@angular/core 20.0.0-next.2 → 20.0.0-next.3
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/fesm2022/core.mjs +413 -365
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/di.mjs +3 -2
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +28 -7
- 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/weak_ref-DrMdAIDh.mjs +1 -1
- package/index.d.ts +7523 -7489
- package/navigation_types.d-u4EOrrdZ.d.ts +1 -1
- package/package.json +2 -2
- package/primitives/di/index.d.ts +25 -10
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +9 -6
- package/rxjs-interop/index.d.ts +1 -10
- package/schematics/bundles/{apply_import_manager-CyRT0UvU.js → apply_import_manager-BXQEjo09.js} +6 -6
- package/schematics/bundles/{checker-DF8ZaFW5.js → checker-BHb19MHt.js} +629 -71
- package/schematics/bundles/cleanup-unused-imports.js +42 -69
- package/schematics/bundles/{compiler_host-Da636uJ8.js → compiler_host-Bk3repE2.js} +2 -2
- package/schematics/bundles/control-flow-migration.js +3 -3
- package/schematics/bundles/imports-CIX-JgAN.js +1 -1
- package/schematics/bundles/{index-DnkWgagp.js → index-BL9kAIe5.js} +11 -11
- package/schematics/bundles/{program-BZk27Ndu.js → index-I8VbxQcO.js} +2234 -2097
- 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-KlOTWeDl.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-C0JPtK2u.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 +1 -3
- package/weak_ref.d-ttyj86RV.d.ts +1 -1
- package/schematics/bundles/index-vGJcp5M7.js +0 -30
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.3
|
|
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-Jtbi76Bs.js');
|
|
12
|
-
require('os');
|
|
13
9
|
var ts = require('typescript');
|
|
14
|
-
|
|
15
|
-
require('./
|
|
10
|
+
require('os');
|
|
11
|
+
var checker = require('./checker-BHb19MHt.js');
|
|
12
|
+
require('./index-I8VbxQcO.js');
|
|
16
13
|
require('path');
|
|
17
|
-
var
|
|
14
|
+
var run_in_devkit = require('./run_in_devkit-C0JPtK2u.js');
|
|
15
|
+
var apply_import_manager = require('./apply_import_manager-BXQEjo09.js');
|
|
18
16
|
var imports = require('./imports-CIX-JgAN.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
|
/** Mapping between `InjectFlag` enum members to their object literal equvalients. */
|
|
26
26
|
const FLAGS_TO_FIELDS = {
|
|
@@ -31,7 +31,7 @@ const FLAGS_TO_FIELDS = {
|
|
|
31
31
|
'SkipSelf': 'skipSelf',
|
|
32
32
|
};
|
|
33
33
|
/** Migration that replaces `InjectFlags` usages with object literals. */
|
|
34
|
-
class InjectFlagsMigration extends
|
|
34
|
+
class InjectFlagsMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
35
35
|
async analyze(info) {
|
|
36
36
|
const locations = {};
|
|
37
37
|
const importRemovals = {};
|
|
@@ -40,7 +40,7 @@ class InjectFlagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
40
40
|
if (specifier === null) {
|
|
41
41
|
continue;
|
|
42
42
|
}
|
|
43
|
-
const file =
|
|
43
|
+
const file = run_in_devkit.projectFile(sourceFile, info);
|
|
44
44
|
const importManager = new checker.ImportManager();
|
|
45
45
|
const importReplacements = [];
|
|
46
46
|
// Always remove the `InjectFlags` since it has been removed from Angular.
|
|
@@ -72,7 +72,7 @@ class InjectFlagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
return
|
|
75
|
+
return run_in_devkit.confirmAsSerializable({ locations, importRemovals });
|
|
76
76
|
}
|
|
77
77
|
async migrate(globalData) {
|
|
78
78
|
const replacements = [];
|
|
@@ -83,12 +83,12 @@ class InjectFlagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
83
83
|
// Declare a property for each flag, except for `default` which does not have a flag.
|
|
84
84
|
const properties = flags.filter((flag) => flag !== 'default').map((flag) => `${flag}: true`);
|
|
85
85
|
const toInsert = properties.length ? `{ ${properties.join(', ')} }` : '{}';
|
|
86
|
-
replacements.push(new
|
|
86
|
+
replacements.push(new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({ position, end, toInsert })));
|
|
87
87
|
}
|
|
88
|
-
return
|
|
88
|
+
return run_in_devkit.confirmAsSerializable({ replacements });
|
|
89
89
|
}
|
|
90
90
|
async combine(unitA, unitB) {
|
|
91
|
-
return
|
|
91
|
+
return run_in_devkit.confirmAsSerializable({
|
|
92
92
|
locations: {
|
|
93
93
|
...unitA.locations,
|
|
94
94
|
...unitB.locations,
|
|
@@ -100,7 +100,7 @@ class InjectFlagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
async globalMeta(combinedData) {
|
|
103
|
-
return
|
|
103
|
+
return run_in_devkit.confirmAsSerializable(combinedData);
|
|
104
104
|
}
|
|
105
105
|
async stats() {
|
|
106
106
|
return { counters: {} };
|
|
@@ -137,44 +137,10 @@ function getInjectFlagsRootExpression(start) {
|
|
|
137
137
|
|
|
138
138
|
function migrate() {
|
|
139
139
|
return async (tree) => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
const fs = new project_paths.DevkitMigrationFilesystem(tree);
|
|
145
|
-
checker.setFileSystem(fs);
|
|
146
|
-
const migration = new InjectFlagsMigration();
|
|
147
|
-
const unitResults = [];
|
|
148
|
-
const programInfos = [...buildPaths, ...testPaths].map((tsconfigPath) => {
|
|
149
|
-
const baseInfo = migration.createProgram(tsconfigPath, fs);
|
|
150
|
-
const info = migration.prepareProgram(baseInfo);
|
|
151
|
-
return { info, tsconfigPath };
|
|
140
|
+
await run_in_devkit.runMigrationInDevkit({
|
|
141
|
+
tree,
|
|
142
|
+
getMigration: () => new InjectFlagsMigration(),
|
|
152
143
|
});
|
|
153
|
-
for (const { info } of programInfos) {
|
|
154
|
-
unitResults.push(await migration.analyze(info));
|
|
155
|
-
}
|
|
156
|
-
const combined = await project_paths.synchronouslyCombineUnitData(migration, unitResults);
|
|
157
|
-
if (combined === null) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
const globalMeta = await migration.globalMeta(combined);
|
|
161
|
-
const replacementsPerFile = new Map();
|
|
162
|
-
const { replacements } = await migration.migrate(globalMeta);
|
|
163
|
-
const changesPerFile = project_paths.groupReplacementsByFile(replacements);
|
|
164
|
-
for (const [file, changes] of changesPerFile) {
|
|
165
|
-
if (!replacementsPerFile.has(file)) {
|
|
166
|
-
replacementsPerFile.set(file, changes);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
for (const [file, changes] of replacementsPerFile) {
|
|
170
|
-
const recorder = tree.beginUpdate(file);
|
|
171
|
-
for (const c of changes) {
|
|
172
|
-
recorder
|
|
173
|
-
.remove(c.data.position, c.data.end - c.data.position)
|
|
174
|
-
.insertRight(c.data.position, c.data.toInsert);
|
|
175
|
-
}
|
|
176
|
-
tree.commitUpdate(recorder);
|
|
177
|
-
}
|
|
178
144
|
};
|
|
179
145
|
}
|
|
180
146
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.3
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
10
|
var p = require('path');
|
|
11
|
-
var compiler_host = require('./compiler_host-
|
|
11
|
+
var compiler_host = require('./compiler_host-Bk3repE2.js');
|
|
12
12
|
var ts = require('typescript');
|
|
13
13
|
var ng_decorators = require('./ng_decorators-DznZ5jMl.js');
|
|
14
14
|
var imports = require('./imports-CIX-JgAN.js');
|
|
15
15
|
var nodes = require('./nodes-B16H9JUd.js');
|
|
16
16
|
var leading_space = require('./leading_space-D9nQ8UQC.js');
|
|
17
|
-
require('./checker-
|
|
17
|
+
require('./checker-BHb19MHt.js');
|
|
18
18
|
require('os');
|
|
19
19
|
require('fs');
|
|
20
20
|
require('module');
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.3
|
|
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-BHb19MHt.js');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
require('os');
|
|
12
12
|
var assert = require('assert');
|
|
13
|
-
var index = require('./index-
|
|
14
|
-
var
|
|
13
|
+
var index = require('./index-BL9kAIe5.js');
|
|
14
|
+
var run_in_devkit = require('./run_in_devkit-C0JPtK2u.js');
|
|
15
15
|
var leading_space = require('./leading_space-D9nQ8UQC.js');
|
|
16
|
-
require('./
|
|
16
|
+
require('./index-I8VbxQcO.js');
|
|
17
17
|
require('path');
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -912,7 +912,7 @@ function removeFromUnionIfPossible(union, filter) {
|
|
|
912
912
|
*/
|
|
913
913
|
function insertPrecedingLine(node, info, text) {
|
|
914
914
|
const leadingSpace = leading_space.getLeadingLineWhitespaceOfNode(node);
|
|
915
|
-
return new
|
|
915
|
+
return new run_in_devkit.Replacement(run_in_devkit.projectFile(node.getSourceFile(), info), new run_in_devkit.TextUpdate({
|
|
916
916
|
position: node.getStart(),
|
|
917
917
|
end: node.getStart(),
|
|
918
918
|
toInsert: `${text}\n${leadingSpace}`,
|
|
@@ -1253,20 +1253,20 @@ function createNewBlockToInsertVariable(node, file, toInsert) {
|
|
|
1253
1253
|
const contentSpace = ' '.repeat(character + 2);
|
|
1254
1254
|
return [
|
|
1255
1255
|
// Delete leading whitespace of the concise body.
|
|
1256
|
-
new
|
|
1256
|
+
new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
1257
1257
|
position: node.body.getFullStart(),
|
|
1258
1258
|
end: node.body.getStart(),
|
|
1259
1259
|
toInsert: '',
|
|
1260
1260
|
})),
|
|
1261
1261
|
// Insert leading block braces, and `toInsert` content.
|
|
1262
1262
|
// Wrap the previous expression in a return now.
|
|
1263
|
-
new
|
|
1263
|
+
new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
1264
1264
|
position: node.body.getStart(),
|
|
1265
1265
|
end: node.body.getStart(),
|
|
1266
1266
|
toInsert: ` {\n${contentSpace}${toInsert}\n${contentSpace}return `,
|
|
1267
1267
|
})),
|
|
1268
1268
|
// Add trailing brace.
|
|
1269
|
-
new
|
|
1269
|
+
new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
1270
1270
|
position: node.body.getEnd(),
|
|
1271
1271
|
end: node.body.getEnd(),
|
|
1272
1272
|
toInsert: `;\n${blockSpace}}`,
|
|
@@ -1296,7 +1296,7 @@ function migrateBindingElementInputReference(tsReferencesInBindingElements, info
|
|
|
1296
1296
|
const bindingElement = reference.parent;
|
|
1297
1297
|
const bindingDecl = index.getBindingElementDeclaration(bindingElement);
|
|
1298
1298
|
const sourceFile = bindingElement.getSourceFile();
|
|
1299
|
-
const file =
|
|
1299
|
+
const file = run_in_devkit.projectFile(sourceFile, info);
|
|
1300
1300
|
const inputFieldName = bindingElement.propertyName ?? bindingElement.name;
|
|
1301
1301
|
assert(!ts.isObjectBindingPattern(inputFieldName) && !ts.isArrayBindingPattern(inputFieldName), 'Property of binding element cannot be another pattern.');
|
|
1302
1302
|
const tmpName = nameGenerator.generate(reference.text, bindingElement);
|
|
@@ -1314,7 +1314,7 @@ function migrateBindingElementInputReference(tsReferencesInBindingElements, info
|
|
|
1314
1314
|
console.error(`Could not migrate reference ${reference.text} in ${file.rootRelativePath}`);
|
|
1315
1315
|
continue;
|
|
1316
1316
|
}
|
|
1317
|
-
replacements.push(new
|
|
1317
|
+
replacements.push(new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
1318
1318
|
position: bindingElement.getStart(),
|
|
1319
1319
|
end: bindingElement.getEnd(),
|
|
1320
1320
|
toInsert: printer.printNode(ts.EmitHint.Unspecified, newBindingToAccessInputField, sourceFile),
|
|
@@ -1339,7 +1339,7 @@ function insertTemporaryVariableForBindingElement(expansionDecl, file, toInsert)
|
|
|
1339
1339
|
const leadingSpace = ' '.repeat(leadingSpaceCount);
|
|
1340
1340
|
const statement = parent.parent;
|
|
1341
1341
|
return [
|
|
1342
|
-
new
|
|
1342
|
+
new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
1343
1343
|
position: statement.getEnd(),
|
|
1344
1344
|
end: statement.getEnd(),
|
|
1345
1345
|
toInsert: `\n${leadingSpace}${toInsert}`,
|
|
@@ -1357,7 +1357,7 @@ function insertTemporaryVariableForBindingElement(expansionDecl, file, toInsert)
|
|
|
1357
1357
|
const leadingSpaceCount = ts.getLineAndCharacterOfPosition(sf, spaceReferenceNode.getStart()).character + spaceOffset;
|
|
1358
1358
|
const leadingSpace = ' '.repeat(leadingSpaceCount);
|
|
1359
1359
|
return [
|
|
1360
|
-
new
|
|
1360
|
+
new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
1361
1361
|
position: bodyBlock.getStart() + 1,
|
|
1362
1362
|
end: bodyBlock.getStart() + 1,
|
|
1363
1363
|
toInsert: `\n${leadingSpace}${toInsert}`,
|
|
@@ -1758,7 +1758,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1758
1758
|
// Unwrap the signal directly.
|
|
1759
1759
|
if (recommendedNode === 'preserve') {
|
|
1760
1760
|
// Append `()` to unwrap the signal.
|
|
1761
|
-
replacements.push(new
|
|
1761
|
+
replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(sf, info), new run_in_devkit.TextUpdate({
|
|
1762
1762
|
position: originalNode.getEnd(),
|
|
1763
1763
|
end: originalNode.getEnd(),
|
|
1764
1764
|
toInsert: '()',
|
|
@@ -1772,7 +1772,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1772
1772
|
const toInsert = idToSharedField.get(recommendedNode);
|
|
1773
1773
|
const replaceNode = index.traverseAccess(originalNode);
|
|
1774
1774
|
assert(toInsert, 'no shared variable yet available');
|
|
1775
|
-
replacements.push(new
|
|
1775
|
+
replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(sf, info), new run_in_devkit.TextUpdate({
|
|
1776
1776
|
position: replaceNode.getStart(),
|
|
1777
1777
|
end: replaceNode.getEnd(),
|
|
1778
1778
|
toInsert,
|
|
@@ -1792,7 +1792,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1792
1792
|
parent = parent.parent;
|
|
1793
1793
|
}
|
|
1794
1794
|
const replaceNode = index.traverseAccess(originalNode);
|
|
1795
|
-
const filePath =
|
|
1795
|
+
const filePath = run_in_devkit.projectFile(sf, info);
|
|
1796
1796
|
const initializer = `${replaceNode.getText()}()`;
|
|
1797
1797
|
const fieldName = nameGenerator.generate(originalNode.text, referenceNodeInBlock);
|
|
1798
1798
|
let sharedValueAccessExpr;
|
|
@@ -1814,13 +1814,13 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1814
1814
|
}
|
|
1815
1815
|
else {
|
|
1816
1816
|
const leadingSpace = ts.getLineAndCharacterOfPosition(sf, referenceNodeInBlock.getStart());
|
|
1817
|
-
replacements.push(new
|
|
1817
|
+
replacements.push(new run_in_devkit.Replacement(filePath, new run_in_devkit.TextUpdate({
|
|
1818
1818
|
position: referenceNodeInBlock.getStart(),
|
|
1819
1819
|
end: referenceNodeInBlock.getStart(),
|
|
1820
1820
|
toInsert: `${temporaryVariableStr}\n${' '.repeat(leadingSpace.character)}`,
|
|
1821
1821
|
})));
|
|
1822
1822
|
}
|
|
1823
|
-
replacements.push(new
|
|
1823
|
+
replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(sf, info), new run_in_devkit.TextUpdate({
|
|
1824
1824
|
position: replaceNode.getStart(),
|
|
1825
1825
|
end: replaceNode.getEnd(),
|
|
1826
1826
|
toInsert: sharedValueAccessExpr,
|
|
@@ -1929,12 +1929,12 @@ function migrateTypeScriptTypeReferences(host, references, importManager, info)
|
|
|
1929
1929
|
exportSymbolName: 'UnwrapSignalInputs',
|
|
1930
1930
|
requestedFile: sf,
|
|
1931
1931
|
});
|
|
1932
|
-
host.replacements.push(new
|
|
1932
|
+
host.replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(sf, info), new run_in_devkit.TextUpdate({
|
|
1933
1933
|
position: firstArg.getStart(),
|
|
1934
1934
|
end: firstArg.getStart(),
|
|
1935
1935
|
toInsert: `${host.printer.printNode(ts.EmitHint.Unspecified, unwrapImportExpr, sf)}<`,
|
|
1936
1936
|
})));
|
|
1937
|
-
host.replacements.push(new
|
|
1937
|
+
host.replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(sf, info), new run_in_devkit.TextUpdate({ position: firstArg.getEnd(), end: firstArg.getEnd(), toInsert: '>' })));
|
|
1938
1938
|
}
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.3
|
|
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-Jtbi76Bs.js');
|
|
12
|
-
require('os');
|
|
13
9
|
var ts = require('typescript');
|
|
14
|
-
|
|
15
|
-
var
|
|
10
|
+
require('os');
|
|
11
|
+
var checker = require('./checker-BHb19MHt.js');
|
|
12
|
+
var index$1 = require('./index-I8VbxQcO.js');
|
|
16
13
|
require('path');
|
|
17
|
-
var
|
|
18
|
-
var
|
|
14
|
+
var run_in_devkit = require('./run_in_devkit-C0JPtK2u.js');
|
|
15
|
+
var apply_import_manager = require('./apply_import_manager-BXQEjo09.js');
|
|
16
|
+
var index = require('./index-BL9kAIe5.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 &&
|
|
@@ -90,7 +90,7 @@ function getOutputDecorator(node, reflector) {
|
|
|
90
90
|
// THINK: this utility + type is not specific to @Output, really, maybe move it to tsurge?
|
|
91
91
|
/** Computes an unique ID for a given Angular `@Output` property. */
|
|
92
92
|
function getUniqueIdForProperty(info, prop) {
|
|
93
|
-
const { id } =
|
|
93
|
+
const { id } = run_in_devkit.projectFile(prop.getSourceFile(), info);
|
|
94
94
|
id.replace(/\.d\.ts$/, '.ts');
|
|
95
95
|
return `${id}@@${prop.parent.name ?? 'unknown-class'}@@${prop.name.getText()}`;
|
|
96
96
|
}
|
|
@@ -169,7 +169,7 @@ function calculateImportReplacements(info, sourceFiles) {
|
|
|
169
169
|
const importManager = new checker.ImportManager();
|
|
170
170
|
const addOnly = [];
|
|
171
171
|
const addRemove = [];
|
|
172
|
-
const file =
|
|
172
|
+
const file = run_in_devkit.projectFile(sf, info);
|
|
173
173
|
importManager.addImport({
|
|
174
174
|
requestedFile: sf,
|
|
175
175
|
exportModuleSpecifier: '@angular/core',
|
|
@@ -225,36 +225,36 @@ function calculatePipeCallReplacement(info, node) {
|
|
|
225
225
|
}
|
|
226
226
|
function prepareTextReplacementForNode(info, node, replacement, start) {
|
|
227
227
|
const sf = node.getSourceFile();
|
|
228
|
-
return new
|
|
228
|
+
return new run_in_devkit.Replacement(run_in_devkit.projectFile(sf, info), new run_in_devkit.TextUpdate({
|
|
229
229
|
position: start ?? node.getStart(),
|
|
230
230
|
end: node.getEnd(),
|
|
231
231
|
toInsert: replacement,
|
|
232
232
|
}));
|
|
233
233
|
}
|
|
234
234
|
function prepareTextReplacement(file, replacement, start, end) {
|
|
235
|
-
return new
|
|
235
|
+
return new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
236
236
|
position: start,
|
|
237
237
|
end: end,
|
|
238
238
|
toInsert: replacement,
|
|
239
239
|
}));
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
class OutputMigration extends
|
|
242
|
+
class OutputMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
243
243
|
config;
|
|
244
244
|
constructor(config = {}) {
|
|
245
245
|
super();
|
|
246
246
|
this.config = config;
|
|
247
247
|
}
|
|
248
248
|
async analyze(info) {
|
|
249
|
-
const { sourceFiles, program
|
|
249
|
+
const { sourceFiles, program } = info;
|
|
250
250
|
const outputFieldReplacements = {};
|
|
251
251
|
const problematicUsages = {};
|
|
252
252
|
let problematicDeclarationCount = 0;
|
|
253
253
|
const filesWithOutputDeclarations = new Set();
|
|
254
|
-
const checker$1 = program
|
|
254
|
+
const checker$1 = program.getTypeChecker();
|
|
255
255
|
const reflector = new checker.TypeScriptReflectionHost(checker$1);
|
|
256
|
-
const dtsReader = new
|
|
257
|
-
const evaluator = new
|
|
256
|
+
const dtsReader = new index$1.DtsMetadataReader(checker$1, reflector);
|
|
257
|
+
const evaluator = new index$1.PartialEvaluator(reflector, checker$1, null);
|
|
258
258
|
const resourceLoader = info.ngCompiler?.['resourceManager'] ?? null;
|
|
259
259
|
// Pre-analyze the program and get access to the template type checker.
|
|
260
260
|
// If we are processing a non-Angular target, there is no template info.
|
|
@@ -290,7 +290,7 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
290
290
|
id: getUniqueIdForProperty(info, node),
|
|
291
291
|
aliasParam: outputDecorator.args?.at(0),
|
|
292
292
|
};
|
|
293
|
-
const outputFile =
|
|
293
|
+
const outputFile = run_in_devkit.projectFile(node.getSourceFile(), info);
|
|
294
294
|
if (this.config.shouldMigrate === undefined ||
|
|
295
295
|
this.config.shouldMigrate({
|
|
296
296
|
key: outputDef.id,
|
|
@@ -318,7 +318,7 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
318
318
|
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker$1, reflector, dtsReader);
|
|
319
319
|
if (propertyDeclaration !== null) {
|
|
320
320
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
321
|
-
const outputFile =
|
|
321
|
+
const outputFile = run_in_devkit.projectFile(node.getSourceFile(), info);
|
|
322
322
|
addOutputReplacement(outputFieldReplacements, id, outputFile, calculateNextFnReplacement(info, node.expression.name));
|
|
323
323
|
}
|
|
324
324
|
}
|
|
@@ -327,7 +327,7 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
327
327
|
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker$1, reflector, dtsReader);
|
|
328
328
|
if (propertyDeclaration !== null) {
|
|
329
329
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
330
|
-
const outputFile =
|
|
330
|
+
const outputFile = run_in_devkit.projectFile(node.getSourceFile(), info);
|
|
331
331
|
if (ts.isExpressionStatement(node.parent)) {
|
|
332
332
|
addOutputReplacement(outputFieldReplacements, id, outputFile, calculateCompleteCallReplacement(info, node.parent));
|
|
333
333
|
}
|
|
@@ -346,7 +346,7 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
346
346
|
if (propertyDeclaration !== null) {
|
|
347
347
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
348
348
|
if (isTestFile) {
|
|
349
|
-
const outputFile =
|
|
349
|
+
const outputFile = run_in_devkit.projectFile(node.getSourceFile(), info);
|
|
350
350
|
addOutputReplacement(outputFieldReplacements, id, outputFile, ...calculatePipeCallReplacement(info, node));
|
|
351
351
|
}
|
|
352
352
|
else {
|
|
@@ -390,7 +390,7 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
390
390
|
}
|
|
391
391
|
// calculate import replacements but do so only for files that have output declarations
|
|
392
392
|
const importReplacements = calculateImportReplacements(info, filesWithOutputDeclarations);
|
|
393
|
-
return
|
|
393
|
+
return run_in_devkit.confirmAsSerializable({
|
|
394
394
|
problematicDeclarationCount,
|
|
395
395
|
outputFields: outputFieldReplacements,
|
|
396
396
|
importReplacements,
|
|
@@ -420,7 +420,7 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
420
420
|
problematicUsages[declId] = unit.problematicUsages[declId];
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
return
|
|
423
|
+
return run_in_devkit.confirmAsSerializable({
|
|
424
424
|
problematicDeclarationCount,
|
|
425
425
|
outputFields,
|
|
426
426
|
importReplacements,
|
|
@@ -442,7 +442,7 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
// Noop here as we don't have any form of special global metadata.
|
|
445
|
-
return
|
|
445
|
+
return run_in_devkit.confirmAsSerializable(combinedData);
|
|
446
446
|
}
|
|
447
447
|
async stats(globalMetadata) {
|
|
448
448
|
const detectedOutputs = new Set(Object.keys(globalMetadata.outputFields)).size +
|
|
@@ -501,73 +501,45 @@ function addOutputReplacement(outputFieldReplacements, outputId, file, ...replac
|
|
|
501
501
|
|
|
502
502
|
function migrate(options) {
|
|
503
503
|
return async (tree, context) => {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
504
|
+
await run_in_devkit.runMigrationInDevkit({
|
|
505
|
+
tree,
|
|
506
|
+
getMigration: (fs) => new OutputMigration({
|
|
507
|
+
shouldMigrate: (_, file) => {
|
|
508
|
+
return (file.rootRelativePath.startsWith(fs.normalize(options.path)) &&
|
|
509
|
+
!/(^|\/)node_modules\//.test(file.rootRelativePath));
|
|
510
|
+
},
|
|
511
|
+
}),
|
|
512
|
+
beforeProgramCreation: (tsconfigPath) => {
|
|
513
|
+
context.logger.info(`Preparing analysis for: ${tsconfigPath}...`);
|
|
514
514
|
},
|
|
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);
|
|
515
|
+
afterProgramCreation: (info, fs) => {
|
|
516
|
+
const analysisPath = fs.resolve(options.analysisDir);
|
|
517
|
+
// Support restricting the analysis to subfolders for larger projects.
|
|
518
|
+
if (analysisPath !== '/') {
|
|
519
|
+
info.sourceFiles = info.sourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
520
|
+
info.fullProgramSourceFiles = info.fullProgramSourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
552
521
|
}
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
522
|
+
},
|
|
523
|
+
beforeUnitAnalysis: (tsconfigPath) => {
|
|
524
|
+
context.logger.info(`Scanning for outputs: ${tsconfigPath}...`);
|
|
525
|
+
},
|
|
526
|
+
afterAllAnalyzed: () => {
|
|
527
|
+
context.logger.info(``);
|
|
528
|
+
context.logger.info(`Processing analysis data between targets...`);
|
|
529
|
+
context.logger.info(``);
|
|
530
|
+
},
|
|
531
|
+
afterAnalysisFailure: () => {
|
|
532
|
+
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
533
|
+
},
|
|
534
|
+
whenDone: ({ counters }) => {
|
|
535
|
+
const { detectedOutputs, problematicOutputs, successRate } = counters;
|
|
536
|
+
const migratedOutputs = detectedOutputs - problematicOutputs;
|
|
537
|
+
const successRatePercent = (successRate * 100).toFixed(2);
|
|
538
|
+
context.logger.info('');
|
|
539
|
+
context.logger.info(`Successfully migrated to outputs as functions 🎉`);
|
|
540
|
+
context.logger.info(` -> Migrated ${migratedOutputs} out of ${detectedOutputs} detected outputs (${successRatePercent} %).`);
|
|
541
|
+
},
|
|
542
|
+
});
|
|
571
543
|
};
|
|
572
544
|
}
|
|
573
545
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.3
|
|
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-Bk3repE2.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-BHb19MHt.js');
|
|
16
16
|
var property_name = require('./property_name-BBwFuqMe.js');
|
|
17
17
|
require('os');
|
|
18
18
|
require('@angular-devkit/core');
|