@angular/core 20.2.1 → 21.0.0-next.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/api.d.d.ts +1 -1
- package/chrome_dev_tools_performance.d.d.ts +1 -1
- package/discovery.d.d.ts +8 -2
- package/event_dispatcher.d.d.ts +1 -1
- package/fesm2022/attribute.mjs +1 -1
- package/fesm2022/attribute.mjs.map +1 -1
- package/fesm2022/core.mjs +9 -6
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/debug_node.mjs +13 -4
- package/fesm2022/debug_node.mjs.map +1 -1
- package/fesm2022/not_found.mjs +1 -1
- package/fesm2022/not_found.mjs.map +1 -1
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/resource.mjs +1 -1
- package/fesm2022/resource.mjs.map +1 -1
- package/fesm2022/root_effect_scheduler.mjs +1 -1
- package/fesm2022/root_effect_scheduler.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/signal.mjs +1 -1
- package/fesm2022/signal.mjs.map +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/untracked.mjs +1 -1
- package/fesm2022/untracked.mjs.map +1 -1
- package/fesm2022/weak_ref.mjs +1 -1
- package/fesm2022/weak_ref.mjs.map +1 -1
- package/graph.d.d.ts +1 -1
- package/index.d.ts +3 -2
- package/package.json +2 -2
- package/primitives/di/index.d.ts +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/bundles/{apply_import_manager-BvwNQhfG.cjs → apply_import_manager-DR9xXCle.cjs} +3 -3
- package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
- package/schematics/bundles/{compiler_host-DbXQvYKt.cjs → compiler_host-BXBP7CE2.cjs} +2 -2
- package/schematics/bundles/control-flow-migration.cjs +3 -3
- package/schematics/bundles/imports-CIX-JgAN.cjs +1 -1
- package/schematics/bundles/{index-Bphk20D_.cjs → index-CfTQUOiz.cjs} +4 -4
- package/schematics/bundles/{index-Bcv0dPD8.cjs → index-esqfDjNB.cjs} +28 -14
- package/schematics/bundles/inject-migration.cjs +3 -3
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-xcaijJqF.cjs → migrate_ts_type_references-6NtAj-Wk.cjs} +5 -5
- package/schematics/bundles/ng_decorators-B5HCqr20.cjs +1 -1
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +6 -6
- package/schematics/bundles/{project_paths-BaK5P5a5.cjs → project_paths-DcaODbky.cjs} +3 -3
- package/schematics/bundles/{project_tsconfig_paths-COqholMT.cjs → project_tsconfig_paths-CS-eSeHC.cjs} +6 -20
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +3 -3
- package/schematics/bundles/router-current-navigation.cjs +4 -4
- package/schematics/bundles/{test-bed-get.cjs → router-last-successful-navigation.cjs} +29 -13
- package/schematics/bundles/self-closing-tags-migration.cjs +4 -4
- package/schematics/bundles/signal-input-migration.cjs +7 -7
- package/schematics/bundles/signal-queries-migration.cjs +7 -7
- package/schematics/bundles/signals.cjs +7 -7
- package/schematics/bundles/standalone-migration.cjs +4 -4
- package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
- package/schematics/migrations.json +7 -17
- package/signal.d.d.ts +1 -1
- package/testing/index.d.ts +1 -1
- package/weak_ref.d.d.ts +1 -1
- package/schematics/bundles/document-core.cjs +0 -95
- package/schematics/bundles/inject-flags.cjs +0 -147
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular
|
|
3
|
+
* @license Angular v21.0.0-next.0
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
10
|
var fs = require('fs');
|
|
11
11
|
var p = require('path');
|
|
12
|
-
var compiler_host = require('./compiler_host-
|
|
13
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
12
|
+
var compiler_host = require('./compiler_host-BXBP7CE2.cjs');
|
|
13
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-CS-eSeHC.cjs');
|
|
14
14
|
var ts = require('typescript');
|
|
15
15
|
var property_name = require('./property_name-BBwFuqMe.cjs');
|
|
16
16
|
require('os');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular
|
|
3
|
+
* @license Angular v21.0.0-next.0
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
require('./project_tsconfig_paths-
|
|
12
|
-
require('./index-
|
|
11
|
+
require('./project_tsconfig_paths-CS-eSeHC.cjs');
|
|
12
|
+
require('./index-esqfDjNB.cjs');
|
|
13
13
|
require('path');
|
|
14
14
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
15
|
+
var project_paths = require('./project_paths-DcaODbky.cjs');
|
|
16
16
|
var imports = require('./imports-CIX-JgAN.cjs');
|
|
17
17
|
var symbol = require('./symbol-VPWguRxr.cjs');
|
|
18
18
|
require('@angular-devkit/core');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular
|
|
3
|
+
* @license Angular v21.0.0-next.0
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
require('./project_tsconfig_paths-
|
|
12
|
-
require('./index-
|
|
11
|
+
require('./project_tsconfig_paths-CS-eSeHC.cjs');
|
|
12
|
+
require('./index-esqfDjNB.cjs');
|
|
13
13
|
require('path');
|
|
14
14
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
15
|
+
var project_paths = require('./project_paths-DcaODbky.cjs');
|
|
16
16
|
var imports = require('./imports-CIX-JgAN.cjs');
|
|
17
17
|
var symbol = require('./symbol-VPWguRxr.cjs');
|
|
18
18
|
require('@angular-devkit/core');
|
|
@@ -23,22 +23,21 @@ require('url');
|
|
|
23
23
|
require('@angular-devkit/schematics');
|
|
24
24
|
|
|
25
25
|
/** Name of the method being replaced. */
|
|
26
|
-
const METHOD_NAME = '
|
|
27
|
-
/** Migration that replaces `
|
|
28
|
-
class
|
|
26
|
+
const METHOD_NAME = 'lastSuccessfulNavigation';
|
|
27
|
+
/** Migration that replaces `Router.lastSuccessfulNavigation` usages with `Router.lastSuccessfulNavigation()`. */
|
|
28
|
+
class RouterLastSuccessfulNavigationMigration extends project_paths.TsurgeFunnelMigration {
|
|
29
29
|
async analyze(info) {
|
|
30
30
|
const locations = [];
|
|
31
31
|
for (const sourceFile of info.sourceFiles) {
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
32
|
+
const routerSpecifier = imports.getImportSpecifier(sourceFile, '@angular/router', 'Router');
|
|
33
|
+
if (routerSpecifier === null) {
|
|
34
34
|
continue;
|
|
35
35
|
}
|
|
36
36
|
const typeChecker = info.program.getTypeChecker();
|
|
37
37
|
sourceFile.forEachChild(function walk(node) {
|
|
38
38
|
if (ts.isPropertyAccessExpression(node) &&
|
|
39
39
|
node.name.text === METHOD_NAME &&
|
|
40
|
-
|
|
41
|
-
symbol.isReferenceToImport(typeChecker, node.expression, specifier)) {
|
|
40
|
+
isRouterType(typeChecker, node.expression, routerSpecifier)) {
|
|
42
41
|
locations.push({ file: project_paths.projectFile(sourceFile, info), position: node.name.getStart() });
|
|
43
42
|
}
|
|
44
43
|
else {
|
|
@@ -53,7 +52,7 @@ class TestBedGetMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
53
52
|
return new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
54
53
|
position: position,
|
|
55
54
|
end: position + METHOD_NAME.length,
|
|
56
|
-
toInsert: '
|
|
55
|
+
toInsert: 'lastSuccessfulNavigation()',
|
|
57
56
|
}));
|
|
58
57
|
});
|
|
59
58
|
return project_paths.confirmAsSerializable({ replacements });
|
|
@@ -78,6 +77,23 @@ class TestBedGetMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
78
77
|
return project_paths.confirmAsSerializable({});
|
|
79
78
|
}
|
|
80
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Checks if the given symbol represents a Router type.
|
|
82
|
+
*/
|
|
83
|
+
function isRouterType(typeChecker, expression, routerSpecifier) {
|
|
84
|
+
const expressionType = typeChecker.getTypeAtLocation(expression);
|
|
85
|
+
const expressionSymbol = expressionType.getSymbol();
|
|
86
|
+
if (!expressionSymbol) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const declarations = expressionSymbol.getDeclarations() ?? [];
|
|
90
|
+
for (const declaration of declarations) {
|
|
91
|
+
if (symbol.isReferenceToImport(typeChecker, declaration, routerSpecifier)) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return declarations.some((decl) => decl === routerSpecifier);
|
|
96
|
+
}
|
|
81
97
|
|
|
82
98
|
/*!
|
|
83
99
|
* @license
|
|
@@ -90,7 +106,7 @@ function migrate() {
|
|
|
90
106
|
return async (tree) => {
|
|
91
107
|
await project_paths.runMigrationInDevkit({
|
|
92
108
|
tree,
|
|
93
|
-
getMigration: () => new
|
|
109
|
+
getMigration: () => new RouterLastSuccessfulNavigationMigration(),
|
|
94
110
|
});
|
|
95
111
|
};
|
|
96
112
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular
|
|
3
|
+
* @license Angular v21.0.0-next.0
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
12
|
-
require('./index-
|
|
11
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-CS-eSeHC.cjs');
|
|
12
|
+
require('./index-esqfDjNB.cjs');
|
|
13
13
|
require('path');
|
|
14
14
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
15
|
+
var project_paths = require('./project_paths-DcaODbky.cjs');
|
|
16
16
|
var ng_decorators = require('./ng_decorators-B5HCqr20.cjs');
|
|
17
17
|
var property_name = require('./property_name-BBwFuqMe.cjs');
|
|
18
18
|
require('@angular-devkit/core');
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular
|
|
3
|
+
* @license Angular v21.0.0-next.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-6NtAj-Wk.cjs');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
require('os');
|
|
12
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
13
|
-
var index$1 = require('./index-
|
|
12
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-CS-eSeHC.cjs');
|
|
13
|
+
var index$1 = require('./index-esqfDjNB.cjs');
|
|
14
14
|
require('path');
|
|
15
15
|
require('node:path');
|
|
16
|
-
var project_paths = require('./project_paths-
|
|
17
|
-
var index = require('./index-
|
|
16
|
+
var project_paths = require('./project_paths-DcaODbky.cjs');
|
|
17
|
+
var index = require('./index-CfTQUOiz.cjs');
|
|
18
18
|
var assert = require('assert');
|
|
19
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
19
|
+
var apply_import_manager = require('./apply_import_manager-DR9xXCle.cjs');
|
|
20
20
|
require('@angular-devkit/core');
|
|
21
21
|
require('node:path/posix');
|
|
22
22
|
require('./leading_space-D9nQ8UQC.cjs');
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular
|
|
3
|
+
* @license Angular v21.0.0-next.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 project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
9
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-CS-eSeHC.cjs');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
require('os');
|
|
12
|
-
var index$1 = require('./index-
|
|
12
|
+
var index$1 = require('./index-esqfDjNB.cjs');
|
|
13
13
|
require('path');
|
|
14
14
|
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-
|
|
15
|
+
var project_paths = require('./project_paths-DcaODbky.cjs');
|
|
16
|
+
var apply_import_manager = require('./apply_import_manager-DR9xXCle.cjs');
|
|
17
|
+
var migrate_ts_type_references = require('./migrate_ts_type_references-6NtAj-Wk.cjs');
|
|
18
18
|
var assert = require('assert');
|
|
19
|
-
var index = require('./index-
|
|
19
|
+
var index = require('./index-CfTQUOiz.cjs');
|
|
20
20
|
require('@angular-devkit/core');
|
|
21
21
|
require('node:path/posix');
|
|
22
22
|
require('fs');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular
|
|
3
|
+
* @license Angular v21.0.0-next.0
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10,7 +10,7 @@ var schematics = require('@angular-devkit/schematics');
|
|
|
10
10
|
var signalQueriesMigration = require('./signal-queries-migration.cjs');
|
|
11
11
|
var signalInputMigration = require('./signal-input-migration.cjs');
|
|
12
12
|
var outputMigration = require('./output-migration.cjs');
|
|
13
|
-
require('./project_tsconfig_paths-
|
|
13
|
+
require('./project_tsconfig_paths-CS-eSeHC.cjs');
|
|
14
14
|
require('typescript');
|
|
15
15
|
require('os');
|
|
16
16
|
require('fs');
|
|
@@ -18,14 +18,14 @@ require('module');
|
|
|
18
18
|
require('path');
|
|
19
19
|
require('url');
|
|
20
20
|
require('@angular-devkit/core');
|
|
21
|
-
require('./index-
|
|
21
|
+
require('./index-esqfDjNB.cjs');
|
|
22
22
|
require('node:path');
|
|
23
|
-
require('./project_paths-
|
|
23
|
+
require('./project_paths-DcaODbky.cjs');
|
|
24
24
|
require('node:path/posix');
|
|
25
|
-
require('./apply_import_manager-
|
|
26
|
-
require('./migrate_ts_type_references-
|
|
25
|
+
require('./apply_import_manager-DR9xXCle.cjs');
|
|
26
|
+
require('./migrate_ts_type_references-6NtAj-Wk.cjs');
|
|
27
27
|
require('assert');
|
|
28
|
-
require('./index-
|
|
28
|
+
require('./index-CfTQUOiz.cjs');
|
|
29
29
|
require('./leading_space-D9nQ8UQC.cjs');
|
|
30
30
|
|
|
31
31
|
function migrate(options) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular
|
|
3
|
+
* @license Angular v21.0.0-next.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 index = require('./index-
|
|
10
|
+
var index = require('./index-esqfDjNB.cjs');
|
|
11
11
|
var fs = require('fs');
|
|
12
12
|
var p = require('path');
|
|
13
13
|
var ts = require('typescript');
|
|
14
|
-
var compiler_host = require('./compiler_host-
|
|
15
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
14
|
+
var compiler_host = require('./compiler_host-BXBP7CE2.cjs');
|
|
15
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-CS-eSeHC.cjs');
|
|
16
16
|
var ng_decorators = require('./ng_decorators-B5HCqr20.cjs');
|
|
17
17
|
var nodes = require('./nodes-B16H9JUd.cjs');
|
|
18
18
|
var symbol = require('./symbol-VPWguRxr.cjs');
|
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schematics": {
|
|
3
|
-
"inject-flags": {
|
|
4
|
-
"version": "20.0.0",
|
|
5
|
-
"description": "Replaces usages of the deprecated InjectFlags enum",
|
|
6
|
-
"factory": "./bundles/inject-flags.cjs#migrate"
|
|
7
|
-
},
|
|
8
|
-
"test-bed-get": {
|
|
9
|
-
"version": "20.0.0",
|
|
10
|
-
"description": "Replaces usages of the deprecated TestBed.get method with TestBed.inject",
|
|
11
|
-
"factory": "./bundles/test-bed-get.cjs#migrate"
|
|
12
|
-
},
|
|
13
3
|
"control-flow-migration": {
|
|
14
|
-
"version": "
|
|
4
|
+
"version": "21.0.0",
|
|
15
5
|
"description": "Converts the entire application to block control flow syntax",
|
|
16
6
|
"factory": "./bundles/control-flow-migration.cjs#migrate",
|
|
17
7
|
"optional": true
|
|
18
8
|
},
|
|
19
|
-
"document-core": {
|
|
20
|
-
"version": "20.0.0",
|
|
21
|
-
"description": "Moves imports of `DOCUMENT` from `@angular/common` to `@angular/core`",
|
|
22
|
-
"factory": "./bundles/document-core.cjs#migrate"
|
|
23
|
-
},
|
|
24
9
|
"router-current-navigation": {
|
|
25
|
-
"version": "
|
|
10
|
+
"version": "21.0.0",
|
|
26
11
|
"description": "Replaces usages of the deprecated Router.getCurrentNavigation method with the Router.currentNavigation signal",
|
|
27
12
|
"factory": "./bundles/router-current-navigation.cjs#migrate",
|
|
28
13
|
"optional": true
|
|
14
|
+
},
|
|
15
|
+
"router-last-successful-navigation": {
|
|
16
|
+
"version": "21.0.0",
|
|
17
|
+
"description": "Ensures that the Router.lastSuccessfulNavigation signal is now invoked",
|
|
18
|
+
"factory": "./bundles/router-last-successful-navigation.cjs#migrate"
|
|
29
19
|
}
|
|
30
20
|
}
|
|
31
21
|
}
|
package/signal.d.d.ts
CHANGED
package/testing/index.d.ts
CHANGED
package/weak_ref.d.d.ts
CHANGED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
/**
|
|
3
|
-
* @license Angular v20.2.1
|
|
4
|
-
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
|
-
* License: MIT
|
|
6
|
-
*/
|
|
7
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-COqholMT.cjs');
|
|
10
|
-
require('typescript');
|
|
11
|
-
require('os');
|
|
12
|
-
var apply_import_manager = require('./apply_import_manager-BvwNQhfG.cjs');
|
|
13
|
-
require('./index-Bcv0dPD8.cjs');
|
|
14
|
-
require('path');
|
|
15
|
-
require('node:path');
|
|
16
|
-
var project_paths = require('./project_paths-BaK5P5a5.cjs');
|
|
17
|
-
var imports = require('./imports-CIX-JgAN.cjs');
|
|
18
|
-
require('@angular-devkit/core');
|
|
19
|
-
require('node:path/posix');
|
|
20
|
-
require('fs');
|
|
21
|
-
require('module');
|
|
22
|
-
require('url');
|
|
23
|
-
require('@angular-devkit/schematics');
|
|
24
|
-
|
|
25
|
-
/** Migration that moves the import of `DOCUMENT` from `core` to `common`. */
|
|
26
|
-
class DocumentCoreMigration extends project_paths.TsurgeFunnelMigration {
|
|
27
|
-
async analyze(info) {
|
|
28
|
-
const replacements = [];
|
|
29
|
-
let importManager = null;
|
|
30
|
-
for (const sourceFile of info.sourceFiles) {
|
|
31
|
-
const specifier = imports.getImportSpecifier(sourceFile, '@angular/common', 'DOCUMENT');
|
|
32
|
-
if (specifier === null) {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
importManager ??= new project_tsconfig_paths.ImportManager({
|
|
36
|
-
// Prevent the manager from trying to generate a non-conflicting import.
|
|
37
|
-
generateUniqueIdentifier: () => null,
|
|
38
|
-
shouldUseSingleQuotes: () => true,
|
|
39
|
-
});
|
|
40
|
-
importManager.removeImport(sourceFile, 'DOCUMENT', '@angular/common');
|
|
41
|
-
importManager.addImport({
|
|
42
|
-
exportSymbolName: 'DOCUMENT',
|
|
43
|
-
exportModuleSpecifier: '@angular/core',
|
|
44
|
-
requestedFile: sourceFile,
|
|
45
|
-
unsafeAliasOverride: specifier.propertyName ? specifier.name.text : undefined,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
if (importManager !== null) {
|
|
49
|
-
apply_import_manager.applyImportManagerChanges(importManager, replacements, info.sourceFiles, info);
|
|
50
|
-
}
|
|
51
|
-
return project_paths.confirmAsSerializable({ replacements });
|
|
52
|
-
}
|
|
53
|
-
async migrate(globalData) {
|
|
54
|
-
return project_paths.confirmAsSerializable(globalData);
|
|
55
|
-
}
|
|
56
|
-
async combine(unitA, unitB) {
|
|
57
|
-
const seen = new Set();
|
|
58
|
-
const combined = [];
|
|
59
|
-
[unitA.replacements, unitB.replacements].forEach((replacements) => {
|
|
60
|
-
replacements.forEach((current) => {
|
|
61
|
-
const { position, end, toInsert } = current.update.data;
|
|
62
|
-
const key = current.projectFile.id + '/' + position + '/' + end + '/' + toInsert;
|
|
63
|
-
if (!seen.has(key)) {
|
|
64
|
-
seen.add(key);
|
|
65
|
-
combined.push(current);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
return project_paths.confirmAsSerializable({ replacements: combined });
|
|
70
|
-
}
|
|
71
|
-
async globalMeta(combinedData) {
|
|
72
|
-
return project_paths.confirmAsSerializable(combinedData);
|
|
73
|
-
}
|
|
74
|
-
async stats() {
|
|
75
|
-
return project_paths.confirmAsSerializable({});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/*!
|
|
80
|
-
* @license
|
|
81
|
-
* Copyright Google LLC All Rights Reserved.
|
|
82
|
-
*
|
|
83
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
84
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
85
|
-
*/
|
|
86
|
-
function migrate() {
|
|
87
|
-
return async (tree) => {
|
|
88
|
-
await project_paths.runMigrationInDevkit({
|
|
89
|
-
tree,
|
|
90
|
-
getMigration: () => new DocumentCoreMigration(),
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
exports.migrate = migrate;
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
/**
|
|
3
|
-
* @license Angular v20.2.1
|
|
4
|
-
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
|
-
* License: MIT
|
|
6
|
-
*/
|
|
7
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
var ts = require('typescript');
|
|
10
|
-
require('os');
|
|
11
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-COqholMT.cjs');
|
|
12
|
-
require('./index-Bcv0dPD8.cjs');
|
|
13
|
-
require('path');
|
|
14
|
-
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-BaK5P5a5.cjs');
|
|
16
|
-
var apply_import_manager = require('./apply_import_manager-BvwNQhfG.cjs');
|
|
17
|
-
var imports = require('./imports-CIX-JgAN.cjs');
|
|
18
|
-
require('@angular-devkit/core');
|
|
19
|
-
require('node:path/posix');
|
|
20
|
-
require('fs');
|
|
21
|
-
require('module');
|
|
22
|
-
require('url');
|
|
23
|
-
require('@angular-devkit/schematics');
|
|
24
|
-
|
|
25
|
-
/** Mapping between `InjectFlag` enum members to their object literal equvalients. */
|
|
26
|
-
const FLAGS_TO_FIELDS = {
|
|
27
|
-
'Default': 'default',
|
|
28
|
-
'Host': 'host',
|
|
29
|
-
'Optional': 'optional',
|
|
30
|
-
'Self': 'self',
|
|
31
|
-
'SkipSelf': 'skipSelf',
|
|
32
|
-
};
|
|
33
|
-
/** Migration that replaces `InjectFlags` usages with object literals. */
|
|
34
|
-
class InjectFlagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
35
|
-
async analyze(info) {
|
|
36
|
-
const locations = {};
|
|
37
|
-
const importRemovals = {};
|
|
38
|
-
for (const sourceFile of info.sourceFiles) {
|
|
39
|
-
const specifier = imports.getImportSpecifier(sourceFile, '@angular/core', 'InjectFlags');
|
|
40
|
-
if (specifier === null) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
const file = project_paths.projectFile(sourceFile, info);
|
|
44
|
-
const importManager = new project_tsconfig_paths.ImportManager();
|
|
45
|
-
const importReplacements = [];
|
|
46
|
-
// Always remove the `InjectFlags` since it has been removed from Angular.
|
|
47
|
-
// Note that it be better to do this inside of `migrate`, but we don't have AST access there.
|
|
48
|
-
importManager.removeImport(sourceFile, 'InjectFlags', '@angular/core');
|
|
49
|
-
apply_import_manager.applyImportManagerChanges(importManager, importReplacements, [sourceFile], info);
|
|
50
|
-
importRemovals[file.id] = importReplacements;
|
|
51
|
-
sourceFile.forEachChild(function walk(node) {
|
|
52
|
-
if (
|
|
53
|
-
// Note: we don't use the type checker for matching here, because
|
|
54
|
-
// the `InjectFlags` will be removed which can break the lookup.
|
|
55
|
-
ts.isPropertyAccessExpression(node) &&
|
|
56
|
-
ts.isIdentifier(node.expression) &&
|
|
57
|
-
node.expression.text === specifier.name.text &&
|
|
58
|
-
FLAGS_TO_FIELDS.hasOwnProperty(node.name.text)) {
|
|
59
|
-
const root = getInjectFlagsRootExpression(node);
|
|
60
|
-
if (root !== null) {
|
|
61
|
-
const flagName = FLAGS_TO_FIELDS[node.name.text];
|
|
62
|
-
const id = getNodeID(file, root);
|
|
63
|
-
locations[id] ??= { file, flags: [], position: root.getStart(), end: root.getEnd() };
|
|
64
|
-
// The flags can't be a set here, because they need to be serializable.
|
|
65
|
-
if (!locations[id].flags.includes(flagName)) {
|
|
66
|
-
locations[id].flags.push(flagName);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
node.forEachChild(walk);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return project_paths.confirmAsSerializable({ locations, importRemovals });
|
|
76
|
-
}
|
|
77
|
-
async migrate(globalData) {
|
|
78
|
-
const replacements = [];
|
|
79
|
-
for (const removals of Object.values(globalData.importRemovals)) {
|
|
80
|
-
replacements.push(...removals);
|
|
81
|
-
}
|
|
82
|
-
for (const { file, position, end, flags } of Object.values(globalData.locations)) {
|
|
83
|
-
// Declare a property for each flag, except for `default` which does not have a flag.
|
|
84
|
-
const properties = flags.filter((flag) => flag !== 'default').map((flag) => `${flag}: true`);
|
|
85
|
-
const toInsert = properties.length ? `{ ${properties.join(', ')} }` : '{}';
|
|
86
|
-
replacements.push(new project_paths.Replacement(file, new project_paths.TextUpdate({ position, end, toInsert })));
|
|
87
|
-
}
|
|
88
|
-
return project_paths.confirmAsSerializable({ replacements });
|
|
89
|
-
}
|
|
90
|
-
async combine(unitA, unitB) {
|
|
91
|
-
return project_paths.confirmAsSerializable({
|
|
92
|
-
locations: {
|
|
93
|
-
...unitA.locations,
|
|
94
|
-
...unitB.locations,
|
|
95
|
-
},
|
|
96
|
-
importRemovals: {
|
|
97
|
-
...unitA.importRemovals,
|
|
98
|
-
...unitB.importRemovals,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
async globalMeta(combinedData) {
|
|
103
|
-
return project_paths.confirmAsSerializable(combinedData);
|
|
104
|
-
}
|
|
105
|
-
async stats() {
|
|
106
|
-
return project_paths.confirmAsSerializable({});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
/** Gets an ID that can be used to look up a node based on its location. */
|
|
110
|
-
function getNodeID(file, node) {
|
|
111
|
-
return `${file.id}/${node.getStart()}/${node.getWidth()}`;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Gets the root expression of an `InjectFlags` usage. For example given `InjectFlags.Optional`.
|
|
115
|
-
* in `InjectFlags.Host | InjectFlags.Optional | InjectFlags.SkipSelf`, the function will return
|
|
116
|
-
* the top-level binary expression.
|
|
117
|
-
* @param start Node from which to start searching.
|
|
118
|
-
*/
|
|
119
|
-
function getInjectFlagsRootExpression(start) {
|
|
120
|
-
let current = start;
|
|
121
|
-
let parent = current?.parent;
|
|
122
|
-
while (parent && (ts.isBinaryExpression(parent) || ts.isParenthesizedExpression(parent))) {
|
|
123
|
-
current = parent;
|
|
124
|
-
parent = current.parent;
|
|
125
|
-
}
|
|
126
|
-
// Only allow allow expressions that are call parameters, variable initializer or parameter
|
|
127
|
-
// initializers which are the only officially supported usages of `InjectFlags`.
|
|
128
|
-
if (current &&
|
|
129
|
-
parent &&
|
|
130
|
-
((ts.isCallExpression(parent) && parent.arguments.includes(current)) ||
|
|
131
|
-
(ts.isVariableDeclaration(parent) && parent.initializer === current) ||
|
|
132
|
-
(ts.isParameter(parent) && parent.initializer === current))) {
|
|
133
|
-
return current;
|
|
134
|
-
}
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function migrate() {
|
|
139
|
-
return async (tree) => {
|
|
140
|
-
await project_paths.runMigrationInDevkit({
|
|
141
|
-
tree,
|
|
142
|
-
getMigration: () => new InjectFlagsMigration(),
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
exports.migrate = migrate;
|