@angular/core 20.0.0-next.1 → 20.0.0-next.3
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 +770 -2144
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/di.mjs +3 -2
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +2 -589
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +44 -13
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +7 -39
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +116 -143
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/weak_ref-DrMdAIDh.mjs +12 -0
- package/fesm2022/weak_ref-DrMdAIDh.mjs.map +1 -0
- package/index.d.ts +14366 -15214
- package/navigation_types.d-u4EOrrdZ.d.ts +121 -0
- package/package.json +2 -2
- package/primitives/di/index.d.ts +66 -59
- package/primitives/event-dispatch/index.d.ts +205 -309
- package/primitives/signals/index.d.ts +161 -195
- package/rxjs-interop/index.d.ts +71 -100
- package/schematics/bundles/{apply_import_manager-e2a7fe5b.js → apply_import_manager-BXQEjo09.js} +15 -19
- package/schematics/bundles/{checker-af521da6.js → checker-BHb19MHt.js} +3695 -1175
- package/schematics/bundles/cleanup-unused-imports.js +56 -89
- package/schematics/bundles/{compiler_host-5a29293c.js → compiler_host-Bk3repE2.js} +19 -23
- package/schematics/bundles/control-flow-migration.js +81 -38
- package/schematics/bundles/{imports-047fbbc8.js → imports-CIX-JgAN.js} +9 -14
- package/schematics/bundles/{index-1bef3025.js → index-BL9kAIe5.js} +62 -66
- package/schematics/bundles/{program-a449f9bf.js → index-I8VbxQcO.js} +1508 -3178
- package/schematics/bundles/inject-flags.js +147 -0
- package/schematics/bundles/inject-migration.js +121 -127
- package/schematics/bundles/{leading_space-f8944434.js → leading_space-D9nQ8UQC.js} +1 -1
- package/schematics/bundles/{migrate_ts_type_references-2a3e9e6b.js → migrate_ts_type_references-KlOTWeDl.js} +121 -126
- package/schematics/bundles/{ng_decorators-b0d8b324.js → ng_decorators-DznZ5jMl.js} +4 -8
- package/schematics/bundles/{nodes-7758dbf6.js → nodes-B16H9JUd.js} +2 -6
- package/schematics/bundles/output-migration.js +94 -128
- package/schematics/bundles/{project_tsconfig_paths-b558633b.js → project_tsconfig_paths-CDVxT6Ov.js} +1 -1
- package/schematics/bundles/{property_name-ac18447e.js → property_name-BBwFuqMe.js} +3 -7
- package/schematics/bundles/route-lazy-loading.js +35 -41
- package/schematics/bundles/{project_paths-17dc204d.js → run_in_devkit-C0JPtK2u.js} +283 -216
- package/schematics/bundles/self-closing-tags-migration.js +55 -91
- package/schematics/bundles/signal-input-migration.js +121 -156
- package/schematics/bundles/signal-queries-migration.js +119 -154
- package/schematics/bundles/signals.js +12 -14
- package/schematics/bundles/standalone-migration.js +180 -200
- package/schematics/bundles/symbol-VPWguRxr.js +25 -0
- package/schematics/bundles/test-bed-get.js +98 -0
- package/schematics/migrations.json +8 -14
- package/testing/index.d.ts +289 -471
- package/weak_ref.d-ttyj86RV.d.ts +9 -0
- package/schematics/bundles/explicit-standalone-flag.js +0 -184
- package/schematics/bundles/index-ef1bffbb.js +0 -30
- package/schematics/bundles/pending-tasks.js +0 -103
- package/schematics/bundles/provide-initializer.js +0 -186
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.3
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
|
-
|
|
11
|
-
var schematics = require('@angular-devkit/schematics');
|
|
12
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-b558633b.js');
|
|
13
|
-
var project_paths = require('./project_paths-17dc204d.js');
|
|
14
|
-
require('os');
|
|
15
9
|
var ts = require('typescript');
|
|
16
|
-
|
|
17
|
-
require('./
|
|
10
|
+
require('os');
|
|
11
|
+
var checker = require('./checker-BHb19MHt.js');
|
|
12
|
+
require('./index-I8VbxQcO.js');
|
|
18
13
|
require('path');
|
|
19
|
-
var
|
|
20
|
-
var
|
|
14
|
+
var run_in_devkit = require('./run_in_devkit-C0JPtK2u.js');
|
|
15
|
+
var ng_decorators = require('./ng_decorators-DznZ5jMl.js');
|
|
16
|
+
var property_name = require('./property_name-BBwFuqMe.js');
|
|
21
17
|
require('@angular-devkit/core');
|
|
22
18
|
require('node:path/posix');
|
|
23
19
|
require('fs');
|
|
24
20
|
require('module');
|
|
25
21
|
require('url');
|
|
26
|
-
require('
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
|
|
22
|
+
require('@angular-devkit/schematics');
|
|
23
|
+
require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
24
|
+
require('./imports-CIX-JgAN.js');
|
|
31
25
|
|
|
32
26
|
/**
|
|
33
27
|
* Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
|
|
@@ -35,7 +29,7 @@ var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
|
|
|
35
29
|
* TypeScript node referring to the inner expression. e.g "exp".
|
|
36
30
|
*/
|
|
37
31
|
function unwrapExpression(node) {
|
|
38
|
-
if (
|
|
32
|
+
if (ts.isParenthesizedExpression(node) || ts.isAsExpression(node)) {
|
|
39
33
|
return unwrapExpression(node.expression);
|
|
40
34
|
}
|
|
41
35
|
else {
|
|
@@ -45,7 +39,7 @@ function unwrapExpression(node) {
|
|
|
45
39
|
|
|
46
40
|
/** Extracts `@Directive` or `@Component` metadata from the given class. */
|
|
47
41
|
function extractAngularClassMetadata(typeChecker, node) {
|
|
48
|
-
const decorators =
|
|
42
|
+
const decorators = ts.getDecorators(node);
|
|
49
43
|
if (!decorators || !decorators.length) {
|
|
50
44
|
return null;
|
|
51
45
|
}
|
|
@@ -64,7 +58,7 @@ function extractAngularClassMetadata(typeChecker, node) {
|
|
|
64
58
|
}
|
|
65
59
|
const metadata = unwrapExpression(decoratorCall.arguments[0]);
|
|
66
60
|
// Ensure that the metadata is an object literal expression.
|
|
67
|
-
if (!
|
|
61
|
+
if (!ts.isObjectLiteralExpression(metadata)) {
|
|
68
62
|
return null;
|
|
69
63
|
}
|
|
70
64
|
return {
|
|
@@ -138,10 +132,10 @@ class NgComponentTemplateVisitor {
|
|
|
138
132
|
this.typeChecker = typeChecker;
|
|
139
133
|
}
|
|
140
134
|
visitNode(node) {
|
|
141
|
-
if (node.kind ===
|
|
135
|
+
if (node.kind === ts.SyntaxKind.ClassDeclaration) {
|
|
142
136
|
this.visitClassDeclaration(node);
|
|
143
137
|
}
|
|
144
|
-
|
|
138
|
+
ts.forEachChild(node, (n) => this.visitNode(n));
|
|
145
139
|
}
|
|
146
140
|
visitClassDeclaration(node) {
|
|
147
141
|
const metadata = extractAngularClassMetadata(this.typeChecker, node);
|
|
@@ -153,13 +147,13 @@ class NgComponentTemplateVisitor {
|
|
|
153
147
|
// Walk through all component metadata properties and determine the referenced
|
|
154
148
|
// HTML templates (either external or inline)
|
|
155
149
|
metadata.node.properties.forEach((property) => {
|
|
156
|
-
if (!
|
|
150
|
+
if (!ts.isPropertyAssignment(property)) {
|
|
157
151
|
return;
|
|
158
152
|
}
|
|
159
153
|
const propertyName = property_name.getPropertyNameText(property.name);
|
|
160
154
|
// In case there is an inline template specified, ensure that the value is statically
|
|
161
155
|
// analyzable by checking if the initializer is a string literal-like node.
|
|
162
|
-
if (propertyName === 'template' &&
|
|
156
|
+
if (propertyName === 'template' && ts.isStringLiteralLike(property.initializer)) {
|
|
163
157
|
// Need to add an offset of one to the start because the template quotes are
|
|
164
158
|
// not part of the template content.
|
|
165
159
|
// The `getText()` method gives us the original raw text.
|
|
@@ -177,10 +171,10 @@ class NgComponentTemplateVisitor {
|
|
|
177
171
|
content,
|
|
178
172
|
inline: true,
|
|
179
173
|
start: start,
|
|
180
|
-
getCharacterAndLineOfPosition: (pos) =>
|
|
174
|
+
getCharacterAndLineOfPosition: (pos) => ts.getLineAndCharacterOfPosition(sourceFile, pos + start),
|
|
181
175
|
});
|
|
182
176
|
}
|
|
183
|
-
if (propertyName === 'templateUrl' &&
|
|
177
|
+
if (propertyName === 'templateUrl' && ts.isStringLiteralLike(property.initializer)) {
|
|
184
178
|
const absolutePath = this.fs.resolve(this.fs.dirname(sourceFileName), property.initializer.text);
|
|
185
179
|
if (!this.fs.exists(absolutePath)) {
|
|
186
180
|
return;
|
|
@@ -303,7 +297,7 @@ class AngularElementCollector extends checker.RecursiveVisitor {
|
|
|
303
297
|
}
|
|
304
298
|
}
|
|
305
299
|
|
|
306
|
-
class SelfClosingTagsMigration extends
|
|
300
|
+
class SelfClosingTagsMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
307
301
|
config;
|
|
308
302
|
constructor(config = {}) {
|
|
309
303
|
super();
|
|
@@ -314,12 +308,12 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
314
308
|
const typeChecker = program.getTypeChecker();
|
|
315
309
|
const tagReplacements = [];
|
|
316
310
|
for (const sf of sourceFiles) {
|
|
317
|
-
|
|
311
|
+
ts.forEachChild(sf, (node) => {
|
|
318
312
|
// Skipping any non component declarations
|
|
319
|
-
if (!
|
|
313
|
+
if (!ts.isClassDeclaration(node)) {
|
|
320
314
|
return;
|
|
321
315
|
}
|
|
322
|
-
const file =
|
|
316
|
+
const file = run_in_devkit.projectFile(node.getSourceFile(), info);
|
|
323
317
|
if (this.config.shouldMigrate && this.config.shouldMigrate(file) === false) {
|
|
324
318
|
return;
|
|
325
319
|
}
|
|
@@ -332,7 +326,7 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
332
326
|
}
|
|
333
327
|
const fileToMigrate = template.inline
|
|
334
328
|
? file
|
|
335
|
-
:
|
|
329
|
+
: run_in_devkit.projectFile(template.filePath, info);
|
|
336
330
|
const end = template.start + template.content.length;
|
|
337
331
|
const replacements = [
|
|
338
332
|
prepareTextReplacement(fileToMigrate, migrated, template.start, end),
|
|
@@ -348,20 +342,20 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
348
342
|
});
|
|
349
343
|
});
|
|
350
344
|
}
|
|
351
|
-
return
|
|
345
|
+
return run_in_devkit.confirmAsSerializable({ tagReplacements });
|
|
352
346
|
}
|
|
353
347
|
async combine(unitA, unitB) {
|
|
354
348
|
const uniqueReplacements = removeDuplicateReplacements([
|
|
355
349
|
...unitA.tagReplacements,
|
|
356
350
|
...unitB.tagReplacements,
|
|
357
351
|
]);
|
|
358
|
-
return
|
|
352
|
+
return run_in_devkit.confirmAsSerializable({ tagReplacements: uniqueReplacements });
|
|
359
353
|
}
|
|
360
354
|
async globalMeta(combinedData) {
|
|
361
355
|
const globalMeta = {
|
|
362
356
|
tagReplacements: combinedData.tagReplacements,
|
|
363
357
|
};
|
|
364
|
-
return
|
|
358
|
+
return run_in_devkit.confirmAsSerializable(globalMeta);
|
|
365
359
|
}
|
|
366
360
|
async stats(globalMetadata) {
|
|
367
361
|
const touchedFilesCount = globalMetadata.tagReplacements.length;
|
|
@@ -378,7 +372,7 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
378
372
|
}
|
|
379
373
|
}
|
|
380
374
|
function prepareTextReplacement(file, replacement, start, end) {
|
|
381
|
-
return new
|
|
375
|
+
return new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
382
376
|
position: start,
|
|
383
377
|
end: end,
|
|
384
378
|
toInsert: replacement,
|
|
@@ -399,65 +393,35 @@ function removeDuplicateReplacements(replacements) {
|
|
|
399
393
|
|
|
400
394
|
function migrate(options) {
|
|
401
395
|
return async (tree, context) => {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
396
|
+
await run_in_devkit.runMigrationInDevkit({
|
|
397
|
+
tree,
|
|
398
|
+
getMigration: (fs) => new SelfClosingTagsMigration({
|
|
399
|
+
shouldMigrate: (file) => {
|
|
400
|
+
return (file.rootRelativePath.startsWith(fs.normalize(options.path)) &&
|
|
401
|
+
!/(^|\/)node_modules\//.test(file.rootRelativePath));
|
|
402
|
+
},
|
|
403
|
+
}),
|
|
404
|
+
beforeProgramCreation: (tsconfigPath) => {
|
|
405
|
+
context.logger.info(`Preparing analysis for: ${tsconfigPath}...`);
|
|
406
|
+
},
|
|
407
|
+
beforeUnitAnalysis: (tsconfigPath) => {
|
|
408
|
+
context.logger.info(`Scanning for component tags: ${tsconfigPath}...`);
|
|
409
|
+
},
|
|
410
|
+
afterAllAnalyzed: () => {
|
|
411
|
+
context.logger.info(``);
|
|
412
|
+
context.logger.info(`Processing analysis data between targets...`);
|
|
413
|
+
context.logger.info(``);
|
|
414
|
+
},
|
|
415
|
+
afterAnalysisFailure: () => {
|
|
416
|
+
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
417
|
+
},
|
|
418
|
+
whenDone: ({ counters }) => {
|
|
419
|
+
const { touchedFilesCount, replacementCount } = counters;
|
|
420
|
+
context.logger.info('');
|
|
421
|
+
context.logger.info(`Successfully migrated to self-closing tags 🎉`);
|
|
422
|
+
context.logger.info(` -> Migrated ${replacementCount} components to self-closing tags in ${touchedFilesCount} component files.`);
|
|
412
423
|
},
|
|
413
424
|
});
|
|
414
|
-
const unitResults = [];
|
|
415
|
-
const programInfos = [...buildPaths, ...testPaths].map((tsconfigPath) => {
|
|
416
|
-
context.logger.info(`Preparing analysis for: ${tsconfigPath}..`);
|
|
417
|
-
const baseInfo = migration.createProgram(tsconfigPath, fs);
|
|
418
|
-
const info = migration.prepareProgram(baseInfo);
|
|
419
|
-
return { info, tsconfigPath };
|
|
420
|
-
});
|
|
421
|
-
// Analyze phase. Treat all projects as compilation units as
|
|
422
|
-
// this allows us to support references between those.
|
|
423
|
-
for (const { info, tsconfigPath } of programInfos) {
|
|
424
|
-
context.logger.info(`Scanning for component tags: ${tsconfigPath}..`);
|
|
425
|
-
unitResults.push(await migration.analyze(info));
|
|
426
|
-
}
|
|
427
|
-
context.logger.info(``);
|
|
428
|
-
context.logger.info(`Processing analysis data between targets..`);
|
|
429
|
-
context.logger.info(``);
|
|
430
|
-
const combined = await project_paths.synchronouslyCombineUnitData(migration, unitResults);
|
|
431
|
-
if (combined === null) {
|
|
432
|
-
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
const globalMeta = await migration.globalMeta(combined);
|
|
436
|
-
const replacementsPerFile = new Map();
|
|
437
|
-
for (const { tsconfigPath } of programInfos) {
|
|
438
|
-
context.logger.info(`Migrating: ${tsconfigPath}..`);
|
|
439
|
-
const { replacements } = await migration.migrate(globalMeta);
|
|
440
|
-
const changesPerFile = project_paths.groupReplacementsByFile(replacements);
|
|
441
|
-
for (const [file, changes] of changesPerFile) {
|
|
442
|
-
if (!replacementsPerFile.has(file)) {
|
|
443
|
-
replacementsPerFile.set(file, changes);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
context.logger.info(`Applying changes..`);
|
|
448
|
-
for (const [file, changes] of replacementsPerFile) {
|
|
449
|
-
const recorder = tree.beginUpdate(file);
|
|
450
|
-
for (const c of changes) {
|
|
451
|
-
recorder
|
|
452
|
-
.remove(c.data.position, c.data.end - c.data.position)
|
|
453
|
-
.insertLeft(c.data.position, c.data.toInsert);
|
|
454
|
-
}
|
|
455
|
-
tree.commitUpdate(recorder);
|
|
456
|
-
}
|
|
457
|
-
const { counters: { touchedFilesCount, replacementCount }, } = await migration.stats(globalMeta);
|
|
458
|
-
context.logger.info('');
|
|
459
|
-
context.logger.info(`Successfully migrated to self-closing tags 🎉`);
|
|
460
|
-
context.logger.info(` -> Migrated ${replacementCount} components to self-closing tags in ${touchedFilesCount} component files.`);
|
|
461
425
|
};
|
|
462
426
|
}
|
|
463
427
|
|