@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "21.0.0-next.1",
3
+ "version": "21.0.0-next.10",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -18,27 +18,27 @@
18
18
  "default": "./package.json"
19
19
  },
20
20
  ".": {
21
- "types": "./index.d.ts",
21
+ "types": "./types/core.d.ts",
22
22
  "default": "./fesm2022/core.mjs"
23
23
  },
24
24
  "./primitives/di": {
25
- "types": "./primitives/di/index.d.ts",
26
- "default": "./fesm2022/primitives/di.mjs"
25
+ "types": "./types/primitives-di.d.ts",
26
+ "default": "./fesm2022/primitives-di.mjs"
27
27
  },
28
28
  "./primitives/event-dispatch": {
29
- "types": "./primitives/event-dispatch/index.d.ts",
30
- "default": "./fesm2022/primitives/event-dispatch.mjs"
29
+ "types": "./types/primitives-event-dispatch.d.ts",
30
+ "default": "./fesm2022/primitives-event-dispatch.mjs"
31
31
  },
32
32
  "./primitives/signals": {
33
- "types": "./primitives/signals/index.d.ts",
34
- "default": "./fesm2022/primitives/signals.mjs"
33
+ "types": "./types/primitives-signals.d.ts",
34
+ "default": "./fesm2022/primitives-signals.mjs"
35
35
  },
36
36
  "./rxjs-interop": {
37
- "types": "./rxjs-interop/index.d.ts",
37
+ "types": "./types/rxjs-interop.d.ts",
38
38
  "default": "./fesm2022/rxjs-interop.mjs"
39
39
  },
40
40
  "./testing": {
41
- "types": "./testing/index.d.ts",
41
+ "types": "./types/testing.d.ts",
42
42
  "default": "./fesm2022/testing.mjs"
43
43
  }
44
44
  },
@@ -46,7 +46,7 @@
46
46
  "tslib": "^2.3.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@angular/compiler": "21.0.0-next.1",
49
+ "@angular/compiler": "21.0.0-next.10",
50
50
  "rxjs": "^6.5.3 || ^7.4.0",
51
51
  "zone.js": "~0.15.0"
52
52
  },
@@ -84,9 +84,15 @@
84
84
  "@angular/service-worker"
85
85
  ]
86
86
  },
87
+ "angular": {
88
+ "bestPractices": {
89
+ "format": "markdown",
90
+ "path": "./resources/best-practices.md"
91
+ }
92
+ },
87
93
  "schematics": "./schematics/collection.json",
88
94
  "sideEffects": false,
89
95
  "module": "./fesm2022/core.mjs",
90
- "typings": "./index.d.ts",
96
+ "typings": "./types/core.d.ts",
91
97
  "type": "module"
92
98
  }
