angular-cn/packages
Alex Rickabaugh b54ed980ed fix(ivy): retain JIT metadata unless JIT mode is explicitly disabled (#33671)
NgModules in Ivy have a definition which contains various different bits
of metadata about the module. In particular, this metadata falls into two
categories:

* metadata required to use the module at runtime (for bootstrapping, etc)
in AOT-only applications.
* metadata required to depend on the module from a JIT-compiled app.

The latter metadata consists of the module's declarations, imports, and
exports. To support JIT usage, this metadata must be included in the
generated code, especially if that code is shipped to NPM. However, because
this metadata preserves the entire NgModule graph (references to all
directives and components in the app), it needs to be removed during
optimization for AOT-only builds.

Previously, this was done with a clever design:

1. The extra metadata was added by a function called `setNgModuleScope`.
A call to this function was generated after each NgModule.
2. This function call was marked as "pure" with a comment and used
`noSideEffects` internally, which causes optimizers to remove it.

The effect was that in dev mode or test mode (which use JIT), no optimizer
runs and the full NgModule metadata was available at runtime. But in
production (presumably AOT) builds, the optimizer runs and removes the JIT-
specific metadata.

However, there are cases where apps that want to use JIT in production, and
still make an optimized build. In this case, the JIT-specific metadata would
be erroneously removed. This commit solves that problem by adding an
`ngJitMode` global variable which guards all `setNgModuleScope` calls. An
optimizer can be configured to statically define this global to be `false`
for AOT-only builds, causing the extra metadata to be stripped.

A configuration for Terser used by the CLI is provided in `tooling.ts` which
sets `ngJitMode` to `false` when building AOT apps.

PR Close #33671
2019-11-20 12:55:43 -08:00
..
animations build: ts_web_test & ts_web_test_suite deprecated in favor of karma_web_test & karma_web_test_suite (#33802) 2019-11-13 13:33:38 -08:00
bazel fix(bazel): add terser as an optional peer dependency (#33891) 2019-11-18 16:01:33 -08:00
benchpress feat: update rxjs peerDependencies minimum requirment to 6.5.3 (#32812) 2019-10-01 14:56:45 -07:00
common docs(common): fix condition in transformed *ngIf (#33425) 2019-11-14 09:25:36 -08:00
compiler fix(ivy): retain JIT metadata unless JIT mode is explicitly disabled (#33671) 2019-11-20 12:55:43 -08:00
compiler-cli fix(ivy): retain JIT metadata unless JIT mode is explicitly disabled (#33671) 2019-11-20 12:55:43 -08:00
core fix(ivy): retain JIT metadata unless JIT mode is explicitly disabled (#33671) 2019-11-20 12:55:43 -08:00
docs refactor(core): remove deprecated Renderer (#33019) 2019-10-08 09:23:00 -07:00
elements build: ts_web_test & ts_web_test_suite deprecated in favor of karma_web_test & karma_web_test_suite (#33802) 2019-11-13 13:33:38 -08:00
examples build: fixes for cross-platform RBE (#33708) 2019-11-15 10:49:55 -08:00
forms fix(ivy): shadow all DOM properties in `DebugElement.properties` (#33781) 2019-11-18 15:49:22 -08:00
http build: ts_web_test & ts_web_test_suite deprecated in favor of karma_web_test & karma_web_test_suite (#33802) 2019-11-13 13:33:38 -08:00
language-service feat(language-service): completions support for indexed types (#33775) 2019-11-15 16:16:06 -08:00
localize build: set up all packages to publish via wombot proxy (#33747) 2019-11-13 11:34:33 -08:00
platform-browser build: ts_web_test & ts_web_test_suite deprecated in favor of karma_web_test & karma_web_test_suite (#33802) 2019-11-13 13:33:38 -08:00
platform-browser-dynamic build: ts_web_test & ts_web_test_suite deprecated in favor of karma_web_test & karma_web_test_suite (#33802) 2019-11-13 13:33:38 -08:00
platform-server build: set up all packages to publish via wombot proxy (#33747) 2019-11-13 11:34:33 -08:00
platform-webworker docs(platform-webworker): mark all public APIs as deprecated (#33824) 2019-11-15 16:14:37 -08:00
platform-webworker-dynamic build: set up all packages to publish via wombot proxy (#33747) 2019-11-13 11:34:33 -08:00
private/testing test: cleanup `document` "after" each test (#33712) 2019-11-11 14:01:04 -08:00
router Revert "fix(router): make routerLinkActive work with query params which contain arrays (#22666)" (#33861) 2019-11-15 13:14:43 -08:00
service-worker build: ts_web_test & ts_web_test_suite deprecated in favor of karma_web_test & karma_web_test_suite (#33802) 2019-11-13 13:33:38 -08:00
upgrade build: ts_web_test & ts_web_test_suite deprecated in favor of karma_web_test & karma_web_test_suite (#33802) 2019-11-13 13:33:38 -08:00
zone.js fix: fixes typo of zone.js patch vrdisplaydisconnected property (#33581) 2019-11-18 15:46:52 -08:00
BUILD.bazel build: reference zone.js from source directly instead of npm. (#33046) 2019-11-06 00:48:34 +00:00
README.md Revert "docs: Remove unneeded file (#18106)" 2017-07-20 16:46:47 -05:00
empty.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
goog.d.ts fix(ivy): use goog.LOCALE for Closure Compiler to define default LOCALE_ID (#31519) 2019-07-16 13:02:10 -04:00
license-banner.txt build: bump year (#27880) 2019-01-11 11:15:59 -08:00
system.d.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
tsconfig-build-no-strict.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-build.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-test.json refactor: fix typescript strict flag failures in all tests (#30993) 2019-07-18 14:21:26 -07:00
tsconfig.json build: reference zone.js from source directly instead of npm. (#33046) 2019-11-06 00:48:34 +00:00
types.d.ts build: reference zone.js from source directly instead of npm. (#33046) 2019-11-06 00:48:34 +00:00

README.md

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

License: MIT