This change replaces the remaining usage of `makeTransform` with the usage of TypeScript AST helpers directly instead. This allows for the reduction in the number of AST walks necessary to transform the application's files.
The `elideImports` function's unit tests now directly test the function instead of relying on the `makeTransform` abstraction.
This change more closely reflects the current usage of `elideImports`.
In Webpack 5, the Webpack callback must be used when Webpack is running in watch mode.
Related warning
```
.(node:6565) [DEP_WEBPACK_WATCH_WITHOUT_CALLBACK] DeprecationWarning: A 'callback' argument need to be provided to the 'webpack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.
```
Webpack 5 now uses a `chunkHash` hook that is accessible from `JavascriptModulesPlugin.getCompilationHooks()`. The `hashForChunk` hooks have been deprecated in Webpack 5.
The `inlineStyleLanguage` option should be set for an application's server target if also present in the application's build target. The setting is needed to ensure the server target properly builds the applica
tion's styles.
The `style` option for the application schematic specifies the language/preprocessor to use for the application's external style files and should also setup the default for inline styles as well via the `inlineStyleLanguage` build option. The value can be adjusted after application generation if needed.
TypeScript files had the potential to be processed twice by the build optimizer. This did not affect the output code but could lead to longer production build times. The build optimizer is now configured in one centralized location for both TypeScript and JavaScript files. The Webpack configuration partial for TypeScript support is also reduced to one common function for both AOT and JIT as a result.
This is needed as currently this breaks lock file maintenance Renovate PR https://github.com/angular/angular-cli/pull/20107 due to quicktype-core has an unspecified dependency on lodash.
```
bazel-out/host/bin/tools/quicktype_runner.sh packages/angular_devkit/build_angular/src/app-shell/schema.json bazel-out/k8-fastbuild/bin/packages/angular_devkit/build_angular/src/app-shell/schema.ts)
Execution platform: //tools:rbe_ubuntu1604-angular
Error: Cannot find module 'lodash'. Please verify that the package.json has a valid "main" entry
at Function.module.constructor._resolveFilename (/b/f/w/bazel-out/host/bin/tools/quicktype_runner.sh.runfiles/angular_cli/tools/quicktype_runner_require_patch.js:480:17)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/b/f/w/bazel-out/host/bin/tools/quicktype_runner.sh.runfiles/npm/node_modules/quicktype-core/dist/language/Dart.js:14:18)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
INFO: Elapsed time: 81.607s, Critical Path: 8.94s
```
With this change we consider the update schematics are idempotent. When updating from or between prereleases we will execute all migrations for the version.
`tsickle` doesn't be a dependency in users projects, if it is most certain it will cause updates to fail due to mismatching peer dependency on TypeScript.
Webpack 5 now includes web worker support. However, the structure of the URL within the `Worker` constructor must be in a specific format.
A migration has been added for Angular v12 that will convert web workers from the old structure to the new structure.
Before: `new Worker('./app.worker', ...)`
After: `new Worker(new URL('./app.worker', import.meta.url), ...)`
While the builders when executed via the Angular CLI and their associated options are considered stable, the programmatic APIs are not considered officially supported and are not subject to the breaking change guarantees of SemVer.
The programmatic APIs for the builders are now explicitly marked as experimental. This allows the package to use a stable versioning scheme while also continuing to provide access to the experimental programmatic API elements of the package.
This mostly just copies the "Getting started with service workers" guide cited to explain what the schematic itself does and defering to that doc for more info on PWA's and how to actually build one.
With the minimum version of Node.js now set to v12, the promise fs API can now be leveraged within the tooling.
This change also uses `copyFile` (with copy-on-write where available) to setup the the service worker files as well a streaming APIs to generate service worker hashes. Both of which improves performance and reduces memory usage.
A new build option named `inlineStyleLanguage` has been introduced that will allow a project to define the stylesheet language used in an application's inline component styles. Inline component styles are styles defined via the `styles` property within the Angular `Component` decorator. Both JIT and AOT mode are supported. However, JIT mode requires that inline styles only be string literals (compile-time partial evaluation is not supported in JIT mode). Currently supported language options are: `CSS` (default), `Sass`, `SCSS`, and `Less`. If the option is not specified, `CSS` will be used and enables existing projects to continue to function as expected.