@angular/core 20.0.0-next.4 → 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-DQLNOR5l.d.ts +297 -0
- package/discovery.d-CFs2MaLO.d.ts +7383 -0
- package/{event_dispatcher.d-pVP0-wST.d.ts → event_dispatcher.d-DlbccpYq.d.ts} +3 -2
- package/fesm2022/attribute-BWp59EjE.mjs +24 -0
- package/fesm2022/attribute-BWp59EjE.mjs.map +1 -0
- package/fesm2022/core.mjs +586 -36873
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/debug_node-z_3NG8qT.mjs +32079 -0
- package/fesm2022/debug_node-z_3NG8qT.mjs.map +1 -0
- package/fesm2022/primitives/di.mjs +18 -4
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +2 -16
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +5 -3
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/resource-CPPwEcg7.mjs +619 -0
- package/fesm2022/resource-CPPwEcg7.mjs.map +1 -0
- package/fesm2022/root_effect_scheduler-VSXfCzDX.mjs +3847 -0
- package/fesm2022/root_effect_scheduler-VSXfCzDX.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +16 -9
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/{untracked-DkcXpNb_.mjs → signal-B6pMq7KS.mjs} +16 -114
- package/fesm2022/signal-B6pMq7KS.mjs.map +1 -0
- package/fesm2022/testing.mjs +265 -201
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/untracked-Bz5WMeU1.mjs +117 -0
- package/fesm2022/untracked-Bz5WMeU1.mjs.map +1 -0
- package/fesm2022/weak_ref-BaIq-pgY.mjs +12 -0
- package/fesm2022/weak_ref-BaIq-pgY.mjs.map +1 -0
- package/{weak_ref.d-BZ7gyRag.d.ts → graph.d-BcIOep_B.d.ts} +3 -24
- package/index.d.ts +2624 -10909
- package/ng_i18n_closure_mode.d-C9d2CaSt.d.ts +832 -0
- package/package.json +3 -3
- package/primitives/di/index.d.ts +3 -2
- package/primitives/event-dispatch/index.d.ts +3 -3
- package/primitives/signals/index.d.ts +8 -4
- package/rxjs-interop/index.d.ts +10 -7
- package/schematics/bundles/{apply_import_manager-CeNv8GIG.js → apply_import_manager-DnMqg1pY.js} +6 -6
- package/schematics/bundles/{compiler_host-DwM3ugW3.js → change_tracker-UMPkv-eH.js} +3 -121
- package/schematics/bundles/checker-BFBQyesT.js +17719 -0
- package/schematics/bundles/cleanup-unused-imports.js +25 -19
- package/schematics/bundles/{checker-k591b6WQ.js → compiler-BQ7R7w2v.js} +1325 -18286
- package/schematics/bundles/compiler_host-CAfDJO3W.js +129 -0
- package/schematics/bundles/control-flow-migration.js +28 -40
- package/schematics/bundles/document-core.js +96 -0
- package/schematics/bundles/imports-CIX-JgAN.js +1 -1
- package/schematics/bundles/{index-B4OAlHh8.js → index-Cv4Q415G.js} +641 -547
- package/schematics/bundles/{index-BhELUmYx.js → index-D8tMJPKa.js} +35 -34
- package/schematics/bundles/inject-flags.js +14 -13
- package/schematics/bundles/inject-migration.js +29 -10
- package/schematics/bundles/leading_space-D9nQ8UQC.js +1 -1
- package/schematics/bundles/{migrate_ts_type_references-Be0TNYen.js → migrate_ts_type_references-Cq_ZBuT4.js} +21 -20
- package/schematics/bundles/ng_decorators-DznZ5jMl.js +1 -1
- package/schematics/bundles/nodes-B16H9JUd.js +1 -1
- package/schematics/bundles/output-migration.js +88 -25
- package/schematics/bundles/{run_in_devkit-CkvEksWP.js → project_paths-ql6qcf_c.js} +254 -243
- 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 +7 -5
- package/schematics/bundles/self-closing-tags-migration.js +25 -19
- package/schematics/bundles/signal-input-migration.js +26 -20
- package/schematics/bundles/signal-queries-migration.js +51 -33
- package/schematics/bundles/signals.js +8 -7
- package/schematics/bundles/standalone-migration.js +11 -9
- package/schematics/bundles/symbol-VPWguRxr.js +1 -1
- package/schematics/bundles/test-bed-get.js +13 -12
- package/schematics/collection.json +0 -6
- package/schematics/migrations.json +11 -0
- package/signal.d-E0e5nW1p.d.ts +31 -0
- package/testing/index.d.ts +16 -28
- package/weak_ref.d-eGOEP9S1.d.ts +9 -0
- package/fesm2022/injector-BlLwZ2sr.mjs +0 -24
- package/fesm2022/injector-BlLwZ2sr.mjs.map +0 -1
- package/fesm2022/untracked-DkcXpNb_.mjs.map +0 -1
- package/navigation_types.d-DgDrF5rp.d.ts +0 -121
- package/schematics/ng-generate/control-flow-migration/schema.json +0 -20
|
@@ -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,10 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var checker = require('./checker-
|
|
12
|
-
var
|
|
11
|
+
var checker = require('./checker-BFBQyesT.js');
|
|
12
|
+
var compiler = require('./compiler-BQ7R7w2v.js');
|
|
13
|
+
var index = require('./index-Cv4Q415G.js');
|
|
13
14
|
require('path');
|
|
14
|
-
var
|
|
15
|
+
var project_paths = require('./project_paths-ql6qcf_c.js');
|
|
15
16
|
|
|
16
17
|
function getMemberName(member) {
|
|
17
18
|
if (member.name === undefined) {
|
|
@@ -188,7 +189,7 @@ function lookupPropertyAccess(checker, type, path, options = {}) {
|
|
|
188
189
|
* This resolution is important to be able to migrate references to inputs
|
|
189
190
|
* that will be migrated to signal inputs.
|
|
190
191
|
*/
|
|
191
|
-
class TemplateReferenceVisitor extends
|
|
192
|
+
class TemplateReferenceVisitor extends compiler.RecursiveVisitor {
|
|
192
193
|
result = [];
|
|
193
194
|
/**
|
|
194
195
|
* Whether we are currently descending into HTML AST nodes
|
|
@@ -235,21 +236,21 @@ class TemplateReferenceVisitor extends checker.RecursiveVisitor$1 {
|
|
|
235
236
|
// of signal calls in templates.
|
|
236
237
|
// TODO: Remove with: https://github.com/angular/angular/pull/55456.
|
|
237
238
|
this.templateAttributeReferencedFields = [];
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
compiler.visitAll(this, template.attributes);
|
|
240
|
+
compiler.visitAll(this, template.templateAttrs);
|
|
240
241
|
// If we are dealing with a microsyntax template, do not check
|
|
241
242
|
// inputs and outputs as those are already passed to the children.
|
|
242
243
|
// Template attributes may contain relevant expressions though.
|
|
243
244
|
if (template.tagName === 'ng-template') {
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
compiler.visitAll(this, template.inputs);
|
|
246
|
+
compiler.visitAll(this, template.outputs);
|
|
246
247
|
}
|
|
247
248
|
const referencedInputs = this.templateAttributeReferencedFields;
|
|
248
249
|
this.templateAttributeReferencedFields = null;
|
|
249
250
|
this.descendAndCheckForNarrowedSimilarReferences(referencedInputs, () => {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
compiler.visitAll(this, template.children);
|
|
252
|
+
compiler.visitAll(this, template.references);
|
|
253
|
+
compiler.visitAll(this, template.variables);
|
|
253
254
|
});
|
|
254
255
|
}
|
|
255
256
|
visitIfBlockBranch(block) {
|
|
@@ -316,7 +317,7 @@ class TemplateReferenceVisitor extends checker.RecursiveVisitor$1 {
|
|
|
316
317
|
* This resolution is important to be able to migrate references to inputs
|
|
317
318
|
* that will be migrated to signal inputs.
|
|
318
319
|
*/
|
|
319
|
-
class TemplateExpressionReferenceVisitor extends
|
|
320
|
+
class TemplateExpressionReferenceVisitor extends compiler.RecursiveAstVisitor {
|
|
320
321
|
typeChecker;
|
|
321
322
|
templateTypeChecker;
|
|
322
323
|
componentClass;
|
|
@@ -382,7 +383,7 @@ class TemplateExpressionReferenceVisitor extends checker.RecursiveAstVisitor {
|
|
|
382
383
|
!this.fieldNamesToConsiderForReferenceLookup.has(ast.name)) {
|
|
383
384
|
return;
|
|
384
385
|
}
|
|
385
|
-
const isWrite = !!(ast instanceof
|
|
386
|
+
const isWrite = !!(ast instanceof compiler.PropertyWrite ||
|
|
386
387
|
(this.activeTmplAstNode && isTwoWayBindingNode(this.activeTmplAstNode)));
|
|
387
388
|
this._checkAccessViaTemplateTypeCheckBlock(ast, isWrite, astPath) ||
|
|
388
389
|
this._checkAccessViaOwningComponentClassType(ast, isWrite, astPath);
|
|
@@ -459,9 +460,9 @@ class TemplateExpressionReferenceVisitor extends checker.RecursiveAstVisitor {
|
|
|
459
460
|
_isPartOfNarrowingTernary(read) {
|
|
460
461
|
// Note: We do not safe check that the reads are fully matching 1:1. This is acceptable
|
|
461
462
|
// as worst case we just skip an input from being migrated. This is very unlikely too.
|
|
462
|
-
return this.insideConditionalExpressionsWithReads.some((r) => (r instanceof
|
|
463
|
-
r instanceof
|
|
464
|
-
r instanceof
|
|
463
|
+
return this.insideConditionalExpressionsWithReads.some((r) => (r instanceof compiler.PropertyRead ||
|
|
464
|
+
r instanceof compiler.PropertyWrite ||
|
|
465
|
+
r instanceof compiler.SafePropertyRead) &&
|
|
465
466
|
r.name === read.name);
|
|
466
467
|
}
|
|
467
468
|
}
|
|
@@ -469,18 +470,18 @@ class TemplateExpressionReferenceVisitor extends checker.RecursiveAstVisitor {
|
|
|
469
470
|
* Emulates an access to a given field using the TypeScript `ts.Type`
|
|
470
471
|
* of the given class. The resolved symbol of the access is returned.
|
|
471
472
|
*/
|
|
472
|
-
function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker
|
|
473
|
+
function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker) {
|
|
473
474
|
const path = [readOrWrite.name];
|
|
474
475
|
let node = readOrWrite;
|
|
475
|
-
while (node.receiver instanceof
|
|
476
|
+
while (node.receiver instanceof compiler.PropertyRead || node.receiver instanceof compiler.PropertyWrite) {
|
|
476
477
|
node = node.receiver;
|
|
477
478
|
path.unshift(node.name);
|
|
478
479
|
}
|
|
479
|
-
if (!(node.receiver instanceof
|
|
480
|
+
if (!(node.receiver instanceof compiler.ImplicitReceiver || node.receiver instanceof compiler.ThisReceiver)) {
|
|
480
481
|
return null;
|
|
481
482
|
}
|
|
482
|
-
const classType = checker
|
|
483
|
-
return (lookupPropertyAccess(checker
|
|
483
|
+
const classType = checker.getTypeAtLocation(componentClass.name);
|
|
484
|
+
return (lookupPropertyAccess(checker, classType, path, {
|
|
484
485
|
// Necessary to avoid breaking the resolution if there is
|
|
485
486
|
// some narrowing involved. E.g. `myClass ? myClass.input`.
|
|
486
487
|
ignoreNullability: true,
|
|
@@ -488,8 +489,8 @@ function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker$1)
|
|
|
488
489
|
}
|
|
489
490
|
/** Whether the given node refers to a two-way binding AST node. */
|
|
490
491
|
function isTwoWayBindingNode(node) {
|
|
491
|
-
return ((node instanceof
|
|
492
|
-
(node instanceof
|
|
492
|
+
return ((node instanceof compiler.BoundAttribute && node.type === compiler.BindingType.TwoWay) ||
|
|
493
|
+
(node instanceof compiler.BoundEvent && node.type === compiler.ParsedEventType.TwoWay));
|
|
493
494
|
}
|
|
494
495
|
|
|
495
496
|
/** Possible types of references to known fields detected. */
|
|
@@ -581,11 +582,11 @@ function identifyHostBindingReferences(node, programInfo, checker$1, reflector,
|
|
|
581
582
|
if (!isPropertyBinding && !isEventBinding) {
|
|
582
583
|
continue;
|
|
583
584
|
}
|
|
584
|
-
const parser =
|
|
585
|
-
const sourceSpan = new
|
|
585
|
+
const parser = compiler.makeBindingParser();
|
|
586
|
+
const sourceSpan = new compiler.ParseSourceSpan(
|
|
586
587
|
// Fake source span to keep parsing offsets zero-based.
|
|
587
588
|
// We then later combine these with the expression TS node offsets.
|
|
588
|
-
new
|
|
589
|
+
new compiler.ParseLocation({ content: '', url: '' }, 0, 0, 0), new compiler.ParseLocation({ content: '', url: '' }, 0, 0, 0));
|
|
589
590
|
const name = rawName.substring(1, rawName.length - 1);
|
|
590
591
|
let parsed = undefined;
|
|
591
592
|
if (isEventBinding) {
|
|
@@ -611,7 +612,7 @@ function identifyHostBindingReferences(node, programInfo, checker$1, reflector,
|
|
|
611
612
|
readAstPath: ref.readAstPath,
|
|
612
613
|
isObjectShorthandExpression: ref.isObjectShorthandExpression,
|
|
613
614
|
isWrite: ref.isWrite,
|
|
614
|
-
file:
|
|
615
|
+
file: project_paths.projectFile(ref.context.getSourceFile(), programInfo),
|
|
615
616
|
hostPropertyNode: ref.context,
|
|
616
617
|
},
|
|
617
618
|
target: ref.targetField,
|
|
@@ -649,7 +650,7 @@ function attemptExtractTemplateDefinition(node, checker$1, reflector, resourceLo
|
|
|
649
650
|
return {
|
|
650
651
|
isInline: true,
|
|
651
652
|
expression: templateProp,
|
|
652
|
-
interpolationConfig:
|
|
653
|
+
interpolationConfig: compiler.DEFAULT_INTERPOLATION_CONFIG,
|
|
653
654
|
preserveWhitespaces: false,
|
|
654
655
|
resolvedTemplateUrl: containingFile,
|
|
655
656
|
templateUrl: containingFile,
|
|
@@ -663,7 +664,7 @@ function attemptExtractTemplateDefinition(node, checker$1, reflector, resourceLo
|
|
|
663
664
|
if (typeof templateUrl === 'string') {
|
|
664
665
|
return {
|
|
665
666
|
isInline: false,
|
|
666
|
-
interpolationConfig:
|
|
667
|
+
interpolationConfig: compiler.DEFAULT_INTERPOLATION_CONFIG,
|
|
667
668
|
preserveWhitespaces: false,
|
|
668
669
|
templateUrlExpression: templateUrlProp,
|
|
669
670
|
templateUrl,
|
|
@@ -711,8 +712,8 @@ function identifyTemplateReferences(programInfo, node, reflector, checker$1, eva
|
|
|
711
712
|
readAstPath: res.readAstPath,
|
|
712
713
|
node: res.context,
|
|
713
714
|
isObjectShorthandExpression: res.isObjectShorthandExpression,
|
|
714
|
-
originatingTsFile:
|
|
715
|
-
templateFile:
|
|
715
|
+
originatingTsFile: project_paths.projectFile(node.getSourceFile(), programInfo),
|
|
716
|
+
templateFile: project_paths.projectFile(checker.absoluteFrom(templateFilePath), programInfo),
|
|
716
717
|
isLikelyPartOfNarrowing: res.isLikelyNarrowed,
|
|
717
718
|
isWrite: res.isWrite,
|
|
718
719
|
},
|
|
@@ -894,7 +895,7 @@ function identifyPotentialTypeScriptReference(node, programInfo, checker, knownF
|
|
|
894
895
|
kind: exports.ReferenceKind.TsReference,
|
|
895
896
|
from: {
|
|
896
897
|
node,
|
|
897
|
-
file:
|
|
898
|
+
file: project_paths.projectFile(node.getSourceFile(), programInfo),
|
|
898
899
|
isWrite: isWriteReference,
|
|
899
900
|
isPartOfElementBinding: ts.isBindingElement(node.parent),
|
|
900
901
|
},
|
|
@@ -958,7 +959,7 @@ function createFindAllSourceFileReferencesVisitor(programInfo, checker, reflecto
|
|
|
958
959
|
result.references.push({
|
|
959
960
|
kind: exports.ReferenceKind.TsClassTypeReference,
|
|
960
961
|
from: {
|
|
961
|
-
file:
|
|
962
|
+
file: project_paths.projectFile(partialDirectiveInCatalyst.referenceNode.getSourceFile(), programInfo),
|
|
962
963
|
node: partialDirectiveInCatalyst.referenceNode,
|
|
963
964
|
},
|
|
964
965
|
isPartialReference: true,
|
|
@@ -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,11 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var checker = require('./checker-
|
|
12
|
-
require('./
|
|
11
|
+
var checker = require('./checker-BFBQyesT.js');
|
|
12
|
+
require('./compiler-BQ7R7w2v.js');
|
|
13
|
+
require('./index-Cv4Q415G.js');
|
|
13
14
|
require('path');
|
|
14
|
-
var
|
|
15
|
-
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');
|
|
16
17
|
var imports = require('./imports-CIX-JgAN.js');
|
|
17
18
|
require('@angular-devkit/core');
|
|
18
19
|
require('node:path/posix');
|
|
@@ -31,7 +32,7 @@ const FLAGS_TO_FIELDS = {
|
|
|
31
32
|
'SkipSelf': 'skipSelf',
|
|
32
33
|
};
|
|
33
34
|
/** Migration that replaces `InjectFlags` usages with object literals. */
|
|
34
|
-
class InjectFlagsMigration extends
|
|
35
|
+
class InjectFlagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
35
36
|
async analyze(info) {
|
|
36
37
|
const locations = {};
|
|
37
38
|
const importRemovals = {};
|
|
@@ -40,7 +41,7 @@ class InjectFlagsMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
40
41
|
if (specifier === null) {
|
|
41
42
|
continue;
|
|
42
43
|
}
|
|
43
|
-
const file =
|
|
44
|
+
const file = project_paths.projectFile(sourceFile, info);
|
|
44
45
|
const importManager = new checker.ImportManager();
|
|
45
46
|
const importReplacements = [];
|
|
46
47
|
// Always remove the `InjectFlags` since it has been removed from Angular.
|
|
@@ -72,7 +73,7 @@ class InjectFlagsMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
72
73
|
}
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
|
-
return
|
|
76
|
+
return project_paths.confirmAsSerializable({ locations, importRemovals });
|
|
76
77
|
}
|
|
77
78
|
async migrate(globalData) {
|
|
78
79
|
const replacements = [];
|
|
@@ -83,12 +84,12 @@ class InjectFlagsMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
83
84
|
// Declare a property for each flag, except for `default` which does not have a flag.
|
|
84
85
|
const properties = flags.filter((flag) => flag !== 'default').map((flag) => `${flag}: true`);
|
|
85
86
|
const toInsert = properties.length ? `{ ${properties.join(', ')} }` : '{}';
|
|
86
|
-
replacements.push(new
|
|
87
|
+
replacements.push(new project_paths.Replacement(file, new project_paths.TextUpdate({ position, end, toInsert })));
|
|
87
88
|
}
|
|
88
|
-
return
|
|
89
|
+
return project_paths.confirmAsSerializable({ replacements });
|
|
89
90
|
}
|
|
90
91
|
async combine(unitA, unitB) {
|
|
91
|
-
return
|
|
92
|
+
return project_paths.confirmAsSerializable({
|
|
92
93
|
locations: {
|
|
93
94
|
...unitA.locations,
|
|
94
95
|
...unitB.locations,
|
|
@@ -100,7 +101,7 @@ class InjectFlagsMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
103
|
async globalMeta(combinedData) {
|
|
103
|
-
return
|
|
104
|
+
return project_paths.confirmAsSerializable(combinedData);
|
|
104
105
|
}
|
|
105
106
|
async stats() {
|
|
106
107
|
return { counters: {} };
|
|
@@ -137,7 +138,7 @@ function getInjectFlagsRootExpression(start) {
|
|
|
137
138
|
|
|
138
139
|
function migrate() {
|
|
139
140
|
return async (tree) => {
|
|
140
|
-
await
|
|
141
|
+
await project_paths.runMigrationInDevkit({
|
|
141
142
|
tree,
|
|
142
143
|
getMigration: () => new InjectFlagsMigration(),
|
|
143
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,13 +8,15 @@
|
|
|
8
8
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
10
|
var p = require('path');
|
|
11
|
-
var
|
|
11
|
+
var change_tracker = require('./change_tracker-UMPkv-eH.js');
|
|
12
|
+
var compiler_host = require('./compiler_host-CAfDJO3W.js');
|
|
12
13
|
var ts = require('typescript');
|
|
13
14
|
var ng_decorators = require('./ng_decorators-DznZ5jMl.js');
|
|
14
15
|
var imports = require('./imports-CIX-JgAN.js');
|
|
15
16
|
var nodes = require('./nodes-B16H9JUd.js');
|
|
16
17
|
var leading_space = require('./leading_space-D9nQ8UQC.js');
|
|
17
|
-
require('./
|
|
18
|
+
require('./compiler-BQ7R7w2v.js');
|
|
19
|
+
require('./checker-BFBQyesT.js');
|
|
18
20
|
require('os');
|
|
19
21
|
require('fs');
|
|
20
22
|
require('module');
|
|
@@ -235,9 +237,20 @@ function getSuperParameters(declaration, superCall, localTypeChecker) {
|
|
|
235
237
|
if (ts.isParameter(decl) && topLevelParameters.has(decl)) {
|
|
236
238
|
usedParams.add(decl);
|
|
237
239
|
}
|
|
240
|
+
else if (ts.isShorthandPropertyAssignment(decl) &&
|
|
241
|
+
topLevelParameterNames.has(decl.name.text)) {
|
|
242
|
+
for (const param of topLevelParameters) {
|
|
243
|
+
if (ts.isIdentifier(param.name) && decl.name.text === param.name.text) {
|
|
244
|
+
usedParams.add(param);
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
238
249
|
});
|
|
250
|
+
// Parameters referenced inside callbacks can be used directly
|
|
251
|
+
// within `super` so don't descend into inline functions.
|
|
239
252
|
}
|
|
240
|
-
else {
|
|
253
|
+
else if (!isInlineFunction(node)) {
|
|
241
254
|
node.forEachChild(walk);
|
|
242
255
|
}
|
|
243
256
|
});
|
|
@@ -329,6 +342,10 @@ function findSuperCall(root) {
|
|
|
329
342
|
});
|
|
330
343
|
return result;
|
|
331
344
|
}
|
|
345
|
+
/** Checks whether a node is an inline function. */
|
|
346
|
+
function isInlineFunction(node) {
|
|
347
|
+
return (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isArrowFunction(node));
|
|
348
|
+
}
|
|
332
349
|
|
|
333
350
|
/*!
|
|
334
351
|
* @license
|
|
@@ -573,9 +590,7 @@ function isInsideInlineFunction(startNode, boundary) {
|
|
|
573
590
|
if (current === boundary) {
|
|
574
591
|
return false;
|
|
575
592
|
}
|
|
576
|
-
if (
|
|
577
|
-
ts.isFunctionExpression(current) ||
|
|
578
|
-
ts.isArrowFunction(current)) {
|
|
593
|
+
if (isInlineFunction(current)) {
|
|
579
594
|
return true;
|
|
580
595
|
}
|
|
581
596
|
current = current.parent;
|
|
@@ -605,7 +620,7 @@ function migrateFile(sourceFile, options) {
|
|
|
605
620
|
return [];
|
|
606
621
|
}
|
|
607
622
|
const printer = ts.createPrinter();
|
|
608
|
-
const tracker = new
|
|
623
|
+
const tracker = new change_tracker.ChangeTracker(printer);
|
|
609
624
|
analysis.classes.forEach(({ node, constructor, superCall }) => {
|
|
610
625
|
const memberIndentation = leading_space.getLeadingLineWhitespaceOfNode(node.members[0]);
|
|
611
626
|
const prependToClass = [];
|
|
@@ -1098,16 +1113,20 @@ function applyInternalOnlyChanges(node, constructor, localTypeChecker, tracker,
|
|
|
1098
1113
|
}
|
|
1099
1114
|
result.toCombine.forEach(({ declaration, initializer }) => {
|
|
1100
1115
|
const initializerStatement = nodes.closestNode(initializer, ts.isStatement);
|
|
1101
|
-
const newProperty = ts.factory.createPropertyDeclaration(cloneModifiers(declaration.modifiers), cloneName(declaration.name), declaration.questionToken, declaration.type, initializer);
|
|
1102
1116
|
// If the initialization order is being preserved, we have to remove the original
|
|
1103
1117
|
// declaration and re-declare it. Otherwise we can do the replacement in-place.
|
|
1104
1118
|
if (preserveInitOrder) {
|
|
1119
|
+
// Preserve comment in the new property since we are removing the entire node.
|
|
1120
|
+
const newProperty = ts.factory.createPropertyDeclaration(declaration.modifiers, declaration.name, declaration.questionToken, declaration.type, initializer);
|
|
1105
1121
|
tracker.removeNode(declaration, true);
|
|
1106
1122
|
removedMembers.add(declaration);
|
|
1107
1123
|
afterInjectCalls.push(memberIndentation +
|
|
1108
1124
|
printer.printNode(ts.EmitHint.Unspecified, newProperty, declaration.getSourceFile()));
|
|
1109
1125
|
}
|
|
1110
1126
|
else {
|
|
1127
|
+
// Strip comments from the declaration since we are replacing just
|
|
1128
|
+
// the node, not the leading comment.
|
|
1129
|
+
const newProperty = ts.factory.createPropertyDeclaration(cloneModifiers(declaration.modifiers), cloneName(declaration.name), declaration.questionToken, declaration.type, initializer);
|
|
1111
1130
|
tracker.replaceNode(declaration, newProperty);
|
|
1112
1131
|
}
|
|
1113
1132
|
// This should always be defined, but null check it just in case.
|
|
@@ -1130,7 +1149,7 @@ function applyInternalOnlyChanges(node, constructor, localTypeChecker, tracker,
|
|
|
1130
1149
|
function migrate(options) {
|
|
1131
1150
|
return async (tree) => {
|
|
1132
1151
|
const basePath = process.cwd();
|
|
1133
|
-
const pathToMigrate =
|
|
1152
|
+
const pathToMigrate = change_tracker.normalizePath(p.join(basePath, options.path));
|
|
1134
1153
|
let allPaths = [];
|
|
1135
1154
|
if (pathToMigrate.trim() !== '') {
|
|
1136
1155
|
allPaths.push(pathToMigrate);
|
|
@@ -1,19 +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
|
-
|
|
9
|
+
require('./compiler-BQ7R7w2v.js');
|
|
10
10
|
var ts = require('typescript');
|
|
11
|
+
var checker = require('./checker-BFBQyesT.js');
|
|
11
12
|
require('os');
|
|
12
13
|
var assert = require('assert');
|
|
13
|
-
var index = require('./index-
|
|
14
|
-
var
|
|
14
|
+
var index = require('./index-D8tMJPKa.js');
|
|
15
|
+
var project_paths = require('./project_paths-ql6qcf_c.js');
|
|
15
16
|
var leading_space = require('./leading_space-D9nQ8UQC.js');
|
|
16
|
-
require('./index-
|
|
17
|
+
require('./index-Cv4Q415G.js');
|
|
17
18
|
require('path');
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -912,7 +913,7 @@ function removeFromUnionIfPossible(union, filter) {
|
|
|
912
913
|
*/
|
|
913
914
|
function insertPrecedingLine(node, info, text) {
|
|
914
915
|
const leadingSpace = leading_space.getLeadingLineWhitespaceOfNode(node);
|
|
915
|
-
return new
|
|
916
|
+
return new project_paths.Replacement(project_paths.projectFile(node.getSourceFile(), info), new project_paths.TextUpdate({
|
|
916
917
|
position: node.getStart(),
|
|
917
918
|
end: node.getStart(),
|
|
918
919
|
toInsert: `${text}\n${leadingSpace}`,
|
|
@@ -1253,20 +1254,20 @@ function createNewBlockToInsertVariable(node, file, toInsert) {
|
|
|
1253
1254
|
const contentSpace = ' '.repeat(character + 2);
|
|
1254
1255
|
return [
|
|
1255
1256
|
// Delete leading whitespace of the concise body.
|
|
1256
|
-
new
|
|
1257
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1257
1258
|
position: node.body.getFullStart(),
|
|
1258
1259
|
end: node.body.getStart(),
|
|
1259
1260
|
toInsert: '',
|
|
1260
1261
|
})),
|
|
1261
1262
|
// Insert leading block braces, and `toInsert` content.
|
|
1262
1263
|
// Wrap the previous expression in a return now.
|
|
1263
|
-
new
|
|
1264
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1264
1265
|
position: node.body.getStart(),
|
|
1265
1266
|
end: node.body.getStart(),
|
|
1266
1267
|
toInsert: ` {\n${contentSpace}${toInsert}\n${contentSpace}return `,
|
|
1267
1268
|
})),
|
|
1268
1269
|
// Add trailing brace.
|
|
1269
|
-
new
|
|
1270
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1270
1271
|
position: node.body.getEnd(),
|
|
1271
1272
|
end: node.body.getEnd(),
|
|
1272
1273
|
toInsert: `;\n${blockSpace}}`,
|
|
@@ -1296,7 +1297,7 @@ function migrateBindingElementInputReference(tsReferencesInBindingElements, info
|
|
|
1296
1297
|
const bindingElement = reference.parent;
|
|
1297
1298
|
const bindingDecl = index.getBindingElementDeclaration(bindingElement);
|
|
1298
1299
|
const sourceFile = bindingElement.getSourceFile();
|
|
1299
|
-
const file =
|
|
1300
|
+
const file = project_paths.projectFile(sourceFile, info);
|
|
1300
1301
|
const inputFieldName = bindingElement.propertyName ?? bindingElement.name;
|
|
1301
1302
|
assert(!ts.isObjectBindingPattern(inputFieldName) && !ts.isArrayBindingPattern(inputFieldName), 'Property of binding element cannot be another pattern.');
|
|
1302
1303
|
const tmpName = nameGenerator.generate(reference.text, bindingElement);
|
|
@@ -1314,7 +1315,7 @@ function migrateBindingElementInputReference(tsReferencesInBindingElements, info
|
|
|
1314
1315
|
console.error(`Could not migrate reference ${reference.text} in ${file.rootRelativePath}`);
|
|
1315
1316
|
continue;
|
|
1316
1317
|
}
|
|
1317
|
-
replacements.push(new
|
|
1318
|
+
replacements.push(new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1318
1319
|
position: bindingElement.getStart(),
|
|
1319
1320
|
end: bindingElement.getEnd(),
|
|
1320
1321
|
toInsert: printer.printNode(ts.EmitHint.Unspecified, newBindingToAccessInputField, sourceFile),
|
|
@@ -1339,7 +1340,7 @@ function insertTemporaryVariableForBindingElement(expansionDecl, file, toInsert)
|
|
|
1339
1340
|
const leadingSpace = ' '.repeat(leadingSpaceCount);
|
|
1340
1341
|
const statement = parent.parent;
|
|
1341
1342
|
return [
|
|
1342
|
-
new
|
|
1343
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1343
1344
|
position: statement.getEnd(),
|
|
1344
1345
|
end: statement.getEnd(),
|
|
1345
1346
|
toInsert: `\n${leadingSpace}${toInsert}`,
|
|
@@ -1357,7 +1358,7 @@ function insertTemporaryVariableForBindingElement(expansionDecl, file, toInsert)
|
|
|
1357
1358
|
const leadingSpaceCount = ts.getLineAndCharacterOfPosition(sf, spaceReferenceNode.getStart()).character + spaceOffset;
|
|
1358
1359
|
const leadingSpace = ' '.repeat(leadingSpaceCount);
|
|
1359
1360
|
return [
|
|
1360
|
-
new
|
|
1361
|
+
new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
1361
1362
|
position: bodyBlock.getStart() + 1,
|
|
1362
1363
|
end: bodyBlock.getStart() + 1,
|
|
1363
1364
|
toInsert: `\n${leadingSpace}${toInsert}`,
|
|
@@ -1758,7 +1759,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1758
1759
|
// Unwrap the signal directly.
|
|
1759
1760
|
if (recommendedNode === 'preserve') {
|
|
1760
1761
|
// Append `()` to unwrap the signal.
|
|
1761
|
-
replacements.push(new
|
|
1762
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1762
1763
|
position: originalNode.getEnd(),
|
|
1763
1764
|
end: originalNode.getEnd(),
|
|
1764
1765
|
toInsert: '()',
|
|
@@ -1772,7 +1773,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1772
1773
|
const toInsert = idToSharedField.get(recommendedNode);
|
|
1773
1774
|
const replaceNode = index.traverseAccess(originalNode);
|
|
1774
1775
|
assert(toInsert, 'no shared variable yet available');
|
|
1775
|
-
replacements.push(new
|
|
1776
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1776
1777
|
position: replaceNode.getStart(),
|
|
1777
1778
|
end: replaceNode.getEnd(),
|
|
1778
1779
|
toInsert,
|
|
@@ -1792,7 +1793,7 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1792
1793
|
parent = parent.parent;
|
|
1793
1794
|
}
|
|
1794
1795
|
const replaceNode = index.traverseAccess(originalNode);
|
|
1795
|
-
const filePath =
|
|
1796
|
+
const filePath = project_paths.projectFile(sf, info);
|
|
1796
1797
|
const initializer = `${replaceNode.getText()}()`;
|
|
1797
1798
|
const fieldName = nameGenerator.generate(originalNode.text, referenceNodeInBlock);
|
|
1798
1799
|
let sharedValueAccessExpr;
|
|
@@ -1814,13 +1815,13 @@ function migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, re
|
|
|
1814
1815
|
}
|
|
1815
1816
|
else {
|
|
1816
1817
|
const leadingSpace = ts.getLineAndCharacterOfPosition(sf, referenceNodeInBlock.getStart());
|
|
1817
|
-
replacements.push(new
|
|
1818
|
+
replacements.push(new project_paths.Replacement(filePath, new project_paths.TextUpdate({
|
|
1818
1819
|
position: referenceNodeInBlock.getStart(),
|
|
1819
1820
|
end: referenceNodeInBlock.getStart(),
|
|
1820
1821
|
toInsert: `${temporaryVariableStr}\n${' '.repeat(leadingSpace.character)}`,
|
|
1821
1822
|
})));
|
|
1822
1823
|
}
|
|
1823
|
-
replacements.push(new
|
|
1824
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1824
1825
|
position: replaceNode.getStart(),
|
|
1825
1826
|
end: replaceNode.getEnd(),
|
|
1826
1827
|
toInsert: sharedValueAccessExpr,
|
|
@@ -1929,12 +1930,12 @@ function migrateTypeScriptTypeReferences(host, references, importManager, info)
|
|
|
1929
1930
|
exportSymbolName: 'UnwrapSignalInputs',
|
|
1930
1931
|
requestedFile: sf,
|
|
1931
1932
|
});
|
|
1932
|
-
host.replacements.push(new
|
|
1933
|
+
host.replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
|
|
1933
1934
|
position: firstArg.getStart(),
|
|
1934
1935
|
end: firstArg.getStart(),
|
|
1935
1936
|
toInsert: `${host.printer.printNode(ts.EmitHint.Unspecified, unwrapImportExpr, sf)}<`,
|
|
1936
1937
|
})));
|
|
1937
|
-
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: '>' })));
|
|
1938
1939
|
}
|
|
1939
1940
|
}
|
|
1940
1941
|
}
|