@angular/core 21.0.0-next.1 → 21.0.0-next.10

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 (107) hide show
  1. package/fesm2022/_attribute-chunk.mjs +12 -0
  2. package/fesm2022/_attribute-chunk.mjs.map +1 -0
  3. package/fesm2022/_debug_node-chunk.mjs +18469 -0
  4. package/fesm2022/_debug_node-chunk.mjs.map +1 -0
  5. package/fesm2022/_effect-chunk.mjs +423 -0
  6. package/fesm2022/_effect-chunk.mjs.map +1 -0
  7. package/fesm2022/_effect-chunk2.mjs +2951 -0
  8. package/fesm2022/_effect-chunk2.mjs.map +1 -0
  9. package/fesm2022/_not_found-chunk.mjs +39 -0
  10. package/fesm2022/_not_found-chunk.mjs.map +1 -0
  11. package/fesm2022/_resource-chunk.mjs +378 -0
  12. package/fesm2022/_resource-chunk.mjs.map +1 -0
  13. package/fesm2022/_untracked-chunk.mjs +96 -0
  14. package/fesm2022/_untracked-chunk.mjs.map +1 -0
  15. package/fesm2022/_weak_ref-chunk.mjs +10 -0
  16. package/fesm2022/_weak_ref-chunk.mjs.map +1 -0
  17. package/fesm2022/core.mjs +2499 -4185
  18. package/fesm2022/core.mjs.map +1 -1
  19. package/fesm2022/primitives-di.mjs +23 -0
  20. package/fesm2022/primitives-di.mjs.map +1 -0
  21. package/fesm2022/primitives-event-dispatch.mjs +788 -0
  22. package/fesm2022/primitives-event-dispatch.mjs.map +1 -0
  23. package/fesm2022/primitives-signals.mjs +187 -0
  24. package/fesm2022/primitives-signals.mjs.map +1 -0
  25. package/fesm2022/rxjs-interop.mjs +210 -308
  26. package/fesm2022/rxjs-interop.mjs.map +1 -1
  27. package/fesm2022/testing.mjs +2309 -3170
  28. package/fesm2022/testing.mjs.map +1 -1
  29. package/package.json +18 -12
  30. package/resources/best-practices.md +56 -0
  31. package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +117 -0
  32. package/schematics/bundles/application-config-core.cjs +84 -0
  33. package/schematics/bundles/{apply_import_manager-yycO3l8f.cjs → apply_import_manager-1Zs_gpB6.cjs} +4 -5
  34. package/schematics/bundles/bootstrap-options-migration.cjs +598 -0
  35. package/schematics/bundles/cleanup-unused-imports.cjs +9 -13
  36. package/schematics/bundles/common-to-standalone-migration.cjs +381 -0
  37. package/schematics/bundles/{compiler_host-DrXTGf_7.cjs → compiler_host-DBwYMlTo.cjs} +10 -11
  38. package/schematics/bundles/control-flow-migration.cjs +113 -82
  39. package/schematics/bundles/{imports-26VeX8i-.cjs → imports-DP72APSx.cjs} +5 -1
  40. package/schematics/bundles/{index-BdH2rlWJ.cjs → index-B7I9sIUx.cjs} +36 -39
  41. package/schematics/bundles/inject-migration.cjs +148 -70
  42. package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
  43. package/schematics/bundles/{migrate_ts_type_references-BVSg43hf.cjs → migrate_ts_type_references-UGIUl7En.cjs} +500 -24
  44. package/schematics/bundles/{ng_component_template-DjLc4mdL.cjs → ng_component_template-Dsuq1Lw7.cjs} +4 -5
  45. package/schematics/bundles/{ng_decorators-CtYwz9Lw.cjs → ng_decorators-DSFlWYQY.cjs} +2 -2
  46. package/schematics/bundles/ngclass-to-class-migration.cjs +118 -109
  47. package/schematics/bundles/ngstyle-to-style-migration.cjs +487 -0
  48. package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
  49. package/schematics/bundles/output-migration.cjs +16 -19
  50. package/schematics/bundles/parse_html-8VLCL37B.cjs +132 -0
  51. package/schematics/bundles/{project_paths-T_M15e2g.cjs → project_paths-DvD50ouC.cjs} +14 -247
  52. package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +90 -0
  53. package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
  54. package/schematics/bundles/route-lazy-loading.cjs +54 -26
  55. package/schematics/bundles/router-current-navigation.cjs +7 -18
  56. package/schematics/bundles/router-last-successful-navigation.cjs +7 -18
  57. package/schematics/bundles/router-testing-module-migration.cjs +502 -0
  58. package/schematics/bundles/self-closing-tags-migration.cjs +14 -17
  59. package/schematics/bundles/signal-input-migration.cjs +93 -29
  60. package/schematics/bundles/signal-queries-migration.cjs +22 -25
  61. package/schematics/bundles/signals.cjs +10 -13
  62. package/schematics/bundles/standalone-migration.cjs +135 -102
  63. package/schematics/bundles/{symbol-VPWguRxr.cjs → symbol-BObKoqes.cjs} +3 -2
  64. package/schematics/collection.json +17 -0
  65. package/schematics/migrations/common-to-standalone-migration/schema.json +14 -0
  66. package/schematics/migrations/ngclass-to-class-migration/schema.json +2 -2
  67. package/schematics/migrations/ngstyle-to-style-migration/schema.json +20 -0
  68. package/schematics/migrations/router-testing-module-migration/schema.json +14 -0
  69. package/schematics/migrations.json +16 -2
  70. package/{api.d.d.ts → types/_api-chunk.d.ts} +9 -6
  71. package/{chrome_dev_tools_performance.d.d.ts → types/_chrome_dev_tools_performance-chunk.d.ts} +25 -15
  72. package/{discovery.d.d.ts → types/_discovery-chunk.d.ts} +130 -75
  73. package/{effect.d.d.ts → types/_effect-chunk.d.ts} +3 -4
  74. package/{event_dispatcher.d.d.ts → types/_event_dispatcher-chunk.d.ts} +2 -2
  75. package/{graph.d.d.ts → types/_formatter-chunk.d.ts} +40 -7
  76. package/{weak_ref.d.d.ts → types/_weak_ref-chunk.d.ts} +2 -2
  77. package/{index.d.ts → types/core.d.ts} +233 -298
  78. package/{primitives/di/index.d.ts → types/primitives-di.d.ts} +2 -2
  79. package/{primitives/event-dispatch/index.d.ts → types/primitives-event-dispatch.d.ts} +4 -4
  80. package/{primitives/signals/index.d.ts → types/primitives-signals.d.ts} +7 -8
  81. package/{rxjs-interop/index.d.ts → types/rxjs-interop.d.ts} +8 -6
  82. package/{testing/index.d.ts → types/testing.d.ts} +7 -7
  83. package/fesm2022/attribute.mjs +0 -24
  84. package/fesm2022/attribute.mjs.map +0 -1
  85. package/fesm2022/debug_node.mjs +0 -31829
  86. package/fesm2022/debug_node.mjs.map +0 -1
  87. package/fesm2022/effect.mjs +0 -142
  88. package/fesm2022/effect.mjs.map +0 -1
  89. package/fesm2022/not_found.mjs +0 -56
  90. package/fesm2022/not_found.mjs.map +0 -1
  91. package/fesm2022/primitives/di.mjs +0 -23
  92. package/fesm2022/primitives/di.mjs.map +0 -1
  93. package/fesm2022/primitives/event-dispatch.mjs +0 -1622
  94. package/fesm2022/primitives/event-dispatch.mjs.map +0 -1
  95. package/fesm2022/primitives/signals.mjs +0 -89
  96. package/fesm2022/primitives/signals.mjs.map +0 -1
  97. package/fesm2022/resource.mjs +0 -624
  98. package/fesm2022/resource.mjs.map +0 -1
  99. package/fesm2022/root_effect_scheduler.mjs +0 -4001
  100. package/fesm2022/root_effect_scheduler.mjs.map +0 -1
  101. package/fesm2022/signal.mjs +0 -560
  102. package/fesm2022/signal.mjs.map +0 -1
  103. package/fesm2022/weak_ref.mjs +0 -12
  104. package/fesm2022/weak_ref.mjs.map +0 -1
  105. package/schematics/bundles/index-jjHOgYYs.cjs +0 -22074
  106. package/schematics/bundles/parse_html-CXR8hziE.cjs +0 -41
  107. package/schematics/bundles/project_tsconfig_paths-D7xzGqRi.cjs +0 -51085
