A Webpack module's `factoryMeta` property is not guaranteed to be defined. This change ensures that the build optimizer skip property is added even in the case of no `factoryMeta` currently defined.
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`.
With this change we "vendor" TypeScript 3.6 in build optimizer instead of using directly the npm package.
Reasons:
- We cannot update to a more recent version of TypeScript due to https://github.com/microsoft/TypeScript/issues/38412
- Yarn workspace are not supported under Bazel. This means currently we are running unit testswhich uses a different TypeScript version at runtime.
- In TypeScript 3.9, the shape of ES2015 classes changed https://github.com/microsoft/TypeScript/pull/32011, this requires some changes in the UT expects, but this again will not be correct to change now.
BREAKING CHANGE
Deprecated and outdated optimization passes class fold and import tslib have been removed.
Note: This change only effects direct @angular-devkit/schematics users and not the application developers.
Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
This transformer can cause size regressions when it introduces `tslib` imports across independent chunks.
It should be deprecated because tslib adoption has become more ubiquitous.
Should also speed up Build Optimizer processing time because there's one less thing to do.
Closes https://github.com/angular/angular-cli/issues/15401 without adding the warning, because some libraries like zone.js should inline the helpers.
When a `__decorator` expression has no `__metadata` call, example:
```js
__decorate([
ContentChild('heading', { read: ElementRef, static: true })
], FooBarComponent.prototype, "buttons", void 0);
```
A `Cannot read property 'kind' of undefined` error will be thrown.
Closes: #15703
Inlined tslib helpers can be suffixed with `$` and a number when having multiple helpers in the same file.
With this change we will replace all tslib inline helpers to imports from `tslib`
Followup to https://github.com/angular/angular-cli/pull/15239, fixes a 6kb size regression in new apps, potentially more in larger apps.
Local declarations inside `@angular/core` files should also be considered metadata and scrubbed.