@angular/build 22.3.0-next.0 → 22.3.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/package.json +13 -13
  2. package/src/builders/application/build-action.js +2 -2
  3. package/src/builders/application/build-action.js.map +1 -1
  4. package/src/builders/application/chunk-optimizer.js +2 -1
  5. package/src/builders/application/chunk-optimizer.js.map +1 -1
  6. package/src/builders/application/index.js +8 -31
  7. package/src/builders/application/index.js.map +1 -1
  8. package/src/builders/application/options.d.ts +1 -3
  9. package/src/builders/application/options.js +2 -3
  10. package/src/builders/application/options.js.map +1 -1
  11. package/src/builders/application/results.d.ts +1 -1
  12. package/src/builders/dev-server/options.js +1 -1
  13. package/src/builders/dev-server/options.js.map +1 -1
  14. package/src/builders/dev-server/vite/server.js +1 -1
  15. package/src/builders/dev-server/vite/server.js.map +1 -1
  16. package/src/builders/dev-server/vite/utils.js +1 -1
  17. package/src/builders/dev-server/vite/utils.js.map +1 -1
  18. package/src/builders/extract-i18n/application-extraction.js +2 -1
  19. package/src/builders/extract-i18n/application-extraction.js.map +1 -1
  20. package/src/builders/karma/assets-middleware.js +1 -1
  21. package/src/builders/karma/assets-middleware.js.map +1 -1
  22. package/src/builders/library/builder-state.d.ts +115 -0
  23. package/src/builders/library/builder-state.js +282 -0
  24. package/src/builders/library/builder-state.js.map +1 -0
  25. package/src/builders/library/builder.js +110 -92
  26. package/src/builders/library/builder.js.map +1 -1
  27. package/src/builders/library/execution-result.d.ts +35 -0
  28. package/src/builders/library/execution-result.js +67 -0
  29. package/src/builders/library/execution-result.js.map +1 -0
  30. package/src/builders/library/index.d.ts +1 -1
  31. package/src/builders/library/index.js.map +1 -1
  32. package/src/builders/library/options.d.ts +9 -0
  33. package/src/builders/library/options.js +29 -23
  34. package/src/builders/library/options.js.map +1 -1
  35. package/src/builders/library/pipeline/assets.d.ts +5 -16
  36. package/src/builders/library/pipeline/assets.js +16 -59
  37. package/src/builders/library/pipeline/assets.js.map +1 -1
  38. package/src/builders/library/pipeline/build-action.d.ts +21 -13
  39. package/src/builders/library/pipeline/build-action.js +76 -124
  40. package/src/builders/library/pipeline/build-action.js.map +1 -1
  41. package/src/builders/library/pipeline/bundler.d.ts +5 -3
  42. package/src/builders/library/pipeline/bundler.js +123 -43
  43. package/src/builders/library/pipeline/bundler.js.map +1 -1
  44. package/src/builders/library/pipeline/compilation.d.ts +7 -26
  45. package/src/builders/library/pipeline/compilation.js +59 -69
  46. package/src/builders/library/pipeline/compilation.js.map +1 -1
  47. package/src/builders/library/pipeline/entry-points.d.ts +26 -6
  48. package/src/builders/library/pipeline/entry-points.js +82 -21
  49. package/src/builders/library/pipeline/entry-points.js.map +1 -1
  50. package/src/builders/library/pipeline/package-manifests.d.ts +2 -1
  51. package/src/builders/library/pipeline/package-manifests.js +50 -1
  52. package/src/builders/library/pipeline/package-manifests.js.map +1 -1
  53. package/src/builders/library/pipeline/stylesheet-bundler.d.ts +4 -1
  54. package/src/builders/library/pipeline/stylesheet-bundler.js +1 -1
  55. package/src/builders/library/pipeline/stylesheet-bundler.js.map +1 -1
  56. package/src/builders/library/pipeline/utils.d.ts +19 -11
  57. package/src/builders/library/pipeline/utils.js +27 -11
  58. package/src/builders/library/pipeline/utils.js.map +1 -1
  59. package/src/builders/library/schema.json +2 -4
  60. package/src/builders/library/types.d.ts +62 -22
  61. package/src/builders/ng-packagr/builder.js +2 -2
  62. package/src/builders/ng-packagr/builder.js.map +1 -1
  63. package/src/builders/unit-test/builder.js +1 -1
  64. package/src/builders/unit-test/builder.js.map +1 -1
  65. package/src/builders/unit-test/options.js +1 -2
  66. package/src/builders/unit-test/options.js.map +1 -1
  67. package/src/builders/unit-test/runners/vitest/executor.js +0 -5
  68. package/src/builders/unit-test/runners/vitest/executor.js.map +1 -1
  69. package/src/builders/unit-test/runners/vitest/plugins.js +13 -1
  70. package/src/builders/unit-test/runners/vitest/plugins.js.map +1 -1
  71. package/src/builders/unit-test/test-discovery.js +4 -2
  72. package/src/builders/unit-test/test-discovery.js.map +1 -1
  73. package/src/private.d.ts +1 -1
  74. package/src/private.js +3 -3
  75. package/src/private.js.map +1 -1
  76. package/src/tools/angular/angular-host.d.ts +1 -1
  77. package/src/tools/angular/angular-host.js +5 -2
  78. package/src/tools/angular/angular-host.js.map +1 -1
  79. package/src/tools/angular/compilation/angular-compilation.d.ts +1 -0
  80. package/src/tools/angular/compilation/angular-compilation.js.map +1 -1
  81. package/src/tools/angular/compilation/aot-compilation.js +325 -80
  82. package/src/tools/angular/compilation/aot-compilation.js.map +1 -1
  83. package/src/tools/angular/compilation/compiler-options.js +4 -1
  84. package/src/tools/angular/compilation/compiler-options.js.map +1 -1
  85. package/src/tools/angular/compilation/jit-compilation.js +5 -4
  86. package/src/tools/angular/compilation/jit-compilation.js.map +1 -1
  87. package/src/tools/angular/compilation/parallel-worker.js +1 -0
  88. package/src/tools/angular/compilation/parallel-worker.js.map +1 -1
  89. package/src/tools/angular/compilation/typescript-compilation.d.ts +2 -0
  90. package/src/tools/angular/compilation/typescript-compilation.js +44 -5
  91. package/src/tools/angular/compilation/typescript-compilation.js.map +1 -1
  92. package/src/tools/esbuild/bundler-context.js +5 -1
  93. package/src/tools/esbuild/bundler-context.js.map +1 -1
  94. package/src/tools/esbuild/persistent-load-result-cache.js +2 -4
  95. package/src/tools/esbuild/persistent-load-result-cache.js.map +1 -1
  96. package/src/tools/esbuild/utils.d.ts +1 -2
  97. package/src/tools/esbuild/utils.js +0 -13
  98. package/src/tools/esbuild/utils.js.map +1 -1
  99. package/src/tools/sass/rebasing-importer.d.ts +1 -1
  100. package/src/tools/sass/rebasing-importer.js +6 -3
  101. package/src/tools/sass/rebasing-importer.js.map +1 -1
  102. package/src/tools/vite/middlewares/assets-middleware.js +1 -1
  103. package/src/tools/vite/middlewares/assets-middleware.js.map +1 -1
  104. package/src/utils/concurrency.d.ts +4 -0
  105. package/src/utils/concurrency.js +5 -0
  106. package/src/utils/concurrency.js.map +1 -1
  107. package/src/utils/delete-output-dir.js +3 -2
  108. package/src/utils/delete-output-dir.js.map +1 -1
  109. package/src/utils/disk-files.d.ts +30 -0
  110. package/src/utils/disk-files.js +68 -0
  111. package/src/utils/disk-files.js.map +1 -0
  112. package/src/utils/index-file/nonce.d.ts +2 -1
  113. package/src/utils/index-file/nonce.js +22 -4
  114. package/src/utils/index-file/nonce.js.map +1 -1
  115. package/src/utils/load-proxy-config.js +12 -10
  116. package/src/utils/load-proxy-config.js.map +1 -1
  117. package/src/utils/load-rolldown.d.ts +27 -0
  118. package/src/utils/load-rolldown.js +79 -0
  119. package/src/utils/load-rolldown.js.map +1 -0
  120. package/src/utils/normalize-asset-patterns.d.ts +18 -3
  121. package/src/utils/normalize-asset-patterns.js +34 -67
  122. package/src/utils/normalize-asset-patterns.js.map +1 -1
  123. package/src/utils/normalize-cache.d.ts +14 -1
  124. package/src/utils/normalize-cache.js +18 -4
  125. package/src/utils/normalize-cache.js.map +1 -1
  126. package/src/utils/postcss-configuration.d.ts +2 -2
  127. package/src/utils/postcss-configuration.js +3 -3
  128. package/src/utils/postcss-configuration.js.map +1 -1
  129. package/src/utils/resolve-assets.js +28 -9
  130. package/src/utils/resolve-assets.js.map +1 -1
  131. package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.d.ts +1 -1
  132. package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js +3 -3
  133. package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js.map +1 -1
  134. package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.js +3 -2
  135. package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.js.map +1 -1
  136. package/src/utils/test-files.js +5 -57
  137. package/src/utils/test-files.js.map +1 -1
  138. package/src/utils/watcher.d.ts +53 -0
  139. package/src/utils/watcher.js +404 -76
  140. package/src/utils/watcher.js.map +1 -1
  141. package/src/builders/library/pipeline/types.d.ts +0 -54