@@ -0,0 +1,56 @@
1
+ You are an expert in TypeScript, Angular, and scalable web application development. You write functional, maintainable, performant, and accessible code following Angular and TypeScript best practices.
2
+
3
+ ## TypeScript Best Practices
4
+
5
+ - Use strict type checking
6
+ - Prefer type inference when the type is obvious
7
+ - Avoid the `any` type; use `unknown` when type is uncertain
8
+
9
+ ## Angular Best Practices
10
+
11
+ - Always use standalone components over NgModules
12
+ - Must NOT set `standalone: true` inside Angular decorators. It's the default in Angular v20+.
13
+ - Use signals for state management
14
+ - Implement lazy loading for feature routes
15
+ - Do NOT use the `@HostBinding` and `@HostListener` decorators. Put host bindings inside the `host` object of the `@Component` or `@Directive` decorator instead
16
+ - Use `NgOptimizedImage` for all static images.
17
+ - `NgOptimizedImage` does not work for inline base64 images.
18
+
19
+ ## Accessibility Requirements
20
+
21
+ - It MUST pass all AXE checks.
22
+ - It MUST follow all WCAG AA minimums, including focus management, color contrast, and ARIA attributes.
23
+
24
+ ### Components
25
+
26
+ - Keep components small and focused on a single responsibility
27
+ - Use `input()` and `output()` functions instead of decorators
28
+ - Use `computed()` for derived state
29
+ - Set `changeDetection: ChangeDetectionStrategy.OnPush` in `@Component` decorator
30
+ - Prefer inline templates for small components
31
+ - Prefer Reactive forms instead of Template-driven ones
32
+ - Do NOT use `ngClass`, use `class` bindings instead
33
+ - Do NOT use `ngStyle`, use `style` bindings instead
34
+ - When using external templates/styles, use paths relative to the component TS file.
35
+
36
+ ## State Management
37
+
38
+ - Use signals for local component state
39
+ - Use `computed()` for derived state
40
+ - Keep state transformations pure and predictable
41
+ - Do NOT use `mutate` on signals, use `update` or `set` instead
42
+
43
+ ## Templates
44
+
45
+ - Keep templates simple and avoid complex logic
46
+ - Use native control flow (`@if`, `@for`, `@switch`) instead of `*ngIf`, `*ngFor`, `*ngSwitch`
47
+ - Use the async pipe to handle observables
48
+ - Do not assume globals like (`new Date()`) are available.
49
+ - Do not write arrow functions in templates (they are not supported).
50
+ - Do not write Regular expressions in templates (they are not supported).
51
+
52
+ ## Services
53
+
54
+ - Design services around a single responsibility
55
+ - Use the `providedIn: 'root'` option for singleton services
56
+ - Use the `inject()` function instead of constructor injection
@@ -0,0 +1,117 @@
1
+ 'use strict';
2
+ /**
3
+ * @license Angular v21.0.0-next.10
4
+ * (c) 2010-2025 Google LLC. https://angular.io/
5
+ * License: MIT
6
+ */
7
+ 'use strict';
8
+
9
+ require('@angular-devkit/core');
10
+ require('node:path/posix');
11
+ var project_paths = require('./project_paths-DvD50ouC.cjs');
12
+ var migrations = require('@angular/compiler-cli/private/migrations');
13
+ var ts = require('typescript');
14
+ var apply_import_manager = require('./apply_import_manager-1Zs_gpB6.cjs');
15
+ require('@angular/compiler-cli');
16
+ require('node:path');
17
+ require('@angular-devkit/schematics');
18
+ require('./project_tsconfig_paths-CDVxT6Ov.cjs');
19
+
20
+ function findArrowFunction(node) {
21
+ let current = node;
22
+ while (current) {
23
+ if (ts.isArrowFunction(current)) {
24
+ return current;
25
+ }
26
+ current = current.parent;
27
+ }
28
+ return undefined;
29
+ }
30
+ class AddBootstrapContextToServerMainMigration extends project_paths.TsurgeFunnelMigration {
31
+ async analyze(info) {
32
+ const replacements = [];
33
+ let importManager = null;
34
+ for (const sourceFile of info.sourceFiles) {
35
+ if (!sourceFile.fileName.endsWith('main.server.ts')) {
36
+ continue;
37
+ }
38
+ const bootstrapAppCalls = [];
39
+ ts.forEachChild(sourceFile, function findCalls(node) {
40
+ if (ts.isCallExpression(node) &&
41
+ ts.isIdentifier(node.expression) &&
42
+ node.expression.text === 'bootstrapApplication' &&
43
+ node.arguments.length < 3) {
44
+ bootstrapAppCalls.push(node);
45
+ }
46
+ ts.forEachChild(node, findCalls);
47
+ });
48
+ if (bootstrapAppCalls.length === 0) {
49
+ continue;
50
+ }
51
+ for (const node of bootstrapAppCalls) {
52
+ const end = node.arguments[node.arguments.length - 1].getEnd();
53
+ replacements.push(new project_paths.Replacement(project_paths.projectFile(sourceFile, info), new project_paths.TextUpdate({
54
+ position: end,
55
+ end: end,
56
+ toInsert: ', context',
57
+ })));
58
+ const arrowFunction = findArrowFunction(node);
59
+ if (arrowFunction && arrowFunction.parameters.length === 0) {
60
+ replacements.push(new project_paths.Replacement(project_paths.projectFile(sourceFile, info), new project_paths.TextUpdate({
61
+ position: arrowFunction.parameters.end,
62
+ end: arrowFunction.parameters.end,
63
+ toInsert: 'context: BootstrapContext',
64
+ })));
65
+ }
66
+ }
67
+ importManager ??= new migrations.ImportManager({
68
+ generateUniqueIdentifier: () => null,
69
+ shouldUseSingleQuotes: () => true,
70
+ });
71
+ importManager.addImport({
72
+ exportSymbolName: 'BootstrapContext',
73
+ exportModuleSpecifier: '@angular/platform-browser',
74
+ requestedFile: sourceFile,
75
+ });
76
+ }
77
+ if (importManager !== null) {
78
+ apply_import_manager.applyImportManagerChanges(importManager, replacements, info.sourceFiles, info);
79
+ }
80
+ return project_paths.confirmAsSerializable({ replacements });
81
+ }
82
+ async migrate(globalData) {
83
+ return project_paths.confirmAsSerializable(globalData);
84
+ }
85
+ async combine(unitA, unitB) {
86
+ const seen = new Set();
87
+ const combined = [];
88
+ [unitA.replacements, unitB.replacements].forEach((replacements) => {
89
+ replacements.forEach((current) => {
90
+ const { position, end, toInsert } = current.update.data;
91
+ const key = current.projectFile.id + '/' + position + '/' + end + '/' + toInsert;
92
+ if (!seen.has(key)) {
93
+ seen.add(key);
94
+ combined.push(current);
95
+ }
96
+ });
97
+ });
98
+ return project_paths.confirmAsSerializable({ replacements: combined });
99
+ }
100
+ async globalMeta(combinedData) {
101
+ return project_paths.confirmAsSerializable(combinedData);
102
+ }
103
+ async stats() {
104
+ return project_paths.confirmAsSerializable({});
105
+ }
106
+ }
107
+
108
+ function migrate() {
109
+ return async (tree) => {
110
+ await project_paths.runMigrationInDevkit({
111
+ tree,
112
+ getMigration: () => new AddBootstrapContextToServerMainMigration(),
113
+ });
114
+ };
115
+ }
116
+
117
+ exports.migrate = migrate;
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+ /**
3
+ * @license Angular v21.0.0-next.10
4
+ * (c) 2010-2025 Google LLC. https://angular.io/
5
+ * License: MIT
6
+ */
7
+ 'use strict';
8
+
9
+ var migrations = require('@angular/compiler-cli/private/migrations');
10
+ var apply_import_manager = require('./apply_import_manager-1Zs_gpB6.cjs');
11
+ require('@angular/compiler-cli');
12
+ require('typescript');
13
+ require('node:path');
14
+ var project_paths = require('./project_paths-DvD50ouC.cjs');
15
+ var imports = require('./imports-DP72APSx.cjs');
16
+ require('@angular-devkit/core');
17
+ require('node:path/posix');
18
+ require('@angular-devkit/schematics');
19
+ require('./project_tsconfig_paths-CDVxT6Ov.cjs');
20
+
21
+ /** Migration that moves the import of `ApplicationConfig` from `platform-browser` to `core`. */
22
+ class ApplicationConfigCoreMigration extends project_paths.TsurgeFunnelMigration {
23
+ async analyze(info) {
24
+ const replacements = [];
25
+ let importManager = null;
26
+ for (const sourceFile of info.sourceFiles) {
27
+ const specifier = imports.getImportSpecifier(sourceFile, '@angular/platform-browser', 'ApplicationConfig');
28
+ if (!specifier) {
29
+ continue;
30
+ }
31
+ importManager ??= new migrations.ImportManager({
32
+ // Prevent the manager from trying to generate a non-conflicting import.
33
+ generateUniqueIdentifier: () => null,
34
+ shouldUseSingleQuotes: () => true,
35
+ });
36
+ importManager.removeImport(sourceFile, 'ApplicationConfig', '@angular/platform-browser');
37
+ importManager.addImport({
38
+ exportSymbolName: 'ApplicationConfig',
39
+ exportModuleSpecifier: '@angular/core',
40
+ requestedFile: sourceFile,
41
+ unsafeAliasOverride: specifier.propertyName ? specifier.name.text : undefined,
42
+ });
43
+ }
44
+ if (importManager !== null) {
45
+ apply_import_manager.applyImportManagerChanges(importManager, replacements, info.sourceFiles, info);
46
+ }
47
+ return project_paths.confirmAsSerializable({ replacements });
48
+ }
49
+ async migrate(globalData) {
50
+ return project_paths.confirmAsSerializable(globalData);
51
+ }
52
+ async combine(unitA, unitB) {
53
+ const seen = new Set();
54
+ const combined = [];
55
+ [unitA.replacements, unitB.replacements].forEach((replacements) => {
56
+ replacements.forEach((current) => {
57
+ const { position, end, toInsert } = current.update.data;
58
+ const key = current.projectFile.id + '/' + position + '/' + end + '/' + toInsert;
59
+ if (!seen.has(key)) {
60
+ seen.add(key);
61
+ combined.push(current);
62
+ }
63
+ });
64
+ });
65
+ return project_paths.confirmAsSerializable({ replacements: combined });
66
+ }
67
+ async globalMeta(combinedData) {
68
+ return project_paths.confirmAsSerializable(combinedData);
69
+ }
70
+ async stats() {
71
+ return project_paths.confirmAsSerializable({});
72
+ }
73
+ }
74
+
75
+ function migrate() {
76
+ return async (tree) => {
77
+ await project_paths.runMigrationInDevkit({
78
+ tree,
79
+ getMigration: () => new ApplicationConfigCoreMigration(),
80
+ });
81
+ };
82
+ }
83
+
84
+ exports.migrate = migrate;
@@ -1,15 +1,14 @@
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 ts = require('typescript');
10
- require('os');
11
- var project_tsconfig_paths = require('./project_tsconfig_paths-D7xzGqRi.cjs');
12
- var project_paths = require('./project_paths-T_M15e2g.cjs');
10
+ var compilerCli = require('@angular/compiler-cli');
11
+ var project_paths = require('./project_paths-DvD50ouC.cjs');
13
12
 
14
13
  /**
15
14
  * Applies import manager changes, and writes them as replacements the
@@ -23,7 +22,7 @@ function applyImportManagerChanges(importManager, replacements, sourceFiles, inf
23
22
  newImports.forEach((newImports, fileName) => {
24
23
  newImports.forEach((newImport) => {
25
24
  const printedImport = printer.printNode(ts.EmitHint.Unspecified, newImport, pathToFile.get(fileName));
26
- replacements.push(new project_paths.Replacement(project_paths.projectFile(project_tsconfig_paths.absoluteFrom(fileName), info), new project_paths.TextUpdate({ position: 0, end: 0, toInsert: `${printedImport}\n` })));
25
+ replacements.push(new project_paths.Replacement(project_paths.projectFile(compilerCli.absoluteFrom(fileName), info), new project_paths.TextUpdate({ position: 0, end: 0, toInsert: `${printedImport}\n` })));
27
26
  });
28
27
  });
29
28
  // Capture updated imports