@@ -1,33 +1,23 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.1
3
+ * @license Angular v21.0.0-next.10
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 schematics = require('@angular-devkit/schematics');
10
- var p = require('path');
11
- var compiler_host = require('./compiler_host-DrXTGf_7.cjs');
10
+ var path = require('path');
11
+ var compiler_host = require('./compiler_host-DBwYMlTo.cjs');
12
12
  var ts = require('typescript');
13
- var ng_decorators = require('./ng_decorators-CtYwz9Lw.cjs');
14
- var imports = require('./imports-26VeX8i-.cjs');
13
+ var ng_decorators = require('./ng_decorators-DSFlWYQY.cjs');
14
+ var imports = require('./imports-DP72APSx.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-D7xzGqRi.cjs');
18
- require('os');
19
- require('fs');
20
- require('module');
21
- require('url');
17
+ var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.cjs');
18
+ require('@angular/compiler-cli/private/migrations');
22
19
  require('@angular-devkit/core');
23
20
 
24
- /*!
25
- * @license
26
- * Copyright Google LLC All Rights Reserved.
27
- *
28
- * Use of this source code is governed by an MIT-style license that can be
29
- * found in the LICENSE file at https://angular.dev/license
30
- */
31
21
  /** Names of decorators that enable DI on a class declaration. */
