@angular/core 21.0.0-next.0 → 21.0.0-next.2

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.
Files changed (75) hide show
  1. package/api.d.d.ts +1 -1
  2. package/chrome_dev_tools_performance.d.d.ts +2 -17
  3. package/discovery.d.d.ts +17 -60
  4. package/{signal.d.d.ts → effect.d.d.ts} +13 -3
  5. package/event_dispatcher.d.d.ts +1 -1
  6. package/fesm2022/attribute.mjs +1 -1
  7. package/fesm2022/attribute.mjs.map +1 -1
  8. package/fesm2022/core.mjs +15 -19
  9. package/fesm2022/core.mjs.map +1 -1
  10. package/fesm2022/debug_node.mjs +75 -719
  11. package/fesm2022/debug_node.mjs.map +1 -1
  12. package/fesm2022/{untracked.mjs → effect.mjs} +29 -4
  13. package/fesm2022/effect.mjs.map +1 -0
  14. package/fesm2022/not_found.mjs +1 -1
  15. package/fesm2022/not_found.mjs.map +1 -1
  16. package/fesm2022/primitives/di.mjs +1 -1
  17. package/fesm2022/primitives/di.mjs.map +1 -1
  18. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  19. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  20. package/fesm2022/primitives/signals.mjs +2 -2
  21. package/fesm2022/primitives/signals.mjs.map +1 -1
  22. package/fesm2022/resource.mjs +18 -27
  23. package/fesm2022/resource.mjs.map +1 -1
  24. package/fesm2022/root_effect_scheduler.mjs +689 -87
  25. package/fesm2022/root_effect_scheduler.mjs.map +1 -1
  26. package/fesm2022/rxjs-interop.mjs +4 -4
  27. package/fesm2022/rxjs-interop.mjs.map +1 -1
  28. package/fesm2022/signal.mjs +1 -1
  29. package/fesm2022/signal.mjs.map +1 -1
  30. package/fesm2022/testing.mjs +6 -8
  31. package/fesm2022/testing.mjs.map +1 -1
  32. package/fesm2022/weak_ref.mjs +1 -1
  33. package/fesm2022/weak_ref.mjs.map +1 -1
  34. package/graph.d.d.ts +1 -1
  35. package/index.d.ts +34 -57
  36. package/package.json +2 -2
  37. package/primitives/di/index.d.ts +1 -1
  38. package/primitives/event-dispatch/index.d.ts +1 -1
  39. package/primitives/signals/index.d.ts +3 -3
  40. package/rxjs-interop/index.d.ts +1 -1
  41. package/schematics/bundles/application-config-core.cjs +95 -0
  42. package/schematics/bundles/{apply_import_manager-DR9xXCle.cjs → apply_import_manager-B3czqUhF.cjs} +3 -3
  43. package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
  44. package/schematics/bundles/{compiler_host-BXBP7CE2.cjs → compiler_host-B9qvCnmC.cjs} +2 -2
  45. package/schematics/bundles/control-flow-migration.cjs +13 -41
  46. package/schematics/bundles/{imports-CIX-JgAN.cjs → imports-26VeX8i-.cjs} +2 -1
  47. package/schematics/bundles/{index-esqfDjNB.cjs → index-B6-f9bil.cjs} +12 -12
  48. package/schematics/bundles/{index-CfTQUOiz.cjs → index-DN8W1c8n.cjs} +4 -4
  49. package/schematics/bundles/inject-migration.cjs +144 -49
  50. package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
  51. package/schematics/bundles/{migrate_ts_type_references-6NtAj-Wk.cjs → migrate_ts_type_references-DawXRJzI.cjs} +5 -5
  52. package/schematics/bundles/ng_component_template-DUAg-x1h.cjs +186 -0
  53. package/schematics/bundles/{ng_decorators-B5HCqr20.cjs → ng_decorators-CtYwz9Lw.cjs} +2 -2
  54. package/schematics/bundles/ngclass-to-class-migration.cjs +533 -0
  55. package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
  56. package/schematics/bundles/output-migration.cjs +6 -6
  57. package/schematics/bundles/parse_html-C8TYlOyu.cjs +41 -0
  58. package/schematics/bundles/{project_paths-DcaODbky.cjs → project_paths-D64fJzoa.cjs} +3 -3
  59. package/schematics/bundles/{project_tsconfig_paths-CS-eSeHC.cjs → project_tsconfig_paths-DZ17BWwk.cjs} +36 -7
  60. package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
  61. package/schematics/bundles/route-lazy-loading.cjs +3 -3
  62. package/schematics/bundles/router-current-navigation.cjs +5 -5
  63. package/schematics/bundles/router-last-successful-navigation.cjs +5 -5
  64. package/schematics/bundles/self-closing-tags-migration.cjs +11 -207
  65. package/schematics/bundles/signal-input-migration.cjs +7 -7
  66. package/schematics/bundles/signal-queries-migration.cjs +7 -7
  67. package/schematics/bundles/signals.cjs +7 -7
  68. package/schematics/bundles/standalone-migration.cjs +6 -6
  69. package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
  70. package/schematics/collection.json +6 -0
  71. package/schematics/migrations/ngclass-to-class-migration/schema.json +20 -0
  72. package/schematics/migrations.json +5 -0
  73. package/testing/index.d.ts +2 -2
  74. package/weak_ref.d.d.ts +1 -1
  75. package/fesm2022/untracked.mjs.map +0 -1
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.0
3
+ * @license Angular v21.0.0-next.2
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-CS-eSeHC.cjs');
9
+ var project_tsconfig_paths = require('./project_tsconfig_paths-DZ17BWwk.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.0'));
894
+ definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.2'));
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.0'));
912
+ definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.2'));
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.0'));
1007
+ definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.2'));
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.0'));
1423
+ definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.2'));
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.0'));
1458
+ definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.2'));
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.0'));
1509
+ definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.2'));
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.0'));
1542
+ definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.2'));
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.0'));
1593
+ definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.2'));
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.0');
12335
+ new project_tsconfig_paths.Version('21.0.0-next.2');
12336
12336
 
