angular-docs-cn/packages/compiler-cli/src
JoostK 1f73af77a7 refactor(compiler-cli): use `ngDevMode` guard for `setClassMetadata` call (#39987)
Prior to this change, the `setClassMetadata` call would be invoked
inside of an IIFE that was marked as pure. This allows the call to be
tree-shaken away in production builds, as the `setClassMetadata` call
is only present to make the original class metadata available to the
testing infrastructure. The pure marker is problematic, though, as the
`setClassMetadata` call does in fact have the side-effect of assigning
the metadata into class properties. This has worked under the assumption
that only build optimization tools perform tree-shaking, however modern
bundlers are also able to elide calls that have been marked pure so this
assumption does no longer hold. Instead, an `ngDevMode` guard is used
which still allows the call to be elided but only by tooling that is
configured to consider `ngDevMode` as constant `false` value.

PR Close #39987
2020-12-10 13:23:13 -08:00
..
diagnostics build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
metadata refactor(compiler-cli): remove TypeScript 3.9 workarounds (#39586) 2020-11-06 15:26:51 -08:00
ngtsc refactor(compiler-cli): use `ngDevMode` guard for `setClassMetadata` call (#39987) 2020-12-10 13:23:13 -08:00
transformers feat(compiler): support tagged template literals in code generator (#39122) 2020-12-07 16:20:04 -08:00
extract_i18n.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
language_services.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
main.ts style(compiler-cli): remove unused constant (#38441) 2020-08-13 13:32:41 -07:00
perform_compile.ts refactor(language-service): language_service_adapter -> adapters (#39619) 2020-11-17 14:45:09 -08:00
perform_watch.ts build: support building with TypeScript 4.1 (#39571) 2020-11-25 11:10:01 -08:00
tooling.ts refactor(compiler-cli): skip class decorators in tooling constructor parameters transform (#37545) 2020-06-15 12:47:57 -07:00
typescript_support.ts feat(compiler-cli): add support for using TypeScript 4.1 (#39571) 2020-11-25 11:10:00 -08:00
version.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00