32
22
  const DECORATORS_SUPPORTING_DI = new Set([
33
23
  'Component',
@@ -346,13 +336,6 @@ function isInlineFunction(node) {
346
336
  return (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isArrowFunction(node));
347
337
  }
348
338
 
349
- /*!
350
- * @license
351
- * Copyright Google LLC All Rights Reserved.
352
- *
353
- * Use of this source code is governed by an MIT-style license that can be
354
- * found in the LICENSE file at https://angular.dev/license
355
- */
356
339
  /**
357
340
  * Finds class property declarations without initializers whose constructor-based initialization
358
341
  * can be inlined into the declaration spot after migrating to `inject`. For example:
@@ -820,66 +803,161 @@ function migrateClass(node, constructor, superCall, options, memberIndentation,
820
803
  * @param afterSuper Statements to be added after the `super` call.
821
804
  */
822
805
  function migrateParameter(node, options, localTypeChecker, printer, tracker, superCall, usedInSuper, usedInConstructor, usesOtherParams, memberIndentation, innerIndentation, prependToConstructor, propsToAdd, afterSuper) {
823
- if (!ts.isIdentifier(node.name)) {
806
+ const context = {
807
+ node,
808
+ options,
809
+ localTypeChecker,
810
+ printer,
811
+ tracker,
812
+ superCall,
813
+ usedInSuper,
814
+ usedInConstructor,
815
+ usesOtherParams,
816
+ memberIndentation,
817
+ innerIndentation,
818
+ prependToConstructor,
819
+ propsToAdd,
820
+ afterSuper,
821
+ };
822
+ if (ts.isIdentifier(node.name)) {
823
+ migrateIdentifierParameter(context, node.name);
824
+ }
825
+ else if (ts.isObjectBindingPattern(node.name)) {
826
+ migrateObjectBindingParameter(context, node.name);
827
+ }
828
+ else {
824
829
  return;
825
830
  }
826
- const name = node.name.text;
831
+ }
832
+ function migrateIdentifierParameter(context, name) {
833
+ const { node, options, localTypeChecker, printer, tracker, usedInConstructor, usesOtherParams } = context;
827
834
  const replacementCall = createInjectReplacementCall(node, options, localTypeChecker, printer, tracker);
828
835
  const declaresProp = parameterDeclaresProperty(node);
829
836
  // If the parameter declares a property, we need to declare it (e.g. `private foo: Foo`).
830
837
  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));
838
+ handlePropertyDeclaration(context, name, replacementCall);
844
839
  }
845
840
  // If the parameter is referenced within the constructor, we need to declare it as a variable.
846
841
  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
- }
842
+ handleConstructorUsage(context, name.text, replacementCall, declaresProp);
873
843
  }
