Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(compiler-cli): introduce `onlyPublishPublicTypingsForNgModul…
…es` (#45894) When generating .d.ts metadata for NgModules, by default we emit type references to their declarations, imports, and exports. However, this information is not necessarily useful to consumers. References to private directives (those that aren't exported by the NgModule) for example aren't at all useful as they can only affect other components declared in the NgModule. References to imports are of limited usefulness - they might be helpful for an IDE to understand the DI structure of an application, but aren't at all used by a downstream compiler. Generating this metadata is not without cost. When an incremental build system uses changes in inputs to determine when a rebuild is necessary, any changes in .d.ts files might cause downstream targets to rebuild. If those .d.ts changes are in the "private" side of the NgModule (imports or non- exported directives/pipes), then these rebuilds are wholly unnecessary. This commit introduces the `onlyPublishPublicTypingsForNgModules` flag for the compiler. When this flag is set, the compiler will filter the emitted references in NgModule .d.ts output and only reference those directives/ pipes that are exported from the NgModule (its public API surface). Omitting the flag preserves the existing behavior of emitting all references, both public and private. This is especially useful for build systems such as Bazel. PR Close #45894
- Loading branch information
Showing
10 changed files
with
130 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters