@angular/core 21.0.0-next.0 → 21.0.0-next.10

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 (106) hide show
  1. package/fesm2022/_attribute-chunk.mjs +12 -0
  2. package/fesm2022/_attribute-chunk.mjs.map +1 -0
  3. package/fesm2022/_debug_node-chunk.mjs +18469 -0
  4. package/fesm2022/_debug_node-chunk.mjs.map +1 -0
  5. package/fesm2022/_effect-chunk.mjs +423 -0
  6. package/fesm2022/_effect-chunk.mjs.map +1 -0
  7. package/fesm2022/_effect-chunk2.mjs +2951 -0
  8. package/fesm2022/_effect-chunk2.mjs.map +1 -0
  9. package/fesm2022/_not_found-chunk.mjs +39 -0
  10. package/fesm2022/_not_found-chunk.mjs.map +1 -0
  11. package/fesm2022/_resource-chunk.mjs +378 -0
  12. package/fesm2022/_resource-chunk.mjs.map +1 -0
  13. package/fesm2022/_untracked-chunk.mjs +96 -0
  14. package/fesm2022/_untracked-chunk.mjs.map +1 -0
  15. package/fesm2022/_weak_ref-chunk.mjs +10 -0
  16. package/fesm2022/_weak_ref-chunk.mjs.map +1 -0
  17. package/fesm2022/core.mjs +2499 -4185
  18. package/fesm2022/core.mjs.map +1 -1
  19. package/fesm2022/primitives-di.mjs +23 -0
  20. package/fesm2022/primitives-di.mjs.map +1 -0
  21. package/fesm2022/primitives-event-dispatch.mjs +788 -0
  22. package/fesm2022/primitives-event-dispatch.mjs.map +1 -0
  23. package/fesm2022/primitives-signals.mjs +187 -0
  24. package/fesm2022/primitives-signals.mjs.map +1 -0
  25. package/fesm2022/rxjs-interop.mjs +210 -308
  26. package/fesm2022/rxjs-interop.mjs.map +1 -1
  27. package/fesm2022/testing.mjs +2309 -3170
  28. package/fesm2022/testing.mjs.map +1 -1
  29. package/package.json +18 -12
  30. package/resources/best-practices.md +56 -0
  31. package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +117 -0
  32. package/schematics/bundles/application-config-core.cjs +84 -0
  33. package/schematics/bundles/{apply_import_manager-DR9xXCle.cjs → apply_import_manager-1Zs_gpB6.cjs} +4 -5
  34. package/schematics/bundles/bootstrap-options-migration.cjs +598 -0
  35. package/schematics/bundles/cleanup-unused-imports.cjs +9 -13
  36. package/schematics/bundles/common-to-standalone-migration.cjs +381 -0
  37. package/schematics/bundles/{compiler_host-BXBP7CE2.cjs → compiler_host-DBwYMlTo.cjs} +10 -11
  38. package/schematics/bundles/control-flow-migration.cjs +122 -119
  39. package/schematics/bundles/{imports-CIX-JgAN.cjs → imports-DP72APSx.cjs} +6 -1
  40. package/schematics/bundles/{index-CfTQUOiz.cjs → index-B7I9sIUx.cjs} +36 -39
  41. package/schematics/bundles/inject-migration.cjs +148 -70
  42. package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
  43. package/schematics/bundles/{migrate_ts_type_references-6NtAj-Wk.cjs → migrate_ts_type_references-UGIUl7En.cjs} +500 -24
  44. package/schematics/bundles/ng_component_template-Dsuq1Lw7.cjs +185 -0
  45. package/schematics/bundles/{ng_decorators-B5HCqr20.cjs → ng_decorators-DSFlWYQY.cjs} +2 -2
  46. package/schematics/bundles/ngclass-to-class-migration.cjs +542 -0
  47. package/schematics/bundles/ngstyle-to-style-migration.cjs +487 -0
  48. package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
  49. package/schematics/bundles/output-migration.cjs +16 -19
  50. package/schematics/bundles/parse_html-8VLCL37B.cjs +132 -0
  51. package/schematics/bundles/{project_paths-DcaODbky.cjs → project_paths-DvD50ouC.cjs} +14 -247
  52. package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +90 -0
  53. package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
  54. package/schematics/bundles/route-lazy-loading.cjs +54 -26
  55. package/schematics/bundles/router-current-navigation.cjs +7 -18
  56. package/schematics/bundles/router-last-successful-navigation.cjs +7 -18
  57. package/schematics/bundles/router-testing-module-migration.cjs +502 -0
  58. package/schematics/bundles/self-closing-tags-migration.cjs +17 -216
  59. package/schematics/bundles/signal-input-migration.cjs +93 -29
  60. package/schematics/bundles/signal-queries-migration.cjs +22 -25
  61. package/schematics/bundles/signals.cjs +10 -13
  62. package/schematics/bundles/standalone-migration.cjs +135 -102
  63. package/schematics/bundles/{symbol-VPWguRxr.cjs → symbol-BObKoqes.cjs} +3 -2
  64. package/schematics/collection.json +23 -0
  65. package/schematics/migrations/common-to-standalone-migration/schema.json +14 -0
  66. package/schematics/migrations/ngclass-to-class-migration/schema.json +20 -0
  67. package/schematics/migrations/ngstyle-to-style-migration/schema.json +20 -0
  68. package/schematics/migrations/router-testing-module-migration/schema.json +14 -0
  69. package/schematics/migrations.json +16 -2
  70. package/{api.d.d.ts → types/_api-chunk.d.ts} +9 -6
  71. package/{chrome_dev_tools_performance.d.d.ts → types/_chrome_dev_tools_performance-chunk.d.ts} +26 -31
  72. package/{discovery.d.d.ts → types/_discovery-chunk.d.ts} +135 -98
  73. package/{signal.d.d.ts → types/_effect-chunk.d.ts} +14 -5
  74. package/{event_dispatcher.d.d.ts → types/_event_dispatcher-chunk.d.ts} +2 -2
  75. package/{graph.d.d.ts → types/_formatter-chunk.d.ts} +40 -7
  76. package/{weak_ref.d.d.ts → types/_weak_ref-chunk.d.ts} +2 -2
  77. package/{index.d.ts → types/core.d.ts} +233 -305
  78. package/{primitives/di/index.d.ts → types/primitives-di.d.ts} +2 -2
  79. package/{primitives/event-dispatch/index.d.ts → types/primitives-event-dispatch.d.ts} +4 -4
  80. package/{primitives/signals/index.d.ts → types/primitives-signals.d.ts} +7 -8
  81. package/{rxjs-interop/index.d.ts → types/rxjs-interop.d.ts} +8 -6
  82. package/{testing/index.d.ts → types/testing.d.ts} +7 -7
  83. package/fesm2022/attribute.mjs +0 -24
  84. package/fesm2022/attribute.mjs.map +0 -1
  85. package/fesm2022/debug_node.mjs +0 -31833
  86. package/fesm2022/debug_node.mjs.map +0 -1
  87. package/fesm2022/not_found.mjs +0 -56
  88. package/fesm2022/not_found.mjs.map +0 -1
  89. package/fesm2022/primitives/di.mjs +0 -23
  90. package/fesm2022/primitives/di.mjs.map +0 -1
  91. package/fesm2022/primitives/event-dispatch.mjs +0 -1622
  92. package/fesm2022/primitives/event-dispatch.mjs.map +0 -1
  93. package/fesm2022/primitives/signals.mjs +0 -89
  94. package/fesm2022/primitives/signals.mjs.map +0 -1
  95. package/fesm2022/resource.mjs +0 -633
  96. package/fesm2022/resource.mjs.map +0 -1
  97. package/fesm2022/root_effect_scheduler.mjs +0 -4007
  98. package/fesm2022/root_effect_scheduler.mjs.map +0 -1
  99. package/fesm2022/signal.mjs +0 -560
  100. package/fesm2022/signal.mjs.map +0 -1
  101. package/fesm2022/untracked.mjs +0 -117
  102. package/fesm2022/untracked.mjs.map +0 -1
  103. package/fesm2022/weak_ref.mjs +0 -12
  104. package/fesm2022/weak_ref.mjs.map +0 -1
  105. package/schematics/bundles/index-esqfDjNB.cjs +0 -22074
  106. package/schematics/bundles/project_tsconfig_paths-CS-eSeHC.cjs +0 -51062
