@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,30 +1,24 @@
|
|
|
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
9
|
var schematics = require('@angular-devkit/schematics');
|
|
12
10
|
var fs = require('fs');
|
|
13
11
|
var p = require('path');
|
|
14
|
-
var compiler_host = require('./compiler_host-
|
|
15
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
12
|
+
var compiler_host = require('./compiler_host-Bk3repE2.js');
|
|
13
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
16
14
|
var ts = require('typescript');
|
|
17
|
-
var checker = require('./checker-
|
|
18
|
-
var property_name = require('./property_name-
|
|
15
|
+
var checker = require('./checker-BHb19MHt.js');
|
|
16
|
+
var property_name = require('./property_name-BBwFuqMe.js');
|
|
19
17
|
require('os');
|
|
20
18
|
require('@angular-devkit/core');
|
|
21
19
|
require('module');
|
|
22
20
|
require('url');
|
|
23
21
|
|
|
24
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
|
-
|
|
26
|
-
var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
|
|
27
|
-
|
|
28
22
|
/**
|
|
29
23
|
* Finds the class declaration that is being referred to by a node.
|
|
30
24
|
* @param reference Node referring to a class declaration.
|
|
@@ -34,7 +28,7 @@ function findClassDeclaration(reference, typeChecker) {
|
|
|
34
28
|
return (typeChecker
|
|
35
29
|
.getTypeAtLocation(reference)
|
|
36
30
|
.getSymbol()
|
|
37
|
-
?.declarations?.find(
|
|
31
|
+
?.declarations?.find(ts.isClassDeclaration) || null);
|
|
38
32
|
}
|
|
39
33
|
|
|
40
34
|
/*!
|
|
@@ -59,7 +53,7 @@ function isStandaloneComponent(node, reflector) {
|
|
|
59
53
|
return false;
|
|
60
54
|
}
|
|
61
55
|
const arg = decorator.args[0];
|
|
62
|
-
if (
|
|
56
|
+
if (ts.isObjectLiteralExpression(arg)) {
|
|
63
57
|
const property = property_name.findLiteralProperty(arg, 'standalone');
|
|
64
58
|
if (property) {
|
|
65
59
|
return property.initializer.getText() === 'true';
|
|
@@ -76,7 +70,7 @@ function isStandaloneComponent(node, reflector) {
|
|
|
76
70
|
* @param typeChecker
|
|
77
71
|
*/
|
|
78
72
|
function isAngularRoutesArray(node, typeChecker) {
|
|
79
|
-
if (
|
|
73
|
+
if (ts.isVariableDeclaration(node)) {
|
|
80
74
|
const type = typeChecker.getTypeAtLocation(node);
|
|
81
75
|
if (type && typeChecker.isArrayType(type)) {
|
|
82
76
|
// Route[] is an array type
|
|
@@ -97,7 +91,7 @@ function isAngularRoutesArray(node, typeChecker) {
|
|
|
97
91
|
* - RouterModule.forChild(routes)
|
|
98
92
|
*/
|
|
99
93
|
function isRouterModuleCallExpression(node, typeChecker) {
|
|
100
|
-
if (
|
|
94
|
+
if (ts.isPropertyAccessExpression(node.expression)) {
|
|
101
95
|
const propAccess = node.expression;
|
|
102
96
|
const moduleSymbol = typeChecker.getSymbolAtLocation(propAccess.expression);
|
|
103
97
|
return (moduleSymbol?.name === 'RouterModule' &&
|
|
@@ -110,8 +104,8 @@ function isRouterModuleCallExpression(node, typeChecker) {
|
|
|
110
104
|
* Example: this.router.resetConfig(routes)
|
|
111
105
|
*/
|
|
112
106
|
function isRouterCallExpression(node, typeChecker) {
|
|
113
|
-
if (
|
|
114
|
-
|
|
107
|
+
if (ts.isCallExpression(node) &&
|
|
108
|
+
ts.isPropertyAccessExpression(node.expression) &&
|
|
115
109
|
node.expression.name.text === 'resetConfig') {
|
|
116
110
|
const calleeExpression = node.expression.expression;
|
|
117
111
|
const symbol = typeChecker.getSymbolAtLocation(calleeExpression);
|
|
@@ -128,7 +122,7 @@ function isRouterCallExpression(node, typeChecker) {
|
|
|
128
122
|
* Example: provideRoutes(routes)
|
|
129
123
|
*/
|
|
130
124
|
function isRouterProviderCallExpression(node, typeChecker) {
|
|
131
|
-
if (
|
|
125
|
+
if (ts.isIdentifier(node.expression)) {
|
|
132
126
|
const moduleSymbol = typeChecker.getSymbolAtLocation(node.expression);
|
|
133
127
|
return moduleSymbol && moduleSymbol.name === 'provideRoutes';
|
|
134
128
|
}
|
|
@@ -139,7 +133,7 @@ function isRouterProviderCallExpression(node, typeChecker) {
|
|
|
139
133
|
* Example: provideRouter(routes)
|
|
140
134
|
*/
|
|
141
135
|
function isProvideRoutesCallExpression(node, typeChecker) {
|
|
142
|
-
if (
|
|
136
|
+
if (ts.isIdentifier(node.expression)) {
|
|
143
137
|
const moduleSymbol = typeChecker.getSymbolAtLocation(node.expression);
|
|
144
138
|
return moduleSymbol && moduleSymbol.name === 'provideRouter';
|
|
145
139
|
}
|
|
@@ -161,7 +155,7 @@ function isProvideRoutesCallExpression(node, typeChecker) {
|
|
|
161
155
|
function migrateFileToLazyRoutes(sourceFile, program) {
|
|
162
156
|
const typeChecker = program.getTypeChecker();
|
|
163
157
|
const reflector = new checker.TypeScriptReflectionHost(typeChecker);
|
|
164
|
-
const printer =
|
|
158
|
+
const printer = ts.createPrinter();
|
|
165
159
|
const tracker = new compiler_host.ChangeTracker(printer);
|
|
166
160
|
const routeArraysToMigrate = findRoutesArrayToMigrate(sourceFile, typeChecker);
|
|
167
161
|
if (routeArraysToMigrate.length === 0) {
|
|
@@ -178,14 +172,14 @@ function migrateFileToLazyRoutes(sourceFile, program) {
|
|
|
178
172
|
function findRoutesArrayToMigrate(sourceFile, typeChecker) {
|
|
179
173
|
const routesArrays = [];
|
|
180
174
|
sourceFile.forEachChild(function walk(node) {
|
|
181
|
-
if (
|
|
175
|
+
if (ts.isCallExpression(node)) {
|
|
182
176
|
if (isRouterModuleCallExpression(node, typeChecker) ||
|
|
183
177
|
isRouterProviderCallExpression(node, typeChecker) ||
|
|
184
178
|
isRouterCallExpression(node, typeChecker) ||
|
|
185
179
|
isProvideRoutesCallExpression(node, typeChecker)) {
|
|
186
180
|
const arg = node.arguments[0]; // ex: RouterModule.forRoot(routes) or provideRouter(routes)
|
|
187
|
-
const routeFileImports = sourceFile.statements.filter(
|
|
188
|
-
if (
|
|
181
|
+
const routeFileImports = sourceFile.statements.filter(ts.isImportDeclaration);
|
|
182
|
+
if (ts.isArrayLiteralExpression(arg) && arg.elements.length > 0) {
|
|
189
183
|
// ex: inline routes array: RouterModule.forRoot([{ path: 'test', component: TestComponent }])
|
|
190
184
|
routesArrays.push({
|
|
191
185
|
routeFilePath: sourceFile.fileName,
|
|
@@ -193,16 +187,16 @@ function findRoutesArrayToMigrate(sourceFile, typeChecker) {
|
|
|
193
187
|
routeFileImports,
|
|
194
188
|
});
|
|
195
189
|
}
|
|
196
|
-
else if (
|
|
190
|
+
else if (ts.isIdentifier(arg)) {
|
|
197
191
|
// ex: reference to routes array: RouterModule.forRoot(routes)
|
|
198
192
|
// RouterModule.forRoot(routes), provideRouter(routes), provideRoutes(routes)
|
|
199
193
|
const symbol = typeChecker.getSymbolAtLocation(arg);
|
|
200
194
|
if (!symbol?.declarations)
|
|
201
195
|
return;
|
|
202
196
|
for (const declaration of symbol.declarations) {
|
|
203
|
-
if (
|
|
197
|
+
if (ts.isVariableDeclaration(declaration)) {
|
|
204
198
|
const initializer = declaration.initializer;
|
|
205
|
-
if (initializer &&
|
|
199
|
+
if (initializer && ts.isArrayLiteralExpression(initializer)) {
|
|
206
200
|
// ex: const routes = [{ path: 'test', component: TestComponent }];
|
|
207
201
|
routesArrays.push({
|
|
208
202
|
routeFilePath: sourceFile.fileName,
|
|
@@ -215,11 +209,11 @@ function findRoutesArrayToMigrate(sourceFile, typeChecker) {
|
|
|
215
209
|
}
|
|
216
210
|
}
|
|
217
211
|
}
|
|
218
|
-
if (
|
|
212
|
+
if (ts.isVariableDeclaration(node)) {
|
|
219
213
|
if (isAngularRoutesArray(node, typeChecker)) {
|
|
220
214
|
const initializer = node.initializer;
|
|
221
215
|
if (initializer &&
|
|
222
|
-
|
|
216
|
+
ts.isArrayLiteralExpression(initializer) &&
|
|
223
217
|
initializer.elements.length > 0) {
|
|
224
218
|
// ex: const routes: Routes = [{ path: 'test', component: TestComponent }];
|
|
225
219
|
if (routesArrays.find((x) => x.array === initializer)) {
|
|
@@ -229,7 +223,7 @@ function findRoutesArrayToMigrate(sourceFile, typeChecker) {
|
|
|
229
223
|
routesArrays.push({
|
|
230
224
|
routeFilePath: sourceFile.fileName,
|
|
231
225
|
array: initializer,
|
|
232
|
-
routeFileImports: sourceFile.statements.filter(
|
|
226
|
+
routeFileImports: sourceFile.statements.filter(ts.isImportDeclaration),
|
|
233
227
|
});
|
|
234
228
|
}
|
|
235
229
|
}
|
|
@@ -245,7 +239,7 @@ function migrateRoutesArray(routesArray, typeChecker, reflector, tracker) {
|
|
|
245
239
|
const importsToRemove = [];
|
|
246
240
|
for (const route of routesArray) {
|
|
247
241
|
route.array.elements.forEach((element) => {
|
|
248
|
-
if (
|
|
242
|
+
if (ts.isObjectLiteralExpression(element)) {
|
|
249
243
|
const { migratedRoutes: migrated, skippedRoutes: toBeSkipped, importsToRemove: toBeRemoved, } = migrateRoute(element, route, typeChecker, reflector, tracker);
|
|
250
244
|
migratedRoutes.push(...migrated);
|
|
251
245
|
skippedRoutes.push(...toBeSkipped);
|
|
@@ -271,9 +265,9 @@ function migrateRoute(element, route, typeChecker, reflector, tracker) {
|
|
|
271
265
|
const routePath = property_name.findLiteralProperty(element, 'path')?.getText() ?? '';
|
|
272
266
|
const children = property_name.findLiteralProperty(element, 'children');
|
|
273
267
|
// recursively migrate children routes first if they exist
|
|
274
|
-
if (children &&
|
|
268
|
+
if (children && ts.isArrayLiteralExpression(children.initializer)) {
|
|
275
269
|
for (const childRoute of children.initializer.elements) {
|
|
276
|
-
if (
|
|
270
|
+
if (ts.isObjectLiteralExpression(childRoute)) {
|
|
277
271
|
const { migratedRoutes: migrated, skippedRoutes: toBeSkipped, importsToRemove: toBeRemoved, } = migrateRoute(childRoute, route, typeChecker, reflector, tracker);
|
|
278
272
|
migratedRoutes.push(...migrated);
|
|
279
273
|
skippedRoutes.push(...toBeSkipped);
|
|
@@ -294,7 +288,7 @@ function migrateRoute(element, route, typeChecker, reflector, tracker) {
|
|
|
294
288
|
skippedRoutes.push({ path: routePath, file: route.routeFilePath });
|
|
295
289
|
return routeMigrationResults;
|
|
296
290
|
}
|
|
297
|
-
const componentClassName = componentDeclaration.name &&
|
|
291
|
+
const componentClassName = componentDeclaration.name && ts.isIdentifier(componentDeclaration.name)
|
|
298
292
|
? componentDeclaration.name.text
|
|
299
293
|
: null;
|
|
300
294
|
if (!componentClassName) {
|
|
@@ -306,7 +300,7 @@ function migrateRoute(element, route, typeChecker, reflector, tracker) {
|
|
|
306
300
|
}
|
|
307
301
|
const componentImport = route.routeFileImports.find((importDecl) => importDecl.importClause?.getText().includes(componentClassName));
|
|
308
302
|
// remove single and double quotes from the import path
|
|
309
|
-
let componentImportPath =
|
|
303
|
+
let componentImportPath = ts.isStringLiteral(componentImport?.moduleSpecifier)
|
|
310
304
|
? componentImport.moduleSpecifier.text
|
|
311
305
|
: null;
|
|
312
306
|
// if the import path is not a string literal, skip it
|
|
@@ -314,7 +308,7 @@ function migrateRoute(element, route, typeChecker, reflector, tracker) {
|
|
|
314
308
|
skippedRoutes.push({ path: routePath, file: route.routeFilePath });
|
|
315
309
|
return routeMigrationResults;
|
|
316
310
|
}
|
|
317
|
-
const isDefaultExport = componentDeclaration.modifiers?.some((x) => x.kind ===
|
|
311
|
+
const isDefaultExport = componentDeclaration.modifiers?.some((x) => x.kind === ts.SyntaxKind.DefaultKeyword) ?? false;
|
|
318
312
|
const loadComponent = createLoadComponentPropertyAssignment(componentImportPath, componentClassName, isDefaultExport);
|
|
319
313
|
tracker.replaceNode(component, loadComponent);
|
|
320
314
|
// Add the import statement for the standalone component
|
|
@@ -334,18 +328,18 @@ function migrateRoute(element, route, typeChecker, reflector, tracker) {
|
|
|
334
328
|
* loadComponent: () => import('./path') // when isDefaultExport is true
|
|
335
329
|
*/
|
|
336
330
|
function createLoadComponentPropertyAssignment(componentImportPath, componentDeclarationName, isDefaultExport) {
|
|
337
|
-
return
|
|
331
|
+
return ts.factory.createPropertyAssignment('loadComponent', ts.factory.createArrowFunction(undefined, undefined, [], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), isDefaultExport
|
|
338
332
|
? createImportCallExpression(componentImportPath) // will generate import('./path) and will skip the then() call
|
|
339
|
-
:
|
|
333
|
+
: ts.factory.createCallExpression(
|
|
340
334
|
// will generate import('./path).then(m => m.componentName)
|
|
341
|
-
|
|
335
|
+
ts.factory.createPropertyAccessExpression(createImportCallExpression(componentImportPath), 'then'), undefined, [createImportThenCallExpression(componentDeclarationName)])));
|
|
342
336
|
}
|
|
343
337
|
// import('./path)
|
|
344
|
-
const createImportCallExpression = (componentImportPath) =>
|
|
345
|
-
|
|
338
|
+
const createImportCallExpression = (componentImportPath) => ts.factory.createCallExpression(ts.factory.createIdentifier('import'), undefined, [
|
|
339
|
+
ts.factory.createStringLiteral(componentImportPath, true),
|
|
346
340
|
]);
|
|
347
341
|
// m => m.componentName
|
|
348
|
-
const createImportThenCallExpression = (componentDeclarationName) =>
|
|
342
|
+
const createImportThenCallExpression = (componentDeclarationName) => ts.factory.createArrowFunction(undefined, undefined, [ts.factory.createParameterDeclaration(undefined, undefined, 'm', undefined, undefined)], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('m'), componentDeclarationName));
|
|
349
343
|
|
|
350
344
|
function migrate(options) {
|
|
351
345
|
return async (tree, context) => {
|