@@ -1 +1 @@
1
- {"version":3,"file":"angular-host.js","sourceRoot":"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AW,CAAC,aAAa,CAAC;IACnC,CAAC,CAAC;IAEF,uEAAuE;IACvE,MAAM,eAAe,GAAG,UAAU,CAAC,2BAA2B,CAC5D,IAAI,CAAC,mBAAmB,EAAE,EAC1B,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EACpC,eAAe,EACf,gBAAgB,CACjB,CAAC;IACF,IAAI,CAAC,wBAAwB,GAAG,GAAG,EAAE,CAAC,eAAe,CAAC;IAEtD,uDAAuD;IACvD,IAAI,WAAW,CAAC,gBAAgB,EAAE,CAAC;QACjC,2BAA2B,CAAC,UAAU,EAAE,IAAI,EAAE,WAAW,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IAC/F,CAAC;IAED,+DAA+D;IAC/D,IAAI,eAAe,EAAE,CAAC;QACpB,sBAAsB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACpF,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5F,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,mBAAmB,CAAC,GAAG,CAAC,mBAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,sBAAsB,CAAC,IAAY;IAC1C,OAAO,qBAAqB,CAAC,GAAG,CAAC,mBAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACzE,CAAC"}
@@ -19,6 +19,7 @@ export interface FileTransformResult {
19
19
  }
