@angular/core 20.0.0-next.1 → 20.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.
Files changed (54) hide show
  1. package/fesm2022/core.mjs +770 -2144
  2. package/fesm2022/core.mjs.map +1 -1
  3. package/fesm2022/primitives/di.mjs +3 -2
  4. package/fesm2022/primitives/di.mjs.map +1 -1
  5. package/fesm2022/primitives/event-dispatch.mjs +2 -589
  6. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  7. package/fesm2022/primitives/signals.mjs +44 -13
  8. package/fesm2022/primitives/signals.mjs.map +1 -1
  9. package/fesm2022/rxjs-interop.mjs +7 -39
  10. package/fesm2022/rxjs-interop.mjs.map +1 -1
  11. package/fesm2022/testing.mjs +116 -143
  12. package/fesm2022/testing.mjs.map +1 -1
  13. package/fesm2022/weak_ref-DrMdAIDh.mjs +12 -0
  14. package/fesm2022/weak_ref-DrMdAIDh.mjs.map +1 -0
  15. package/index.d.ts +14366 -15214
  16. package/navigation_types.d-u4EOrrdZ.d.ts +121 -0
  17. package/package.json +2 -2
  18. package/primitives/di/index.d.ts +66 -59
  19. package/primitives/event-dispatch/index.d.ts +205 -309
  20. package/primitives/signals/index.d.ts +161 -195
  21. package/rxjs-interop/index.d.ts +71 -100
  22. package/schematics/bundles/{apply_import_manager-e2a7fe5b.js → apply_import_manager-BXQEjo09.js} +15 -19
  23. package/schematics/bundles/{checker-af521da6.js → checker-BHb19MHt.js} +3695 -1175
  24. package/schematics/bundles/cleanup-unused-imports.js +56 -89
  25. package/schematics/bundles/{compiler_host-5a29293c.js → compiler_host-Bk3repE2.js} +19 -23
  26. package/schematics/bundles/control-flow-migration.js +81 -38
  27. package/schematics/bundles/{imports-047fbbc8.js → imports-CIX-JgAN.js} +9 -14
  28. package/schematics/bundles/{index-1bef3025.js → index-BL9kAIe5.js} +62 -66
  29. package/schematics/bundles/{program-a449f9bf.js → index-I8VbxQcO.js} +1508 -3178
  30. package/schematics/bundles/inject-flags.js +147 -0
  31. package/schematics/bundles/inject-migration.js +121 -127
  32. package/schematics/bundles/{leading_space-f8944434.js → leading_space-D9nQ8UQC.js} +1 -1
  33. package/schematics/bundles/{migrate_ts_type_references-2a3e9e6b.js → migrate_ts_type_references-KlOTWeDl.js} +121 -126
  34. package/schematics/bundles/{ng_decorators-b0d8b324.js → ng_decorators-DznZ5jMl.js} +4 -8
  35. package/schematics/bundles/{nodes-7758dbf6.js → nodes-B16H9JUd.js} +2 -6
  36. package/schematics/bundles/output-migration.js +94 -128
  37. package/schematics/bundles/{project_tsconfig_paths-b558633b.js → project_tsconfig_paths-CDVxT6Ov.js} +1 -1
  38. package/schematics/bundles/{property_name-ac18447e.js → property_name-BBwFuqMe.js} +3 -7
  39. package/schematics/bundles/route-lazy-loading.js +35 -41
  40. package/schematics/bundles/{project_paths-17dc204d.js → run_in_devkit-C0JPtK2u.js} +283 -216
  41. package/schematics/bundles/self-closing-tags-migration.js +55 -91
  42. package/schematics/bundles/signal-input-migration.js +121 -156
  43. package/schematics/bundles/signal-queries-migration.js +119 -154
  44. package/schematics/bundles/signals.js +12 -14
  45. package/schematics/bundles/standalone-migration.js +180 -200
  46. package/schematics/bundles/symbol-VPWguRxr.js +25 -0
  47. package/schematics/bundles/test-bed-get.js +98 -0
  48. package/schematics/migrations.json +8 -14
  49. package/testing/index.d.ts +289 -471
  50. package/weak_ref.d-ttyj86RV.d.ts +9 -0
  51. package/schematics/bundles/explicit-standalone-flag.js +0 -184
  52. package/schematics/bundles/index-ef1bffbb.js +0 -30
  53. package/schematics/bundles/pending-tasks.js +0 -103
  54. package/schematics/bundles/provide-initializer.js +0 -186
