@angular/core 21.0.0-next.4 → 21.0.0-next.6
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.mjs → _attribute-chunk.mjs} +2 -2
- package/fesm2022/_attribute-chunk.mjs.map +1 -0
- package/fesm2022/{debug_node.mjs → _debug_node-chunk.mjs} +70 -69
- package/fesm2022/_debug_node-chunk.mjs.map +1 -0
- package/fesm2022/{effect.mjs → _effect-chunk.mjs} +5 -6
- package/fesm2022/_effect-chunk.mjs.map +1 -0
- package/fesm2022/{not_found.mjs → _not_found-chunk.mjs} +2 -2
- package/fesm2022/_not_found-chunk.mjs.map +1 -0
- package/fesm2022/{resource.mjs → _resource-chunk.mjs} +9 -8
- package/fesm2022/_resource-chunk.mjs.map +1 -0
- package/fesm2022/{root_effect_scheduler.mjs → _root_effect_scheduler-chunk.mjs} +11 -11
- package/fesm2022/_root_effect_scheduler-chunk.mjs.map +1 -0
- package/fesm2022/{signal.mjs → _signal-chunk.mjs} +9 -9
- package/fesm2022/_signal-chunk.mjs.map +1 -0
- package/fesm2022/{weak_ref.mjs → _weak_ref-chunk.mjs} +2 -2
- package/fesm2022/_weak_ref-chunk.mjs.map +1 -0
- package/fesm2022/core.mjs +21 -22
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/{primitives/di.mjs → primitives-di.mjs} +3 -3
- package/fesm2022/primitives-di.mjs.map +1 -0
- package/fesm2022/{primitives/event-dispatch.mjs → primitives-event-dispatch.mjs} +3 -3
- package/fesm2022/primitives-event-dispatch.mjs.map +1 -0
- package/fesm2022/primitives-signals.mjs +221 -0
- package/fesm2022/primitives-signals.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +6 -6
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +6 -6
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +12 -12
- package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +5 -5
- package/schematics/bundles/application-config-core.cjs +5 -5
- package/schematics/bundles/{apply_import_manager-DroqamMP.cjs → apply_import_manager-pLtndDki.cjs} +3 -3
- package/schematics/bundles/bootstrap-options-migration.cjs +13 -91
- package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
- package/schematics/bundles/{compiler_host-aKaS4KRz.cjs → compiler_host-BJEh7-L1.cjs} +2 -2
- package/schematics/bundles/control-flow-migration.cjs +71 -39
- package/schematics/bundles/imports-DwPXlGFl.cjs +1 -1
- package/schematics/bundles/{index-BI97t1U8.cjs → index-DCfgOEYE.cjs} +55 -45
- package/schematics/bundles/{index-DaB-z4lP.cjs → index-bqpULzLD.cjs} +4 -6
- package/schematics/bundles/inject-migration.cjs +3 -3
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-DPuwhGod.cjs → migrate_ts_type_references-COE6BA7E.cjs} +5 -5
- package/schematics/bundles/{ng_component_template-CytqBs-q.cjs → ng_component_template-pDoKlgPP.cjs} +2 -2
- package/schematics/bundles/ng_decorators-BI0uV7KI.cjs +1 -1
- package/schematics/bundles/ngclass-to-class-migration.cjs +108 -96
- package/schematics/bundles/ngstyle-to-style-migration.cjs +7 -7
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +6 -6
- package/schematics/bundles/{parse_html-CeQjkdOK.cjs → parse_html-B6fblY_V.cjs} +2 -2
- package/schematics/bundles/{project_paths-Cz4x-QiT.cjs → project_paths-i0Wjiiq1.cjs} +3 -3
- package/schematics/bundles/{project_tsconfig_paths-Clg7WX1w.cjs → project_tsconfig_paths-sFatqIE5.cjs} +330 -170
- 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/router-last-successful-navigation.cjs +4 -4
- package/schematics/bundles/self-closing-tags-migration.cjs +6 -6
- package/schematics/bundles/signal-input-migration.cjs +67 -8
- package/schematics/bundles/signal-queries-migration.cjs +7 -7
- package/schematics/bundles/signals.cjs +7 -7
- package/schematics/bundles/standalone-migration.cjs +70 -43
- package/schematics/bundles/symbol-BObKoqes.cjs +1 -1
- package/schematics/migrations.json +1 -2
- package/{api.d.d.ts → types/_api-chunk.d.ts} +8 -5
- package/{chrome_dev_tools_performance.d.d.ts → types/_chrome_dev_tools_performance-chunk.d.ts} +3 -3
- package/{discovery.d.d.ts → types/_discovery-chunk.d.ts} +10 -9
- package/{effect.d.d.ts → types/_effect-chunk.d.ts} +2 -3
- package/{event_dispatcher.d.d.ts → types/_event_dispatcher-chunk.d.ts} +1 -1
- package/{graph.d.d.ts → types/_formatter-chunk.d.ts} +14 -2
- package/{weak_ref.d.d.ts → types/_weak_ref-chunk.d.ts} +1 -1
- package/{index.d.ts → types/core.d.ts} +21 -24
- package/{primitives/di/index.d.ts → types/primitives-di.d.ts} +1 -1
- package/{primitives/event-dispatch/index.d.ts → types/primitives-event-dispatch.d.ts} +3 -3
- package/{primitives/signals/index.d.ts → types/primitives-signals.d.ts} +6 -7
- package/{rxjs-interop/index.d.ts → types/rxjs-interop.d.ts} +5 -5
- package/{testing/index.d.ts → types/testing.d.ts} +6 -6
- package/fesm2022/attribute.mjs.map +0 -1
- package/fesm2022/debug_node.mjs.map +0 -1
- package/fesm2022/effect.mjs.map +0 -1
- package/fesm2022/not_found.mjs.map +0 -1
- package/fesm2022/primitives/di.mjs.map +0 -1
- package/fesm2022/primitives/event-dispatch.mjs.map +0 -1
- package/fesm2022/primitives/signals.mjs +0 -89
- package/fesm2022/primitives/signals.mjs.map +0 -1
- package/fesm2022/resource.mjs.map +0 -1
- package/fesm2022/root_effect_scheduler.mjs.map +0 -1
- package/fesm2022/signal.mjs.map +0 -1
- package/fesm2022/weak_ref.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/core",
|
|
3
|
-
"version": "21.0.0-next.
|
|
3
|
+
"version": "21.0.0-next.6",
|
|
4
4
|
"description": "Angular - the core framework",
|
|
5
5
|
"author": "angular",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,27 +18,27 @@
|
|
|
18
18
|
"default": "./package.json"
|
|
19
19
|
},
|
|
20
20
|
".": {
|
|
21
|
-
"types": "./
|
|
21
|
+
"types": "./types/core.d.ts",
|
|
22
22
|
"default": "./fesm2022/core.mjs"
|
|
23
23
|
},
|
|
24
24
|
"./primitives/di": {
|
|
25
|
-
"types": "./primitives
|
|
26
|
-
"default": "./fesm2022/primitives
|
|
25
|
+
"types": "./types/primitives-di.d.ts",
|
|
26
|
+
"default": "./fesm2022/primitives-di.mjs"
|
|
27
27
|
},
|
|
28
28
|
"./primitives/event-dispatch": {
|
|
29
|
-
"types": "./primitives
|
|
30
|
-
"default": "./fesm2022/primitives
|
|
29
|
+
"types": "./types/primitives-event-dispatch.d.ts",
|
|
30
|
+
"default": "./fesm2022/primitives-event-dispatch.mjs"
|
|
31
31
|
},
|
|
32
32
|
"./primitives/signals": {
|
|
33
|
-
"types": "./primitives
|
|
34
|
-
"default": "./fesm2022/primitives
|
|
33
|
+
"types": "./types/primitives-signals.d.ts",
|
|
34
|
+
"default": "./fesm2022/primitives-signals.mjs"
|
|
35
35
|
},
|
|
36
36
|
"./rxjs-interop": {
|
|
37
|
-
"types": "./rxjs-interop
|
|
37
|
+
"types": "./types/rxjs-interop.d.ts",
|
|
38
38
|
"default": "./fesm2022/rxjs-interop.mjs"
|
|
39
39
|
},
|
|
40
40
|
"./testing": {
|
|
41
|
-
"types": "./testing
|
|
41
|
+
"types": "./types/testing.d.ts",
|
|
42
42
|
"default": "./fesm2022/testing.mjs"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"tslib": "^2.3.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@angular/compiler": "21.0.0-next.
|
|
49
|
+
"@angular/compiler": "21.0.0-next.6",
|
|
50
50
|
"rxjs": "^6.5.3 || ^7.4.0",
|
|
51
51
|
"zone.js": "~0.15.0"
|
|
52
52
|
},
|
|
@@ -87,6 +87,6 @@
|
|
|
87
87
|
"schematics": "./schematics/collection.json",
|
|
88
88
|
"sideEffects": false,
|
|
89
89
|
"module": "./fesm2022/core.mjs",
|
|
90
|
-
"typings": "./
|
|
90
|
+
"typings": "./types/core.d.ts",
|
|
91
91
|
"type": "module"
|
|
92
92
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
require('@angular-devkit/core');
|
|
10
10
|
require('node:path/posix');
|
|
11
|
-
var project_paths = require('./project_paths-
|
|
12
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
11
|
+
var project_paths = require('./project_paths-i0Wjiiq1.cjs');
|
|
12
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-sFatqIE5.cjs');
|
|
13
13
|
var ts = require('typescript');
|
|
14
14
|
require('os');
|
|
15
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
16
|
-
require('./index-
|
|
15
|
+
var apply_import_manager = require('./apply_import_manager-pLtndDki.cjs');
|
|
16
|
+
require('./index-DCfgOEYE.cjs');
|
|
17
17
|
require('path');
|
|
18
18
|
require('node:path');
|
|
19
19
|
require('@angular-devkit/schematics');
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.6
|
|
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-sFatqIE5.cjs');
|
|
10
10
|
require('typescript');
|
|
11
11
|
require('os');
|
|
12
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
13
|
-
require('./index-
|
|
12
|
+
var apply_import_manager = require('./apply_import_manager-pLtndDki.cjs');
|
|
13
|
+
require('./index-DCfgOEYE.cjs');
|
|
14
14
|
require('path');
|
|
15
15
|
require('node:path');
|
|
16
|
-
var project_paths = require('./project_paths-
|
|
16
|
+
var project_paths = require('./project_paths-i0Wjiiq1.cjs');
|
|
17
17
|
var imports = require('./imports-DwPXlGFl.cjs');
|
|
18
18
|
require('@angular-devkit/core');
|
|
19
19
|
require('node:path/posix');
|
package/schematics/bundles/{apply_import_manager-DroqamMP.cjs → apply_import_manager-pLtndDki.cjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
12
|
-
var project_paths = require('./project_paths-
|
|
11
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-sFatqIE5.cjs');
|
|
12
|
+
var project_paths = require('./project_paths-i0Wjiiq1.cjs');
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Applies import manager changes, and writes them as replacements the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
require('@angular-devkit/core');
|
|
10
10
|
require('node:path/posix');
|
|
11
|
-
var project_paths = require('./project_paths-
|
|
11
|
+
var project_paths = require('./project_paths-i0Wjiiq1.cjs');
|
|
12
12
|
require('os');
|
|
13
13
|
var ts = require('typescript');
|
|
14
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
15
|
-
var index = require('./index-
|
|
14
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-sFatqIE5.cjs');
|
|
15
|
+
var index = require('./index-DCfgOEYE.cjs');
|
|
16
16
|
require('path');
|
|
17
17
|
require('node:path');
|
|
18
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
18
|
+
var apply_import_manager = require('./apply_import_manager-pLtndDki.cjs');
|
|
19
19
|
var property_name = require('./property_name-BBwFuqMe.cjs');
|
|
20
20
|
var imports = require('./imports-DwPXlGFl.cjs');
|
|
21
21
|
var symbol = require('./symbol-BObKoqes.cjs');
|
|
@@ -27,34 +27,6 @@ require('url');
|
|
|
27
27
|
const CORE_PACKAGE = '@angular/core';
|
|
28
28
|
const PROVIDE_ZONE_CHANGE_DETECTION = 'provideZoneChangeDetection';
|
|
29
29
|
const ZONE_CD_PROVIDER = `${PROVIDE_ZONE_CHANGE_DETECTION}()`;
|
|
30
|
-
const NoopNgZone = `
|
|
31
|
-
// TODO ADD WARNING MESSAGE
|
|
32
|
-
export class NoopNgZone implements NgZone {
|
|
33
|
-
readonly hasPendingMicrotasks = false;
|
|
34
|
-
readonly hasPendingMacrotasks = false;
|
|
35
|
-
readonly isStable = true;
|
|
36
|
-
readonly onUnstable = new EventEmitter<any>();
|
|
37
|
-
readonly onMicrotaskEmpty = new EventEmitter<any>();
|
|
38
|
-
readonly onStable = new EventEmitter<any>();
|
|
39
|
-
readonly onError = new EventEmitter<any>();
|
|
40
|
-
|
|
41
|
-
run<T>(fn: (...args: any[]) => T, applyThis?: any, applyArgs?: any): T {
|
|
42
|
-
return fn.apply(applyThis, applyArgs);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
runGuarded<T>(fn: (...args: any[]) => any, applyThis?: any, applyArgs?: any): T {
|
|
46
|
-
return fn.apply(applyThis, applyArgs);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
runOutsideAngular<T>(fn: (...args: any[]) => T): T {
|
|
50
|
-
return fn();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
runTask<T>(fn: (...args: any[]) => T, applyThis?: any, applyArgs?: any, name?: string): T {
|
|
54
|
-
return fn.apply(applyThis, applyArgs);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
30
|
class BootstrapOptionsMigration extends project_paths.TsurgeFunnelMigration {
|
|
59
31
|
async analyze(info) {
|
|
60
32
|
let replacements = [];
|
|
@@ -65,11 +37,12 @@ class BootstrapOptionsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
65
37
|
// * `platformBrowser().bootstrapModule(AppModule)`
|
|
66
38
|
// * `platformBrowserDynamic().bootstrapModule(AppModule)`
|
|
67
39
|
// * `TestBed.initTestEnvironment([AppModule], platformBrowserTesting())`
|
|
40
|
+
// * `getTestBed.initTestEnvironment([AppModule], platformBrowserTesting())`
|
|
68
41
|
const specifiers = getSpecifiers(sourceFile);
|
|
69
42
|
// If none of the imports related to bootstraping are present, we can skip the file.
|
|
70
43
|
if (specifiers === null)
|
|
71
44
|
continue;
|
|
72
|
-
const { bootstrapAppSpecifier, platformBrowserDynamicSpecifier, platformBrowserSpecifier, testBedSpecifier, createApplicationSpecifier, } = specifiers;
|
|
45
|
+
const { bootstrapAppSpecifier, platformBrowserDynamicSpecifier, platformBrowserSpecifier, testBedSpecifier, createApplicationSpecifier, getTestBedSpecifier, } = specifiers;
|
|
73
46
|
const typeChecker = info.program.getTypeChecker();
|
|
74
47
|
const isCreateApplicationNode = (node) => {
|
|
75
48
|
return (ts.isCallExpression(node) &&
|
|
@@ -93,23 +66,8 @@ class BootstrapOptionsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
93
66
|
return (ts.isCallExpression(node) &&
|
|
94
67
|
ts.isPropertyAccessExpression(node.expression) &&
|
|
95
68
|
node.expression.name.text === 'initTestEnvironment' &&
|
|
96
|
-
symbol.isReferenceToImport(typeChecker, node.expression.expression, testBedSpecifier)
|
|
97
|
-
|
|
98
|
-
const NgModuleWithBootstrapPropMetadataLiteral = (node) => {
|
|
99
|
-
const moduleClass = node;
|
|
100
|
-
const ngModule = findNgModule(moduleClass, reflector);
|
|
101
|
-
if (!ngModule)
|
|
102
|
-
return;
|
|
103
|
-
const ngModuleMetadata = evaluator.evaluate(ngModule);
|
|
104
|
-
if (!(ngModuleMetadata instanceof Map)) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (ngModuleMetadata.has('bootstrap') &&
|
|
108
|
-
Array.isArray(ngModuleMetadata.get('bootstrap')) &&
|
|
109
|
-
ngModuleMetadata.get('bootstrap').length > 0) {
|
|
110
|
-
return ngModule;
|
|
111
|
-
}
|
|
112
|
-
return;
|
|
69
|
+
(symbol.isReferenceToImport(typeChecker, node.expression.expression, testBedSpecifier) ||
|
|
70
|
+
symbol.isReferenceToImport(typeChecker, node.expression.expression, getTestBedSpecifier)));
|
|
113
71
|
};
|
|
114
72
|
const reflector = new project_tsconfig_paths.TypeScriptReflectionHost(typeChecker);
|
|
115
73
|
const evaluator = new index.PartialEvaluator(reflector, typeChecker, null);
|
|
@@ -126,13 +84,6 @@ class BootstrapOptionsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
126
84
|
else if (isTestBedInitEnvironmentNode(node)) {
|
|
127
85
|
this.analyzeTestBedInitEnvironment(node, sourceFile, info, typeChecker, importManager, replacements);
|
|
128
86
|
}
|
|
129
|
-
else if (ts.isClassDeclaration(node)) {
|
|
130
|
-
// This case is specific for handling G3 where the NgModule metadata might not be inspectable when it's in a different build target.
|
|
131
|
-
const ngModuleLiteral = NgModuleWithBootstrapPropMetadataLiteral(node);
|
|
132
|
-
if (ngModuleLiteral) {
|
|
133
|
-
this.analyzeModuleWithBootstrapProp(ngModuleLiteral, sourceFile, info, typeChecker, importManager, replacements);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
87
|
node.forEachChild(walk);
|
|
137
88
|
};
|
|
138
89
|
sourceFile.forEachChild(walk);
|
|
@@ -309,23 +260,6 @@ class BootstrapOptionsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
309
260
|
}
|
|
310
261
|
}
|
|
311
262
|
else if (typeof ngZoneOption === 'string' && ngZoneOption === 'noop') {
|
|
312
|
-
importManager.addImport({
|
|
313
|
-
exportModuleSpecifier: CORE_PACKAGE,
|
|
314
|
-
exportSymbolName: 'NgZone',
|
|
315
|
-
requestedFile: moduleSourceFile,
|
|
316
|
-
});
|
|
317
|
-
// The migration specifically relies on this being longer than ZoneChangeDetectionModule
|
|
318
|
-
// As we take the "longest" change in case of duplicate replacements.
|
|
319
|
-
const moduleName = 'ZonelessChangeDetectionModule';
|
|
320
|
-
replacements.push(new project_paths.Replacement(moduleProjectFile, new project_paths.TextUpdate({
|
|
321
|
-
position: moduleClass.getStart() - 1,
|
|
322
|
-
end: moduleClass.getStart() - 1,
|
|
323
|
-
toInsert: `${NoopNgZone}\n@NgModule({providers: [{provide: NgZone, useClass: NoopNgZone}]})\nexport class ${moduleName} {}\n\n`,
|
|
324
|
-
})));
|
|
325
|
-
const importsNode = property_name.findLiteralProperty(ngModule, 'imports');
|
|
326
|
-
if (importsNode && ts.isPropertyAssignment(importsNode)) {
|
|
327
|
-
insertZoneCDModule(importsNode.initializer, moduleProjectFile, replacements, moduleName);
|
|
328
|
-
}
|
|
329
263
|
return;
|
|
330
264
|
}
|
|
331
265
|
else if (ngZoneOption && typeof ngZoneOption !== 'string') {
|
|
@@ -394,21 +328,6 @@ class BootstrapOptionsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
394
328
|
addZoneCDModule(ZONE_CD_PROVIDER, moduleProjectFile, insertPosition, replacements);
|
|
395
329
|
insertZoneCDModule(ngModules, moduleProjectFile, replacements, 'ZoneChangeDetectionModule');
|
|
396
330
|
}
|
|
397
|
-
analyzeModuleWithBootstrapProp(ngModuleProps, sourceFile, info, typeChecker, importManager, replacements) {
|
|
398
|
-
if (sourceFile.getText().includes('ZoneChangeDetectionModule')) {
|
|
399
|
-
// If the file already contains the ZoneChangeDetectionModule, we can skip it.
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
const hasExistingChangeDetectionProvider = hasChangeDetectionProvider(ngModuleProps, typeChecker);
|
|
403
|
-
if (hasExistingChangeDetectionProvider)
|
|
404
|
-
return;
|
|
405
|
-
importManager.addImport({
|
|
406
|
-
exportModuleSpecifier: CORE_PACKAGE,
|
|
407
|
-
exportSymbolName: PROVIDE_ZONE_CHANGE_DETECTION,
|
|
408
|
-
requestedFile: sourceFile,
|
|
409
|
-
});
|
|
410
|
-
addProvidersToNgModule(project_paths.projectFile(sourceFile, info), sourceFile, ngModuleProps, ZONE_CD_PROVIDER, replacements);
|
|
411
|
-
}
|
|
412
331
|
}
|
|
413
332
|
function addProvidersToNgModule(projectFile, moduleSourceFile, ngModule, providersText, replacements) {
|
|
414
333
|
// ObjLiteral => callExp => Decorator => ClassExpression
|
|
@@ -629,13 +548,15 @@ function getSpecifiers(sourceFile) {
|
|
|
629
548
|
const platformBrowserDynamicSpecifier = imports.getImportSpecifier(sourceFile, '@angular/platform-browser-dynamic', 'platformBrowserDynamic');
|
|
630
549
|
const platformBrowserSpecifier = imports.getImportSpecifier(sourceFile, '@angular/platform-browser', 'platformBrowser');
|
|
631
550
|
const testBedSpecifier = imports.getImportSpecifier(sourceFile, '@angular/core/testing', 'TestBed');
|
|
551
|
+
const getTestBedSpecifier = imports.getImportSpecifier(sourceFile, '@angular/core/testing', 'getTestBed');
|
|
632
552
|
const ngModuleSpecifier = imports.getImportSpecifier(sourceFile, '@angular/core', 'NgModule');
|
|
633
553
|
if (!createApplicationSpecifier &&
|
|
634
554
|
!bootstrapAppSpecifier &&
|
|
635
555
|
!platformBrowserDynamicSpecifier &&
|
|
636
556
|
!platformBrowserSpecifier &&
|
|
637
557
|
!testBedSpecifier &&
|
|
638
|
-
!ngModuleSpecifier
|
|
558
|
+
!ngModuleSpecifier &&
|
|
559
|
+
!getTestBedSpecifier) {
|
|
639
560
|
return null;
|
|
640
561
|
}
|
|
641
562
|
return {
|
|
@@ -645,6 +566,7 @@ function getSpecifiers(sourceFile) {
|
|
|
645
566
|
platformBrowserSpecifier,
|
|
646
567
|
testBedSpecifier,
|
|
647
568
|
ngModuleSpecifier,
|
|
569
|
+
getTestBedSpecifier,
|
|
648
570
|
};
|
|
649
571
|
}
|
|
650
572
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
require('@angular-devkit/core');
|
|
10
10
|
require('node:path/posix');
|
|
11
|
-
var project_paths = require('./project_paths-
|
|
11
|
+
var project_paths = require('./project_paths-i0Wjiiq1.cjs');
|
|
12
12
|
var ts = require('typescript');
|
|
13
13
|
require('os');
|
|
14
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
15
|
-
var index = require('./index-
|
|
14
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-sFatqIE5.cjs');
|
|
15
|
+
var index = require('./index-DCfgOEYE.cjs');
|
|
16
16
|
require('path');
|
|
17
17
|
require('node:path');
|
|
18
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
18
|
+
var apply_import_manager = require('./apply_import_manager-pLtndDki.cjs');
|
|
19
19
|
require('@angular-devkit/schematics');
|
|
20
20
|
require('fs');
|
|
21
21
|
require('module');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.6
|
|
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
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
10
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-sFatqIE5.cjs');
|
|
11
11
|
require('os');
|
|
12
12
|
var p = require('path');
|
|
13
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
10
|
var p = require('path');
|
|
11
|
-
var compiler_host = require('./compiler_host-
|
|
12
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
11
|
+
var compiler_host = require('./compiler_host-BJEh7-L1.cjs');
|
|
12
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-sFatqIE5.cjs');
|
|
13
13
|
var ts = require('typescript');
|
|
14
|
-
var parse_html = require('./parse_html-
|
|
14
|
+
var parse_html = require('./parse_html-B6fblY_V.cjs');
|
|
15
15
|
require('os');
|
|
16
16
|
require('fs');
|
|
17
17
|
require('module');
|
|
@@ -410,6 +410,7 @@ const endMarkerRegex = new RegExp(endMarker, 'gm');
|
|
|
410
410
|
const startI18nMarkerRegex = new RegExp(startI18nMarker, 'gm');
|
|
411
411
|
const endI18nMarkerRegex = new RegExp(endI18nMarker, 'gm');
|
|
412
412
|
const replaceMarkerRegex = new RegExp(`${startMarker}|${endMarker}`, 'gm');
|
|
413
|
+
const PRIORITY_WEIGHT_TEMPLATE_REFERENCE_BY_OUTLET = 2;
|
|
413
414
|
/**
|
|
414
415
|
* Analyzes a source file to find file that need to be migrated and the text ranges within them.
|
|
415
416
|
* @param sourceFile File to be analyzed.
|
|
@@ -689,34 +690,6 @@ function getTemplates(template) {
|
|
|
689
690
|
}
|
|
690
691
|
return new Map();
|
|
691
692
|
}
|
|
692
|
-
function countTemplateUsage(nodes, templateName) {
|
|
693
|
-
let count = 0;
|
|
694
|
-
let isReferencedInTemplateOutlet = false;
|
|
695
|
-
for (const node of nodes) {
|
|
696
|
-
if (node.attrs) {
|
|
697
|
-
for (const attr of node.attrs) {
|
|
698
|
-
if (attr.name === '*ngTemplateOutlet' && attr.value === templateName.slice(1)) {
|
|
699
|
-
isReferencedInTemplateOutlet = true;
|
|
700
|
-
break;
|
|
701
|
-
}
|
|
702
|
-
if (attr.name.trim() === templateName) {
|
|
703
|
-
count++;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
if (node.children) {
|
|
708
|
-
if (node.name === 'for') {
|
|
709
|
-
for (const child of node.children) {
|
|
710
|
-
if (child.value?.includes(templateName.slice(1))) {
|
|
711
|
-
count++;
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
count += countTemplateUsage(node.children, templateName);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
return isReferencedInTemplateOutlet ? count + 2 : count;
|
|
719
|
-
}
|
|
720
693
|
function updateTemplates(template, templates) {
|
|
721
694
|
const updatedTemplates = getTemplates(template);
|
|
722
695
|
for (let [key, tmpl] of updatedTemplates) {
|
|
@@ -740,9 +713,10 @@ function processNgTemplates(template, sourceFile) {
|
|
|
740
713
|
try {
|
|
741
714
|
const templates = getTemplates(template);
|
|
742
715
|
// swap placeholders and remove
|
|
743
|
-
for (const [
|
|
744
|
-
const
|
|
745
|
-
const
|
|
716
|
+
for (const [nameWithHash, t] of templates) {
|
|
717
|
+
const name = nameWithHash.slice(1);
|
|
718
|
+
const replaceRegex = new RegExp(getPlaceholder(name), 'g');
|
|
719
|
+
const forRegex = new RegExp(getPlaceholder(nameWithHash.slice(1), PlaceholderKind.Alternate), 'g');
|
|
746
720
|
const forMatches = [...template.matchAll(forRegex)];
|
|
747
721
|
const matches = [...forMatches, ...template.matchAll(replaceRegex)];
|
|
748
722
|
let safeToRemove = true;
|
|
@@ -767,7 +741,12 @@ function processNgTemplates(template, sourceFile) {
|
|
|
767
741
|
template = template.replace(replaceRegex, t.children);
|
|
768
742
|
}
|
|
769
743
|
const dist = matches.filter((obj, index, self) => index === self.findIndex((t) => t.input === obj.input));
|
|
770
|
-
|
|
744
|
+
// Check if template is used by ngTemplateOutlet in addition to control flow
|
|
745
|
+
const hasTemplateOutletUsage = checkForTemplateOutletUsage(template, nameWithHash.slice(1));
|
|
746
|
+
// Only remove template if it's safe to do so AND not used by ngTemplateOutlet
|
|
747
|
+
if ((t.count === dist.length || t.count - matches.length === 1) &&
|
|
748
|
+
safeToRemove &&
|
|
749
|
+
!hasTemplateOutletUsage) {
|
|
771
750
|
const refsInComponentFile = getViewChildOrViewChildrenNames(sourceFile);
|
|
772
751
|
if (refsInComponentFile?.length > 0) {
|
|
773
752
|
const templateRefs = getTemplateReferences(template);
|
|
@@ -797,6 +776,59 @@ function processNgTemplates(template, sourceFile) {
|
|
|
797
776
|
return { migrated: template, err: err };
|
|
798
777
|
}
|
|
799
778
|
}
|
|
779
|
+
function analyzeTemplateUsage(nodes, templateName) {
|
|
780
|
+
let count = 0;
|
|
781
|
+
let isReferencedInTemplateOutlet = false;
|
|
782
|
+
const templateNameWithHash = `#${templateName}`;
|
|
783
|
+
function traverseNodes(nodeList) {
|
|
784
|
+
for (const node of nodeList) {
|
|
785
|
+
if (node.attrs) {
|
|
786
|
+
for (const attr of node.attrs) {
|
|
787
|
+
if ((attr.name === '*ngTemplateOutlet' || attr.name === '[ngTemplateOutlet]') &&
|
|
788
|
+
attr.value === templateName) {
|
|
789
|
+
isReferencedInTemplateOutlet = true;
|
|
790
|
+
}
|
|
791
|
+
if (attr.name.trim() === templateNameWithHash) {
|
|
792
|
+
count++;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
if (node.children) {
|
|
797
|
+
if (node.name === 'for') {
|
|
798
|
+
for (const child of node.children) {
|
|
799
|
+
if (child.value?.includes(templateName)) {
|
|
800
|
+
count++;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
traverseNodes(node.children);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
traverseNodes(nodes);
|
|
809
|
+
return {
|
|
810
|
+
isReferencedInTemplateOutlet,
|
|
811
|
+
totalCount: isReferencedInTemplateOutlet
|
|
812
|
+
? count + PRIORITY_WEIGHT_TEMPLATE_REFERENCE_BY_OUTLET
|
|
813
|
+
: count,
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Checks if a template is used by ngTemplateOutlet directive
|
|
818
|
+
*/
|
|
819
|
+
function checkForTemplateOutletUsage(template, templateName) {
|
|
820
|
+
const parsed = parse_html.parseTemplate(template);
|
|
821
|
+
if (parsed.tree === undefined) {
|
|
822
|
+
return false;
|
|
823
|
+
}
|
|
824
|
+
const result = analyzeTemplateUsage(parsed.tree.rootNodes, templateName);
|
|
825
|
+
return result.isReferencedInTemplateOutlet;
|
|
826
|
+
}
|
|
827
|
+
function countTemplateUsage(nodes, templateNameWithHash) {
|
|
828
|
+
const templateName = templateNameWithHash.slice(1);
|
|
829
|
+
const result = analyzeTemplateUsage(nodes, templateName);
|
|
830
|
+
return result.totalCount;
|
|
831
|
+
}
|
|
800
832
|
function getViewChildOrViewChildrenNames(sourceFile) {
|
|
801
833
|
const names = [];
|
|
802
834
|
function visit(node) {
|
|
@@ -821,11 +853,11 @@ function getTemplateReferences(template) {
|
|
|
821
853
|
if (parsed.tree === undefined) {
|
|
822
854
|
return [];
|
|
823
855
|
}
|
|
824
|
-
const
|
|
856
|
+
const templateNameRefWithoutHash = [];
|
|
825
857
|
function visitNodes(nodes) {
|
|
826
858
|
for (const node of nodes) {
|
|
827
859
|
if (node?.name === 'ng-template') {
|
|
828
|
-
|
|
860
|
+
templateNameRefWithoutHash.push(...node.attrs?.map((ref) => ref?.name?.slice(1)));
|
|
829
861
|
}
|
|
830
862
|
if (node.children) {
|
|
831
863
|
visitNodes(node.children);
|
|
@@ -833,7 +865,7 @@ function getTemplateReferences(template) {
|
|
|
833
865
|
}
|
|
834
866
|
}
|
|
835
867
|
visitNodes(parsed.tree.rootNodes);
|
|
836
|
-
return
|
|
868
|
+
return templateNameRefWithoutHash;
|
|
837
869
|
}
|
|
838
870
|
function replaceRemainingPlaceholders(template) {
|
|
839
871
|
const pattern = '.*';
|