angular-cn/packages/compiler-cli/test
Alex Rickabaugh 08a4f10ee7 fix(ivy): move setClassMetadata calls into a pure iife ()
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 
2019-11-20 12:55:58 -08:00
..
compliance perf(ivy): chain styling instructions () 2019-11-19 11:44:29 -08:00
diagnostics refactor(compiler-cli): Move diagnostics files to language service () 2019-11-14 09:29:07 -08:00
helpers fix(ivy): handle namespaced imports correctly () 2019-07-09 09:40:30 -07:00
metadata refactor(core): rename ngInjectableDef to ɵprov () 2019-10-16 16:36:19 -04:00
ngtsc fix(ivy): move setClassMetadata calls into a pure iife () 2019-11-20 12:55:58 -08:00
transformers feat(ivy): verify whether TypeScript version is supported () 2019-10-24 15:46:23 -07:00
BUILD.bazel fix(ivy): recompile component when template changes in ngc watch mode () 2019-11-12 13:55:09 -08:00
extract_i18n_spec.ts feat: make the Ivy compiler the default for ngc () 2019-08-20 16:41:08 -07:00
mocks.ts fix(compiler-cli): Use typescript to resolve modules for metadata () 2018-07-10 11:11:48 -07:00
ngc_spec.ts fix(compiler): do not throw when using abstract directive from other compilation unit () 2019-10-23 11:59:24 -07:00
perform_compile_spec.ts fix(compiler): return enableIvy true when using `readConfiguration` () 2019-08-21 10:06:25 -07:00
perform_watch_spec.ts fix(ivy): recompile component when template changes in ngc watch mode () 2019-11-12 13:55:09 -08:00
test_support.ts feat: make the Ivy compiler the default for ngc () 2019-08-20 16:41:08 -07:00
typescript_support_spec.ts feat(ivy): verify whether TypeScript version is supported () 2019-10-24 15:46:23 -07:00