@angular/core 20.0.0-next.5 → 20.0.0-next.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/{api.d-mxcXqDpA.d.ts → api.d-DQLNOR5l.d.ts} +4 -4
- package/{discovery.d-CyYpOJ7j.d.ts → discovery.d-CFs2MaLO.d.ts} +7 -17
- package/{event_dispatcher.d-PWnbqZDx.d.ts → event_dispatcher.d-DlbccpYq.d.ts} +3 -3
- package/fesm2022/{attribute-B17mgaqe.mjs → attribute-BWp59EjE.mjs} +3 -3
- package/fesm2022/{attribute-B17mgaqe.mjs.map → attribute-BWp59EjE.mjs.map} +1 -1
- package/fesm2022/core.mjs +20 -18
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/{debug_node-xKpCIZm-.mjs → debug_node-z_3NG8qT.mjs} +77 -68
- package/fesm2022/{debug_node-xKpCIZm-.mjs.map → debug_node-z_3NG8qT.mjs.map} +1 -1
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +2 -2
- package/fesm2022/primitives/signals.mjs +5 -5
- package/fesm2022/{resource-BPpYEDic.mjs → resource-CPPwEcg7.mjs} +6 -8
- package/fesm2022/resource-CPPwEcg7.mjs.map +1 -0
- package/fesm2022/{root_effect_scheduler-D0_b1cf_.mjs → root_effect_scheduler-VSXfCzDX.mjs} +46 -15
- package/fesm2022/root_effect_scheduler-VSXfCzDX.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +7 -84
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/{signal-DhRAAi7R.mjs → signal-B6pMq7KS.mjs} +3 -3
- package/fesm2022/{signal-DhRAAi7R.mjs.map → signal-B6pMq7KS.mjs.map} +1 -1
- package/fesm2022/testing.mjs +165 -103
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/{untracked-DaaW3JJm.mjs → untracked-Bz5WMeU1.mjs} +4 -4
- package/fesm2022/{untracked-DaaW3JJm.mjs.map → untracked-Bz5WMeU1.mjs.map} +1 -1
- package/fesm2022/{weak_ref-DrMdAIDh.mjs → weak_ref-BaIq-pgY.mjs} +3 -3
- package/fesm2022/{weak_ref-DrMdAIDh.mjs.map → weak_ref-BaIq-pgY.mjs.map} +1 -1
- package/{graph.d-StYigYp1.d.ts → graph.d-BcIOep_B.d.ts} +3 -3
- package/index.d.ts +18 -20
- package/{ng_i18n_closure_mode.d-DLxSUiDr.d.ts → ng_i18n_closure_mode.d-C9d2CaSt.d.ts} +5 -5
- package/package.json +2 -2
- package/primitives/di/index.d.ts +1 -1
- package/primitives/event-dispatch/index.d.ts +3 -3
- package/primitives/signals/index.d.ts +6 -6
- package/rxjs-interop/index.d.ts +8 -17
- package/schematics/bundles/{apply_import_manager-C-ysxahq.js → apply_import_manager-DnMqg1pY.js} +6 -6
- package/schematics/bundles/{change_tracker-0Ktek5Xl.js → change_tracker-UMPkv-eH.js} +3 -3
- package/schematics/bundles/{checker-DqUKCGda.js → checker-BFBQyesT.js} +20 -3
- package/schematics/bundles/cleanup-unused-imports.js +25 -20
- package/schematics/bundles/{compiler-CuoiHqkc.js → compiler-BQ7R7w2v.js} +962 -297
- package/schematics/bundles/compiler_host-CAfDJO3W.js +1 -1
- package/schematics/bundles/control-flow-migration.js +2 -2
- package/schematics/bundles/document-core.js +12 -12
- package/schematics/bundles/imports-CIX-JgAN.js +1 -1
- package/schematics/bundles/{index-WFXCe5Q0.js → index-Cv4Q415G.js} +127 -36
- package/schematics/bundles/{index-CwFQSYXZ.js → index-D8tMJPKa.js} +10 -10
- package/schematics/bundles/inject-flags.js +14 -14
- package/schematics/bundles/inject-migration.js +4 -4
- package/schematics/bundles/leading_space-D9nQ8UQC.js +1 -1
- package/schematics/bundles/{migrate_ts_type_references-BNuHufqZ.js → migrate_ts_type_references-Cq_ZBuT4.js} +21 -21
- package/schematics/bundles/ng_decorators-DznZ5jMl.js +1 -1
- package/schematics/bundles/nodes-B16H9JUd.js +1 -1
- package/schematics/bundles/output-migration.js +80 -22
- package/schematics/bundles/{run_in_devkit-CmHxABFr.js → project_paths-ql6qcf_c.js} +254 -244
- 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 +4 -4
- package/schematics/bundles/self-closing-tags-migration.js +20 -15
- package/schematics/bundles/signal-input-migration.js +26 -21
- package/schematics/bundles/signal-queries-migration.js +32 -27
- package/schematics/bundles/signals.js +8 -8
- package/schematics/bundles/standalone-migration.js +5 -5
- package/schematics/bundles/symbol-VPWguRxr.js +1 -1
- package/schematics/bundles/test-bed-get.js +13 -13
- package/{signal.d-BeaTIeOE.d.ts → signal.d-E0e5nW1p.d.ts} +4 -4
- package/testing/index.d.ts +9 -25
- package/{weak_ref.d-ttyj86RV.d.ts → weak_ref.d-eGOEP9S1.d.ts} +2 -2
- package/fesm2022/resource-BPpYEDic.mjs.map +0 -1
- package/fesm2022/root_effect_scheduler-D0_b1cf_.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var checker = require('./checker-
|
|
12
|
-
require('./compiler-
|
|
13
|
-
require('./index-
|
|
11
|
+
var checker = require('./checker-BFBQyesT.js');
|
|
12
|
+
require('./compiler-BQ7R7w2v.js');
|
|
13
|
+
require('./index-Cv4Q415G.js');
|
|
14
14
|
require('path');
|
|
15
|
-
var
|
|
16
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
15
|
+
var project_paths = require('./project_paths-ql6qcf_c.js');
|
|
16
|
+
var apply_import_manager = require('./apply_import_manager-DnMqg1pY.js');
|
|
17
17
|
var imports = require('./imports-CIX-JgAN.js');
|
|
18
18
|
require('@angular-devkit/core');
|
|
19
19
|
require('node:path/posix');
|
|
@@ -32,7 +32,7 @@ const FLAGS_TO_FIELDS = {
|
|
|
32
32
|
'SkipSelf': 'skipSelf',
|
|
33
33
|
};
|
|
34
34
|
/** Migration that replaces `InjectFlags` usages with object literals. */
|
|
35
|
-
class InjectFlagsMigration extends
|
|
35
|
+
class InjectFlagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
36
36
|
async analyze(info) {
|
|
37
37
|
const locations = {};
|
|
38
38
|
const importRemovals = {};
|
|
@@ -41,7 +41,7 @@ class InjectFlagsMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
41
41
|
if (specifier === null) {
|
|
42
42
|
continue;
|
|
43
43
|
}
|
|
44
|
-
const file =
|
|
44
|
+
const file = project_paths.projectFile(sourceFile, info);
|
|
45
45
|
const importManager = new checker.ImportManager();
|
|
46
46
|
const importReplacements = [];
|
|
47
47
|
// Always remove the `InjectFlags` since it has been removed from Angular.
|
|
@@ -73,7 +73,7 @@ class InjectFlagsMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
return
|
|
76
|
+
return project_paths.confirmAsSerializable({ locations, importRemovals });
|
|
77
77
|
}
|
|
78
78
|
async migrate(globalData) {
|
|
79
79
|
const replacements = [];
|
|
@@ -84,12 +84,12 @@ class InjectFlagsMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
84
84
|
// Declare a property for each flag, except for `default` which does not have a flag.
|
|
85
85
|
const properties = flags.filter((flag) => flag !== 'default').map((flag) => `${flag}: true`);
|
|
86
86
|
const toInsert = properties.length ? `{ ${properties.join(', ')} }` : '{}';
|
|
87
|
-
replacements.push(new
|
|
87
|
+
replacements.push(new project_paths.Replacement(file, new project_paths.TextUpdate({ position, end, toInsert })));
|
|
88
88
|
}
|
|
89
|
-
return
|
|
89
|
+
return project_paths.confirmAsSerializable({ replacements });
|
|
90
90
|
}
|
|
91
91
|
async combine(unitA, unitB) {
|
|
92
|
-
return
|
|
92
|
+
return project_paths.confirmAsSerializable({
|
|
93
93
|
locations: {
|
|
94
94
|
...unitA.locations,
|
|
95
95
|
...unitB.locations,
|
|
@@ -101,7 +101,7 @@ class InjectFlagsMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
async globalMeta(combinedData) {
|
|
104
|
-
return
|
|
104
|
+
return project_paths.confirmAsSerializable(combinedData);
|
|
105
105
|
}
|
|
106
106
|
async stats() {
|
|
107
107
|
return { counters: {} };
|
|
@@ -138,7 +138,7 @@ function getInjectFlagsRootExpression(start) {
|
|
|
138
138
|
|
|
139
139
|
function migrate() {
|
|
140
140
|
return async (tree) => {
|
|
141
|
-
await
|
|
141
|
+
await project_paths.runMigrationInDevkit({
|
|
142
142
|
tree,
|
|
143
143
|
getMigration: () => new InjectFlagsMigration(),
|
|
144
144
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
10
|
var p = require('path');
|
|
11
|
-
var change_tracker = require('./change_tracker-
|
|
11
|
+
var change_tracker = require('./change_tracker-UMPkv-eH.js');
|
|
12
12
|
var compiler_host = require('./compiler_host-CAfDJO3W.js');
|
|
13
13
|
var ts = require('typescript');
|
|
14
14
|
var ng_decorators = require('./ng_decorators-DznZ5jMl.js');
|
|
15
15
|
var imports = require('./imports-CIX-JgAN.js');
|
|
16
16
|
var nodes = require('./nodes-B16H9JUd.js');
|
|
17
17
|
var leading_space = require('./leading_space-D9nQ8UQC.js');
|
|
18
|
-
require('./compiler-
|
|
19
|
-
require('./checker-
|
|
18
|
+
require('./compiler-BQ7R7w2v.js');
|
|
19
|
+
require('./checker-BFBQyesT.js');
|
|
20
20
|
require('os');
|
|
21
21
|
require('fs');
|
|
22
22
|
require('module');
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
require('./compiler-
|
|
9
|
+
require('./compiler-BQ7R7w2v.js');
|
|
10
10
|
var ts = require('typescript');
|
|
11
|
-
var checker = require('./checker-
|
|
11
|
+
var checker = require('./checker-BFBQyesT.js');
|
|
12
12
|
require('os');
|
|
13
13
|
var assert = require('assert');
|
|
14
|
-
var index = require('./index-
|
|
15
|
-
var
|
|
14
|
+
var index = require('./index-D8tMJPKa.js');
|
|
15
|
+
var project_paths = require('./project_paths-ql6qcf_c.js');
|
|
16
16
|
var leading_space = require('./leading_space-D9nQ8UQC.js');
|
|
17
|
-
require('./index-
|
|
17
|
+
require('./index-Cv4Q415G.js');
|
|
18
18
|
require('path');
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -913,7 +913,7 @@ function removeFromUnionIfPossible(union, filter) {
|
|
|
913
913
|
*/
|
|
914
914
|
function insertPrecedingLine(node, info, text) {
|
|
915
915
|
const leadingSpace = leading_space.getLeadingLineWhitespaceOfNode(node);
|
|
916
|
-
return new
|
|
916
|
+
return new project_paths.Replacement(project_paths.projectFile(node.getSourceFile(), info), new project_paths.TextUpdate({
|
|
917
917
|
position: node.getStart(),
|
|
918
918
|
end: node.getStart(),
|
|
919
919
|
toInsert: `${text}\n${leadingSpace}`,
|
|
@@ -1254,20 +1254,20 @@ function createNewBlockToInsertVariable(node, file, toInsert) {
|
|
|
1254
1254
|
const contentSpace = ' '.repeat(character + 2);
|
|
1255
1255
|
return [
|
|
1256
1256
|
// Delete leading whitespace of the concise body.
|
|
1257
|
-
new
|
|
1257
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1258
1258
|
position: node.body.getFullStart(),
|
|
1259
1259
|
end: node.body.getStart(),
|
|
1260
1260
|
toInsert: '',
|
|
1261
1261
|
})),
|
|
1262
1262
|
// Insert leading block braces, and `toInsert` content.
|
|
1263
1263
|
// Wrap the previous expression in a return now.
|
|
1264
|
-
new
|
|
1264
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1265
1265
|
position: node.body.getStart(),
|
|
1266
1266
|
end: node.body.getStart(),
|
|
1267
1267
|
toInsert: ` {\n${contentSpace}${toInsert}\n${contentSpace}return `,
|
|
1268
1268
|
})),
|
|
1269
1269
|
// Add trailing brace.
|
|
1270
|
-
new
|
|
1270
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1271
1271
|
position: node.body.getEnd(),
|
|
1272
1272
|
end: node.body.getEnd(),
|
|
1273
1273
|
toInsert: `;\n${blockSpace}}`,
|
|
@@ -1297,7 +1297,7 @@ function migrateBindingElementInputReference(tsReferencesInBindingElements, info
|
|
|
1297
1297
|
const bindingElement = reference.parent;
|
|
1298
1298
|
const bindingDecl = index.getBindingElementDeclaration(bindingElement);
|
|
1299
1299
|
const sourceFile = bindingElement.getSourceFile();
|
|
1300
|
-
const file =
|
|
1300
|
+
const file = project_paths.projectFile(sourceFile, info);
|
|
1301
1301
|
const inputFieldName = bindingElement.propertyName ?? bindingElement.name;
|
|
1302
1302
|
assert(!ts.isObjectBindingPattern(inputFieldName) && !ts.isArrayBindingPattern(inputFieldName), 'Property of binding element cannot be another pattern.');
|
|
1303
1303
|
const tmpName = nameGenerator.generate(reference.text, bindingElement);
|
|
@@ -1315,7 +1315,7 @@ function migrateBindingElementInputReference(tsReferencesInBindingElements, info
|
|
|
1315
1315
|
console.error(`Could not migrate reference ${reference.text} in ${file.rootRelativePath}`);
|
|
1316
1316
|
continue;
|
|
1317
1317
|
}
|
|
1318
|
-
replacements.push(new
|
|
1318
|
+
replacements.push(new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1319
1319
|
position: bindingElement.getStart(),
|
|
1320
1320
|
end: bindingElement.getEnd(),
|
|
1321
1321
|
toInsert: printer.printNode(ts.EmitHint.Unspecified, newBindingToAccessInputField, sourceFile),
|
|
@@ -1340,7 +1340,7 @@ function insertTemporaryVariableForBindingElement(expansionDecl, file, toInsert)
|
|
|
1340
1340
|
const leadingSpace = ' '.repeat(leadingSpaceCount);
|
|
1341
1341
|
const statement = parent.parent;
|
|
1342
1342
|
return [
|
|
1343
|
-
new
|
|
1343
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1344
1344
|
position: statement.getEnd(),
|
|
1345
1345
|
end: statement.getEnd(),
|
|
1346
1346
|
toInsert: `\n${leadingSpace}${toInsert}`,
|
|
@@ -1358,7 +1358,7 @@ function insertTemporaryVariableForBindingElement(expansionDecl, file, toInsert)
|
|
|
1358
1358
|
const leadingSpaceCount = ts.getLineAndCharacterOfPosition(sf, spaceReferenceNode.getStart()).character + spaceOffset;
|
|
1359
1359
|
const leadingSpace = ' '.repeat(leadingSpaceCount);
|
|
1360
1360
|
return [
|
|
1361
|
-
new
|
|
1361
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1362
1362
|
position: bodyBlock.getStart() + 1,
|
|
1363
1363
|
end: bodyBlock.getStart() + 1,
|
|
1364
1364
|
toInsert: `\n${leadingSpace}${toInsert}`,
|
|
@@ -1759,7 +1759,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1759
1759
|
// Unwrap the signal directly.
|
|
1760
1760
|
if (recommendedNode === 'preserve') {
|
|
1761
1761
|
// Append `()` to unwrap the signal.
|
|
1762
|
-
replacements.push(new
|
|
1762
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1763
1763
|
position: originalNode.getEnd(),
|
|
1764
1764
|
end: originalNode.getEnd(),
|
|
1765
1765
|
toInsert: '()',
|
|
@@ -1773,7 +1773,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1773
1773
|
const toInsert = idToSharedField.get(recommendedNode);
|
|
1774
1774
|
const replaceNode = index.traverseAccess(originalNode);
|
|
1775
1775
|
assert(toInsert, 'no shared variable yet available');
|
|
1776
|
-
replacements.push(new
|
|
1776
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1777
1777
|
position: replaceNode.getStart(),
|
|
1778
1778
|
end: replaceNode.getEnd(),
|
|
1779
1779
|
toInsert,
|
|
@@ -1793,7 +1793,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1793
1793
|
parent = parent.parent;
|
|
1794
1794
|
}
|
|
1795
1795
|
const replaceNode = index.traverseAccess(originalNode);
|
|
1796
|
-
const filePath =
|
|
1796
|
+
const filePath = project_paths.projectFile(sf, info);
|
|
1797
1797
|
const initializer = `${replaceNode.getText()}()`;
|
|
1798
1798
|
const fieldName = nameGenerator.generate(originalNode.text, referenceNodeInBlock);
|
|
1799
1799
|
let sharedValueAccessExpr;
|
|
@@ -1815,13 +1815,13 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1815
1815
|
}
|
|
1816
1816
|
else {
|
|
1817
1817
|
const leadingSpace = ts.getLineAndCharacterOfPosition(sf, referenceNodeInBlock.getStart());
|
|
1818
|
-
replacements.push(new
|
|
1818
|
+
replacements.push(new project_paths.Replacement(filePath, new project_paths.TextUpdate({
|
|
1819
1819
|
position: referenceNodeInBlock.getStart(),
|
|
1820
1820
|
end: referenceNodeInBlock.getStart(),
|
|
1821
1821
|
toInsert: `${temporaryVariableStr}\n${' '.repeat(leadingSpace.character)}`,
|
|
1822
1822
|
})));
|
|
1823
1823
|
}
|
|
1824
|
-
replacements.push(new
|
|
1824
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1825
1825
|
position: replaceNode.getStart(),
|
|
1826
1826
|
end: replaceNode.getEnd(),
|
|
1827
1827
|
toInsert: sharedValueAccessExpr,
|
|
@@ -1930,12 +1930,12 @@ function migrateTypeScriptTypeReferences(host, references, importManager, info)
|
|
|
1930
1930
|
exportSymbolName: 'UnwrapSignalInputs',
|
|
1931
1931
|
requestedFile: sf,
|
|
1932
1932
|
});
|
|
1933
|
-
host.replacements.push(new
|
|
1933
|
+
host.replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1934
1934
|
position: firstArg.getStart(),
|
|
1935
1935
|
end: firstArg.getStart(),
|
|
1936
1936
|
toInsert: `${host.printer.printNode(ts.EmitHint.Unspecified, unwrapImportExpr, sf)}<`,
|
|
1937
1937
|
})));
|
|
1938
|
-
host.replacements.push(new
|
|
1938
|
+
host.replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({ position: firstArg.getEnd(), end: firstArg.getEnd(), toInsert: '>' })));
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
1941
1941
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.6
|
|
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 ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var checker = require('./checker-
|
|
12
|
-
var compiler = require('./compiler-
|
|
13
|
-
var index$1 = require('./index-
|
|
11
|
+
var checker = require('./checker-BFBQyesT.js');
|
|
12
|
+
var compiler = require('./compiler-BQ7R7w2v.js');
|
|
13
|
+
var index$1 = require('./index-Cv4Q415G.js');
|
|
14
14
|
require('path');
|
|
15
|
-
var
|
|
16
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
17
|
-
var index = require('./index-
|
|
15
|
+
var project_paths = require('./project_paths-ql6qcf_c.js');
|
|
16
|
+
var apply_import_manager = require('./apply_import_manager-DnMqg1pY.js');
|
|
17
|
+
var index = require('./index-D8tMJPKa.js');
|
|
18
18
|
require('@angular-devkit/core');
|
|
19
19
|
require('node:path/posix');
|
|
20
20
|
require('fs');
|
|
@@ -91,7 +91,7 @@ function getOutputDecorator(node, reflector) {
|
|
|
91
91
|
// THINK: this utility + type is not specific to @Output, really, maybe move it to tsurge?
|
|
92
92
|
/** Computes an unique ID for a given Angular `@Output` property. */
|
|
93
93
|
function getUniqueIdForProperty(info, prop) {
|
|
94
|
-
const { id } =
|
|
94
|
+
const { id } = project_paths.projectFile(prop.getSourceFile(), info);
|
|
95
95
|
id.replace(/\.d\.ts$/, '.ts');
|
|
96
96
|
return `${id}@@${prop.parent.name ?? 'unknown-class'}@@${prop.name.getText()}`;
|
|
97
97
|
}
|
|
@@ -174,7 +174,7 @@ function calculateImportReplacements(info, sourceFiles) {
|
|
|
174
174
|
const importManager = new checker.ImportManager();
|
|
175
175
|
const addOnly = [];
|
|
176
176
|
const addRemove = [];
|
|
177
|
-
const file =
|
|
177
|
+
const file = project_paths.projectFile(sf, info);
|
|
178
178
|
importManager.addImport({
|
|
179
179
|
requestedFile: sf,
|
|
180
180
|
exportModuleSpecifier: '@angular/core',
|
|
@@ -230,21 +230,21 @@ function calculatePipeCallReplacement(info, node) {
|
|
|
230
230
|
}
|
|
231
231
|
function prepareTextReplacementForNode(info, node, replacement, start) {
|
|
232
232
|
const sf = node.getSourceFile();
|
|
233
|
-
return new
|
|
233
|
+
return new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
234
234
|
position: start ?? node.getStart(),
|
|
235
235
|
end: node.getEnd(),
|
|
236
236
|
toInsert: replacement,
|
|
237
237
|
}));
|
|
238
238
|
}
|
|
239
239
|
function prepareTextReplacement(file, replacement, start, end) {
|
|
240
|
-
return new
|
|
240
|
+
return new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
241
241
|
position: start,
|
|
242
242
|
end: end,
|
|
243
243
|
toInsert: replacement,
|
|
244
244
|
}));
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
class OutputMigration extends
|
|
247
|
+
class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
248
248
|
config;
|
|
249
249
|
constructor(config = {}) {
|
|
250
250
|
super();
|
|
@@ -295,7 +295,7 @@ class OutputMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
295
295
|
id: getUniqueIdForProperty(info, node),
|
|
296
296
|
aliasParam: outputDecorator.args?.at(0),
|
|
297
297
|
};
|
|
298
|
-
const outputFile =
|
|
298
|
+
const outputFile = project_paths.projectFile(node.getSourceFile(), info);
|
|
299
299
|
if (this.config.shouldMigrate === undefined ||
|
|
300
300
|
this.config.shouldMigrate({
|
|
301
301
|
key: outputDef.id,
|
|
@@ -323,7 +323,7 @@ class OutputMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
323
323
|
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker$1, reflector, dtsReader);
|
|
324
324
|
if (propertyDeclaration !== null) {
|
|
325
325
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
326
|
-
const outputFile =
|
|
326
|
+
const outputFile = project_paths.projectFile(node.getSourceFile(), info);
|
|
327
327
|
addOutputReplacement(outputFieldReplacements, id, outputFile, calculateNextFnReplacement(info, node.expression.name));
|
|
328
328
|
}
|
|
329
329
|
}
|
|
@@ -332,7 +332,7 @@ class OutputMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
332
332
|
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker$1, reflector, dtsReader);
|
|
333
333
|
if (propertyDeclaration !== null) {
|
|
334
334
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
335
|
-
const outputFile =
|
|
335
|
+
const outputFile = project_paths.projectFile(node.getSourceFile(), info);
|
|
336
336
|
if (ts.isExpressionStatement(node.parent)) {
|
|
337
337
|
addOutputReplacement(outputFieldReplacements, id, outputFile, calculateCompleteCallReplacement(info, node.parent));
|
|
338
338
|
}
|
|
@@ -341,6 +341,7 @@ class OutputMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
+
addCommentForEmptyEmit(node, info, checker$1, reflector, dtsReader, outputFieldReplacements);
|
|
344
345
|
// detect imports of test runners
|
|
345
346
|
if (isTestRunnerImport(node)) {
|
|
346
347
|
isTestFile = true;
|
|
@@ -351,7 +352,7 @@ class OutputMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
351
352
|
if (propertyDeclaration !== null) {
|
|
352
353
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
353
354
|
if (isTestFile) {
|
|
354
|
-
const outputFile =
|
|
355
|
+
const outputFile = project_paths.projectFile(node.getSourceFile(), info);
|
|
355
356
|
addOutputReplacement(outputFieldReplacements, id, outputFile, ...calculatePipeCallReplacement(info, node));
|
|
356
357
|
}
|
|
357
358
|
else {
|
|
@@ -395,7 +396,7 @@ class OutputMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
395
396
|
}
|
|
396
397
|
// calculate import replacements but do so only for files that have output declarations
|
|
397
398
|
const importReplacements = calculateImportReplacements(info, filesWithOutputDeclarations);
|
|
398
|
-
return
|
|
399
|
+
return project_paths.confirmAsSerializable({
|
|
399
400
|
problematicDeclarationCount,
|
|
400
401
|
outputFields: outputFieldReplacements,
|
|
401
402
|
importReplacements,
|
|
@@ -425,7 +426,7 @@ class OutputMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
425
426
|
problematicUsages[declId] = unit.problematicUsages[declId];
|
|
426
427
|
}
|
|
427
428
|
}
|
|
428
|
-
return
|
|
429
|
+
return project_paths.confirmAsSerializable({
|
|
429
430
|
problematicDeclarationCount,
|
|
430
431
|
outputFields,
|
|
431
432
|
importReplacements,
|
|
@@ -447,7 +448,7 @@ class OutputMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
447
448
|
}
|
|
448
449
|
}
|
|
449
450
|
// Noop here as we don't have any form of special global metadata.
|
|
450
|
-
return
|
|
451
|
+
return project_paths.confirmAsSerializable(combinedData);
|
|
451
452
|
}
|
|
452
453
|
async stats(globalMetadata) {
|
|
453
454
|
const detectedOutputs = new Set(Object.keys(globalMetadata.outputFields)).size +
|
|
@@ -503,10 +504,62 @@ function addOutputReplacement(outputFieldReplacements, outputId, file, ...replac
|
|
|
503
504
|
}
|
|
504
505
|
existingReplacements.replacements.push(...replacements);
|
|
505
506
|
}
|
|
507
|
+
function addCommentForEmptyEmit(node, info, checker, reflector, dtsReader, outputFieldReplacements) {
|
|
508
|
+
if (!isEmptyEmitCall(node))
|
|
509
|
+
return;
|
|
510
|
+
const propertyAccess = getPropertyAccess(node);
|
|
511
|
+
if (!propertyAccess)
|
|
512
|
+
return;
|
|
513
|
+
const symbol = checker.getSymbolAtLocation(propertyAccess.name);
|
|
514
|
+
if (!symbol || !symbol.declarations?.length)
|
|
515
|
+
return;
|
|
516
|
+
const propertyDeclaration = isTargetOutputDeclaration(propertyAccess, checker, reflector, dtsReader);
|
|
517
|
+
if (!propertyDeclaration)
|
|
518
|
+
return;
|
|
519
|
+
const eventEmitterType = getEventEmitterArgumentType(propertyDeclaration);
|
|
520
|
+
if (!eventEmitterType)
|
|
521
|
+
return;
|
|
522
|
+
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
523
|
+
const file = project_paths.projectFile(node.getSourceFile(), info);
|
|
524
|
+
const formatter = getFormatterText(node);
|
|
525
|
+
const todoReplacement = new project_paths.TextUpdate({
|
|
526
|
+
toInsert: `${formatter.indent}// TODO: The 'emit' function requires a mandatory ${eventEmitterType} argument\n`,
|
|
527
|
+
end: formatter.lineStartPos,
|
|
528
|
+
position: formatter.lineStartPos,
|
|
529
|
+
});
|
|
530
|
+
addOutputReplacement(outputFieldReplacements, id, file, new project_paths.Replacement(file, todoReplacement));
|
|
531
|
+
}
|
|
532
|
+
function isEmptyEmitCall(node) {
|
|
533
|
+
return (ts.isCallExpression(node) &&
|
|
534
|
+
ts.isPropertyAccessExpression(node.expression) &&
|
|
535
|
+
node.expression.name.text === 'emit' &&
|
|
536
|
+
node.arguments.length === 0);
|
|
537
|
+
}
|
|
538
|
+
function getPropertyAccess(node) {
|
|
539
|
+
const propertyAccessExpression = node.expression.expression;
|
|
540
|
+
return ts.isPropertyAccessExpression(propertyAccessExpression) ? propertyAccessExpression : null;
|
|
541
|
+
}
|
|
542
|
+
function getEventEmitterArgumentType(propertyDeclaration) {
|
|
543
|
+
const initializer = propertyDeclaration.initializer;
|
|
544
|
+
if (!initializer || !ts.isNewExpression(initializer))
|
|
545
|
+
return null;
|
|
546
|
+
const isEventEmitter = ts.isIdentifier(initializer.expression) && initializer.expression.getText() === 'EventEmitter';
|
|
547
|
+
if (!isEventEmitter)
|
|
548
|
+
return null;
|
|
549
|
+
const [typeArg] = initializer.typeArguments ?? [];
|
|
550
|
+
return typeArg ? typeArg.getText() : null;
|
|
551
|
+
}
|
|
552
|
+
function getFormatterText(node) {
|
|
553
|
+
const sourceFile = node.getSourceFile();
|
|
554
|
+
const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
555
|
+
const lineStartPos = sourceFile.getPositionOfLineAndCharacter(line, 0);
|
|
556
|
+
const indent = sourceFile.text.slice(lineStartPos, node.getStart());
|
|
557
|
+
return { indent, lineStartPos };
|
|
558
|
+
}
|
|
506
559
|
|
|
507
560
|
function migrate(options) {
|
|
508
561
|
return async (tree, context) => {
|
|
509
|
-
await
|
|
562
|
+
await project_paths.runMigrationInDevkit({
|
|
510
563
|
tree,
|
|
511
564
|
getMigration: (fs) => new OutputMigration({
|
|
512
565
|
shouldMigrate: (_, file) => {
|
|
@@ -514,8 +567,13 @@ function migrate(options) {
|
|
|
514
567
|
!/(^|\/)node_modules\//.test(file.rootRelativePath));
|
|
515
568
|
},
|
|
516
569
|
}),
|
|
517
|
-
beforeProgramCreation: (tsconfigPath) => {
|
|
518
|
-
|
|
570
|
+
beforeProgramCreation: (tsconfigPath, stage) => {
|
|
571
|
+
if (stage === project_paths.MigrationStage.Analysis) {
|
|
572
|
+
context.logger.info(`Preparing analysis for: ${tsconfigPath}...`);
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
context.logger.info(`Running migration for: ${tsconfigPath}...`);
|
|
576
|
+
}
|
|
519
577
|
},
|
|
520
578
|
afterProgramCreation: (info, fs) => {
|
|
521
579
|
const analysisPath = fs.resolve(options.analysisDir);
|