790 Commits

Author SHA1 Message Date
Alan Agius
e414d9b44a fix(@angular-devkit/build-angular): generate ES5 code in ES5 bundles for default browserslist configuration 2020-03-05 11:30:23 -08:00
Sachin Grover
14dc4fb818 fix(@angular-devkit/build-angular): allow function in filename while changing the name of compiling chunks
Fixes angular#17087
2020-02-26 12:26:45 -08:00
Alan Agius
94c753c1a5 fix(@angular-devkit/build-angular): limit the amount of CPUs used by workers
See: https://github.com/angular/angular-cli/issues/16860#issuecomment-588828079
2020-02-25 10:28:25 -08:00
Alan Agius
d29d40370a fix(@angular-devkit/build-angular): fix autoprefixer comments support in scss
Change Scss output style to `expanded` as otherwise sass will remove comments that are needed for autoprefixer when webpack is in prod mode because of the following implementation in `sass-loader`:
See: 45ad0be172/src/getSassOptions.js (L68-L70)

Fixes #17041
2020-02-24 12:52:12 -08:00
Alan Agius
4e65705205 fix(@angular-devkit/build-angular): baseHref with protocol and localize option
`posix.join` will dedupe double forward slashes resulting in incorrect protocol.

Closes: #17029
2020-02-24 12:39:47 -08:00
Sachin Grover
764b977de4 fix(@angular/cli): expand locale pattern in all schemas for all cases
Fixes: #17032
2020-02-24 12:39:35 -08:00
Charles Lyding
5bd3b911ce refactor(@angular-devkit/build-angular): use localize babel plugins directly
With recent improvements in the performance of babel parsing and AST traversal, the localize babel plugins can now be leveraged directly.
2020-02-19 10:08:55 -08:00
Filipe Silva
a5bc1cd15b fix(@angular-devkit/build-angular): limit CPUs used by terser-webpack-plugin
Should help with https://github.com/angular/angular-cli/issues/16860#issuecomment-585751187
2020-02-18 12:44:01 -08:00
Jonathan Garvey
d6c9693952 feat(@angular-devkit/build-angular): pass "grep" and "invertGrep"
Pass the "grep" and "invertGrep" flags through to the Angular Protractor
builder as "jasmineNodeOpts" so that individual specs within an E2E test
file can be targeted.

Fixes #13020
2020-02-18 10:53:27 -08:00
EmaGht
2f1a9db872 fix(@angular-devkit/build-angular): Correctly prints the size of the chunk during the build statistic print.
Fixes: #16627
2020-02-13 15:51:48 -08:00
Charles Lyding
5a53b84f96 fix(@angular-devkit/build-angular): insert sourcemap source content when using fast path 2020-02-13 15:50:58 -08:00
Charles Lyding
6091879428 fix(@angular-devkit/build-angular): generate correct filenames when targeting ESNext
Fixes: #16906
2020-02-12 12:01:42 -08:00
Charles Lyding
c5156977f2 fix(@angular-devkit/build-angular): provide explicit return type for extract-i18n builder
Fixes: #16934
2020-02-12 12:01:32 -08:00
Alan Agius
d0ede14918 refactor: remove safari nomodule polyfills as it's unsupported 2020-02-11 08:47:20 -08:00
Charles Lyding
3c771d1b56 fix(@angular-devkit/build-angular): only remove localize polyfill if in AOT mode
Fixes: #16890
2020-02-11 08:46:40 -08:00
Sachin Grover
e5061ef252 fix(@angular-devkit/build-angular): correct maximum budget size message
WARNING in budgets exceeded message showing wrong number

Fixes angular#16871.
2020-02-10 16:05:03 -08:00
Charles Lyding
3595cee14d fix(@angular-devkit/build-angular): resolve webdriver-manager from protractor location
The webdriver-manager package is a direct dependency of protractor.  The only guaranteed method to resolve the webdriver-manager package in this case is to resolve it from a base of the protractor location.
2020-02-06 09:09:21 -08:00
Alan Agius
a2c0532ca7 fix(@angular-devkit/build-angular): provide supported browsers to babel
By default the browserslist `configPath` will default to `process.cwd()`. This might return incorrect data in a multi app workspace setup.

https://babeljs.io/docs/en/babel-preset-env#configpath
2020-02-04 07:29:27 -08:00
Charles Lyding
9c4da54b63 refactor(@angular-devkit/build-angular): remove redundant ES2015 string polyfills 2020-02-04 07:27:33 -08:00
Charles Lyding
878e4473e0 fix(@angular-devkit/build-angular): use translation file in bundle hash calculations
This change ensures that any changes to translation files is represented in the output file names when output hashing is enabled.  This prevents the situation where a translation file only change to an application would result in built files with no change in output name.
2020-02-04 07:26:41 -08:00
Alan Agius
c3aa081ef7 fix(@angular-devkit/build-angular): add crossorigin attribute to lazy chunks
Fixes #16801
2020-02-03 17:29:58 -08:00
Charles Lyding
52a74a841c fix(@angular-devkit/build-angular): remove unneeded regex polyfills 2020-01-30 11:23:40 -08:00
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