angular/packages/bazel/test/ng_package
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
..
example feat(bazel): speed up dev-turnaround by bundling types only when packaging (#45405) 2022-04-21 11:09:39 -07:00
example-with-ts-library feat(bazel): speed up dev-turnaround by bundling types only when packaging (#45405) 2022-04-21 11:09:39 -07:00
BUILD.bazel fix(bazel): do not error if files part of srcs are outside of package (#45622) 2022-04-14 14:58:27 -07:00
common_package.spec.ts feat(bazel): speed up dev-turnaround by bundling types only when packaging (#45405) 2022-04-21 11:09:39 -07:00
core_package.spec.ts feat(bazel): speed up dev-turnaround by bundling types only when packaging (#45405) 2022-04-21 11:09:39 -07:00
example_package.golden refactor(compiler-cli): increase minimum version of partial declarations (#45782) 2022-04-29 17:19:16 -04:00
example_package.spec.ts build: update to latest version of rules_nodejs v3.3.0 (#41599) 2021-04-13 17:37:28 -07:00
example_with_ts_library_package.golden refactor(compiler-cli): increase minimum version of partial declarations (#45782) 2022-04-29 17:19:16 -04:00
outside_package.txt fix(bazel): do not error if files part of srcs are outside of package (#45622) 2022-04-14 14:58:27 -07:00
test_utils.ts build: update to jasmine 4.0 (#45558) 2022-04-11 16:25:28 +00:00