@angular/core 19.2.13 → 19.2.15
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.
- package/event_dispatcher.d-K56StcHr.d.ts +1 -1
- package/fesm2022/core.mjs +32 -23
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/untracked-BKcld_ew.mjs +1 -1
- package/fesm2022/untracked-BKcld_ew.mjs.map +1 -1
- package/index.d.ts +7 -8
- package/navigation_types.d-fAxd92YV.d.ts +1 -1
- package/package.json +1 -1
- package/primitives/di/index.d.ts +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +127 -0
- package/schematics/bundles/{apply_import_manager-QQDfWa1Z.cjs → apply_import_manager-DF0BUe6N.cjs} +3 -3
- package/schematics/bundles/{compiler_host-B1Gyeytz.cjs → change_tracker-BfH3nBIf.cjs} +2 -121
- package/schematics/bundles/{checker-5pyJrZ9G.cjs → checker-BwV9MjSQ.cjs} +8 -10
- package/schematics/bundles/cleanup-unused-imports.cjs +50 -12
- package/schematics/bundles/compiler_host-CAfDJO3W.cjs +129 -0
- package/schematics/bundles/control-flow-migration.cjs +5 -4
- package/schematics/bundles/explicit-standalone-flag.cjs +5 -4
- package/schematics/bundles/imports-CIX-JgAN.cjs +1 -1
- package/schematics/bundles/{index-BPhQoCcF.cjs → index-B6p5mHIY.cjs} +4 -4
- package/schematics/bundles/{index-BIvVb6in.cjs → index-BnJH1Hc7.cjs} +13 -15
- package/schematics/bundles/inject-migration.cjs +6 -5
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-Czrg1gcB.cjs → migrate_ts_type_references-DQe6JtwN.cjs} +5 -5
- package/schematics/bundles/ng_decorators-B5HCqr20.cjs +1 -1
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +6 -6
- package/schematics/bundles/pending-tasks.cjs +5 -4
- package/schematics/bundles/{project_paths-CyWVEsbT.cjs → project_paths-DY3SIODd.cjs} +3 -3
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +1 -1
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/provide-initializer.cjs +5 -4
- package/schematics/bundles/route-lazy-loading.cjs +6 -5
- package/schematics/bundles/self-closing-tags-migration.cjs +4 -4
- package/schematics/bundles/signal-input-migration.cjs +7 -7
- package/schematics/bundles/signal-queries-migration.cjs +7 -7
- package/schematics/bundles/signals.cjs +7 -7
- package/schematics/bundles/standalone-migration.cjs +10 -9
- package/schematics/migrations.json +5 -0
- package/testing/index.d.ts +1 -1
- package/weak_ref.d-DWHPG08n.d.ts +1 -1
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.15
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
|
-
var checker = require('./checker-
|
|
10
|
+
var checker = require('./checker-BwV9MjSQ.cjs');
|
|
11
11
|
require('os');
|
|
12
|
-
var p = require('path');
|
|
13
|
-
|
|
14
|
-
function _interopNamespaceDefault(e) {
|
|
15
|
-
var n = Object.create(null);
|
|
16
|
-
if (e) {
|
|
17
|
-
Object.keys(e).forEach(function (k) {
|
|
18
|
-
if (k !== 'default') {
|
|
19
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return e[k]; }
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
n.default = e;
|
|
28
|
-
return Object.freeze(n);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var p__namespace = /*#__PURE__*/_interopNamespaceDefault(p);
|
|
32
12
|
|
|
33
13
|
/** Tracks changes that have to be made for specific files. */
|
|
34
14
|
class ChangeTracker {
|
|
@@ -216,104 +196,5 @@ function normalizePath(path) {
|
|
|
216
196
|
return path.replace(/\\/g, '/');
|
|
217
197
|
}
|
|
218
198
|
|
|
219
|
-
function parseTsconfigFile(tsconfigPath, basePath) {
|
|
220
|
-
const { config } = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
|
221
|
-
const parseConfigHost = {
|
|
222
|
-
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
|
|
223
|
-
fileExists: ts.sys.fileExists,
|
|
224
|
-
readDirectory: ts.sys.readDirectory,
|
|
225
|
-
readFile: ts.sys.readFile,
|
|
226
|
-
};
|
|
227
|
-
// Throw if incorrect arguments are passed to this function. Passing relative base paths
|
|
228
|
-
// results in root directories not being resolved and in later type checking runtime errors.
|
|
229
|
-
// More details can be found here: https://github.com/microsoft/TypeScript/issues/37731.
|
|
230
|
-
if (!p__namespace.isAbsolute(basePath)) {
|
|
231
|
-
throw Error('Unexpected relative base path has been specified.');
|
|
232
|
-
}
|
|
233
|
-
return ts.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Creates a TypeScript program instance for a TypeScript project within
|
|
238
|
-
* the virtual file system tree.
|
|
239
|
-
* @param tree Virtual file system tree that contains the source files.
|
|
240
|
-
* @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
|
|
241
|
-
* @param basePath Base path for the virtual file system tree.
|
|
242
|
-
* @param fakeFileRead Optional file reader function. Can be used to overwrite files in
|
|
243
|
-
* the TypeScript program, or to add in-memory files (e.g. to add global types).
|
|
244
|
-
* @param additionalFiles Additional file paths that should be added to the program.
|
|
245
|
-
*/
|
|
246
|
-
function createMigrationProgram(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles) {
|
|
247
|
-
const { rootNames, options, host } = createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead);
|
|
248
|
-
return ts.createProgram(rootNames, options, host);
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Creates the options necessary to instantiate a TypeScript program.
|
|
252
|
-
* @param tree Virtual file system tree that contains the source files.
|
|
253
|
-
* @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
|
|
254
|
-
* @param basePath Base path for the virtual file system tree.
|
|
255
|
-
* @param fakeFileRead Optional file reader function. Can be used to overwrite files in
|
|
256
|
-
* the TypeScript program, or to add in-memory files (e.g. to add global types).
|
|
257
|
-
* @param additionalFiles Additional file paths that should be added to the program.
|
|
258
|
-
* @param optionOverrides Overrides of the parsed compiler options.
|
|
259
|
-
*/
|
|
260
|
-
function createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles, optionOverrides) {
|
|
261
|
-
// Resolve the tsconfig path to an absolute path. This is needed as TypeScript otherwise
|
|
262
|
-
// is not able to resolve root directories in the given tsconfig. More details can be found
|
|
263
|
-
// in the following issue: https://github.com/microsoft/TypeScript/issues/37731.
|
|
264
|
-
tsconfigPath = p.resolve(basePath, tsconfigPath);
|
|
265
|
-
const parsed = parseTsconfigFile(tsconfigPath, p.dirname(tsconfigPath));
|
|
266
|
-
const options = optionOverrides ? { ...parsed.options, ...optionOverrides } : parsed.options;
|
|
267
|
-
const host = createMigrationCompilerHost(tree, options, basePath, fakeFileRead);
|
|
268
|
-
return { rootNames: parsed.fileNames.concat([]), options, host };
|
|
269
|
-
}
|
|
270
|
-
function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
|
|
271
|
-
const host = ts.createCompilerHost(options, true);
|
|
272
|
-
const defaultReadFile = host.readFile;
|
|
273
|
-
// We need to overwrite the host "readFile" method, as we want the TypeScript
|
|
274
|
-
// program to be based on the file contents in the virtual file tree. Otherwise
|
|
275
|
-
// if we run multiple migrations we might have intersecting changes and
|
|
276
|
-
// source files.
|
|
277
|
-
host.readFile = (fileName) => {
|
|
278
|
-
const treeRelativePath = p.relative(basePath, fileName);
|
|
279
|
-
let result = fakeRead?.(treeRelativePath);
|
|
280
|
-
if (typeof result !== 'string') {
|
|
281
|
-
// If the relative path resolved to somewhere outside of the tree, fall back to
|
|
282
|
-
// TypeScript's default file reading function since the `tree` will throw an error.
|
|
283
|
-
result = treeRelativePath.startsWith('..')
|
|
284
|
-
? defaultReadFile.call(host, fileName)
|
|
285
|
-
: tree.read(treeRelativePath)?.toString();
|
|
286
|
-
}
|
|
287
|
-
// Strip BOM as otherwise TSC methods (Ex: getWidth) will return an offset,
|
|
288
|
-
// which breaks the CLI UpdateRecorder.
|
|
289
|
-
// See: https://github.com/angular/angular/pull/30719
|
|
290
|
-
return typeof result === 'string' ? result.replace(/^\uFEFF/, '') : undefined;
|
|
291
|
-
};
|
|
292
|
-
return host;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Checks whether a file can be migrate by our automated migrations.
|
|
296
|
-
* @param basePath Absolute path to the project.
|
|
297
|
-
* @param sourceFile File being checked.
|
|
298
|
-
* @param program Program that includes the source file.
|
|
299
|
-
*/
|
|
300
|
-
function canMigrateFile(basePath, sourceFile, program) {
|
|
301
|
-
// We shouldn't migrate .d.ts files, files from an external library or type checking files.
|
|
302
|
-
if (sourceFile.fileName.endsWith('.ngtypecheck.ts') ||
|
|
303
|
-
sourceFile.isDeclarationFile ||
|
|
304
|
-
program.isSourceFileFromExternalLibrary(sourceFile)) {
|
|
305
|
-
return false;
|
|
306
|
-
}
|
|
307
|
-
// Our migrations are set up to create a `Program` from the project's tsconfig and to migrate all
|
|
308
|
-
// the files within the program. This can include files that are outside of the Angular CLI
|
|
309
|
-
// project. We can't migrate files outside of the project, because our file system interactions
|
|
310
|
-
// go through the CLI's `Tree` which assumes that all files are within the project. See:
|
|
311
|
-
// https://github.com/angular/angular-cli/blob/0b0961c9c233a825b6e4bb59ab7f0790f9b14676/packages/angular_devkit/schematics/src/tree/host-tree.ts#L131
|
|
312
|
-
return !p.relative(basePath, sourceFile.fileName).startsWith('..');
|
|
313
|
-
}
|
|
314
|
-
|
|
315
199
|
exports.ChangeTracker = ChangeTracker;
|
|
316
|
-
exports.canMigrateFile = canMigrateFile;
|
|
317
|
-
exports.createMigrationProgram = createMigrationProgram;
|
|
318
|
-
exports.createProgramOptions = createProgramOptions;
|
|
319
200
|
exports.normalizePath = normalizePath;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.15
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -17596,8 +17596,7 @@ class _Scanner {
|
|
|
17596
17596
|
length;
|
|
17597
17597
|
peek = 0;
|
|
17598
17598
|
index = -1;
|
|
17599
|
-
|
|
17600
|
-
braceDepth = 0;
|
|
17599
|
+
braceStack = [];
|
|
17601
17600
|
constructor(input) {
|
|
17602
17601
|
this.input = input;
|
|
17603
17602
|
this.length = input.length;
|
|
@@ -17704,18 +17703,17 @@ class _Scanner {
|
|
|
17704
17703
|
return newOperatorToken(start, this.index, str);
|
|
17705
17704
|
}
|
|
17706
17705
|
scanOpenBrace(start, code) {
|
|
17707
|
-
this.
|
|
17706
|
+
this.braceStack.push('expression');
|
|
17708
17707
|
this.advance();
|
|
17709
17708
|
return newCharacterToken(start, this.index, code);
|
|
17710
17709
|
}
|
|
17711
17710
|
scanCloseBrace(start, code) {
|
|
17712
17711
|
this.advance();
|
|
17713
|
-
|
|
17714
|
-
|
|
17712
|
+
const currentBrace = this.braceStack.pop();
|
|
17713
|
+
if (currentBrace === 'interpolation') {
|
|
17715
17714
|
this.tokens.push(newOperatorToken(start, this.index, '}'));
|
|
17716
17715
|
return this.scanTemplateLiteralPart(this.index);
|
|
17717
17716
|
}
|
|
17718
|
-
this.braceDepth--;
|
|
17719
17717
|
return newCharacterToken(start, this.index, code);
|
|
17720
17718
|
}
|
|
17721
17719
|
/**
|
|
@@ -17858,7 +17856,7 @@ class _Scanner {
|
|
|
17858
17856
|
this.advance();
|
|
17859
17857
|
// @ts-expect-error
|
|
17860
17858
|
if (this.peek === $LBRACE) {
|
|
17861
|
-
this.
|
|
17859
|
+
this.braceStack.push('interpolation');
|
|
17862
17860
|
this.tokens.push(new StringToken(start, dollar, buffer + this.input.substring(marker, dollar), StringTokenKind.TemplateLiteralPart));
|
|
17863
17861
|
this.advance();
|
|
17864
17862
|
return newOperatorToken(dollar, this.index, this.input.substring(dollar, this.index));
|
|
@@ -30744,7 +30742,7 @@ function publishFacade(global) {
|
|
|
30744
30742
|
* @description
|
|
30745
30743
|
* Entry point for all public APIs of the compiler package.
|
|
30746
30744
|
*/
|
|
30747
|
-
new Version('19.2.
|
|
30745
|
+
new Version('19.2.15');
|
|
30748
30746
|
|
|
30749
30747
|
const _I18N_ATTR = 'i18n';
|
|
30750
30748
|
const _I18N_ATTR_PREFIX = 'i18n-';
|
|
@@ -32162,7 +32160,7 @@ class NodeJSPathManipulation {
|
|
|
32162
32160
|
// G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
|
|
32163
32161
|
// CommonJS/ESM interop for determining the current file name and containing dir.
|
|
32164
32162
|
const isCommonJS = typeof __filename !== 'undefined';
|
|
32165
|
-
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('checker-
|
|
32163
|
+
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('checker-BwV9MjSQ.cjs', document.baseURI).href));
|
|
32166
32164
|
const currentFileName = isCommonJS ? __filename : url.fileURLToPath(currentFileUrl);
|
|
32167
32165
|
/**
|
|
32168
32166
|
* A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.15
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
require('@angular-devkit/core');
|
|
10
10
|
require('node:path/posix');
|
|
11
|
-
var project_paths = require('./project_paths-
|
|
11
|
+
var project_paths = require('./project_paths-DY3SIODd.cjs');
|
|
12
12
|
var ts = require('typescript');
|
|
13
13
|
require('os');
|
|
14
|
-
var checker = require('./checker-
|
|
15
|
-
var index = require('./index-
|
|
14
|
+
var checker = require('./checker-BwV9MjSQ.cjs');
|
|
15
|
+
var index = require('./index-BnJH1Hc7.cjs');
|
|
16
16
|
require('path');
|
|
17
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
17
|
+
var apply_import_manager = require('./apply_import_manager-DF0BUe6N.cjs');
|
|
18
|
+
var leading_space = require('./leading_space-D9nQ8UQC.cjs');
|
|
18
19
|
require('@angular-devkit/schematics');
|
|
19
20
|
require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
20
21
|
require('fs');
|
|
@@ -196,6 +197,7 @@ class UnusedImportsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
196
197
|
const { fullRemovals, partialRemovals, allRemovedIdentifiers } = removalLocations;
|
|
197
198
|
const { importedSymbols, identifierCounts } = usages;
|
|
198
199
|
const importManager = new checker.ImportManager();
|
|
200
|
+
const sourceText = sourceFile.getFullText();
|
|
199
201
|
// Replace full arrays with empty ones. This allows preserves more of the user's formatting.
|
|
200
202
|
fullRemovals.forEach((node) => {
|
|
201
203
|
replacements.push(new project_paths.Replacement(project_paths.projectFile(sourceFile, info), new project_paths.TextUpdate({
|
|
@@ -205,13 +207,10 @@ class UnusedImportsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
205
207
|
})));
|
|
206
208
|
});
|
|
207
209
|
// Filter out the unused identifiers from an array.
|
|
208
|
-
partialRemovals.forEach((toRemove,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
end: node.getEnd(),
|
|
213
|
-
toInsert: this.printer.printNode(ts.EmitHint.Unspecified, newNode, sourceFile),
|
|
214
|
-
})));
|
|
210
|
+
partialRemovals.forEach((toRemove, parent) => {
|
|
211
|
+
toRemove.forEach((node) => {
|
|
212
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(sourceFile, info), getArrayElementRemovalUpdate(node, parent, sourceText)));
|
|
213
|
+
});
|
|
215
214
|
});
|
|
216
215
|
// Attempt to clean up unused import declarations. Note that this isn't foolproof, because we
|
|
217
216
|
// do the matching based on identifier text, rather than going through the type checker which
|
|
@@ -231,6 +230,45 @@ class UnusedImportsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
231
230
|
apply_import_manager.applyImportManagerChanges(importManager, replacements, [sourceFile], info);
|
|
232
231
|
}
|
|
233
232
|
}
|
|
233
|
+
/** Generates a `TextUpdate` for the removal of an array element. */
|
|
234
|
+
function getArrayElementRemovalUpdate(node, parent, sourceText) {
|
|
235
|
+
let position = node.getStart();
|
|
236
|
+
let end = node.getEnd();
|
|
237
|
+
let toInsert = '';
|
|
238
|
+
const whitespaceOrLineFeed = /\s/;
|
|
239
|
+
// Usually the way we'd remove the nodes would be to recreate the `parent` while excluding
|
|
240
|
+
// the nodes that should be removed. The problem with this is that it'll strip out comments
|
|
241
|
+
// inside the array which can have special meaning internally. We work around it by removing
|
|
242
|
+
// only the node's own offsets. This comes with another problem in that it won't remove the commas
|
|
243
|
+
// that separate array elements which in turn can look weird if left in place (e.g.
|
|
244
|
+
// `[One, Two, Three, Four]` can turn into `[One,,Four]`). To account for them, we start with the
|
|
245
|
+
// node's end offset and then expand it to include trailing commas, whitespace and line breaks.
|
|
246
|
+
for (let i = end; i < sourceText.length; i++) {
|
|
247
|
+
if (sourceText[i] === ',' || whitespaceOrLineFeed.test(sourceText[i])) {
|
|
248
|
+
end++;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
// If we're removing the last element in the array, adjust the starting offset so that
|
|
255
|
+
// it includes the previous comma on the same line. This avoids turning something like
|
|
256
|
+
// `[One, Two, Three]` into `[One,]`. We only do this within the same like, because
|
|
257
|
+
// trailing comma at the end of the line is fine.
|
|
258
|
+
if (parent.elements[parent.elements.length - 1] === node) {
|
|
259
|
+
for (let i = position - 1; i >= 0; i--) {
|
|
260
|
+
if (sourceText[i] === ',' || sourceText[i] === ' ') {
|
|
261
|
+
position--;
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// Replace the node with its leading whitespace to preserve the formatting.
|
|
268
|
+
toInsert = leading_space.getLeadingLineWhitespaceOfNode(node);
|
|
269
|
+
}
|
|
270
|
+
return new project_paths.TextUpdate({ position, end, toInsert });
|
|
271
|
+
}
|
|
234
272
|
|
|
235
273
|
function migrate() {
|
|
236
274
|
return async (tree, context) => {
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @license Angular v19.2.15
|
|
4
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var p = require('path');
|
|
10
|
+
var ts = require('typescript');
|
|
11
|
+
|
|
12
|
+
function _interopNamespaceDefault(e) {
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n.default = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var p__namespace = /*#__PURE__*/_interopNamespaceDefault(p);
|
|
30
|
+
|
|
31
|
+
function parseTsconfigFile(tsconfigPath, basePath) {
|
|
32
|
+
const { config } = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
|
33
|
+
const parseConfigHost = {
|
|
34
|
+
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
|
|
35
|
+
fileExists: ts.sys.fileExists,
|
|
36
|
+
readDirectory: ts.sys.readDirectory,
|
|
37
|
+
readFile: ts.sys.readFile,
|
|
38
|
+
};
|
|
39
|
+
// Throw if incorrect arguments are passed to this function. Passing relative base paths
|
|
40
|
+
// results in root directories not being resolved and in later type checking runtime errors.
|
|
41
|
+
// More details can be found here: https://github.com/microsoft/TypeScript/issues/37731.
|
|
42
|
+
if (!p__namespace.isAbsolute(basePath)) {
|
|
43
|
+
throw Error('Unexpected relative base path has been specified.');
|
|
44
|
+
}
|
|
45
|
+
return ts.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Creates a TypeScript program instance for a TypeScript project within
|
|
50
|
+
* the virtual file system tree.
|
|
51
|
+
* @param tree Virtual file system tree that contains the source files.
|
|
52
|
+
* @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
|
|
53
|
+
* @param basePath Base path for the virtual file system tree.
|
|
54
|
+
* @param fakeFileRead Optional file reader function. Can be used to overwrite files in
|
|
55
|
+
* the TypeScript program, or to add in-memory files (e.g. to add global types).
|
|
56
|
+
* @param additionalFiles Additional file paths that should be added to the program.
|
|
57
|
+
*/
|
|
58
|
+
function createMigrationProgram(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles) {
|
|
59
|
+
const { rootNames, options, host } = createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead);
|
|
60
|
+
return ts.createProgram(rootNames, options, host);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Creates the options necessary to instantiate a TypeScript program.
|
|
64
|
+
* @param tree Virtual file system tree that contains the source files.
|
|
65
|
+
* @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
|
|
66
|
+
* @param basePath Base path for the virtual file system tree.
|
|
67
|
+
* @param fakeFileRead Optional file reader function. Can be used to overwrite files in
|
|
68
|
+
* the TypeScript program, or to add in-memory files (e.g. to add global types).
|
|
69
|
+
* @param additionalFiles Additional file paths that should be added to the program.
|
|
70
|
+
* @param optionOverrides Overrides of the parsed compiler options.
|
|
71
|
+
*/
|
|
72
|
+
function createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles, optionOverrides) {
|
|
73
|
+
// Resolve the tsconfig path to an absolute path. This is needed as TypeScript otherwise
|
|
74
|
+
// is not able to resolve root directories in the given tsconfig. More details can be found
|
|
75
|
+
// in the following issue: https://github.com/microsoft/TypeScript/issues/37731.
|
|
76
|
+
tsconfigPath = p.resolve(basePath, tsconfigPath);
|
|
77
|
+
const parsed = parseTsconfigFile(tsconfigPath, p.dirname(tsconfigPath));
|
|
78
|
+
const options = optionOverrides ? { ...parsed.options, ...optionOverrides } : parsed.options;
|
|
79
|
+
const host = createMigrationCompilerHost(tree, options, basePath, fakeFileRead);
|
|
80
|
+
return { rootNames: parsed.fileNames.concat([]), options, host };
|
|
81
|
+
}
|
|
82
|
+
function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
|
|
83
|
+
const host = ts.createCompilerHost(options, true);
|
|
84
|
+
const defaultReadFile = host.readFile;
|
|
85
|
+
// We need to overwrite the host "readFile" method, as we want the TypeScript
|
|
86
|
+
// program to be based on the file contents in the virtual file tree. Otherwise
|
|
87
|
+
// if we run multiple migrations we might have intersecting changes and
|
|
88
|
+
// source files.
|
|
89
|
+
host.readFile = (fileName) => {
|
|
90
|
+
const treeRelativePath = p.relative(basePath, fileName);
|
|
91
|
+
let result = fakeRead?.(treeRelativePath);
|
|
92
|
+
if (typeof result !== 'string') {
|
|
93
|
+
// If the relative path resolved to somewhere outside of the tree, fall back to
|
|
94
|
+
// TypeScript's default file reading function since the `tree` will throw an error.
|
|
95
|
+
result = treeRelativePath.startsWith('..')
|
|
96
|
+
? defaultReadFile.call(host, fileName)
|
|
97
|
+
: tree.read(treeRelativePath)?.toString();
|
|
98
|
+
}
|
|
99
|
+
// Strip BOM as otherwise TSC methods (Ex: getWidth) will return an offset,
|
|
100
|
+
// which breaks the CLI UpdateRecorder.
|
|
101
|
+
// See: https://github.com/angular/angular/pull/30719
|
|
102
|
+
return typeof result === 'string' ? result.replace(/^\uFEFF/, '') : undefined;
|
|
103
|
+
};
|
|
104
|
+
return host;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Checks whether a file can be migrate by our automated migrations.
|
|
108
|
+
* @param basePath Absolute path to the project.
|
|
109
|
+
* @param sourceFile File being checked.
|
|
110
|
+
* @param program Program that includes the source file.
|
|
111
|
+
*/
|
|
112
|
+
function canMigrateFile(basePath, sourceFile, program) {
|
|
113
|
+
// We shouldn't migrate .d.ts files, files from an external library or type checking files.
|
|
114
|
+
if (sourceFile.fileName.endsWith('.ngtypecheck.ts') ||
|
|
115
|
+
sourceFile.isDeclarationFile ||
|
|
116
|
+
program.isSourceFileFromExternalLibrary(sourceFile)) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
// Our migrations are set up to create a `Program` from the project's tsconfig and to migrate all
|
|
120
|
+
// the files within the program. This can include files that are outside of the Angular CLI
|
|
121
|
+
// project. We can't migrate files outside of the project, because our file system interactions
|
|
122
|
+
// go through the CLI's `Tree` which assumes that all files are within the project. See:
|
|
123
|
+
// https://github.com/angular/angular-cli/blob/0b0961c9c233a825b6e4bb59ab7f0790f9b14676/packages/angular_devkit/schematics/src/tree/host-tree.ts#L131
|
|
124
|
+
return !p.relative(basePath, sourceFile.fileName).startsWith('..');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
exports.canMigrateFile = canMigrateFile;
|
|
128
|
+
exports.createMigrationProgram = createMigrationProgram;
|
|
129
|
+
exports.createProgramOptions = createProgramOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.15
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
10
|
var p = require('path');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var change_tracker = require('./change_tracker-BfH3nBIf.cjs');
|
|
12
|
+
var compiler_host = require('./compiler_host-CAfDJO3W.cjs');
|
|
13
|
+
var checker = require('./checker-BwV9MjSQ.cjs');
|
|
13
14
|
var ts = require('typescript');
|
|
14
15
|
require('os');
|
|
15
16
|
require('fs');
|
|
@@ -1839,7 +1840,7 @@ function migrateTemplate(template, templateType, node, file, format = true, anal
|
|
|
1839
1840
|
function migrate(options) {
|
|
1840
1841
|
return async (tree, context) => {
|
|
1841
1842
|
const basePath = process.cwd();
|
|
1842
|
-
const pathToMigrate =
|
|
1843
|
+
const pathToMigrate = change_tracker.normalizePath(p.join(basePath, options.path));
|
|
1843
1844
|
let allPaths = [];
|
|
1844
1845
|
if (pathToMigrate.trim() !== '') {
|
|
1845
1846
|
allPaths.push(pathToMigrate);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.15
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
10
|
var p = require('path');
|
|
11
11
|
var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
12
|
-
var compiler_host = require('./compiler_host-
|
|
12
|
+
var compiler_host = require('./compiler_host-CAfDJO3W.cjs');
|
|
13
13
|
var ts = require('typescript');
|
|
14
|
+
var change_tracker = require('./change_tracker-BfH3nBIf.cjs');
|
|
14
15
|
var imports = require('./imports-CIX-JgAN.cjs');
|
|
15
16
|
require('@angular-devkit/core');
|
|
16
|
-
require('./checker-
|
|
17
|
+
require('./checker-BwV9MjSQ.cjs');
|
|
17
18
|
require('os');
|
|
18
19
|
require('fs');
|
|
19
20
|
require('module');
|
|
@@ -24,7 +25,7 @@ const DIRECTIVE = 'Directive';
|
|
|
24
25
|
const COMPONENT = 'Component';
|
|
25
26
|
const PIPE = 'Pipe';
|
|
26
27
|
function migrateFile(sourceFile, rewriteFn) {
|
|
27
|
-
const changeTracker = new
|
|
28
|
+
const changeTracker = new change_tracker.ChangeTracker(ts.createPrinter());
|
|
28
29
|
// Check if there are any imports of the `AfterRenderPhase` enum.
|
|
29
30
|
const coreImports = imports.getNamedImports(sourceFile, CORE);
|
|
30
31
|
if (!coreImports) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.15
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var checker = require('./checker-
|
|
12
|
-
var index = require('./index-
|
|
11
|
+
var checker = require('./checker-BwV9MjSQ.cjs');
|
|
12
|
+
var index = require('./index-BnJH1Hc7.cjs');
|
|
13
13
|
require('path');
|
|
14
|
-
var project_paths = require('./project_paths-
|
|
14
|
+
var project_paths = require('./project_paths-DY3SIODd.cjs');
|
|
15
15
|
|
|
16
16
|
function getMemberName(member) {
|
|
17
17
|
if (member.name === undefined) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.15
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var checker = require('./checker-
|
|
9
|
+
var checker = require('./checker-BwV9MjSQ.cjs');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
var p = require('path');
|
|
12
12
|
require('os');
|
|
@@ -1005,7 +1005,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
1005
1005
|
function compileDeclareClassMetadata(metadata) {
|
|
1006
1006
|
const definitionMap = new checker.DefinitionMap();
|
|
1007
1007
|
definitionMap.set('minVersion', checker.literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
1008
|
-
definitionMap.set('version', checker.literal('19.2.
|
|
1008
|
+
definitionMap.set('version', checker.literal('19.2.15'));
|
|
1009
1009
|
definitionMap.set('ngImport', checker.importExpr(checker.Identifiers.core));
|
|
1010
1010
|
definitionMap.set('type', metadata.type);
|
|
1011
1011
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -1023,7 +1023,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
1023
1023
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? checker.literal(null));
|
|
1024
1024
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? checker.literal(null));
|
|
1025
1025
|
definitionMap.set('minVersion', checker.literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
1026
|
-
definitionMap.set('version', checker.literal('19.2.
|
|
1026
|
+
definitionMap.set('version', checker.literal('19.2.15'));
|
|
1027
1027
|
definitionMap.set('ngImport', checker.importExpr(checker.Identifiers.core));
|
|
1028
1028
|
definitionMap.set('type', metadata.type);
|
|
1029
1029
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -1118,7 +1118,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
1118
1118
|
const definitionMap = new checker.DefinitionMap();
|
|
1119
1119
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
1120
1120
|
definitionMap.set('minVersion', checker.literal(minVersion));
|
|
1121
|
-
definitionMap.set('version', checker.literal('19.2.
|
|
1121
|
+
definitionMap.set('version', checker.literal('19.2.15'));
|
|
1122
1122
|
// e.g. `type: MyDirective`
|
|
1123
1123
|
definitionMap.set('type', meta.type.value);
|
|
1124
1124
|
if (meta.isStandalone !== undefined) {
|
|
@@ -1534,7 +1534,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
1534
1534
|
function compileDeclareFactoryFunction(meta) {
|
|
1535
1535
|
const definitionMap = new checker.DefinitionMap();
|
|
1536
1536
|
definitionMap.set('minVersion', checker.literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
1537
|
-
definitionMap.set('version', checker.literal('19.2.
|
|
1537
|
+
definitionMap.set('version', checker.literal('19.2.15'));
|
|
1538
1538
|
definitionMap.set('ngImport', checker.importExpr(checker.Identifiers.core));
|
|
1539
1539
|
definitionMap.set('type', meta.type.value);
|
|
1540
1540
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -1569,7 +1569,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
1569
1569
|
function createInjectableDefinitionMap(meta) {
|
|
1570
1570
|
const definitionMap = new checker.DefinitionMap();
|
|
1571
1571
|
definitionMap.set('minVersion', checker.literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
1572
|
-
definitionMap.set('version', checker.literal('19.2.
|
|
1572
|
+
definitionMap.set('version', checker.literal('19.2.15'));
|
|
1573
1573
|
definitionMap.set('ngImport', checker.importExpr(checker.Identifiers.core));
|
|
1574
1574
|
definitionMap.set('type', meta.type.value);
|
|
1575
1575
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -1620,7 +1620,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
1620
1620
|
function createInjectorDefinitionMap(meta) {
|
|
1621
1621
|
const definitionMap = new checker.DefinitionMap();
|
|
1622
1622
|
definitionMap.set('minVersion', checker.literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
1623
|
-
definitionMap.set('version', checker.literal('19.2.
|
|
1623
|
+
definitionMap.set('version', checker.literal('19.2.15'));
|
|
1624
1624
|
definitionMap.set('ngImport', checker.importExpr(checker.Identifiers.core));
|
|
1625
1625
|
definitionMap.set('type', meta.type.value);
|
|
1626
1626
|
definitionMap.set('providers', meta.providers);
|
|
@@ -1653,7 +1653,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
1653
1653
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
1654
1654
|
}
|
|
1655
1655
|
definitionMap.set('minVersion', checker.literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
1656
|
-
definitionMap.set('version', checker.literal('19.2.
|
|
1656
|
+
definitionMap.set('version', checker.literal('19.2.15'));
|
|
1657
1657
|
definitionMap.set('ngImport', checker.importExpr(checker.Identifiers.core));
|
|
1658
1658
|
definitionMap.set('type', meta.type.value);
|
|
1659
1659
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -1704,7 +1704,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
1704
1704
|
function createPipeDefinitionMap(meta) {
|
|
1705
1705
|
const definitionMap = new checker.DefinitionMap();
|
|
1706
1706
|
definitionMap.set('minVersion', checker.literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
1707
|
-
definitionMap.set('version', checker.literal('19.2.
|
|
1707
|
+
definitionMap.set('version', checker.literal('19.2.15'));
|
|
1708
1708
|
definitionMap.set('ngImport', checker.importExpr(checker.Identifiers.core));
|
|
1709
1709
|
// e.g. `type: MyPipe`
|
|
1710
1710
|
definitionMap.set('type', meta.type.value);
|
|
@@ -10730,7 +10730,7 @@ class PipeDecoratorHandler {
|
|
|
10730
10730
|
* @description
|
|
10731
10731
|
* Entry point for all public APIs of the compiler-cli package.
|
|
10732
10732
|
*/
|
|
10733
|
-
new checker.Version('19.2.
|
|
10733
|
+
new checker.Version('19.2.15');
|
|
10734
10734
|
|
|
10735
10735
|
/**
|
|
10736
10736
|
* Whether a given decorator should be treated as an Angular decorator.
|
|
@@ -15845,9 +15845,7 @@ class SourceFileValidator {
|
|
|
15845
15845
|
rules;
|
|
15846
15846
|
constructor(reflector, importedSymbolsTracker, templateTypeChecker, typeCheckingConfig) {
|
|
15847
15847
|
this.rules = [new InitializerApiUsageRule(reflector, importedSymbolsTracker)];
|
|
15848
|
-
|
|
15849
|
-
this.rules.push(new UnusedStandaloneImportsRule(templateTypeChecker, typeCheckingConfig, importedSymbolsTracker));
|
|
15850
|
-
}
|
|
15848
|
+
this.rules.push(new UnusedStandaloneImportsRule(templateTypeChecker, typeCheckingConfig, importedSymbolsTracker));
|
|
15851
15849
|
}
|
|
15852
15850
|
/**
|
|
15853
15851
|
* Gets the diagnostics for a specific file, or null if the file is valid.
|
|
@@ -18585,7 +18583,7 @@ var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
|
|
|
18585
18583
|
* @param minVersion Minimum required version for the feature.
|
|
18586
18584
|
*/
|
|
18587
18585
|
function coreVersionSupportsFeature(coreVersion, minVersion) {
|
|
18588
|
-
// A version of `19.2.
|
|
18586
|
+
// A version of `19.2.15` usually means that core is at head so it supports
|
|
18589
18587
|
// all features. Use string interpolation prevent the placeholder from being replaced
|
|
18590
18588
|
// with the current version during build time.
|
|
18591
18589
|
if (coreVersion === `0.0.0-${'PLACEHOLDER'}`) {
|