@@ -0,0 +1,147 @@
1
+ 'use strict';
2
+ /**
3
+ * @license Angular v20.0.0-next.3
4
+ * (c) 2010-2025 Google LLC. https://angular.io/
5
+ * License: MIT
6
+ */
7
+ 'use strict';
8
+
9
+ var ts = require('typescript');
10
+ require('os');
11
+ var checker = require('./checker-BHb19MHt.js');
12
+ require('./index-I8VbxQcO.js');
13
+ require('path');
14
+ var run_in_devkit = require('./run_in_devkit-C0JPtK2u.js');
15
+ var apply_import_manager = require('./apply_import_manager-BXQEjo09.js');
16
+ var imports = require('./imports-CIX-JgAN.js');
17
+ require('@angular-devkit/core');
18
+ require('node:path/posix');
19
+ require('fs');
20
+ require('module');
21
+ require('url');
22
+ require('@angular-devkit/schematics');
23
+ require('./project_tsconfig_paths-CDVxT6Ov.js');
24
+
25
+ /** Mapping between `InjectFlag` enum members to their object literal equvalients. */
26
+ const FLAGS_TO_FIELDS = {
27
+ 'Default': 'default',
28
+ 'Host': 'host',
29
+ 'Optional': 'optional',
30
+ 'Self': 'self',
31
+ 'SkipSelf': 'skipSelf',
32
+ };
33
+ /** Migration that replaces `InjectFlags` usages with object literals. */
34
+ class InjectFlagsMigration extends run_in_devkit.TsurgeFunnelMigration {
35
+ async analyze(info) {
36
+ const locations = {};
37
+ const importRemovals = {};
38
+ for (const sourceFile of info.sourceFiles) {
39
+ const specifier = imports.getImportSpecifier(sourceFile, '@angular/core', 'InjectFlags');
40
+ if (specifier === null) {
41
+ continue;
42
+ }
43
+ const file = run_in_devkit.projectFile(sourceFile, info);
44
+ const importManager = new checker.ImportManager();
45
+ const importReplacements = [];
46
+ // Always remove the `InjectFlags` since it has been removed from Angular.
47
+ // Note that it be better to do this inside of `migrate`, but we don't have AST access there.
48
+ importManager.removeImport(sourceFile, 'InjectFlags', '@angular/core');
49
+ apply_import_manager.applyImportManagerChanges(importManager, importReplacements, [sourceFile], info);
50
+ importRemovals[file.id] = importReplacements;
51
+ sourceFile.forEachChild(function walk(node) {
52
+ if (
53
+ // Note: we don't use the type checker for matching here, because
54
+ // the `InjectFlags` will be removed which can break the lookup.
55
+ ts.isPropertyAccessExpression(node) &&
56
+ ts.isIdentifier(node.expression) &&
57
+ node.expression.text === specifier.name.text &&
58
+ FLAGS_TO_FIELDS.hasOwnProperty(node.name.text)) {
59
+ const root = getInjectFlagsRootExpression(node);
60
+ if (root !== null) {
61
+ const flagName = FLAGS_TO_FIELDS[node.name.text];
62
+ const id = getNodeID(file, root);
63
+ locations[id] ??= { file, flags: [], position: root.getStart(), end: root.getEnd() };
64
+ // The flags can't be a set here, because they need to be serializable.
65
+ if (!locations[id].flags.includes(flagName)) {
66
+ locations[id].flags.push(flagName);
67
+ }
68
+ }
69
+ }
70
+ else {
71
+ node.forEachChild(walk);
72
+ }
73
+ });
74
+ }
75
+ return run_in_devkit.confirmAsSerializable({ locations, importRemovals });
76
+ }
77
+ async migrate(globalData) {
78
+ const replacements = [];
79
+ for (const removals of Object.values(globalData.importRemovals)) {
80
+ replacements.push(...removals);
81
+ }
82
+ for (const { file, position, end, flags } of Object.values(globalData.locations)) {
83
+ // Declare a property for each flag, except for `default` which does not have a flag.
84
+ const properties = flags.filter((flag) => flag !== 'default').map((flag) => `${flag}: true`);
85
+ const toInsert = properties.length ? `{ ${properties.join(', ')} }` : '{}';
86
+ replacements.push(new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({ position, end, toInsert })));
87
+ }
88
+ return run_in_devkit.confirmAsSerializable({ replacements });
89
+ }
90
+ async combine(unitA, unitB) {
91
+ return run_in_devkit.confirmAsSerializable({
92
+ locations: {
93
+ ...unitA.locations,
94
+ ...unitB.locations,
95
+ },
96
+ importRemovals: {
97
+ ...unitA.importRemovals,
98
+ ...unitB.importRemovals,
99
+ },
100
+ });
101
+ }
102
+ async globalMeta(combinedData) {
103
+ return run_in_devkit.confirmAsSerializable(combinedData);
104
+ }
105
+ async stats() {
106
+ return { counters: {} };
107
+ }
108
+ }
109
+ /** Gets an ID that can be used to look up a node based on its location. */
110
+ function getNodeID(file, node) {
111
+ return `${file.id}/${node.getStart()}/${node.getWidth()}`;
112
+ }
113
+ /**
114
+ * Gets the root expression of an `InjectFlags` usage. For example given `InjectFlags.Optional`.
115
+ * in `InjectFlags.Host | InjectFlags.Optional | InjectFlags.SkipSelf`, the function will return
116
+ * the top-level binary expression.
117
+ * @param start Node from which to start searching.
118
+ */
119
+ function getInjectFlagsRootExpression(start) {
120
+ let current = start;
121
+ let parent = current?.parent;
122
+ while (parent && (ts.isBinaryExpression(parent) || ts.isParenthesizedExpression(parent))) {
123
+ current = parent;
124
+ parent = current.parent;
125
+ }
126
+ // Only allow allow expressions that are call parameters, variable initializer or parameter
127
+ // initializers which are the only officially supported usages of `InjectFlags`.
128
+ if (current &&
129
+ parent &&
130
+ ((ts.isCallExpression(parent) && parent.arguments.includes(current)) ||
131
+ (ts.isVariableDeclaration(parent) && parent.initializer === current) ||
132
+ (ts.isParameter(parent) && parent.initializer === current))) {
133
+ return current;
134
+ }
135
+ return null;
136
+ }
137
+
138
+ function migrate() {
139
+ return async (tree) => {
140
+ await run_in_devkit.runMigrationInDevkit({
141
+ tree,
142
+ getMigration: () => new InjectFlagsMigration(),
143
+ });
144
+ };
145
+ }
146
+
147
+ exports.migrate = migrate;