@@ -0,0 +1,132 @@
1
+ 'use strict';
2
+ /**
3
+ * @license Angular v21.0.0-next.10
4
+ * (c) 2010-2025 Google LLC. https://angular.io/
5
+ * License: MIT
6
+ */
7
+ 'use strict';
8
+
9
+ var compiler = require('@angular/compiler');
10
+
11
+ /**
12
+ * parses the template string into the Html AST
13
+ */
14
+ function parseTemplate(template) {
15
+ let parsed;
16
+ try {
17
+ // Note: we use the HtmlParser here, instead of the `parseTemplate` function, because the
18
+ // latter returns an Ivy AST, not an HTML AST. The HTML AST has the advantage of preserving
19
+ // interpolated text as text nodes containing a mixture of interpolation tokens and text tokens,
20
+ // rather than turning them into `BoundText` nodes like the Ivy AST does. This allows us to
21
+ // easily get the text-only ranges without having to reconstruct the original text.
22
+ parsed = new compiler.HtmlParser().parse(template, '', {
23
+ // Allows for ICUs to be parsed.
24
+ tokenizeExpansionForms: true,
25
+ // Explicitly disable blocks so that their characters are treated as plain text.
26
+ tokenizeBlocks: true,
27
+ preserveLineEndings: true,
28
+ });
29
+ // Don't migrate invalid templates.
30
+ if (parsed.errors && parsed.errors.length > 0) {
31
+ const errors = parsed.errors.map((e) => ({ type: 'parse', error: e }));
32
+ return { tree: undefined, errors };
33
+ }
34
+ }
35
+ catch (e) {
36
+ return { tree: undefined, errors: [{ type: 'parse', error: e }] };
37
+ }
38
+ return { tree: parsed, errors: [] };
39
+ }
40
+ function pipeMatchRegExpFor(name) {
41
+ return new RegExp(`\\|\\s*${name}`);
42
+ }
43
+ const commonModulePipes = [
44
+ 'date',
45
+ 'async',
46
+ 'currency',
47
+ 'number',
48
+ 'i18nPlural',
49
+ 'i18nSelect',
50
+ 'json',
51
+ 'keyvalue',
52
+ 'slice',
53
+ 'lowercase',
54
+ 'uppercase',
55
+ 'titlecase',
56
+ 'percent',
57
+ ].map((name) => pipeMatchRegExpFor(name));
58
+ function allFormsOf(selector) {
59
+ return [selector, `*${selector}`, `[${selector}]`];
60
+ }
61
+ const commonModuleDirectives = new Set([
62
+ ...allFormsOf('ngComponentOutlet'),
63
+ ...allFormsOf('ngTemplateOutlet'),
64
+ ...allFormsOf('ngClass'),
65
+ ...allFormsOf('ngPlural'),
66
+ ...allFormsOf('ngPluralCase'),
67
+ ...allFormsOf('ngStyle'),
68
+ ...allFormsOf('ngTemplateOutlet'),
69
+ ...allFormsOf('ngComponentOutlet'),
70
+ '[NgForOf]',
71
+ '[NgForTrackBy]',
72
+ '[ngIfElse]',
73
+ '[ngIfThenElse]',
74
+ '*ngIf',
75
+ '*ngSwitch',
76
+ '*ngFor',
77
+ ]);
78
+ /**
79
+ * determines if the CommonModule can be safely removed from imports
80
+ */
81
+ function canRemoveCommonModule(template) {
82
+ const parsed = parseTemplate(template);
83
+ let removeCommonModule = false;
84
+ if (parsed.tree !== undefined) {
85
+ const visitor = new CommonCollector();
86
+ compiler.visitAll(visitor, parsed.tree.rootNodes);
87
+ removeCommonModule = visitor.count === 0;
88
+ }
89
+ return removeCommonModule;
90
+ }
91
+ /** Finds all non-control flow elements from common module. */
92
+ class CommonCollector extends compiler.RecursiveVisitor {
93
+ count = 0;
94
+ visitElement(el) {
95
+ if (el.attrs.length > 0) {
96
+ for (const attr of el.attrs) {
97
+ if (this.hasDirectives(attr.name) || this.hasPipes(attr.value)) {
98
+ this.count++;
99
+ }
100
+ }
101
+ }
102
+ super.visitElement(el, null);
103
+ }
104
+ visitBlock(ast) {
105
+ for (const blockParam of ast.parameters) {
106
+ if (this.hasPipes(blockParam.expression)) {
107
+ this.count++;
108
+ }
109
+ }
110
+ super.visitBlock(ast, null);
111
+ }
112
+ visitText(ast) {
113
+ if (this.hasPipes(ast.value)) {
114
+ this.count++;
115
+ }
116
+ }
117
+ visitLetDeclaration(decl) {
118
+ if (this.hasPipes(decl.value)) {
119
+ this.count++;
120
+ }
121
+ super.visitLetDeclaration(decl, null);
122
+ }
123
+ hasDirectives(input) {
124
+ return commonModuleDirectives.has(input);
125
+ }
126
+ hasPipes(input) {
127
+ return commonModulePipes.some((regexp) => regexp.test(input));
128
+ }
129
+ }
130
+
131
+ exports.canRemoveCommonModule = canRemoveCommonModule;
132
+ exports.parseTemplate = parseTemplate;
@@ -1,20 +1,19 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.0
3
+ * @license Angular v21.0.0-next.10
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
- var index = require('./index-esqfDjNB.cjs');
9
+ var compilerCli = require('@angular/compiler-cli');
10
10
  var schematics = require('@angular-devkit/schematics');
