468 Commits

Author SHA1 Message Date
Charles Lyding
397ef0590b refactor(@angular-devkit/build-angular): improve debug optimize environment variables
`NG_BUILD_DEBUG_OPTIMIZE` when enabled will disable minify and mangle as well as enable beautify.
2020-01-29 17:12:05 -08:00
Charles Lyding
f85c00ad55 fix(@angular-devkit/build-angular): when optimizing do not emit Ivy class metadata or module scope 2020-01-28 10:47:54 -08:00
Charles Lyding
8a55bc3115 fix(@angular-devkit/build-angular): ensure babel configurations are isolated
The `configFile` option needs to be set to false to ensure Babel does not attempt to discover and load any file based configurations.
2020-01-28 10:35:18 -08:00
Pete Bacon Darwin
9bbc7c785f fix(@angular-devkit/build-angular): pass filename to parseSync
The latest version of Babel (e.g. 7.8.3) requires a filename
to be passed to `parseSync()`.

Fixes #16781
2020-01-28 10:22:43 -08:00
Charles Lyding
d8cd9b73b3 fix(@angular-devkit/build-angular): reintroduce fast sourcemap path 2020-01-27 11:26:20 -08:00
Charles Lyding
5a1b190fdf refactor(@angular-devkit/build-angular): add additional debug build environment variables
`NG_BUILD_MINIFY` can be used to separately disable minification (terser's compress)
`NG_BUILD_BEAUTIFY` can be used to format the output code even when otherwise optimized
2020-01-23 18:00:25 -08:00
Charles Lyding
9a7d8e3877 fix(@angular-devkit/build-angular): ensure output is ASCII only
Fixes: #16721
2020-01-23 18:00:04 -08:00
Alan Agius
237c1dcf2b build: update jest-worker to version 25.1.0 2020-01-23 15:28:37 -08:00
Charles Lyding
d918af3935 refactor(@angular-devkit/build-angular): remove nonexistent argument from rxjs path mapping call
The rxjs path mapping function does not have any parameters and has not since version 5.5.0 which is not supported.
2020-01-21 08:35:45 -08:00
Alan Agius
f1ffb106b2 fix(@angular-devkit/build-angular): emit error when a script is not found
While we currently invoke the `callback` with the error in d4f1ff82c5/packages/angular_devkit/build_angular/src/angular-cli-files/plugins/scripts-webpack-plugin.ts (L163) this is not bubbled up to the main webpack compilation due to the usage of `thisCompilation`.

Closes #16659
2020-01-15 11:31:09 -08:00
Alan Agius
e9897de7ae fix(@angular-devkit/build-angular): change css optimizer from clean-css with cssnano
Closes #16123 and closes #13854
2020-01-13 09:46:15 -08:00
Charles Lyding
b989e4583e fix(@angular-devkit/build-angular): improve quality of differential loading sourcemaps 2020-01-09 12:02:32 -08:00
Alan Agius
653be114ca fix(@angular-devkit/build-angular): replace istanbul-instrumenter-loader with coverage-istanbul-loader
Fixes #16576 and fixes #7117
2020-01-09 11:55:35 -08:00
Alan Agius
4630e03209 fix(@angular-devkit/build-angular): account for hashed and non hashed filesnames when having sourcemaps 2020-01-04 11:19:09 -08:00
Charles Lyding
032fb147f9 fix(@angular-devkit/build-angular): prevent differential loading double sourcemap search
This can drastically reduce memory usage; especially in cases where bundled code modules contain individual sourcemap comments and vendor sourcemaps are disabled.  Enabling the vendor sourcemap option has the side effect of removing all individual module sourcemap comments and as a result removes the potential for those comments to be found and processed.
2020-01-02 11:27:40 -08:00
Alan Agius
490c24be98 fix(@angular-devkit/build-angular): add sourceMappingURL comment for ES2015 during differential loading
When having differential loading enabled we only add the `sourceMappingURL` comment when optimization is enabled, because we only process these bundles when we enabling optimization.

With this change we now process such bundles even when optimization is disabled and add `sourceMappingURL` when source maps are enabled and not hidden.

Closes #16522
2020-01-02 11:27:27 -08:00
Charles Lyding
a5a8cc53bf fix(@angular-devkit/build-angular): optimize web worker differential loading processing
Closes #16441
2019-12-17 11:17:45 -08:00
Charles Lyding
0a1743ec2e revert: fix(@angular-devkit/build-angular): sockPath for custom path
This reverts commit 5260bbb9a3d17aefb90bcf1b660e252996cf68df.

Fixes #16410
Fixes #16266
2019-12-12 10:17:30 -08:00
Doug Parker
982df7e77a fix(@angular-devkit/build-angular): update budgets to check differential builds separately
Fixes #15792.

Previously, budgets would include content for both versions of a differential build. Thus the `initial` budget would count content from the ES5 **and** ES2015 bundles together. This is a very misleading statistic because no user would download both versions. I've updated the budget calculators to take this into account and generate size values for both builds which are then checked independently of each other.

The only calculators I changed are the `InitialCalculator` (for computing `initial` bundle sizes) and `BundleCalculator` (for computing named bundles). Since budgets are handled by Webpack for builds without differential loading, the `initial` bundle will always have those two sizes. The `BundleCalculator` might reference a bundle which does not have differential loading performed (such as a CSS file), so it emits sizes depending on whether or not multiple builds were found for that chunk.

Most of the other calculators don't really need to take differential loading into account. `AnyScriptCalculator` and `AnyCalculator` already apply on a file-by-file basis, so they generate sizes for both build versions already. `AnyComponentStyleCalculator` only applies to CSS which does not have differential builds.

The wierd ones here are `AllCalculator` and `AllScriptCalculator` which reference files with and without differential builds. Conceptually, they should be separated, as a "total" budget specified by an app developer probably wanted it to mean "the total resources a user would have to download", which would only be one differential build at a time. However, I don't see a good way of identifying which assets belong to which differential build. Even if an asset belongs to a chunk with differential builds, we don't know which build takes which assets into account. I decided to leave this for the time being, but it is probably something we should look into separately.

Since budgets take differential loading into account, users might reasonably want to set different budgets for different builds (ie. "initial-es2015 bundle should be capped at 100k, but initial-es5 bundle can go to 150k"). That's more of a feature request, so I also left that out for a future PR.
2019-12-09 15:26:50 -08:00
Doug Parker
6427922415 fix(@angular-devkit/build-angular): remove async files from initial bundle budget.
Refs #15792.

Static files listed in `angular.json` were being accounted in the `initial` bundle budget even when they were deferred asynchronously with `"lazy": true` or `"inject": false`. Webpack belives these files to be `initial`, so this commit corrects that by finding all extra entry points and excluding ones which are explicitly marked by the application developer as asynchronous.

One edge case would be that the main bundle might transitively depend on one of these static files, and thus pull it into the `initial` bundle. However, this is not possible because the files are not present until the end of the build and cannot be depended upon by a Webpack build step. Thus all files listed by the application developer can be safely assumed to truly be loaded asynchronously.
2019-12-09 15:26:50 -08:00
Doug Parker
1792ccaf57 refactor(@angular-devkit/build-angular): move budget computations to be post-build
Refs #15792.

This provides access to all the size information necessary because all build steps have already completed. This commit is roughly a no-op because it simply moves the budget checks (for different builds) to be executed post-build.

The lone exception is the AnyComponentStyle budget. Component stylesheet files are not emitted after the build is completed, so there is no size information to work with. Instead, these budgets are checked during a separate plugin (exected for different builds **and** non-differential builds).
2019-12-09 15:26:50 -08:00
Smartin
c73e28e91c refactor(@angular-devkit/build-angular): export executeExtractI18nBuilder
export executeExtractI18nBuilder for use in custom builders and to be consistent with browser- and dev-server-builder.

no breaking changes, no issue
2019-12-09 13:42:08 -08:00
Charles Lyding
f4bb020b94 fix(@angular-devkit/build-angular): ensure source locale data is injected when localizing
Fixes #16389
2019-12-09 13:40:50 -08:00
Alan Agius
f1985e1315 fix(@angular-devkit/build-angular): resolve @babel/preset-env
This is needed as otherwise under Bazel we hit `Cannot find module '@babel/preset-env` we use `require.resolve` since this is always patched under Bazel.
2019-12-09 13:39:35 -08:00
Alan Agius
41c63ea871 fix(@angular-devkit/build-angular): add symlinks option to resolveLoader
This is needed as otherwise under Bazel it will fail with `Angular Compiler was detected but it was an instance of the wrong class.` when not using the linker since node_modules will be linked to `external/npm`. Under Bazel `preserveSymlinks` is to be set to true, however with the current behaviour this doesn't effect resolveLoader.
2019-12-09 13:39:35 -08:00
Charles Lyding
713f95d678 fix(@angular-devkit/build-angular): localize service worker base href 2019-12-09 13:39:06 -08:00
Alan Agius
cae943d7e6 fix(@angular-devkit/build-angular): add notice when using bundleDependencies: none with Ivy
Related to: https://github.com/angular/universal/issues/1354
2019-12-09 13:38:34 -08:00
Doug Parker
59c9802d26 fix(@angular-devkit/build-angular): suppress duplicate 3rdpartylicenses.txt warning
Refs #16193

This detects and filters out error messages about duplicate 3rdpartylicenses.txt. This is a short-term fix intended to get us to 9.0.x release while a follow up effort will work to properly fix this bug. Left a TODO to remove this filter once a fix is ready.
2019-12-05 18:55:15 -08:00
Alan Agius
302a9f325c refactor(@angular-devkit/build-angular): don't add a SourceMapDevToolPlugin when sourcemaps are disabled 2019-12-05 18:53:08 -08:00
Alan Agius
0659cf09e3 fix(@angular-devkit/build-angular): add externalDependencies to server builders
Certain node packages depend on native bindings which cannot be bundled, with this fix we add a way to exclude these from being processed by the bundler.

Closes: #16348
2019-12-05 18:53:08 -08:00
Alan Agius
0a7ace3595 fix(@angular-devkit/build-angular): allow bundleDependencies to be a boolean 2019-12-05 18:53:08 -08:00
Alan Agius
4f19e36dc9 refactor: deprecated unused server builder options 2019-12-05 18:52:27 -08:00
Charles Lyding
c37eaeec43 fix(@angular-devkit/build-angular): augment base HREF when localizing
All locale i18n options now support an object form which allows a base HREF to be defined for the locale.  Each locale can now optionally define a custom base HREF that will be combined with the base HREF defined for the build configuration.  By default if the shorthand form for the locale is used or the field is not present in the longhand form, the locale code will be used as the base HREF.  To disable automatic augmentation a base HREF value of an empty string (`""`) can be used.  This will prevent anything from being added to the existing base HREF.

For common scenarios, the shorthand form will result in the preferred and recommended outcome of each built locale variant of the application containing a defined base HREF  containing the locale code.
2019-12-04 08:14:16 -08:00
Charles Lyding
1d79b28c17 fix(@angular-devkit/build-angular): support differential loading for web workers
Fixes #16275
2019-12-02 10:19:38 -08:00
Charles Lyding
09a7d87f00 fix(@angular-devkit/build-angular): ensure HTML lang attribute is set when localizing 2019-12-02 10:17:57 -08:00
Alan Agius
d155c7c804 fix(@angular-devkit/build-webpack): allow runWebpackDevServer to accept a webpackDevServerFactory 2019-12-02 10:16:08 -08:00
Alan Agius
2960a71807 fix(@angular-devkit/build-angular): pass webpack factor to runWebpackDevServer 2019-12-02 10:16:08 -08:00
Charles Lyding
ef7748524c fix(@angular-devkit/build-angular): make i18n translation files relative to workspace
All other paths within the workspace file are relative to the workspace root.
2019-11-26 13:08:29 -08:00
Alan Agius
02c50fbd6a refactor(@angular-devkit/build-angular): deprecate karma environment option
This option is unused and has no effect
2019-11-26 13:07:42 -08:00
Alan Agius
07801363a6 fix(@angular-devkit/build-angular): add pattern validations for browserTarget and serverTarget 2019-11-26 13:07:13 -08:00
Charles Lyding
3d5a5a97a4 fix(@angular-devkit/build-angular): enable dynamic import parsing with serve localization
Fixes #16248
2019-11-26 13:05:30 -08:00
Charles Lyding
adb4139b80 fix(@angular-devkit/build-angular): cache localize results with development server 2019-11-26 13:05:30 -08:00
FDIM
2c0efd834b fix(@angular-devkit/build-angular): mocked context in single test transform matches webpack API 2019-11-23 10:35:45 +02:00
Greg Magolan
a4200a0f04 refactor(@angular-devkit/build-angular): allow @angular/core version 0.0.0
Allow version "0.0.0" for integration testing in the angular/angular repository with the generated development @angular/core npm package which is versioned "0.0.0".
This is a pre-req for https://github.com/angular/angular/pull/33927 which runs integration tests against the bazel generated npm packages.
2019-11-22 22:36:31 +01:00
Charles Lyding
cfc0aa4780 fix(@angular-devkit/build-angular): properly process es2016+ targets with differential loading
A target of es2015 was previously assumed when using differential loading.  This could result in erroneously downleveling an es2016+ output file instead of generating a new es5 output file.
2019-11-20 13:21:58 -08:00
Igor Minar
17792c46b3 fix(@angular-devkit/build-angular): update link to update.angular.io
This link is rarely seen by developers but when they do see it, they should get the real one.
2019-11-20 08:51:21 -08:00
Charles Lyding
d8438f7ad1 fix(@angular-devkit/build-angular): prevent webpack from adding suffixes to polyfills files
The ES5 polyfills file was erroneously being suffixed with `es2015`.  The webpack configuration does not support conditional customization per chunk for the output filenames (`chunkFilename` option schema only supports string values).  This change adds an additional small webpack plugin that allows the chunk filenames to be adjusted based on the chunk name.  The plugin is only added when differential loading is enabled as this is the only time that a chunk currently requires its filename to be adjusted.

Closes #15915
2019-11-18 10:55:53 -08:00
Charles Lyding
798790622d fix(@angular-devkit/build-angular): allow new i18n options to work with VE 2019-11-18 10:54:35 -08:00
Charles Lyding
04cb2ac17b fix(@angular-devkit/build-angular): support global locale data with development server 2019-11-15 10:42:18 -08:00
Charles Lyding
9c682b7c04 refactor(@angular-devkit/build-angular): re-enable multi-localize support 2019-11-15 10:42:18 -08:00