angular-docs-cn/packages/compiler-cli/src
Pete Bacon Darwin 2ebe2bcb2f refactor(compiler): move factory out of injector definition (#41022)
Previously, injector definitions contained a `factory` property that
was used to create a new instance of the associated NgModule class.

Now this factory has been moved to its own `ɵfac` static property on the
NgModule class itself. This is inline with how directives, components and
pipes are created.

There is a small size increase to bundle sizes for each NgModule class,
because the `ɵfac` takes up a bit more space:

Before:

```js
let a = (() => {
  class n {}
  return n.\u0275mod = c.Cb({type: n}),
  n.\u0275inj = c.Bb({factory: function(t) { return new (t || n) }, imports: [[e.a.forChild(s)], e.a]}),
  n
})(),
```

After:

```js
let a = (() => {
  class n {}
  return n.\u0275fac = function(t) { return new (t || n) },
  n.\u0275mod = c.Cb({type: n}),
  n.\u0275inj = c.Bb({imports: [[r.a.forChild(s)], r.a]}),
  n
})(),
```

In other words `n.\u0275fac = ` is longer than `factory: ` (by 5 characters)
and only because the tooling insists on encoding `ɵ` as `\u0275`.

This can be mitigated in a future PR by only generating the `ɵfac` property
if it is actually needed.

PR Close #41022
2021-03-08 15:31:30 -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): move factory out of injector definition (#41022) 2021-03-08 15:31:30 -08:00
transformers refactor(compiler): remove unreachable code (#40984) 2021-03-01 15:29:20 -08:00
extract_i18n.ts refactor(compiler): add process title to Angular node binaries (#40648) 2021-02-17 17:06:27 -08:00
language_services.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
main.ts refactor(compiler): add process title to Angular node binaries (#40648) 2021-02-17 17:06:27 -08:00
perform_compile.ts fix(compiler-cli): extend `angularCompilerOptions` in tsconfig from node (#40694) 2021-02-11 13:29:51 -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