@angular/core 22.0.0-next.0 → 22.0.0-next.10
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/_attribute-chunk.mjs +1 -1
- package/fesm2022/_debug_node-chunk.mjs +2425 -1941
- package/fesm2022/_debug_node-chunk.mjs.map +1 -1
- package/fesm2022/_effect-chunk.mjs +3 -5
- package/fesm2022/_effect-chunk.mjs.map +1 -1
- package/fesm2022/_not_found-chunk.mjs +1 -1
- package/fesm2022/_not_found-chunk.mjs.map +1 -1
- package/fesm2022/_pending_tasks-chunk.mjs +47 -44
- package/fesm2022/_pending_tasks-chunk.mjs.map +1 -1
- package/fesm2022/_resource-chunk.mjs +55 -18
- package/fesm2022/_resource-chunk.mjs.map +1 -1
- package/fesm2022/_untracked-chunk.mjs +10 -7
- package/fesm2022/_untracked-chunk.mjs.map +1 -1
- package/fesm2022/_weak_ref-chunk.mjs +1 -1
- package/fesm2022/_weak_ref-chunk.mjs.map +1 -1
- package/fesm2022/core.mjs +2332 -1884
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives-di.mjs +1 -1
- package/fesm2022/primitives-di.mjs.map +1 -1
- package/fesm2022/primitives-event-dispatch.mjs +2 -24
- package/fesm2022/primitives-event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives-signals.mjs +2 -2
- package/fesm2022/primitives-signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +6 -3
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +56 -25
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/bundles/apply_import_manager-CxA_YYgB.cjs +1 -1
- package/schematics/bundles/can-match-snapshot-required.cjs +104 -0
- package/schematics/bundles/change-detection-eager.cjs +4 -7
- package/schematics/bundles/cleanup-unused-imports.cjs +1 -1
- package/schematics/bundles/common-to-standalone-migration.cjs +1 -1
- package/schematics/bundles/compiler_host-CY14HvaP.cjs +1 -1
- package/schematics/bundles/control-flow-migration.cjs +1 -1
- package/schematics/bundles/http-xhr-backend.cjs +6 -11
- package/schematics/bundles/imports-CKV-ITqD.cjs +1 -1
- package/schematics/bundles/incremental-hydration.cjs +91 -0
- package/schematics/bundles/{index-BtLcQH8g.cjs → index-DADA7AvC.cjs} +7 -3
- package/schematics/bundles/inject-migration.cjs +26 -18
- package/schematics/bundles/json-file-Drblb4E1.cjs +1916 -0
- package/schematics/bundles/leading_space-BTPRV0wu.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-MWoZx-Cb.cjs → migrate_ts_type_references-CdaIOlGY.cjs} +48 -28
- package/schematics/bundles/model-output.cjs +200 -0
- package/schematics/bundles/ng_component_template-DPAF1aEA.cjs +1 -1
- package/schematics/bundles/ng_decorators-IVztR9rk.cjs +1 -1
- package/schematics/bundles/ngclass-to-class-migration.cjs +14 -6
- package/schematics/bundles/ngstyle-to-style-migration.cjs +14 -6
- package/schematics/bundles/nodes-ZSQ7WZRB.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +2 -2
- package/schematics/bundles/parse_html-C8eKA9px.cjs +1 -1
- package/schematics/bundles/project_paths-D2V-Uh2L.cjs +1 -1
- package/schematics/bundles/project_tsconfig_paths-DkkMibv-.cjs +1 -1
- package/schematics/bundles/property_name-BCpALNpZ.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +22 -2
- package/schematics/bundles/router-testing-module-migration.cjs +1 -1
- package/schematics/bundles/self-closing-tags-migration.cjs +1 -1
- package/schematics/bundles/signal-input-migration.cjs +3 -3
- package/schematics/bundles/signal-queries-migration.cjs +3 -3
- package/schematics/bundles/signals.cjs +3 -3
- package/schematics/bundles/standalone-migration.cjs +29 -17
- package/schematics/bundles/strict-safe-navigation-narrow.cjs +32 -0
- package/schematics/bundles/strict-templates-default.cjs +63 -0
- package/schematics/migrations.json +25 -0
- package/types/_api-chunk.d.ts +22 -4
- package/types/_chrome_dev_tools_performance-chunk.d.ts +4 -3
- package/types/{_discovery-chunk.d.ts → _debug_node-chunk.d.ts} +2157 -2258
- package/types/_effect-chunk.d.ts +1 -1
- package/types/_event_dispatcher-chunk.d.ts +1 -1
- package/types/_formatter-chunk.d.ts +1 -1
- package/types/_weak_ref-chunk.d.ts +1 -1
- package/types/core.d.ts +6488 -6285
- package/types/primitives-di.d.ts +1 -1
- package/types/primitives-event-dispatch.d.ts +1 -1
- package/types/primitives-signals.d.ts +1 -1
- package/types/rxjs-interop.d.ts +2 -1
- package/types/testing.d.ts +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v22.0.0-next.
|
|
3
|
+
* @license Angular v22.0.0-next.10
|
|
4
4
|
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
var assert = require('assert');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
var migrations = require('@angular/compiler-cli/private/migrations');
|
|
12
|
-
var index = require('./index-
|
|
12
|
+
var index = require('./index-DADA7AvC.cjs');
|
|
13
13
|
var project_paths = require('./project_paths-D2V-Uh2L.cjs');
|
|
14
14
|
var leading_space = require('./leading_space-BTPRV0wu.cjs');
|
|
15
15
|
require('@angular/compiler-cli');
|
|
@@ -191,9 +191,11 @@ function areAllEquivalent(base, other) {
|
|
|
191
191
|
return areAllEquivalentPredicate(base, other, (baseElement, otherElement) => baseElement.isEquivalent(otherElement));
|
|
192
192
|
}
|
|
193
193
|
class Expression {
|
|
194
|
+
leadingComments;
|
|
194
195
|
type;
|
|
195
196
|
sourceSpan;
|
|
196
|
-
constructor(type, sourceSpan) {
|
|
197
|
+
constructor(type, sourceSpan, leadingComments) {
|
|
198
|
+
this.leadingComments = leadingComments;
|
|
197
199
|
this.type = type || null;
|
|
198
200
|
this.sourceSpan = sourceSpan || null;
|
|
199
201
|
}
|
|
@@ -203,13 +205,13 @@ class Expression {
|
|
|
203
205
|
key(index, type, sourceSpan) {
|
|
204
206
|
return new ReadKeyExpr(this, index, type, sourceSpan);
|
|
205
207
|
}
|
|
206
|
-
callFn(params, sourceSpan, pure) {
|
|
207
|
-
return new InvokeFunctionExpr(this, params, null, sourceSpan, pure);
|
|
208
|
+
callFn(params, sourceSpan, pure, leadingComments) {
|
|
209
|
+
return new InvokeFunctionExpr(this, params, null, sourceSpan, pure, leadingComments);
|
|
208
210
|
}
|
|
209
|
-
instantiate(params, type, sourceSpan) {
|
|
211
|
+
instantiate(params, type, sourceSpan, leadingComments) {
|
|
210
212
|
return new InstantiateExpr(this, params, type, sourceSpan);
|
|
211
213
|
}
|
|
212
|
-
conditional(trueCase, falseCase = null, sourceSpan) {
|
|
214
|
+
conditional(trueCase, falseCase = null, sourceSpan, leadingComments) {
|
|
213
215
|
return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan);
|
|
214
216
|
}
|
|
215
217
|
equals(rhs, sourceSpan) {
|
|
@@ -274,19 +276,21 @@ class Expression {
|
|
|
274
276
|
nullishCoalesce(rhs, sourceSpan) {
|
|
275
277
|
return new BinaryOperatorExpr(BinaryOperator.NullishCoalesce, this, rhs, null, sourceSpan);
|
|
276
278
|
}
|
|
277
|
-
toStmt() {
|
|
278
|
-
return new ExpressionStatement(this, null);
|
|
279
|
+
toStmt(leadingComments) {
|
|
280
|
+
return new ExpressionStatement(this, null, leadingComments);
|
|
279
281
|
}
|
|
280
282
|
}
|
|
281
283
|
class InvokeFunctionExpr extends Expression {
|
|
282
284
|
fn;
|
|
283
285
|
args;
|
|
284
286
|
pure;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
+
isOptional;
|
|
288
|
+
constructor(fn, args, type, sourceSpan, pure = false, leadingComments, isOptional = false) {
|
|
289
|
+
super(type, sourceSpan, leadingComments);
|
|
287
290
|
this.fn = fn;
|
|
288
291
|
this.args = args;
|
|
289
292
|
this.pure = pure;
|
|
293
|
+
this.isOptional = isOptional;
|
|
290
294
|
}
|
|
291
295
|
// An alias for fn, which allows other logic to handle calls and property reads together.
|
|
292
296
|
get receiver() {
|
|
@@ -305,14 +309,14 @@ class InvokeFunctionExpr extends Expression {
|
|
|
305
309
|
return visitor.visitInvokeFunctionExpr(this, context);
|
|
306
310
|
}
|
|
307
311
|
clone() {
|
|
308
|
-
return new InvokeFunctionExpr(this.fn.clone(), this.args.map((arg) => arg.clone()), this.type, this.sourceSpan, this.pure);
|
|
312
|
+
return new InvokeFunctionExpr(this.fn.clone(), this.args.map((arg) => arg.clone()), this.type, this.sourceSpan, this.pure, [], this.isOptional);
|
|
309
313
|
}
|
|
310
314
|
}
|
|
311
315
|
class InstantiateExpr extends Expression {
|
|
312
316
|
classExpr;
|
|
313
317
|
args;
|
|
314
|
-
constructor(classExpr, args, type, sourceSpan) {
|
|
315
|
-
super(type, sourceSpan);
|
|
318
|
+
constructor(classExpr, args, type, sourceSpan, leadingComments) {
|
|
319
|
+
super(type, sourceSpan, leadingComments);
|
|
316
320
|
this.classExpr = classExpr;
|
|
317
321
|
this.args = args;
|
|
318
322
|
}
|
|
@@ -333,8 +337,8 @@ class InstantiateExpr extends Expression {
|
|
|
333
337
|
}
|
|
334
338
|
class LiteralExpr extends Expression {
|
|
335
339
|
value;
|
|
336
|
-
constructor(value, type, sourceSpan) {
|
|
337
|
-
super(type, sourceSpan);
|
|
340
|
+
constructor(value, type, sourceSpan, leadingComments) {
|
|
341
|
+
super(type, sourceSpan, leadingComments);
|
|
338
342
|
this.value = value;
|
|
339
343
|
}
|
|
340
344
|
isEquivalent(e) {
|
|
@@ -354,8 +358,8 @@ class ConditionalExpr extends Expression {
|
|
|
354
358
|
condition;
|
|
355
359
|
falseCase;
|
|
356
360
|
trueCase;
|
|
357
|
-
constructor(condition, trueCase, falseCase = null, type, sourceSpan) {
|
|
358
|
-
super(type || trueCase.type, sourceSpan);
|
|
361
|
+
constructor(condition, trueCase, falseCase = null, type, sourceSpan, leadingComments) {
|
|
362
|
+
super(type || trueCase.type, sourceSpan, leadingComments);
|
|
359
363
|
this.condition = condition;
|
|
360
364
|
this.falseCase = falseCase;
|
|
361
365
|
this.trueCase = trueCase;
|
|
@@ -380,8 +384,8 @@ class BinaryOperatorExpr extends Expression {
|
|
|
380
384
|
operator;
|
|
381
385
|
rhs;
|
|
382
386
|
lhs;
|
|
383
|
-
constructor(operator, lhs, rhs, type, sourceSpan) {
|
|
384
|
-
super(type || lhs.type, sourceSpan);
|
|
387
|
+
constructor(operator, lhs, rhs, type, sourceSpan, leadingComments) {
|
|
388
|
+
super(type || lhs.type, sourceSpan, leadingComments);
|
|
385
389
|
this.operator = operator;
|
|
386
390
|
this.rhs = rhs;
|
|
387
391
|
this.lhs = lhs;
|
|
@@ -418,17 +422,26 @@ class BinaryOperatorExpr extends Expression {
|
|
|
418
422
|
class ReadPropExpr extends Expression {
|
|
419
423
|
receiver;
|
|
420
424
|
name;
|
|
421
|
-
|
|
422
|
-
|
|
425
|
+
isOptional;
|
|
426
|
+
constructor(receiver, name, type, sourceSpan, leadingComments,
|
|
427
|
+
/**
|
|
428
|
+
* Whether the property access uses the optional-chaining operator (`?.`).
|
|
429
|
+
*/
|
|
430
|
+
isOptional = false) {
|
|
431
|
+
super(type, sourceSpan, leadingComments);
|
|
423
432
|
this.receiver = receiver;
|
|
424
433
|
this.name = name;
|
|
434
|
+
this.isOptional = isOptional;
|
|
425
435
|
}
|
|
426
436
|
// An alias for name, which allows other logic to handle property reads and keyed reads together.
|
|
427
437
|
get index() {
|
|
428
438
|
return this.name;
|
|
429
439
|
}
|
|
430
440
|
isEquivalent(e) {
|
|
431
|
-
return (e instanceof ReadPropExpr &&
|
|
441
|
+
return (e instanceof ReadPropExpr &&
|
|
442
|
+
this.receiver.isEquivalent(e.receiver) &&
|
|
443
|
+
this.name === e.name &&
|
|
444
|
+
this.isOptional === e.isOptional);
|
|
432
445
|
}
|
|
433
446
|
isConstant() {
|
|
434
447
|
return false;
|
|
@@ -440,21 +453,28 @@ class ReadPropExpr extends Expression {
|
|
|
440
453
|
return new BinaryOperatorExpr(BinaryOperator.Assign, this.receiver.prop(this.name), value, null, this.sourceSpan);
|
|
441
454
|
}
|
|
442
455
|
clone() {
|
|
443
|
-
return new ReadPropExpr(this.receiver.clone(), this.name, this.type, this.sourceSpan);
|
|
456
|
+
return new ReadPropExpr(this.receiver.clone(), this.name, this.type, this.sourceSpan, [], this.isOptional);
|
|
444
457
|
}
|
|
445
458
|
}
|
|
446
459
|
class ReadKeyExpr extends Expression {
|
|
447
460
|
receiver;
|
|
448
461
|
index;
|
|
449
|
-
|
|
450
|
-
|
|
462
|
+
isOptional;
|
|
463
|
+
constructor(receiver, index, type, sourceSpan, leadingComments,
|
|
464
|
+
/**
|
|
465
|
+
* Whether the property access uses the optional-chaining operator (`?.[`).
|
|
466
|
+
*/
|
|
467
|
+
isOptional = false) {
|
|
468
|
+
super(type, sourceSpan, leadingComments);
|
|
451
469
|
this.receiver = receiver;
|
|
452
470
|
this.index = index;
|
|
471
|
+
this.isOptional = isOptional;
|
|
453
472
|
}
|
|
454
473
|
isEquivalent(e) {
|
|
455
474
|
return (e instanceof ReadKeyExpr &&
|
|
456
475
|
this.receiver.isEquivalent(e.receiver) &&
|
|
457
|
-
this.index.isEquivalent(e.index)
|
|
476
|
+
this.index.isEquivalent(e.index) &&
|
|
477
|
+
this.isOptional === e.isOptional);
|
|
458
478
|
}
|
|
459
479
|
isConstant() {
|
|
460
480
|
return false;
|
|
@@ -466,7 +486,7 @@ class ReadKeyExpr extends Expression {
|
|
|
466
486
|
return new BinaryOperatorExpr(BinaryOperator.Assign, this.receiver.key(this.index), value, null, this.sourceSpan);
|
|
467
487
|
}
|
|
468
488
|
clone() {
|
|
469
|
-
return new ReadKeyExpr(this.receiver.clone(), this.index.clone(), this.type, this.sourceSpan);
|
|
489
|
+
return new ReadKeyExpr(this.receiver.clone(), this.index.clone(), this.type, this.sourceSpan, [], this.isOptional);
|
|
470
490
|
}
|
|
471
491
|
}
|
|
472
492
|
const NULL_EXPR = new LiteralExpr(null, null, null);
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @license Angular v22.0.0-next.10
|
|
4
|
+
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
require('@angular/compiler-cli');
|
|
10
|
+
var migrations = require('@angular/compiler-cli/private/migrations');
|
|
11
|
+
var ts = require('typescript');
|
|
12
|
+
require('node:path');
|
|
13
|
+
var project_paths = require('./project_paths-D2V-Uh2L.cjs');
|
|
14
|
+
var imports = require('./imports-CKV-ITqD.cjs');
|
|
15
|
+
var apply_import_manager = require('./apply_import_manager-CxA_YYgB.cjs');
|
|
16
|
+
require('@angular-devkit/core');
|
|
17
|
+
require('node:path/posix');
|
|
18
|
+
require('@angular-devkit/schematics');
|
|
19
|
+
require('./project_tsconfig_paths-DkkMibv-.cjs');
|
|
20
|
+
|
|
21
|
+
class ModelOutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
22
|
+
config;
|
|
23
|
+
constructor(config = {}) {
|
|
24
|
+
super();
|
|
25
|
+
this.config = config;
|
|
26
|
+
}
|
|
27
|
+
async analyze(info) {
|
|
28
|
+
const replacements = [];
|
|
29
|
+
for (const sourceFile of info.sourceFiles) {
|
|
30
|
+
if (this.config.shouldMigrate && !this.config.shouldMigrate(project_paths.projectFile(sourceFile, info))) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const importManager = new migrations.ImportManager();
|
|
34
|
+
const visit = (node) => {
|
|
35
|
+
if (ts.isClassDeclaration(node)) {
|
|
36
|
+
this.analyzeClass(node, info.program.getTypeChecker(), importManager, replacements, sourceFile, info);
|
|
37
|
+
}
|
|
38
|
+
ts.forEachChild(node, visit);
|
|
39
|
+
};
|
|
40
|
+
visit(sourceFile);
|
|
41
|
+
apply_import_manager.applyImportManagerChanges(importManager, replacements, [sourceFile], info);
|
|
42
|
+
}
|
|
43
|
+
return project_paths.confirmAsSerializable({
|
|
44
|
+
replacements,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
analyzeClass(classNode, typeChecker, importManager, replacements, sourceFile, info) {
|
|
48
|
+
const modelProperties = [];
|
|
49
|
+
const outputProperties = new Map();
|
|
50
|
+
for (const member of classNode.members) {
|
|
51
|
+
if (!ts.isPropertyDeclaration(member) || !ts.isIdentifier(member.name)) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
// Check for @Output() decorators
|
|
55
|
+
const decorators = ts.getDecorators(member);
|
|
56
|
+
if (decorators) {
|
|
57
|
+
for (const decorator of decorators) {
|
|
58
|
+
if (ts.isCallExpression(decorator.expression) &&
|
|
59
|
+
ts.isIdentifier(decorator.expression.expression) &&
|
|
60
|
+
decorator.expression.expression.text === 'Output') {
|
|
61
|
+
const name = member.name.text;
|
|
62
|
+
outputProperties.set(name, member);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (!member.initializer || !ts.isCallExpression(member.initializer)) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const call = member.initializer;
|
|
70
|
+
let identifier = null;
|
|
71
|
+
if (ts.isIdentifier(call.expression)) {
|
|
72
|
+
identifier = call.expression;
|
|
73
|
+
}
|
|
74
|
+
else if (ts.isPropertyAccessExpression(call.expression)) {
|
|
75
|
+
let current = call.expression;
|
|
76
|
+
while (ts.isPropertyAccessExpression(current)) {
|
|
77
|
+
if (ts.isIdentifier(current.name) && current.name.text === 'model') {
|
|
78
|
+
identifier = current.name;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
current = current.expression;
|
|
82
|
+
}
|
|
83
|
+
if (!identifier && ts.isIdentifier(current) && current.text === 'model') {
|
|
84
|
+
identifier = current;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (!identifier)
|
|
88
|
+
continue;
|
|
89
|
+
const imp = imports.getImportOfIdentifier(typeChecker, identifier);
|
|
90
|
+
if (!imp || imp.importModule !== '@angular/core')
|
|
91
|
+
continue;
|
|
92
|
+
if (imp.name === 'model') {
|
|
93
|
+
modelProperties.push(member);
|
|
94
|
+
}
|
|
95
|
+
else if (imp.name === 'output') {
|
|
96
|
+
const name = member.name.text;
|
|
97
|
+
outputProperties.set(name, member);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
for (const modelProp of modelProperties) {
|
|
101
|
+
const modelName = modelProp.name.text;
|
|
102
|
+
const expectedOutputName = `${modelName}Change`;
|
|
103
|
+
if (outputProperties.has(expectedOutputName)) {
|
|
104
|
+
const update = this.migrateModelProperty(modelProp, importManager, sourceFile);
|
|
105
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(sourceFile, info), update));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
migrateModelProperty(modelProp, importManager, sourceFile) {
|
|
110
|
+
const modelName = modelProp.name.text;
|
|
111
|
+
const call = modelProp.initializer;
|
|
112
|
+
const isRequired = ts.isPropertyAccessExpression(call.expression) && call.expression.name.text === 'required';
|
|
113
|
+
const typeArgs = call.typeArguments
|
|
114
|
+
? `<${call.typeArguments.map((t) => t.getText()).join(', ')}>`
|
|
115
|
+
: '';
|
|
116
|
+
// Use input and linkedSignal
|
|
117
|
+
importManager.addImport({
|
|
118
|
+
exportModuleSpecifier: '@angular/core',
|
|
119
|
+
exportSymbolName: 'input',
|
|
120
|
+
requestedFile: sourceFile,
|
|
121
|
+
});
|
|
122
|
+
importManager.addImport({
|
|
123
|
+
exportModuleSpecifier: '@angular/core',
|
|
124
|
+
exportSymbolName: 'linkedSignal',
|
|
125
|
+
requestedFile: sourceFile,
|
|
126
|
+
});
|
|
127
|
+
const inputName = `${modelName}Input`;
|
|
128
|
+
const initialValue = isRequired ? undefined : (call.arguments[0]?.getText() ?? 'undefined');
|
|
129
|
+
const optionsNode = isRequired ? call.arguments[0] : call.arguments[1];
|
|
130
|
+
const aliasProperty = `alias: '${modelName}'`;
|
|
131
|
+
let inputArgs;
|
|
132
|
+
if (!optionsNode) {
|
|
133
|
+
inputArgs = `{${aliasProperty}}`;
|
|
134
|
+
}
|
|
135
|
+
else if (ts.isObjectLiteralExpression(optionsNode)) {
|
|
136
|
+
const hasAlias = optionsNode.properties.some((p) => {
|
|
137
|
+
if (!ts.isPropertyAssignment(p) && !ts.isShorthandPropertyAssignment(p)) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
return (ts.isIdentifier(p.name) || ts.isStringLiteral(p.name)) && p.name.text === 'alias';
|
|
141
|
+
});
|
|
142
|
+
if (hasAlias) {
|
|
143
|
+
inputArgs = optionsNode.getText();
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const optionsText = optionsNode.getText();
|
|
147
|
+
const inner = optionsText.slice(1, -1).trim();
|
|
148
|
+
inputArgs = `{${aliasProperty}${inner ? `, ${inner}` : ''}}`;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
inputArgs = `{${aliasProperty}, ...${optionsNode.getText()}}`;
|
|
153
|
+
}
|
|
154
|
+
if (initialValue !== undefined) {
|
|
155
|
+
inputArgs = `${initialValue}, ${inputArgs}`;
|
|
156
|
+
}
|
|
157
|
+
const modifiers = modelProp.modifiers
|
|
158
|
+
? modelProp.modifiers.map((m) => m.getText()).join(' ') + ' '
|
|
159
|
+
: '';
|
|
160
|
+
// Detect indentation
|
|
161
|
+
const { character } = sourceFile.getLineAndCharacterOfPosition(modelProp.getStart());
|
|
162
|
+
const indent = sourceFile.text.substring(modelProp.getStart() - character, modelProp.getStart());
|
|
163
|
+
const inputCall = isRequired ? 'input.required' : 'input';
|
|
164
|
+
const newContent = `${modifiers}${inputName} = ${inputCall}${typeArgs}(${inputArgs});\n${indent}${modifiers}${modelName} = linkedSignal(this.${inputName});`;
|
|
165
|
+
return new project_paths.TextUpdate({
|
|
166
|
+
position: modelProp.getStart(),
|
|
167
|
+
end: modelProp.getEnd(),
|
|
168
|
+
toInsert: newContent,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
async combine(unitA, unitB) {
|
|
172
|
+
return project_paths.confirmAsSerializable({
|
|
173
|
+
replacements: [...unitA.replacements, ...unitB.replacements],
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
async globalMeta(combinedData) {
|
|
177
|
+
return project_paths.confirmAsSerializable({
|
|
178
|
+
replacements: combinedData.replacements,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
async migrate(globalData) {
|
|
182
|
+
return project_paths.confirmAsSerializable({
|
|
183
|
+
replacements: globalData.replacements,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
async stats(globalMetadata) {
|
|
187
|
+
return project_paths.confirmAsSerializable({});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function migrate(options) {
|
|
192
|
+
return async (tree, context) => {
|
|
193
|
+
await project_paths.runMigrationInDevkit({
|
|
194
|
+
tree,
|
|
195
|
+
getMigration: (fs) => new ModelOutputMigration(),
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
exports.migrate = migrate;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v22.0.0-next.
|
|
3
|
+
* @license Angular v22.0.0-next.10
|
|
4
4
|
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -121,12 +121,20 @@ function getPropertyRemovalRange(property) {
|
|
|
121
121
|
}
|
|
122
122
|
const properties = parent.properties;
|
|
123
123
|
const propertyIndex = properties.indexOf(property);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
if (properties.length === 1) {
|
|
125
|
+
const sourceFile = property.getSourceFile();
|
|
126
|
+
let end = property.getEnd();
|
|
127
|
+
const textAfter = sourceFile.text.substring(end, parent.getEnd());
|
|
128
|
+
const commaIndex = textAfter.indexOf(',');
|
|
129
|
+
if (commaIndex !== -1) {
|
|
130
|
+
end += commaIndex + 1;
|
|
131
|
+
}
|
|
132
|
+
return { start: property.getFullStart(), end };
|
|
133
|
+
}
|
|
134
|
+
if (propertyIndex === 0) {
|
|
135
|
+
return { start: property.getFullStart(), end: properties[1].getFullStart() };
|
|
128
136
|
}
|
|
129
|
-
return { start:
|
|
137
|
+
return { start: properties[propertyIndex - 1].getEnd(), end: property.getEnd() };
|
|
130
138
|
}
|
|
131
139
|
function calculateImportReplacements(info, sourceFiles, filesToRemoveCommonModule) {
|
|
132
140
|
const importReplacements = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v22.0.0-next.
|
|
3
|
+
* @license Angular v22.0.0-next.10
|
|
4
4
|
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -115,12 +115,20 @@ function getPropertyRemovalRange(property) {
|
|
|
115
115
|
}
|
|
116
116
|
const properties = parent.properties;
|
|
117
117
|
const propertyIndex = properties.indexOf(property);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
if (properties.length === 1) {
|
|
119
|
+
const sourceFile = property.getSourceFile();
|
|
120
|
+
let end = property.getEnd();
|
|
121
|
+
const textAfter = sourceFile.text.substring(end, parent.getEnd());
|
|
122
|
+
const commaIndex = textAfter.indexOf(',');
|
|
123
|
+
if (commaIndex !== -1) {
|
|
124
|
+
end += commaIndex + 1;
|
|
125
|
+
}
|
|
126
|
+
return { start: property.getFullStart(), end };
|
|
127
|
+
}
|
|
128
|
+
if (propertyIndex === 0) {
|
|
129
|
+
return { start: property.getFullStart(), end: properties[1].getFullStart() };
|
|
122
130
|
}
|
|
123
|
-
return { start:
|
|
131
|
+
return { start: properties[propertyIndex - 1].getEnd(), end: property.getEnd() };
|
|
124
132
|
}
|
|
125
133
|
function calculateImportReplacements(info, sourceFiles, filesToRemoveCommonModule) {
|
|
126
134
|
const importReplacements = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v22.0.0-next.
|
|
3
|
+
* @license Angular v22.0.0-next.10
|
|
4
4
|
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -13,7 +13,7 @@ require('node:path');
|
|
|
13
13
|
var project_paths = require('./project_paths-D2V-Uh2L.cjs');
|
|
14
14
|
var compiler = require('@angular/compiler');
|
|
15
15
|
var apply_import_manager = require('./apply_import_manager-CxA_YYgB.cjs');
|
|
16
|
-
var index = require('./index-
|
|
16
|
+
var index = require('./index-DADA7AvC.cjs');
|
|
17
17
|
require('@angular-devkit/core');
|
|
18
18
|
require('node:path/posix');
|
|
19
19
|
require('@angular-devkit/schematics');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v22.0.0-next.
|
|
3
|
+
* @license Angular v22.0.0-next.10
|
|
4
4
|
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -296,7 +296,27 @@ function migrateRoute(element, route, typeChecker, reflector, tracker) {
|
|
|
296
296
|
if (componentDeclaration.getSourceFile().fileName === route.routeFilePath) {
|
|
297
297
|
return routeMigrationResults;
|
|
298
298
|
}
|
|
299
|
-
|
|
299
|
+
// Resolve the import that provides this component by exact specifier match
|
|
300
|
+
// Handles default imports, named imports, and aliases (e.g., `import { Foo as Bar }`).
|
|
301
|
+
const componentImport = route.routeFileImports.find((importDecl) => {
|
|
302
|
+
const clause = importDecl.importClause;
|
|
303
|
+
if (!clause)
|
|
304
|
+
return false;
|
|
305
|
+
// Default import: import FooComponent from '...'
|
|
306
|
+
if (clause.name && ts.isIdentifier(clause.name) && clause.name.text === componentClassName) {
|
|
307
|
+
return true;
|
|
308
|
+
}
|
|
309
|
+
// Named imports: import { FooComponent } from '...'
|
|
310
|
+
const named = clause.namedBindings;
|
|
311
|
+
if (named && ts.isNamedImports(named)) {
|
|
312
|
+
return named.elements.some((el) => {
|
|
313
|
+
// Support alias: import { Foo as Bar }
|
|
314
|
+
const importedName = el.propertyName ? el.propertyName.text : el.name.text;
|
|
315
|
+
return importedName === componentClassName;
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
return false;
|
|
319
|
+
});
|
|
300
320
|
// remove single and double quotes from the import path
|
|
301
321
|
let componentImportPath = ts.isStringLiteral(componentImport?.moduleSpecifier)
|
|
302
322
|
? componentImport.moduleSpecifier.text
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v22.0.0-next.
|
|
3
|
+
* @license Angular v22.0.0-next.10
|
|
4
4
|
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var migrate_ts_type_references = require('./migrate_ts_type_references-
|
|
9
|
+
var migrate_ts_type_references = require('./migrate_ts_type_references-CdaIOlGY.cjs');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
require('@angular/compiler-cli');
|
|
12
12
|
var migrations = require('@angular/compiler-cli/private/migrations');
|
|
13
13
|
require('node:path');
|
|
14
14
|
var project_paths = require('./project_paths-D2V-Uh2L.cjs');
|
|
15
|
-
var index = require('./index-
|
|
15
|
+
var index = require('./index-DADA7AvC.cjs');
|
|
16
16
|
var assert = require('assert');
|
|
17
17
|
var apply_import_manager = require('./apply_import_manager-CxA_YYgB.cjs');
|
|
18
18
|
require('@angular-devkit/core');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v22.0.0-next.
|
|
3
|
+
* @license Angular v22.0.0-next.10
|
|
4
4
|
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -12,9 +12,9 @@ require('@angular/compiler-cli');
|
|
|
12
12
|
require('node:path');
|
|
13
13
|
var project_paths = require('./project_paths-D2V-Uh2L.cjs');
|
|
14
14
|
var apply_import_manager = require('./apply_import_manager-CxA_YYgB.cjs');
|
|
15
|
-
var migrate_ts_type_references = require('./migrate_ts_type_references-
|
|
15
|
+
var migrate_ts_type_references = require('./migrate_ts_type_references-CdaIOlGY.cjs');
|
|
16
16
|
var assert = require('assert');
|
|
17
|
-
var index = require('./index-
|
|
17
|
+
var index = require('./index-DADA7AvC.cjs');
|
|
18
18
|
var compiler = require('@angular/compiler');
|
|
19
19
|
require('@angular-devkit/core');
|
|
20
20
|
require('node:path/posix');
|