Skip to content

Commit 9cae9b4

Browse files
AndrewKushniratscott
authored andcommitted
refactor(compiler-cli): add an internal config to enforce explicit deps in @defer for local compilation mode (#53591)
This commit adds an internal config option to enforce explicit deps in `@defer` for local compilation mode. PR Close #53591
1 parent 29b959c commit 9cae9b4

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

goldens/public-api/compiler-cli/compiler_options.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
export interface BazelAndG3Options {
99
annotateForClosureCompiler?: boolean;
1010
generateDeepReexports?: boolean;
11+
onlyExplicitDeferDependencyImports?: boolean;
1112
onlyPublishPublicTypingsForNgModules?: boolean;
1213
}
1314

packages/bazel/src/ngc-wrapped/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export async function runOneBuild(
8787
'createExternalSymbolFactoryReexports',
8888
'extendedDiagnostics',
8989
'forbidOrphanComponents',
90+
'onlyExplicitDeferDependencyImports',
9091
]);
9192

9293
const userOverrides = Object.entries(userOptions)

packages/compiler-cli/src/ngtsc/core/api/src/public_options.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,17 @@ export interface BazelAndG3Options {
317317
* Insert JSDoc type annotations needed by Closure Compiler
318318
*/
319319
annotateForClosureCompiler?: boolean;
320+
321+
/**
322+
* Specifies whether Angular compiler should rely on explicit imports
323+
* via `@Component.deferredImports` field for `@defer` blocks and generate
324+
* dynamic imports only for types from that list.
325+
*
326+
* This flag is needed to enable stricter behavior internally to make sure
327+
* that local compilation with specific internal configuration can support
328+
* `@defer` blocks.
329+
*/
330+
onlyExplicitDeferDependencyImports?: boolean;
320331
}
321332

322333
/**

0 commit comments

Comments
 (0)