angular/packages/compiler-cli/src/ngtsc
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
..
annotations fix(ivy): move setClassMetadata calls into a pure iife (#33337) 2019-11-20 12:55:58 -08:00
cycles refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
diagnostics fix(ivy): don't crash on unknown pipe (#33454) 2019-10-31 23:43:32 +00:00
entry_point refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
file_system test(ivy): support chdir() on the compiler's filesystem abstraction (#33828) 2019-11-19 12:41:24 -08:00
imports fix(ivy): emit fs-relative paths when rootDir(s) aren't in effect (#33828) 2019-11-19 12:41:24 -08:00
incremental fix(ivy): always re-analyze the program during incremental rebuilds (#33862) 2019-11-20 11:46:02 -08:00
indexer fix(ivy): support abstract directives in template type checking (#33131) 2019-10-24 12:44:30 -07:00
metadata fix(ivy): support abstract directives in template type checking (#33131) 2019-10-24 12:44:30 -07:00
partial_evaluator feat(core): missing-injectable migration should migrate empty object literal providers (#33709) 2019-11-18 15:47:20 -08:00
perf refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
reflection fix(ngcc): handle new __spreadArrays tslib helper (#33617) 2019-11-06 19:43:07 +00:00
routing build: rules_nodejs 0.26.0 & use @npm instead of @ngdeps now that downstream angular build uses angular bundles (#28871) 2019-02-28 12:06:36 -08:00
scope fix(ivy): always re-analyze the program during incremental rebuilds (#33862) 2019-11-20 11:46:02 -08:00
shims fix(compiler-cli): Pass SourceFile to getFullText() (#33660) 2019-11-07 16:47:07 -08:00
switch build: rules_nodejs 0.26.0 & use @npm instead of @ngdeps now that downstream angular build uses angular bundles (#28871) 2019-02-28 12:06:36 -08:00
testing refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
transform fix(ivy): always re-analyze the program during incremental rebuilds (#33862) 2019-11-20 11:46:02 -08:00
translator fix(ivy): retain JIT metadata unless JIT mode is explicitly disabled (#33671) 2019-11-20 12:55:43 -08:00
typecheck fix(ngcc): do not emit ES2015 code in ES5 files (#33514) 2019-11-13 13:49:31 -08:00
util feat: typescript 3.6 support (#32946) 2019-10-18 13:15:16 -04:00
program.ts fix(ivy): don't infer template context types when in full mode (#33537) 2019-11-20 11:47:42 -08:00
resource_loader.ts fix(ivy): handle rooted resource paths correctly (#31511) 2019-07-11 11:42:33 -04:00
synthetic_files_compiler_host.ts feat: add support for TypeScript 3.3 (and drop older versions) (#29004) 2019-03-13 10:38:37 -07:00
tsc_plugin.ts refactor(ivy): use ClassDeclaration in more ReflectionHost methods (#29209) 2019-03-21 22:20:23 +00:00