874
844
  else if (usesOtherParams && declaresProp) {
875
- const toAdd = `${innerIndentation}this.${name} = ${replacementCall};`;
845
+ handleParameterWithDependencies(context, name.text, replacementCall);
846
+ }
847
+ }
848
+ function handlePropertyDeclaration(context, name, replacementCall) {
849
+ const { node, memberIndentation, propsToAdd } = context;
850
+ const canInitialize = !context.usedInSuper && !context.usesOtherParams;
851
+ const prop = ts.factory.createPropertyDeclaration(cloneModifiers(node.modifiers?.filter((modifier) => {
852
+ return !ts.isDecorator(modifier) && modifier.kind !== ts.SyntaxKind.PublicKeyword;
853
+ })), name, node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.PrivateKeyword)
854
+ ? undefined
855
+ : node.questionToken, canInitialize ? undefined : node.type, canInitialize ? ts.factory.createIdentifier(PLACEHOLDER) : undefined);
856
+ propsToAdd.push(memberIndentation +
857
+ replaceNodePlaceholder(node.getSourceFile(), prop, replacementCall, context.printer));
858
+ }
859
+ function handleConstructorUsage(context, name, replacementCall, declaresProp) {
860
+ const { innerIndentation, prependToConstructor, afterSuper, superCall } = context;
861
+ if (context.usedInSuper) {
862
+ // Usages of `this` aren't allowed before `super` calls so we need to
863
+ // create a variable which calls `inject()` directly instead...
864
+ prependToConstructor.push(`${innerIndentation}const ${name} = ${replacementCall};`);
865
+ if (declaresProp) {
866
+ afterSuper.push(`${innerIndentation}this.${name} = ${name};`);
867
+ }
868
+ }
869
+ else if (declaresProp) {
870
+ // If the parameter declares a property (`private foo: foo`) and is used inside the class
871
+ // at the same time, we need to ensure that it's initialized to the value from the variable
872
+ // and that we only reference `this` after the `super` call.
873
+ const initializer = `${innerIndentation}const ${name} = this.${name};`;
876
874
  if (superCall === null) {
877
- prependToConstructor.push(toAdd);
875
+ prependToConstructor.push(initializer);
878
876
  }
879
877
  else {
880
- afterSuper.push(toAdd);
878
+ afterSuper.push(initializer);
881
879
  }
882
880
  }
881
+ else {
882
+ // If the parameter is only referenced in the constructor, we
883
+ // don't need to declare any new properties.
884
+ prependToConstructor.push(`${innerIndentation}const ${name} = ${replacementCall};`);
885
+ }
886
+ }
887
+ function handleParameterWithDependencies(context, name, replacementCall) {
888
+ const { innerIndentation, prependToConstructor, afterSuper, superCall } = context;
889
+ const toAdd = `${innerIndentation}this.${name} = ${replacementCall};`;
890
+ if (superCall === null) {
891
+ prependToConstructor.push(toAdd);
892
+ }
893
+ else {
894
+ afterSuper.push(toAdd);
895
+ }
896
+ }
897
+ function migrateObjectBindingParameter(context, bindingPattern) {
898
+ const { node, options, localTypeChecker, printer, tracker } = context;
899
+ const replacementCall = createInjectReplacementCall(node, options, localTypeChecker, printer, tracker);
900
+ for (const element of bindingPattern.elements) {
901
+ if (ts.isBindingElement(element) && ts.isIdentifier(element.name)) {
902
+ migrateBindingElement(context, element, element.name, replacementCall);
903
+ }
904
+ }
905
+ }
906
+ function migrateBindingElement(context, element, elementName, replacementCall) {
907
+ const propertyName = elementName.text;
908
+ // Determines how to access the property
909
+ const propertyAccess = element.propertyName
910
+ ? `${replacementCall}.${element.propertyName.getText()}`
911
+ : `${replacementCall}.${propertyName}`;
912
+ createPropertyForBindingElement(context, propertyName, propertyAccess);
913
+ if (context.usedInConstructor) {
914
+ handleConstructorUsageBindingElement(context, element, propertyName);
915
+ }
916
+ }
917
+ function handleConstructorUsageBindingElement(context, element, propertyName) {
918
+ const { tracker, localTypeChecker, node: paramNode } = context;
919
+ const constructorDecl = paramNode.parent;
920
+ // Check in constructor or exist body content
921
+ if (!ts.isConstructorDeclaration(constructorDecl) || !constructorDecl.body) {
922
+ return;
923
+ }
924
+ // Get the unique "symbol" for our unstructured property.
925
+ const symbol = localTypeChecker.getSymbolAtLocation(element.name);
926
+ if (!symbol) {
927
+ return;
928
+ }
929
+ // Visit recursive function navigate constructor
930
+ const visit = (node) => {
931
+ // Check if current node is identifier (variable)
932
+ if (ts.isIdentifier(node)) {
933
+ // Using the type checker, verify that this identifier refers
934
+ // exactly to our destructured parameter and is not the node of the original declaration.
935
+ if (localTypeChecker.getSymbolAtLocation(node) === symbol && node !== element.name) {
936
+ // If the identifier is used as a shorthand property in an object literal (e.g., { myVar }),
937
+ // must replace the entire `ShorthandPropertyAssignment` node
938
+ // with a `PropertyAssignment` (e.g., myVar: this.myVar).
939
+ if (ts.isShorthandPropertyAssignment(node.parent)) {
940
+ tracker.replaceNode(node.parent, ts.factory.createPropertyAssignment(node, ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propertyName)));
941
+ }
942
+ else {
943
+ // Otherwise, replace the identifier with `this.propertyName`.
944
+ tracker.replaceNode(node, ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propertyName));
945
+ }
946
+ }
947
+ }
948
+ ts.forEachChild(node, visit);
949
+ };
950
+ visit(constructorDecl.body);
951
+ }
952
+ function createPropertyForBindingElement(context, propertyName, propertyAccess) {
953
+ const { node, memberIndentation, propsToAdd } = context;
954
+ const prop = ts.factory.createPropertyDeclaration(cloneModifiers(node.modifiers?.filter((modifier) => {
955
+ return !ts.isDecorator(modifier) && modifier.kind !== ts.SyntaxKind.PublicKeyword;
956
+ })), propertyName, node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.PrivateKeyword)
957
+ ? undefined
958
+ : node.questionToken, undefined, ts.factory.createIdentifier(PLACEHOLDER));
959
+ propsToAdd.push(memberIndentation +
960
+ replaceNodePlaceholder(node.getSourceFile(), prop, propertyAccess, context.printer));
883
961
  }
