2684 Commits

Author SHA1 Message Date
Alan Agius
ab17b1721c fix(@angular-devkit/build-angular): handle ng-packagr errors more gracefully.
Ng-packagr will throw an error when a compilation fails.
2021-06-21 11:11:09 +01:00
Renovate Bot
b3c333aafd build: update dependency less-loader to v10 2021-06-18 11:19:47 +01:00
Renovate Bot
b2a4cb013e build: update dependency typescript to v4.3.3 2021-06-17 12:55:03 -04:00
Renovate Bot
8c4c464f5c build: update all non-major dependencies 2021-06-17 09:43:33 -04:00
Alberto Calvo
0fe6cfef64 fix(@angular-devkit/build-angular): use the name as chunk filename instead of id 2021-06-16 08:15:38 -04:00
Renovate Bot
3dbd3e3242 build: update all non-major dependencies 2021-06-16 08:00:05 -04:00
Renovate Bot
ddd2c9f671 build: update all non-major dependencies 2021-06-15 07:30:11 -04:00
Renovate Bot
4409998826 build: update all non-major dependencies 2021-06-14 08:03:27 -04:00
Charles Lyding
b3d7080147 build: enable esModuleInterop TypeScript option
The `esModuleInterop` option is recommended to be enable by TypeScript and corrects several assumptions TypeScript would otherwise make when importing CommonJS files.
This option change helps ensure compatibility as packages move towards ESM.
Reference: https://www.typescriptlang.org/tsconfig#esModuleInterop
2021-06-13 11:45:55 -04:00
Alan Agius
528b7f182e refactor(@angular-devkit/build-angular): extract webpack configurations from browser builder 2021-06-11 17:20:50 -04:00
Alan Agius
f90a8324b4 perf(@angular-devkit/build-angular): enable opt-in usage of file system cache
With this change we enable Webpack's filesystem cache, this important because `terser-webpack-plugin`, `css-minimizer-webpack-plugin` and `copy-webpack-plugin` all use Webpacks' caching API to avoid additional processing during the 2nd cold build.

This changes causes `node_modules` to be treated as immutable. Webpack will avoid hashing and timestamping them, assume the version is unique and will use it as a snapshot.

To opt-in using the experimental persistent build cache use the`NG_PERSISTENT_BUILD_CACHE` environment variable.

```
NG_PERSISTENT_BUILD_CACHE=1 ng serve
```
2021-06-11 12:11:49 -04:00
Alan Agius
83602515fa fix(@angular-devkit/build-angular): explicitly set compilation target in test configuration
When not set, and browserslist returns no reesults due to the file being empty or commented. Webpack will generate invalid code because it doesn't know which enviorment we want to target.

```diff
- (self["webpackChunktest_app"] = self["webpackChunktest_app"] || []).push([["vendor"],{

/***/ 8583:
```

Closes #21111
2021-06-11 09:51:25 -04:00
Alan Agius
071c8d10ce fix(@angular-devkit/build-angular): don't parse new Worker syntax when webWorkerTsConfig is not defined in karma builder
This is to retain version 11 behaviour.

Closes #21108
2021-06-11 09:42:25 -04:00
Alan Agius
cc4afa2de6 refactor(@angular-devkit/build-angular): ignore postcss-loader warning
Users should not install `postcss` in their workspace as this is a dependency of `@angular-devkit/build-angular`.
2021-06-11 09:24:48 -04:00
Renovate Bot
7d57e5ae81 build: update dependency postcss-loader to v6 2021-06-11 09:16:06 -04:00
Renovate Bot
b17937a00d build: update all non-major dependencies 2021-06-11 09:15:12 -04:00
Renovate Bot
8624680036 build: update all non-major dependencies 2021-06-10 18:13:08 +02:00
Charles Lyding
b35ef57b0f feat(@angular-devkit/build-angular): suppport using TypeScript 4.3
With the support of TypeScript 4.3 within the Angular framework, the CLI now supports using TypeScript 4.3 as well.  TypeScript 4.2 also continues to be supported for existing projects.
2021-06-10 17:34:02 +02:00
Alan Agius
1dd3bda57f test: fix failing tests which were not shown
Previously when an unhandled error occured Bazel would mark the suit as passed instead of failed.

