angular/packages/compiler-cli/ngcc/src
Alex Rickabaugh a006edefd1 refactor(compiler-cli): introduce onlyPublishPublicTypingsForNgModules (#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
2022-06-02 13:39:14 -07:00
..
analysis refactor(compiler-cli): introduce onlyPublishPublicTypingsForNgModules (#45894) 2022-06-02 13:39:14 -07:00
dependencies fix(ngcc): cope with packages following APF v14+ (#45833) 2022-05-06 09:51:14 -07:00
entry_point_finder refactor: add override keyword to members implementing abstract declarations (#42512) 2021-07-12 13:11:17 -07:00
execution refactor(ngcc): move loadPackageJson() and related types to utils.ts (#45833) 2022-05-06 09:51:14 -07:00
host fix(ngcc): correctly resolve UMD dependencies (#44381) 2021-12-07 08:33:00 -05:00
locking build: enable useUnknownInCatchVariables (#44679) 2022-02-01 18:17:29 +00:00
migrations refactor(compiler): remove usages of deprecated AST creation functions (#45134) 2022-02-22 10:22:47 -08:00
packages fix(ngcc): cope with packages following APF v14+ (#45833) 2022-05-06 09:51:14 -07:00
rendering build: enable useUnknownInCatchVariables (#44679) 2022-02-01 18:17:29 +00:00
writing fix(ngcc): cope with packages following APF v14+ (#45833) 2022-05-06 09:51:14 -07:00
command_line_options.ts refactor: update yargs to new API for ESM compatibility (#43431) 2021-10-01 18:28:45 +00:00
constants.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
main.ts refactor(ngcc): support processing only the typings files of packages (#40976) 2021-02-24 14:23:14 -08:00
ngcc_options.ts refactor(ngcc): support processing only the typings files of packages (#40976) 2021-02-24 14:23:14 -08:00
path_mappings.ts refactor(compiler-cli): update to use new file-system interfaces (#40281) 2021-01-08 09:34:44 -08:00
utils.ts fix(ngcc): cope with packages following APF v14+ (#45833) 2022-05-06 09:51:14 -07:00