@angular/core 21.0.0-next.4 → 21.0.0-next.5
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 +7 -4
- package/chrome_dev_tools_performance.d.d.ts +1 -1
- package/discovery.d.d.ts +6 -5
- package/effect.d.d.ts +1 -2
- package/event_dispatcher.d.d.ts +1 -1
- package/fesm2022/attribute.mjs +1 -1
- package/fesm2022/core.mjs +10 -11
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/debug_node.mjs +56 -65
- package/fesm2022/debug_node.mjs.map +1 -1
- package/fesm2022/effect.mjs +3 -4
- package/fesm2022/effect.mjs.map +1 -1
- package/fesm2022/not_found.mjs +1 -1
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +3 -4
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/resource.mjs +5 -4
- package/fesm2022/resource.mjs.map +1 -1
- package/fesm2022/root_effect_scheduler.mjs +8 -8
- package/fesm2022/root_effect_scheduler.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/signal.mjs +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/fesm2022/weak_ref.mjs +1 -1
- package/graph.d.d.ts +1 -1
- package/index.d.ts +9 -12
- 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 -2
- package/rxjs-interop/index.d.ts +1 -1
- 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-Bx60Uquz.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-Aouk-n4F.cjs} +2 -2
- package/schematics/bundles/control-flow-migration.cjs +71 -39
- package/schematics/bundles/imports-DwPXlGFl.cjs +1 -1
- package/schematics/bundles/{index-DaB-z4lP.cjs → index-BZQb51Qf.cjs} +4 -4
- package/schematics/bundles/{index-BI97t1U8.cjs → index-Bb6iejCd.cjs} +35 -21
- 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-By2ZtKls.cjs} +5 -5
- package/schematics/bundles/{ng_component_template-CytqBs-q.cjs → ng_component_template-B4M8mTyv.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-7Wl_HDnw.cjs} +2 -2
- package/schematics/bundles/{project_paths-Cz4x-QiT.cjs → project_paths-Dr2s3Pq3.cjs} +3 -3
- package/schematics/bundles/{project_tsconfig_paths-Clg7WX1w.cjs → project_tsconfig_paths-DX9KHLn9.cjs} +258 -41
- 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 +7 -7
- package/schematics/bundles/signal-queries-migration.cjs +7 -7
- package/schematics/bundles/signals.cjs +7 -7
- package/schematics/bundles/standalone-migration.cjs +14 -7
- package/schematics/bundles/symbol-BObKoqes.cjs +1 -1
- package/testing/index.d.ts +1 -1
- package/weak_ref.d.d.ts +1 -1
package/fesm2022/signal.mjs
CHANGED
package/fesm2022/testing.mjs
CHANGED
package/fesm2022/weak_ref.mjs
CHANGED
package/graph.d.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.0.0-next.
|
|
2
|
+
* @license Angular v21.0.0-next.5
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2194,6 +2194,7 @@ declare function linkedSignal<S, D>(options: {
|
|
|
2194
2194
|
value: NoInfer<D>;
|
|
2195
2195
|
}) => D;
|
|
2196
2196
|
equal?: ValueEqualityFn<NoInfer<D>>;
|
|
2197
|
+
debugName?: string;
|
|
2197
2198
|
}): WritableSignal<D>;
|
|
2198
2199
|
|
|
2199
2200
|
/**
|
|
@@ -3525,7 +3526,6 @@ declare class TemplateRef<C> {
|
|
|
3525
3526
|
*
|
|
3526
3527
|
* ```angular-ts
|
|
3527
3528
|
* @Component({
|
|
3528
|
-
* standalone: true,
|
|
3529
3529
|
* selector: 'dynamic',
|
|
3530
3530
|
* template: `<span>This is a content of a dynamic component.</span>`,
|
|
3531
3531
|
* })
|
|
@@ -3534,7 +3534,6 @@ declare class TemplateRef<C> {
|
|
|
3534
3534
|
* }
|
|
3535
3535
|
*
|
|
3536
3536
|
* @Component({
|
|
3537
|
-
* standalone: true,
|
|
3538
3537
|
* selector: 'app',
|
|
3539
3538
|
* template: `<main>Hi! This is the main content.</main>`,
|
|
3540
3539
|
* })
|
|
@@ -4770,6 +4769,7 @@ declare const enum RuntimeErrorCode {
|
|
|
4770
4769
|
MISSING_INJECTION_TOKEN = 208,
|
|
4771
4770
|
INVALID_MULTI_PROVIDER = -209,
|
|
4772
4771
|
MISSING_DOCUMENT = 210,
|
|
4772
|
+
INVALID_APP_ID = 211,
|
|
4773
4773
|
MULTIPLE_COMPONENTS_MATCH = -300,
|
|
4774
4774
|
EXPORT_NOT_FOUND = -301,
|
|
4775
4775
|
PIPE_NOT_FOUND = -302,
|
|
@@ -4789,7 +4789,7 @@ declare const enum RuntimeErrorCode {
|
|
|
4789
4789
|
INVALID_BINDING_TARGET = 316,
|
|
4790
4790
|
INVALID_SET_INPUT_CALL = 317,
|
|
4791
4791
|
MULTIPLE_PLATFORMS = 400,
|
|
4792
|
-
PLATFORM_NOT_FOUND = 401,
|
|
4792
|
+
PLATFORM_NOT_FOUND = -401,
|
|
4793
4793
|
MISSING_REQUIRED_INJECTABLE_IN_BOOTSTRAP = 402,
|
|
4794
4794
|
BOOTSTRAP_COMPONENTS_NOT_FOUND = -403,
|
|
4795
4795
|
PLATFORM_ALREADY_DESTROYED = 404,
|
|
@@ -6383,12 +6383,12 @@ declare function ɵɵdeferHydrateOnViewport(): void;
|
|
|
6383
6383
|
declare function ɵɵadvance(delta?: number): void;
|
|
6384
6384
|
|
|
6385
6385
|
/**
|
|
6386
|
-
* Update an ARIA attribute
|
|
6386
|
+
* Update an ARIA attribute on a selected element.
|
|
6387
6387
|
*
|
|
6388
|
-
* If the
|
|
6389
|
-
* inputs will be set instead of the element
|
|
6388
|
+
* If the attribute name also exists as an input property on any of the element's directives, those
|
|
6389
|
+
* inputs will be set instead of the element attribute.
|
|
6390
6390
|
*
|
|
6391
|
-
* @param name Name of the ARIA attribute
|
|
6391
|
+
* @param name Name of the ARIA attribute (beginning with `aria-`).
|
|
6392
6392
|
* @param value New value to write.
|
|
6393
6393
|
* @returns This function returns itself so that it may be chained.
|
|
6394
6394
|
*
|
|
@@ -9099,7 +9099,6 @@ declare const depsTracker: DepsTracker;
|
|
|
9099
9099
|
*
|
|
9100
9100
|
* ```angular-ts
|
|
9101
9101
|
* @Component({
|
|
9102
|
-
* standalone: true,
|
|
9103
9102
|
* template: `Hello {{ name }}!`
|
|
9104
9103
|
* })
|
|
9105
9104
|
* class HelloComponent {
|
|
@@ -9107,7 +9106,6 @@ declare const depsTracker: DepsTracker;
|
|
|
9107
9106
|
* }
|
|
9108
9107
|
*
|
|
9109
9108
|
* @Component({
|
|
9110
|
-
* standalone: true,
|
|
9111
9109
|
* template: `<div id="hello-component-host"></div>`
|
|
9112
9110
|
* })
|
|
9113
9111
|
* class RootComponent {}
|
|
@@ -9144,7 +9142,7 @@ declare const depsTracker: DepsTracker;
|
|
|
9144
9142
|
* `[[element1, element2], [element3]]`: projects `element1` and `element2` into one `<ng-content>`,
|
|
9145
9143
|
* and `element3` into a separate `<ng-content>`.
|
|
9146
9144
|
* * `directives` (optional): Directives that should be applied to the component.
|
|
9147
|
-
* * `
|
|
9145
|
+
* * `bindings` (optional): Bindings to apply to the root component.
|
|
9148
9146
|
* @returns ComponentRef instance that represents a given Component.
|
|
9149
9147
|
*
|
|
9150
9148
|
* @publicApi
|
|
@@ -9208,7 +9206,6 @@ interface ComponentMirror<C> {
|
|
|
9208
9206
|
*
|
|
9209
9207
|
* ```angular-ts
|
|
9210
9208
|
* @Component({
|
|
9211
|
-
* standalone: true,
|
|
9212
9209
|
* selector: 'foo-component',
|
|
9213
9210
|
* template: `
|
|
9214
9211
|
* <ng-content></ng-content>
|
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.5",
|
|
4
4
|
"description": "Angular - the core framework",
|
|
5
5
|
"author": "angular",
|
|
6
6
|
"license": "MIT",
|
|
@@ -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.5",
|
|
50
50
|
"rxjs": "^6.5.3 || ^7.4.0",
|
|
51
51
|
"zone.js": "~0.15.0"
|
|
52
52
|
},
|
package/primitives/di/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.0.0-next.
|
|
2
|
+
* @license Angular v21.0.0-next.5
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -106,7 +106,6 @@ interface Watch {
|
|
|
106
106
|
[SIGNAL]: WatchNode;
|
|
107
107
|
}
|
|
108
108
|
interface WatchNode extends ReactiveNode {
|
|
109
|
-
hasRun: boolean;
|
|
110
109
|
fn: ((onCleanup: WatchCleanupRegisterFn) => void) | null;
|
|
111
110
|
schedule: ((watch: Watch) => void) | null;
|
|
112
111
|
cleanupFn: WatchCleanupFn;
|
package/rxjs-interop/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.5
|
|
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-Dr2s3Pq3.cjs');
|
|
12
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.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-Bx60Uquz.cjs');
|
|
16
|
+
require('./index-Bb6iejCd.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.5
|
|
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-DX9KHLn9.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-Bx60Uquz.cjs');
|
|
13
|
+
require('./index-Bb6iejCd.cjs');
|
|
14
14
|
require('path');
|
|
15
15
|
require('node:path');
|
|
16
|
-
var project_paths = require('./project_paths-
|
|
16
|
+
var project_paths = require('./project_paths-Dr2s3Pq3.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-Bx60Uquz.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.5
|
|
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-DX9KHLn9.cjs');
|
|
12
|
+
var project_paths = require('./project_paths-Dr2s3Pq3.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.5
|
|
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-Dr2s3Pq3.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-DX9KHLn9.cjs');
|
|
15
|
+
var index = require('./index-Bb6iejCd.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-Bx60Uquz.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.5
|
|
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-Dr2s3Pq3.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-DX9KHLn9.cjs');
|
|
15
|
+
var index = require('./index-Bb6iejCd.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-Bx60Uquz.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.5
|
|
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-DX9KHLn9.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.5
|
|
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-Aouk-n4F.cjs');
|
|
12
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.cjs');
|
|
13
13
|
var ts = require('typescript');
|
|
14
|
-
var parse_html = require('./parse_html-
|
|
14
|
+
var parse_html = require('./parse_html-7Wl_HDnw.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 = '.*';
|