See: https://togithub.com/bazelbuild/rules_nodejs/commit/3c4ef58
2021-06-10 16:25:19 +02:00
Alan Agius
a30525b68b fix(@angular-devkit/schematics): handle updating renamed files
With this change we fix an issue which caused a file not found error when trying to modify the file after it was renamed.

Closes #14255 and closes #21083
2021-06-09 19:59:45 +02:00
Alan Agius
dc5a58528a fix(@angular-devkit/build-angular): styles CSS files not available in unit tests
With this change we force styles to be extracted in css files during unit tests.

Closes #21054
2021-06-09 08:00:58 +02:00
Alan Agius
fe1825ae38 test: refactor karma tests to use test harness 2021-06-09 08:00:58 +02:00
Renovate Bot
137bbb7b49 build: update all non-major dependencies 2021-06-08 12:30:32 +02:00
Alan Agius
c43ace7383 fix(@angular-devkit/build-angular): add web-workers in lazy chunks in stats output
Web-workers are not marked as `initial` since their initialization can be guarded.

Closes #21059
2021-06-07 19:29:58 +02:00
Alan Agius
2d0d82ba5b fix(@angular-devkit/build-angular): correctly mark async chunks as non initial in dev-server 2021-06-07 17:09:49 +02:00
Alan Agius
699802d488 perf(@angular-devkit/build-angular): reduce memory usage by cleaning output directory before emitting
Unless `deleteOutputPath` is false, we should clean, this helps reduce assets in tests.
2021-06-07 17:09:27 +02:00
Renovate Bot
c68492797f build: update dependency webpack-merge to v5.8.0 2021-06-07 12:45:36 +02:00
Renovate Bot
9a4b55aa91 build: update all non-major dependencies 2021-06-06 19:07:02 +02:00
Charles Lyding
1168edb8d1 refactor(@angular-devkit/build-angular): add a loose mode for build optimizer enum pass
The `adjust-typescript-enums` plugin now includes an optional loose mode. This mode generates less code for an adjusted enum but differs from the canonical TypeScript enum structure emitted by the TypeScript compiler. This mode is only enabled for packages validated to operate correctly with this structure and is currently limited to first-party Angular packages. The adjusted structure is a variation of the previous build optimizer pass structure but better reflects the runtime behavior of the TypeScript emit structure.
2021-06-04 21:10:06 +02:00
Charles Lyding
5bdd1cbbb7 refactor(@angular-devkit/build-angular): enable babel build optimizer passes for ES2015+ targets
The new babel-based build optimizer passes are now enabled when targetting ES2015 and higher. ES5 targets will currently continue to use the previous build optimizer. ES5 support will require additional refactoring of the downlevelling process as the new build optimizer passes are designed for ES2015 code.
2021-06-04 21:10:06 +02:00
Charles Lyding
f277d951ed refactor(@angular-devkit/build-angular): convert build optimizer passes to babel plugins
The build optimizer passes that are still relevant for Ivy are now implemented as babel plugins.  Using babel has several advantages.  The `babel-loader` is already present within the build pipeline and many packages will already need to be processed by it.  The `babel-loader` also provides the necessary infrastructure to setup babel and link it to the Webpack build system.  This removes the need for the infrastructure code within the build optimizer loader and reduces the build optimizer to only a set of transformation plugins for babel to consume.  The babel plugin architecture also allows for less code to represent similar transformations and provides a variety of helper utilities which further reduces the amount code needed.
The passes are now implemented to be safer when transforming code.  Enum values which contain potential side effects are also no longer altered.  Enums are wrapped in less destructive manner which reduces the likelihood of incorrectly emitting the transformed enum. Class static fields which contain potential side effects are no longer wrapped in pure annotated IIFEs.  Known safe Angular static fields are also wrapped and Angular static fields which are not required in production code are also dropped.
The conversion of the passes not only reduces the amount of code to maintain but also provides a noticeable performance improvement.  Initial tests of a production build of AIO resulted in a ~10% total build time reduction.

