mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
49b82ae561
This commit implements partial compilation APF v13 for the `ng_package` rule. The changes involve the following things: 1. Requesting the partial compilation output for all targets (and its transitives) in the `deps` or `srcs` attributes. 2. Downleveling of ES2020 prodmode output to a FESM2015 file. 3. Cleanup of file resolution. Previusly, execroot file paths (which are passed to the packager tool) were composed manually. This is prone to mistakes and breaks with transitions. A lot of this code can be simplified by passing the necessary Bazel `File` information as JSON. This also simplifies the packager tool significantly (and makes it more readable..) 4. Remoal of UMD bundles. This also allows us remove the `globals` rule attribute with `externals` (we do not need any UMD global identifier names anymore). 5. The `package.json` will set the `exports` field and use subpath exports to make module resolution work for ESM consumers. 6. TSLib is also always set as `external` now. Previously it had to be added as `dep` to the `ng_package` rule as UMD files bundled `tslib`. 7. The `include_devmode_srcs` option has been removed. This option was an addition to APF that allowed the `@angular/compiler` to ship non-flattened ES5 CommonJS sources. We want to keep APF consistent and not allow such exceptions. Compiler is now a strict APF package as well, and the compiler-cli just needs to go through the primary entry-point for things it needs (or it bundles the necessary parts into the CLI.) Overall, these are all changes. A lot of changes to make the packager rule and tool more readable and Bazel-idiomatic were made as well. This allows us to easier make packaging changes in the future, and it's more future-proof if we ever change how inputs (like `ng_module` targets) are generated (e.g. consider a case where we'd use the `ts_project` rule). PR Close #43431