angular-cn/packages/compiler-cli/ngcc/test
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
..
analysis fix(ngcc): always add exports for `ModuleWithProviders` references (#33875) 2019-11-18 09:11:34 -08:00
dependencies feat(ngcc): support ignoreMissingDependencies in ngcc config (#33192) 2019-10-17 19:43:39 -04:00
entry_point_finder fix(ngcc): do not analyze dependencies for non Angular entry-points (#32303) 2019-08-26 10:08:44 -07:00
execution perf(ngcc): process tasks in parallel in async mode (#32427) 2019-09-09 15:55:13 -04:00
helpers feat(ngcc): enable private NgModule re-exports in ngcc on request (#33177) 2019-10-22 13:14:31 -04:00
host fix(ngcc): properly detect origin of constructor param types (#33901) 2019-11-19 11:38:33 -08:00
integration fix(ivy): move setClassMetadata calls into a pure iife (#33337) 2019-11-20 12:55:58 -08:00
logging feat(compiler-cli): ngcc - make logging more configurable (#29591) 2019-04-01 11:53:28 -07:00
migrations refactor(ngcc): rework undecorated parent migration (#33362) 2019-10-25 09:16:50 -07:00
packages fix(ngcc): correctly include internal .d.ts files (#33875) 2019-11-18 09:11:34 -08:00
rendering fix(ivy): move setClassMetadata calls into a pure iife (#33337) 2019-11-20 12:55:58 -08:00
writing refactor(ngcc): abstract updating `package.json` files behind an interface (#32427) 2019-09-09 15:55:13 -04:00
BUILD.bazel fix(ngcc): do not emit ES2015 code in ES5 files (#33514) 2019-11-13 13:49:31 -08:00
utils_spec.ts refactor(ivy): ngcc - implement new module resolver (#29643) 2019-04-29 12:37:21 -07:00