@angular/core 19.2.0-next.2 → 19.2.0-rc.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/fesm2022/core.mjs +1094 -1064
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +5 -5
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +5 -5
- package/index.d.ts +92 -44
- package/package.json +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +2 -2
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/bundles/apply_import_manager-a930fcf1.js +71 -0
- package/schematics/bundles/{checker-9af84be9.js → checker-2eecc677.js} +101 -63
- package/schematics/bundles/cleanup-unused-imports.js +17 -16
- package/schematics/bundles/{compiler_host-dbff2781.js → compiler_host-c280a924.js} +2 -2
- package/schematics/bundles/control-flow-migration.js +10 -3
- package/schematics/bundles/explicit-standalone-flag.js +5 -5
- package/schematics/bundles/{imports-31a38653.js → imports-abe29092.js} +1 -1
- package/schematics/bundles/{index-23b503a4.js → index-24a2ad1e.js} +9 -9
- package/schematics/bundles/{index-93e324de.js → index-3891dd55.js} +4 -4
- package/schematics/bundles/inject-migration.js +10 -9
- package/schematics/bundles/{leading_space-6e7a8ec6.js → leading_space-d190b83b.js} +1 -1
- package/schematics/bundles/{migrate_ts_type_references-c6615b87.js → migrate_ts_type_references-71b3a951.js} +21 -21
- package/schematics/bundles/{nodes-88c2157f.js → ng_decorators-e699c081.js} +2 -15
- package/schematics/bundles/nodes-a535b2be.js +27 -0
- package/schematics/bundles/output-migration.js +22 -21
- package/schematics/bundles/pending-tasks.js +5 -5
- package/schematics/bundles/{program-66386e72.js → program-24da9092.js} +113 -54
- package/schematics/bundles/{apply_import_manager-d8ea426b.js → project_paths-b073c4d6.js} +3 -57
- package/schematics/bundles/{project_tsconfig_paths-6c9cde78.js → project_tsconfig_paths-e9ccccbf.js} +1 -1
- package/schematics/bundles/property_name-7c8433f5.js +31 -0
- package/schematics/bundles/provide-initializer.js +5 -5
- package/schematics/bundles/route-lazy-loading.js +9 -13
- package/schematics/bundles/self-closing-tags-migration.js +448 -0
- package/schematics/bundles/signal-input-migration.js +22 -21
- package/schematics/bundles/signal-queries-migration.js +28 -27
- package/schematics/bundles/signals.js +9 -8
- package/schematics/bundles/standalone-migration.js +14 -13
- package/schematics/collection.json +6 -0
- package/schematics/ng-generate/self-closing-tags-migration/schema.json +14 -0
- package/testing/index.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.0-
|
|
3
|
+
* @license Angular v19.2.0-rc.0
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var checker = require('./checker-
|
|
12
|
-
var program = require('./program-
|
|
11
|
+
var checker = require('./checker-2eecc677.js');
|
|
12
|
+
var program = require('./program-24da9092.js');
|
|
13
13
|
require('path');
|
|
14
|
-
var
|
|
14
|
+
var project_paths = require('./project_paths-b073c4d6.js');
|
|
15
15
|
|
|
16
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
17
|
|
|
@@ -615,7 +615,7 @@ function identifyHostBindingReferences(node, programInfo, checker$1, reflector,
|
|
|
615
615
|
readAstPath: ref.readAstPath,
|
|
616
616
|
isObjectShorthandExpression: ref.isObjectShorthandExpression,
|
|
617
617
|
isWrite: ref.isWrite,
|
|
618
|
-
file:
|
|
618
|
+
file: project_paths.projectFile(ref.context.getSourceFile(), programInfo),
|
|
619
619
|
hostPropertyNode: ref.context,
|
|
620
620
|
},
|
|
621
621
|
target: ref.targetField,
|
|
@@ -715,8 +715,8 @@ function identifyTemplateReferences(programInfo, node, reflector, checker$1, eva
|
|
|
715
715
|
readAstPath: res.readAstPath,
|
|
716
716
|
node: res.context,
|
|
717
717
|
isObjectShorthandExpression: res.isObjectShorthandExpression,
|
|
718
|
-
originatingTsFile:
|
|
719
|
-
templateFile:
|
|
718
|
+
originatingTsFile: project_paths.projectFile(node.getSourceFile(), programInfo),
|
|
719
|
+
templateFile: project_paths.projectFile(checker.absoluteFrom(templateFilePath), programInfo),
|
|
720
720
|
isLikelyPartOfNarrowing: res.isLikelyNarrowed,
|
|
721
721
|
isWrite: res.isWrite,
|
|
722
722
|
},
|
|
@@ -898,7 +898,7 @@ function identifyPotentialTypeScriptReference(node, programInfo, checker, knownF
|
|
|
898
898
|
kind: exports.ReferenceKind.TsReference,
|
|
899
899
|
from: {
|
|
900
900
|
node,
|
|
901
|
-
file:
|
|
901
|
+
file: project_paths.projectFile(node.getSourceFile(), programInfo),
|
|
902
902
|
isWrite: isWriteReference,
|
|
903
903
|
isPartOfElementBinding: ts__default["default"].isBindingElement(node.parent),
|
|
904
904
|
},
|
|
@@ -962,7 +962,7 @@ function createFindAllSourceFileReferencesVisitor(programInfo, checker, reflecto
|
|
|
962
962
|
result.references.push({
|
|
963
963
|
kind: exports.ReferenceKind.TsClassTypeReference,
|
|
964
964
|
from: {
|
|
965
|
-
file:
|
|
965
|
+
file: project_paths.projectFile(partialDirectiveInCatalyst.referenceNode.getSourceFile(), programInfo),
|
|
966
966
|
node: partialDirectiveInCatalyst.referenceNode,
|
|
967
967
|
},
|
|
968
968
|
isPartialReference: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.0-
|
|
3
|
+
* @license Angular v19.2.0-rc.0
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
require('os');
|
|
10
10
|
require('typescript');
|
|
11
|
-
var checker = require('./checker-
|
|
12
|
-
require('./program-
|
|
11
|
+
var checker = require('./checker-2eecc677.js');
|
|
12
|
+
require('./program-24da9092.js');
|
|
13
13
|
require('path');
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -17,7 +17,7 @@ require('path');
|
|
|
17
17
|
* @description
|
|
18
18
|
* Entry point for all public APIs of the compiler-cli package.
|
|
19
19
|
*/
|
|
20
|
-
new checker.Version('19.2.0-
|
|
20
|
+
new checker.Version('19.2.0-rc.0');
|
|
21
21
|
|
|
22
22
|
var LogLevel;
|
|
23
23
|
(function (LogLevel) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.0-
|
|
3
|
+
* @license Angular v19.2.0-rc.0
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10,12 +10,13 @@ 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-c280a924.js');
|
|
14
14
|
var ts = require('typescript');
|
|
15
|
-
var
|
|
16
|
-
var imports = require('./imports-
|
|
17
|
-
var
|
|
18
|
-
require('./
|
|
15
|
+
var ng_decorators = require('./ng_decorators-e699c081.js');
|
|
16
|
+
var imports = require('./imports-abe29092.js');
|
|
17
|
+
var nodes = require('./nodes-a535b2be.js');
|
|
18
|
+
var leading_space = require('./leading_space-d190b83b.js');
|
|
19
|
+
require('./checker-2eecc677.js');
|
|
19
20
|
require('os');
|
|
20
21
|
require('fs');
|
|
21
22
|
require('module');
|
|
@@ -125,7 +126,7 @@ function analyzeFile(sourceFile, localTypeChecker, options) {
|
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
else if (ts__default["default"].isClassDeclaration(node)) {
|
|
128
|
-
const decorators =
|
|
129
|
+
const decorators = ng_decorators.getAngularDecorators(localTypeChecker, ts__default["default"].getDecorators(node) || []);
|
|
129
130
|
const isAbstract = !!node.modifiers?.some((m) => m.kind === ts__default["default"].SyntaxKind.AbstractKeyword);
|
|
130
131
|
const supportsDI = decorators.some((dec) => DECORATORS_SUPPORTING_DI.has(dec.name));
|
|
131
132
|
const constructorNode = node.members.find((member) => ts__default["default"].isConstructorDeclaration(member) &&
|
|
@@ -138,7 +139,7 @@ function analyzeFile(sourceFile, localTypeChecker, options) {
|
|
|
138
139
|
if (!param.type || !UNINJECTABLE_TYPE_KINDS.has(param.type.kind)) {
|
|
139
140
|
return true;
|
|
140
141
|
}
|
|
141
|
-
return
|
|
142
|
+
return ng_decorators.getAngularDecorators(localTypeChecker, ts__default["default"].getDecorators(param) || []).some((dec) => dec.name === 'Inject' || dec.name === 'Attribute');
|
|
142
143
|
});
|
|
143
144
|
// Don't migrate abstract classes by default, because
|
|
144
145
|
// their parameters aren't guaranteed to be injectable.
|
|
@@ -822,7 +823,7 @@ function migrateParameter(node, options, localTypeChecker, printer, tracker, sup
|
|
|
822
823
|
function createInjectReplacementCall(param, options, localTypeChecker, printer, tracker) {
|
|
823
824
|
const moduleName = '@angular/core';
|
|
824
825
|
const sourceFile = param.getSourceFile();
|
|
825
|
-
const decorators =
|
|
826
|
+
const decorators = ng_decorators.getAngularDecorators(localTypeChecker, ts__default["default"].getDecorators(param) || []);
|
|
826
827
|
const literalProps = [];
|
|
827
828
|
const type = param.type;
|
|
828
829
|
let injectedType = '';
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.0-
|
|
3
|
+
* @license Angular v19.2.0-rc.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-2eecc677.js');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
require('os');
|
|
12
12
|
var assert = require('assert');
|
|
13
|
-
var index = require('./index-
|
|
14
|
-
var
|
|
15
|
-
var leading_space = require('./leading_space-
|
|
16
|
-
require('./program-
|
|
13
|
+
var index = require('./index-24a2ad1e.js');
|
|
14
|
+
var project_paths = require('./project_paths-b073c4d6.js');
|
|
15
|
+
var leading_space = require('./leading_space-d190b83b.js');
|
|
16
|
+
require('./program-24da9092.js');
|
|
17
17
|
require('path');
|
|
18
18
|
|
|
19
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -915,7 +915,7 @@ function removeFromUnionIfPossible(union, filter) {
|
|
|
915
915
|
*/
|
|
916
916
|
function insertPrecedingLine(node, info, text) {
|
|
917
917
|
const leadingSpace = leading_space.getLeadingLineWhitespaceOfNode(node);
|
|
918
|
-
return new
|
|
918
|
+
return new project_paths.Replacement(project_paths.projectFile(node.getSourceFile(), info), new project_paths.TextUpdate({
|
|
919
919
|
position: node.getStart(),
|
|
920
920
|
end: node.getStart(),
|
|
921
921
|
toInsert: `${text}\n${leadingSpace}`,
|
|
@@ -1256,20 +1256,20 @@ function createNewBlockToInsertVariable(node, file, toInsert) {
|
|
|
1256
1256
|
const contentSpace = ' '.repeat(character + 2);
|
|
1257
1257
|
return [
|
|
1258
1258
|
// Delete leading whitespace of the concise body.
|
|
1259
|
-
new
|
|
1259
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1260
1260
|
position: node.body.getFullStart(),
|
|
1261
1261
|
end: node.body.getStart(),
|
|
1262
1262
|
toInsert: '',
|
|
1263
1263
|
})),
|
|
1264
1264
|
// Insert leading block braces, and `toInsert` content.
|
|
1265
1265
|
// Wrap the previous expression in a return now.
|
|
1266
|
-
new
|
|
1266
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1267
1267
|
position: node.body.getStart(),
|
|
1268
1268
|
end: node.body.getStart(),
|
|
1269
1269
|
toInsert: ` {\n${contentSpace}${toInsert}\n${contentSpace}return `,
|
|
1270
1270
|
})),
|
|
1271
1271
|
// Add trailing brace.
|
|
1272
|
-
new
|
|
1272
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1273
1273
|
position: node.body.getEnd(),
|
|
1274
1274
|
end: node.body.getEnd(),
|
|
1275
1275
|
toInsert: `;\n${blockSpace}}`,
|
|
@@ -1299,7 +1299,7 @@ function migrateBindingElementInputReference(tsReferencesInBindingElements, info
|
|
|
1299
1299
|
const bindingElement = reference.parent;
|
|
1300
1300
|
const bindingDecl = index.getBindingElementDeclaration(bindingElement);
|
|
1301
1301
|
const sourceFile = bindingElement.getSourceFile();
|
|
1302
|
-
const file =
|
|
1302
|
+
const file = project_paths.projectFile(sourceFile, info);
|
|
1303
1303
|
const inputFieldName = bindingElement.propertyName ?? bindingElement.name;
|
|
1304
1304
|
assert__default["default"](!ts__default["default"].isObjectBindingPattern(inputFieldName) && !ts__default["default"].isArrayBindingPattern(inputFieldName), 'Property of binding element cannot be another pattern.');
|
|
1305
1305
|
const tmpName = nameGenerator.generate(reference.text, bindingElement);
|
|
@@ -1317,7 +1317,7 @@ function migrateBindingElementInputReference(tsReferencesInBindingElements, info
|
|
|
1317
1317
|
console.error(`Could not migrate reference ${reference.text} in ${file.rootRelativePath}`);
|
|
1318
1318
|
continue;
|
|
1319
1319
|
}
|
|
1320
|
-
replacements.push(new
|
|
1320
|
+
replacements.push(new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1321
1321
|
position: bindingElement.getStart(),
|
|
1322
1322
|
end: bindingElement.getEnd(),
|
|
1323
1323
|
toInsert: printer.printNode(ts__default["default"].EmitHint.Unspecified, newBindingToAccessInputField, sourceFile),
|
|
@@ -1342,7 +1342,7 @@ function insertTemporaryVariableForBindingElement(expansionDecl, file, toInsert)
|
|
|
1342
1342
|
const leadingSpace = ' '.repeat(leadingSpaceCount);
|
|
1343
1343
|
const statement = parent.parent;
|
|
1344
1344
|
return [
|
|
1345
|
-
new
|
|
1345
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1346
1346
|
position: statement.getEnd(),
|
|
1347
1347
|
end: statement.getEnd(),
|
|
1348
1348
|
toInsert: `\n${leadingSpace}${toInsert}`,
|
|
@@ -1360,7 +1360,7 @@ function insertTemporaryVariableForBindingElement(expansionDecl, file, toInsert)
|
|
|
1360
1360
|
const leadingSpaceCount = ts__default["default"].getLineAndCharacterOfPosition(sf, spaceReferenceNode.getStart()).character + spaceOffset;
|
|
1361
1361
|
const leadingSpace = ' '.repeat(leadingSpaceCount);
|
|
1362
1362
|
return [
|
|
1363
|
-
new
|
|
1363
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1364
1364
|
position: bodyBlock.getStart() + 1,
|
|
1365
1365
|
end: bodyBlock.getStart() + 1,
|
|
1366
1366
|
toInsert: `\n${leadingSpace}${toInsert}`,
|
|
@@ -1761,7 +1761,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1761
1761
|
// Unwrap the signal directly.
|
|
1762
1762
|
if (recommendedNode === 'preserve') {
|
|
1763
1763
|
// Append `()` to unwrap the signal.
|
|
1764
|
-
replacements.push(new
|
|
1764
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1765
1765
|
position: originalNode.getEnd(),
|
|
1766
1766
|
end: originalNode.getEnd(),
|
|
1767
1767
|
toInsert: '()',
|
|
@@ -1775,7 +1775,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1775
1775
|
const toInsert = idToSharedField.get(recommendedNode);
|
|
1776
1776
|
const replaceNode = index.traverseAccess(originalNode);
|
|
1777
1777
|
assert__default["default"](toInsert, 'no shared variable yet available');
|
|
1778
|
-
replacements.push(new
|
|
1778
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1779
1779
|
position: replaceNode.getStart(),
|
|
1780
1780
|
end: replaceNode.getEnd(),
|
|
1781
1781
|
toInsert,
|
|
@@ -1795,7 +1795,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1795
1795
|
parent = parent.parent;
|
|
1796
1796
|
}
|
|
1797
1797
|
const replaceNode = index.traverseAccess(originalNode);
|
|
1798
|
-
const filePath =
|
|
1798
|
+
const filePath = project_paths.projectFile(sf, info);
|
|
1799
1799
|
const initializer = `${replaceNode.getText()}()`;
|
|
1800
1800
|
const fieldName = nameGenerator.generate(originalNode.text, referenceNodeInBlock);
|
|
1801
1801
|
let sharedValueAccessExpr;
|
|
@@ -1817,13 +1817,13 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1817
1817
|
}
|
|
1818
1818
|
else {
|
|
1819
1819
|
const leadingSpace = ts__default["default"].getLineAndCharacterOfPosition(sf, referenceNodeInBlock.getStart());
|
|
1820
|
-
replacements.push(new
|
|
1820
|
+
replacements.push(new project_paths.Replacement(filePath, new project_paths.TextUpdate({
|
|
1821
1821
|
position: referenceNodeInBlock.getStart(),
|
|
1822
1822
|
end: referenceNodeInBlock.getStart(),
|
|
1823
1823
|
toInsert: `${temporaryVariableStr}\n${' '.repeat(leadingSpace.character)}`,
|
|
1824
1824
|
})));
|
|
1825
1825
|
}
|
|
1826
|
-
replacements.push(new
|
|
1826
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1827
1827
|
position: replaceNode.getStart(),
|
|
1828
1828
|
end: replaceNode.getEnd(),
|
|
1829
1829
|
toInsert: sharedValueAccessExpr,
|
|
@@ -1932,12 +1932,12 @@ function migrateTypeScriptTypeReferences(host, references, importManager, info)
|
|
|
1932
1932
|
exportSymbolName: 'UnwrapSignalInputs',
|
|
1933
1933
|
requestedFile: sf,
|
|
1934
1934
|
});
|
|
1935
|
-
host.replacements.push(new
|
|
1935
|
+
host.replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1936
1936
|
position: firstArg.getStart(),
|
|
1937
1937
|
end: firstArg.getStart(),
|
|
1938
1938
|
toInsert: `${host.printer.printNode(ts__default["default"].EmitHint.Unspecified, unwrapImportExpr, sf)}<`,
|
|
1939
1939
|
})));
|
|
1940
|
-
host.replacements.push(new
|
|
1940
|
+
host.replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({ position: firstArg.getEnd(), end: firstArg.getEnd(), toInsert: '>' })));
|
|
1941
1941
|
}
|
|
1942
1942
|
}
|
|
1943
1943
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.0-
|
|
3
|
+
* @license Angular v19.2.0-rc.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-abe29092.js');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -40,17 +40,4 @@ function getAngularDecorators(typeChecker, decorators) {
|
|
|
40
40
|
}));
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/** Find the closest parent node of a particular kind. */
|
|
44
|
-
function closestNode(node, predicate) {
|
|
45
|
-
let current = node.parent;
|
|
46
|
-
while (current && !ts__default["default"].isSourceFile(current)) {
|
|
47
|
-
if (predicate(current)) {
|
|
48
|
-
return current;
|
|
49
|
-
}
|
|
50
|
-
current = current.parent;
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
exports.closestNode = closestNode;
|
|
56
43
|
exports.getAngularDecorators = getAngularDecorators;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @license Angular v19.2.0-rc.0
|
|
4
|
+
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var ts = require('typescript');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
|
|
14
|
+
|
|
15
|
+
/** Find the closest parent node of a particular kind. */
|
|
16
|
+
function closestNode(node, predicate) {
|
|
17
|
+
let current = node.parent;
|
|
18
|
+
while (current && !ts__default["default"].isSourceFile(current)) {
|
|
19
|
+
if (predicate(current)) {
|
|
20
|
+
return current;
|
|
21
|
+
}
|
|
22
|
+
current = current.parent;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.closestNode = closestNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.0-
|
|
3
|
+
* @license Angular v19.2.0-rc.0
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -9,14 +9,15 @@
|
|
|
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-e9ccccbf.js');
|
|
13
|
+
var project_paths = require('./project_paths-b073c4d6.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-2eecc677.js');
|
|
17
|
+
var program = require('./program-24da9092.js');
|
|
18
18
|
require('path');
|
|
19
|
-
var
|
|
19
|
+
var apply_import_manager = require('./apply_import_manager-a930fcf1.js');
|
|
20
|
+
var index = require('./index-24a2ad1e.js');
|
|
20
21
|
require('@angular-devkit/core');
|
|
21
22
|
require('node:path/posix');
|
|
22
23
|
require('fs');
|
|
@@ -95,7 +96,7 @@ function getOutputDecorator(node, reflector) {
|
|
|
95
96
|
// THINK: this utility + type is not specific to @Output, really, maybe move it to tsurge?
|
|
96
97
|
/** Computes an unique ID for a given Angular `@Output` property. */
|
|
97
98
|
function getUniqueIdForProperty(info, prop) {
|
|
98
|
-
const { id } =
|
|
99
|
+
const { id } = project_paths.projectFile(prop.getSourceFile(), info);
|
|
99
100
|
id.replace(/\.d\.ts$/, '.ts');
|
|
100
101
|
return `${id}@@${prop.parent.name ?? 'unknown-class'}@@${prop.name.getText()}`;
|
|
101
102
|
}
|
|
@@ -174,7 +175,7 @@ function calculateImportReplacements(info, sourceFiles) {
|
|
|
174
175
|
const importManager = new checker.ImportManager();
|
|
175
176
|
const addOnly = [];
|
|
176
177
|
const addRemove = [];
|
|
177
|
-
const file =
|
|
178
|
+
const file = project_paths.projectFile(sf, info);
|
|
178
179
|
importManager.addImport({
|
|
179
180
|
requestedFile: sf,
|
|
180
181
|
exportModuleSpecifier: '@angular/core',
|
|
@@ -230,21 +231,21 @@ function calculatePipeCallReplacement(info, node) {
|
|
|
230
231
|
}
|
|
231
232
|
function prepareTextReplacementForNode(info, node, replacement, start) {
|
|
232
233
|
const sf = node.getSourceFile();
|
|
233
|
-
return new
|
|
234
|
+
return new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
234
235
|
position: start ?? node.getStart(),
|
|
235
236
|
end: node.getEnd(),
|
|
236
237
|
toInsert: replacement,
|
|
237
238
|
}));
|
|
238
239
|
}
|
|
239
240
|
function prepareTextReplacement(file, replacement, start, end) {
|
|
240
|
-
return new
|
|
241
|
+
return new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
241
242
|
position: start,
|
|
242
243
|
end: end,
|
|
243
244
|
toInsert: replacement,
|
|
244
245
|
}));
|
|
245
246
|
}
|
|
246
247
|
|
|
247
|
-
class OutputMigration extends
|
|
248
|
+
class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
248
249
|
config;
|
|
249
250
|
constructor(config = {}) {
|
|
250
251
|
super();
|
|
@@ -295,7 +296,7 @@ class OutputMigration extends apply_import_manager.TsurgeFunnelMigration {
|
|
|
295
296
|
id: getUniqueIdForProperty(info, node),
|
|
296
297
|
aliasParam: outputDecorator.args?.at(0),
|
|
297
298
|
};
|
|
298
|
-
const outputFile =
|
|
299
|
+
const outputFile = project_paths.projectFile(node.getSourceFile(), info);
|
|
299
300
|
if (this.config.shouldMigrate === undefined ||
|
|
300
301
|
this.config.shouldMigrate({
|
|
301
302
|
key: outputDef.id,
|
|
@@ -323,7 +324,7 @@ class OutputMigration extends apply_import_manager.TsurgeFunnelMigration {
|
|
|
323
324
|
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker$1, reflector, dtsReader);
|
|
324
325
|
if (propertyDeclaration !== null) {
|
|
325
326
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
326
|
-
const outputFile =
|
|
327
|
+
const outputFile = project_paths.projectFile(node.getSourceFile(), info);
|
|
327
328
|
addOutputReplacement(outputFieldReplacements, id, outputFile, calculateNextFnReplacement(info, node.expression.name));
|
|
328
329
|
}
|
|
329
330
|
}
|
|
@@ -332,7 +333,7 @@ class OutputMigration extends apply_import_manager.TsurgeFunnelMigration {
|
|
|
332
333
|
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker$1, reflector, dtsReader);
|
|
333
334
|
if (propertyDeclaration !== null) {
|
|
334
335
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
335
|
-
const outputFile =
|
|
336
|
+
const outputFile = project_paths.projectFile(node.getSourceFile(), info);
|
|
336
337
|
if (ts__default["default"].isExpressionStatement(node.parent)) {
|
|
337
338
|
addOutputReplacement(outputFieldReplacements, id, outputFile, calculateCompleteCallReplacement(info, node.parent));
|
|
338
339
|
}
|
|
@@ -351,7 +352,7 @@ class OutputMigration extends apply_import_manager.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 apply_import_manager.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 apply_import_manager.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 apply_import_manager.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 +
|
|
@@ -510,7 +511,7 @@ function migrate(options) {
|
|
|
510
511
|
if (!buildPaths.length && !testPaths.length) {
|
|
511
512
|
throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run output migration.');
|
|
512
513
|
}
|
|
513
|
-
const fs = new
|
|
514
|
+
const fs = new project_paths.DevkitMigrationFilesystem(tree);
|
|
514
515
|
checker.setFileSystem(fs);
|
|
515
516
|
const migration = new OutputMigration({
|
|
516
517
|
shouldMigrate: (_, file) => {
|
|
@@ -540,7 +541,7 @@ function migrate(options) {
|
|
|
540
541
|
context.logger.info(``);
|
|
541
542
|
context.logger.info(`Processing analysis data between targets..`);
|
|
542
543
|
context.logger.info(``);
|
|
543
|
-
const combined = await
|
|
544
|
+
const combined = await project_paths.synchronouslyCombineUnitData(migration, unitResults);
|
|
544
545
|
if (combined === null) {
|
|
545
546
|
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
546
547
|
return;
|
|
@@ -550,7 +551,7 @@ function migrate(options) {
|
|
|
550
551
|
for (const { info, tsconfigPath } of programInfos) {
|
|
551
552
|
context.logger.info(`Migrating: ${tsconfigPath}..`);
|
|
552
553
|
const { replacements } = await migration.migrate(globalMeta);
|
|
553
|
-
const changesPerFile =
|
|
554
|
+
const changesPerFile = project_paths.groupReplacementsByFile(replacements);
|
|
554
555
|
for (const [file, changes] of changesPerFile) {
|
|
555
556
|
if (!replacementsPerFile.has(file)) {
|
|
556
557
|
replacementsPerFile.set(file, changes);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.0-
|
|
3
|
+
* @license Angular v19.2.0-rc.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-e9ccccbf.js');
|
|
14
|
+
var compiler_host = require('./compiler_host-c280a924.js');
|
|
15
15
|
var ts = require('typescript');
|
|
16
|
-
var imports = require('./imports-
|
|
16
|
+
var imports = require('./imports-abe29092.js');
|
|
17
17
|
require('@angular-devkit/core');
|
|
18
|
-
require('./checker-
|
|
18
|
+
require('./checker-2eecc677.js');
|
|
19
19
|
require('os');
|
|
20
20
|
require('fs');
|
|
21
21
|
require('module');
|