@angular/core 20.0.0-next.2 → 20.0.0-next.4
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 +345 -0
- package/fesm2022/core.mjs +614 -428
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/injector-BlLwZ2sr.mjs +24 -0
- package/fesm2022/injector-BlLwZ2sr.mjs.map +1 -0
- package/fesm2022/primitives/di.mjs +5 -18
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +4 -589
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -8
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +2 -10
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/untracked-DkcXpNb_.mjs +620 -0
- package/fesm2022/untracked-DkcXpNb_.mjs.map +1 -0
- package/index.d.ts +7589 -7510
- package/{navigation_types.d-u4EOrrdZ.d.ts → navigation_types.d-DgDrF5rp.d.ts} +2 -2
- package/package.json +2 -2
- package/primitives/di/index.d.ts +25 -10
- package/primitives/event-dispatch/index.d.ts +5 -340
- package/primitives/signals/index.d.ts +5 -208
- package/rxjs-interop/index.d.ts +1 -10
- package/schematics/bundles/{apply_import_manager-CyRT0UvU.js → apply_import_manager-CeNv8GIG.js} +6 -6
- package/schematics/bundles/{checker-DF8ZaFW5.js → checker-k591b6WQ.js} +856 -180
- package/schematics/bundles/cleanup-unused-imports.js +42 -69
- package/schematics/bundles/{compiler_host-Da636uJ8.js → compiler_host-DwM3ugW3.js} +2 -2
- package/schematics/bundles/control-flow-migration.js +34 -13
- package/schematics/bundles/imports-CIX-JgAN.js +1 -1
- package/schematics/bundles/{program-BZk27Ndu.js → index-B4OAlHh8.js} +2234 -2097
- package/schematics/bundles/{index-DnkWgagp.js → index-BhELUmYx.js} +11 -11
- package/schematics/bundles/inject-flags.js +18 -52
- package/schematics/bundles/inject-migration.js +3 -3
- package/schematics/bundles/leading_space-D9nQ8UQC.js +1 -1
- package/schematics/bundles/{migrate_ts_type_references-DtkOnnv0.js → migrate_ts_type_references-Be0TNYen.js} +20 -20
- package/schematics/bundles/ng_decorators-DznZ5jMl.js +1 -1
- package/schematics/bundles/nodes-B16H9JUd.js +1 -1
- package/schematics/bundles/output-migration.js +62 -90
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.js +1 -1
- package/schematics/bundles/property_name-BBwFuqMe.js +1 -1
- package/schematics/bundles/route-lazy-loading.js +3 -3
- package/schematics/bundles/{project_paths-Jtbi76Bs.js → run_in_devkit-CkvEksWP.js} +262 -197
- package/schematics/bundles/self-closing-tags-migration.js +41 -71
- package/schematics/bundles/signal-input-migration.js +69 -97
- package/schematics/bundles/signal-queries-migration.js +80 -108
- package/schematics/bundles/signals.js +11 -11
- package/schematics/bundles/standalone-migration.js +8 -22
- package/schematics/bundles/symbol-VPWguRxr.js +25 -0
- package/schematics/bundles/test-bed-get.js +98 -0
- package/schematics/migrations.json +5 -0
- package/testing/index.d.ts +2 -4
- package/weak_ref.d-BZ7gyRag.d.ts +216 -0
- package/fesm2022/weak_ref-DrMdAIDh.mjs +0 -12
- package/fesm2022/weak_ref-DrMdAIDh.mjs.map +0 -1
- package/schematics/bundles/index-vGJcp5M7.js +0 -30
- package/weak_ref.d-ttyj86RV.d.ts +0 -9
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.4
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
11
|
-
var project_paths = require('./project_paths-Jtbi76Bs.js');
|
|
12
|
-
require('os');
|
|
9
|
+
var checker = require('./checker-k591b6WQ.js');
|
|
13
10
|
var ts = require('typescript');
|
|
14
|
-
|
|
15
|
-
var
|
|
11
|
+
require('os');
|
|
12
|
+
var index$1 = require('./index-B4OAlHh8.js');
|
|
16
13
|
require('path');
|
|
17
|
-
var
|
|
18
|
-
var
|
|
14
|
+
var run_in_devkit = require('./run_in_devkit-CkvEksWP.js');
|
|
15
|
+
var apply_import_manager = require('./apply_import_manager-CeNv8GIG.js');
|
|
16
|
+
var migrate_ts_type_references = require('./migrate_ts_type_references-Be0TNYen.js');
|
|
19
17
|
var assert = require('assert');
|
|
20
|
-
var index = require('./index-
|
|
18
|
+
var index = require('./index-BhELUmYx.js');
|
|
21
19
|
require('@angular-devkit/core');
|
|
22
20
|
require('node:path/posix');
|
|
23
21
|
require('fs');
|
|
24
22
|
require('module');
|
|
25
23
|
require('url');
|
|
24
|
+
require('@angular-devkit/schematics');
|
|
25
|
+
require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
26
26
|
require('./leading_space-D9nQ8UQC.js');
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -57,7 +57,7 @@ function migrateHostBindings(host, references, info) {
|
|
|
57
57
|
const appendText = reference.from.isObjectShorthandExpression
|
|
58
58
|
? `: ${reference.from.read.name}()`
|
|
59
59
|
: `()`;
|
|
60
|
-
host.replacements.push(new
|
|
60
|
+
host.replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(bindingField.getSourceFile(), info), new run_in_devkit.TextUpdate({ position: readEndPos, end: readEndPos, toInsert: appendText })));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -86,7 +86,7 @@ function migrateTemplateReferences(host, references) {
|
|
|
86
86
|
const appendText = reference.from.isObjectShorthandExpression
|
|
87
87
|
? `: ${reference.from.read.name}()`
|
|
88
88
|
: `()`;
|
|
89
|
-
host.replacements.push(new
|
|
89
|
+
host.replacements.push(new run_in_devkit.Replacement(reference.from.templateFile, new run_in_devkit.TextUpdate({
|
|
90
90
|
position: reference.from.read.sourceSpan.end,
|
|
91
91
|
end: reference.from.read.sourceSpan.end,
|
|
92
92
|
toInsert: appendText,
|
|
@@ -217,7 +217,7 @@ function computeReplacementsToMigrateQuery(node, metadata, importManager, info,
|
|
|
217
217
|
resolvedReadType === null && type !== undefined ? [type] : undefined, args);
|
|
218
218
|
const updated = ts.factory.createPropertyDeclaration([ts.factory.createModifier(ts.SyntaxKind.ReadonlyKeyword)], node.name, undefined, undefined, call);
|
|
219
219
|
return [
|
|
220
|
-
new
|
|
220
|
+
new run_in_devkit.Replacement(run_in_devkit.projectFile(node.getSourceFile(), info), new run_in_devkit.TextUpdate({
|
|
221
221
|
position: node.getStart(),
|
|
222
222
|
end: node.getEnd(),
|
|
223
223
|
toInsert: printer.printNode(ts.EmitHint.Unspecified, updated, sf),
|
|
@@ -258,7 +258,7 @@ function getUniqueIDForClassProperty(property, info) {
|
|
|
258
258
|
if (property.name === undefined) {
|
|
259
259
|
return null;
|
|
260
260
|
}
|
|
261
|
-
const id =
|
|
261
|
+
const id = run_in_devkit.projectFile(property.getSourceFile(), info).id.replace(/\.d\.ts$/, '.ts');
|
|
262
262
|
// Note: If a class is nested, there could be an ID clash.
|
|
263
263
|
// This is highly unlikely though, and this is not a problem because
|
|
264
264
|
// in such cases, there is even less chance there are any references to
|
|
@@ -382,7 +382,7 @@ class KnownQueries {
|
|
|
382
382
|
});
|
|
383
383
|
this.knownQueryIDs.set(id, { key: id, node: queryField });
|
|
384
384
|
const descriptor = { key: id, node: queryField };
|
|
385
|
-
const file =
|
|
385
|
+
const file = run_in_devkit.projectFile(queryField.getSourceFile(), this.info);
|
|
386
386
|
if (this.config.shouldMigrateQuery !== undefined &&
|
|
387
387
|
!this.config.shouldMigrateQuery(descriptor, file)) {
|
|
388
388
|
this.markFieldIncompatible(descriptor, {
|
|
@@ -581,7 +581,7 @@ function removeQueryListToArrayCall(ref, info, globalMetadata, knownQueries, rep
|
|
|
581
581
|
return;
|
|
582
582
|
}
|
|
583
583
|
const toArrayExpr = toArrayCallExpr.expression;
|
|
584
|
-
replacements.push(new
|
|
584
|
+
replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(toArrayExpr.getSourceFile(), info), new run_in_devkit.TextUpdate({
|
|
585
585
|
// Delete from expression end to call end. E.g. `.toArray(<..>)`.
|
|
586
586
|
position: toArrayExpr.expression.getEnd(),
|
|
587
587
|
end: toArrayCallExpr.getEnd(),
|
|
@@ -596,7 +596,7 @@ function removeQueryListToArrayCall(ref, info, globalMetadata, knownQueries, rep
|
|
|
596
596
|
}
|
|
597
597
|
const file = index.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
|
|
598
598
|
const offset = index.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
|
|
599
|
-
replacements.push(new
|
|
599
|
+
replacements.push(new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
600
600
|
// Delete from expression end to call end. E.g. `.toArray(<..>)`.
|
|
601
601
|
position: offset + callExpr.receiver.receiver.sourceSpan.end,
|
|
602
602
|
end: offset + callExpr.sourceSpan.end,
|
|
@@ -620,7 +620,7 @@ function replaceQueryListGetCall(ref, info, globalMetadata, knownQueries, replac
|
|
|
620
620
|
return;
|
|
621
621
|
}
|
|
622
622
|
const getExpr = getCallExpr.expression;
|
|
623
|
-
replacements.push(new
|
|
623
|
+
replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(getExpr.getSourceFile(), info), new run_in_devkit.TextUpdate({
|
|
624
624
|
position: getExpr.name.getStart(),
|
|
625
625
|
end: getExpr.name.getEnd(),
|
|
626
626
|
toInsert: 'at',
|
|
@@ -634,7 +634,7 @@ function replaceQueryListGetCall(ref, info, globalMetadata, knownQueries, replac
|
|
|
634
634
|
}
|
|
635
635
|
const file = index.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
|
|
636
636
|
const offset = index.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
|
|
637
|
-
replacements.push(new
|
|
637
|
+
replacements.push(new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
638
638
|
position: offset + callExpr.receiver.nameSpan.start,
|
|
639
639
|
end: offset + callExpr.receiver.nameSpan.end,
|
|
640
640
|
toInsert: 'at',
|
|
@@ -689,7 +689,7 @@ function replaceQueryListFirstAndLastReferences(ref, info, globalMetadata, known
|
|
|
689
689
|
if (expr === null) {
|
|
690
690
|
return;
|
|
691
691
|
}
|
|
692
|
-
replacements.push(new
|
|
692
|
+
replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(expr.getSourceFile(), info), new run_in_devkit.TextUpdate({
|
|
693
693
|
position: expr.name.getStart(),
|
|
694
694
|
end: expr.name.getEnd(),
|
|
695
695
|
toInsert: mapping.get(expr.name.text),
|
|
@@ -703,14 +703,14 @@ function replaceQueryListFirstAndLastReferences(ref, info, globalMetadata, known
|
|
|
703
703
|
}
|
|
704
704
|
const file = index.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
|
|
705
705
|
const offset = index.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
|
|
706
|
-
replacements.push(new
|
|
706
|
+
replacements.push(new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
707
707
|
position: offset + expr.nameSpan.start,
|
|
708
708
|
end: offset + expr.nameSpan.end,
|
|
709
709
|
toInsert: mapping.get(expr.name),
|
|
710
710
|
})));
|
|
711
711
|
}
|
|
712
712
|
|
|
713
|
-
class SignalQueriesMigration extends
|
|
713
|
+
class SignalQueriesMigration extends run_in_devkit.TsurgeComplexMigration {
|
|
714
714
|
config;
|
|
715
715
|
constructor(config = {}) {
|
|
716
716
|
super();
|
|
@@ -726,10 +726,10 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
726
726
|
if (templateTypeChecker !== null) {
|
|
727
727
|
templateTypeChecker.generateAllTypeCheckBlocks();
|
|
728
728
|
}
|
|
729
|
-
const { sourceFiles, program
|
|
730
|
-
const checker$1 = program
|
|
729
|
+
const { sourceFiles, program } = info;
|
|
730
|
+
const checker$1 = program.getTypeChecker();
|
|
731
731
|
const reflector = new checker.TypeScriptReflectionHost(checker$1);
|
|
732
|
-
const evaluator = new
|
|
732
|
+
const evaluator = new index$1.PartialEvaluator(reflector, checker$1, null);
|
|
733
733
|
const res = {
|
|
734
734
|
knownQueryFields: {},
|
|
735
735
|
potentialProblematicQueries: {},
|
|
@@ -748,7 +748,7 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
748
748
|
key: extractedQuery.id,
|
|
749
749
|
node: queryNode,
|
|
750
750
|
};
|
|
751
|
-
const containingFile =
|
|
751
|
+
const containingFile = run_in_devkit.projectFile(queryNode.getSourceFile(), info);
|
|
752
752
|
// If we have a config filter function, use it here for later
|
|
753
753
|
// perf-boosted reference lookups. Useful in non-batch mode.
|
|
754
754
|
if (this.config.shouldMigrateQuery === undefined ||
|
|
@@ -852,7 +852,7 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
852
852
|
if (this.config.assumeNonBatch) {
|
|
853
853
|
res.reusableAnalysisReferences = referenceResult.references;
|
|
854
854
|
}
|
|
855
|
-
return
|
|
855
|
+
return run_in_devkit.confirmAsSerializable(res);
|
|
856
856
|
}
|
|
857
857
|
async combine(unitA, unitB) {
|
|
858
858
|
const combined = {
|
|
@@ -892,7 +892,7 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
|
-
return
|
|
895
|
+
return run_in_devkit.confirmAsSerializable(combined);
|
|
896
896
|
}
|
|
897
897
|
async globalMeta(combinedData) {
|
|
898
898
|
const globalUnitData = {
|
|
@@ -905,7 +905,7 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
905
905
|
markFieldIncompatibleInMetadata(globalUnitData.problematicQueries, id, migrate_ts_type_references.FieldIncompatibilityReason.SignalQueries__QueryListProblematicFieldAccessed);
|
|
906
906
|
}
|
|
907
907
|
}
|
|
908
|
-
return
|
|
908
|
+
return run_in_devkit.confirmAsSerializable(globalUnitData);
|
|
909
909
|
}
|
|
910
910
|
async migrate(globalMetadata, info) {
|
|
911
911
|
// Pre-Analyze the program and get access to the template type checker.
|
|
@@ -914,10 +914,10 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
914
914
|
metaReader: null,
|
|
915
915
|
};
|
|
916
916
|
const resourceLoader = info.ngCompiler?.['resourceManager'] ?? null;
|
|
917
|
-
const { program
|
|
918
|
-
const checker$1 = program
|
|
917
|
+
const { program, sourceFiles } = info;
|
|
918
|
+
const checker$1 = program.getTypeChecker();
|
|
919
919
|
const reflector = new checker.TypeScriptReflectionHost(checker$1);
|
|
920
|
-
const evaluator = new
|
|
920
|
+
const evaluator = new index$1.PartialEvaluator(reflector, checker$1, null);
|
|
921
921
|
const replacements = [];
|
|
922
922
|
const importManager = new checker.ImportManager();
|
|
923
923
|
const printer = ts.createPrinter();
|
|
@@ -1106,84 +1106,56 @@ function updateFileState(stateMap, node, queryType) {
|
|
|
1106
1106
|
|
|
1107
1107
|
function migrate(options) {
|
|
1108
1108
|
return async (tree, context) => {
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1109
|
+
await run_in_devkit.runMigrationInDevkit({
|
|
1110
|
+
tree,
|
|
1111
|
+
getMigration: (fs) => new SignalQueriesMigration({
|
|
1112
|
+
bestEffortMode: options.bestEffortMode,
|
|
1113
|
+
insertTodosForSkippedFields: options.insertTodos,
|
|
1114
|
+
shouldMigrateQuery: (_query, file) => {
|
|
1115
|
+
return (file.rootRelativePath.startsWith(fs.normalize(options.path)) &&
|
|
1116
|
+
!/(^|\/)node_modules\//.test(file.rootRelativePath));
|
|
1117
|
+
},
|
|
1118
|
+
}),
|
|
1119
|
+
beforeProgramCreation: (tsconfigPath) => {
|
|
1120
|
+
context.logger.info(`Preparing analysis for: ${tsconfigPath}...`);
|
|
1121
1121
|
},
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
const info = migration.prepareProgram(baseInfo);
|
|
1129
|
-
// Support restricting the analysis to subfolders for larger projects.
|
|
1130
|
-
if (analysisPath !== '/') {
|
|
1131
|
-
info.sourceFiles = info.sourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1132
|
-
info.fullProgramSourceFiles = info.fullProgramSourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1133
|
-
}
|
|
1134
|
-
return { info, tsconfigPath };
|
|
1135
|
-
});
|
|
1136
|
-
// Analyze phase. Treat all projects as compilation units as
|
|
1137
|
-
// this allows us to support references between those.
|
|
1138
|
-
for (const { info, tsconfigPath } of programInfos) {
|
|
1139
|
-
context.logger.info(`Scanning for queries: ${tsconfigPath}..`);
|
|
1140
|
-
unitResults.push(await migration.analyze(info));
|
|
1141
|
-
}
|
|
1142
|
-
context.logger.info(``);
|
|
1143
|
-
context.logger.info(`Processing analysis data between targets..`);
|
|
1144
|
-
context.logger.info(``);
|
|
1145
|
-
const combined = await project_paths.synchronouslyCombineUnitData(migration, unitResults);
|
|
1146
|
-
if (combined === null) {
|
|
1147
|
-
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
1148
|
-
return;
|
|
1149
|
-
}
|
|
1150
|
-
const globalMeta = await migration.globalMeta(combined);
|
|
1151
|
-
const replacementsPerFile = new Map();
|
|
1152
|
-
for (const { info, tsconfigPath } of programInfos) {
|
|
1153
|
-
context.logger.info(`Migrating: ${tsconfigPath}..`);
|
|
1154
|
-
const { replacements } = await migration.migrate(globalMeta, info);
|
|
1155
|
-
const changesPerFile = project_paths.groupReplacementsByFile(replacements);
|
|
1156
|
-
for (const [file, changes] of changesPerFile) {
|
|
1157
|
-
if (!replacementsPerFile.has(file)) {
|
|
1158
|
-
replacementsPerFile.set(file, changes);
|
|
1122
|
+
afterProgramCreation: (info, fs) => {
|
|
1123
|
+
const analysisPath = fs.resolve(options.analysisDir);
|
|
1124
|
+
// Support restricting the analysis to subfolders for larger projects.
|
|
1125
|
+
if (analysisPath !== '/') {
|
|
1126
|
+
info.sourceFiles = info.sourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1127
|
+
info.fullProgramSourceFiles = info.fullProgramSourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1159
1128
|
}
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1129
|
+
},
|
|
1130
|
+
beforeUnitAnalysis: (tsconfigPath) => {
|
|
1131
|
+
context.logger.info(`Scanning for queries: ${tsconfigPath}...`);
|
|
1132
|
+
},
|
|
1133
|
+
afterAnalysisFailure: () => {
|
|
1134
|
+
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
1135
|
+
},
|
|
1136
|
+
afterAllAnalyzed: () => {
|
|
1137
|
+
context.logger.info(``);
|
|
1138
|
+
context.logger.info(`Processing analysis data between targets...`);
|
|
1139
|
+
context.logger.info(``);
|
|
1140
|
+
},
|
|
1141
|
+
whenDone: ({ counters }) => {
|
|
1142
|
+
context.logger.info('');
|
|
1143
|
+
context.logger.info(`Successfully migrated to signal queries 🎉`);
|
|
1144
|
+
const { queriesCount, incompatibleQueries } = counters;
|
|
1145
|
+
const migratedQueries = queriesCount - incompatibleQueries;
|
|
1146
|
+
context.logger.info('');
|
|
1147
|
+
context.logger.info(`Successfully migrated to signal queries 🎉`);
|
|
1148
|
+
context.logger.info(` -> Migrated ${migratedQueries}/${queriesCount} queries.`);
|
|
1149
|
+
if (incompatibleQueries > 0 && !options.insertTodos) {
|
|
1150
|
+
context.logger.warn(`To see why ${incompatibleQueries} queries couldn't be migrated`);
|
|
1151
|
+
context.logger.warn(`consider re-running with "--insert-todos" or "--best-effort-mode".`);
|
|
1152
|
+
}
|
|
1153
|
+
if (options.bestEffortMode) {
|
|
1154
|
+
context.logger.warn(`You ran with best effort mode. Manually verify all code ` +
|
|
1155
|
+
`works as intended, and fix where necessary.`);
|
|
1156
|
+
}
|
|
1157
|
+
},
|
|
1158
|
+
});
|
|
1187
1159
|
};
|
|
1188
1160
|
}
|
|
1189
1161
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.4
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10,22 +10,22 @@ var schematics = require('@angular-devkit/schematics');
|
|
|
10
10
|
var signalQueriesMigration = require('./signal-queries-migration.js');
|
|
11
11
|
var signalInputMigration = require('./signal-input-migration.js');
|
|
12
12
|
var outputMigration = require('./output-migration.js');
|
|
13
|
-
require('./
|
|
14
|
-
require('@angular-devkit/core');
|
|
15
|
-
require('./project_paths-Jtbi76Bs.js');
|
|
16
|
-
require('node:path/posix');
|
|
17
|
-
require('os');
|
|
13
|
+
require('./checker-k591b6WQ.js');
|
|
18
14
|
require('typescript');
|
|
19
|
-
require('
|
|
15
|
+
require('os');
|
|
20
16
|
require('fs');
|
|
21
17
|
require('module');
|
|
22
18
|
require('path');
|
|
23
19
|
require('url');
|
|
24
|
-
require('./
|
|
25
|
-
require('./
|
|
26
|
-
require('
|
|
20
|
+
require('./index-B4OAlHh8.js');
|
|
21
|
+
require('./run_in_devkit-CkvEksWP.js');
|
|
22
|
+
require('@angular-devkit/core');
|
|
23
|
+
require('node:path/posix');
|
|
24
|
+
require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
25
|
+
require('./apply_import_manager-CeNv8GIG.js');
|
|
26
|
+
require('./migrate_ts_type_references-Be0TNYen.js');
|
|
27
27
|
require('assert');
|
|
28
|
-
require('./index-
|
|
28
|
+
require('./index-BhELUmYx.js');
|
|
29
29
|
require('./leading_space-D9nQ8UQC.js');
|
|
30
30
|
|
|
31
31
|
function migrate(options) {
|
|
@@ -1,44 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.4
|
|
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 schematics = require('@angular-devkit/schematics');
|
|
10
|
-
require('./index-
|
|
10
|
+
var index = require('./index-B4OAlHh8.js');
|
|
11
11
|
var fs = require('fs');
|
|
12
12
|
var p = require('path');
|
|
13
13
|
var ts = require('typescript');
|
|
14
|
-
var compiler_host = require('./compiler_host-
|
|
14
|
+
var compiler_host = require('./compiler_host-DwM3ugW3.js');
|
|
15
15
|
var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
16
16
|
var ng_decorators = require('./ng_decorators-DznZ5jMl.js');
|
|
17
17
|
var nodes = require('./nodes-B16H9JUd.js');
|
|
18
|
+
var symbol = require('./symbol-VPWguRxr.js');
|
|
18
19
|
var imports = require('./imports-CIX-JgAN.js');
|
|
19
|
-
var checker = require('./checker-
|
|
20
|
+
var checker = require('./checker-k591b6WQ.js');
|
|
20
21
|
require('os');
|
|
21
|
-
var program = require('./program-BZk27Ndu.js');
|
|
22
22
|
require('@angular-devkit/core');
|
|
23
23
|
require('module');
|
|
24
24
|
require('url');
|
|
25
25
|
|
|
26
26
|
function createProgram({ rootNames, options, host, oldProgram, }) {
|
|
27
|
-
return new
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** Checks whether a node is referring to a specific import specifier. */
|
|
31
|
-
function isReferenceToImport(typeChecker, node, importSpecifier) {
|
|
32
|
-
// If this function is called on an identifier (should be most cases), we can quickly rule out
|
|
33
|
-
// non-matches by comparing the identifier's string and the local name of the import specifier
|
|
34
|
-
// which saves us some calls to the type checker.
|
|
35
|
-
if (ts.isIdentifier(node) && node.text !== importSpecifier.name.text) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
const nodeSymbol = typeChecker.getTypeAtLocation(node).getSymbol();
|
|
39
|
-
const importSymbol = typeChecker.getTypeAtLocation(importSpecifier).getSymbol();
|
|
40
|
-
return (!!(nodeSymbol?.declarations?.[0] && importSymbol?.declarations?.[0]) &&
|
|
41
|
-
nodeSymbol.declarations[0] === importSymbol.declarations[0]);
|
|
27
|
+
return new index.NgtscProgram(rootNames, options, host, oldProgram);
|
|
42
28
|
}
|
|
43
29
|
|
|
44
30
|
/*!
|
|
@@ -315,11 +301,11 @@ function isTestCall(typeChecker, node, testBedImport, catalystImport) {
|
|
|
315
301
|
testBedImport &&
|
|
316
302
|
ts.isPropertyAccessExpression(node.expression) &&
|
|
317
303
|
node.expression.name.text === 'configureTestingModule' &&
|
|
318
|
-
isReferenceToImport(typeChecker, node.expression.expression, testBedImport);
|
|
304
|
+
symbol.isReferenceToImport(typeChecker, node.expression.expression, testBedImport);
|
|
319
305
|
const isCatalystCall = isObjectLiteralCall &&
|
|
320
306
|
catalystImport &&
|
|
321
307
|
ts.isIdentifier(node.expression) &&
|
|
322
|
-
isReferenceToImport(typeChecker, node.expression, catalystImport);
|
|
308
|
+
symbol.isReferenceToImport(typeChecker, node.expression, catalystImport);
|
|
323
309
|
return !!(isTestBedCall || isCatalystCall);
|
|
324
310
|
}
|
|
325
311
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @license Angular v20.0.0-next.4
|
|
4
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var ts = require('typescript');
|
|
10
|
+
|
|
11
|
+
/** Checks whether a node is referring to a specific import specifier. */
|
|
12
|
+
function isReferenceToImport(typeChecker, node, importSpecifier) {
|
|
13
|
+
// If this function is called on an identifier (should be most cases), we can quickly rule out
|
|
14
|
+
// non-matches by comparing the identifier's string and the local name of the import specifier
|
|
15
|
+
// which saves us some calls to the type checker.
|
|
16
|
+
if (ts.isIdentifier(node) && node.text !== importSpecifier.name.text) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const nodeSymbol = typeChecker.getTypeAtLocation(node).getSymbol();
|
|
20
|
+
const importSymbol = typeChecker.getTypeAtLocation(importSpecifier).getSymbol();
|
|
21
|
+
return (!!(nodeSymbol?.declarations?.[0] && importSymbol?.declarations?.[0]) &&
|
|
22
|
+
nodeSymbol.declarations[0] === importSymbol.declarations[0]);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.isReferenceToImport = isReferenceToImport;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @license Angular v20.0.0-next.4
|
|
4
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var ts = require('typescript');
|
|
10
|
+
require('os');
|
|
11
|
+
require('./checker-k591b6WQ.js');
|
|
12
|
+
require('./index-B4OAlHh8.js');
|
|
13
|
+
require('path');
|
|
14
|
+
var run_in_devkit = require('./run_in_devkit-CkvEksWP.js');
|
|
15
|
+
var imports = require('./imports-CIX-JgAN.js');
|
|
16
|
+
var symbol = require('./symbol-VPWguRxr.js');
|
|
17
|
+
require('@angular-devkit/core');
|
|
18
|
+
require('node:path/posix');
|
|
19
|
+
require('fs');
|
|
20
|
+
require('module');
|
|
21
|
+
require('url');
|
|
22
|
+
require('@angular-devkit/schematics');
|
|
23
|
+
require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
24
|
+
|
|
25
|
+
/** Name of the method being replaced. */
|
|
26
|
+
const METHOD_NAME = 'get';
|
|
27
|
+
/** Migration that replaces `TestBed.get` usages with `TestBed.inject`. */
|
|
28
|
+
class TestBedGetMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
29
|
+
async analyze(info) {
|
|
30
|
+
const locations = [];
|
|
31
|
+
for (const sourceFile of info.sourceFiles) {
|
|
32
|
+
const specifier = imports.getImportSpecifier(sourceFile, '@angular/core/testing', 'TestBed');
|
|
33
|
+
if (specifier === null) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const typeChecker = info.program.getTypeChecker();
|
|
37
|
+
sourceFile.forEachChild(function walk(node) {
|
|
38
|
+
if (ts.isPropertyAccessExpression(node) &&
|
|
39
|
+
node.name.text === METHOD_NAME &&
|
|
40
|
+
ts.isIdentifier(node.expression) &&
|
|
41
|
+
symbol.isReferenceToImport(typeChecker, node.expression, specifier)) {
|
|
42
|
+
locations.push({ file: run_in_devkit.projectFile(sourceFile, info), position: node.name.getStart() });
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
node.forEachChild(walk);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return run_in_devkit.confirmAsSerializable({ locations });
|
|
50
|
+
}
|
|
51
|
+
async migrate(globalData) {
|
|
52
|
+
const replacements = globalData.locations.map(({ file, position }) => {
|
|
53
|
+
return new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
54
|
+
position: position,
|
|
55
|
+
end: position + METHOD_NAME.length,
|
|
56
|
+
toInsert: 'inject',
|
|
57
|
+
}));
|
|
58
|
+
});
|
|
59
|
+
return run_in_devkit.confirmAsSerializable({ replacements });
|
|
60
|
+
}
|
|
61
|
+
async combine(unitA, unitB) {
|
|
62
|
+
const seen = new Set();
|
|
63
|
+
const locations = [];
|
|
64
|
+
const combined = [...unitA.locations, ...unitB.locations];
|
|
65
|
+
for (const location of combined) {
|
|
66
|
+
const key = `${location.file.id}#${location.position}`;
|
|
67
|
+
if (!seen.has(key)) {
|
|
68
|
+
seen.add(key);
|
|
69
|
+
locations.push(location);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return run_in_devkit.confirmAsSerializable({ locations });
|
|
73
|
+
}
|
|
74
|
+
async globalMeta(combinedData) {
|
|
75
|
+
return run_in_devkit.confirmAsSerializable(combinedData);
|
|
76
|
+
}
|
|
77
|
+
async stats() {
|
|
78
|
+
return { counters: {} };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/*!
|
|
83
|
+
* @license
|
|
84
|
+
* Copyright Google LLC All Rights Reserved.
|
|
85
|
+
*
|
|
86
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
87
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
88
|
+
*/
|
|
89
|
+
function migrate() {
|
|
90
|
+
return async (tree) => {
|
|
91
|
+
await run_in_devkit.runMigrationInDevkit({
|
|
92
|
+
tree,
|
|
93
|
+
getMigration: () => new TestBedGetMigration(),
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
exports.migrate = migrate;
|
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
"version": "20.0.0",
|
|
5
5
|
"description": "Replaces usages of the deprecated InjectFlags enum",
|
|
6
6
|
"factory": "./bundles/inject-flags#migrate"
|
|
7
|
+
},
|
|
8
|
+
"test-bed-get": {
|
|
9
|
+
"version": "20.0.0",
|
|
10
|
+
"description": "Replaces usages of the deprecated TestBed.get method with TestBed.inject",
|
|
11
|
+
"factory": "./bundles/test-bed-get#migrate"
|
|
7
12
|
}
|
|
8
13
|
}
|
|
9
14
|
}
|
package/testing/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
2
|
+
* @license Angular v20.0.0-next.4
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { ɵDeferBlockDetails as _DeferBlockDetails, ɵDeferBlockState as _DeferBlockState, ComponentRef, DebugElement, ElementRef, ChangeDetectorRef, NgZone, SchemaMetadata, ɵDeferBlockBehavior as _DeferBlockBehavior, InjectionToken, PlatformRef, Type, ProviderToken, InjectOptions, NgModule, Component, Directive, Pipe } from '@angular/core';
|
|
8
8
|
export { ɵDeferBlockBehavior as DeferBlockBehavior, ɵDeferBlockState as DeferBlockState } from '@angular/core';
|
|
9
|
-
import {
|
|
9
|
+
import { N as Navigation, a as NavigationHistoryEntry, b as NavigationNavigateOptions, c as NavigationResult, d as NavigationOptions, e as NavigateEvent, f as NavigationCurrentEntryChangeEvent, g as NavigationTransition, h as NavigationUpdateCurrentEntryOptions, i as NavigationReloadOptions } from '../navigation_types.d-DgDrF5rp.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Wraps a test function in an asynchronous test zone. The test will automatically
|
|
@@ -411,8 +411,6 @@ interface TestBed {
|
|
|
411
411
|
}): T;
|
|
412
412
|
inject<T>(token: ProviderToken<T>, notFoundValue: null | undefined, options: InjectOptions): T | null;
|
|
413
413
|
inject<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions): T;
|
|
414
|
-
/** @deprecated from v9.0.0 use TestBed.inject */
|
|
415
|
-
get(token: any, notFoundValue?: any): any;
|
|
416
414
|
/**
|
|
417
415
|
* Runs the given function in the `EnvironmentInjector` context of `TestBed`.
|
|
418
416
|
*
|