@angular/core 21.0.0-next.8 → 21.0.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/_attribute-chunk.mjs +2 -14
- package/fesm2022/_attribute-chunk.mjs.map +1 -1
- package/fesm2022/_debug_node-chunk.mjs +15214 -28375
- package/fesm2022/_debug_node-chunk.mjs.map +1 -1
- package/fesm2022/_effect-chunk.mjs +402 -120
- package/fesm2022/_effect-chunk.mjs.map +1 -1
- package/fesm2022/_effect-chunk2.mjs +2951 -0
- package/fesm2022/_effect-chunk2.mjs.map +1 -0
- package/fesm2022/_not_found-chunk.mjs +18 -35
- package/fesm2022/_not_found-chunk.mjs.map +1 -1
- package/fesm2022/_resource-chunk.mjs +316 -563
- package/fesm2022/_resource-chunk.mjs.map +1 -1
- package/fesm2022/_untracked-chunk.mjs +96 -0
- package/fesm2022/_untracked-chunk.mjs.map +1 -0
- package/fesm2022/_weak_ref-chunk.mjs +2 -4
- package/fesm2022/_weak_ref-chunk.mjs.map +1 -1
- package/fesm2022/core.mjs +2466 -4309
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives-di.mjs +9 -9
- package/fesm2022/primitives-di.mjs.map +1 -1
- package/fesm2022/primitives-event-dispatch.mjs +626 -1460
- package/fesm2022/primitives-event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives-signals.mjs +157 -191
- package/fesm2022/primitives-signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +208 -308
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +2305 -3164
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +8 -2
- package/resources/best-practices.md +56 -0
- package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +7 -25
- package/schematics/bundles/application-config-core.cjs +8 -19
- package/schematics/bundles/{apply_import_manager-CBLmogDD.cjs → apply_import_manager-1Zs_gpB6.cjs} +4 -5
- package/schematics/bundles/bootstrap-options-migration.cjs +93 -132
- package/schematics/bundles/cleanup-unused-imports.cjs +9 -13
- package/schematics/bundles/common-to-standalone-migration.cjs +381 -0
- package/schematics/bundles/{compiler_host-T6xncpiw.cjs → compiler_host-DBwYMlTo.cjs} +10 -11
- package/schematics/bundles/control-flow-migration.cjs +29 -31
- package/schematics/bundles/{imports-DwPXlGFl.cjs → imports-DP72APSx.cjs} +1 -23
- package/schematics/bundles/{index-DWSaRJdz.cjs → index-B7I9sIUx.cjs} +36 -37
- package/schematics/bundles/inject-migration.cjs +9 -26
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-Cu-FR4L5.cjs → migrate_ts_type_references-UGIUl7En.cjs} +458 -24
- package/schematics/bundles/{ng_component_template-BkWiUuGG.cjs → ng_component_template-Dsuq1Lw7.cjs} +4 -5
- package/schematics/bundles/{ng_decorators-BI0uV7KI.cjs → ng_decorators-DSFlWYQY.cjs} +2 -2
- package/schematics/bundles/ngclass-to-class-migration.cjs +16 -19
- package/schematics/bundles/ngstyle-to-style-migration.cjs +15 -18
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +16 -19
- package/schematics/bundles/{parse_html-C97tKKp3.cjs → parse_html-8VLCL37B.cjs} +5 -5
- package/schematics/bundles/{project_paths-C6g3lqjX.cjs → project_paths-DvD50ouC.cjs} +14 -247
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +90 -0
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +9 -25
- package/schematics/bundles/router-current-navigation.cjs +6 -17
- package/schematics/bundles/router-last-successful-navigation.cjs +6 -17
- package/schematics/bundles/router-testing-module-migration.cjs +7 -18
- package/schematics/bundles/self-closing-tags-migration.cjs +14 -17
- package/schematics/bundles/signal-input-migration.cjs +23 -26
- package/schematics/bundles/signal-queries-migration.cjs +22 -25
- package/schematics/bundles/signals.cjs +10 -13
- package/schematics/bundles/standalone-migration.cjs +22 -56
- package/schematics/bundles/symbol-BObKoqes.cjs +1 -1
- package/schematics/collection.json +6 -0
- package/schematics/migrations/common-to-standalone-migration/schema.json +14 -0
- package/types/_api-chunk.d.ts +1 -1
- package/types/_chrome_dev_tools_performance-chunk.d.ts +20 -12
- package/types/_discovery-chunk.d.ts +18 -14
- package/types/_effect-chunk.d.ts +1 -1
- package/types/_event_dispatcher-chunk.d.ts +1 -1
- package/types/_formatter-chunk.d.ts +4 -3
- package/types/_weak_ref-chunk.d.ts +1 -1
- package/types/core.d.ts +49 -100
- package/types/primitives-di.d.ts +1 -1
- package/types/primitives-event-dispatch.d.ts +1 -1
- package/types/primitives-signals.d.ts +2 -2
- package/types/rxjs-interop.d.ts +1 -1
- package/types/testing.d.ts +1 -1
- package/fesm2022/_root_effect_scheduler-chunk.mjs +0 -4630
- package/fesm2022/_root_effect_scheduler-chunk.mjs.map +0 -1
- package/fesm2022/_signal-chunk.mjs +0 -581
- package/fesm2022/_signal-chunk.mjs.map +0 -1
- package/schematics/bundles/index-BnmACOsq.cjs +0 -22319
- package/schematics/bundles/project_tsconfig_paths-CdhVNYMk.cjs +0 -51583
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-
|
|
3
|
+
* @license Angular v21.0.0-rc.0
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -103,30 +103,8 @@ function findImportSpecifier(nodes, specifierName) {
|
|
|
103
103
|
return propertyName ? propertyName.text === specifierName : name.text === specifierName;
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Gets the relative path between two files.
|
|
108
|
-
* @param from Path of the file that is importing from another file.
|
|
109
|
-
* @param to Path of the file that is being imported.
|
|
110
|
-
*/
|
|
111
|
-
function getRelativePath(from, to) {
|
|
112
|
-
const fromParts = from.split('/').slice(0, -1);
|
|
113
|
-
const toParts = to.split('/');
|
|
114
|
-
while (fromParts.length > 0 && toParts.length > 0 && fromParts[0] === toParts[0]) {
|
|
115
|
-
fromParts.shift();
|
|
116
|
-
toParts.shift();
|
|
117
|
-
}
|
|
118
|
-
let relativePath = fromParts.map(() => '..').join('/') + (fromParts.length > 0 ? '/' : '') + toParts.join('/');
|
|
119
|
-
if (relativePath.endsWith('.ts')) {
|
|
120
|
-
relativePath = relativePath.slice(0, -3);
|
|
121
|
-
}
|
|
122
|
-
if (!relativePath.startsWith('.')) {
|
|
123
|
-
relativePath = './' + relativePath;
|
|
124
|
-
}
|
|
125
|
-
return relativePath;
|
|
126
|
-
}
|
|
127
106
|
|
|
128
107
|
exports.getImportOfIdentifier = getImportOfIdentifier;
|
|
129
108
|
exports.getImportSpecifier = getImportSpecifier;
|
|
130
109
|
exports.getImportSpecifiers = getImportSpecifiers;
|
|
131
110
|
exports.getNamedImports = getNamedImports;
|
|
132
|
-
exports.getRelativePath = getRelativePath;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-
|
|
3
|
+
* @license Angular v21.0.0-rc.0
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
|
-
require('
|
|
11
|
-
var
|
|
12
|
-
var index = require('./index-BnmACOsq.cjs');
|
|
13
|
-
require('path');
|
|
10
|
+
var compilerCli = require('@angular/compiler-cli');
|
|
11
|
+
var migrations = require('@angular/compiler-cli/private/migrations');
|
|
14
12
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
13
|
+
var project_paths = require('./project_paths-DvD50ouC.cjs');
|
|
14
|
+
var compiler = require('@angular/compiler');
|
|
16
15
|
|
|
17
16
|
function getMemberName(member) {
|
|
18
17
|
if (member.name === undefined) {
|
|
@@ -189,7 +188,7 @@ function lookupPropertyAccess(checker, type, path, options = {}) {
|
|
|
189
188
|
* This resolution is important to be able to migrate references to inputs
|
|
190
189
|
* that will be migrated to signal inputs.
|
|
191
190
|
*/
|
|
192
|
-
class TemplateReferenceVisitor extends
|
|
191
|
+
class TemplateReferenceVisitor extends compiler.TmplAstRecursiveVisitor {
|
|
193
192
|
result = [];
|
|
194
193
|
/**
|
|
195
194
|
* Whether we are currently descending into HTML AST nodes
|
|
@@ -236,21 +235,21 @@ class TemplateReferenceVisitor extends project_tsconfig_paths.RecursiveVisitor {
|
|
|
236
235
|
// of signal calls in templates.
|
|
237
236
|
// TODO: Remove with: https://github.com/angular/angular/pull/55456.
|
|
238
237
|
this.templateAttributeReferencedFields = [];
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
compiler.tmplAstVisitAll(this, template.attributes);
|
|
239
|
+
compiler.tmplAstVisitAll(this, template.templateAttrs);
|
|
241
240
|
// If we are dealing with a microsyntax template, do not check
|
|
242
241
|
// inputs and outputs as those are already passed to the children.
|
|
243
242
|
// Template attributes may contain relevant expressions though.
|
|
244
243
|
if (template.tagName === 'ng-template') {
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
compiler.tmplAstVisitAll(this, template.inputs);
|
|
245
|
+
compiler.tmplAstVisitAll(this, template.outputs);
|
|
247
246
|
}
|
|
248
247
|
const referencedInputs = this.templateAttributeReferencedFields;
|
|
249
248
|
this.templateAttributeReferencedFields = null;
|
|
250
249
|
this.descendAndCheckForNarrowedSimilarReferences(referencedInputs, () => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
250
|
+
compiler.tmplAstVisitAll(this, template.children);
|
|
251
|
+
compiler.tmplAstVisitAll(this, template.references);
|
|
252
|
+
compiler.tmplAstVisitAll(this, template.variables);
|
|
254
253
|
});
|
|
255
254
|
}
|
|
256
255
|
visitIfBlockBranch(block) {
|
|
@@ -317,7 +316,7 @@ class TemplateReferenceVisitor extends project_tsconfig_paths.RecursiveVisitor {
|
|
|
317
316
|
* This resolution is important to be able to migrate references to inputs
|
|
318
317
|
* that will be migrated to signal inputs.
|
|
319
318
|
*/
|
|
320
|
-
class TemplateExpressionReferenceVisitor extends
|
|
319
|
+
class TemplateExpressionReferenceVisitor extends compiler.RecursiveAstVisitor {
|
|
321
320
|
typeChecker;
|
|
322
321
|
templateTypeChecker;
|
|
323
322
|
componentClass;
|
|
@@ -364,7 +363,7 @@ class TemplateExpressionReferenceVisitor extends project_tsconfig_paths.Recursiv
|
|
|
364
363
|
super.visitPropertyRead(ast, context);
|
|
365
364
|
}
|
|
366
365
|
visitBinary(ast, context) {
|
|
367
|
-
if (ast.operation === '=' && ast.left instanceof
|
|
366
|
+
if (ast.operation === '=' && ast.left instanceof compiler.PropertyRead) {
|
|
368
367
|
this._inspectPropertyAccess(ast.left, true, [...context, ast, ast.left]);
|
|
369
368
|
}
|
|
370
369
|
else {
|
|
@@ -402,7 +401,7 @@ class TemplateExpressionReferenceVisitor extends project_tsconfig_paths.Recursiv
|
|
|
402
401
|
return false;
|
|
403
402
|
}
|
|
404
403
|
const symbol = this.templateTypeChecker.getSymbolOfNode(ast, this.componentClass);
|
|
405
|
-
if (symbol?.kind !==
|
|
404
|
+
if (symbol?.kind !== migrations.SymbolKind.Expression || symbol.tsSymbol === null) {
|
|
406
405
|
return false;
|
|
407
406
|
}
|
|
408
407
|
// Dangerous: Type checking symbol retrieval is a totally different `ts.Program`,
|
|
@@ -464,7 +463,7 @@ class TemplateExpressionReferenceVisitor extends project_tsconfig_paths.Recursiv
|
|
|
464
463
|
_isPartOfNarrowingTernary(read) {
|
|
465
464
|
// Note: We do not safe check that the reads are fully matching 1:1. This is acceptable
|
|
466
465
|
// as worst case we just skip an input from being migrated. This is very unlikely too.
|
|
467
|
-
return this.insideConditionalExpressionsWithReads.some((r) => (r instanceof
|
|
466
|
+
return this.insideConditionalExpressionsWithReads.some((r) => (r instanceof compiler.PropertyRead || r instanceof compiler.SafePropertyRead) && r.name === read.name);
|
|
468
467
|
}
|
|
469
468
|
}
|
|
470
469
|
/**
|
|
@@ -474,11 +473,11 @@ class TemplateExpressionReferenceVisitor extends project_tsconfig_paths.Recursiv
|
|
|
474
473
|
function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker) {
|
|
475
474
|
const path = [readOrWrite.name];
|
|
476
475
|
let node = readOrWrite;
|
|
477
|
-
while (node.receiver instanceof
|
|
476
|
+
while (node.receiver instanceof compiler.PropertyRead) {
|
|
478
477
|
node = node.receiver;
|
|
479
478
|
path.unshift(node.name);
|
|
480
479
|
}
|
|
481
|
-
if (!(node.receiver instanceof
|
|
480
|
+
if (!(node.receiver instanceof compiler.ImplicitReceiver || node.receiver instanceof compiler.ThisReceiver)) {
|
|
482
481
|
return null;
|
|
483
482
|
}
|
|
484
483
|
const classType = checker.getTypeAtLocation(componentClass.name);
|
|
@@ -490,8 +489,8 @@ function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker) {
|
|
|
490
489
|
}
|
|
491
490
|
/** Whether the given node refers to a two-way binding AST node. */
|
|
492
491
|
function isTwoWayBindingNode(node) {
|
|
493
|
-
return ((node instanceof
|
|
494
|
-
(node instanceof
|
|
492
|
+
return ((node instanceof compiler.TmplAstBoundAttribute && node.type === compiler.BindingType.TwoWay) ||
|
|
493
|
+
(node instanceof compiler.TmplAstBoundEvent && node.type === compiler.ParsedEventType.TwoWay));
|
|
495
494
|
}
|
|
496
495
|
|
|
497
496
|
/** Possible types of references to known fields detected. */
|
|
@@ -534,7 +533,7 @@ function identifyHostBindingReferences(node, programInfo, checker, reflector, re
|
|
|
534
533
|
if (decorators === null) {
|
|
535
534
|
return;
|
|
536
535
|
}
|
|
537
|
-
const angularDecorators =
|
|
536
|
+
const angularDecorators = migrations.getAngularDecorators(decorators, ['Directive', 'Component'],
|
|
538
537
|
/* isAngularCore */ false);
|
|
539
538
|
if (angularDecorators.length === 0) {
|
|
540
539
|
return;
|
|
@@ -544,15 +543,15 @@ function identifyHostBindingReferences(node, programInfo, checker, reflector, re
|
|
|
544
543
|
if (ngDecorator.args?.length !== 1) {
|
|
545
544
|
return;
|
|
546
545
|
}
|
|
547
|
-
const metadataNode =
|
|
546
|
+
const metadataNode = migrations.unwrapExpression(ngDecorator.args[0]);
|
|
548
547
|
if (!ts.isObjectLiteralExpression(metadataNode)) {
|
|
549
548
|
return;
|
|
550
549
|
}
|
|
551
|
-
const metadata =
|
|
550
|
+
const metadata = migrations.reflectObjectLiteral(metadataNode);
|
|
552
551
|
if (!metadata.has('host')) {
|
|
553
552
|
return;
|
|
554
553
|
}
|
|
555
|
-
let hostField =
|
|
554
|
+
let hostField = migrations.unwrapExpression(metadata.get('host'));
|
|
556
555
|
// Special-case in case host bindings are shared via a variable.
|
|
557
556
|
// e.g. Material button shares host bindings as a constant in the same target.
|
|
558
557
|
if (ts.isIdentifier(hostField)) {
|
|
@@ -570,7 +569,7 @@ function identifyHostBindingReferences(node, programInfo, checker, reflector, re
|
|
|
570
569
|
if (hostField === undefined || !ts.isObjectLiteralExpression(hostField)) {
|
|
571
570
|
return;
|
|
572
571
|
}
|
|
573
|
-
const hostMap =
|
|
572
|
+
const hostMap = migrations.reflectObjectLiteral(hostField);
|
|
574
573
|
const expressionResult = [];
|
|
575
574
|
const expressionVisitor = new TemplateExpressionReferenceVisitor(checker, null, node, knownFields, fieldNamesToConsiderForReferenceLookup);
|
|
576
575
|
for (const [rawName, expression] of hostMap.entries()) {
|
|
@@ -583,11 +582,11 @@ function identifyHostBindingReferences(node, programInfo, checker, reflector, re
|
|
|
583
582
|
if (!isPropertyBinding && !isEventBinding) {
|
|
584
583
|
continue;
|
|
585
584
|
}
|
|
586
|
-
const parser =
|
|
587
|
-
const sourceSpan = new
|
|
585
|
+
const parser = compiler.makeBindingParser();
|
|
586
|
+
const sourceSpan = new compiler.ParseSourceSpan(
|
|
588
587
|
// Fake source span to keep parsing offsets zero-based.
|
|
589
588
|
// We then later combine these with the expression TS node offsets.
|
|
590
|
-
new
|
|
589
|
+
new compiler.ParseLocation({ content: '', url: '' }, 0, 0, 0), new compiler.ParseLocation({ content: '', url: '' }, 0, 0, 0));
|
|
591
590
|
const name = rawName.substring(1, rawName.length - 1);
|
|
592
591
|
let parsed = undefined;
|
|
593
592
|
if (isEventBinding) {
|
|
@@ -630,9 +629,9 @@ function identifyHostBindingReferences(node, programInfo, checker, reflector, re
|
|
|
630
629
|
*/
|
|
631
630
|
function attemptExtractTemplateDefinition(node, checker, reflector, resourceLoader) {
|
|
632
631
|
const classDecorators = reflector.getDecoratorsOfDeclaration(node);
|
|
633
|
-
const evaluator = new
|
|
632
|
+
const evaluator = new migrations.PartialEvaluator(reflector, checker, null);
|
|
634
633
|
const ngDecorators = classDecorators !== null
|
|
635
|
-
?
|
|
634
|
+
? migrations.getAngularDecorators(classDecorators, ['Component'], /* isAngularCore */ false)
|
|
636
635
|
: [];
|
|
637
636
|
if (ngDecorators.length === 0 ||
|
|
638
637
|
ngDecorators[0].args === null ||
|
|
@@ -640,7 +639,7 @@ function attemptExtractTemplateDefinition(node, checker, reflector, resourceLoad
|
|
|
640
639
|
!ts.isObjectLiteralExpression(ngDecorators[0].args[0])) {
|
|
641
640
|
return null;
|
|
642
641
|
}
|
|
643
|
-
const properties =
|
|
642
|
+
const properties = migrations.reflectObjectLiteral(ngDecorators[0].args[0]);
|
|
644
643
|
const templateProp = properties.get('template');
|
|
645
644
|
const templateUrlProp = properties.get('templateUrl');
|
|
646
645
|
const containingFile = node.getSourceFile().fileName;
|
|
@@ -683,7 +682,7 @@ function attemptExtractTemplateDefinition(node, checker, reflector, resourceLoad
|
|
|
683
682
|
* all of the references to inputs.
|
|
684
683
|
*/
|
|
685
684
|
function identifyTemplateReferences(programInfo, node, reflector, checker, evaluator, templateTypeChecker, resourceLoader, options, result, knownFields, fieldNamesToConsiderForReferenceLookup) {
|
|
686
|
-
const template = templateTypeChecker.getTemplate(node,
|
|
685
|
+
const template = templateTypeChecker.getTemplate(node, compilerCli.OptimizeFor.WholeProgram) ??
|
|
687
686
|
// If there is no template registered in the TCB or compiler, the template may
|
|
688
687
|
// be skipped due to an explicit `jit: true` setting. We try to detect this case
|
|
689
688
|
// and parse the template manually.
|
|
@@ -712,7 +711,7 @@ function identifyTemplateReferences(programInfo, node, reflector, checker, evalu
|
|
|
712
711
|
node: res.context,
|
|
713
712
|
isObjectShorthandExpression: res.isObjectShorthandExpression,
|
|
714
713
|
originatingTsFile: project_paths.projectFile(node.getSourceFile(), programInfo),
|
|
715
|
-
templateFile: project_paths.projectFile(
|
|
714
|
+
templateFile: project_paths.projectFile(compilerCli.absoluteFrom(templateFilePath), programInfo),
|
|
716
715
|
isLikelyPartOfNarrowing: res.isLikelyNarrowed,
|
|
717
716
|
isWrite: res.isWrite,
|
|
718
717
|
},
|
|
@@ -738,14 +737,14 @@ function extractTemplateWithoutCompilerAnalysis(node, checker, reflector, resour
|
|
|
738
737
|
if (tmplDef === null) {
|
|
739
738
|
return null;
|
|
740
739
|
}
|
|
741
|
-
return
|
|
740
|
+
return migrations.extractTemplate(node, tmplDef, evaluator, null, resourceLoader, {
|
|
742
741
|
enableBlockSyntax: true,
|
|
743
742
|
enableLetSyntax: true,
|
|
744
743
|
usePoisonedData: true,
|
|
745
744
|
enableI18nLegacyMessageIdFormat: options.enableI18nLegacyMessageIdFormat !== false,
|
|
746
745
|
i18nNormalizeLineEndingsInICUs: options.i18nNormalizeLineEndingsInICUs === true,
|
|
747
746
|
enableSelectorless: false,
|
|
748
|
-
},
|
|
747
|
+
}, migrations.CompilationMode.FULL).nodes;
|
|
749
748
|
}
|
|
750
749
|
|
|
751
750
|
/** Gets the pattern and property name for a given binding element. */
|
|
@@ -1,33 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-
|
|
3
|
+
* @license Angular v21.0.0-rc.0
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
|
-
var
|
|
11
|
-
var compiler_host = require('./compiler_host-
|
|
10
|
+
var path = require('path');
|
|
11
|
+
var compiler_host = require('./compiler_host-DBwYMlTo.cjs');
|
|
12
12
|
var ts = require('typescript');
|
|
13
|
-
var ng_decorators = require('./ng_decorators-
|
|
14
|
-
var imports = require('./imports-
|
|
13
|
+
var ng_decorators = require('./ng_decorators-DSFlWYQY.cjs');
|
|
14
|
+
var imports = require('./imports-DP72APSx.cjs');
|
|
15
15
|
var nodes = require('./nodes-B16H9JUd.cjs');
|
|
16
16
|
var leading_space = require('./leading_space-D9nQ8UQC.cjs');
|
|
17
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
18
|
-
require('
|
|
19
|
-
require('fs');
|
|
20
|
-
require('module');
|
|
21
|
-
require('url');
|
|
17
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
18
|
+
require('@angular/compiler-cli/private/migrations');
|
|
22
19
|
require('@angular-devkit/core');
|
|
23
20
|
|
|
24
|
-
/*!
|
|
25
|
-
* @license
|
|
26
|
-
* Copyright Google LLC All Rights Reserved.
|
|
27
|
-
*
|
|
28
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
29
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
30
|
-
*/
|
|
31
21
|
/** Names of decorators that enable DI on a class declaration. */
|
|
32
22
|
const DECORATORS_SUPPORTING_DI = new Set([
|
|
33
23
|
'Component',
|
|
@@ -346,13 +336,6 @@ function isInlineFunction(node) {
|
|
|
346
336
|
return (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isArrowFunction(node));
|
|
347
337
|
}
|
|
348
338
|
|
|
349
|
-
/*!
|
|
350
|
-
* @license
|
|
351
|
-
* Copyright Google LLC All Rights Reserved.
|
|
352
|
-
*
|
|
353
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
354
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
355
|
-
*/
|
|
356
339
|
/**
|
|
357
340
|
* Finds class property declarations without initializers whose constructor-based initialization
|
|
358
341
|
* can be inlined into the declaration spot after migrating to `inject`. For example:
|
|
@@ -1342,7 +1325,7 @@ function migrate(options) {
|
|
|
1342
1325
|
const { buildPaths, testPaths } = await project_tsconfig_paths.getProjectTsConfigPaths(tree);
|
|
1343
1326
|
const basePath = process.cwd();
|
|
1344
1327
|
const allPaths = [...buildPaths, ...testPaths];
|
|
1345
|
-
const pathToMigrate = compiler_host.normalizePath(
|
|
1328
|
+
const pathToMigrate = compiler_host.normalizePath(path.join(basePath, options.path));
|
|
1346
1329
|
if (!allPaths.length) {
|
|
1347
1330
|
throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run the inject migration.');
|
|
1348
1331
|
}
|
|
@@ -1366,7 +1349,7 @@ function runInjectMigration(tree, tsconfigPath, basePath, pathToMigrate, schemat
|
|
|
1366
1349
|
for (const sourceFile of sourceFiles) {
|
|
1367
1350
|
const changes = migrateFile(sourceFile, schematicOptions);
|
|
1368
1351
|
if (changes.length > 0) {
|
|
1369
|
-
const update = tree.beginUpdate(
|
|
1352
|
+
const update = tree.beginUpdate(path.relative(basePath, sourceFile.fileName));
|
|
1370
1353
|
for (const change of changes) {
|
|
1371
1354
|
if (change.removeLength != null) {
|
|
1372
1355
|
update.remove(change.start, change.removeLength);
|