@angular/core 21.0.0-next.1 → 21.0.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.d.d.ts +1 -1
- package/chrome_dev_tools_performance.d.d.ts +1 -1
- package/discovery.d.d.ts +11 -36
- package/effect.d.d.ts +1 -1
- package/event_dispatcher.d.d.ts +1 -1
- package/fesm2022/attribute.mjs +1 -1
- package/fesm2022/attribute.mjs.map +1 -1
- package/fesm2022/core.mjs +46 -41
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/debug_node.mjs +29 -669
- package/fesm2022/debug_node.mjs.map +1 -1
- package/fesm2022/effect.mjs +1 -1
- package/fesm2022/effect.mjs.map +1 -1
- package/fesm2022/not_found.mjs +1 -1
- package/fesm2022/not_found.mjs.map +1 -1
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/resource.mjs +1 -1
- package/fesm2022/resource.mjs.map +1 -1
- package/fesm2022/root_effect_scheduler.mjs +689 -81
- package/fesm2022/root_effect_scheduler.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +3 -3
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/signal.mjs +1 -1
- package/fesm2022/signal.mjs.map +1 -1
- package/fesm2022/testing.mjs +6 -8
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/weak_ref.mjs +1 -1
- package/fesm2022/weak_ref.mjs.map +1 -1
- package/graph.d.d.ts +1 -1
- package/index.d.ts +37 -54
- package/package.json +2 -2
- package/primitives/di/index.d.ts +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +135 -0
- package/schematics/bundles/application-config-core.cjs +95 -0
- package/schematics/bundles/{apply_import_manager-yycO3l8f.cjs → apply_import_manager-tNexl58m.cjs} +3 -3
- package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
- package/schematics/bundles/{compiler_host-DrXTGf_7.cjs → compiler_host-Df7s6Riz.cjs} +2 -2
- package/schematics/bundles/control-flow-migration.cjs +4 -4
- package/schematics/bundles/imports-26VeX8i-.cjs +1 -1
- package/schematics/bundles/{index-jjHOgYYs.cjs → index-CBaykQBv.cjs} +35 -14
- package/schematics/bundles/{index-BdH2rlWJ.cjs → index-Clvp4COX.cjs} +4 -4
- package/schematics/bundles/inject-migration.cjs +142 -47
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-BVSg43hf.cjs → migrate_ts_type_references-C_gTvDtH.cjs} +5 -5
- package/schematics/bundles/{ng_component_template-DjLc4mdL.cjs → ng_component_template-HYGPuVhy.cjs} +2 -2
- package/schematics/bundles/ng_decorators-CtYwz9Lw.cjs +1 -1
- package/schematics/bundles/ngclass-to-class-migration.cjs +8 -8
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +6 -6
- package/schematics/bundles/{parse_html-CXR8hziE.cjs → parse_html-CLFKoiOK.cjs} +2 -2
- package/schematics/bundles/{project_paths-T_M15e2g.cjs → project_paths-BJTqcWvC.cjs} +3 -3
- package/schematics/bundles/{project_tsconfig_paths-D7xzGqRi.cjs → project_tsconfig_paths-bRwOJEk9.cjs} +13 -5
- 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 +4 -4
- package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
- package/schematics/migrations/ngclass-to-class-migration/schema.json +2 -2
- package/schematics/migrations.json +10 -0
- 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.3
|
|
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-Df7s6Riz.cjs');
|
|
12
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-bRwOJEk9.cjs');
|
|
13
13
|
var ts = require('typescript');
|
|
14
|
-
var parse_html = require('./parse_html-
|
|
14
|
+
var parse_html = require('./parse_html-CLFKoiOK.cjs');
|
|
15
15
|
require('os');
|
|
16
16
|
require('fs');
|
|
17
17
|
require('module');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.3
|
|
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-bRwOJEk9.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.3'));
|
|
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.3'));
|
|
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.3'));
|
|
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.3'));
|
|
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.3'));
|
|
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.3'));
|
|
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.3'));
|
|
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.3'));
|
|
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);
|
|
@@ -12332,7 +12332,7 @@ class PipeDecoratorHandler {
|
|
|
12332
12332
|
* @description
|
|
12333
12333
|
* Entry point for all public APIs of the compiler-cli package.
|
|
12334
12334
|
*/
|
|
12335
|
-
new project_tsconfig_paths.Version('21.0.0-next.
|
|
12335
|
+
new project_tsconfig_paths.Version('21.0.0-next.3');
|
|
12336
12336
|
|
|
12337
12337
|
/**
|
|
12338
12338
|
* Whether a given decorator should be treated as an Angular decorator.
|
|
@@ -13165,7 +13165,7 @@ function compareVersions(v1, v2) {
|
|
|
13165
13165
|
* Note: this check is disabled in g3, search for
|
|
13166
13166
|
* `angularCompilerOptions.disableTypeScriptVersionCheck` config param value in g3.
|
|
13167
13167
|
*/
|
|
13168
|
-
const MIN_TS_VERSION = '5.
|
|
13168
|
+
const MIN_TS_VERSION = '5.9.0';
|
|
13169
13169
|
/**
|
|
13170
13170
|
* Supremum of supported TypeScript versions
|
|
13171
13171
|
* ∀ supported typescript version v, v < MAX_TS_VERSION
|
|
@@ -16480,6 +16480,27 @@ class InterpolatedSignalCheck extends TemplateCheckWithVisitor {
|
|
|
16480
16480
|
return buildDiagnosticForSignal(ctx, nodeAst, component);
|
|
16481
16481
|
}
|
|
16482
16482
|
}
|
|
16483
|
+
// if blocks like `@if(mySignal) { ... }`
|
|
16484
|
+
else if (node instanceof project_tsconfig_paths.IfBlock) {
|
|
16485
|
+
return node.branches
|
|
16486
|
+
.map((branch) => branch.expression)
|
|
16487
|
+
.filter((expr) => expr instanceof project_tsconfig_paths.ASTWithSource)
|
|
16488
|
+
.map((expr) => {
|
|
16489
|
+
const ast = expr.ast;
|
|
16490
|
+
return ast instanceof project_tsconfig_paths.PrefixNot ? ast.expression : ast;
|
|
16491
|
+
})
|
|
16492
|
+
.filter((ast) => ast instanceof project_tsconfig_paths.PropertyRead)
|
|
16493
|
+
.flatMap((item) => buildDiagnosticForSignal(ctx, item, component));
|
|
16494
|
+
}
|
|
16495
|
+
// switch blocks like `@switch(mySignal) { ... }`
|
|
16496
|
+
else if (node instanceof project_tsconfig_paths.SwitchBlock && node.expression instanceof project_tsconfig_paths.ASTWithSource) {
|
|
16497
|
+
const expression = node.expression.ast instanceof project_tsconfig_paths.PrefixNot
|
|
16498
|
+
? node.expression.ast.expression
|
|
16499
|
+
: node.expression.ast;
|
|
16500
|
+
if (expression instanceof project_tsconfig_paths.PropertyRead) {
|
|
16501
|
+
return buildDiagnosticForSignal(ctx, expression, component);
|
|
16502
|
+
}
|
|
16503
|
+
}
|
|
16483
16504
|
return [];
|
|
16484
16505
|
}
|
|
16485
16506
|
}
|
|
@@ -20322,7 +20343,7 @@ var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
|
|
|
20322
20343
|
* @param minVersion Minimum required version for the feature.
|
|
20323
20344
|
*/
|
|
20324
20345
|
function coreVersionSupportsFeature(coreVersion, minVersion) {
|
|
20325
|
-
// A version of `21.0.0-next.
|
|
20346
|
+
// A version of `21.0.0-next.3` usually means that core is at head so it supports
|
|
20326
20347
|
// all features. Use string interpolation prevent the placeholder from being replaced
|
|
20327
20348
|
// with the current version during build time.
|
|
20328
20349
|
if (coreVersion === `0.0.0-${'PLACEHOLDER'}`) {
|
|
@@ -21264,7 +21285,7 @@ class NgCompiler {
|
|
|
21264
21285
|
const supportJitMode = this.options['supportJitMode'] ?? true;
|
|
21265
21286
|
const supportTestBed = this.options['supportTestBed'] ?? true;
|
|
21266
21287
|
const externalRuntimeStyles = this.options['externalRuntimeStyles'] ?? false;
|
|
21267
|
-
const typeCheckHostBindings = this.options.typeCheckHostBindings ??
|
|
21288
|
+
const typeCheckHostBindings = this.options.typeCheckHostBindings ?? true;
|
|
21268
21289
|
// Libraries compiled in partial mode could potentially be used with TestBed within an
|
|
21269
21290
|
// application. Since this is not known at library compilation time, support is required to
|
|
21270
21291
|
// prevent potential downstream application testing breakage.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.3
|
|
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-bRwOJEk9.cjs');
|
|
12
|
+
var index = require('./index-CBaykQBv.cjs');
|
|
13
13
|
require('path');
|
|
14
14
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
15
|
+
var project_paths = require('./project_paths-BJTqcWvC.cjs');
|
|
16
16
|
|
|
17
17
|
function getMemberName(member) {
|
|
18
18
|
if (member.name === undefined) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.3
|
|
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-Df7s6Riz.cjs');
|
|
12
12
|
var ts = require('typescript');
|
|
13
13
|
var ng_decorators = require('./ng_decorators-CtYwz9Lw.cjs');
|
|
14
14
|
var imports = require('./imports-26VeX8i-.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-bRwOJEk9.cjs');
|
|
18
18
|
require('os');
|
|
19
19
|
require('fs');
|
|
20
20
|
require('module');
|
|
@@ -820,67 +820,162 @@ function migrateClass(node, constructor, superCall, options, memberIndentation,
|
|
|
820
820
|
* @param afterSuper Statements to be added after the `super` call.
|
|
821
821
|
*/
|
|
822
822
|
function migrateParameter(node, options, localTypeChecker, printer, tracker, superCall, usedInSuper, usedInConstructor, usesOtherParams, memberIndentation, innerIndentation, prependToConstructor, propsToAdd, afterSuper) {
|
|
823
|
-
|
|
823
|
+
const context = {
|
|
824
|
+
node,
|
|
825
|
+
options,
|
|
826
|
+
localTypeChecker,
|
|
827
|
+
printer,
|
|
828
|
+
tracker,
|
|
829
|
+
superCall,
|
|
830
|
+
usedInSuper,
|
|
831
|
+
usedInConstructor,
|
|
832
|
+
usesOtherParams,
|
|
833
|
+
memberIndentation,
|
|
834
|
+
innerIndentation,
|
|
835
|
+
prependToConstructor,
|
|
836
|
+
propsToAdd,
|
|
837
|
+
afterSuper,
|
|
838
|
+
};
|
|
839
|
+
if (ts.isIdentifier(node.name)) {
|
|
840
|
+
migrateIdentifierParameter(context, node.name);
|
|
841
|
+
}
|
|
842
|
+
else if (ts.isObjectBindingPattern(node.name)) {
|
|
843
|
+
migrateObjectBindingParameter(context, node.name);
|
|
844
|
+
}
|
|
845
|
+
else {
|
|
824
846
|
return;
|
|
825
847
|
}
|
|
826
|
-
|
|
848
|
+
}
|
|
849
|
+
function migrateIdentifierParameter(context, name) {
|
|
850
|
+
const { node, options, localTypeChecker, printer, tracker, usedInConstructor, usesOtherParams } = context;
|
|
827
851
|
const replacementCall = createInjectReplacementCall(node, options, localTypeChecker, printer, tracker);
|
|
828
852
|
const declaresProp = parameterDeclaresProperty(node);
|
|
829
853
|
// If the parameter declares a property, we need to declare it (e.g. `private foo: Foo`).
|
|
830
854
|
if (declaresProp) {
|
|
831
|
-
|
|
832
|
-
// other parameters. See the logic further below for the initialization.
|
|
833
|
-
const canInitialize = !usedInSuper && !usesOtherParams;
|
|
834
|
-
const prop = ts.factory.createPropertyDeclaration(cloneModifiers(node.modifiers?.filter((modifier) => {
|
|
835
|
-
// Strip out the DI decorators, as well as `public` which is redundant.
|
|
836
|
-
return !ts.isDecorator(modifier) && modifier.kind !== ts.SyntaxKind.PublicKeyword;
|
|
837
|
-
})), name,
|
|
838
|
-
// Don't add the question token to private properties since it won't affect interface implementation.
|
|
839
|
-
node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.PrivateKeyword)
|
|
840
|
-
? undefined
|
|
841
|
-
: node.questionToken, canInitialize ? undefined : node.type, canInitialize ? ts.factory.createIdentifier(PLACEHOLDER) : undefined);
|
|
842
|
-
propsToAdd.push(memberIndentation +
|
|
843
|
-
replaceNodePlaceholder(node.getSourceFile(), prop, replacementCall, printer));
|
|
855
|
+
handlePropertyDeclaration(context, name, replacementCall);
|
|
844
856
|
}
|
|
845
857
|
// If the parameter is referenced within the constructor, we need to declare it as a variable.
|
|
846
858
|
if (usedInConstructor) {
|
|
847
|
-
|
|
848
|
-
// Usages of `this` aren't allowed before `super` calls so we need to
|
|
849
|
-
// create a variable which calls `inject()` directly instead...
|
|
850
|
-
prependToConstructor.push(`${innerIndentation}const ${name} = ${replacementCall};`);
|
|
851
|
-
// ...then we can initialize the property after the `super` call.
|
|
852
|
-
if (declaresProp) {
|
|
853
|
-
afterSuper.push(`${innerIndentation}this.${name} = ${name};`);
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
else if (declaresProp) {
|
|
857
|
-
// If the parameter declares a property (`private foo: foo`) and is used inside the class
|
|
858
|
-
// at the same time, we need to ensure that it's initialized to the value from the variable
|
|
859
|
-
// and that we only reference `this` after the `super` call.
|
|
860
|
-
const initializer = `${innerIndentation}const ${name} = this.${name};`;
|
|
861
|
-
if (superCall === null) {
|
|
862
|
-
prependToConstructor.push(initializer);
|
|
863
|
-
}
|
|
864
|
-
else {
|
|
865
|
-
afterSuper.push(initializer);
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
else {
|
|
869
|
-
// If the parameter is only referenced in the constructor, we
|
|
870
|
-
// don't need to declare any new properties.
|
|
871
|
-
prependToConstructor.push(`${innerIndentation}const ${name} = ${replacementCall};`);
|
|
872
|
-
}
|
|
859
|
+
handleConstructorUsage(context, name.text, replacementCall, declaresProp);
|
|
873
860
|
}
|
|
874
861
|
else if (usesOtherParams && declaresProp) {
|
|
875
|
-
|
|
862
|
+
handleParameterWithDependencies(context, name.text, replacementCall);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
function handlePropertyDeclaration(context, name, replacementCall) {
|
|
866
|
+
const { node, memberIndentation, propsToAdd } = context;
|
|
867
|
+
const canInitialize = !context.usedInSuper && !context.usesOtherParams;
|
|
868
|
+
const prop = ts.factory.createPropertyDeclaration(cloneModifiers(node.modifiers?.filter((modifier) => {
|
|
869
|
+
return !ts.isDecorator(modifier) && modifier.kind !== ts.SyntaxKind.PublicKeyword;
|
|
870
|
+
})), name, node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.PrivateKeyword)
|
|
871
|
+
? undefined
|
|
872
|
+
: node.questionToken, canInitialize ? undefined : node.type, canInitialize ? ts.factory.createIdentifier(PLACEHOLDER) : undefined);
|
|
873
|
+
propsToAdd.push(memberIndentation +
|
|
874
|
+
replaceNodePlaceholder(node.getSourceFile(), prop, replacementCall, context.printer));
|
|
875
|
+
}
|
|
876
|
+
function handleConstructorUsage(context, name, replacementCall, declaresProp) {
|
|
877
|
+
const { innerIndentation, prependToConstructor, afterSuper, superCall } = context;
|
|
878
|
+
if (context.usedInSuper) {
|
|
879
|
+
// Usages of `this` aren't allowed before `super` calls so we need to
|
|
880
|
+
// create a variable which calls `inject()` directly instead...
|
|
881
|
+
prependToConstructor.push(`${innerIndentation}const ${name} = ${replacementCall};`);
|
|
882
|
+
if (declaresProp) {
|
|
883
|
+
afterSuper.push(`${innerIndentation}this.${name} = ${name};`);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
else if (declaresProp) {
|
|
887
|
+
// If the parameter declares a property (`private foo: foo`) and is used inside the class
|
|
888
|
+
// at the same time, we need to ensure that it's initialized to the value from the variable
|
|
889
|
+
// and that we only reference `this` after the `super` call.
|
|
890
|
+
const initializer = `${innerIndentation}const ${name} = this.${name};`;
|
|
876
891
|
if (superCall === null) {
|
|
877
|
-
prependToConstructor.push(
|
|
892
|
+
prependToConstructor.push(initializer);
|
|
878
893
|
}
|
|
879
894
|
else {
|
|
880
|
-
afterSuper.push(
|
|
895
|
+
afterSuper.push(initializer);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
else {
|
|
899
|
+
// If the parameter is only referenced in the constructor, we
|
|
900
|
+
// don't need to declare any new properties.
|
|
901
|
+
prependToConstructor.push(`${innerIndentation}const ${name} = ${replacementCall};`);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
function handleParameterWithDependencies(context, name, replacementCall) {
|
|
905
|
+
const { innerIndentation, prependToConstructor, afterSuper, superCall } = context;
|
|
906
|
+
const toAdd = `${innerIndentation}this.${name} = ${replacementCall};`;
|
|
907
|
+
if (superCall === null) {
|
|
908
|
+
prependToConstructor.push(toAdd);
|
|
909
|
+
}
|
|
910
|
+
else {
|
|
911
|
+
afterSuper.push(toAdd);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
function migrateObjectBindingParameter(context, bindingPattern) {
|
|
915
|
+
const { node, options, localTypeChecker, printer, tracker } = context;
|
|
916
|
+
const replacementCall = createInjectReplacementCall(node, options, localTypeChecker, printer, tracker);
|
|
917
|
+
for (const element of bindingPattern.elements) {
|
|
918
|
+
if (ts.isBindingElement(element) && ts.isIdentifier(element.name)) {
|
|
919
|
+
migrateBindingElement(context, element, element.name, replacementCall);
|
|
881
920
|
}
|
|
882
921
|
}
|
|
883
922
|
}
|
|
923
|
+
function migrateBindingElement(context, element, elementName, replacementCall) {
|
|
924
|
+
const propertyName = elementName.text;
|
|
925
|
+
// Determines how to access the property
|
|
926
|
+
const propertyAccess = element.propertyName
|
|
927
|
+
? `${replacementCall}.${element.propertyName.getText()}`
|
|
928
|
+
: `${replacementCall}.${propertyName}`;
|
|
929
|
+
createPropertyForBindingElement(context, propertyName, propertyAccess);
|
|
930
|
+
if (context.usedInConstructor) {
|
|
931
|
+
handleConstructorUsageBindingElement(context, element, propertyName);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
function handleConstructorUsageBindingElement(context, element, propertyName) {
|
|
935
|
+
const { tracker, localTypeChecker, node: paramNode } = context;
|
|
936
|
+
const constructorDecl = paramNode.parent;
|
|
937
|
+
// Check in constructor or exist body content
|
|
938
|
+
if (!ts.isConstructorDeclaration(constructorDecl) || !constructorDecl.body) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
// Get the unique "symbol" for our unstructured property.
|
|
942
|
+
const symbol = localTypeChecker.getSymbolAtLocation(element.name);
|
|
943
|
+
if (!symbol) {
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
// Visit recursive function navigate constructor
|
|
947
|
+
const visit = (node) => {
|
|
948
|
+
// Check if current node is identifier (variable)
|
|
949
|
+
if (ts.isIdentifier(node)) {
|
|
950
|
+
// Using the type checker, verify that this identifier refers
|
|
951
|
+
// exactly to our destructured parameter and is not the node of the original declaration.
|
|
952
|
+
if (localTypeChecker.getSymbolAtLocation(node) === symbol && node !== element.name) {
|
|
953
|
+
// If the identifier is used as a shorthand property in an object literal (e.g., { myVar }),
|
|
954
|
+
// must replace the entire `ShorthandPropertyAssignment` node
|
|
955
|
+
// with a `PropertyAssignment` (e.g., myVar: this.myVar).
|
|
956
|
+
if (ts.isShorthandPropertyAssignment(node.parent)) {
|
|
957
|
+
tracker.replaceNode(node.parent, ts.factory.createPropertyAssignment(node, ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propertyName)));
|
|
958
|
+
}
|
|
959
|
+
else {
|
|
960
|
+
// Otherwise, replace the identifier with `this.propertyName`.
|
|
961
|
+
tracker.replaceNode(node, ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propertyName));
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
ts.forEachChild(node, visit);
|
|
966
|
+
};
|
|
967
|
+
visit(constructorDecl.body);
|
|
968
|
+
}
|
|
969
|
+
function createPropertyForBindingElement(context, propertyName, propertyAccess) {
|
|
970
|
+
const { node, memberIndentation, propsToAdd } = context;
|
|
971
|
+
const prop = ts.factory.createPropertyDeclaration(cloneModifiers(node.modifiers?.filter((modifier) => {
|
|
972
|
+
return !ts.isDecorator(modifier) && modifier.kind !== ts.SyntaxKind.PublicKeyword;
|
|
973
|
+
})), propertyName, node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.PrivateKeyword)
|
|
974
|
+
? undefined
|
|
975
|
+
: node.questionToken, undefined, ts.factory.createIdentifier(PLACEHOLDER));
|
|
976
|
+
propsToAdd.push(memberIndentation +
|
|
977
|
+
replaceNodePlaceholder(node.getSourceFile(), prop, propertyAccess, context.printer));
|
|
978
|
+
}
|
|
884
979
|
/**
|
|
885
980
|
* Creates a replacement `inject` call from a function parameter.
|
|
886
981
|
* @param param Parameter for which to generate the `inject` call.
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.3
|
|
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-bRwOJEk9.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-Clvp4COX.cjs');
|
|
14
|
+
var project_paths = require('./project_paths-BJTqcWvC.cjs');
|
|
15
15
|
var leading_space = require('./leading_space-D9nQ8UQC.cjs');
|
|
16
|
-
require('./index-
|
|
16
|
+
require('./index-CBaykQBv.cjs');
|
|
17
17
|
require('path');
|
|
18
18
|
require('node:path');
|
|
19
19
|
|
package/schematics/bundles/{ng_component_template-DjLc4mdL.cjs → ng_component_template-HYGPuVhy.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.3
|
|
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-CtYwz9Lw.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-bRwOJEk9.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.3
|
|
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-bRwOJEk9.cjs');
|
|
12
|
+
var index = require('./index-CBaykQBv.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-BJTqcWvC.cjs');
|
|
16
|
+
var apply_import_manager = require('./apply_import_manager-tNexl58m.cjs');
|
|
17
17
|
var imports = require('./imports-26VeX8i-.cjs');
|
|
18
|
-
var parse_html = require('./parse_html-
|
|
19
|
-
var ng_component_template = require('./ng_component_template-
|
|
18
|
+
var parse_html = require('./parse_html-CLFKoiOK.cjs');
|
|
19
|
+
var ng_component_template = require('./ng_component_template-HYGPuVhy.cjs');
|
|
20
20
|
require('@angular-devkit/core');
|
|
21
21
|
require('node:path/posix');
|
|
22
22
|
require('fs');
|
|
@@ -511,7 +511,7 @@ function migrate(options) {
|
|
|
511
511
|
}
|
|
512
512
|
},
|
|
513
513
|
beforeUnitAnalysis: (tsconfigPath) => {
|
|
514
|
-
context.logger.info(`Scanning for
|
|
514
|
+
context.logger.info(`Scanning for ngClass bindings: ${tsconfigPath}...`);
|
|
515
515
|
},
|
|
516
516
|
afterAllAnalyzed: () => {
|
|
517
517
|
context.logger.info(``);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.3
|
|
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-bRwOJEk9.cjs');
|
|
12
|
+
var index$1 = require('./index-CBaykQBv.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-BJTqcWvC.cjs');
|
|
16
|
+
var apply_import_manager = require('./apply_import_manager-tNexl58m.cjs');
|
|
17
|
+
var index = require('./index-Clvp4COX.cjs');
|
|
18
18
|
require('@angular-devkit/core');
|
|
19
19
|
require('node:path/posix');
|
|
20
20
|
require('fs');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.3
|
|
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-bRwOJEk9.cjs');
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* parses the template string into the Html AST
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.3
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var index = require('./index-
|
|
9
|
+
var index = require('./index-CBaykQBv.cjs');
|
|
10
10
|
var schematics = require('@angular-devkit/schematics');
|
|
11
11
|
var core = require('@angular-devkit/core');
|
|
12
12
|
var posixPath = require('node:path/posix');
|
|
13
13
|
var os = require('os');
|
|
14
14
|
var ts = require('typescript');
|
|
15
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
15
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-bRwOJEk9.cjs');
|
|
16
16
|
require('path');
|
|
17
17
|
var path = require('node:path');
|
|
18
18
|
|