angular-cn/packages/compiler/src
Alex Rickabaugh 08a4f10ee7 fix(ivy): move setClassMetadata calls into a pure iife (#33337)
This commit transforms the setClassMetadata calls generated by ngtsc from:

```typescript
/*@__PURE__*/ setClassMetadata(...);
```

to:

```typescript
/*@__PURE__*/ (function() {
  setClassMetadata(...);
})();
```

Without the IIFE, terser won't remove these function calls because the
function calls have arguments that themselves are function calls or other
impure expressions. In order to make the whole block be DCE-ed by terser,
we wrap it into IIFE and mark the IIFE as pure.

It should be noted that this change doesn't have any impact on CLI* with
build-optimizer, which removes the whole setClassMetadata block within
the webpack loader, so terser or webpack itself don't get to see it at
all. This is done to prevent cross-chunk retention issues caused by
webpack's internal module registry.

* actually we do expect a short-term size regression while
https://github.com/angular/angular-cli/pull/16228
is merged and released in the next rc of the CLI. But long term this
change does nothing to CLI + build-optimizer configuration and is done
primarly to correct the seemingly correct but non-function PURE annotation
that builds not using build-optimizer could rely on.

PR Close #33337
2019-11-20 12:55:58 -08:00
..
aot fix(compiler): do not throw when using abstract directive from other compilation unit (#33347) 2019-10-23 11:59:24 -07:00
compiler_util refactor(compiler): add details while throw error during expression convert (#32760) 2019-11-18 15:47:59 -08:00
css_parser build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
expression_parser fix(compiler-cli): Fix typo $implict (#33633) 2019-11-07 01:54:17 +00:00
i18n fix(compiler): i18n - ignore `alt-trans` tags in XLIFF 1.2 (#33450) 2019-10-29 11:49:32 -07:00
jit refactor(compiler): wrap the jit evaluation in an injectable class (#28055) 2019-02-12 20:58:27 -08:00
ml_parser refactor(compiler): add abstract `NodeWithI18n` class to ML parsing (#33318) 2019-10-22 13:30:16 -04:00
output fix(ivy): i18n - support "\", "`" and "${" sequences in i18n messages (#33820) 2019-11-18 16:00:22 -08:00
render3 fix(ivy): retain JIT metadata unless JIT mode is explicitly disabled (#33671) 2019-11-20 12:55:43 -08:00
schema refactor(compiler): update docs (#29599) 2019-04-02 10:28:52 -07:00
template_parser fix(compiler): correctly parse attributes with a dot in the name (#32256) 2019-11-07 01:02:56 +00:00
view_compiler refactor: re-enable dynamic queries migration (#32992) 2019-10-04 13:54:09 -07:00
assertions.ts refactor(compiler): rename INTERPOLATION_BLACKLIST_REGEXPS (#29593) 2019-04-02 10:36:26 -07:00
ast_path.ts style: typos fixed - https://github.com/vlajos/misspell-fixer (#22975) 2018-03-27 14:51:53 -04:00
chars.ts feat(compiler): support tokenizing escaped strings (#28055) 2019-02-12 20:58:27 -08:00
compile_metadata.ts feat(core): allow users to define timing of ViewChild/ContentChild queries (#28810) 2019-02-19 12:56:25 -08:00
compile_reflector.ts feat(ivy): @NgModule -> ngInjectorDef compilation (#22458) 2018-03-16 12:57:11 -07:00
compiler.ts fix(ivy): move setClassMetadata calls into a pure iife (#33337) 2019-11-20 12:55:58 -08:00
compiler_facade_interface.ts fix(ivy): retain JIT metadata unless JIT mode is explicitly disabled (#33671) 2019-11-20 12:55:43 -08:00
config.ts feat: add TypeScript 3 support (#25275) 2018-08-27 21:07:53 -04:00
constant_pool.ts refactor(core): rename ngInjectorDef to ɵinj (#33151) 2019-10-16 16:36:19 -04:00
core.ts refactor(core): rename ngInjectableDef to ɵprov (#33151) 2019-10-16 16:36:19 -04:00
directive_normalizer.ts refactor(compiler): use `options` argument for parsers (#28055) 2019-02-12 20:58:27 -08:00
directive_resolver.ts feat(compiler): narrow types of expressions used in *ngIf (#20702) 2017-12-08 10:24:26 -08:00
identifiers.ts refactor(ivy): generate ngFactoryDef for injectables (#32433) 2019-10-02 13:04:26 -07:00
injectable_compiler.ts refactor(core): rename ngInjectableDef to ɵprov (#33151) 2019-10-16 16:36:19 -04:00
injectable_compiler_2.ts refactor(ivy): split `type` into `type`, `internalType` and `adjacentType` (#33533) 2019-11-05 17:25:01 +00:00
jit_compiler_facade.ts refactor(ivy): split `type` into `type`, `internalType` and `adjacentType` (#33533) 2019-11-05 17:25:01 +00:00
lifecycle_reflector.ts feat(ivy): implement TestBed (#25369) 2018-08-14 11:58:47 -07:00
metadata_resolver.ts refactor: utilize type narrowing (#33075) 2019-10-10 15:18:44 -07:00
ng_module_compiler.ts feat(compiler): lower @NgModule ids if needed (#23031) 2018-03-28 09:15:16 -07:00
ng_module_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
parse_util.ts feat(ivy): record absolute position of template expressions (#31391) 2019-07-22 09:48:35 -07:00
pipe_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
provider_analyzer.ts feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
resource_loader.ts refactor(compiler): allow sync AOT compilation (#16832). 2017-05-23 10:41:23 -06:00
selector.ts fix(ivy): support for #id bootstrap selectors (#33784) 2019-11-15 10:42:52 -08:00
shadow_css.ts fix(compiler): Don't strip `/*# sourceURL ... */` (#16088) 2018-01-24 12:35:30 -08:00
style_compiler.ts feat(ivy): bridge component styles into the component renderer (#25255) 2018-08-23 16:51:15 -04:00
style_url_resolver.ts fix(compiler): Don't strip CSS source maps 2017-08-15 16:30:09 -07:00
summary_resolver.ts fix(compiler): allow to use flat modules and summaries 2017-09-28 14:20:20 -07:00
url_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
util.ts refactor(compiler): replace instanceof Array (#33076) 2019-10-10 15:19:12 -07:00
version.ts style: remove empty comments (#23404) 2018-05-10 15:48:13 -07:00