12337
12337
  /**
12338
12338
  * Whether a given decorator should be treated as an Angular decorator.
@@ -20322,7 +20322,7 @@ var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
20322
20322
  * @param minVersion Minimum required version for the feature.
20323
20323
  */
20324
20324
  function coreVersionSupportsFeature(coreVersion, minVersion) {
20325
- // A version of `21.0.0-next.0` usually means that core is at head so it supports
20325
+ // A version of `21.0.0-next.2` usually means that core is at head so it supports
20326
20326
  // all features. Use string interpolation prevent the placeholder from being replaced
20327
20327
  // with the current version during build time.
20328
20328
  if (coreVersion === `0.0.0-${'PLACEHOLDER'}`) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.0
3
+ * @license Angular v21.0.0-next.2
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-CS-eSeHC.cjs');
12
- var index = require('./index-esqfDjNB.cjs');
11
+ var project_tsconfig_paths = require('./project_tsconfig_paths-DZ17BWwk.cjs');
12
+ var index = require('./index-B6-f9bil.cjs');
13
13
  require('path');
14
14
  require('node:path');
15
- var project_paths = require('./project_paths-DcaODbky.cjs');
15
+ var project_paths = require('./project_paths-D64fJzoa.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.0
3
+ * @license Angular v21.0.0-next.2
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-BXBP7CE2.cjs');
11
+ var compiler_host = require('./compiler_host-B9qvCnmC.cjs');
12
12
  var ts = require('typescript');
13
- var ng_decorators = require('./ng_decorators-B5HCqr20.cjs');
14
- var imports = require('./imports-CIX-JgAN.cjs');
13
+ var ng_decorators = require('./ng_decorators-CtYwz9Lw.cjs');
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-CS-eSeHC.cjs');
17
+ var project_tsconfig_paths = require('./project_tsconfig_paths-DZ17BWwk.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
- if (!ts.isIdentifier(node.name)) {
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
- const name = node.name.text;
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
- // We can't initialize the property if it's referenced within a `super` call or it references
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
- if (usedInSuper) {
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
- const toAdd = `${innerIndentation}this.${name} = ${replacementCall};`;
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(toAdd);
892
+ prependToConstructor.push(initializer);
878
893
  }
879
894
  else {
880
- afterSuper.push(toAdd);
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,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.0
3
+ * @license Angular v21.0.0-next.2
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -1,19 +1,19 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.0
3
+ * @license Angular v21.0.0-next.2
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-CS-eSeHC.cjs');
9
+ var project_tsconfig_paths = require('./project_tsconfig_paths-DZ17BWwk.cjs');
10
10
  var ts = require('typescript');
11
11
  require('os');
12
12
  var assert = require('assert');
13
- var index = require('./index-CfTQUOiz.cjs');
14
- var project_paths = require('./project_paths-DcaODbky.cjs');
13
+ var index = require('./index-DN8W1c8n.cjs');
14
+ var project_paths = require('./project_paths-D64fJzoa.cjs');
15
15
  var leading_space = require('./leading_space-D9nQ8UQC.cjs');
16
- require('./index-esqfDjNB.cjs');
16
+ require('./index-B6-f9bil.cjs');
17
17
  require('path');
18
18
  require('node:path');
19
19
 
@@ -0,0 +1,186 @@
1
+ 'use strict';
2
+ /**
3
+ * @license Angular v21.0.0-next.2
4
+ * (c) 2010-2025 Google LLC. https://angular.io/
5
+ * License: MIT
6
+ */
7
+ 'use strict';
8
+
9
+ var ts = require('typescript');
10
+ var ng_decorators = require('./ng_decorators-CtYwz9Lw.cjs');
11
+ var property_name = require('./property_name-BBwFuqMe.cjs');
12
+ require('os');
13
+ var project_tsconfig_paths = require('./project_tsconfig_paths-DZ17BWwk.cjs');
14
+
15
+ /**
16
+ * Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
17
+ * parentheses or as expression. e.g. "(((({exp}))))()". The function should return the
18
+ * TypeScript node referring to the inner expression. e.g "exp".
19
+ */
20
+ function unwrapExpression(node) {
21
+ if (ts.isParenthesizedExpression(node) || ts.isAsExpression(node)) {
22
+ return unwrapExpression(node.expression);
23
+ }
24
+ else {
25
+ return node;
26
+ }
27
+ }
28
+
29
+ /** Extracts `@Directive` or `@Component` metadata from the given class. */
30
+ function extractAngularClassMetadata(typeChecker, node) {
31
+ const decorators = ts.getDecorators(node);
32
+ if (!decorators || !decorators.length) {
33
+ return null;
34
+ }
35
+ const ngDecorators = ng_decorators.getAngularDecorators(typeChecker, decorators);
36
+ const componentDecorator = ngDecorators.find((dec) => dec.name === 'Component');
37
+ const directiveDecorator = ngDecorators.find((dec) => dec.name === 'Directive');
38
+ const decorator = componentDecorator ?? directiveDecorator;
39
+ // In case no decorator could be found on the current class, skip.
40
+ if (!decorator) {
41
+ return null;
42
+ }
43
+ const decoratorCall = decorator.node.expression;
44
+ // In case the decorator call is not valid, skip this class declaration.
45
+ if (decoratorCall.arguments.length !== 1) {
46
+ return null;
47
+ }
48
+ const metadata = unwrapExpression(decoratorCall.arguments[0]);
49
+ // Ensure that the metadata is an object literal expression.
50
+ if (!ts.isObjectLiteralExpression(metadata)) {
51
+ return null;
52
+ }
53
+ return {
54
+ type: componentDecorator ? 'component' : 'directive',
55
+ node: metadata,
56
+ };
57
+ }
58
+
59
+ const LF_CHAR = 10;
60
+ const CR_CHAR = 13;
61
+ const LINE_SEP_CHAR = 8232;
62
+ const PARAGRAPH_CHAR = 8233;
63
+ /** Gets the line and character for the given position from the line starts map. */
64
+ function getLineAndCharacterFromPosition(lineStartsMap, position) {
65
+ const lineIndex = findClosestLineStartPosition(lineStartsMap, position);
66
+ return { character: position - lineStartsMap[lineIndex], line: lineIndex };
67
+ }
68
+ /**
69
+ * Computes the line start map of the given text. This can be used in order to
70
+ * retrieve the line and character of a given text position index.
71
+ */
72
+ function computeLineStartsMap(text) {
73
+ const result = [0];
74
+ let pos = 0;
75
+ while (pos < text.length) {
76
+ const char = text.charCodeAt(pos++);
77
+ // Handles the "CRLF" line break. In that case we peek the character
78
+ // after the "CR" and check if it is a line feed.
79
+ if (char === CR_CHAR) {
80
+ if (text.charCodeAt(pos) === LF_CHAR) {
81
+ pos++;
82
+ }
83
+ result.push(pos);
84
+ }
85
+ else if (char === LF_CHAR || char === LINE_SEP_CHAR || char === PARAGRAPH_CHAR) {
86
+ result.push(pos);
87
+ }
88
+ }
89
+ result.push(pos);
90
+ return result;
91
+ }
92
+ /** Finds the closest line start for the given position. */
93
+ function findClosestLineStartPosition(linesMap, position, low = 0, high = linesMap.length - 1) {
94
+ while (low <= high) {
95
+ const pivotIdx = Math.floor((low + high) / 2);
96
+ const pivotEl = linesMap[pivotIdx];
97
+ if (pivotEl === position) {
98
+ return pivotIdx;
99
+ }
100
+ else if (position > pivotEl) {
101
+ low = pivotIdx + 1;
102
+ }
103
+ else {
104
+ high = pivotIdx - 1;
105
+ }
106
+ }
107
+ // In case there was no exact match, return the closest "lower" line index. We also
108
+ // subtract the index by one because want the index of the previous line start.
109
+ return low - 1;
110
+ }
111
+
112
+ /**
113
+ * Visitor that can be used to determine Angular templates referenced within given
114
+ * TypeScript source files (inline templates or external referenced templates)
115
+ */
116
+ class NgComponentTemplateVisitor {
117
+ typeChecker;
118
+ resolvedTemplates = [];
119
+ fs = project_tsconfig_paths.getFileSystem();
120
+ constructor(typeChecker) {
121
+ this.typeChecker = typeChecker;
122
+ }
123
+ visitNode(node) {
124
+ if (node.kind === ts.SyntaxKind.ClassDeclaration) {
125
+ this.visitClassDeclaration(node);
126
+ }
127
+ ts.forEachChild(node, (n) => this.visitNode(n));
128
+ }
129
+ visitClassDeclaration(node) {
130
+ const metadata = extractAngularClassMetadata(this.typeChecker, node);
131
+ if (metadata === null || metadata.type !== 'component') {
132
+ return;
133
+ }
134
+ const sourceFile = node.getSourceFile();
135
+ const sourceFileName = sourceFile.fileName;
136
+ // Walk through all component metadata properties and determine the referenced
137
+ // HTML templates (either external or inline)
138
+ metadata.node.properties.forEach((property) => {
139
+ if (!ts.isPropertyAssignment(property)) {
140
+ return;
141
+ }
142
+ const propertyName = property_name.getPropertyNameText(property.name);
143
+ // In case there is an inline template specified, ensure that the value is statically
144
+ // analyzable by checking if the initializer is a string literal-like node.
145
+ if (propertyName === 'template' && ts.isStringLiteralLike(property.initializer)) {
146
+ // Need to add an offset of one to the start because the template quotes are
147
+ // not part of the template content.
148
+ // The `getText()` method gives us the original raw text.
149
+ // We could have used the `text` property, but if the template is defined as a backtick
150
+ // string then the `text` property contains a "cooked" version of the string. Such cooked
151
+ // strings will have converted CRLF characters to only LF. This messes up string
152
+ // replacements in template migrations.
153
+ // The raw text returned by `getText()` includes the enclosing quotes so we change the
154
+ // `content` and `start` values accordingly.
155
+ const content = property.initializer.getText().slice(1, -1);
156
+ const start = property.initializer.getStart() + 1;
157
+ this.resolvedTemplates.push({
158
+ filePath: sourceFileName,
159
+ container: node,
160
+ content,
161
+ inline: true,
162
+ start: start,
163
+ getCharacterAndLineOfPosition: (pos) => ts.getLineAndCharacterOfPosition(sourceFile, pos + start),
164
+ });
165
+ }
166
+ if (propertyName === 'templateUrl' && ts.isStringLiteralLike(property.initializer)) {
167
+ const absolutePath = this.fs.resolve(this.fs.dirname(sourceFileName), property.initializer.text);
168
+ if (!this.fs.exists(absolutePath)) {
169
+ return;
170
+ }
171
+ const fileContent = this.fs.readFile(absolutePath);
172
+ const lineStartsMap = computeLineStartsMap(fileContent);
173
+ this.resolvedTemplates.push({
174
+ filePath: absolutePath,
175
+ container: node,
176
+ content: fileContent,
177
+ inline: false,
178
+ start: 0,
179
+ getCharacterAndLineOfPosition: (pos) => getLineAndCharacterFromPosition(lineStartsMap, pos),
180
+ });
181
+ }
182
+ });
183
+ }
184
+ }
185
+
186
+ exports.NgComponentTemplateVisitor = NgComponentTemplateVisitor;
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.0
3
+ * @license Angular v21.0.0-next.2
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 imports = require('./imports-CIX-JgAN.cjs');
10
+ var imports = require('./imports-26VeX8i-.cjs');
11
11
 
12
12
  function getCallDecoratorImport(typeChecker, decorator) {
13
13
  // Note that this does not cover the edge case where decorators are called from