@angular/core 19.2.4 → 19.2.6
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-pVP0-wST.d.ts → event_dispatcher.d-DlbccpYq.d.ts} +3 -2
- package/fesm2022/core.mjs +103 -88
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +3 -3
- package/fesm2022/rxjs-interop.mjs +4 -3
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +148 -97
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/{untracked-CS7WUAzb.mjs → untracked-BKcld_ew.mjs} +3 -3
- package/fesm2022/{untracked-CS7WUAzb.mjs.map → untracked-BKcld_ew.mjs.map} +1 -1
- package/index.d.ts +23 -7
- package/{navigation_types.d-DgDrF5rp.d.ts → navigation_types.d-fAxd92YV.d.ts} +3 -2
- package/package.json +1 -1
- package/primitives/di/index.d.ts +3 -2
- package/primitives/event-dispatch/index.d.ts +3 -3
- package/primitives/signals/index.d.ts +5 -4
- package/rxjs-interop/index.d.ts +4 -3
- package/schematics/bundles/{apply_import_manager-BynuozbO.js → apply_import_manager-DFADpdFu.js} +3 -3
- package/schematics/bundles/{checker-DP-zos5Q.js → checker-DoX_7XCa.js} +20 -13
- package/schematics/bundles/cleanup-unused-imports.js +42 -64
- package/schematics/bundles/{compiler_host-DzM2hemp.js → compiler_host-BUKEE1cA.js} +2 -2
- package/schematics/bundles/control-flow-migration.js +3 -3
- package/schematics/bundles/explicit-standalone-flag.js +3 -3
- package/schematics/bundles/imports-CIX-JgAN.js +1 -1
- package/schematics/bundles/{program-BmLi-Vxz.js → index-B4b0V0Vo.js} +52 -26
- package/schematics/bundles/{index-CPpyW--c.js → index-CpZKzrqM.js} +6 -6
- package/schematics/bundles/inject-migration.js +25 -8
- package/schematics/bundles/leading_space-D9nQ8UQC.js +1 -1
- package/schematics/bundles/{migrate_ts_type_references-Ri-K4P_1.js → migrate_ts_type_references-DQVDid4G.js} +5 -5
- package/schematics/bundles/ng_decorators-DznZ5jMl.js +1 -1
- package/schematics/bundles/nodes-B16H9JUd.js +1 -1
- package/schematics/bundles/output-migration.js +115 -81
- package/schematics/bundles/pending-tasks.js +3 -3
- package/schematics/bundles/{project_paths-CXXqWSoY.js → project_paths-C3etOlgT.js} +88 -13
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.js +1 -1
- package/schematics/bundles/property_name-BBwFuqMe.js +1 -1
- package/schematics/bundles/provide-initializer.js +3 -3
- package/schematics/bundles/route-lazy-loading.js +3 -3
- package/schematics/bundles/self-closing-tags-migration.js +39 -64
- package/schematics/bundles/signal-input-migration.js +64 -87
- package/schematics/bundles/signal-queries-migration.js +82 -93
- package/schematics/bundles/signals.js +11 -11
- package/schematics/bundles/standalone-migration.js +5 -6
- package/testing/index.d.ts +7 -22
- package/{weak_ref.d-Bp6cSy-X.d.ts → weak_ref.d-DWHPG08n.d.ts} +3 -2
- package/schematics/bundles/index-BPqwMr5d.js +0 -30
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.6
|
|
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-DoX_7XCa.js');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
require('os');
|
|
12
12
|
var assert = require('assert');
|
|
13
|
-
var index = require('./index-
|
|
14
|
-
var project_paths = require('./project_paths-
|
|
13
|
+
var index = require('./index-CpZKzrqM.js');
|
|
14
|
+
var project_paths = require('./project_paths-C3etOlgT.js');
|
|
15
15
|
var leading_space = require('./leading_space-D9nQ8UQC.js');
|
|
16
|
-
require('./
|
|
16
|
+
require('./index-B4b0V0Vo.js');
|
|
17
17
|
require('path');
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var schematics = require('@angular-devkit/schematics');
|
|
10
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
11
|
-
var project_paths = require('./project_paths-CXXqWSoY.js');
|
|
12
|
-
require('os');
|
|
13
9
|
var ts = require('typescript');
|
|
14
|
-
|
|
15
|
-
var
|
|
10
|
+
require('os');
|
|
11
|
+
var checker = require('./checker-DoX_7XCa.js');
|
|
12
|
+
var index$1 = require('./index-B4b0V0Vo.js');
|
|
16
13
|
require('path');
|
|
17
|
-
var
|
|
18
|
-
var
|
|
14
|
+
var project_paths = require('./project_paths-C3etOlgT.js');
|
|
15
|
+
var apply_import_manager = require('./apply_import_manager-DFADpdFu.js');
|
|
16
|
+
var index = require('./index-CpZKzrqM.js');
|
|
19
17
|
require('@angular-devkit/core');
|
|
20
18
|
require('node:path/posix');
|
|
21
19
|
require('fs');
|
|
22
20
|
require('module');
|
|
23
21
|
require('url');
|
|
22
|
+
require('@angular-devkit/schematics');
|
|
23
|
+
require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
24
24
|
|
|
25
25
|
function isOutputDeclarationEligibleForMigration(node) {
|
|
26
26
|
return (node.initializer !== undefined &&
|
|
@@ -144,9 +144,13 @@ function checkNonTsReferenceCallsField(ref, fieldName) {
|
|
|
144
144
|
const printer = ts.createPrinter();
|
|
145
145
|
function calculateDeclarationReplacement(info, node, aliasParam) {
|
|
146
146
|
const sf = node.getSourceFile();
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
let payloadTypes;
|
|
148
|
+
if (node.initializer && ts.isNewExpression(node.initializer) && node.initializer.typeArguments) {
|
|
149
|
+
payloadTypes = node.initializer.typeArguments;
|
|
150
|
+
}
|
|
151
|
+
else if (node.type && ts.isTypeReferenceNode(node.type) && node.type.typeArguments) {
|
|
152
|
+
payloadTypes = ts.factory.createNodeArray(node.type.typeArguments);
|
|
153
|
+
}
|
|
150
154
|
const outputCall = ts.factory.createCallExpression(ts.factory.createIdentifier('output'), payloadTypes, aliasParam !== undefined
|
|
151
155
|
? [
|
|
152
156
|
ts.factory.createObjectLiteralExpression([
|
|
@@ -246,15 +250,15 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
246
250
|
this.config = config;
|
|
247
251
|
}
|
|
248
252
|
async analyze(info) {
|
|
249
|
-
const { sourceFiles, program
|
|
253
|
+
const { sourceFiles, program } = info;
|
|
250
254
|
const outputFieldReplacements = {};
|
|
251
255
|
const problematicUsages = {};
|
|
252
256
|
let problematicDeclarationCount = 0;
|
|
253
257
|
const filesWithOutputDeclarations = new Set();
|
|
254
|
-
const checker$1 = program
|
|
258
|
+
const checker$1 = program.getTypeChecker();
|
|
255
259
|
const reflector = new checker.TypeScriptReflectionHost(checker$1);
|
|
256
|
-
const dtsReader = new
|
|
257
|
-
const evaluator = new
|
|
260
|
+
const dtsReader = new index$1.DtsMetadataReader(checker$1, reflector);
|
|
261
|
+
const evaluator = new index$1.PartialEvaluator(reflector, checker$1, null);
|
|
258
262
|
const resourceLoader = info.ngCompiler?.['resourceManager'] ?? null;
|
|
259
263
|
// Pre-analyze the program and get access to the template type checker.
|
|
260
264
|
// If we are processing a non-Angular target, there is no template info.
|
|
@@ -336,6 +340,7 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
336
340
|
}
|
|
337
341
|
}
|
|
338
342
|
}
|
|
343
|
+
addCommentForEmptyEmit(node, info, checker$1, reflector, dtsReader, outputFieldReplacements);
|
|
339
344
|
// detect imports of test runners
|
|
340
345
|
if (isTestRunnerImport(node)) {
|
|
341
346
|
isTestFile = true;
|
|
@@ -498,76 +503,105 @@ function addOutputReplacement(outputFieldReplacements, outputId, file, ...replac
|
|
|
498
503
|
}
|
|
499
504
|
existingReplacements.replacements.push(...replacements);
|
|
500
505
|
}
|
|
506
|
+
function addCommentForEmptyEmit(node, info, checker, reflector, dtsReader, outputFieldReplacements) {
|
|
507
|
+
if (!isEmptyEmitCall(node))
|
|
508
|
+
return;
|
|
509
|
+
const propertyAccess = getPropertyAccess(node);
|
|
510
|
+
if (!propertyAccess)
|
|
511
|
+
return;
|
|
512
|
+
const symbol = checker.getSymbolAtLocation(propertyAccess.name);
|
|
513
|
+
if (!symbol || !symbol.declarations?.length)
|
|
514
|
+
return;
|
|
515
|
+
const propertyDeclaration = isTargetOutputDeclaration(propertyAccess, checker, reflector, dtsReader);
|
|
516
|
+
if (!propertyDeclaration)
|
|
517
|
+
return;
|
|
518
|
+
const eventEmitterType = getEventEmitterArgumentType(propertyDeclaration);
|
|
519
|
+
if (!eventEmitterType)
|
|
520
|
+
return;
|
|
521
|
+
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
522
|
+
const file = project_paths.projectFile(node.getSourceFile(), info);
|
|
523
|
+
const formatter = getFormatterText(node);
|
|
524
|
+
const todoReplacement = new project_paths.TextUpdate({
|
|
525
|
+
toInsert: `${formatter.indent}// TODO: The 'emit' function requires a mandatory ${eventEmitterType} argument\n`,
|
|
526
|
+
end: formatter.lineStartPos,
|
|
527
|
+
position: formatter.lineStartPos,
|
|
528
|
+
});
|
|
529
|
+
addOutputReplacement(outputFieldReplacements, id, file, new project_paths.Replacement(file, todoReplacement));
|
|
530
|
+
}
|
|
531
|
+
function isEmptyEmitCall(node) {
|
|
532
|
+
return (ts.isCallExpression(node) &&
|
|
533
|
+
ts.isPropertyAccessExpression(node.expression) &&
|
|
534
|
+
node.expression.name.text === 'emit' &&
|
|
535
|
+
node.arguments.length === 0);
|
|
536
|
+
}
|
|
537
|
+
function getPropertyAccess(node) {
|
|
538
|
+
const propertyAccessExpression = node.expression.expression;
|
|
539
|
+
return ts.isPropertyAccessExpression(propertyAccessExpression) ? propertyAccessExpression : null;
|
|
540
|
+
}
|
|
541
|
+
function getEventEmitterArgumentType(propertyDeclaration) {
|
|
542
|
+
const initializer = propertyDeclaration.initializer;
|
|
543
|
+
if (!initializer || !ts.isNewExpression(initializer))
|
|
544
|
+
return null;
|
|
545
|
+
const isEventEmitter = ts.isIdentifier(initializer.expression) && initializer.expression.getText() === 'EventEmitter';
|
|
546
|
+
if (!isEventEmitter)
|
|
547
|
+
return null;
|
|
548
|
+
const [typeArg] = initializer.typeArguments ?? [];
|
|
549
|
+
return typeArg ? typeArg.getText() : null;
|
|
550
|
+
}
|
|
551
|
+
function getFormatterText(node) {
|
|
552
|
+
const sourceFile = node.getSourceFile();
|
|
553
|
+
const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
554
|
+
const lineStartPos = sourceFile.getPositionOfLineAndCharacter(line, 0);
|
|
555
|
+
const indent = sourceFile.text.slice(lineStartPos, node.getStart());
|
|
556
|
+
return { indent, lineStartPos };
|
|
557
|
+
}
|
|
501
558
|
|
|
502
559
|
function migrate(options) {
|
|
503
560
|
return async (tree, context) => {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
561
|
+
await project_paths.runMigrationInDevkit({
|
|
562
|
+
tree,
|
|
563
|
+
getMigration: (fs) => new OutputMigration({
|
|
564
|
+
shouldMigrate: (_, file) => {
|
|
565
|
+
return (file.rootRelativePath.startsWith(fs.normalize(options.path)) &&
|
|
566
|
+
!/(^|\/)node_modules\//.test(file.rootRelativePath));
|
|
567
|
+
},
|
|
568
|
+
}),
|
|
569
|
+
beforeProgramCreation: (tsconfigPath, stage) => {
|
|
570
|
+
if (stage === project_paths.MigrationStage.Analysis) {
|
|
571
|
+
context.logger.info(`Preparing analysis for: ${tsconfigPath}...`);
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
context.logger.info(`Running migration for: ${tsconfigPath}...`);
|
|
575
|
+
}
|
|
514
576
|
},
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
const info = migration.prepareProgram(baseInfo);
|
|
522
|
-
// Support restricting the analysis to subfolders for larger projects.
|
|
523
|
-
if (analysisPath !== '/') {
|
|
524
|
-
info.sourceFiles = info.sourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
525
|
-
info.fullProgramSourceFiles = info.fullProgramSourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
526
|
-
}
|
|
527
|
-
return { info, tsconfigPath };
|
|
528
|
-
});
|
|
529
|
-
// Analyze phase. Treat all projects as compilation units as
|
|
530
|
-
// this allows us to support references between those.
|
|
531
|
-
for (const { info, tsconfigPath } of programInfos) {
|
|
532
|
-
context.logger.info(`Scanning for outputs: ${tsconfigPath}..`);
|
|
533
|
-
unitResults.push(await migration.analyze(info));
|
|
534
|
-
}
|
|
535
|
-
context.logger.info(``);
|
|
536
|
-
context.logger.info(`Processing analysis data between targets..`);
|
|
537
|
-
context.logger.info(``);
|
|
538
|
-
const combined = await project_paths.synchronouslyCombineUnitData(migration, unitResults);
|
|
539
|
-
if (combined === null) {
|
|
540
|
-
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
const globalMeta = await migration.globalMeta(combined);
|
|
544
|
-
const replacementsPerFile = new Map();
|
|
545
|
-
for (const { info, tsconfigPath } of programInfos) {
|
|
546
|
-
context.logger.info(`Migrating: ${tsconfigPath}..`);
|
|
547
|
-
const { replacements } = await migration.migrate(globalMeta);
|
|
548
|
-
const changesPerFile = project_paths.groupReplacementsByFile(replacements);
|
|
549
|
-
for (const [file, changes] of changesPerFile) {
|
|
550
|
-
if (!replacementsPerFile.has(file)) {
|
|
551
|
-
replacementsPerFile.set(file, changes);
|
|
577
|
+
afterProgramCreation: (info, fs) => {
|
|
578
|
+
const analysisPath = fs.resolve(options.analysisDir);
|
|
579
|
+
// Support restricting the analysis to subfolders for larger projects.
|
|
580
|
+
if (analysisPath !== '/') {
|
|
581
|
+
info.sourceFiles = info.sourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
582
|
+
info.fullProgramSourceFiles = info.fullProgramSourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
552
583
|
}
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
584
|
+
},
|
|
585
|
+
beforeUnitAnalysis: (tsconfigPath) => {
|
|
586
|
+
context.logger.info(`Scanning for outputs: ${tsconfigPath}...`);
|
|
587
|
+
},
|
|
588
|
+
afterAllAnalyzed: () => {
|
|
589
|
+
context.logger.info(``);
|
|
590
|
+
context.logger.info(`Processing analysis data between targets...`);
|
|
591
|
+
context.logger.info(``);
|
|
592
|
+
},
|
|
593
|
+
afterAnalysisFailure: () => {
|
|
594
|
+
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
595
|
+
},
|
|
596
|
+
whenDone: ({ counters }) => {
|
|
597
|
+
const { detectedOutputs, problematicOutputs, successRate } = counters;
|
|
598
|
+
const migratedOutputs = detectedOutputs - problematicOutputs;
|
|
599
|
+
const successRatePercent = (successRate * 100).toFixed(2);
|
|
600
|
+
context.logger.info('');
|
|
601
|
+
context.logger.info(`Successfully migrated to outputs as functions 🎉`);
|
|
602
|
+
context.logger.info(` -> Migrated ${migratedOutputs} out of ${detectedOutputs} detected outputs (${successRatePercent} %).`);
|
|
603
|
+
},
|
|
604
|
+
});
|
|
571
605
|
};
|
|
572
606
|
}
|
|
573
607
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -9,11 +9,11 @@
|
|
|
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.js');
|
|
12
|
-
var compiler_host = require('./compiler_host-
|
|
12
|
+
var compiler_host = require('./compiler_host-BUKEE1cA.js');
|
|
13
13
|
var ts = require('typescript');
|
|
14
14
|
var imports = require('./imports-CIX-JgAN.js');
|
|
15
15
|
require('@angular-devkit/core');
|
|
16
|
-
require('./checker-
|
|
16
|
+
require('./checker-DoX_7XCa.js');
|
|
17
17
|
require('os');
|
|
18
18
|
require('fs');
|
|
19
19
|
require('module');
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.6
|
|
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-B4b0V0Vo.js');
|
|
10
|
+
var schematics = require('@angular-devkit/schematics');
|
|
9
11
|
var core = require('@angular-devkit/core');
|
|
10
12
|
var posixPath = require('node:path/posix');
|
|
11
13
|
var os = require('os');
|
|
12
14
|
var ts = require('typescript');
|
|
13
|
-
var checker = require('./checker-
|
|
14
|
-
var program = require('./program-BmLi-Vxz.js');
|
|
15
|
+
var checker = require('./checker-DoX_7XCa.js');
|
|
15
16
|
require('path');
|
|
17
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
16
18
|
|
|
17
19
|
function _interopNamespaceDefault(e) {
|
|
18
20
|
var n = Object.create(null);
|
|
@@ -187,7 +189,7 @@ function readConfiguration(project, existingOptions, host = checker.getFileSyste
|
|
|
187
189
|
errors: [error],
|
|
188
190
|
rootNames: [],
|
|
189
191
|
options: {},
|
|
190
|
-
emitFlags:
|
|
192
|
+
emitFlags: index.EmitFlags.Default,
|
|
191
193
|
};
|
|
192
194
|
}
|
|
193
195
|
const existingCompilerOptions = {
|
|
@@ -198,12 +200,12 @@ function readConfiguration(project, existingOptions, host = checker.getFileSyste
|
|
|
198
200
|
};
|
|
199
201
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
200
202
|
const { options, errors, fileNames: rootNames, projectReferences, } = ts.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
201
|
-
let emitFlags =
|
|
203
|
+
let emitFlags = index.EmitFlags.Default;
|
|
202
204
|
if (!(options['skipMetadataEmit'] || options['flatModuleOutFile'])) {
|
|
203
|
-
emitFlags |=
|
|
205
|
+
emitFlags |= index.EmitFlags.Metadata;
|
|
204
206
|
}
|
|
205
207
|
if (options['skipTemplateCodegen']) {
|
|
206
|
-
emitFlags = emitFlags & ~
|
|
208
|
+
emitFlags = emitFlags & ~index.EmitFlags.Codegen;
|
|
207
209
|
}
|
|
208
210
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
209
211
|
}
|
|
@@ -216,10 +218,10 @@ function readConfiguration(project, existingOptions, host = checker.getFileSyste
|
|
|
216
218
|
start: undefined,
|
|
217
219
|
length: undefined,
|
|
218
220
|
source: 'angular',
|
|
219
|
-
code:
|
|
221
|
+
code: index.UNKNOWN_ERROR_CODE,
|
|
220
222
|
},
|
|
221
223
|
];
|
|
222
|
-
return { project: '', errors, rootNames: [], options: {}, emitFlags:
|
|
224
|
+
return { project: '', errors, rootNames: [], options: {}, emitFlags: index.EmitFlags.Default };
|
|
223
225
|
}
|
|
224
226
|
}
|
|
225
227
|
function createParseConfigHost(host, fs = checker.getFileSystem()) {
|
|
@@ -488,7 +490,7 @@ function createPlainTsProgram(tsHost, tsconfig, optionOverrides) {
|
|
|
488
490
|
* an instance of the Angular compiler for the project.
|
|
489
491
|
*/
|
|
490
492
|
function createNgtscProgram(tsHost, tsconfig, optionOverrides) {
|
|
491
|
-
const ngtscProgram = new
|
|
493
|
+
const ngtscProgram = new index.NgtscProgram(tsconfig.rootNames, {
|
|
492
494
|
...tsconfig.options,
|
|
493
495
|
...defaultMigrationTsOptions,
|
|
494
496
|
...optionOverrides,
|
|
@@ -607,6 +609,81 @@ class TsurgeFunnelMigration extends TsurgeBaseMigration {
|
|
|
607
609
|
class TsurgeComplexMigration extends TsurgeBaseMigration {
|
|
608
610
|
}
|
|
609
611
|
|
|
612
|
+
/*!
|
|
613
|
+
* @license
|
|
614
|
+
* Copyright Google LLC All Rights Reserved.
|
|
615
|
+
*
|
|
616
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
617
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
618
|
+
*/
|
|
619
|
+
exports.MigrationStage = void 0;
|
|
620
|
+
(function (MigrationStage) {
|
|
621
|
+
/** The migration is analyzing an entrypoint */
|
|
622
|
+
MigrationStage[MigrationStage["Analysis"] = 0] = "Analysis";
|
|
623
|
+
/** The migration is about to migrate an entrypoint */
|
|
624
|
+
MigrationStage[MigrationStage["Migrate"] = 1] = "Migrate";
|
|
625
|
+
})(exports.MigrationStage || (exports.MigrationStage = {}));
|
|
626
|
+
/** Runs a Tsurge within an Angular Devkit context. */
|
|
627
|
+
async function runMigrationInDevkit(config) {
|
|
628
|
+
const { buildPaths, testPaths } = await project_tsconfig_paths.getProjectTsConfigPaths(config.tree);
|
|
629
|
+
if (!buildPaths.length && !testPaths.length) {
|
|
630
|
+
throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run the migration.');
|
|
631
|
+
}
|
|
632
|
+
const tsconfigPaths = [...buildPaths, ...testPaths];
|
|
633
|
+
const fs = new DevkitMigrationFilesystem(config.tree);
|
|
634
|
+
checker.setFileSystem(fs);
|
|
635
|
+
const migration = config.getMigration(fs);
|
|
636
|
+
const unitResults = [];
|
|
637
|
+
const isFunnelMigration = migration instanceof TsurgeFunnelMigration;
|
|
638
|
+
for (const tsconfigPath of tsconfigPaths) {
|
|
639
|
+
config.beforeProgramCreation?.(tsconfigPath, exports.MigrationStage.Analysis);
|
|
640
|
+
const baseInfo = migration.createProgram(tsconfigPath, fs);
|
|
641
|
+
const info = migration.prepareProgram(baseInfo);
|
|
642
|
+
config.afterProgramCreation?.(info, fs, exports.MigrationStage.Analysis);
|
|
643
|
+
config.beforeUnitAnalysis?.(tsconfigPath);
|
|
644
|
+
unitResults.push(await migration.analyze(info));
|
|
645
|
+
}
|
|
646
|
+
config.afterAllAnalyzed?.();
|
|
647
|
+
const combined = await synchronouslyCombineUnitData(migration, unitResults);
|
|
648
|
+
if (combined === null) {
|
|
649
|
+
config.afterAnalysisFailure?.();
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
const globalMeta = await migration.globalMeta(combined);
|
|
653
|
+
let replacements;
|
|
654
|
+
if (isFunnelMigration) {
|
|
655
|
+
replacements = (await migration.migrate(globalMeta)).replacements;
|
|
656
|
+
}
|
|
657
|
+
else {
|
|
658
|
+
replacements = [];
|
|
659
|
+
for (const tsconfigPath of tsconfigPaths) {
|
|
660
|
+
config.beforeProgramCreation?.(tsconfigPath, exports.MigrationStage.Migrate);
|
|
661
|
+
const baseInfo = migration.createProgram(tsconfigPath, fs);
|
|
662
|
+
const info = migration.prepareProgram(baseInfo);
|
|
663
|
+
config.afterProgramCreation?.(info, fs, exports.MigrationStage.Migrate);
|
|
664
|
+
const result = await migration.migrate(globalMeta, info);
|
|
665
|
+
replacements.push(...result.replacements);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
const replacementsPerFile = new Map();
|
|
669
|
+
const changesPerFile = groupReplacementsByFile(replacements);
|
|
670
|
+
for (const [file, changes] of changesPerFile) {
|
|
671
|
+
if (!replacementsPerFile.has(file)) {
|
|
672
|
+
replacementsPerFile.set(file, changes);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
for (const [file, changes] of replacementsPerFile) {
|
|
676
|
+
const recorder = config.tree.beginUpdate(file);
|
|
677
|
+
for (const c of changes) {
|
|
678
|
+
recorder
|
|
679
|
+
.remove(c.data.position, c.data.end - c.data.position)
|
|
680
|
+
.insertRight(c.data.position, c.data.toInsert);
|
|
681
|
+
}
|
|
682
|
+
config.tree.commitUpdate(recorder);
|
|
683
|
+
}
|
|
684
|
+
config.whenDone?.(await migration.stats(globalMeta));
|
|
685
|
+
}
|
|
686
|
+
|
|
610
687
|
/** A text replacement for the given file. */
|
|
611
688
|
class Replacement {
|
|
612
689
|
projectFile;
|
|
@@ -668,13 +745,11 @@ function isWithinBasePath(fs, base, path) {
|
|
|
668
745
|
return checker.isLocalRelativePath(fs.relative(base, path));
|
|
669
746
|
}
|
|
670
747
|
|
|
671
|
-
exports.DevkitMigrationFilesystem = DevkitMigrationFilesystem;
|
|
672
748
|
exports.Replacement = Replacement;
|
|
673
749
|
exports.TextUpdate = TextUpdate;
|
|
674
750
|
exports.TsurgeComplexMigration = TsurgeComplexMigration;
|
|
675
751
|
exports.TsurgeFunnelMigration = TsurgeFunnelMigration;
|
|
676
752
|
exports.confirmAsSerializable = confirmAsSerializable;
|
|
677
753
|
exports.createBaseProgramInfo = createBaseProgramInfo;
|
|
678
|
-
exports.groupReplacementsByFile = groupReplacementsByFile;
|
|
679
754
|
exports.projectFile = projectFile;
|
|
680
|
-
exports.
|
|
755
|
+
exports.runMigrationInDevkit = runMigrationInDevkit;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -9,11 +9,11 @@
|
|
|
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.js');
|
|
12
|
-
var compiler_host = require('./compiler_host-
|
|
12
|
+
var compiler_host = require('./compiler_host-BUKEE1cA.js');
|
|
13
13
|
var ts = require('typescript');
|
|
14
14
|
var imports = require('./imports-CIX-JgAN.js');
|
|
15
15
|
require('@angular-devkit/core');
|
|
16
|
-
require('./checker-
|
|
16
|
+
require('./checker-DoX_7XCa.js');
|
|
17
17
|
require('os');
|
|
18
18
|
require('fs');
|
|
19
19
|
require('module');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
3
|
+
* @license Angular v19.2.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
10
|
var fs = require('fs');
|
|
11
11
|
var p = require('path');
|
|
12
|
-
var compiler_host = require('./compiler_host-
|
|
12
|
+
var compiler_host = require('./compiler_host-BUKEE1cA.js');
|
|
13
13
|
var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
14
14
|
var ts = require('typescript');
|
|
15
|
-
var checker = require('./checker-
|
|
15
|
+
var checker = require('./checker-DoX_7XCa.js');
|
|
16
16
|
var property_name = require('./property_name-BBwFuqMe.js');
|
|
17
17
|
require('os');
|
|
18
18
|
require('@angular-devkit/core');
|