20
20
  export interface AngularCompilationOptions {
21
21
  allowJs?: boolean;
22
+ compilationMode?: 'full' | 'partial' | 'experimental-local';
22
23
  declarationMap?: boolean;
23
24
  isolatedModules?: boolean;
24
25
  sourceMap?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"angular-compilation.js","sourceRoot":"","sources":["angular-compilation.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAoCH,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,qDAAQ,CAAA;IACR,yDAAe,CAAA;IACf,+DAAkB,CAAA;IAClB,6DAAiB,CAAA;IACjB,mDAAmC,CAAA;AACrC,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AAED,MAAsB,kBAAkB;IAQtC,iBAAiB;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;IAID,KAAK,CAAC,aAAa,CACjB,KAAuB;QAEvB,OAAO,EAAE,CAAC;IACZ,CAAC;CAKF;AAvBD,gDAuBC"}
1
+ {"version":3,"file":"angular-compilation.js","sourceRoot":"","sources":["angular-compilation.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAqCH,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,qDAAQ,CAAA;IACR,yDAAe,CAAA;IACf,+DAAkB,CAAA;IAClB,6DAAiB,CAAA;IACjB,mDAAmC,CAAA;AACrC,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AAED,MAAsB,kBAAkB;IAQtC,iBAAiB;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;IAID,KAAK,CAAC,aAAa,CACjB,KAAuB;QAEvB,OAAO,EAAE,CAAC;IACZ,CAAC;CAKF;AAvBD,gDAuBC"}
@@ -30,6 +30,26 @@ const typescript_printer_1 = require("./typescript-printer");
30
30
  * than a full rebuild would entail.
31
31
  */
32
32
  const HMR_MODIFIED_FILE_LIMIT = 32;
33
+ /**
34
+ * Extension for Angular type-checking files.
35
+ */
36
+ const TTC_EXTENSION = '.ngtypecheck.ts';
37
+ /**
38
+ * Length of the `.ngtypecheck.ts` extension.
39
+ */
40
+ const TTC_EXTENSION_LENGTH = TTC_EXTENSION.length;
41
+ /**
42
+ * Checks if a file is an Angular type-checking shim file.
43
+ */
44
+ function isNgTypeCheckFile(fileName) {
45
+ return fileName.endsWith(TTC_EXTENSION);
46
+ }
47
+ /**
48
+ * Returns the original filename for a type-checking shim file.
49
+ */
50
+ function getOriginalFilename(fileName) {
51
+ return fileName.slice(0, -TTC_EXTENSION_LENGTH) + '.ts';
52
+ }
33
53
  class AngularCompilationState {
34
54
  angularProgram;
35
55
  compilerHost;
@@ -39,7 +59,9 @@ class AngularCompilationState {
39
59
  webWorkerTransform;
40
60
  useTypeScriptTranspilation;
41
61
  diagnosticCache;
42
- constructor(angularProgram, compilerHost, typeScriptProgram, affectedFiles, templateDiagnosticsOptimization, webWorkerTransform, useTypeScriptTranspilation, diagnosticCache = new WeakMap()) {
62
+ filesWithoutDtsSignature;
63
+ useFallbackRootNames;
64
+ constructor(angularProgram, compilerHost, typeScriptProgram, affectedFiles, templateDiagnosticsOptimization, webWorkerTransform, useTypeScriptTranspilation, diagnosticCache = new WeakMap(), filesWithoutDtsSignature = new Set(), useFallbackRootNames = false) {
43
65
  this.angularProgram = angularProgram;
44
66
  this.compilerHost = compilerHost;
45
67
  this.typeScriptProgram = typeScriptProgram;
@@ -48,6 +70,8 @@ class AngularCompilationState {
48
70
  this.webWorkerTransform = webWorkerTransform;
49
71
  this.useTypeScriptTranspilation = useTypeScriptTranspilation;
50
72
  this.diagnosticCache = diagnosticCache;
73
+ this.filesWithoutDtsSignature = filesWithoutDtsSignature;
74
+ this.useFallbackRootNames = useFallbackRootNames;
51
75
  }
52
76
  get angularCompiler() {
53
77
  return this.angularProgram.compiler;
@@ -65,7 +89,7 @@ class AotCompilation extends typescript_compilation_1.TypeScriptCompilation {
65
89
  // Dynamically load the Angular compiler CLI package
66
90
  const { NgtscProgram, OptimizeFor } = await typescript_compilation_1.TypeScriptCompilation.loadCompilerCli();
67
91
  // Load the compiler configuration and transform as needed
68
- const { compilerOptions, rootNames, errors: configurationDiagnostics, warnings, } = await this.loadConfiguration(tsconfig, compilerOptionOverrides, buildType);
92
+ const { compilerOptions, rootNames, fallbackRootNames, errors: configurationDiagnostics, warnings, tsConfigFiles, } = await this.loadConfiguration(tsconfig, compilerOptionOverrides, buildType);
69
93
  const useTypeScriptTranspilation = compilerOptions['_useTypeScriptTranspilation'] ??
70
94
  !compilerOptions.isolatedModules;
71
95
  if (compilerOptions.externalRuntimeStyles) {
@@ -82,8 +106,8 @@ class AotCompilation extends typescript_compilation_1.TypeScriptCompilation {
82
106
  let clearPackageJsonCache = false;
83
107
  if (hostOptions.modifiedFiles) {
84
108
  this.invalidateFiles(hostOptions.modifiedFiles);
85
- for (const modifiedFile of hostOptions.modifiedFiles) {
86
- if (this.#state) {
109
+ if (this.#state && hostOptions.modifiedFiles.size > 0) {
110
+ for (const modifiedFile of hostOptions.modifiedFiles) {
87
111
  // Clear package.json cache if a node modules file was modified
88
112
  if (!clearPackageJsonCache && modifiedFile.includes('node_modules')) {
89
113
  clearPackageJsonCache = true;
@@ -98,14 +122,35 @@ class AotCompilation extends typescript_compilation_1.TypeScriptCompilation {
98
122
  }
99
123
  }
100
124
  }
125
+ if (environment_options_1.useTypeChecking || useTypeScriptTranspilation) {
126
+ populatePreviousDtsSignatures(this.#state.typeScriptProgram, hostOptions.modifiedFiles, this.#state.filesWithoutDtsSignature);
127
+ }
101
128
  }
102
129
  }
103
130
  // Create Angular compiler host
104
131
  const host = (0, angular_host_1.createAngularCompilerHost)(typescript_1.default, compilerOptions, hostOptions, packageJsonCache, this.sourceFiles);
132
+ // If a previous watch rebuild already fell back to the full tsconfig root file set,
133
+ // start directly with fallbackRootNames to avoid repeating the two-step check.
134
+ let useFallbackRootNames = this.#state?.useFallbackRootNames ?? false;
105
135
  // Create the Angular specific program that contains the Angular compiler
106
- const angularProgram = (0, profiling_1.profileSync)('NG_CREATE_PROGRAM', () => new NgtscProgram(rootNames, compilerOptions, host, this.#state?.angularProgram));
107
- const angularCompiler = angularProgram.compiler;
108
- const angularTypeScriptProgram = angularProgram.getTsProgram();
136
+ let angularProgram = (0, profiling_1.profileSync)('NG_CREATE_PROGRAM', () => new NgtscProgram((useFallbackRootNames && fallbackRootNames) || rootNames, compilerOptions, host, this.#state?.angularProgram));
137
+ let angularCompiler = angularProgram.compiler;
138
+ await (0, profiling_1.profileAsync)('NG_ANALYZE_PROGRAM', () => angularCompiler.analyzeAsync());
139
+ let angularTypeScriptProgram = angularProgram.getTsProgram();
140
+ // When rootFiles filtering is active and a non-standalone component without a resolved
141
+ // NgModule scope is encountered, its declaring NgModule may not be directly imported by
142
+ // the test entry points. Fall back to the full tsconfig root file set if it contains
143
+ // additional uncompiled files so the Angular compiler can discover all NgModules and
144
+ // resolve component compilation scopes.
145
+ if (!useFallbackRootNames &&
146
+ fallbackRootNames?.some((file) => !angularTypeScriptProgram.getSourceFile(file)) &&
147
+ hasUnscopedComponent(angularCompiler)) {
148
+ useFallbackRootNames = true;
149
+ angularProgram = (0, profiling_1.profileSync)('NG_CREATE_PROGRAM_FALLBACK', () => new NgtscProgram(fallbackRootNames, compilerOptions, host, angularProgram));
150
+ angularCompiler = angularProgram.compiler;
151
+ await (0, profiling_1.profileAsync)('NG_ANALYZE_PROGRAM_FALLBACK', () => angularCompiler.analyzeAsync());
152
+ angularTypeScriptProgram = angularProgram.getTsProgram();
153
+ }
109
154
  (0, angular_host_1.ensureSourceFileVersions)(angularTypeScriptProgram);
110
155
  let oldProgram = this.#state?.typeScriptProgram;
111
156
  let usingBuildInfo = false;
@@ -114,7 +159,15 @@ class AotCompilation extends typescript_compilation_1.TypeScriptCompilation {
114
159
  usingBuildInfo = !!oldProgram;
115
160
  }
116
161
  const typeScriptProgram = typescript_1.default.createEmitAndSemanticDiagnosticsBuilderProgram(angularTypeScriptProgram, host, oldProgram, configurationDiagnostics);
117
- await (0, profiling_1.profileAsync)('NG_ANALYZE_PROGRAM', () => angularCompiler.analyzeAsync());
162
+ const filesWithoutDtsSignature = this.#state?.filesWithoutDtsSignature ?? new Set();
163
+ if (!this.#state) {
164
+ for (const sourceFile of typeScriptProgram.getSourceFiles()) {
165
+ if (!sourceFile.isDeclarationFile &&
166
+ !angularCompiler.ignoreForDiagnostics.has(sourceFile)) {
167
+ filesWithoutDtsSignature.add(sourceFile.fileName);
168
+ }
169
+ }
170
+ }
118
171
  let templateUpdates;
119
172
  if (useHmr && hostOptions.modifiedFiles && this.#state) {
120
173
  const componentNodes = (0, hmr_candidates_1.collectHmrCandidates)(hostOptions.modifiedFiles, angularProgram, staleSourceFiles);
@@ -148,29 +201,44 @@ class AotCompilation extends typescript_compilation_1.TypeScriptCompilation {
148
201
  // `diagnoseFiles` mask), and in the isolatedModules fast path emit is per-file, so the
149
202
  // set is never read. Skip the walk in that case to avoid a discarded semantic pass.
150
203
  const affectedFiles = environment_options_1.useTypeChecking || useTypeScriptTranspilation
151
- ? (0, profiling_1.profileSync)('NG_FIND_AFFECTED', () => findAffectedFiles(typeScriptProgram, angularCompiler, usingBuildInfo))
204
+ ? (0, profiling_1.profileSync)('NG_FIND_AFFECTED', () => findAffectedFiles(typeScriptProgram, angularCompiler, usingBuildInfo, this.#state?.typeScriptProgram, filesWithoutDtsSignature))
152
205
  : new Set();
153
206
  const componentResourcesDependencies = new Map();
154
207
  // Get all files referenced in the TypeScript/Angular program including component resources
155
- const referencedFiles = typeScriptProgram
156
- .getSourceFiles()
157
- .filter((sourceFile) => !angularCompiler.ignoreForEmit.has(sourceFile))
158
- .flatMap((sourceFile) => {
208
+ const referencedFiles = [...tsConfigFiles];
209
+ for (const sourceFile of typeScriptProgram.getSourceFiles()) {
210
+ if (angularCompiler.ignoreForEmit.has(sourceFile)) {
211
+ continue;
212
+ }
213
+ referencedFiles.push(sourceFile.fileName);
214
+ if (sourceFile.isDeclarationFile) {
215
+ continue;
216
+ }
159
217
  const resourceDependencies = angularCompiler.getResourceDependencies(sourceFile);
160
218
  componentResourcesDependencies.set(sourceFile.fileName, resourceDependencies);
219
+ if (resourceDependencies.length === 0) {
220
+ continue;
221
+ }
222
+ referencedFiles.push(...resourceDependencies);
161
223
  // Also invalidate Angular diagnostics for a source file if component resources are modified
162
224
  if (this.#state && hostOptions.modifiedFiles?.size) {
163
225
  for (const resourceDependency of resourceDependencies) {
164
- if (hostOptions.modifiedFiles.has(resourceDependency)) {
165
- this.#state.diagnosticCache.delete(sourceFile);
166
- // Also mark as affected in case changed template affects diagnostics
167
- affectedFiles.add(sourceFile);
226
+ if (!hostOptions.modifiedFiles.has(resourceDependency) ||
227
+ /\.(?:css|scss|sass|less)$/i.test(resourceDependency)) {
228
+ continue;
229
+ }
230
+ this.#state.diagnosticCache.delete(sourceFile);
231
+ const oldSourceFile = this.#state.typeScriptProgram.getSourceFile(sourceFile.fileName);
232
+ if (oldSourceFile) {
233
+ this.#state.diagnosticCache.delete(oldSourceFile);
168
234
  }
235
+ // Also mark as affected in case changed template affects diagnostics
236
+ affectedFiles.add(sourceFile);
237
+ break;
169
238
  }
170
239
  }
171
- return [sourceFile.fileName, ...resourceDependencies];
172
- });
173
- this.#state = new AngularCompilationState(angularProgram, host, typeScriptProgram, affectedFiles, affectedFiles.size === 1 ? OptimizeFor.SingleFile : OptimizeFor.WholeProgram, (0, web_worker_transformer_1.createWorkerTransformer)(hostOptions.processWebWorker.bind(hostOptions)), useTypeScriptTranspilation, this.#state?.diagnosticCache);
240
+ }
241
+ this.#state = new AngularCompilationState(angularProgram, host, typeScriptProgram, affectedFiles, affectedFiles.size === 1 ? OptimizeFor.SingleFile : OptimizeFor.WholeProgram, (0, web_worker_transformer_1.createWorkerTransformer)(hostOptions.processWebWorker.bind(hostOptions)), useTypeScriptTranspilation, this.#state?.diagnosticCache, filesWithoutDtsSignature, useFallbackRootNames);
174
242
  return {
175
243
  compilerOptions,
176
244
  referencedFiles,
@@ -185,45 +253,67 @@ class AotCompilation extends typescript_compilation_1.TypeScriptCompilation {
185
253
  const { affectedFiles, angularCompiler, diagnosticCache, templateDiagnosticsOptimization, typeScriptProgram, } = this.#state;
186
254
  const syntactic = modes & angular_compilation_1.DiagnosticModes.Syntactic;
187
255
  const semantic = modes & angular_compilation_1.DiagnosticModes.Semantic;
188
- // Collect program level diagnostics
189
- if (modes & angular_compilation_1.DiagnosticModes.Option) {
190
- yield* typeScriptProgram.getConfigFileParsingDiagnostics();
191
- yield* angularCompiler.getOptionDiagnostics();
192
- yield* typeScriptProgram.getOptionsDiagnostics();
193
- }
194
- if (syntactic) {
195
- yield* typeScriptProgram.getGlobalDiagnostics();
196
- }
197
- // Collect source file specific diagnostics
198
- for (const sourceFile of typeScriptProgram.getSourceFiles()) {
199
- if (angularCompiler.ignoreForDiagnostics.has(sourceFile)) {
200
- continue;
256
+ try {
257
+ // Collect program level diagnostics
258
+ if (modes & angular_compilation_1.DiagnosticModes.Option) {
259
+ yield* typeScriptProgram.getConfigFileParsingDiagnostics();
260
+ yield* angularCompiler.getOptionDiagnostics();
261
+ yield* typeScriptProgram.getOptionsDiagnostics();
201
262
  }
202
263
  if (syntactic) {
203
- // TypeScript will use cached diagnostics for files that have not been
204
- // changed or affected for this build when using incremental building.
205
- yield* (0, profiling_1.profileSync)('NG_DIAGNOSTICS_SYNTACTIC', () => typeScriptProgram.getSyntacticDiagnostics(sourceFile), true);
206
- }
207
- if (!semantic) {
208
- continue;
209
- }
210
- yield* (0, profiling_1.profileSync)('NG_DIAGNOSTICS_SEMANTIC', () => typeScriptProgram.getSemanticDiagnostics(sourceFile), true);
211
- // Declaration files cannot have template diagnostics
212
- if (sourceFile.isDeclarationFile) {
213
- continue;
214
- }
215
- // Only request Angular template diagnostics for affected files to avoid
216
- // overhead of template diagnostics for unchanged files.
217
- if (affectedFiles.has(sourceFile)) {
218
- const angularDiagnostics = (0, profiling_1.profileSync)('NG_DIAGNOSTICS_TEMPLATE', () => angularCompiler.getDiagnosticsForFile(sourceFile, templateDiagnosticsOptimization), true);
219
- diagnosticCache.set(sourceFile, angularDiagnostics);
220
- yield* angularDiagnostics;
264
+ yield* typeScriptProgram.getGlobalDiagnostics();
221
265
  }
222
- else {
223
- const angularDiagnostics = diagnosticCache.get(sourceFile);
224
- if (angularDiagnostics) {
266
+ // Collect source file specific diagnostics
267
+ for (const sourceFile of typeScriptProgram.getSourceFiles()) {
268
+ if (angularCompiler.ignoreForDiagnostics.has(sourceFile)) {
269
+ continue;
270
+ }
271
+ if (syntactic) {
272
+ // TypeScript will use cached diagnostics for files that have not been
273
+ // changed or affected for this build when using incremental building.
274
+ yield* (0, profiling_1.profileSync)('NG_DIAGNOSTICS_SYNTACTIC', () => typeScriptProgram.getSyntacticDiagnostics(sourceFile), true);
275
+ }
276
+ if (!semantic) {
277
+ continue;
278
+ }
279
+ yield* (0, profiling_1.profileSync)('NG_DIAGNOSTICS_SEMANTIC', () => typeScriptProgram.getSemanticDiagnostics(sourceFile), true);
280
+ // Declaration files cannot have template diagnostics
281
+ if (sourceFile.isDeclarationFile) {
282
+ continue;
283
+ }
284
+ // Only request Angular template diagnostics for affected files to avoid
285
+ // overhead of template diagnostics for unchanged files.
286
+ if (affectedFiles.has(sourceFile)) {
287
+ const angularDiagnostics = (0, profiling_1.profileSync)('NG_DIAGNOSTICS_TEMPLATE', () => angularCompiler.getDiagnosticsForFile(sourceFile, templateDiagnosticsOptimization), true);
288
+ diagnosticCache.set(sourceFile, angularDiagnostics);
225
289
  yield* angularDiagnostics;
226
290
  }
291
+ else {
292
+ const angularDiagnostics = diagnosticCache.get(sourceFile);
293
+ if (angularDiagnostics) {
294
+ yield* angularDiagnostics;
295
+ }
296
+ }
297
+ }
298
+ }
299
+ finally {
300
+ // Angular's template typechecker lazily creates `.ngtypecheck.ts` shims in a new `ts.Program`
301
+ // during `getDiagnosticsForFile`. Sync the builder program with `angularCompiler.getCurrentProgram()`
302
+ // so the next incremental build does not treat all `.ngtypecheck.ts` files as newly added files.
303
+ const currentTsProgram = angularCompiler.getCurrentProgram();
304
+ if (currentTsProgram !== typeScriptProgram.getProgram()) {
305
+ (0, angular_host_1.ensureSourceFileVersions)(currentTsProgram, typeScriptProgram);
306
+ this.#state.typeScriptProgram = typescript_1.default.createEmitAndSemanticDiagnosticsBuilderProgram(currentTsProgram, this.#state.compilerHost, typeScriptProgram);
307
+ const baseEmit = currentTsProgram.emit;
308
+ currentTsProgram.emit = () => ({ emitSkipped: true, diagnostics: [] });
309
+ try {
310
+ while (this.#state.typeScriptProgram.getSemanticDiagnosticsOfNextAffectedFile(undefined, () => true)) {
311
+ /* empty */
312
+ }
313
+ }
314
+ finally {
315
+ currentTsProgram.emit = baseEmit;
316
+ }
227
317
  }
228
318
  }
229
319
  }
@@ -283,7 +373,7 @@ class AotCompilation extends typescript_compilation_1.TypeScriptCompilation {
283
373
  continue;
284
374
  }
285
375
  if (angularCompiler.incrementalCompilation.safeToSkipEmit(sourceFile) &&
286
- !affectedFiles.has(sourceFile)) {
376
+ (!useTypeScriptTranspilation || !affectedFiles.has(sourceFile))) {
287
377
  continue;
288
378
  }
289
379
  if (useTypeScriptTranspilation) {
@@ -326,33 +416,92 @@ class AotCompilation extends typescript_compilation_1.TypeScriptCompilation {
326
416
  }
327
417
  }
328
418
  exports.AotCompilation = AotCompilation;
329
- function findAffectedFiles(builder, { ignoreForDiagnostics }, includeTTC) {
419
+ function findAffectedFiles(builder, { ignoreForDiagnostics, incrementalCompilation }, includeTTC, oldBuilder, filesWithoutDtsSignature) {
330
420
  const affectedFiles = new Set();
331
- // eslint-disable-next-line no-constant-condition
332
- while (true) {
333
- const result = builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, (sourceFile) => {
334
- // If the affected file is a TTC shim, add the shim's original source file.
335
- // This ensures that changes that affect TTC are typechecked even when the changes
336
- // are otherwise unrelated from a TS perspective and do not result in Ivy codegen changes.
337
- // For example, changing @Input property types of a directive used in another component's
338
- // template.
339
- // A TTC shim is a file that has been ignored for diagnostics and has a filename ending in `.ngtypecheck.ts`.
340
- if (ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith('.ngtypecheck.ts')) {
341
- // This file name conversion relies on internal compiler logic and should be converted
342
- // to an official method when available. 15 is length of `.ngtypecheck.ts`
343
- const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';
344
- const originalSourceFile = builder.getSourceFile(originalFilename);
345
- if (originalSourceFile) {
346
- affectedFiles.add(originalSourceFile);
421
+ // Temporarily disable `isolatedModules` and `verbatimModuleSyntax` while walking affected
422
+ // files so TypeScript's `getFilesAffectedByUpdatedShapeWhenModuleEmit` yields dependent
423
+ // `.ngtypecheck.ts` shims to the `ignoreSourceFile` callback when a file's `.d.ts` shape
424
+ // changes, instead of returning only the modified file itself.
425
+ const compilerOptions = builder.getCompilerOptions();
426
+ const prevIsolatedModules = compilerOptions.isolatedModules;
427
+ const prevVerbatimModuleSyntax = compilerOptions.verbatimModuleSyntax;
428
+ compilerOptions.isolatedModules = false;
429
+ compilerOptions.verbatimModuleSyntax = false;
430
+ const program = builder.getProgram();
431
+ const baseEmit = program.emit;
432
+ const oldProgram = oldBuilder?.getProgram();
433
+ program.emit = (targetSourceFile, writeFile, cancellationToken, emitOnly, customTransformers, ...rest) => {
434
+ if (targetSourceFile) {
435
+ if (isNgTypeCheckFile(targetSourceFile.fileName)) {
436
+ return { emitSkipped: true, diagnostics: [] };
437
+ }
438
+ if (oldProgram && filesWithoutDtsSignature.has(targetSourceFile.fileName)) {
439
+ const oldSourceFile = oldProgram.getSourceFile(targetSourceFile.fileName);
440
+ if (oldSourceFile) {
441
+ let oldDtsText;
442
+ let oldHasDiagnostics = false;
443
+ oldProgram.emit(oldSourceFile, (_fileName, text, _bom, _onError, _sourceFiles, data) => {
444
+ oldDtsText = text;
445
+ oldHasDiagnostics = !!data?.diagnostics
446
+ ?.length;
447
+ }, cancellationToken, emitOnly, customTransformers, ...rest);
448
+ return baseEmit.call(program, targetSourceFile, (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
449
+ const newHasDiagnostics = !!data
450
+ ?.diagnostics?.length;
451
+ if (text !== oldDtsText || newHasDiagnostics !== oldHasDiagnostics) {
452
+ filesWithoutDtsSignature.delete(targetSourceFile.fileName);
453
+ writeFile?.(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
454
+ }
455
+ }, cancellationToken, emitOnly, customTransformers, ...rest);
456
+ }
457
+ filesWithoutDtsSignature.delete(targetSourceFile.fileName);
458
+ }
459
+ }
460
+ return baseEmit.call(program, targetSourceFile, writeFile, cancellationToken, emitOnly, customTransformers, ...rest);
461
+ };
462
+ try {
463
+ while (builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, (sourceFile) => {
464
+ if (ignoreForDiagnostics.has(sourceFile)) {
465
+ // If the affected file is a TTC shim, add the shim's original source file.
466
+ // This ensures that changes that affect TTC are typechecked even when the changes
467
+ // are otherwise unrelated from a TS perspective and do not result in Ivy codegen changes.
468
+ // For example, changing @Input property types of a directive used in another component's
469
+ // template.
470
+ // A TTC shim is a file that has been ignored for diagnostics and has a filename ending in `.ngtypecheck.ts`.
471
+ if (isNgTypeCheckFile(sourceFile.fileName)) {
472
+ // This file name conversion relies on internal compiler logic and should be converted
473
+ // to an official method when available. 15 is length of `.ngtypecheck.ts`
474
+ const originalFilename = getOriginalFilename(sourceFile.fileName);
475
+ const originalSourceFile = builder.getSourceFile(originalFilename);
476
+ if (originalSourceFile) {
477
+ affectedFiles.add(originalSourceFile);
478
+ }
347
479
  }
348
- return true;
349
480
  }
350
- return false;
351
- });
352
- if (!result) {
353
- break;
481
+ else {
482
+ affectedFiles.add(sourceFile);
483
+ }
484
+ return true;
485
+ })) {
486
+ /* empty */
487
+ }
488
+ }
489
+ finally {
490
+ program.emit = baseEmit;
491
+ compilerOptions.isolatedModules = prevIsolatedModules;
492
+ compilerOptions.verbatimModuleSyntax = prevVerbatimModuleSyntax;
493
+ }
494
+ // Also include files identified by Angular's incremental compilation graph as needing
495
+ // re-emission or template re-typechecking (such as selector renames or required input changes
496
+ // that only affect Angular metadata without altering standard TypeScript `.d.ts` signatures).
497
+ for (const sourceFile of builder.getSourceFiles()) {
498
+ if (sourceFile.isDeclarationFile || ignoreForDiagnostics.has(sourceFile)) {
499
+ continue;
500
+ }
501
+ if (!incrementalCompilation.safeToSkipEmit(sourceFile) ||
502
+ incrementalCompilation.priorTypeCheckingResultsFor(sourceFile) === null) {
503
+ affectedFiles.add(sourceFile);
354
504
  }
355
- affectedFiles.add(result.affected);
356
505
  }
357
506
  // Add all files with associated template type checking files.
358
507
  // Stored TS build info does not have knowledge of the AOT compiler or the typechecking state of the templates.
@@ -360,10 +509,10 @@ function findAffectedFiles(builder, { ignoreForDiagnostics }, includeTTC) {
360
509
  // info is present.
361
510
  if (includeTTC) {
362
511
  for (const sourceFile of builder.getSourceFiles()) {
363
- if (ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith('.ngtypecheck.ts')) {
512
+ if (ignoreForDiagnostics.has(sourceFile) && isNgTypeCheckFile(sourceFile.fileName)) {
364
513
  // This file name conversion relies on internal compiler logic and should be converted
365
514
  // to an official method when available. 15 is length of `.ngtypecheck.ts`
366
- const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';
515
+ const originalFilename = getOriginalFilename(sourceFile.fileName);
367
516
  const originalSourceFile = builder.getSourceFile(originalFilename);
368
517
  if (originalSourceFile) {
369
518
  affectedFiles.add(originalSourceFile);
@@ -373,4 +522,100 @@ function findAffectedFiles(builder, { ignoreForDiagnostics }, includeTTC) {
373
522
  }
374
523
  return affectedFiles;
375
524
  }
525
+ /**
526
+ * Ensures `.d.ts` shape signatures are computed on the previous `BuilderProgram` for modified
527
+ * files before the next `BuilderProgram` is created.
528
+ *
529
+ * On the initial build (`oldProgram === undefined`), TypeScript initializes each file's shape
530
+ * signature to its `.ts` source version hash rather than emitting `.d.ts` declarations for every
531
+ * file. When a file is modified on a watch rebuild, TypeScript computes its new `.d.ts` signature
532
+ * and compares it against the previous program's stored signature. Emitting the `.d.ts` signature
533
+ * on `oldProgram` for the modified file replaces its initial `.ts` version hash with its true
534
+ * `.d.ts` signature prior to diffing, avoiding false-positive `.d.ts` cascades across importers.
535
+ */
536
+ function populatePreviousDtsSignatures(oldProgram, modifiedFiles, filesWithoutDtsSignature) {
537
+ const filesToUpdate = [];
538
+ for (const modifiedFile of modifiedFiles) {
539
+ const sf = oldProgram.getSourceFile(modifiedFile);
540
+ if (sf && !sf.isDeclarationFile && filesWithoutDtsSignature.delete(sf.fileName)) {
541
+ filesToUpdate.push(sf);
542
+ }
543
+ }
544
+ if (filesToUpdate.length === 0) {
545
+ return;
546
+ }
547
+ const compilerOptions = oldProgram.getCompilerOptions();
548
+ const prevDeclaration = compilerOptions.declaration;
549
+ const prevComposite = compilerOptions.composite;
550
+ const prevNoEmit = compilerOptions.noEmit;
551
+ const prevNoEmitOnError = compilerOptions.noEmitOnError;
552
+ compilerOptions.declaration = true;
553
+ compilerOptions.composite = false;
554
+ compilerOptions.noEmit = false;
555
+ compilerOptions.noEmitOnError = false;
556
+ const program = oldProgram.getProgram();
557
+ const baseEmit = program.emit;
558
+ program.emit = (targetSourceFile, writeFile, cancellationToken) => baseEmit.call(program, targetSourceFile, writeFile, cancellationToken, 2, // ts.EmitOnly.BuilderSignature
559
+ undefined, true);
560
+ try {
561
+ for (const sf of filesToUpdate) {
562
+ oldProgram.emit(sf, () => { }, undefined, true);
563
+ }
564
+ }
565
+ finally {
566
+ program.emit = baseEmit;
567
+ compilerOptions.declaration = prevDeclaration;
568
+ compilerOptions.composite = prevComposite;
569
+ compilerOptions.noEmit = prevNoEmit;
570
+ compilerOptions.noEmitOnError = prevNoEmitOnError;
571
+ }
572
+ }
573
+ /**
574
+ * Checks whether the analyzed Angular program contains any non-standalone `@Component`
575
+ * declarations in user source files that lack an owning `NgModule` scope.
576
+ */
577
+ function hasUnscopedComponent(angularCompiler) {
578
+ // `incrementalCompilation.state` is typed as the `IncrementalState` union
579
+ // (`AnalyzedIncrementalState | DeltaIncrementalState | FreshIncrementalState`), where only
580
+ // `AnalyzedIncrementalState` (populated once `analyzeAsync()` completes) contains
581
+ // `priorAnalysis`. Because the `IncrementalStateKind` discriminant enum is not re-exported
582
+ // from `@angular/compiler-cli`, narrow the union via `'priorAnalysis' in state`.
583
+ const state = angularCompiler.incrementalCompilation.state;
584
+ if (!('priorAnalysis' in state)) {
585
+ return false;
586
+ }
587
+ let templateTypeChecker;
588
+ for (const [sourceFile, records] of state.priorAnalysis) {
589
+ if (records.length === 0 || angularCompiler.ignoreForEmit.has(sourceFile)) {
590
+ continue;
591
+ }
592
+ for (const { node } of records) {
593
+ if (!typescript_1.default.isClassDeclaration(node)) {
594
+ continue;
595
+ }
596
+ const meta = angularCompiler.getMeta(node);
597
+ if (meta && 'isComponent' in meta && meta.isComponent && !meta.isStandalone) {
598
+ if (!templateTypeChecker) {
599
+ // `NgtscProgram` initializes `NgCompiler` with `enableTemplateTypeChecker = false`, which
600
+ // guards the public `getTemplateTypeChecker()` getter. Temporarily enable the flag after
601
+ // `analyzeAsync()` has already constructed `TemplateTypeCheckerImpl` so we can query
602
+ // `getOwningNgModule()` without altering `typeCheckingConfig.enableTemplateTypeChecker`.
603
+ const compiler = angularCompiler;
604
+ const previous = compiler.enableTemplateTypeChecker;
605
+ try {
606
+ compiler.enableTemplateTypeChecker = true;
607
+ templateTypeChecker = angularCompiler.getTemplateTypeChecker();
608
+ }
609
+ finally {
610
+ compiler.enableTemplateTypeChecker = previous;
611
+ }
612
+ }
613
+ if (templateTypeChecker.getOwningNgModule(node) === null) {
614
+ return true;
615
+ }
616
+ }
617
+ }
618
+ }
619
+ return false;
620
+ }
376
621
  //# sourceMappingURL=aot-compilation.js.map