11
11
  var core = require('@angular-devkit/core');
12
12
  var posixPath = require('node:path/posix');
13
- var os = require('os');
13
+ var migrations = require('@angular/compiler-cli/private/migrations');
14
14
  var ts = require('typescript');
15
- var project_tsconfig_paths = require('./project_tsconfig_paths-CS-eSeHC.cjs');
16
- require('path');
17
15
  var path = require('node:path');
16
+ var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.cjs');
18
17
 
19
18
  function _interopNamespaceDefault(e) {
20
19
  var n = Object.create(null);
@@ -34,233 +33,8 @@ function _interopNamespaceDefault(e) {
34
33
  }
35
34
 
36
35
  var posixPath__namespace = /*#__PURE__*/_interopNamespaceDefault(posixPath);
37
- var os__namespace = /*#__PURE__*/_interopNamespaceDefault(os);
38
36
  var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
39
37
 
40
- /// <reference types="node" />
41
- class NgtscCompilerHost {
42
- fs;
43
- options;
44
- constructor(fs, options = {}) {
45
- this.fs = fs;
46
- this.options = options;
47
- }
48
- getSourceFile(fileName, languageVersion) {
49
- const text = this.readFile(fileName);
50
- return text !== undefined
51
- ? ts.createSourceFile(fileName, text, languageVersion, true)
52
- : undefined;
53
- }
54
- getDefaultLibFileName(options) {
55
- return this.fs.join(this.getDefaultLibLocation(), ts.getDefaultLibFileName(options));
56
- }
57
- getDefaultLibLocation() {
58
- return this.fs.getDefaultLibLocation();
59
- }
60
- writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles) {
61
- const path = project_tsconfig_paths.absoluteFrom(fileName);
62
- this.fs.ensureDir(this.fs.dirname(path));
63
- this.fs.writeFile(path, data);
64
- }
65
- getCurrentDirectory() {
66
- return this.fs.pwd();
67
- }
68
- getCanonicalFileName(fileName) {
69
- return this.useCaseSensitiveFileNames() ? fileName : fileName.toLowerCase();
70
- }
71
- useCaseSensitiveFileNames() {
72
- return this.fs.isCaseSensitive();
73
- }
74
- getNewLine() {
75
- switch (this.options.newLine) {
76
- case ts.NewLineKind.CarriageReturnLineFeed:
77
- return '\r\n';
78
- case ts.NewLineKind.LineFeed:
79
- return '\n';
80
- default:
81
- return os__namespace.EOL;
82
- }
83
- }
84
- fileExists(fileName) {
85
- const absPath = this.fs.resolve(fileName);
86
- return this.fs.exists(absPath) && this.fs.stat(absPath).isFile();
87
- }
88
- readFile(fileName) {
89
- const absPath = this.fs.resolve(fileName);
90
- if (!this.fileExists(absPath)) {
91
- return undefined;
92
- }
93
- return this.fs.readFile(absPath);
94
- }
95
- realpath(path) {
96
- return this.fs.realpath(this.fs.resolve(path));
97
- }
98
- }
99
-
100
- // We use TypeScript's native `ts.matchFiles` utility for the virtual file systems
101
- // and their TypeScript compiler host `readDirectory` implementation. TypeScript's
102
- // function implements complex logic for matching files with respect to root
103
- // directory, extensions, excludes, includes etc. The function is currently
104
- // internal but we can use it as the API most likely will not change any time soon,
105
- // nor does it seem like this is being made public any time soon.
106
- // Related issue for tracking: https://github.com/microsoft/TypeScript/issues/13793.
107
- /**
108
- * Creates a {@link ts.CompilerHost#readDirectory} implementation function,
109
- * that leverages the specified file system (that may be e.g. virtual).
110
- */
111
- function createFileSystemTsReadDirectoryFn(fs) {
112
- if (ts.matchFiles === undefined) {
113
- throw Error('Unable to read directory in configured file system. This means that ' +
114
- 'TypeScript changed its file matching internals.\n\nPlease consider downgrading your ' +
115
- 'TypeScript version, and report an issue in the Angular framework repository.');
116
- }
117
- const matchFilesFn = ts.matchFiles.bind(ts);
118
- return (rootDir, extensions, excludes, includes, depth) => {
119
- const directoryExists = (p) => {
120
- const resolvedPath = fs.resolve(p);
121
- return fs.exists(resolvedPath) && fs.stat(resolvedPath).isDirectory();
122
- };
123
- return matchFilesFn(rootDir, extensions, excludes, includes, fs.isCaseSensitive(), fs.pwd(), depth, (p) => {
124
- const resolvedPath = fs.resolve(p);
125
- // TS also gracefully returns an empty file set.
126
- if (!directoryExists(resolvedPath)) {
127
- return { directories: [], files: [] };
128
- }
129
- const children = fs.readdir(resolvedPath);
130
- const files = [];
131
- const directories = [];
132
- for (const child of children) {
133
- if (fs.stat(fs.join(resolvedPath, child))?.isDirectory()) {
134
- directories.push(child);
135
- }
136
- else {
137
- files.push(child);
138
- }
139
- }
140
- return { files, directories };
141
- }, (p) => fs.resolve(p), (p) => directoryExists(p));
142
- };
143
- }
144
-
145
- function calcProjectFileAndBasePath(project, host = project_tsconfig_paths.getFileSystem()) {
146
- const absProject = host.resolve(project);
147
- const projectIsDir = host.lstat(absProject).isDirectory();
148
- const projectFile = projectIsDir ? host.join(absProject, 'tsconfig.json') : absProject;
149
- const projectDir = projectIsDir ? absProject : host.dirname(absProject);
150
- const basePath = host.resolve(projectDir);
151
- return { projectFile, basePath };
152
- }
153
- function readConfiguration(project, existingOptions, host = project_tsconfig_paths.getFileSystem()) {
154
- try {
155
- const fs = project_tsconfig_paths.getFileSystem();
156
- const readConfigFile = (configFile) => ts.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
157
- const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
158
- const { config, error } = readConfigFile(configFile);
159
- if (error) {
160
- // Errors are handled later on by 'parseJsonConfigFileContent'
161
- return parentOptions;
162
- }
163
- // Note: In Google, `angularCompilerOptions` are stored in `bazelOptions`.
164
- // This function typically doesn't run for actual Angular compilations, but
165
- // tooling like Tsurge, or schematics may leverage this helper, so we account
166
- // for this here.
167
- const angularCompilerOptions = config.angularCompilerOptions ?? config.bazelOptions?.angularCompilerOptions;
168
- // we are only interested into merging 'angularCompilerOptions' as
169
- // other options like 'compilerOptions' are merged by TS
170
- let existingNgCompilerOptions = { ...angularCompilerOptions, ...parentOptions };
171
- if (!config.extends) {
172
- return existingNgCompilerOptions;
173
- }
174
- const extendsPaths = typeof config.extends === 'string' ? [config.extends] : config.extends;
175
- // Call readAngularCompilerOptions recursively to merge NG Compiler options
176
- // Reverse the array so the overrides happen from right to left.
177
- return [...extendsPaths].reverse().reduce((prevOptions, extendsPath) => {
178
- const extendedConfigPath = getExtendedConfigPath(configFile, extendsPath, host, fs);
179
- return extendedConfigPath === null
180
- ? prevOptions
181
- : readAngularCompilerOptions(extendedConfigPath, prevOptions);
182
- }, existingNgCompilerOptions);
183
- };
184
- const { projectFile, basePath } = calcProjectFileAndBasePath(project, host);
185
- const configFileName = host.resolve(host.pwd(), projectFile);
186
- const { config, error } = readConfigFile(projectFile);
187
- if (error) {
188
- return {
189
- project,
190
- errors: [error],
191
- rootNames: [],
192
- options: {},
193
- emitFlags: index.EmitFlags.Default,
194
- };
195
- }
196
- const existingCompilerOptions = {
197
- genDir: basePath,
198
- basePath,
199
- ...readAngularCompilerOptions(configFileName),
200
- ...existingOptions,
201
- };
202
- const parseConfigHost = createParseConfigHost(host, fs);
203
- const { options, errors, fileNames: rootNames, projectReferences, } = ts.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
204
- let emitFlags = index.EmitFlags.Default;
205
- if (!(options['skipMetadataEmit'] || options['flatModuleOutFile'])) {
206
- emitFlags |= index.EmitFlags.Metadata;
207
- }
208
- if (options['skipTemplateCodegen']) {
209
- emitFlags = emitFlags & ~index.EmitFlags.Codegen;
210
- }
211
- return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
212
- }
213
- catch (e) {
214
- const errors = [
215
- {
216
- category: ts.DiagnosticCategory.Error,
217
- messageText: e.stack ?? e.message,
218
- file: undefined,
219
- start: undefined,
220
- length: undefined,
221
- source: 'angular',
222
- code: index.UNKNOWN_ERROR_CODE,
223
- },
224
- ];
225
- return { project: '', errors, rootNames: [], options: {}, emitFlags: index.EmitFlags.Default };
226
- }
227
- }
228
- function createParseConfigHost(host, fs = project_tsconfig_paths.getFileSystem()) {
229
- return {
230
- fileExists: host.exists.bind(host),
231
- readDirectory: createFileSystemTsReadDirectoryFn(fs),
232
- readFile: host.readFile.bind(host),
233
- useCaseSensitiveFileNames: fs.isCaseSensitive(),
234
- };
235
- }
236
- function getExtendedConfigPath(configFile, extendsValue, host, fs) {
237
- const result = getExtendedConfigPathWorker(configFile, extendsValue, host, fs);
238
- if (result !== null) {
239
- return result;
240
- }
241
- // Try to resolve the paths with a json extension append a json extension to the file in case if
242
- // it is missing and the resolution failed. This is to replicate TypeScript behaviour, see:
243
- // https://github.com/microsoft/TypeScript/blob/294a5a7d784a5a95a8048ee990400979a6bc3a1c/src/compiler/commandLineParser.ts#L2806
244
- return getExtendedConfigPathWorker(configFile, `${extendsValue}.json`, host, fs);
245
- }
246
- function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
247
- if (extendsValue.startsWith('.') || fs.isRooted(extendsValue)) {
248
- const extendedConfigPath = host.resolve(host.dirname(configFile), extendsValue);
249
- if (host.exists(extendedConfigPath)) {
250
- return extendedConfigPath;
251
- }
252
- }
253
- else {
254
- const parseConfigHost = createParseConfigHost(host, fs);
255
- // Path isn't a rooted or relative path, resolve like a module.
256
- const { resolvedModule } = ts.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
257
- if (resolvedModule) {
258
- return project_tsconfig_paths.absoluteFrom(resolvedModule.resolvedFileName);
259
- }
260
- }
261
- return null;
262
- }
263
-
264
38
  /**
265
39
  * Angular compiler file system implementation that leverages an
266
40
  * CLI schematic virtual file tree.
@@ -495,7 +269,7 @@ function createPlainTsProgram(tsHost, tsconfig, optionOverrides) {
495
269
  * an instance of the Angular compiler for the project.
496
270
  */