884
962
  /**
885
963
  * Creates a replacement `inject` call from a function parameter.
@@ -1247,7 +1325,7 @@ function migrate(options) {
1247
1325
  const { buildPaths, testPaths } = await project_tsconfig_paths.getProjectTsConfigPaths(tree);
1248
1326
  const basePath = process.cwd();
1249
1327
  const allPaths = [...buildPaths, ...testPaths];
1250
- const pathToMigrate = compiler_host.normalizePath(p.join(basePath, options.path));
1328
+ const pathToMigrate = compiler_host.normalizePath(path.join(basePath, options.path));
1251
1329
  if (!allPaths.length) {
1252
1330
  throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run the inject migration.');
1253
1331
  }
@@ -1271,7 +1349,7 @@ function runInjectMigration(tree, tsconfigPath, basePath, pathToMigrate, schemat
1271
1349
  for (const sourceFile of sourceFiles) {
1272
1350
  const changes = migrateFile(sourceFile, schematicOptions);
1273
1351
  if (changes.length > 0) {
1274
- const update = tree.beginUpdate(p.relative(basePath, sourceFile.fileName));
1352
+ const update = tree.beginUpdate(path.relative(basePath, sourceFile.fileName));
1275
1353
  for (const change of changes) {
1276
1354
  if (change.removeLength != null) {
1277
1355
  update.remove(change.start, change.removeLength);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.1
3
+ * @license Angular v21.0.0-next.10
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */