2917 Commits

Author SHA1 Message Date
Alan Agius
f3c0c98fbd Revert "feat(@angular-devkit/build-angular): disable critical CSS inlining by default"
This reverts commit bf0709b14c1f0d47af77a64e586a5d4564b75766.
2021-10-21 03:24:36 -05:00
Alan Agius
ba54a8d2d8 test: update css minification spec to match new Esbuild output
For more context see https://github.com/evanw/esbuild/blob/master/CHANGELOG.md#%E2%80%8B0137
2021-10-19 12:01:08 -04:00
Renovate Bot
80b026c051 build: update all non-major dependencies 2021-10-19 12:01:08 -04:00
Charles Lyding
0780e63c2d refactor(@angular-devkit/build-webpack): reduce complexity of get emitted files helper function
The deduplication logic is now inline with the chunk and asset iteration and is checked via a Set instead of a follow-up step.
2021-10-19 10:09:10 -04:00
Charles Lyding
f44cb908c3 refactor(@angular-devkit/build-angular): eagerly remove used i18n temporary files
Temporary JavaScript application files that have been queued for i18n processing are now removed immediately after reading their content. This reduces the on-disk size of temporary files as well as reduces the needed disk access during the final asset copy phase of the i18n inlining process. Additional debug logging has also been added to the i18n inlining process which can be enabled via the `NG_DEBUG=1` environment variable.
2021-10-19 10:09:10 -04:00
Alan Agius
da1733cc69 fix(@angular-devkit/build-angular): transform remapped sourcemap into a plain object
`remapping` will return a SourceMap which it's prototype is not a simple object. This causes Babel to fail when it invoked from `istanbul-lib-instrument` because Babel with `don't know how to turn this value into a node` error as Babel will not process not simple objects.

See: 780aa48d2a/packages/babel-types/src/converters/valueToNode.ts (L115-L130)

Closes #21967
2021-10-19 09:33:14 -04:00
Alan Agius
1dac761f56 fix(@angular-devkit/build-angular): generate unique webpack runtimes
Currently, using 2 Angular applications from the same workspace on the same page causes a conflict because both of the webpack runtime chunks naming are the same.

With this change we configure the runtime chunk name to be inferred from the project name. This also results in reducing unnecessary file reads which Webpack needs to do to infer the name from the workspace package.json.

For more information about this option see: https://webpack.js.org/configuration/output/#outputuniquename

Closes #21957
2021-10-19 09:30:07 -04:00
Extacy
08fb32eb5e fix(@angular-devkit/build-angular): add "Failed to compile" message
Add missing "Failed to compile" message when the webpack build is not
successful. This is useful for [background problem matchers](https://code.visualstudio.com/docs/editor/tasks#_background-watching-tasks).
Previously, it was not possible to tell using a regular expression when
the compiler has stopped when there was an error, as no message was
printed.
2021-10-19 09:29:40 -04:00
Ruslan Lekhman
ef45c7543b refactor(@angular-devkit/build-angular): consistent import from webpack style 2021-10-15 09:57:27 -04:00
Renovate Bot
167706a5d7 build: update all non-major dependencies 2021-10-14 12:55:20 -04:00
Alan Agius
079ef070c9 refactor(@angular-devkit/build-angular): replace Ivy Enabled analytics dimension with AOT Enabled
The motivation behind this change is that since version 12, application are always built using Ivy, in addition to this, adding AOT as dimension might be  helpful in our decision process if we want to remove JIT.
2021-10-13 21:03:50 +02:00
Alan Agius
cd000d283e test(@angular-devkit/core): address lint issues 2021-10-13 16:50:37 +02:00
Renovate Bot
7c0ae75add build: update all non-major dependencies 2021-10-13 10:56:08 +02:00
Renovate Bot
c5936a7836 build: update dependency typescript to v4.4.4 2021-10-13 10:55:22 +02:00
Kristiyan Kostadinov
b776d8d0d7 fix(@angular-devkit/schematics): handle zero or negative length removals in update buffer
This came up while fixing an issue in a Framework migration (https://github.com/angular/angular/pull/43776/files#diff-365738677fa9dfb9fb2c4fac7c75addb58e5a35182603e722e736cc3f24bbf5bR55). The `UpdateBuffer` stops recording changes if a removal with a zero length occurs. This doesn't appear to be an issue with `UpdateBuffer2`, but considering that the former is still being used and that the fix is trivial, I decided to proceed with it.

I've also aligned the behavior between `UpdateBuffer` and `UpdateBuffer2` when dealing with negative removals.
2021-10-11 10:24:01 +02:00
Renovate Bot
32e644518b build: update all non-major dependencies 2021-10-11 10:22:59 +02:00
Alan Agius
a169f26513 refactor(@angular-devkit/core): use chokidar types instead of custom interface
Replace `ChokidarWatcher` with types from `chokidar`
2021-10-09 07:04:18 +02:00
Alan Agius
1b3a5429b0 fix(@angular-devkit/core): add missing option peer dependency on chokidar 2021-10-09 07:04:18 +02:00
Alan Agius
81531d1b64 fix(@schematics/angular): remove target and lib options for library tsconfig
The `target` option is set directly in ng-packagr binary and cannot be overridden, while the `lib` option is inherited from the root level tsconfig.
2021-10-08 14:40:54 +02:00
Renovate Bot
7c2119e48a build: update all non-major dependencies 2021-10-08 10:32:47 +02:00
Alan Agius
94c00afbf3 fix(@schematics/angular): don't export renderModuleFactory from server file
Using `renderModuleFactory` is no longer needed since this was used for ViewEngine.
2021-10-07 18:50:54 +02:00
Alan Agius
9a3b63766a refactor(@angular-devkit/build-angular): remove redundant require.resolve for @angular/service-worker
This was mainly done prior to the introduction of optional peer dependencies.
2021-10-07 17:34:19 +02:00
Charles Lyding
5dba8a22b1 test(@angular-devkit/build-angular): disable Webpack caching during harness-based unit tests
The default set of metadata fields provided to all builders executed via the BuilderHarness is controlled programmatically. The BuilderHarness is eventually intended to operate in-memory and without file system access unlike the legacy unit tests. The `cli.cache.enabled` option must therefore be set within the BuilderHarness initialization code. `cli.cache.enabled` set to false provides improved test isolation guarantees by disabling Webpack’s caching.
2021-10-07 17:33:14 +02:00
Renovate Bot
6bcbc77b91 build: update all non-major dependencies to v7.15.8 2021-10-07 08:50:01 +02:00
Alan Agius
64ca38bda5 test(@angular-devkit/build-webpack): disable webpack cache during unit tests
Unit tests are not isolated and therefore using cache might be flakey due to race conditions.
2021-10-06 19:11:47 -04:00
Charles Lyding
93ae204047 test(@angular-devkit/build-angular): correctly disable caching in unit-tests
The unit-tests where intended to not use build caching to better ensure test isolation. However, the configuration format was incorrect and did not disable the build caching.
2021-10-06 19:10:24 -04:00
Charles Lyding
d7af4a7b53 fix(@angular-devkit/build-angular): enable custom es2020 and es2015 conditional exports
By adding the `es2020` and `es2015` condition names, the build process will now use ES2020 or ES2015 specific files if a package's exports entries contain files for either of those conditions. This allows packages to provide multiple variants of the code that the bundler can then use based on the bundler's configuration. As of Angular v13, ES2020 code is preferred. However, some packages may prefer to export other variants by default but provide an `es2020`/`es2015` condition to allow other variants if requested.
The server configuration is intentional not altered since the server output executes on Node.js and should use the `node` condition which is automatically added by Webpack based on the output target.
2021-10-06 19:10:24 -04:00
Doug Parker
5e435ff377 docs: mark @angular-devkit/build-optimizer as deprecated.
DEPRECATED: `@angular-devkit/build-optimizer`

It's functionality has been included in `@angular-devkit/build-angular` so this package is no longer needed by the CLI and we will stop publishing the package soon. It has been an experimental (never hit `1.0.0`) and internal (only used by Angular itself) package and should be not be used directly by others.
2021-10-06 14:34:59 -05:00
Alan Agius
bf0709b14c feat(@angular-devkit/build-angular): disable critical CSS inlining by default
With this change we disable critical css inline by default. The main motivations are the following issues #20760 and #20864.

BREAKING CHANGE:

Inlining of critical CSS is no longer enable by default. Users already on Angular CLI version 12 and have not opted-out from using this feature are encouraged to opt-in using the browser builder `inlineCritical` option.

The motivation behind this change is that the package used to parse the CSS has a number of defects which can lead to unactionable error messages when updating to Angular 13 from versions priors to 12. Such errors can be seen in the following issue #20760.

```json
"configurations": {
  "production": {
    "optimization": {
      "styles": {
        "inlineCritical": true,
      }
    },
    ...
  }
```
2021-10-06 14:34:11 -05:00
Alan Agius
585adacd06 fix(@schematics/angular): don't add destroyAfterEach in newly generated spec files
This is now enabled by default.

See https://github.com/angular/angular/pull/43353 for more context.
2021-10-06 14:33:42 -05:00
Alan Agius
7ff8c5350e feat(@schematics/angular): add /.angular/cache to .gitignore
With this change we add `/.angular/cache` to `.gitignore`. This folder will primary be used to store the build disk cache artifacts.
2021-10-06 08:02:22 -05:00
Alan Agius
5904afd1de feat(@angular-devkit/build-angular): enable disk cache by default and provide configurable options
Persistent disk build cache is now enabled by default. A number of options have been added to allow fine tuning of the cache.

The options can be configuration in `cli.cache` section in the `angular.json` as shown below.

- `enabled`: Configure whether disk caching is enabled. Defaults to `true`
- `environment`: Configure in which environment disk cache is enabled. Valid values `ci`, `local` or `all`. Defaults to: `local`
- `path`: cache base path. Defaults to `.angular/cache`

DEPRECATED: `NG_BUILD_CACHE` environment variable option will be removed in the next major version. Configure `cli.cache` in the workspace configuration instead.

BREAKING CHANGE:  `NG_PERSISTENT_BUILD_CACHE` environment variable option no longer  have effect. Configure `cli.cache` in the workspace configuration instead.

```json
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "cli": {
    "cache": {
      "enabled": true,
      "path": ".custom-cache-path",
      "environment": "all"
    }
  }
  ...
}
```
2021-10-06 08:02:22 -05:00
Alan Agius
09e039500f feat(@angular-devkit/architect): include workspace extensions in project metadata 2021-10-06 08:02:22 -05:00
Renovate Bot
96600f55d7 build: update dependency license-webpack-plugin to v3 2021-10-06 06:12:25 -05:00
Renovate Bot
a5dadc5f71 build: update all non-major dependencies 2021-10-06 06:12:13 -05:00
Charles Lyding
248ed4864e refactor(@angular-devkit/build-angular): remove unneeded @angular/core System.import workarounds
With the removal of support for the string form of `loadChildren` within the Angular router, the usage of `System.import` has also been removal from `@angular/core`. This removal allows for the additional removal of all workarounds within the Angular CLI due to the `System.import` usage. Webpack's deprecated support for `System.import` was previously required to be enabled which resulted in warnings that then needed to be suppressed. A Webpack context dependency replacement was also previously required to prevent Webpack from failing due to the otherwise unknown behavior of the `System.import` call. All of these workarounds have now been removed.
2021-10-06 06:11:36 -05:00
Charles Lyding
a54e5e0655 fix(@angular-devkit/core): support Node.js v16 with NodeJsSyncHost/NodeJsAsyncHost delete operation
The `NodeJsSyncHost`/`NodeJsAsyncHost` classes' `delete` method uses `fs.rmdirSync`/`fs.rmdir` to delete directories. However, Node.js v16's `fs.rmdirSync`/`fs.rmdir` will now throw an `ENOENT` error if the path does not exist. `fs.rmSync`/`fs.rm` is now the preferred option when using Node.js v16 but since this function is not available on Node.js v12 both are tried with `fs.rmSync`/`fs.rm` given preference.
Once Node.js 12 support is dropped, the `delete` method could potentially be refactored to avoid the `isDirectory` check and only use `fs.rmSync`/`fs.rm` which supports both files and directories.
2021-10-06 06:11:09 -05:00
Charles Lyding
f10a828336 fix(@angular-devkit/build-angular): improve fidelity and performance of babel loader sourcemaps
This change uses the `@ampproject/remapping` package to merge sourcemaps generated from the customized babel loader used to perform the partial compilation linking in applications as well as other optimization and downleveling transformations. This provides more accurate output mapppings as well as improved performance and lower memory usage when source maps are enabled within a build.
2021-10-06 06:10:57 -05:00
Alan Agius
b715e73957 test(@angular-devkit/build-angular): update shared lazy modules spec file path 2021-10-05 11:38:20 -04:00
Alan Agius
75fddc9b13 test(@angular-devkit/build-angular): workaround for rxjs 6 directory imports
rxjs 6 requires directory imports which are not support in ES modules. Disabling `fullySpecified` allows Webpack to ignore cases such as this until the package can be updated to use package exports.
2021-10-05 11:38:20 -04:00
Alan Agius
7930b50388 build: update ng-packagr to version 13.0.0-next.6 2021-10-05 11:38:20 -04:00
Alan Agius
e11209591a refactor(@angular-devkit/build-angular): use @angular/localize/tools entry-point 2021-10-05 11:38:20 -04:00
Charles Lyding
4be6537ddf fix(@angular-devkit/build-angular): update TS/JS regexp checks to latest extensions
The regular expressions based checks for TypeScript and JavaScript files used by Webpack module rules have been updated to include all current extension variations.
JavaScript files can be either `.js`, `.mjs`, or `.cjs`. TypeScript files as of the upcoming version 4.5 can be either `.ts`, `.mts`, or `.cts`.
Also while not officially supported by Angular, the TypeScript compiler can attempt to process any of the previous extensions with an `x` suffix which indicates a JSX/TSX file.
2021-10-05 04:44:24 -05:00
Alan Agius
22cd9edfaf feat(@angular-devkit/build-angular): favor es2020 main fields
APF version 13 will include es2020, with this change we favor es2020 entrypoints.
2021-10-01 14:08:14 -05:00
Alan Agius
000b0e51c1 feat(@angular-devkit/build-angular): remove deprecated dev-server options
BREAKING CHANGE: With this change a number of deprecated dev-server builder options which proxied to the browser builder have been removed. These options should be configured in the browser builder instead.

The removed options are:
- `aot`
- `sourceMap`
- `deployUrl`
- `baseHref`
- `vendorChunk`
- `commonChunk`
- `optimization`
- `progress`
2021-10-01 14:07:42 -05:00
Paul Gschwendtner
f383f3201b fix(@angular-devkit/build-angular): ESM-interop loaded plugin creators of @angular/localize/tools not respected
This is a follow-up to fb210e5b747ce0351dd9ee7d482770b9cfa71133 which
added support for the ESM-variant of the `@angular/localize` package,
and also prepared for the `tools/` secondary entry-point we will expose
as of v13.

Unfortunately this change currently does not pass-through the ESM-loaded
plugin creators as the option (which is passed to the Babel plugin) is
incorrect. This was hidden due to a type cast. This commit fixes the
issue and also ensures TS would complain in the future if the option
names differ.
2021-09-30 06:57:01 -04:00
Renovate Bot
1a8d0d0af5 build: update all non-major dependencies 2021-09-29 15:36:38 -04:00
Alan Agius
4e0743c8ad perf(@angular-devkit/build-angular): change webpack hashing function to xxhash64
`xxhash64` uses a faster WASM based hash mechanism.
2021-09-29 11:33:56 -04:00
Alan Agius
884111ac0b fix(@angular-devkit/build-angular): update IE unsupported and deprecation messages
IE 11 is no longer supported.
2021-09-29 09:22:11 -04:00
Alan Agius
9c924a4c24 build: update to TypeScript 4.4 2021-09-28 09:35:19 -04:00