497
271
  function createNgtscProgram(tsHost, tsconfig, optionOverrides) {
498
- const ngtscProgram = new index.NgtscProgram(tsconfig.rootNames, {
272
+ const ngtscProgram = new compilerCli.NgtscProgram(tsconfig.rootNames, {
499
273
  ...tsconfig.options,
500
274
  ...defaultMigrationTsOptions,
501
275
  ...optionOverrides,
@@ -517,7 +291,7 @@ function createNgtscProgram(tsHost, tsconfig, optionOverrides) {
517
291
  const NO_INPUTS_ERROR_CODE = 18003;
518
292
  /** Parses the given tsconfig file, supporting Angular compiler options. */
519
293
  function parseTsconfigOrDie(absoluteTsconfigPath, fs) {
520
- const tsconfig = readConfiguration(absoluteTsconfigPath, {}, fs);
294
+ const tsconfig = compilerCli.readConfiguration(absoluteTsconfigPath, {}, fs);
521
295
  // Skip the "No inputs found..." error since we don't want to interrupt the migration if a
522
296
  // tsconfig doesn't match a file. This will result in an empty `Program` which is still valid.
523
297
  const errors = tsconfig.errors.filter((diag) => diag.code !== NO_INPUTS_ERROR_CODE);
@@ -555,9 +329,9 @@ function createBaseProgramInfo(absoluteTsconfigPath, fs, optionOverrides = {}) {
555
329
  // Make sure the FS becomes globally available. Some code paths
556
330
  // of the Angular compiler, or tsconfig parsing aren't leveraging
557
331
  // the specified file system.
558
- project_tsconfig_paths.setFileSystem(fs);
332
+ compilerCli.setFileSystem(fs);
559
333
  const tsconfig = parseTsconfigOrDie(absoluteTsconfigPath, fs);
560
- const tsHost = new NgtscCompilerHost(fs, tsconfig.options);
334
+ const tsHost = new compilerCli.NgtscCompilerHost(fs, tsconfig.options);
561
335
  // When enabled, use a plain TS program if we are sure it's not
562
336
  // an Angular project based on the `tsconfig.json`.
563
337
  if (google3UsePlainTsProgramIfNoKnownAngularOption() &&
@@ -584,14 +358,14 @@ function getProgramInfoFromBaseInfo(baseInfo) {
584
358
  const fullProgramSourceFiles = [...baseInfo.program.getSourceFiles()];
585
359
  const sourceFiles = fullProgramSourceFiles.filter((f) => !f.isDeclarationFile &&
586
360
  // Note `isShim` will work for the initial program, but for TCB programs, the shims are no longer annotated.
587
- !project_tsconfig_paths.isShim(f) &&
361
+ !migrations.isShim(f) &&
588
362
  !f.fileName.endsWith('.ngtypecheck.ts'));
589
363
  // Sort it by length in reverse order (longest first). This speeds up lookups,
590
364
  // since there's no need to keep going through the array once a match is found.
591
- const sortedRootDirs = project_tsconfig_paths.getRootDirs(baseInfo.host, baseInfo.userOptions).sort((a, b) => b.length - a.length);
365
+ const sortedRootDirs = migrations.getRootDirs(baseInfo.host, baseInfo.userOptions).sort((a, b) => b.length - a.length);
592
366
  // TODO: Consider also following TS's logic here, finding the common source root.
593
367
  // See: Program#getCommonSourceDirectory.
594
- const primaryRoot = project_tsconfig_paths.absoluteFrom(baseInfo.userOptions.rootDir ?? sortedRootDirs.at(-1) ?? baseInfo.program.getCurrentDirectory());
368
+ const primaryRoot = compilerCli.absoluteFrom(baseInfo.userOptions.rootDir ?? sortedRootDirs.at(-1) ?? baseInfo.program.getCurrentDirectory());
595
369
  return {
596
370
  ...baseInfo,
597
371
  sourceFiles,
@@ -648,13 +422,6 @@ class TsurgeFunnelMigration extends TsurgeBaseMigration {
648
422
  class TsurgeComplexMigration extends TsurgeBaseMigration {
649
423
  }
650
424
 
651
- /*!
652
- * @license
653
- * Copyright Google LLC All Rights Reserved.
654
- *
655
- * Use of this source code is governed by an MIT-style license that can be
656
- * found in the LICENSE file at https://angular.dev/license
657
- */
658
425
  exports.MigrationStage = void 0;
659
426
  (function (MigrationStage) {
660
427
  /** The migration is analyzing an entrypoint */
@@ -670,7 +437,7 @@ async function runMigrationInDevkit(config) {
670
437
  }
671
438
  const tsconfigPaths = [...buildPaths, ...testPaths];
672
439
  const fs = new DevkitMigrationFilesystem(config.tree);
673
- project_tsconfig_paths.setFileSystem(fs);
440
+ compilerCli.setFileSystem(fs);
674
441
  const migration = config.getMigration(fs);
675
442
  const unitResults = [];
676
443
  const isFunnelMigration = migration instanceof TsurgeFunnelMigration;
@@ -780,7 +547,7 @@ function confirmAsSerializable(data) {
780
547
  * See {@link ProjectFile}.
781
548
  */
782
549
  function projectFile(file, { sortedRootDirs, projectRoot }) {
783
- const fs = project_tsconfig_paths.getFileSystem();
550
+ const fs = compilerCli.getFileSystem();
784
551
  const filePath = fs.resolve(typeof file === 'string' ? file : file.fileName);
785
552
  // Sorted root directories are sorted longest to shortest. First match
786
553
  // is the appropriate root directory for ID computation.
@@ -807,7 +574,7 @@ function projectFile(file, { sortedRootDirs, projectRoot }) {
807
574
  * E.g. `a/b/c` is within `a/b` but not within `a/x`.
808
575
  */
809
576
  function isWithinBasePath(fs, base, path) {
810
- return project_tsconfig_paths.isLocalRelativePath(fs.relative(base, path));
577
+ return compilerCli.isLocalRelativePath(fs.relative(base, path));
811
578
  }
812
579
 
813
580
  exports.Replacement = Replacement;
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+ /**
3
+ * @license Angular v21.0.0-next.10
4
+ * (c) 2010-2025 Google LLC. https://angular.io/
5
+ * License: MIT
6
+ */
7
+ 'use strict';
8
+
9
+ var core = require('@angular-devkit/core');
10
+
11
+ /**
12
+ * Gets all tsconfig paths from a CLI project by reading the workspace configuration
13
+ * and looking for common tsconfig locations.
14
+ */
15
+ async function getProjectTsConfigPaths(tree) {
16
+ // Start with some tsconfig paths that are generally used within CLI projects. Note
17
+ // that we are not interested in IDE-specific tsconfig files (e.g. /tsconfig.json)
18
+ const buildPaths = new Set();
19
+ const testPaths = new Set();
20
+ const workspace = await getWorkspace(tree);
21
+ for (const [, project] of workspace.projects) {
22
+ for (const [name, target] of project.targets) {
23
+ if (name !== 'build' && name !== 'test') {
24
+ continue;
25
+ }
26
+ for (const [, options] of allTargetOptions(target)) {
27
+ const tsConfig = options['tsConfig'];
28
+ // Filter out tsconfig files that don't exist in the CLI project.
29
+ if (typeof tsConfig !== 'string' || !tree.exists(tsConfig)) {
30
+ continue;
31
+ }
32
+ if (name === 'build') {
33
+ buildPaths.add(core.normalize(tsConfig));
34
+ }
35
+ else {
36
+ testPaths.add(core.normalize(tsConfig));
37
+ }
38
+ }
39
+ }
40
+ }
41
+ return {
42
+ buildPaths: [...buildPaths],
43
+ testPaths: [...testPaths],
44
+ };
45
+ }
46
+ /** Get options for all configurations for the passed builder target. */
47
+ function* allTargetOptions(target) {
48
+ if (target.options) {
49
+ yield [undefined, target.options];
50
+ }
51
+ if (!target.configurations) {
52
+ return;
53
+ }
54
+ for (const [name, options] of Object.entries(target.configurations)) {
55
+ if (options) {
56
+ yield [name, options];
57
+ }
58
+ }
59
+ }
60
+ function createHost(tree) {
61
+ return {
62
+ async readFile(path) {
63
+ const data = tree.read(path);
64
+ if (!data) {
65
+ throw new Error('File not found.');
66
+ }
67
+ return core.virtualFs.fileBufferToString(data);
68
+ },
69
+ async writeFile(path, data) {
70
+ return tree.overwrite(path, data);
71
+ },
72
+ async isDirectory(path) {
73
+ // Approximate a directory check.
74
+ // We don't need to consider empty directories and hence this is a good enough approach.
75
+ // This is also per documentation, see:
76
+ // https://angular.dev/tools/cli/schematics-for-libraries#get-the-project-configuration
77
+ return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
78
+ },
79
+ async isFile(path) {
80
+ return tree.exists(path);
81
+ },
82
+ };
83
+ }
84
+ async function getWorkspace(tree) {
85
+ const host = createHost(tree);
86
+ const { workspace } = await core.workspaces.readWorkspace('/', host);
87
+ return workspace;
88
+ }
89
+
90
+ exports.getProjectTsConfigPaths = getProjectTsConfigPaths;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.0
3
+ * @license Angular v21.0.0-next.10
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */