3923201f95
Previously, it was not possible to block a partial-linker from trying to process a declaration that was defined in a newer version of Angular than that of the partial-linker. For example, if a partial-linker was published as part of version 12.0.0, there was no way for a partially-compiled declaration compiled via version 13.0.0 to tell the 12.0.0 linker that it would be invalid to attempt to process it. This commit adds a new `minVersion` property to partial-declarations, which is interpreted as the "minimum partial-linker version" that can process this declaration. When selecting a partial-linker for such a declaration, the known linker version ranges are checked to find the most recent linker whose version range has an overlap with the interpreted declaration range. This approach allows us to set a minimum version for a declaration, which can inform an old partial-linker that will it not be able to accurately process the declaration. Note that any pre-release part to versions are ignored in this selection process. The file-linker can be configured, via the `unknownDeclarationVersionHandling` property of `LinkerOptions`, to handle such a situation in one of three ways: - `error` - the version mismatch is a fatal error - `warn` - a warning is sent to the logger but the most recent partial-linker will attempt to process the declaration anyway. - `ignore` - the most recent partial-linker will, silently, attempt to process the declaration. The default is to throw an error. Closes #41497 PR Close #41578 |
||
---|---|---|
.. | ||
babel | ||
src | ||
test | ||
BUILD.bazel | ||
README.md | ||
index.ts |
README.md
Angular Linker
This package contains a FileLinker
and supporting code to be able to "link" partial declarations of components, directives, etc in libraries to produce the full definitions.
The partial declaration format allows library packages to be published to npm without exposing the underlying Ivy instructions.
The tooling here allows application build tools (e.g. CLI) to produce fully compiled components, directives, etc at the point when the application is bundled.
These linked files can be cached outside node_modules
so it does not suffer from problems of mutating packages in node_modules
.
Generally this tooling will be wrapped in a transpiler specific plugin, such as the provided Babel plugin.
Unit Testing
The unit tests are built and run using Bazel:
yarn bazel test //packages/compiler-cli/linker/test