@angular/core 19.1.0-next.4 → 19.1.0
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/LICENSE +1 -1
- package/fesm2022/core.mjs +85 -91
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -24
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +4 -4
- package/index.d.ts +41 -36
- package/package.json +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/bundles/apply_import_manager-5082ccea.js +732 -0
- package/schematics/bundles/{checker-884633eb.js → checker-aa999c96.js} +50 -25
- package/schematics/bundles/cleanup-unused-imports.js +295 -0
- package/schematics/bundles/{compiler_host-22f6513d.js → compiler_host-f0b570c8.js} +2 -2
- package/schematics/bundles/control-flow-migration.js +3 -3
- package/schematics/bundles/explicit-standalone-flag.js +5 -5
- package/schematics/bundles/{imports-abe29092.js → imports-31a38653.js} +1 -1
- package/schematics/bundles/index-02a11f43.js +30 -0
- package/schematics/bundles/{combine_units-4a95b1b9.js → index-15b61bae.js} +10 -723
- package/schematics/bundles/inject-migration.js +6 -6
- package/schematics/bundles/{leading_space-d190b83b.js → leading_space-6e7a8ec6.js} +1 -1
- package/schematics/bundles/{migrate_ts_type_references-4b11f3f2.js → migrate_ts_type_references-042ca765.js} +30 -29
- package/schematics/bundles/{nodes-a9f0b985.js → nodes-88c2157f.js} +2 -2
- package/schematics/bundles/output-migration.js +27 -26
- package/schematics/bundles/pending-tasks.js +5 -5
- package/schematics/bundles/{program-094352ba.js → program-393ca8f3.js} +106 -46
- package/schematics/bundles/{project_tsconfig_paths-e9ccccbf.js → project_tsconfig_paths-6c9cde78.js} +1 -1
- package/schematics/bundles/provide-initializer.js +5 -5
- package/schematics/bundles/route-lazy-loading.js +4 -4
- package/schematics/bundles/signal-input-migration.js +33 -32
- package/schematics/bundles/signal-queries-migration.js +56 -49
- package/schematics/bundles/signals.js +8 -7
- package/schematics/bundles/standalone-migration.js +12 -28
- package/schematics/collection.json +5 -0
- package/schematics/ng-generate/cleanup-unused-imports/schema.json +7 -0
- package/testing/index.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0
|
|
3
|
+
* @license Angular v19.1.0
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10,12 +10,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
12
|
var p = require('path');
|
|
13
|
-
var compiler_host = require('./compiler_host-
|
|
13
|
+
var compiler_host = require('./compiler_host-f0b570c8.js');
|
|
14
14
|
var ts = require('typescript');
|
|
15
|
-
var nodes = require('./nodes-
|
|
16
|
-
var imports = require('./imports-
|
|
17
|
-
var leading_space = require('./leading_space-
|
|
18
|
-
require('./checker-
|
|
15
|
+
var nodes = require('./nodes-88c2157f.js');
|
|
16
|
+
var imports = require('./imports-31a38653.js');
|
|
17
|
+
var leading_space = require('./leading_space-6e7a8ec6.js');
|
|
18
|
+
require('./checker-aa999c96.js');
|
|
19
19
|
require('os');
|
|
20
20
|
require('fs');
|
|
21
21
|
require('module');
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0
|
|
3
|
+
* @license Angular v19.1.0
|
|
4
4
|
* (c) 2010-2024 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-aa999c96.js');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
require('os');
|
|
12
12
|
var assert = require('assert');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
require('./
|
|
13
|
+
var index = require('./index-15b61bae.js');
|
|
14
|
+
var apply_import_manager = require('./apply_import_manager-5082ccea.js');
|
|
15
|
+
var leading_space = require('./leading_space-6e7a8ec6.js');
|
|
16
|
+
require('./program-393ca8f3.js');
|
|
16
17
|
require('path');
|
|
17
18
|
|
|
18
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -625,7 +626,7 @@ function checkIncompatiblePatterns(inheritanceGraph, checker$1, groupedTsAstVisi
|
|
|
625
626
|
newTarget = checker$1.getAliasedSymbol(newTarget);
|
|
626
627
|
}
|
|
627
628
|
if (newTarget && inputClassSymbolsToClass.has(newTarget)) {
|
|
628
|
-
const memberName =
|
|
629
|
+
const memberName = index.getMemberName(insidePropertyDeclaration);
|
|
629
630
|
if (memberName === null) {
|
|
630
631
|
break problematicReferencesCheck;
|
|
631
632
|
}
|
|
@@ -858,7 +859,7 @@ function checkInheritanceOfKnownFields(inheritanceGraph, metaRegistry, fields, o
|
|
|
858
859
|
// Check inheritance of every input in the given "directive class".
|
|
859
860
|
inputCheck: for (const fieldDescr of classFields) {
|
|
860
861
|
const inputNode = fieldDescr.node;
|
|
861
|
-
const { derivedMembers, inherited } = inheritanceGraph.checkOverlappingMembers(inputClass, inputNode,
|
|
862
|
+
const { derivedMembers, inherited } = inheritanceGraph.checkOverlappingMembers(inputClass, inputNode, index.getMemberName(inputNode));
|
|
862
863
|
// If we discover a derived, input re-declared via class metadata, then it
|
|
863
864
|
// will cause conflicts as we cannot migrate it/ nor mark it as signal-based.
|
|
864
865
|
if (fieldDescr.node.name !== undefined &&
|
|
@@ -914,7 +915,7 @@ function removeFromUnionIfPossible(union, filter) {
|
|
|
914
915
|
*/
|
|
915
916
|
function insertPrecedingLine(node, info, text) {
|
|
916
917
|
const leadingSpace = leading_space.getLeadingLineWhitespaceOfNode(node);
|
|
917
|
-
return new
|
|
918
|
+
return new apply_import_manager.Replacement(apply_import_manager.projectFile(node.getSourceFile(), info), new apply_import_manager.TextUpdate({
|
|
918
919
|
position: node.getStart(),
|
|
919
920
|
end: node.getStart(),
|
|
920
921
|
toInsert: `${text}\n${leadingSpace}`,
|
|
@@ -1255,20 +1256,20 @@ function createNewBlockToInsertVariable(node, file, toInsert) {
|
|
|
1255
1256
|
const contentSpace = ' '.repeat(character + 2);
|
|
1256
1257
|
return [
|
|
1257
1258
|
// Delete leading whitespace of the concise body.
|
|
1258
|
-
new
|
|
1259
|
+
new apply_import_manager.Replacement(file, new apply_import_manager.TextUpdate({
|
|
1259
1260
|
position: node.body.getFullStart(),
|
|
1260
1261
|
end: node.body.getStart(),
|
|
1261
1262
|
toInsert: '',
|
|
1262
1263
|
})),
|
|
1263
1264
|
// Insert leading block braces, and `toInsert` content.
|
|
1264
1265
|
// Wrap the previous expression in a return now.
|
|
1265
|
-
new
|
|
1266
|
+
new apply_import_manager.Replacement(file, new apply_import_manager.TextUpdate({
|
|
1266
1267
|
position: node.body.getStart(),
|
|
1267
1268
|
end: node.body.getStart(),
|
|
1268
1269
|
toInsert: ` {\n${contentSpace}${toInsert}\n${contentSpace}return `,
|
|
1269
1270
|
})),
|
|
1270
1271
|
// Add trailing brace.
|
|
1271
|
-
new
|
|
1272
|
+
new apply_import_manager.Replacement(file, new apply_import_manager.TextUpdate({
|
|
1272
1273
|
position: node.body.getEnd(),
|
|
1273
1274
|
end: node.body.getEnd(),
|
|
1274
1275
|
toInsert: `;\n${blockSpace}}`,
|
|
@@ -1296,9 +1297,9 @@ function migrateBindingElementInputReference(tsReferencesInBindingElements, info
|
|
|
1296
1297
|
const nameGenerator = new UniqueNamesGenerator(['Input', 'Signal', 'Ref']);
|
|
1297
1298
|
for (const reference of tsReferencesInBindingElements) {
|
|
1298
1299
|
const bindingElement = reference.parent;
|
|
1299
|
-
const bindingDecl =
|
|
1300
|
+
const bindingDecl = index.getBindingElementDeclaration(bindingElement);
|
|
1300
1301
|
const sourceFile = bindingElement.getSourceFile();
|
|
1301
|
-
const file =
|
|
1302
|
+
const file = apply_import_manager.projectFile(sourceFile, info);
|
|
1302
1303
|
const inputFieldName = bindingElement.propertyName ?? bindingElement.name;
|
|
1303
1304
|
assert__default["default"](!ts__default["default"].isObjectBindingPattern(inputFieldName) && !ts__default["default"].isArrayBindingPattern(inputFieldName), 'Property of binding element cannot be another pattern.');
|
|
1304
1305
|
const tmpName = nameGenerator.generate(reference.text, bindingElement);
|
|
@@ -1316,7 +1317,7 @@ function migrateBindingElementInputReference(tsReferencesInBindingElements, info
|
|
|
1316
1317
|
console.error(`Could not migrate reference ${reference.text} in ${file.rootRelativePath}`);
|
|
1317
1318
|
continue;
|
|
1318
1319
|
}
|
|
1319
|
-
replacements.push(new
|
|
1320
|
+
replacements.push(new apply_import_manager.Replacement(file, new apply_import_manager.TextUpdate({
|
|
1320
1321
|
position: bindingElement.getStart(),
|
|
1321
1322
|
end: bindingElement.getEnd(),
|
|
1322
1323
|
toInsert: printer.printNode(ts__default["default"].EmitHint.Unspecified, newBindingToAccessInputField, sourceFile),
|
|
@@ -1341,7 +1342,7 @@ function insertTemporaryVariableForBindingElement(expansionDecl, file, toInsert)
|
|
|
1341
1342
|
const leadingSpace = ' '.repeat(leadingSpaceCount);
|
|
1342
1343
|
const statement = parent.parent;
|
|
1343
1344
|
return [
|
|
1344
|
-
new
|
|
1345
|
+
new apply_import_manager.Replacement(file, new apply_import_manager.TextUpdate({
|
|
1345
1346
|
position: statement.getEnd(),
|
|
1346
1347
|
end: statement.getEnd(),
|
|
1347
1348
|
toInsert: `\n${leadingSpace}${toInsert}`,
|
|
@@ -1359,7 +1360,7 @@ function insertTemporaryVariableForBindingElement(expansionDecl, file, toInsert)
|
|
|
1359
1360
|
const leadingSpaceCount = ts__default["default"].getLineAndCharacterOfPosition(sf, spaceReferenceNode.getStart()).character + spaceOffset;
|
|
1360
1361
|
const leadingSpace = ' '.repeat(leadingSpaceCount);
|
|
1361
1362
|
return [
|
|
1362
|
-
new
|
|
1363
|
+
new apply_import_manager.Replacement(file, new apply_import_manager.TextUpdate({
|
|
1363
1364
|
position: bodyBlock.getStart() + 1,
|
|
1364
1365
|
end: bodyBlock.getStart() + 1,
|
|
1365
1366
|
toInsert: `\n${leadingSpace}${toInsert}`,
|
|
@@ -1720,7 +1721,7 @@ function findSimilarReferenceNode(start, reference, referenceToMetadata, restrai
|
|
|
1720
1721
|
* e.g. checks that they have similar property receiver accesses.
|
|
1721
1722
|
*/
|
|
1722
1723
|
function isLexicalSameReference(checker, sharePartner, reference) {
|
|
1723
|
-
const aParent =
|
|
1724
|
+
const aParent = index.unwrapParent(reference.parent);
|
|
1724
1725
|
// If the reference is not part a property access, return true. The references
|
|
1725
1726
|
// are guaranteed symbol matches.
|
|
1726
1727
|
if (!ts__default["default"].isPropertyAccessExpression(aParent) && !ts__default["default"].isElementAccessExpression(aParent)) {
|
|
@@ -1728,7 +1729,7 @@ function isLexicalSameReference(checker, sharePartner, reference) {
|
|
|
1728
1729
|
}
|
|
1729
1730
|
// If reference parent is part of a property expression, but the share
|
|
1730
1731
|
// partner not, then this cannot be shared.
|
|
1731
|
-
const bParent =
|
|
1732
|
+
const bParent = index.unwrapParent(sharePartner.parent);
|
|
1732
1733
|
if (aParent.kind !== bParent.kind) {
|
|
1733
1734
|
return false;
|
|
1734
1735
|
}
|
|
@@ -1760,7 +1761,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1760
1761
|
// Unwrap the signal directly.
|
|
1761
1762
|
if (recommendedNode === 'preserve') {
|
|
1762
1763
|
// Append `()` to unwrap the signal.
|
|
1763
|
-
replacements.push(new
|
|
1764
|
+
replacements.push(new apply_import_manager.Replacement(apply_import_manager.projectFile(sf, info), new apply_import_manager.TextUpdate({
|
|
1764
1765
|
position: originalNode.getEnd(),
|
|
1765
1766
|
end: originalNode.getEnd(),
|
|
1766
1767
|
toInsert: '()',
|
|
@@ -1772,9 +1773,9 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1772
1773
|
if (typeof recommendedNode === 'number') {
|
|
1773
1774
|
// Extract the shared field name.
|
|
1774
1775
|
const toInsert = idToSharedField.get(recommendedNode);
|
|
1775
|
-
const replaceNode =
|
|
1776
|
+
const replaceNode = index.traverseAccess(originalNode);
|
|
1776
1777
|
assert__default["default"](toInsert, 'no shared variable yet available');
|
|
1777
|
-
replacements.push(new
|
|
1778
|
+
replacements.push(new apply_import_manager.Replacement(apply_import_manager.projectFile(sf, info), new apply_import_manager.TextUpdate({
|
|
1778
1779
|
position: replaceNode.getStart(),
|
|
1779
1780
|
end: replaceNode.getEnd(),
|
|
1780
1781
|
toInsert,
|
|
@@ -1793,8 +1794,8 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1793
1794
|
referenceNodeInBlock = parent;
|
|
1794
1795
|
parent = parent.parent;
|
|
1795
1796
|
}
|
|
1796
|
-
const replaceNode =
|
|
1797
|
-
const filePath =
|
|
1797
|
+
const replaceNode = index.traverseAccess(originalNode);
|
|
1798
|
+
const filePath = apply_import_manager.projectFile(sf, info);
|
|
1798
1799
|
const initializer = `${replaceNode.getText()}()`;
|
|
1799
1800
|
const fieldName = nameGenerator.generate(originalNode.text, referenceNodeInBlock);
|
|
1800
1801
|
let sharedValueAccessExpr;
|
|
@@ -1816,13 +1817,13 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1816
1817
|
}
|
|
1817
1818
|
else {
|
|
1818
1819
|
const leadingSpace = ts__default["default"].getLineAndCharacterOfPosition(sf, referenceNodeInBlock.getStart());
|
|
1819
|
-
replacements.push(new
|
|
1820
|
+
replacements.push(new apply_import_manager.Replacement(filePath, new apply_import_manager.TextUpdate({
|
|
1820
1821
|
position: referenceNodeInBlock.getStart(),
|
|
1821
1822
|
end: referenceNodeInBlock.getStart(),
|
|
1822
1823
|
toInsert: `${temporaryVariableStr}\n${' '.repeat(leadingSpace.character)}`,
|
|
1823
1824
|
})));
|
|
1824
1825
|
}
|
|
1825
|
-
replacements.push(new
|
|
1826
|
+
replacements.push(new apply_import_manager.Replacement(apply_import_manager.projectFile(sf, info), new apply_import_manager.TextUpdate({
|
|
1826
1827
|
position: replaceNode.getStart(),
|
|
1827
1828
|
end: replaceNode.getEnd(),
|
|
1828
1829
|
toInsert: sharedValueAccessExpr,
|
|
@@ -1862,7 +1863,7 @@ function migrateTypeScriptReferences(host, references, checker, info) {
|
|
|
1862
1863
|
const seenIdentifiers = new WeakSet();
|
|
1863
1864
|
for (const reference of references) {
|
|
1864
1865
|
// This pass only deals with TS references.
|
|
1865
|
-
if (!
|
|
1866
|
+
if (!index.isTsReference(reference)) {
|
|
1866
1867
|
continue;
|
|
1867
1868
|
}
|
|
1868
1869
|
// Skip references to incompatible inputs.
|
|
@@ -1905,7 +1906,7 @@ function migrateTypeScriptTypeReferences(host, references, importManager, info)
|
|
|
1905
1906
|
const seenTypeNodes = new WeakSet();
|
|
1906
1907
|
for (const reference of references) {
|
|
1907
1908
|
// This pass only deals with TS input class type references.
|
|
1908
|
-
if (!
|
|
1909
|
+
if (!index.isTsClassTypeReference(reference)) {
|
|
1909
1910
|
continue;
|
|
1910
1911
|
}
|
|
1911
1912
|
// Skip references to classes that are not fully migrated.
|
|
@@ -1931,12 +1932,12 @@ function migrateTypeScriptTypeReferences(host, references, importManager, info)
|
|
|
1931
1932
|
exportSymbolName: 'UnwrapSignalInputs',
|
|
1932
1933
|
requestedFile: sf,
|
|
1933
1934
|
});
|
|
1934
|
-
host.replacements.push(new
|
|
1935
|
+
host.replacements.push(new apply_import_manager.Replacement(apply_import_manager.projectFile(sf, info), new apply_import_manager.TextUpdate({
|
|
1935
1936
|
position: firstArg.getStart(),
|
|
1936
1937
|
end: firstArg.getStart(),
|
|
1937
1938
|
toInsert: `${host.printer.printNode(ts__default["default"].EmitHint.Unspecified, unwrapImportExpr, sf)}<`,
|
|
1938
1939
|
})));
|
|
1939
|
-
host.replacements.push(new
|
|
1940
|
+
host.replacements.push(new apply_import_manager.Replacement(apply_import_manager.projectFile(sf, info), new apply_import_manager.TextUpdate({ position: firstArg.getEnd(), end: firstArg.getEnd(), toInsert: '>' })));
|
|
1940
1941
|
}
|
|
1941
1942
|
}
|
|
1942
1943
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0
|
|
3
|
+
* @license Angular v19.1.0
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
|
-
var imports = require('./imports-
|
|
10
|
+
var imports = require('./imports-31a38653.js');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0
|
|
3
|
+
* @license Angular v19.1.0
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
13
|
-
var
|
|
12
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js');
|
|
13
|
+
var apply_import_manager = require('./apply_import_manager-5082ccea.js');
|
|
14
14
|
require('os');
|
|
15
15
|
var ts = require('typescript');
|
|
16
|
-
var checker = require('./checker-
|
|
17
|
-
var program = require('./program-
|
|
16
|
+
var checker = require('./checker-aa999c96.js');
|
|
17
|
+
var program = require('./program-393ca8f3.js');
|
|
18
18
|
require('path');
|
|
19
|
+
var index = require('./index-15b61bae.js');
|
|
19
20
|
require('@angular-devkit/core');
|
|
20
21
|
require('node:path/posix');
|
|
21
22
|
require('fs');
|
|
@@ -94,7 +95,7 @@ function getOutputDecorator(node, reflector) {
|
|
|
94
95
|
// THINK: this utility + type is not specific to @Output, really, maybe move it to tsurge?
|
|
95
96
|
/** Computes an unique ID for a given Angular `@Output` property. */
|
|
96
97
|
function getUniqueIdForProperty(info, prop) {
|
|
97
|
-
const { id } =
|
|
98
|
+
const { id } = apply_import_manager.projectFile(prop.getSourceFile(), info);
|
|
98
99
|
id.replace(/\.d\.ts$/, '.ts');
|
|
99
100
|
return `${id}@@${prop.parent.name ?? 'unknown-class'}@@${prop.name.getText()}`;
|
|
100
101
|
}
|
|
@@ -173,16 +174,16 @@ function calculateImportReplacements(info, sourceFiles) {
|
|
|
173
174
|
const importManager = new checker.ImportManager();
|
|
174
175
|
const addOnly = [];
|
|
175
176
|
const addRemove = [];
|
|
176
|
-
const file =
|
|
177
|
+
const file = apply_import_manager.projectFile(sf, info);
|
|
177
178
|
importManager.addImport({
|
|
178
179
|
requestedFile: sf,
|
|
179
180
|
exportModuleSpecifier: '@angular/core',
|
|
180
181
|
exportSymbolName: 'output',
|
|
181
182
|
});
|
|
182
|
-
|
|
183
|
+
apply_import_manager.applyImportManagerChanges(importManager, addOnly, [sf], info);
|
|
183
184
|
importManager.removeImport(sf, 'Output', '@angular/core');
|
|
184
185
|
importManager.removeImport(sf, 'EventEmitter', '@angular/core');
|
|
185
|
-
|
|
186
|
+
apply_import_manager.applyImportManagerChanges(importManager, addRemove, [sf], info);
|
|
186
187
|
importReplacements[file.id] = {
|
|
187
188
|
add: addOnly,
|
|
188
189
|
addAndRemove: addRemove,
|
|
@@ -219,7 +220,7 @@ function calculatePipeCallReplacement(info, node) {
|
|
|
219
220
|
const replacements = [
|
|
220
221
|
prepareTextReplacementForNode(info, node, printer.printNode(ts__default["default"].EmitHint.Unspecified, pipeCallExp, sf)),
|
|
221
222
|
];
|
|
222
|
-
|
|
223
|
+
apply_import_manager.applyImportManagerChanges(importManager, replacements, [sf], info);
|
|
223
224
|
return replacements;
|
|
224
225
|
}
|
|
225
226
|
else {
|
|
@@ -229,21 +230,21 @@ function calculatePipeCallReplacement(info, node) {
|
|
|
229
230
|
}
|
|
230
231
|
function prepareTextReplacementForNode(info, node, replacement, start) {
|
|
231
232
|
const sf = node.getSourceFile();
|
|
232
|
-
return new
|
|
233
|
+
return new apply_import_manager.Replacement(apply_import_manager.projectFile(sf, info), new apply_import_manager.TextUpdate({
|
|
233
234
|
position: start ?? node.getStart(),
|
|
234
235
|
end: node.getEnd(),
|
|
235
236
|
toInsert: replacement,
|
|
236
237
|
}));
|
|
237
238
|
}
|
|
238
239
|
function prepareTextReplacement(file, replacement, start, end) {
|
|
239
|
-
return new
|
|
240
|
+
return new apply_import_manager.Replacement(file, new apply_import_manager.TextUpdate({
|
|
240
241
|
position: start,
|
|
241
242
|
end: end,
|
|
242
243
|
toInsert: replacement,
|
|
243
244
|
}));
|
|
244
245
|
}
|
|
245
246
|
|
|
246
|
-
class OutputMigration extends
|
|
247
|
+
class OutputMigration extends apply_import_manager.TsurgeFunnelMigration {
|
|
247
248
|
config;
|
|
248
249
|
constructor(config = {}) {
|
|
249
250
|
super();
|
|
@@ -294,7 +295,7 @@ class OutputMigration extends combine_units.TsurgeFunnelMigration {
|
|
|
294
295
|
id: getUniqueIdForProperty(info, node),
|
|
295
296
|
aliasParam: outputDecorator.args?.at(0),
|
|
296
297
|
};
|
|
297
|
-
const outputFile =
|
|
298
|
+
const outputFile = apply_import_manager.projectFile(node.getSourceFile(), info);
|
|
298
299
|
if (this.config.shouldMigrate === undefined ||
|
|
299
300
|
this.config.shouldMigrate({
|
|
300
301
|
key: outputDef.id,
|
|
@@ -322,7 +323,7 @@ class OutputMigration extends combine_units.TsurgeFunnelMigration {
|
|
|
322
323
|
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker$1, reflector, dtsReader);
|
|
323
324
|
if (propertyDeclaration !== null) {
|
|
324
325
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
325
|
-
const outputFile =
|
|
326
|
+
const outputFile = apply_import_manager.projectFile(node.getSourceFile(), info);
|
|
326
327
|
addOutputReplacement(outputFieldReplacements, id, outputFile, calculateNextFnReplacement(info, node.expression.name));
|
|
327
328
|
}
|
|
328
329
|
}
|
|
@@ -331,7 +332,7 @@ class OutputMigration extends combine_units.TsurgeFunnelMigration {
|
|
|
331
332
|
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker$1, reflector, dtsReader);
|
|
332
333
|
if (propertyDeclaration !== null) {
|
|
333
334
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
334
|
-
const outputFile =
|
|
335
|
+
const outputFile = apply_import_manager.projectFile(node.getSourceFile(), info);
|
|
335
336
|
if (ts__default["default"].isExpressionStatement(node.parent)) {
|
|
336
337
|
addOutputReplacement(outputFieldReplacements, id, outputFile, calculateCompleteCallReplacement(info, node.parent));
|
|
337
338
|
}
|
|
@@ -350,7 +351,7 @@ class OutputMigration extends combine_units.TsurgeFunnelMigration {
|
|
|
350
351
|
if (propertyDeclaration !== null) {
|
|
351
352
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
352
353
|
if (isTestFile) {
|
|
353
|
-
const outputFile =
|
|
354
|
+
const outputFile = apply_import_manager.projectFile(node.getSourceFile(), info);
|
|
354
355
|
addOutputReplacement(outputFieldReplacements, id, outputFile, ...calculatePipeCallReplacement(info, node));
|
|
355
356
|
}
|
|
356
357
|
else {
|
|
@@ -367,7 +368,7 @@ class OutputMigration extends combine_units.TsurgeFunnelMigration {
|
|
|
367
368
|
}
|
|
368
369
|
// take care of the references in templates and host bindings
|
|
369
370
|
const referenceResult = { references: [] };
|
|
370
|
-
const { visitor: templateHostRefVisitor } =
|
|
371
|
+
const { visitor: templateHostRefVisitor } = index.createFindAllSourceFileReferencesVisitor(info, checker$1, reflector, resourceLoader, evaluator, templateTypeChecker, knownFields, null, // TODO: capture known output names as an optimization
|
|
371
372
|
referenceResult);
|
|
372
373
|
// calculate template / host binding replacements
|
|
373
374
|
for (const sf of sourceFiles) {
|
|
@@ -375,7 +376,7 @@ class OutputMigration extends combine_units.TsurgeFunnelMigration {
|
|
|
375
376
|
}
|
|
376
377
|
for (const ref of referenceResult.references) {
|
|
377
378
|
// detect .next usages that should be migrated to .emit in template and host binding expressions
|
|
378
|
-
if (ref.kind ===
|
|
379
|
+
if (ref.kind === index.ReferenceKind.InTemplate) {
|
|
379
380
|
const callExpr = checkNonTsReferenceCallsField(ref, 'next');
|
|
380
381
|
// TODO: here and below for host bindings, we should ideally filter in the global meta stage
|
|
381
382
|
// (instead of using the `outputFieldReplacements` map)
|
|
@@ -385,7 +386,7 @@ class OutputMigration extends combine_units.TsurgeFunnelMigration {
|
|
|
385
386
|
addOutputReplacement(outputFieldReplacements, ref.target.key, ref.from.templateFile, calculateNextFnReplacementInTemplate(ref.from.templateFile, callExpr.nameSpan));
|
|
386
387
|
}
|
|
387
388
|
}
|
|
388
|
-
else if (ref.kind ===
|
|
389
|
+
else if (ref.kind === index.ReferenceKind.InHostBinding) {
|
|
389
390
|
const callExpr = checkNonTsReferenceCallsField(ref, 'next');
|
|
390
391
|
if (callExpr !== null && outputFieldReplacements[ref.target.key] !== undefined) {
|
|
391
392
|
addOutputReplacement(outputFieldReplacements, ref.target.key, ref.from.file, calculateNextFnReplacementInHostBinding(ref.from.file, ref.from.hostPropertyNode.getStart() + 1, callExpr.nameSpan));
|
|
@@ -394,7 +395,7 @@ class OutputMigration extends combine_units.TsurgeFunnelMigration {
|
|
|
394
395
|
}
|
|
395
396
|
// calculate import replacements but do so only for files that have output declarations
|
|
396
397
|
const importReplacements = calculateImportReplacements(info, filesWithOutputDeclarations);
|
|
397
|
-
return
|
|
398
|
+
return apply_import_manager.confirmAsSerializable({
|
|
398
399
|
problematicDeclarationCount,
|
|
399
400
|
outputFields: outputFieldReplacements,
|
|
400
401
|
importReplacements,
|
|
@@ -424,7 +425,7 @@ class OutputMigration extends combine_units.TsurgeFunnelMigration {
|
|
|
424
425
|
problematicUsages[declId] = unit.problematicUsages[declId];
|
|
425
426
|
}
|
|
426
427
|
}
|
|
427
|
-
return
|
|
428
|
+
return apply_import_manager.confirmAsSerializable({
|
|
428
429
|
problematicDeclarationCount,
|
|
429
430
|
outputFields,
|
|
430
431
|
importReplacements,
|
|
@@ -446,7 +447,7 @@ class OutputMigration extends combine_units.TsurgeFunnelMigration {
|
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
449
|
// Noop here as we don't have any form of special global metadata.
|
|
449
|
-
return
|
|
450
|
+
return apply_import_manager.confirmAsSerializable(combinedData);
|
|
450
451
|
}
|
|
451
452
|
async stats(globalMetadata) {
|
|
452
453
|
const detectedOutputs = new Set(Object.keys(globalMetadata.outputFields)).size +
|
|
@@ -509,7 +510,7 @@ function migrate(options) {
|
|
|
509
510
|
if (!buildPaths.length && !testPaths.length) {
|
|
510
511
|
throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run output migration.');
|
|
511
512
|
}
|
|
512
|
-
const fs = new
|
|
513
|
+
const fs = new apply_import_manager.DevkitMigrationFilesystem(tree);
|
|
513
514
|
checker.setFileSystem(fs);
|
|
514
515
|
const migration = new OutputMigration({
|
|
515
516
|
shouldMigrate: (_, file) => {
|
|
@@ -539,7 +540,7 @@ function migrate(options) {
|
|
|
539
540
|
context.logger.info(``);
|
|
540
541
|
context.logger.info(`Processing analysis data between targets..`);
|
|
541
542
|
context.logger.info(``);
|
|
542
|
-
const combined = await
|
|
543
|
+
const combined = await apply_import_manager.synchronouslyCombineUnitData(migration, unitResults);
|
|
543
544
|
if (combined === null) {
|
|
544
545
|
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
545
546
|
return;
|
|
@@ -549,7 +550,7 @@ function migrate(options) {
|
|
|
549
550
|
for (const { info, tsconfigPath } of programInfos) {
|
|
550
551
|
context.logger.info(`Migrating: ${tsconfigPath}..`);
|
|
551
552
|
const { replacements } = await migration.migrate(globalMeta);
|
|
552
|
-
const changesPerFile =
|
|
553
|
+
const changesPerFile = apply_import_manager.groupReplacementsByFile(replacements);
|
|
553
554
|
for (const [file, changes] of changesPerFile) {
|
|
554
555
|
if (!replacementsPerFile.has(file)) {
|
|
555
556
|
replacementsPerFile.set(file, changes);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0
|
|
3
|
+
* @license Angular v19.1.0
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10,12 +10,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
12
|
var p = require('path');
|
|
13
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
14
|
-
var compiler_host = require('./compiler_host-
|
|
13
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js');
|
|
14
|
+
var compiler_host = require('./compiler_host-f0b570c8.js');
|
|
15
15
|
var ts = require('typescript');
|
|
16
|
-
var imports = require('./imports-
|
|
16
|
+
var imports = require('./imports-31a38653.js');
|
|
17
17
|
require('@angular-devkit/core');
|
|
18
|
-
require('./checker-
|
|
18
|
+
require('./checker-aa999c96.js');
|
|
19
19
|
require('os');
|
|
20
20
|
require('fs');
|
|
21
21
|
require('module');
|