Closes #12160
2021-06-04 21:10:06 +02:00
Alan Agius
bd82967523 fix(@angular-devkit/build-angular): show progress during re-builds
With the recent changes in https://github.com/angular/angular-cli/pull/20960 we moved the spinner to be started outside of the progress callback, this causes a side-effect that after `succeed` is called the spinner will stop reporting progress unless it is started again.
2021-06-04 17:55:41 +02:00
Alan Agius
c0106f6e3a refactor(@angular-devkit/build-angular): remove usage of rimraf package
Use Node.JS `rmdirSync` instead.
2021-06-04 15:37:10 +02:00
Charles Lyding
1dd5c28f8d fix(@angular-devkit/build-angular): dispose Sass worker resources on Webpack shutdown
Sass Worker instances and resource requests are now cleaned up when the Webpack compiler is shutdown. This removes the need to unreference the workers upon creation.

Fixes #20985
2021-06-04 08:35:02 +02:00
Charles Lyding
11a414e468 fix(@angular-devkit/build-angular): ensure all Webpack Stats assets are present on rebuilds
Webpack will only provide emitted assets in the returned Stats each rebuild unless the `cachedAssets` option is enabled. This is currently needed for the bundle budget calculations.

Fixes #21038
2021-06-03 22:11:33 +02:00
Alan Agius
3a287beab3 refactor: remove left over webpack version 4 code 2021-06-03 15:12:23 +02:00
Alan Agius
8a8384b70a build: update peerDependencies to support ^12.1.0-next 2021-06-03 13:44:07 +02:00
Renovate Bot
50d405245c build: update dependency webpack-dev-middleware to v5 2021-06-03 10:03:48 +02:00
Renovate Bot
8ca3c2d315 build: update all non-major dependencies 2021-06-03 08:07:59 +02:00
Alan Agius
023d0937c4 perf(@angular-devkit/build-webpack): include only required stats in webpackStats
Until we depend on `webpackStats` in the browser builder we should only included the required stats.

The below are the needed stats;
```
    all: false,
    colors: true,
    hash: true,
    timings: true,
    chunks: true,
    builtAt: true,
    warnings: true,
    errors: true,
    assets: true,
    ids: true,
    entrypoints: true,
```
2021-06-02 18:25:58 +02:00
Alan Agius
2e007b7fe0 refactor(@angular-devkit/build-angular): update SASS worker to provide fromImport.
Since sass 1.33.0, an importer can determine whether it’s being called from an `@import` rule by checking `this.fromImport`. This API, is now being used by `sass-loader` version 12.
2021-06-02 17:17:43 +02:00
Renovate Bot
85e8b59d74 build: update dependency sass-loader to v12 2021-06-02 17:17:43 +02:00
Alan Agius
a41f2ed85c docs(@angular-devkit/build-angular): update includePaths description 2021-06-02 09:17:19 +02:00
why520crazy
966c0aebbc fix(@angular-devkit/core): transform path using getSystemPath for NodeJsAsyncHost's exists method 2021-06-02 09:16:19 +02:00
Renovate Bot
0553de187c build: update all non-major dependencies 2021-06-02 09:16:03 +02:00
Alan Agius
494cca6426 build: update Webpack to version 5.38.1
With this change we update to `webpack` to `5.38.1`, this also updates `webpack-sources` to `2.3.0`, The latter is causing OOM errors on our CI, but it in real projects the memory usage only increased by a small fraction. Also, the OOM errors don't manifest themselves when the entire test suit is run locally.

Therefore with this change we also disable sourcemap genertation for most of the browser builds to speed up the tests and reduce memery usage.
2021-05-31 12:49:55 +01:00
Charles Lyding
92c9be44fa fix(@angular-devkit/build-angular): correctly ignore inline styles during i18n extraction
Stylesheets are not processed during i18n extraction to improve performance and the rules to support them are intentionally not present.
2021-05-31 12:48:55 +01:00
Alan Agius
f209cb5545 test(@angular-devkit/core): update host tests to not use deprecated Jasmine behaviour
```
DEPRECATION: An asynchronous before/it/after function was defined with the async keyword but also took a done callback. This is not supported and will stop working in the future. Either remove the done callback (recommended) or remove the async keyword.
```
2021-05-31 12:48:18 +01:00
Alan Agius
06af7d7e7b fix(@angular-devkit/core): handle async schema validations 2021-05-31 12:48:18 +01:00
Alan Agius
9f85bc5625 fix(@angular-devkit/core): handle complex smart defaults in schemas 2021-05-31 12:48:18 +01:00