@angular/core 21.0.0-next.9 → 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 +15164 -28368
- package/fesm2022/_debug_node-chunk.mjs.map +1 -1
- package/fesm2022/_effect-chunk.mjs +322 -504
- package/fesm2022/_effect-chunk.mjs.map +1 -1
- package/fesm2022/_effect-chunk2.mjs +2204 -4061
- package/fesm2022/_effect-chunk2.mjs.map +1 -1
- package/fesm2022/_not_found-chunk.mjs +18 -35
- package/fesm2022/_not_found-chunk.mjs.map +1 -1
- package/fesm2022/_resource-chunk.mjs +312 -391
- package/fesm2022/_resource-chunk.mjs.map +1 -1
- package/fesm2022/_untracked-chunk.mjs +75 -96
- package/fesm2022/_untracked-chunk.mjs.map +1 -1
- package/fesm2022/_weak_ref-chunk.mjs +2 -4
- package/fesm2022/_weak_ref-chunk.mjs.map +1 -1
- package/fesm2022/core.mjs +2461 -4305
- 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 +154 -188
- package/fesm2022/primitives-signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +204 -304
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +2303 -3162
- 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-CoeTX_Ob.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 +12 -16
- package/schematics/bundles/{compiler_host-emLDwK2U.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-CLxYZ09c.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-CpM5FPGa.cjs → migrate_ts_type_references-UGIUl7En.cjs} +458 -24
- package/schematics/bundles/{ng_component_template-BRbBIAUX.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-CPWfkfhR.cjs → parse_html-8VLCL37B.cjs} +5 -5
- package/schematics/bundles/{project_paths-C8H7KDJ3.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/types/_api-chunk.d.ts +1 -1
- package/types/_chrome_dev_tools_performance-chunk.d.ts +1 -1
- package/types/_discovery-chunk.d.ts +7 -9
- 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 +1 -81
- 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 +1 -1
- package/types/testing.d.ts +1 -1
- package/schematics/bundles/index-Dvqnp6JS.cjs +0 -22419
- package/schematics/bundles/project_tsconfig_paths-CiBzGSIa.cjs +0 -51591
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @license Angular v21.0.0-rc.0
|
|
4
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var core = require('@angular-devkit/core');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Gets all tsconfig paths from a CLI project by reading the workspace configuration
|
|
13
|
+
* and looking for common tsconfig locations.
|
|
14
|
+
*/
|
|
15
|
+
async function getProjectTsConfigPaths(tree) {
|
|
16
|
+
// Start with some tsconfig paths that are generally used within CLI projects. Note
|
|
17
|
+
// that we are not interested in IDE-specific tsconfig files (e.g. /tsconfig.json)
|
|
18
|
+
const buildPaths = new Set();
|
|
19
|
+
const testPaths = new Set();
|
|
20
|
+
const workspace = await getWorkspace(tree);
|
|
21
|
+
for (const [, project] of workspace.projects) {
|
|
22
|
+
for (const [name, target] of project.targets) {
|
|
23
|
+
if (name !== 'build' && name !== 'test') {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
for (const [, options] of allTargetOptions(target)) {
|
|
27
|
+
const tsConfig = options['tsConfig'];
|
|
28
|
+
// Filter out tsconfig files that don't exist in the CLI project.
|
|
29
|
+
if (typeof tsConfig !== 'string' || !tree.exists(tsConfig)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (name === 'build') {
|
|
33
|
+
buildPaths.add(core.normalize(tsConfig));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
testPaths.add(core.normalize(tsConfig));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
buildPaths: [...buildPaths],
|
|
43
|
+
testPaths: [...testPaths],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** Get options for all configurations for the passed builder target. */
|
|
47
|
+
function* allTargetOptions(target) {
|
|
48
|
+
if (target.options) {
|
|
49
|
+
yield [undefined, target.options];
|
|
50
|
+
}
|
|
51
|
+
if (!target.configurations) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
for (const [name, options] of Object.entries(target.configurations)) {
|
|
55
|
+
if (options) {
|
|
56
|
+
yield [name, options];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function createHost(tree) {
|
|
61
|
+
return {
|
|
62
|
+
async readFile(path) {
|
|
63
|
+
const data = tree.read(path);
|
|
64
|
+
if (!data) {
|
|
65
|
+
throw new Error('File not found.');
|
|
66
|
+
}
|
|
67
|
+
return core.virtualFs.fileBufferToString(data);
|
|
68
|
+
},
|
|
69
|
+
async writeFile(path, data) {
|
|
70
|
+
return tree.overwrite(path, data);
|
|
71
|
+
},
|
|
72
|
+
async isDirectory(path) {
|
|
73
|
+
// Approximate a directory check.
|
|
74
|
+
// We don't need to consider empty directories and hence this is a good enough approach.
|
|
75
|
+
// This is also per documentation, see:
|
|
76
|
+
// https://angular.dev/tools/cli/schematics-for-libraries#get-the-project-configuration
|
|
77
|
+
return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
|
|
78
|
+
},
|
|
79
|
+
async isFile(path) {
|
|
80
|
+
return tree.exists(path);
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async function getWorkspace(tree) {
|
|
85
|
+
const host = createHost(tree);
|
|
86
|
+
const { workspace } = await core.workspaces.readWorkspace('/', host);
|
|
87
|
+
return workspace;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
exports.getProjectTsConfigPaths = getProjectTsConfigPaths;
|
|
@@ -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
|
*/
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
10
|
var fs = require('fs');
|
|
11
|
-
var
|
|
12
|
-
var compiler_host = require('./compiler_host-
|
|
13
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
11
|
+
var path = require('path');
|
|
12
|
+
var compiler_host = require('./compiler_host-DBwYMlTo.cjs');
|
|
13
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
14
14
|
var ts = require('typescript');
|
|
15
|
+
var migrations = require('@angular/compiler-cli/private/migrations');
|
|
15
16
|
var property_name = require('./property_name-BBwFuqMe.cjs');
|
|
16
|
-
require('os');
|
|
17
|
-
require('module');
|
|
18
|
-
require('url');
|
|
19
17
|
require('@angular-devkit/core');
|
|
20
18
|
|
|
21
19
|
/**
|
|
@@ -30,13 +28,6 @@ function findClassDeclaration(reference, typeChecker) {
|
|
|
30
28
|
?.declarations?.find(ts.isClassDeclaration) || null);
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
/*!
|
|
34
|
-
* @license
|
|
35
|
-
* Copyright Google LLC All Rights Reserved.
|
|
36
|
-
*
|
|
37
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
38
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
39
|
-
*/
|
|
40
31
|
/**
|
|
41
32
|
* Checks whether a component is standalone.
|
|
42
33
|
* @param node Class being checked.
|
|
@@ -47,7 +38,7 @@ function isStandaloneComponent(node, reflector) {
|
|
|
47
38
|
if (decorators === null) {
|
|
48
39
|
return false;
|
|
49
40
|
}
|
|
50
|
-
const decorator =
|
|
41
|
+
const decorator = migrations.findAngularDecorator(decorators, 'Component', false);
|
|
51
42
|
if (decorator === undefined || decorator.args === null || decorator.args.length !== 1) {
|
|
52
43
|
return false;
|
|
53
44
|
}
|
|
@@ -139,13 +130,6 @@ function isProvideRoutesCallExpression(node, typeChecker) {
|
|
|
139
130
|
return false;
|
|
140
131
|
}
|
|
141
132
|
|
|
142
|
-
/*!
|
|
143
|
-
* @license
|
|
144
|
-
* Copyright Google LLC All Rights Reserved.
|
|
145
|
-
*
|
|
146
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
147
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
148
|
-
*/
|
|
149
133
|
/**
|
|
150
134
|
* Converts all application routes that are using standalone components to be lazy loaded.
|
|
151
135
|
* @param sourceFile File that should be migrated.
|
|
@@ -153,7 +137,7 @@ function isProvideRoutesCallExpression(node, typeChecker) {
|
|
|
153
137
|
*/
|
|
154
138
|
function migrateFileToLazyRoutes(sourceFile, program) {
|
|
155
139
|
const typeChecker = program.getTypeChecker();
|
|
156
|
-
const reflector = new
|
|
140
|
+
const reflector = new migrations.TypeScriptReflectionHost(typeChecker);
|
|
157
141
|
const printer = ts.createPrinter();
|
|
158
142
|
const tracker = new compiler_host.ChangeTracker(printer);
|
|
159
143
|
const routeArraysToMigrate = findRoutesArrayToMigrate(sourceFile, typeChecker);
|
|
@@ -390,7 +374,7 @@ function migrate(options) {
|
|
|
390
374
|
const basePath = process.cwd();
|
|
391
375
|
// TS and Schematic use paths in POSIX format even on Windows. This is needed as otherwise
|
|
392
376
|
// string matching such as `sourceFile.fileName.startsWith(pathToMigrate)` might not work.
|
|
393
|
-
const pathToMigrate = compiler_host.normalizePath(
|
|
377
|
+
const pathToMigrate = compiler_host.normalizePath(path.join(basePath, options.path));
|
|
394
378
|
if (!buildPaths.length) {
|
|
395
379
|
throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run the route lazy loading migration.');
|
|
396
380
|
}
|
|
@@ -439,7 +423,7 @@ function standaloneRoutesMigration(tree, tsconfigPath, basePath, pathToMigrate,
|
|
|
439
423
|
const { pendingChanges, skippedRoutes: skipped, migratedRoutes: migrated, } = migrateFileToLazyRoutes(sourceFile, program);
|
|
440
424
|
skippedRoutes.push(...skipped);
|
|
441
425
|
migratedRoutes.push(...migrated);
|
|
442
|
-
const update = tree.beginUpdate(
|
|
426
|
+
const update = tree.beginUpdate(path.relative(basePath, sourceFile.fileName));
|
|
443
427
|
pendingChanges.forEach((change) => {
|
|
444
428
|
if (change.removeLength != null) {
|
|
445
429
|
update.remove(change.start, change.removeLength);
|
|
@@ -1,26 +1,22 @@
|
|
|
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
|
-
require('
|
|
12
|
-
require('./index-Dvqnp6JS.cjs');
|
|
13
|
-
require('path');
|
|
10
|
+
require('@angular/compiler-cli');
|
|
11
|
+
require('@angular/compiler-cli/private/migrations');
|
|
14
12
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
16
|
-
var imports = require('./imports-
|
|
13
|
+
var project_paths = require('./project_paths-DvD50ouC.cjs');
|
|
14
|
+
var imports = require('./imports-DP72APSx.cjs');
|
|
17
15
|
var symbol = require('./symbol-BObKoqes.cjs');
|
|
18
16
|
require('@angular-devkit/core');
|
|
19
17
|
require('node:path/posix');
|
|
20
|
-
require('fs');
|
|
21
|
-
require('module');
|
|
22
|
-
require('url');
|
|
23
18
|
require('@angular-devkit/schematics');
|
|
19
|
+
require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
24
20
|
|
|
25
21
|
/** Name of the method being replaced. */
|
|
26
22
|
const METHOD_NAME = 'getCurrentNavigation';
|
|
@@ -95,13 +91,6 @@ function isRouterType(typeChecker, expression, routerSpecifier) {
|
|
|
95
91
|
return declarations.some((decl) => decl === routerSpecifier);
|
|
96
92
|
}
|
|
97
93
|
|
|
98
|
-
/*!
|
|
99
|
-
* @license
|
|
100
|
-
* Copyright Google LLC All Rights Reserved.
|
|
101
|
-
*
|
|
102
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
103
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
104
|
-
*/
|
|
105
94
|
function migrate() {
|
|
106
95
|
return async (tree) => {
|
|
107
96
|
await project_paths.runMigrationInDevkit({
|
|
@@ -1,26 +1,22 @@
|
|
|
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
|
-
require('
|
|
12
|
-
require('./index-Dvqnp6JS.cjs');
|
|
13
|
-
require('path');
|
|
10
|
+
require('@angular/compiler-cli');
|
|
11
|
+
require('@angular/compiler-cli/private/migrations');
|
|
14
12
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
16
|
-
var imports = require('./imports-
|
|
13
|
+
var project_paths = require('./project_paths-DvD50ouC.cjs');
|
|
14
|
+
var imports = require('./imports-DP72APSx.cjs');
|
|
17
15
|
var symbol = require('./symbol-BObKoqes.cjs');
|
|
18
16
|
require('@angular-devkit/core');
|
|
19
17
|
require('node:path/posix');
|
|
20
|
-
require('fs');
|
|
21
|
-
require('module');
|
|
22
|
-
require('url');
|
|
23
18
|
require('@angular-devkit/schematics');
|
|
19
|
+
require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
24
20
|
|
|
25
21
|
/** Name of the method being replaced. */
|
|
26
22
|
const METHOD_NAME = 'lastSuccessfulNavigation';
|
|
@@ -95,13 +91,6 @@ function isRouterType(typeChecker, expression, routerSpecifier) {
|
|
|
95
91
|
return declarations.some((decl) => decl === routerSpecifier);
|
|
96
92
|
}
|
|
97
93
|
|
|
98
|
-
/*!
|
|
99
|
-
* @license
|
|
100
|
-
* Copyright Google LLC All Rights Reserved.
|
|
101
|
-
*
|
|
102
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
103
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
104
|
-
*/
|
|
105
94
|
function migrate() {
|
|
106
95
|
return async (tree) => {
|
|
107
96
|
await project_paths.runMigrationInDevkit({
|
|
@@ -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
|
*/
|
|
@@ -8,18 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
require('@angular-devkit/core');
|
|
10
10
|
require('node:path/posix');
|
|
11
|
-
var project_paths = require('./project_paths-
|
|
12
|
-
require('
|
|
11
|
+
var project_paths = require('./project_paths-DvD50ouC.cjs');
|
|
12
|
+
require('@angular/compiler-cli');
|
|
13
|
+
var migrations = require('@angular/compiler-cli/private/migrations');
|
|
13
14
|
var ts = require('typescript');
|
|
14
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-CiBzGSIa.cjs');
|
|
15
|
-
require('./index-Dvqnp6JS.cjs');
|
|
16
|
-
require('path');
|
|
17
15
|
require('node:path');
|
|
18
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
16
|
+
var apply_import_manager = require('./apply_import_manager-1Zs_gpB6.cjs');
|
|
19
17
|
require('@angular-devkit/schematics');
|
|
20
|
-
require('
|
|
21
|
-
require('module');
|
|
22
|
-
require('url');
|
|
18
|
+
require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
23
19
|
|
|
24
20
|
const ROUTER_TESTING_MODULE = 'RouterTestingModule';
|
|
25
21
|
const SPY_LOCATION = 'SpyLocation';
|
|
@@ -404,7 +400,7 @@ class RouterTestingModuleMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
404
400
|
const replacements = [];
|
|
405
401
|
const migratedUsages = [];
|
|
406
402
|
const filesWithLocationMocks = new Map();
|
|
407
|
-
const importManager = new
|
|
403
|
+
const importManager = new migrations.ImportManager({
|
|
408
404
|
shouldUseSingleQuotes: () => true,
|
|
409
405
|
});
|
|
410
406
|
for (const sourceFile of info.sourceFiles) {
|
|
@@ -461,13 +457,6 @@ class RouterTestingModuleMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
461
457
|
}
|
|
462
458
|
}
|
|
463
459
|
|
|
464
|
-
/*!
|
|
465
|
-
* @license
|
|
466
|
-
* Copyright Google LLC All Rights Reserved.
|
|
467
|
-
*
|
|
468
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
469
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
470
|
-
*/
|
|
471
460
|
function migrate(options) {
|
|
472
461
|
return async (tree, context) => {
|
|
473
462
|
await project_paths.runMigrationInDevkit({
|
|
@@ -1,28 +1,25 @@
|
|
|
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
|
-
|
|
12
|
-
require('./index-Dvqnp6JS.cjs');
|
|
13
|
-
require('path');
|
|
10
|
+
require('@angular/compiler-cli');
|
|
11
|
+
require('@angular/compiler-cli/private/migrations');
|
|
14
12
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
16
|
-
var ng_component_template = require('./ng_component_template-
|
|
17
|
-
var
|
|
13
|
+
var project_paths = require('./project_paths-DvD50ouC.cjs');
|
|
14
|
+
var ng_component_template = require('./ng_component_template-Dsuq1Lw7.cjs');
|
|
15
|
+
var compiler = require('@angular/compiler');
|
|
16
|
+
var parse_html = require('./parse_html-8VLCL37B.cjs');
|
|
18
17
|
require('@angular-devkit/core');
|
|
19
18
|
require('node:path/posix');
|
|
20
|
-
require('fs');
|
|
21
|
-
require('module');
|
|
22
|
-
require('url');
|
|
23
19
|
require('@angular-devkit/schematics');
|
|
24
|
-
require('./
|
|
25
|
-
require('./
|
|
20
|
+
require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
21
|
+
require('./ng_decorators-DSFlWYQY.cjs');
|
|
22
|
+
require('./imports-DP72APSx.cjs');
|
|
26
23
|
require('./property_name-BBwFuqMe.cjs');
|
|
27
24
|
|
|
28
25
|
function migrateTemplateToSelfClosingTags(template) {
|
|
@@ -31,7 +28,7 @@ function migrateTemplateToSelfClosingTags(template) {
|
|
|
31
28
|
return { migrated: template, changed: false, replacementCount: 0 };
|
|
32
29
|
}
|
|
33
30
|
const visitor = new AngularElementCollector();
|
|
34
|
-
|
|
31
|
+
compiler.visitAll(visitor, parsed.tree.rootNodes);
|
|
35
32
|
let newTemplate = template;
|
|
36
33
|
let changedOffset = 0;
|
|
37
34
|
let replacementCount = 0;
|
|
@@ -59,8 +56,8 @@ function replaceWithSelfClosingTag(html, tagName) {
|
|
|
59
56
|
function replaceTemplate(template, replaceValue, start, end, offset) {
|
|
60
57
|
return template.slice(0, start + offset) + replaceValue + template.slice(end + offset);
|
|
61
58
|
}
|
|
62
|
-
const ALL_HTML_TAGS = new
|
|
63
|
-
class AngularElementCollector extends
|
|
59
|
+
const ALL_HTML_TAGS = new compiler.DomElementSchemaRegistry().allKnownElementNames();
|
|
60
|
+
class AngularElementCollector extends compiler.RecursiveVisitor {
|
|
64
61
|
elements = [];
|
|
65
62
|
constructor() {
|
|
66
63
|
super();
|
|
@@ -83,7 +80,7 @@ class AngularElementCollector extends project_tsconfig_paths.RecursiveVisitor$1
|
|
|
83
80
|
}
|
|
84
81
|
if (element.children.length === 1) {
|
|
85
82
|
const child = element.children[0];
|
|
86
|
-
return child instanceof
|
|
83
|
+
return child instanceof compiler.Text && /^\s*$/.test(child.value);
|
|
87
84
|
}
|
|
88
85
|
return false;
|
|
89
86
|
}
|
|
@@ -1,29 +1,26 @@
|
|
|
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
|
-
var migrate_ts_type_references = require('./migrate_ts_type_references-
|
|
9
|
+
var migrate_ts_type_references = require('./migrate_ts_type_references-UGIUl7En.cjs');
|
|
10
10
|
var ts = require('typescript');
|
|
11
|
-
require('
|
|
12
|
-
var
|
|
13
|
-
var index$1 = require('./index-Dvqnp6JS.cjs');
|
|
14
|
-
require('path');
|
|
11
|
+
require('@angular/compiler-cli');
|
|
12
|
+
var migrations = require('@angular/compiler-cli/private/migrations');
|
|
15
13
|
require('node:path');
|
|
16
|
-
var project_paths = require('./project_paths-
|
|
17
|
-
var index = require('./index-
|
|
14
|
+
var project_paths = require('./project_paths-DvD50ouC.cjs');
|
|
15
|
+
var index = require('./index-B7I9sIUx.cjs');
|
|
18
16
|
var assert = require('assert');
|
|
19
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
17
|
+
var apply_import_manager = require('./apply_import_manager-1Zs_gpB6.cjs');
|
|
20
18
|
require('@angular-devkit/core');
|
|
21
19
|
require('node:path/posix');
|
|
22
20
|
require('./leading_space-D9nQ8UQC.cjs');
|
|
23
|
-
require('fs');
|
|
24
|
-
require('module');
|
|
25
|
-
require('url');
|
|
26
21
|
require('@angular-devkit/schematics');
|
|
22
|
+
require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
23
|
+
require('@angular/compiler');
|
|
27
24
|
|
|
28
25
|
/**
|
|
29
26
|
* Class that holds information about a given directive and its input fields.
|
|
@@ -274,9 +271,9 @@ function prepareAnalysisInfo(userProgram, compiler, programAbsoluteRootPaths) {
|
|
|
274
271
|
state.templateTypeChecker.generateAllTypeCheckBlocks();
|
|
275
272
|
}
|
|
276
273
|
const typeChecker = userProgram.getTypeChecker();
|
|
277
|
-
const reflector = new
|
|
278
|
-
const evaluator = new
|
|
279
|
-
const dtsMetadataReader = new
|
|
274
|
+
const reflector = new migrations.TypeScriptReflectionHost(typeChecker);
|
|
275
|
+
const evaluator = new migrations.PartialEvaluator(reflector, typeChecker, null);
|
|
276
|
+
const dtsMetadataReader = new migrations.DtsMetadataReader(typeChecker, reflector);
|
|
280
277
|
return {
|
|
281
278
|
metaRegistry: metaReader,
|
|
282
279
|
dtsMetadataReader,
|
|
@@ -337,7 +334,7 @@ function extractDtsInput(node, metadataReader) {
|
|
|
337
334
|
// in the `.d.ts` aren't resolvable. This seems to be unexpected and shouldn't
|
|
338
335
|
// result in the entire migration to be failing.
|
|
339
336
|
try {
|
|
340
|
-
directiveMetadata = metadataReader.getDirectiveMetadata(new
|
|
337
|
+
directiveMetadata = metadataReader.getDirectiveMetadata(new migrations.Reference(node.parent));
|
|
341
338
|
}
|
|
342
339
|
catch (e) {
|
|
343
340
|
console.error('Unexpected error. Gracefully ignoring.');
|
|
@@ -373,7 +370,7 @@ function extractSourceCodeInput(node, host, reflector, evaluator) {
|
|
|
373
370
|
if (decorators === null) {
|
|
374
371
|
return null;
|
|
375
372
|
}
|
|
376
|
-
const ngDecorators =
|
|
373
|
+
const ngDecorators = migrations.getAngularDecorators(decorators, ['Input'], host.isMigratingCore);
|
|
377
374
|
if (ngDecorators.length === 0) {
|
|
378
375
|
return null;
|
|
379
376
|
}
|
|
@@ -425,27 +422,27 @@ function extractSourceCodeInput(node, host, reflector, evaluator) {
|
|
|
425
422
|
*/
|
|
426
423
|
function parseTransformOfInput(evaluatedInputOpts, node, reflector) {
|
|
427
424
|
const transformValue = evaluatedInputOpts.get('transform');
|
|
428
|
-
if (!(transformValue instanceof
|
|
425
|
+
if (!(transformValue instanceof migrations.DynamicValue) && !(transformValue instanceof migrations.Reference)) {
|
|
429
426
|
return null;
|
|
430
427
|
}
|
|
431
428
|
// For parsing the transform, we don't need a real reference emitter, as
|
|
432
429
|
// the emitter is only used for verifying that the transform type could be
|
|
433
430
|
// copied into e.g. an `ngInputAccept` class member.
|
|
434
|
-
const noopRefEmitter = new
|
|
431
|
+
const noopRefEmitter = new migrations.ReferenceEmitter([
|
|
435
432
|
{
|
|
436
433
|
emit: () => ({
|
|
437
|
-
kind:
|
|
438
|
-
expression:
|
|
434
|
+
kind: migrations.ReferenceEmitKind.Success,
|
|
435
|
+
expression: migrate_ts_type_references.NULL_EXPR,
|
|
439
436
|
importedFile: null,
|
|
440
437
|
}),
|
|
441
438
|
},
|
|
442
439
|
]);
|
|
443
440
|
try {
|
|
444
|
-
return
|
|
441
|
+
return migrations.parseDecoratorInputTransformFunction(node.parent, node.name.text, transformValue, reflector, noopRefEmitter, migrations.CompilationMode.FULL,
|
|
445
442
|
/* emitDeclarationOnly */ false);
|
|
446
443
|
}
|
|
447
444
|
catch (e) {
|
|
448
|
-
if (!(e instanceof
|
|
445
|
+
if (!(e instanceof migrations.FatalDiagnosticError)) {
|
|
449
446
|
throw e;
|
|
450
447
|
}
|
|
451
448
|
// TODO: implement error handling.
|
|
@@ -656,7 +653,7 @@ function pass1__IdentifySourceFileAndDeclarationInputs(sf, host, checker, reflec
|
|
|
656
653
|
function pass3__checkIncompatiblePatterns(host, inheritanceGraph, checker, groupedTsAstVisitor, knownInputs) {
|
|
657
654
|
migrate_ts_type_references.checkIncompatiblePatterns(inheritanceGraph, checker, groupedTsAstVisitor, knownInputs, () => knownInputs.getAllInputContainingClasses());
|
|
658
655
|
for (const input of knownInputs.knownInputIds.values()) {
|
|
659
|
-
const hostBindingDecorators =
|
|
656
|
+
const hostBindingDecorators = migrations.getAngularDecorators(input.metadata.fieldDecorators, ['HostBinding'], host.isMigratingCore);
|
|
660
657
|
if (hostBindingDecorators.length > 0) {
|
|
661
658
|
knownInputs.markFieldIncompatible(input.descriptor, {
|
|
662
659
|
context: hostBindingDecorators[0].node,
|
|
@@ -694,7 +691,7 @@ function executeAnalysisPhase(host, knownInputs, result, { sourceFiles, fullProg
|
|
|
694
691
|
fullProgramSourceFiles.forEach((sf) =>
|
|
695
692
|
// Shim shim files. Those are unnecessary and might cause unexpected slowness.
|
|
696
693
|
// e.g. `ngtypecheck` files.
|
|
697
|
-
!
|
|
694
|
+
!migrations.isShim(sf) &&
|
|
698
695
|
pass1__IdentifySourceFileAndDeclarationInputs(sf, host, typeChecker, reflector, dtsMetadataReader, evaluator, knownInputs, result));
|
|
699
696
|
const fieldNamesToConsiderForReferenceLookup = new Set();
|
|
700
697
|
for (const input of knownInputs.knownInputIds.values()) {
|
|
@@ -1301,7 +1298,7 @@ function pass9__migrateTypeScriptTypeReferences(host, references, importManager,
|
|
|
1301
1298
|
*/
|
|
1302
1299
|
function executeMigrationPhase(host, knownInputs, result, info) {
|
|
1303
1300
|
const { typeChecker, sourceFiles } = info;
|
|
1304
|
-
const importManager = new
|
|
1301
|
+
const importManager = new migrations.ImportManager({
|
|
1305
1302
|
// For the purpose of this migration, we always use `input` and don't alias
|
|
1306
1303
|
// it to e.g. `input_1`.
|
|
1307
1304
|
generateUniqueIdentifier: () => null,
|
|
@@ -1,28 +1,25 @@
|
|
|
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
|
-
var
|
|
9
|
+
var migrations = require('@angular/compiler-cli/private/migrations');
|
|
10
10
|
var ts = require('typescript');
|
|
11
|
-
require('
|
|
12
|
-
var index$1 = require('./index-Dvqnp6JS.cjs');
|
|
13
|
-
require('path');
|
|
11
|
+
require('@angular/compiler-cli');
|
|
14
12
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
16
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
17
|
-
var migrate_ts_type_references = require('./migrate_ts_type_references-
|
|
13
|
+
var project_paths = require('./project_paths-DvD50ouC.cjs');
|
|
14
|
+
var apply_import_manager = require('./apply_import_manager-1Zs_gpB6.cjs');
|
|
15
|
+
var migrate_ts_type_references = require('./migrate_ts_type_references-UGIUl7En.cjs');
|
|
18
16
|
var assert = require('assert');
|
|
19
|
-
var index = require('./index-
|
|
17
|
+
var index = require('./index-B7I9sIUx.cjs');
|
|
18
|
+
var compiler = require('@angular/compiler');
|
|
20
19
|
require('@angular-devkit/core');
|
|
21
20
|
require('node:path/posix');
|
|
22
|
-
require('fs');
|
|
23
|
-
require('module');
|
|
24
|
-
require('url');
|
|
25
21
|
require('@angular-devkit/schematics');
|
|
22
|
+
require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
26
23
|
require('./leading_space-D9nQ8UQC.cjs');
|
|
27
24
|
|
|
28
25
|
/**
|
|
@@ -159,7 +156,7 @@ function computeReplacementsToMigrateQuery(node, metadata, importManager, info,
|
|
|
159
156
|
}
|
|
160
157
|
}
|
|
161
158
|
if (metadata.queryInfo.read !== null) {
|
|
162
|
-
assert(metadata.queryInfo.read instanceof
|
|
159
|
+
assert(metadata.queryInfo.read instanceof compiler.WrappedNodeExpr);
|
|
163
160
|
optionProperties.push(ts.factory.createPropertyAssignment('read', metadata.queryInfo.read.node));
|
|
164
161
|
}
|
|
165
162
|
if (metadata.queryInfo.descendants !== defaultDescendants) {
|
|
@@ -203,7 +200,7 @@ function computeReplacementsToMigrateQuery(node, metadata, importManager, info,
|
|
|
203
200
|
// If the original property type and the read type are matching, we can rely
|
|
204
201
|
// on the TS inference, instead of repeating types, like in `viewChild<Button>(Button)`.
|
|
205
202
|
if (type !== undefined &&
|
|
206
|
-
resolvedReadType instanceof
|
|
203
|
+
resolvedReadType instanceof compiler.WrappedNodeExpr &&
|
|
207
204
|
ts.isIdentifier(resolvedReadType.node) &&
|
|
208
205
|
ts.isTypeReferenceNode(type) &&
|
|
209
206
|
ts.isIdentifier(type.typeName) &&
|
|
@@ -291,7 +288,7 @@ function extractSourceQueryDefinition(node, reflector, evaluator, info) {
|
|
|
291
288
|
return null;
|
|
292
289
|
}
|
|
293
290
|
const decorators = reflector.getDecoratorsOfDeclaration(node) ?? [];
|
|
294
|
-
const ngDecorators =
|
|
291
|
+
const ngDecorators = migrations.getAngularDecorators(decorators, migrations.queryDecoratorNames, /* isCore */ false);
|
|
295
292
|
if (ngDecorators.length === 0) {
|
|
296
293
|
return null;
|
|
297
294
|
}
|
|
@@ -318,10 +315,10 @@ function extractSourceQueryDefinition(node, reflector, evaluator, info) {
|
|
|
318
315
|
}
|
|
319
316
|
let queryInfo = null;
|
|
320
317
|
try {
|
|
321
|
-
queryInfo =
|
|
318
|
+
queryInfo = migrations.extractDecoratorQueryMetadata(node, decorator.name, decorator.args ?? [], node.name.text, reflector, evaluator);
|
|
322
319
|
}
|
|
323
320
|
catch (e) {
|
|
324
|
-
if (!(e instanceof
|
|
321
|
+
if (!(e instanceof migrations.FatalDiagnosticError)) {
|
|
325
322
|
throw e;
|
|
326
323
|
}
|
|
327
324
|
console.error(`Skipping query: ${e.node.getSourceFile().fileName}: ${e.toString()}`);
|
|
@@ -532,7 +529,7 @@ function checkNonTsReferenceAccessesField(ref, fieldName) {
|
|
|
532
529
|
if (ref.from.read !== readFromPath) {
|
|
533
530
|
return null;
|
|
534
531
|
}
|
|
535
|
-
if (!(parentRead instanceof
|
|
532
|
+
if (!(parentRead instanceof compiler.PropertyRead) || parentRead.name !== fieldName) {
|
|
536
533
|
return null;
|
|
537
534
|
}
|
|
538
535
|
return parentRead;
|
|
@@ -570,7 +567,7 @@ function checkNonTsReferenceCallsField(ref, fieldName) {
|
|
|
570
567
|
return null;
|
|
571
568
|
}
|
|
572
569
|
const potentialCall = ref.from.readAstPath[accessIdx - 1];
|
|
573
|
-
if (potentialCall === undefined || !(potentialCall instanceof
|
|
570
|
+
if (potentialCall === undefined || !(potentialCall instanceof compiler.Call)) {
|
|
574
571
|
return null;
|
|
575
572
|
}
|
|
576
573
|
return potentialCall;
|
|
@@ -740,8 +737,8 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
740
737
|
}
|
|
741
738
|
const { sourceFiles, program } = info;
|
|
742
739
|
const checker = program.getTypeChecker();
|
|
743
|
-
const reflector = new
|
|
744
|
-
const evaluator = new
|
|
740
|
+
const reflector = new migrations.TypeScriptReflectionHost(checker);
|
|
741
|
+
const evaluator = new migrations.PartialEvaluator(reflector, checker, null);
|
|
745
742
|
const res = {
|
|
746
743
|
knownQueryFields: {},
|
|
747
744
|
potentialProblematicQueries: {},
|
|
@@ -789,7 +786,7 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
789
786
|
}
|
|
790
787
|
// Migrating fields with `@HostBinding` is incompatible as
|
|
791
788
|
// the host binding decorator does not invoke the signal.
|
|
792
|
-
const hostBindingDecorators =
|
|
789
|
+
const hostBindingDecorators = migrations.getAngularDecorators(extractedQuery.fieldDecorators, ['HostBinding'],
|
|
793
790
|
/* isCore */ false);
|
|
794
791
|
if (hostBindingDecorators.length > 0) {
|
|
795
792
|
markFieldIncompatibleInMetadata(res.potentialProblematicQueries, extractedQuery.id, migrate_ts_type_references.FieldIncompatibilityReason.SignalIncompatibleWithHostBinding);
|
|
@@ -928,10 +925,10 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
928
925
|
const resourceLoader = info.ngCompiler?.['resourceManager'] ?? null;
|
|
929
926
|
const { program, sourceFiles } = info;
|
|
930
927
|
const checker = program.getTypeChecker();
|
|
931
|
-
const reflector = new
|
|
932
|
-
const evaluator = new
|
|
928
|
+
const reflector = new migrations.TypeScriptReflectionHost(checker);
|
|
929
|
+
const evaluator = new migrations.PartialEvaluator(reflector, checker, null);
|
|
933
930
|
const replacements = [];
|
|
934
|
-
const importManager = new
|
|
931
|
+
const importManager = new migrations.ImportManager();
|
|
935
932
|
const printer = ts.createPrinter();
|
|
936
933
|
const filesWithSourceQueries = new Map();
|
|
937
934
|
const filesWithIncompleteMigration = new Map();
|