This change allows the result of the stylesheet Webpack compilation to be explicitly available for access after the output source code is generated. The previous method relied on assumptions within the code generated by Webpack and no longer worked with Webpack 5.
By leveraging TypeScript's AST type guards, function parameter assumptions and casting can be removed. Many of these cases caused errors when enabling TypeScript's strict option. This is preliminary work to support enabling full TypeScript strict mode within the project.
This commit makes a few minor changes to enable syncing the CLI repository
into google3.
1. mark pkg_tar and pkg_npm as external
2. remove dependencies (marked as comment) which are stale in google3
3. remove TS files generated from JSON schema in BUILD files since these
files are compiled and added to the g3 codebase at sync time
4. Some minor typing changes
5. Remove duplicate licenses
6. mark dependencies which are not available in g3 as external
7. Immediately type the result of JSON.parse() as required by g3 linter.
Otherwise, the type defaults to `any`.
NGTSC, will transform `ShorthandPropertyAssignment` to `PropertyAssignment`, with this change we handle such cases and retain the import which previously was dropped.
Closes#18149 and closes#17347
This change performs a ngcc run check to determine if an initial execution is required. If a run hash file exists that matches the current package manager lock file and the project's tsconfig, then an initial ngcc run has already been performed.
By limiting the need to spawn and execute ngcc in another process on each build, the total build time can be reduced on subsequent builds.
With this change we consume the change in https://github.com/angular/angular/pull/37075 where the NGCC now exposes a new option `--use-program-dependencies`, to only process packages which are part of the TypeScript program.
From the initial benchmarking the time taken for NGCC to process that dependencies needed for an `ng new` application went down by 36% from 10526ms to 6708ms.
As of 10.0.0, the `@angular/compiler-cli` package provides a TypeScript transformer to downlevel Angular decorators. This change switches the tooling webpack plugin from using an internal variant of the transformer to the new one within the compiler-cli. For details on why this type of transformation is needed, please see: 401ef71ae5
Unlike TSC which has it's own mechanism the resolve and join paths in POSIX format, NGTSC heavily relies onNode.JS `fs` and `path` modules. This prevents `Path` usage because in Windows `path.resolve` will causes an absolute path to be resolved or joined incorrectly. Example: `/D/MyPath/MyProject` -> `D:/d/mypath/myproject`.
With this change we change the `getCanonicalFileName` method to return FS compatible paths.
Previously, the import default TypeScript helper was emitted for every file when in JIT mode. This was unused code in the majority of cases. The helper is now emitted only when needed. For this package that would be when an Angular component decorator's resource URL properties are adjusted to support JIT execution with Webpack.
BREAKING CHANGE:
`isSupported` method has been removed from `AngularCompilerPlugin` as it has become redundant with peer dependencies.
Note: this change only effects direct `@ngtools/webpack` users and not the application developers.