@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
|
@@ -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,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
|
-
var index = require('./index-
|
|
11
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.cjs');
|
|
12
|
+
var index = require('./index-Bb6iejCd.cjs');
|
|
13
13
|
require('path');
|
|
14
14
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
15
|
+
var project_paths = require('./project_paths-Dr2s3Pq3.cjs');
|
|
16
16
|
|
|
17
17
|
function getMemberName(member) {
|
|
18
18
|
if (member.name === undefined) {
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
var ts = require('typescript');
|
|
11
11
|
var p = require('path');
|
|
12
12
|
require('os');
|
|
@@ -891,7 +891,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
891
891
|
function compileDeclareClassMetadata(metadata) {
|
|
892
892
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
893
893
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
894
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
894
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.5'));
|
|
895
895
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
896
896
|
definitionMap.set('type', metadata.type);
|
|
897
897
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -909,7 +909,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
909
909
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? project_tsconfig_paths.literal(null));
|
|
910
910
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? project_tsconfig_paths.literal(null));
|
|
911
911
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
912
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
912
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.5'));
|
|
913
913
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
914
914
|
definitionMap.set('type', metadata.type);
|
|
915
915
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -1004,7 +1004,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
1004
1004
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
1005
1005
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
1006
1006
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(minVersion));
|
|
1007
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1007
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.5'));
|
|
1008
1008
|
// e.g. `type: MyDirective`
|
|
1009
1009
|
definitionMap.set('type', meta.type.value);
|
|
1010
1010
|
if (meta.isStandalone !== undefined) {
|
|
@@ -1420,7 +1420,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
1420
1420
|
function compileDeclareFactoryFunction(meta) {
|
|
1421
1421
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
1422
1422
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
1423
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1423
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.5'));
|
|
1424
1424
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
1425
1425
|
definitionMap.set('type', meta.type.value);
|
|
1426
1426
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -1455,7 +1455,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
1455
1455
|
function createInjectableDefinitionMap(meta) {
|
|
1456
1456
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
1457
1457
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
1458
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1458
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.5'));
|
|
1459
1459
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
1460
1460
|
definitionMap.set('type', meta.type.value);
|
|
1461
1461
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -1506,7 +1506,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
1506
1506
|
function createInjectorDefinitionMap(meta) {
|
|
1507
1507
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
1508
1508
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
1509
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1509
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.5'));
|
|
1510
1510
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
1511
1511
|
definitionMap.set('type', meta.type.value);
|
|
1512
1512
|
definitionMap.set('providers', meta.providers);
|
|
@@ -1539,7 +1539,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
1539
1539
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
1540
1540
|
}
|
|
1541
1541
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
1542
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1542
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.5'));
|
|
1543
1543
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
1544
1544
|
definitionMap.set('type', meta.type.value);
|
|
1545
1545
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -1590,7 +1590,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
1590
1590
|
function createPipeDefinitionMap(meta) {
|
|
1591
1591
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
1592
1592
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
1593
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1593
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.5'));
|
|
1594
1594
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
1595
1595
|
// e.g. `type: MyPipe`
|
|
1596
1596
|
definitionMap.set('type', meta.type.value);
|
|
@@ -11525,11 +11525,12 @@ class ComponentDecoratorHandler {
|
|
|
11525
11525
|
for (const [_, deps] of resolution.deferPerBlockDependencies) {
|
|
11526
11526
|
for (const deferBlockDep of deps) {
|
|
11527
11527
|
const node = deferBlockDep.declaration.node;
|
|
11528
|
-
const
|
|
11529
|
-
if (
|
|
11528
|
+
const importInfo = resolution.deferrableDeclToImportDecl.get(node) ?? null;
|
|
11529
|
+
if (importInfo !== null && this.deferredSymbolTracker.canDefer(importInfo.node)) {
|
|
11530
11530
|
deferBlockDep.isDeferrable = true;
|
|
11531
|
-
deferBlockDep.
|
|
11532
|
-
deferBlockDep.
|
|
11531
|
+
deferBlockDep.symbolName = importInfo.name;
|
|
11532
|
+
deferBlockDep.importPath = importInfo.from;
|
|
11533
|
+
deferBlockDep.isDefaultImport = isDefaultImport(importInfo.node);
|
|
11533
11534
|
// The same dependency may be used across multiple deferred blocks. De-duplicate it
|
|
11534
11535
|
// because it can throw off other logic further down the compilation pipeline.
|
|
11535
11536
|
// Note that the logic above needs to run even if the dependency is seen before,
|
|
@@ -11702,9 +11703,10 @@ class ComponentDecoratorHandler {
|
|
|
11702
11703
|
// This is not a directive or a pipe.
|
|
11703
11704
|
return;
|
|
11704
11705
|
}
|
|
11705
|
-
// Keep track of how this class made it into the current source file
|
|
11706
|
-
//
|
|
11707
|
-
|
|
11706
|
+
// Keep track of how this class made it into the current source file.
|
|
11707
|
+
// Store the full `Import` info so that callers can correctly determine the
|
|
11708
|
+
// exported name (handling aliasing) and the module specifier.
|
|
11709
|
+
resolutionData.deferrableDeclToImportDecl.set(decl.node, imp);
|
|
11708
11710
|
this.deferredSymbolTracker.markAsDeferrableCandidate(node, imp.node, componentClassDecl, isDeferredImport);
|
|
11709
11711
|
}
|
|
11710
11712
|
compileDeferBlocks(resolution) {
|
|
@@ -12323,7 +12325,7 @@ class PipeDecoratorHandler {
|
|
|
12323
12325
|
* @description
|
|
12324
12326
|
* Entry point for all public APIs of the compiler-cli package.
|
|
12325
12327
|
*/
|
|
12326
|
-
new project_tsconfig_paths.Version('21.0.0-next.
|
|
12328
|
+
new project_tsconfig_paths.Version('21.0.0-next.5');
|
|
12327
12329
|
|
|
12328
12330
|
/**
|
|
12329
12331
|
* Whether a given decorator should be treated as an Angular decorator.
|
|
@@ -16779,13 +16781,24 @@ const factory$9 = {
|
|
|
16779
16781
|
* otherwise it would produce inaccurate results.
|
|
16780
16782
|
*/
|
|
16781
16783
|
class OptionalChainNotNullableCheck extends TemplateCheckWithVisitor {
|
|
16784
|
+
noUncheckedIndexedAccess;
|
|
16782
16785
|
canVisitStructuralAttributes = false;
|
|
16783
16786
|
code = project_tsconfig_paths.ErrorCode.OPTIONAL_CHAIN_NOT_NULLABLE;
|
|
16787
|
+
constructor(noUncheckedIndexedAccess) {
|
|
16788
|
+
super();
|
|
16789
|
+
this.noUncheckedIndexedAccess = noUncheckedIndexedAccess;
|
|
16790
|
+
}
|
|
16784
16791
|
visitNode(ctx, component, node) {
|
|
16785
16792
|
if (!(node instanceof project_tsconfig_paths.SafeCall) &&
|
|
16786
16793
|
!(node instanceof project_tsconfig_paths.SafePropertyRead) &&
|
|
16787
|
-
!(node instanceof project_tsconfig_paths.SafeKeyedRead))
|
|
16794
|
+
!(node instanceof project_tsconfig_paths.SafeKeyedRead)) {
|
|
16788
16795
|
return [];
|
|
16796
|
+
}
|
|
16797
|
+
// When `noUncheckedIndexedAccess` is disabled, an indexed access is not checked
|
|
16798
|
+
// and may result in `undefined`.
|
|
16799
|
+
if (node.receiver instanceof project_tsconfig_paths.KeyedRead && !this.noUncheckedIndexedAccess) {
|
|
16800
|
+
return [];
|
|
16801
|
+
}
|
|
16789
16802
|
const symbolLeft = ctx.templateTypeChecker.getSymbolOfNode(node.receiver, component);
|
|
16790
16803
|
if (symbolLeft === null || symbolLeft.kind !== project_tsconfig_paths.SymbolKind.Expression) {
|
|
16791
16804
|
return [];
|
|
@@ -16825,7 +16838,8 @@ const factory$8 = {
|
|
|
16825
16838
|
if (!strictNullChecks) {
|
|
16826
16839
|
return null;
|
|
16827
16840
|
}
|
|
16828
|
-
|
|
16841
|
+
const noUncheckedIndexedAccess = !!options.noUncheckedIndexedAccess;
|
|
16842
|
+
return new OptionalChainNotNullableCheck(noUncheckedIndexedAccess);
|
|
16829
16843
|
},
|
|
16830
16844
|
};
|
|
16831
16845
|
|
|
@@ -20415,7 +20429,7 @@ var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
|
|
|
20415
20429
|
* @param minVersion Minimum required version for the feature.
|
|
20416
20430
|
*/
|
|
20417
20431
|
function coreVersionSupportsFeature(coreVersion, minVersion) {
|
|
20418
|
-
// A version of `21.0.0-next.
|
|
20432
|
+
// A version of `21.0.0-next.5` usually means that core is at head so it supports
|
|
20419
20433
|
// all features. Use string interpolation prevent the placeholder from being replaced
|
|
20420
20434
|
// with the current version during build time.
|
|
20421
20435
|
if (coreVersion === `0.0.0-${'PLACEHOLDER'}`) {
|
|
@@ -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,13 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
10
|
var p = require('path');
|
|
11
|
-
var compiler_host = require('./compiler_host-
|
|
11
|
+
var compiler_host = require('./compiler_host-Aouk-n4F.cjs');
|
|
12
12
|
var ts = require('typescript');
|
|
13
13
|
var ng_decorators = require('./ng_decorators-BI0uV7KI.cjs');
|
|
14
14
|
var imports = require('./imports-DwPXlGFl.cjs');
|
|
15
15
|
var nodes = require('./nodes-B16H9JUd.cjs');
|
|
16
16
|
var leading_space = require('./leading_space-D9nQ8UQC.cjs');
|
|
17
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
17
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.cjs');
|
|
18
18
|
require('os');
|
|
19
19
|
require('fs');
|
|
20
20
|
require('module');
|
|
@@ -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
|
var ts = require('typescript');
|
|
11
11
|
require('os');
|
|
12
12
|
var assert = require('assert');
|
|
13
|
-
var index = require('./index-
|
|
14
|
-
var project_paths = require('./project_paths-
|
|
13
|
+
var index = require('./index-BZQb51Qf.cjs');
|
|
14
|
+
var project_paths = require('./project_paths-Dr2s3Pq3.cjs');
|
|
15
15
|
var leading_space = require('./leading_space-D9nQ8UQC.cjs');
|
|
16
|
-
require('./index-
|
|
16
|
+
require('./index-Bb6iejCd.cjs');
|
|
17
17
|
require('path');
|
|
18
18
|
require('node:path');
|
|
19
19
|
|
package/schematics/bundles/{ng_component_template-CytqBs-q.cjs → ng_component_template-B4M8mTyv.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
|
*/
|
|
@@ -10,7 +10,7 @@ var ts = require('typescript');
|
|
|
10
10
|
var ng_decorators = require('./ng_decorators-BI0uV7KI.cjs');
|
|
11
11
|
var property_name = require('./property_name-BBwFuqMe.cjs');
|
|
12
12
|
require('os');
|
|
13
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
13
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.cjs');
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
|
|
@@ -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,15 +8,15 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
12
|
-
var index = require('./index-
|
|
11
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.cjs');
|
|
12
|
+
var index = require('./index-Bb6iejCd.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-
|
|
15
|
+
var project_paths = require('./project_paths-Dr2s3Pq3.cjs');
|
|
16
|
+
var apply_import_manager = require('./apply_import_manager-Bx60Uquz.cjs');
|
|
17
17
|
var imports = require('./imports-DwPXlGFl.cjs');
|
|
18
|
-
var parse_html = require('./parse_html-
|
|
19
|
-
var ng_component_template = require('./ng_component_template-
|
|
18
|
+
var parse_html = require('./parse_html-7Wl_HDnw.cjs');
|
|
19
|
+
var ng_component_template = require('./ng_component_template-B4M8mTyv.cjs');
|
|
20
20
|
require('@angular-devkit/core');
|
|
21
21
|
require('node:path/posix');
|
|
22
22
|
require('fs');
|
|
@@ -32,7 +32,7 @@ const commonModuleImportsStr = 'CommonModule';
|
|
|
32
32
|
function migrateNgClassBindings(template, config, componentNode, typeChecker) {
|
|
33
33
|
const parsed = parse_html.parseTemplate(template);
|
|
34
34
|
if (!parsed.tree || !parsed.tree.rootNodes.length) {
|
|
35
|
-
return { migrated: template, changed: false, replacementCount: 0 };
|
|
35
|
+
return { migrated: template, changed: false, replacementCount: 0, canRemoveCommonModule: false };
|
|
36
36
|
}
|
|
37
37
|
const visitor = new NgClassCollector(template, componentNode, typeChecker);
|
|
38
38
|
project_tsconfig_paths.visitAll$1(visitor, parsed.tree.rootNodes, config);
|
|
@@ -45,13 +45,19 @@ function migrateNgClassBindings(template, config, componentNode, typeChecker) {
|
|
|
45
45
|
changedOffset += newTemplate.length - currentLength;
|
|
46
46
|
replacementCount++;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
const changed = newTemplate !== template;
|
|
49
|
+
return {
|
|
50
|
+
migrated: newTemplate,
|
|
51
|
+
changed,
|
|
52
|
+
replacementCount,
|
|
53
|
+
canRemoveCommonModule: changed ? parse_html.canRemoveCommonModule(newTemplate) : false,
|
|
54
|
+
};
|
|
49
55
|
}
|
|
50
56
|
/**
|
|
51
57
|
* Creates a Replacement to remove `NgClass` from a component's `imports` array.
|
|
52
58
|
* Uses ReflectionHost + PartialEvaluator for robust AST analysis.
|
|
53
59
|
*/
|
|
54
|
-
function createNgClassImportsArrayRemoval(classNode, file, typeChecker) {
|
|
60
|
+
function createNgClassImportsArrayRemoval(classNode, file, typeChecker, removeCommonModule) {
|
|
55
61
|
const reflector = new project_tsconfig_paths.TypeScriptReflectionHost(typeChecker);
|
|
56
62
|
const evaluator = new index.PartialEvaluator(reflector, typeChecker, null);
|
|
57
63
|
// Use ReflectionHost to get decorators instead of manual AST traversal
|
|
@@ -84,74 +90,66 @@ function createNgClassImportsArrayRemoval(classNode, file, typeChecker) {
|
|
|
84
90
|
return null;
|
|
85
91
|
}
|
|
86
92
|
const importsArray = importsProperty.initializer;
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (isLastElement) {
|
|
114
|
-
// If this is the LAST element, the range is from the END of the previous element
|
|
115
|
-
// to the END of this element. This captures the comma and space preceding it.
|
|
116
|
-
// Ex: `[a, b]` -> remove `, b`
|
|
117
|
-
const start = elementIndex > 0 ? elements[elementIndex - 1].getEnd() : elementNode.getStart(sourceFile); // If it is also the first (only) element, there is no comma before it.
|
|
118
|
-
return { start: start, end: elementNode.getEnd() };
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
// If it's the FIRST or MIDDLE element, the range goes from the BEGINNING of this element
|
|
122
|
-
// to the BEGINNING of the next one. This captures the element itself and the comma that FOLLOWS it.
|
|
123
|
-
// Ex: `[a, b]` -> remove `a,`
|
|
124
|
-
const nextElement = elements[elementIndex + 1];
|
|
125
|
-
return {
|
|
126
|
-
start: elementNode.getStart(sourceFile),
|
|
127
|
-
end: nextElement.getStart(sourceFile),
|
|
128
|
-
};
|
|
129
|
-
}
|
|
93
|
+
const elementsToRemove = new Set([ngClassStr]);
|
|
94
|
+
if (removeCommonModule) {
|
|
95
|
+
elementsToRemove.add(commonModuleImportsStr);
|
|
96
|
+
}
|
|
97
|
+
const originalElements = importsArray.elements;
|
|
98
|
+
const filteredElements = originalElements.filter((el) => !ts.isIdentifier(el) || !elementsToRemove.has(el.text));
|
|
99
|
+
if (filteredElements.length === originalElements.length) {
|
|
100
|
+
return null; // No changes needed.
|
|
101
|
+
}
|
|
102
|
+
// If the array becomes empty, remove the entire `imports` property.
|
|
103
|
+
if (filteredElements.length === 0) {
|
|
104
|
+
const removalRange = getPropertyRemovalRange(importsProperty);
|
|
105
|
+
return new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
106
|
+
position: removalRange.start,
|
|
107
|
+
end: removalRange.end,
|
|
108
|
+
toInsert: '',
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
const printer = ts.createPrinter();
|
|
112
|
+
const newArray = ts.factory.updateArrayLiteralExpression(importsArray, filteredElements);
|
|
113
|
+
const newText = printer.printNode(ts.EmitHint.Unspecified, newArray, classNode.getSourceFile());
|
|
114
|
+
return new project_paths.Replacement(file, new project_paths.TextUpdate({
|
|
115
|
+
position: importsArray.getStart(),
|
|
116
|
+
end: importsArray.getEnd(),
|
|
117
|
+
toInsert: newText,
|
|
118
|
+
}));
|
|
130
119
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
120
|
+
function getPropertyRemovalRange(property) {
|
|
121
|
+
const parent = property.parent;
|
|
122
|
+
if (!ts.isObjectLiteralExpression(parent)) {
|
|
123
|
+
return { start: property.getStart(), end: property.getEnd() };
|
|
124
|
+
}
|
|
125
|
+
const properties = parent.properties;
|
|
126
|
+
const propertyIndex = properties.indexOf(property);
|
|
127
|
+
const end = property.getEnd();
|
|
128
|
+
if (propertyIndex < properties.length - 1) {
|
|
129
|
+
const nextProperty = properties[propertyIndex + 1];
|
|
130
|
+
return { start: property.getStart(), end: nextProperty.getStart() };
|
|
131
|
+
}
|
|
132
|
+
return { start: property.getStart(), end };
|
|
142
133
|
}
|
|
143
|
-
function calculateImportReplacements(info, sourceFiles) {
|
|
134
|
+
function calculateImportReplacements(info, sourceFiles, filesToRemoveCommonModule) {
|
|
144
135
|
const importReplacements = {};
|
|
145
136
|
const importManager = new project_tsconfig_paths.ImportManager();
|
|
146
137
|
for (const sf of sourceFiles) {
|
|
147
138
|
const file = project_paths.projectFile(sf, info);
|
|
139
|
+
// Always remove NgClass if it's imported directly.
|
|
148
140
|
importManager.removeImport(sf, ngClassStr, commonModuleStr);
|
|
141
|
+
// Conditionally remove CommonModule if it's no longer needed.
|
|
142
|
+
if (filesToRemoveCommonModule.has(file.id)) {
|
|
143
|
+
importManager.removeImport(sf, commonModuleImportsStr, commonModuleStr);
|
|
144
|
+
}
|
|
149
145
|
const addRemove = [];
|
|
150
146
|
apply_import_manager.applyImportManagerChanges(importManager, addRemove, [sf], info);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
if (addRemove.length > 0) {
|
|
148
|
+
importReplacements[file.id] = {
|
|
149
|
+
add: [],
|
|
150
|
+
addAndRemove: addRemove,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
155
153
|
}
|
|
156
154
|
return importReplacements;
|
|
157
155
|
}
|
|
@@ -390,11 +388,27 @@ class NgClassMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
390
388
|
super();
|
|
391
389
|
this.config = config;
|
|
392
390
|
}
|
|
391
|
+
processTemplate(template, node, file, info, typeChecker) {
|
|
392
|
+
const { migrated, changed, replacementCount, canRemoveCommonModule } = migrateNgClassBindings(template.content, this.config, node, typeChecker);
|
|
393
|
+
if (!changed) {
|
|
394
|
+
return null;
|
|
395
|
+
}
|
|
396
|
+
const fileToMigrate = template.inline
|
|
397
|
+
? file
|
|
398
|
+
: project_paths.projectFile(template.filePath, info);
|
|
399
|
+
const end = template.start + template.content.length;
|
|
400
|
+
return {
|
|
401
|
+
replacements: [prepareTextReplacement(fileToMigrate, migrated, template.start, end)],
|
|
402
|
+
replacementCount,
|
|
403
|
+
canRemoveCommonModule,
|
|
404
|
+
};
|
|
405
|
+
}
|
|
393
406
|
async analyze(info) {
|
|
394
407
|
const { sourceFiles, program } = info;
|
|
395
408
|
const typeChecker = program.getTypeChecker();
|
|
396
409
|
const ngClassReplacements = [];
|
|
397
410
|
const filesWithNgClassDeclarations = new Set();
|
|
411
|
+
const filesToRemoveCommonModule = new Set();
|
|
398
412
|
for (const sf of sourceFiles) {
|
|
399
413
|
ts.forEachChild(sf, (node) => {
|
|
400
414
|
if (!ts.isClassDeclaration(node)) {
|
|
@@ -408,42 +422,40 @@ class NgClassMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
408
422
|
templateVisitor.visitNode(node);
|
|
409
423
|
const replacementsForClass = [];
|
|
410
424
|
let replacementCountForClass = 0;
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
425
|
+
let canRemoveCommonModuleForFile = true;
|
|
426
|
+
for (const template of templateVisitor.resolvedTemplates) {
|
|
427
|
+
const result = this.processTemplate(template, node, file, info, typeChecker);
|
|
428
|
+
if (result) {
|
|
429
|
+
replacementsForClass.push(...result.replacements);
|
|
430
|
+
replacementCountForClass += result.replacementCount;
|
|
431
|
+
if (!result.canRemoveCommonModule) {
|
|
432
|
+
canRemoveCommonModuleForFile = false;
|
|
433
|
+
}
|
|
415
434
|
}
|
|
416
|
-
replacementCountForClass += replacementCount;
|
|
417
|
-
const fileToMigrate = template.inline
|
|
418
|
-
? file
|
|
419
|
-
: project_paths.projectFile(template.filePath, info);
|
|
420
|
-
const end = template.start + template.content.length;
|
|
421
|
-
replacementsForClass.push(prepareTextReplacement(fileToMigrate, migrated, template.start, end));
|
|
422
|
-
});
|
|
423
|
-
if (replacementCountForClass === 0) {
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
filesWithNgClassDeclarations.add(sf);
|
|
427
|
-
const importArrayRemoval = createNgClassImportsArrayRemoval(node, file, typeChecker);
|
|
428
|
-
if (importArrayRemoval) {
|
|
429
|
-
replacementsForClass.push(importArrayRemoval);
|
|
430
|
-
}
|
|
431
|
-
const existing = ngClassReplacements.find((entry) => entry.file === file);
|
|
432
|
-
if (existing) {
|
|
433
|
-
existing.replacements.push(...replacementsForClass);
|
|
434
|
-
existing.replacementCount += replacementCountForClass;
|
|
435
435
|
}
|
|
436
|
-
|
|
436
|
+
if (replacementsForClass.length > 0) {
|
|
437
|
+
if (canRemoveCommonModuleForFile) {
|
|
438
|
+
filesToRemoveCommonModule.add(file.id);
|
|
439
|
+
}
|
|
440
|
+
// Handle the `@Component({ imports: [...] })` array.
|
|
441
|
+
const importsRemoval = createNgClassImportsArrayRemoval(node, file, typeChecker, canRemoveCommonModuleForFile);
|
|
442
|
+
if (importsRemoval) {
|
|
443
|
+
replacementsForClass.push(importsRemoval);
|
|
444
|
+
}
|
|
437
445
|
ngClassReplacements.push({
|
|
438
446
|
file,
|
|
439
|
-
replacements: replacementsForClass,
|
|
440
447
|
replacementCount: replacementCountForClass,
|
|
448
|
+
replacements: replacementsForClass,
|
|
441
449
|
});
|
|
450
|
+
filesWithNgClassDeclarations.add(sf);
|
|
442
451
|
}
|
|
443
452
|
});
|
|
444
453
|
}
|
|
445
|
-
const importReplacements = calculateImportReplacements(info, filesWithNgClassDeclarations);
|
|
446
|
-
return project_paths.confirmAsSerializable({
|
|
454
|
+
const importReplacements = calculateImportReplacements(info, filesWithNgClassDeclarations, filesToRemoveCommonModule);
|
|
455
|
+
return project_paths.confirmAsSerializable({
|
|
456
|
+
ngClassReplacements,
|
|
457
|
+
importReplacements,
|
|
458
|
+
});
|
|
447
459
|
}
|
|
448
460
|
async combine(unitA, unitB) {
|
|
449
461
|
const importReplacements = {};
|
|
@@ -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,15 +8,15 @@
|
|
|
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-DX9KHLn9.cjs');
|
|
12
|
+
require('./index-Bb6iejCd.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-
|
|
15
|
+
var project_paths = require('./project_paths-Dr2s3Pq3.cjs');
|
|
16
|
+
var apply_import_manager = require('./apply_import_manager-Bx60Uquz.cjs');
|
|
17
17
|
var imports = require('./imports-DwPXlGFl.cjs');
|
|
18
|
-
var parse_html = require('./parse_html-
|
|
19
|
-
var ng_component_template = require('./ng_component_template-
|
|
18
|
+
var parse_html = require('./parse_html-7Wl_HDnw.cjs');
|
|
19
|
+
var ng_component_template = require('./ng_component_template-B4M8mTyv.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 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,13 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
12
|
-
var index$1 = require('./index-
|
|
11
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.cjs');
|
|
12
|
+
var index$1 = require('./index-Bb6iejCd.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 index = require('./index-
|
|
15
|
+
var project_paths = require('./project_paths-Dr2s3Pq3.cjs');
|
|
16
|
+
var apply_import_manager = require('./apply_import_manager-Bx60Uquz.cjs');
|
|
17
|
+
var index = require('./index-BZQb51Qf.cjs');
|
|
18
18
|
require('@angular-devkit/core');
|
|
19
19
|
require('node:path/posix');
|
|
20
20
|
require('fs');
|