angular/packages/compiler-cli/test
JoostK a88bf2090e refactor(compiler-cli): increase minimum version of partial declarations (#45782)
In v14, the partial compilation output of components have changed in a way
that prevents older versions of Angular to compile the partial declarations
correctly.

In particular, we used to emit used directives/components in separate arrays called
`components` and `directives`, and used pipes in a property called `pipes`:

```js
TestComponent.ɵcmp = i0.ɵɵngDeclareComponent({
  minVersion: "12.0.0",
  version: "13.3.0",
  type: TestComponent,
  selector: "ng-component",
  ngImport: i0,
  template: ``,
  isInline: true,
  directives: [{ type: i1.SomeDir, selector: "[some-dir]" }],
  components: [{ type: i1.SomeCmp, selector: "some-cmp" }],
  pipes: { 'async': i2.AsyncPipe },
});
```

In the above example, the `version` property indicates which exact compiler
version was used to compile the component, but the `minVersion` allows older
versions of the compiler/Angular linker to "link" the partial declaration to
its final AOT compilation output.

In v14, the used directives, components and pipes are now emitted together
into a single array under the `dependencies` property:

```js
TestComponent.ɵcmp = i0.ɵɵngDeclareComponent({
  minVersion: "12.0.0",
  version: "13.3.0",
  type: TestComponent,
  selector: "ng-component",
  ngImport: i0,
  template: ``,
  isInline: true,
  dependencies: [
    { kind: "directive", type: i1.SomeDir, selector: "[some-dir]" },
    { kind: "component", type: i1.SomeCmp, selector: "some-cmp" },
    { kind: "pipe", type: i2.AsyncPipe },
  ],
});
```

This change has been made in support of standalone components, but it does mean
that older compiler versions can no longer link these partial declarations
as desirable as none of the components, directives and pipes would be included
in the AOT-compiled code.

By increasing the `minVersion` property, we hint to older compiler versions that
they are not capable of processing the partial declaration. This allows reporting
an error at compile time instead of resulting in runtime failures due to missing
components, directives and pipes.

PR Close #45782
2022-04-29 17:19:16 -04:00
..
compliance refactor(compiler-cli): increase minimum version of partial declarations (#45782) 2022-04-29 17:19:16 -04:00
ngtsc refactor(compiler-cli): support schemas in standalone components (#45752) 2022-04-27 10:25:53 -07:00
BUILD.bazel build: switch devmode output to es2015 (#44505) 2022-01-05 23:20:20 +00:00
downlevel_decorators_transform_spec.ts feat(core): support TypeScript 4.6 (#45190) 2022-03-07 11:31:39 -08:00
extract_i18n_spec.ts build: switch devmode output to es2015 (#44505) 2022-01-05 23:20:20 +00:00
mocks.ts refactor: make all imports compatible with ESM/CJS output. (#43431) 2021-10-01 18:28:45 +00:00
perform_compile_spec.ts refactor: make all imports compatible with ESM/CJS output. (#43431) 2021-10-01 18:28:45 +00:00
perform_watch_spec.ts feat(core): support TypeScript 4.7 (#45749) 2022-04-29 12:19:45 -04:00
test_support.ts build: enable useUnknownInCatchVariables (#44679) 2022-02-01 18:17:29 +00:00
typescript_support_spec.ts fix(compiler-cli): handle pre-release versions when checking version (#44109) 2021-11-09 20:54:45 +00:00
version_helpers_spec.ts refactor(compiler-cli): move version number helpers out of diagnostics subfolder (#44269) 2021-12-01 10:36:30 -08:00