@angular/core 17.0.0-next.6 → 17.0.0-next.8

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 (93) hide show
  1. package/esm2022/primitives/signals/index.mjs +15 -0
  2. package/esm2022/primitives/signals/src/computed.mjs +92 -0
  3. package/esm2022/primitives/signals/src/equality.mjs +14 -0
  4. package/esm2022/primitives/signals/src/errors.mjs +18 -0
  5. package/esm2022/primitives/signals/src/graph.mjs +291 -0
  6. package/esm2022/primitives/signals/src/signal.mjs +78 -0
  7. package/esm2022/primitives/signals/src/watch.mjs +82 -0
  8. package/esm2022/primitives/signals/src/weak_ref.mjs +11 -0
  9. package/esm2022/rxjs-interop/src/to_signal.mjs +45 -14
  10. package/esm2022/src/application_init.mjs +50 -2
  11. package/esm2022/src/application_ref.mjs +7 -2
  12. package/esm2022/src/application_tokens.mjs +16 -1
  13. package/esm2022/src/core_private_export.mjs +4 -4
  14. package/esm2022/src/core_reactivity_export_internal.mjs +6 -2
  15. package/esm2022/src/core_render3_private_export.mjs +2 -2
  16. package/esm2022/src/errors.mjs +1 -1
  17. package/esm2022/src/image_performance_warning.mjs +154 -0
  18. package/esm2022/src/linker/compiler.mjs +1 -1
  19. package/esm2022/src/metadata/directives.mjs +1 -1
  20. package/esm2022/src/render3/after_render_hooks.mjs +5 -1
  21. package/esm2022/src/render3/assert.mjs +16 -1
  22. package/esm2022/src/render3/component_ref.mjs +12 -3
  23. package/esm2022/src/render3/debug/framework_injector_profiler.mjs +33 -4
  24. package/esm2022/src/render3/debug/injector_profiler.mjs +1 -1
  25. package/esm2022/src/render3/debug/set_debug_info.mjs +20 -0
  26. package/esm2022/src/render3/definition.mjs +2 -1
  27. package/esm2022/src/render3/deps_tracker/api.mjs +1 -1
  28. package/esm2022/src/render3/deps_tracker/deps_tracker.mjs +13 -2
  29. package/esm2022/src/render3/features/host_directives_feature.mjs +3 -8
  30. package/esm2022/src/render3/hooks.mjs +5 -5
  31. package/esm2022/src/render3/index.mjs +3 -2
  32. package/esm2022/src/render3/instructions/change_detection.mjs +31 -14
  33. package/esm2022/src/render3/instructions/control_flow.mjs +75 -63
  34. package/esm2022/src/render3/instructions/defer.mjs +410 -60
  35. package/esm2022/src/render3/instructions/defer_events.mjs +28 -8
  36. package/esm2022/src/render3/instructions/shared.mjs +5 -4
  37. package/esm2022/src/render3/interfaces/container.mjs +5 -4
  38. package/esm2022/src/render3/interfaces/defer.mjs +13 -6
  39. package/esm2022/src/render3/interfaces/definition.mjs +1 -1
  40. package/esm2022/src/render3/interfaces/view.mjs +5 -4
  41. package/esm2022/src/render3/jit/environment.mjs +3 -1
  42. package/esm2022/src/render3/list_reconciliation.mjs +257 -0
  43. package/esm2022/src/render3/node_manipulation.mjs +4 -6
  44. package/esm2022/src/render3/pipe.mjs +4 -4
  45. package/esm2022/src/render3/reactive_lview_consumer.mjs +2 -2
  46. package/esm2022/src/render3/reactivity/api.mjs +15 -0
  47. package/esm2022/src/render3/reactivity/asserts.mjs +26 -0
  48. package/esm2022/src/render3/reactivity/computed.mjs +19 -0
  49. package/esm2022/src/render3/reactivity/effect.mjs +7 -6
  50. package/esm2022/src/render3/reactivity/signal.mjs +32 -0
  51. package/esm2022/src/render3/reactivity/untracked.mjs +24 -0
  52. package/esm2022/src/render3/util/global_utils.mjs +3 -2
  53. package/esm2022/src/render3/util/injector_discovery_utils.mjs +70 -9
  54. package/esm2022/src/render3/util/stringify_utils.mjs +28 -1
  55. package/esm2022/src/render3/util/view_utils.mjs +41 -25
  56. package/esm2022/src/render3/view_ref.mjs +13 -2
  57. package/esm2022/src/util/stringify.mjs +16 -1
  58. package/esm2022/src/version.mjs +1 -1
  59. package/esm2022/testing/src/logger.mjs +3 -3
  60. package/fesm2022/core.mjs +15104 -14010
  61. package/fesm2022/core.mjs.map +1 -1
  62. package/fesm2022/primitives/signals.mjs +539 -0
  63. package/fesm2022/primitives/signals.mjs.map +1 -0
  64. package/fesm2022/rxjs-interop.mjs +45 -14
  65. package/fesm2022/rxjs-interop.mjs.map +1 -1
  66. package/fesm2022/testing.mjs +1 -1
  67. package/index.d.ts +171 -167
  68. package/package.json +7 -1
  69. package/primitives/signals/index.d.ts +281 -0
  70. package/rxjs-interop/index.d.ts +15 -101
  71. package/schematics/collection.json +12 -2
  72. package/schematics/migrations/block-template-entities/bundle.js +1192 -610
  73. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  74. package/schematics/migrations/compiler-options/bundle.js +582 -0
  75. package/schematics/migrations/compiler-options/bundle.js.map +7 -0
  76. package/schematics/migrations/transfer-state/bundle.js +592 -0
  77. package/schematics/migrations/transfer-state/bundle.js.map +7 -0
  78. package/schematics/migrations.json +10 -0
  79. package/schematics/ng-generate/control-flow-migration/bundle.js +24097 -0
  80. package/schematics/ng-generate/control-flow-migration/bundle.js.map +7 -0
  81. package/schematics/ng-generate/control-flow-migration/schema.json +7 -0
  82. package/schematics/ng-generate/standalone-migration/bundle.js +2470 -1627
  83. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  84. package/testing/index.d.ts +1 -1
  85. package/esm2022/src/signals/index.mjs +0 -16
  86. package/esm2022/src/signals/src/api.mjs +0 -39
  87. package/esm2022/src/signals/src/computed.mjs +0 -95
  88. package/esm2022/src/signals/src/errors.mjs +0 -18
  89. package/esm2022/src/signals/src/graph.mjs +0 -280
  90. package/esm2022/src/signals/src/signal.mjs +0 -92
  91. package/esm2022/src/signals/src/untracked.mjs +0 -26
  92. package/esm2022/src/signals/src/watch.mjs +0 -81
  93. package/esm2022/src/signals/src/weak_ref.mjs +0 -11
@@ -0,0 +1,592 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __export = (target, all) => {
22
+ for (var name in all)
23
+ __defProp(target, name, { get: all[name], enumerable: true });
24
+ };
25
+ var __copyProps = (to, from, except, desc) => {
26
+ if (from && typeof from === "object" || typeof from === "function") {
27
+ for (let key of __getOwnPropNames(from))
28
+ if (!__hasOwnProp.call(to, key) && key !== except)
29
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
30
+ }
31
+ return to;
32
+ };
33
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
34
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
+ mod
36
+ ));
37
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
+ var __publicField = (obj, key, value) => {
39
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
40
+ return value;
41
+ };
42
+ var __async = (__this, __arguments, generator) => {
43
+ return new Promise((resolve3, reject) => {
44
+ var fulfilled = (value) => {
45
+ try {
46
+ step(generator.next(value));
47
+ } catch (e) {
48
+ reject(e);
49
+ }
50
+ };
51
+ var rejected = (value) => {
52
+ try {
53
+ step(generator.throw(value));
54
+ } catch (e) {
55
+ reject(e);
56
+ }
57
+ };
58
+ var step = (x) => x.done ? resolve3(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
59
+ step((generator = generator.apply(__this, __arguments)).next());
60
+ });
61
+ };
62
+
63
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/transfer-state/index.mjs
64
+ var transfer_state_exports = {};
65
+ __export(transfer_state_exports, {
66
+ default: () => transfer_state_default
67
+ });
68
+ module.exports = __toCommonJS(transfer_state_exports);
69
+ var import_schematics = require("@angular-devkit/schematics");
70
+ var import_path3 = require("path");
71
+
72
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs
73
+ var import_core = require("@angular-devkit/core");
74
+ function getProjectTsConfigPaths(tree) {
75
+ return __async(this, null, function* () {
76
+ const buildPaths = /* @__PURE__ */ new Set();
77
+ const testPaths = /* @__PURE__ */ new Set();
78
+ const workspace = yield getWorkspace(tree);
79
+ for (const [, project] of workspace.projects) {
80
+ for (const [name, target] of project.targets) {
81
+ if (name !== "build" && name !== "test") {
82
+ continue;
83
+ }
84
+ for (const [, options] of allTargetOptions(target)) {
85
+ const tsConfig = options["tsConfig"];
86
+ if (typeof tsConfig !== "string" || !tree.exists(tsConfig)) {
87
+ continue;
88
+ }
89
+ if (name === "build") {
90
+ buildPaths.add((0, import_core.normalize)(tsConfig));
91
+ } else {
92
+ testPaths.add((0, import_core.normalize)(tsConfig));
93
+ }
94
+ }
95
+ }
96
+ }
97
+ return {
98
+ buildPaths: [...buildPaths],
99
+ testPaths: [...testPaths]
100
+ };
101
+ });
102
+ }
103
+ function* allTargetOptions(target) {
104
+ if (target.options) {
105
+ yield [void 0, target.options];
106
+ }
107
+ if (!target.configurations) {
108
+ return;
109
+ }
110
+ for (const [name, options] of Object.entries(target.configurations)) {
111
+ if (options) {
112
+ yield [name, options];
113
+ }
114
+ }
115
+ }
116
+ function createHost(tree) {
117
+ return {
118
+ readFile(path2) {
119
+ return __async(this, null, function* () {
120
+ const data = tree.read(path2);
121
+ if (!data) {
122
+ throw new Error("File not found.");
123
+ }
124
+ return import_core.virtualFs.fileBufferToString(data);
125
+ });
126
+ },
127
+ writeFile(path2, data) {
128
+ return __async(this, null, function* () {
129
+ return tree.overwrite(path2, data);
130
+ });
131
+ },
132
+ isDirectory(path2) {
133
+ return __async(this, null, function* () {
134
+ return !tree.exists(path2) && tree.getDir(path2).subfiles.length > 0;
135
+ });
136
+ },
137
+ isFile(path2) {
138
+ return __async(this, null, function* () {
139
+ return tree.exists(path2);
140
+ });
141
+ }
142
+ };
143
+ }
144
+ function getWorkspace(tree) {
145
+ return __async(this, null, function* () {
146
+ const host = createHost(tree);
147
+ const { workspace } = yield import_core.workspaces.readWorkspace("/", host);
148
+ return workspace;
149
+ });
150
+ }
151
+
152
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
153
+ var import_path = require("path");
154
+ var import_typescript2 = __toESM(require("typescript"), 1);
155
+
156
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
157
+ var path = __toESM(require("path"), 1);
158
+ var import_typescript = __toESM(require("typescript"), 1);
159
+ function parseTsconfigFile(tsconfigPath, basePath) {
160
+ const { config } = import_typescript.default.readConfigFile(tsconfigPath, import_typescript.default.sys.readFile);
161
+ const parseConfigHost = {
162
+ useCaseSensitiveFileNames: import_typescript.default.sys.useCaseSensitiveFileNames,
163
+ fileExists: import_typescript.default.sys.fileExists,
164
+ readDirectory: import_typescript.default.sys.readDirectory,
165
+ readFile: import_typescript.default.sys.readFile
166
+ };
167
+ if (!path.isAbsolute(basePath)) {
168
+ throw Error("Unexpected relative base path has been specified.");
169
+ }
170
+ return import_typescript.default.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
171
+ }
172
+
173
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
174
+ function createMigrationProgram(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles) {
175
+ const { rootNames, options, host } = createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles);
176
+ return import_typescript2.default.createProgram(rootNames, options, host);
177
+ }
178
+ function createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles, optionOverrides) {
179
+ tsconfigPath = (0, import_path.resolve)(basePath, tsconfigPath);
180
+ const parsed = parseTsconfigFile(tsconfigPath, (0, import_path.dirname)(tsconfigPath));
181
+ const options = optionOverrides ? __spreadValues(__spreadValues({}, parsed.options), optionOverrides) : parsed.options;
182
+ const host = createMigrationCompilerHost(tree, options, basePath, fakeFileRead);
183
+ return { rootNames: parsed.fileNames.concat(additionalFiles || []), options, host };
184
+ }
185
+ function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
186
+ const host = import_typescript2.default.createCompilerHost(options, true);
187
+ const defaultReadFile = host.readFile;
188
+ host.readFile = (fileName) => {
189
+ var _a;
190
+ const treeRelativePath = (0, import_path.relative)(basePath, fileName);
191
+ let result = fakeRead == null ? void 0 : fakeRead(treeRelativePath);
192
+ if (typeof result !== "string") {
193
+ result = treeRelativePath.startsWith("..") ? defaultReadFile.call(host, fileName) : (_a = tree.read(treeRelativePath)) == null ? void 0 : _a.toString();
194
+ }
195
+ return typeof result === "string" ? result.replace(/^\uFEFF/, "") : void 0;
196
+ };
197
+ return host;
198
+ }
199
+ function canMigrateFile(basePath, sourceFile, program) {
200
+ if (sourceFile.fileName.endsWith(".ngtypecheck.ts") || sourceFile.isDeclarationFile || program.isSourceFileFromExternalLibrary(sourceFile)) {
201
+ return false;
202
+ }
203
+ return !(0, import_path.relative)(basePath, sourceFile.fileName).startsWith("..");
204
+ }
205
+
206
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/transfer-state/utils.mjs
207
+ var import_typescript7 = __toESM(require("typescript"), 1);
208
+
209
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
210
+ var import_typescript4 = __toESM(require("typescript"), 1);
211
+
212
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/import_manager.mjs
213
+ var import_path2 = require("path");
214
+ var import_typescript3 = __toESM(require("typescript"), 1);
215
+ var ImportManager = class {
216
+ constructor(getUpdateRecorder, printer) {
217
+ __publicField(this, "getUpdateRecorder");
218
+ __publicField(this, "printer");
219
+ __publicField(this, "updatedImports", /* @__PURE__ */ new Map());
220
+ __publicField(this, "usedIdentifierNames", /* @__PURE__ */ new Map());
221
+ __publicField(this, "newImports", /* @__PURE__ */ new Map());
222
+ __publicField(this, "quoteStyles", {});
223
+ __publicField(this, "importCache", []);
224
+ this.getUpdateRecorder = getUpdateRecorder;
225
+ this.printer = printer;
226
+ }
227
+ addImportToSourceFile(sourceFile, symbolName, moduleName, alias = null, typeImport = false, keepSymbolName = false) {
228
+ const sourceDir = (0, import_path2.dirname)(sourceFile.fileName);
229
+ let importStartIndex = 0;
230
+ let existingImport = null;
231
+ const cachedImport = this.importCache.find((c) => c.sourceFile === sourceFile && c.symbolName === symbolName && c.moduleName === moduleName && c.alias === alias);
232
+ if (cachedImport) {
233
+ return cachedImport.identifier;
234
+ }
235
+ for (let i = sourceFile.statements.length - 1; i >= 0; i--) {
236
+ const statement = sourceFile.statements[i];
237
+ if (!import_typescript3.default.isImportDeclaration(statement) || !import_typescript3.default.isStringLiteral(statement.moduleSpecifier) || !statement.importClause) {
238
+ continue;
239
+ }
240
+ if (importStartIndex === 0) {
241
+ importStartIndex = this._getEndPositionOfNode(statement);
242
+ }
243
+ const moduleSpecifier = statement.moduleSpecifier.text;
244
+ if (moduleSpecifier.startsWith(".") && (0, import_path2.resolve)(sourceDir, moduleSpecifier) !== (0, import_path2.resolve)(sourceDir, moduleName) || moduleSpecifier !== moduleName) {
245
+ continue;
246
+ }
247
+ if (statement.importClause.namedBindings) {
248
+ const namedBindings = statement.importClause.namedBindings;
249
+ if (import_typescript3.default.isNamespaceImport(namedBindings) && !typeImport) {
250
+ return import_typescript3.default.factory.createPropertyAccessExpression(import_typescript3.default.factory.createIdentifier(namedBindings.name.text), import_typescript3.default.factory.createIdentifier(alias || symbolName || "default"));
251
+ } else if (import_typescript3.default.isNamedImports(namedBindings) && symbolName) {
252
+ const existingElement = namedBindings.elements.find((e) => {
253
+ if (alias) {
254
+ return e.propertyName && e.name.text === alias && e.propertyName.text === symbolName;
255
+ }
256
+ return e.propertyName ? e.propertyName.text === symbolName : e.name.text === symbolName;
257
+ });
258
+ if (existingElement) {
259
+ return import_typescript3.default.factory.createIdentifier(existingElement.name.text);
260
+ }
261
+ existingImport = statement;
262
+ }
263
+ } else if (statement.importClause.name && !symbolName) {
264
+ return import_typescript3.default.factory.createIdentifier(statement.importClause.name.text);
265
+ }
266
+ }
267
+ if (existingImport) {
268
+ const { propertyName, name } = this._getImportParts(sourceFile, symbolName, alias, keepSymbolName);
269
+ this.updatedImports.set(existingImport, (this.updatedImports.get(existingImport) || []).concat({ propertyName, importName: name }));
270
+ this.importCache.push({ sourceFile, moduleName, symbolName, alias, identifier: name });
271
+ return name;
272
+ }
273
+ let identifier = null;
274
+ if (!this.newImports.has(sourceFile)) {
275
+ this.newImports.set(sourceFile, {
276
+ importStartIndex,
277
+ defaultImports: /* @__PURE__ */ new Map(),
278
+ namedImports: /* @__PURE__ */ new Map()
279
+ });
280
+ }
281
+ if (symbolName) {
282
+ const { propertyName, name } = this._getImportParts(sourceFile, symbolName, alias, keepSymbolName);
283
+ const importMap = this.newImports.get(sourceFile).namedImports;
284
+ identifier = name;
285
+ if (!importMap.has(moduleName)) {
286
+ importMap.set(moduleName, []);
287
+ }
288
+ importMap.get(moduleName).push(import_typescript3.default.factory.createImportSpecifier(false, propertyName, name));
289
+ } else {
290
+ const importMap = this.newImports.get(sourceFile).defaultImports;
291
+ identifier = this._getUniqueIdentifier(sourceFile, "defaultExport");
292
+ importMap.set(moduleName, identifier);
293
+ }
294
+ this.importCache.push({ sourceFile, symbolName, moduleName, alias, identifier });
295
+ return identifier;
296
+ }
297
+ recordChanges() {
298
+ this.updatedImports.forEach((expressions, importDecl) => {
299
+ const sourceFile = importDecl.getSourceFile();
300
+ const recorder = this.getUpdateRecorder(sourceFile);
301
+ const namedBindings = importDecl.importClause.namedBindings;
302
+ const newNamedBindings = import_typescript3.default.factory.updateNamedImports(namedBindings, namedBindings.elements.concat(expressions.map(({ propertyName, importName }) => import_typescript3.default.factory.createImportSpecifier(false, propertyName, importName))));
303
+ const newNamedBindingsText = this.printer.printNode(import_typescript3.default.EmitHint.Unspecified, newNamedBindings, sourceFile);
304
+ recorder.updateExistingImport(namedBindings, newNamedBindingsText);
305
+ });
306
+ this.newImports.forEach(({ importStartIndex, defaultImports, namedImports }, sourceFile) => {
307
+ const recorder = this.getUpdateRecorder(sourceFile);
308
+ const useSingleQuotes = this._getQuoteStyle(sourceFile) === 0;
309
+ defaultImports.forEach((identifier, moduleName) => {
310
+ const newImport = import_typescript3.default.factory.createImportDeclaration(void 0, import_typescript3.default.factory.createImportClause(false, identifier, void 0), import_typescript3.default.factory.createStringLiteral(moduleName, useSingleQuotes));
311
+ recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
312
+ });
313
+ namedImports.forEach((specifiers, moduleName) => {
314
+ const newImport = import_typescript3.default.factory.createImportDeclaration(void 0, import_typescript3.default.factory.createImportClause(false, void 0, import_typescript3.default.factory.createNamedImports(specifiers)), import_typescript3.default.factory.createStringLiteral(moduleName, useSingleQuotes));
315
+ recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
316
+ });
317
+ });
318
+ }
319
+ _getUniqueIdentifier(sourceFile, baseName) {
320
+ if (this.isUniqueIdentifierName(sourceFile, baseName)) {
321
+ this._recordUsedIdentifier(sourceFile, baseName);
322
+ return import_typescript3.default.factory.createIdentifier(baseName);
323
+ }
324
+ let name = null;
325
+ let counter = 1;
326
+ do {
327
+ name = `${baseName}_${counter++}`;
328
+ } while (!this.isUniqueIdentifierName(sourceFile, name));
329
+ this._recordUsedIdentifier(sourceFile, name);
330
+ return import_typescript3.default.factory.createIdentifier(name);
331
+ }
332
+ isUniqueIdentifierName(sourceFile, name) {
333
+ if (this.usedIdentifierNames.has(sourceFile) && this.usedIdentifierNames.get(sourceFile).indexOf(name) !== -1) {
334
+ return false;
335
+ }
336
+ const nodeQueue = [sourceFile];
337
+ while (nodeQueue.length) {
338
+ const node = nodeQueue.shift();
339
+ if (import_typescript3.default.isIdentifier(node) && node.text === name && (!import_typescript3.default.isImportSpecifier(node.parent) || node.parent.propertyName !== node)) {
340
+ return false;
341
+ }
342
+ nodeQueue.push(...node.getChildren());
343
+ }
344
+ return true;
345
+ }
346
+ _recordUsedIdentifier(sourceFile, identifierName) {
347
+ this.usedIdentifierNames.set(sourceFile, (this.usedIdentifierNames.get(sourceFile) || []).concat(identifierName));
348
+ }
349
+ _getEndPositionOfNode(node) {
350
+ const nodeEndPos = node.getEnd();
351
+ const commentRanges = import_typescript3.default.getTrailingCommentRanges(node.getSourceFile().text, nodeEndPos);
352
+ if (!commentRanges || !commentRanges.length) {
353
+ return nodeEndPos;
354
+ }
355
+ return commentRanges[commentRanges.length - 1].end;
356
+ }
357
+ _getNewImportText(importStartIndex, newImport, sourceFile) {
358
+ const text = this.printer.printNode(import_typescript3.default.EmitHint.Unspecified, newImport, sourceFile);
359
+ return importStartIndex === 0 ? `${text}
360
+ ` : `
361
+ ${text}`;
362
+ }
363
+ _getImportParts(sourceFile, symbolName, alias, keepSymbolName) {
364
+ const symbolIdentifier = import_typescript3.default.factory.createIdentifier(symbolName);
365
+ const aliasIdentifier = alias ? import_typescript3.default.factory.createIdentifier(alias) : null;
366
+ const generatedUniqueIdentifier = this._getUniqueIdentifier(sourceFile, alias || symbolName);
367
+ const needsGeneratedUniqueName = generatedUniqueIdentifier.text !== (alias || symbolName);
368
+ let propertyName;
369
+ let name;
370
+ if (needsGeneratedUniqueName && !keepSymbolName) {
371
+ propertyName = symbolIdentifier;
372
+ name = generatedUniqueIdentifier;
373
+ } else if (aliasIdentifier) {
374
+ propertyName = symbolIdentifier;
375
+ name = aliasIdentifier;
376
+ } else {
377
+ name = symbolIdentifier;
378
+ }
379
+ return { propertyName, name };
380
+ }
381
+ _getQuoteStyle(sourceFile) {
382
+ if (!this.quoteStyles.hasOwnProperty(sourceFile.fileName)) {
383
+ let quoteStyle;
384
+ for (const statement of sourceFile.statements) {
385
+ if (import_typescript3.default.isImportDeclaration(statement) && import_typescript3.default.isStringLiteralLike(statement.moduleSpecifier)) {
386
+ quoteStyle = statement.moduleSpecifier.getText().trim().startsWith('"') ? 1 : 0;
387
+ break;
388
+ }
389
+ }
390
+ this.quoteStyles[sourceFile.fileName] = quoteStyle != null ? quoteStyle : 0;
391
+ }
392
+ return this.quoteStyles[sourceFile.fileName];
393
+ }
394
+ };
395
+
396
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
397
+ var ChangeTracker = class {
398
+ constructor(_printer, _importRemapper) {
399
+ __publicField(this, "_printer");
400
+ __publicField(this, "_importRemapper");
401
+ __publicField(this, "_changes", /* @__PURE__ */ new Map());
402
+ __publicField(this, "_importManager");
403
+ this._printer = _printer;
404
+ this._importRemapper = _importRemapper;
405
+ this._importManager = new ImportManager((currentFile) => ({
406
+ addNewImport: (start, text) => this.insertText(currentFile, start, text),
407
+ updateExistingImport: (namedBindings, text) => this.replaceText(currentFile, namedBindings.getStart(), namedBindings.getWidth(), text)
408
+ }), this._printer);
409
+ }
410
+ insertText(sourceFile, index, text) {
411
+ this._trackChange(sourceFile, { start: index, text });
412
+ }
413
+ replaceText(sourceFile, start, removeLength, text) {
414
+ this._trackChange(sourceFile, { start, removeLength, text });
415
+ }
416
+ replaceNode(oldNode, newNode, emitHint = import_typescript4.default.EmitHint.Unspecified, sourceFileWhenPrinting) {
417
+ const sourceFile = oldNode.getSourceFile();
418
+ this.replaceText(sourceFile, oldNode.getStart(), oldNode.getWidth(), this._printer.printNode(emitHint, newNode, sourceFileWhenPrinting || sourceFile));
419
+ }
420
+ removeNode(node) {
421
+ this._trackChange(node.getSourceFile(), { start: node.getStart(), removeLength: node.getWidth(), text: "" });
422
+ }
423
+ addImport(sourceFile, symbolName, moduleName, alias = null, keepSymbolName = false) {
424
+ if (this._importRemapper) {
425
+ moduleName = this._importRemapper(moduleName, sourceFile.fileName);
426
+ }
427
+ moduleName = normalizePath(moduleName);
428
+ return this._importManager.addImportToSourceFile(sourceFile, symbolName, moduleName, alias, false, keepSymbolName);
429
+ }
430
+ recordChanges() {
431
+ this._importManager.recordChanges();
432
+ return this._changes;
433
+ }
434
+ clearChanges() {
435
+ this._changes.clear();
436
+ }
437
+ _trackChange(file, change) {
438
+ const changes = this._changes.get(file);
439
+ if (changes) {
440
+ const insertIndex = changes.findIndex((current) => current.start <= change.start);
441
+ if (insertIndex === -1) {
442
+ changes.push(change);
443
+ } else {
444
+ changes.splice(insertIndex, 0, change);
445
+ }
446
+ } else {
447
+ this._changes.set(file, [change]);
448
+ }
449
+ }
450
+ };
451
+ function normalizePath(path2) {
452
+ return path2.replace(/\\/g, "/");
453
+ }
454
+
455
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/imports.mjs
456
+ var import_typescript5 = __toESM(require("typescript"), 1);
457
+ function getImportSpecifiers(sourceFile, moduleName, specifierNames) {
458
+ var _a;
459
+ const matches = [];
460
+ for (const node of sourceFile.statements) {
461
+ if (import_typescript5.default.isImportDeclaration(node) && import_typescript5.default.isStringLiteral(node.moduleSpecifier)) {
462
+ const isMatch = typeof moduleName === "string" ? node.moduleSpecifier.text === moduleName : moduleName.test(node.moduleSpecifier.text);
463
+ const namedBindings = (_a = node.importClause) == null ? void 0 : _a.namedBindings;
464
+ if (isMatch && namedBindings && import_typescript5.default.isNamedImports(namedBindings)) {
465
+ for (const specifierName of specifierNames) {
466
+ const match = findImportSpecifier(namedBindings.elements, specifierName);
467
+ if (match) {
468
+ matches.push(match);
469
+ }
470
+ }
471
+ }
472
+ }
473
+ }
474
+ return matches;
475
+ }
476
+ function removeSymbolFromNamedImports(node, symbol) {
477
+ return import_typescript5.default.factory.updateNamedImports(node, [
478
+ ...node.elements.filter((current) => current !== symbol)
479
+ ]);
480
+ }
481
+ function findImportSpecifier(nodes, specifierName) {
482
+ return nodes.find((element) => {
483
+ const { name, propertyName } = element;
484
+ return propertyName ? propertyName.text === specifierName : name.text === specifierName;
485
+ });
486
+ }
487
+
488
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/nodes.mjs
489
+ var import_typescript6 = __toESM(require("typescript"), 1);
490
+ function closestNode(node, predicate) {
491
+ let current = node.parent;
492
+ while (current && !import_typescript6.default.isSourceFile(current)) {
493
+ if (predicate(current)) {
494
+ return current;
495
+ }
496
+ current = current.parent;
497
+ }
498
+ return null;
499
+ }
500
+
501
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/transfer-state/utils.mjs
502
+ var symbolsToUpdate = /* @__PURE__ */ new Set(["makeStateKey", "StateKey", "TransferState"]);
503
+ var platformBrowserModule = "@angular/platform-browser";
504
+ var coreModule = "@angular/core";
505
+ function migrateFile(sourceFile, rewriteFn) {
506
+ const exposedImports = getImportSpecifiers(sourceFile, platformBrowserModule, [...symbolsToUpdate]);
507
+ if (exposedImports.length === 0) {
508
+ return;
509
+ }
510
+ migrateImports(sourceFile, rewriteFn);
511
+ }
512
+ function migrateImports(sourceFile, rewriteFn) {
513
+ var _a, _b, _c;
514
+ let changeTracker = new ChangeTracker(import_typescript7.default.createPrinter());
515
+ const updatedImports = /* @__PURE__ */ new Map();
516
+ const addedImports = new Array();
517
+ const importSpecifiers = getImportSpecifiers(sourceFile, platformBrowserModule, [...symbolsToUpdate]);
518
+ for (const importSpecifier of importSpecifiers) {
519
+ const namedImports = closestNode(importSpecifier, import_typescript7.default.isNamedImports);
520
+ const importToUpdate = (_a = updatedImports.get(namedImports)) != null ? _a : namedImports;
521
+ const rewrittenNamedImports = removeSymbolFromNamedImports(importToUpdate, importSpecifier);
522
+ updatedImports.set(namedImports, rewrittenNamedImports);
523
+ addedImports.push(importSpecifier.name.getText());
524
+ }
525
+ for (const [originalNode, rewrittenNode] of updatedImports.entries()) {
526
+ if (rewrittenNode.elements.length > 0) {
527
+ changeTracker.replaceNode(originalNode, rewrittenNode);
528
+ } else {
529
+ const importDeclaration = originalNode.parent.parent;
530
+ changeTracker.removeNode(importDeclaration);
531
+ }
532
+ }
533
+ for (const changesInFile of changeTracker.recordChanges().values()) {
534
+ for (const change of changesInFile) {
535
+ rewriteFn(change.start, (_b = change.removeLength) != null ? _b : 0, change.text);
536
+ }
537
+ }
538
+ changeTracker.clearChanges();
539
+ for (const i of addedImports) {
540
+ changeTracker.addImport(sourceFile, i, coreModule, null, true);
541
+ }
542
+ for (const changesInFile of changeTracker.recordChanges().values()) {
543
+ for (const change of changesInFile) {
544
+ rewriteFn(change.start, (_c = change.removeLength) != null ? _c : 0, change.text);
545
+ }
546
+ }
547
+ }
548
+
549
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/transfer-state/index.mjs
550
+ function transfer_state_default() {
551
+ return (tree) => __async(this, null, function* () {
552
+ const { buildPaths, testPaths } = yield getProjectTsConfigPaths(tree);
553
+ const basePath = process.cwd();
554
+ const allPaths = [...buildPaths, ...testPaths];
555
+ if (!allPaths.length) {
556
+ throw new import_schematics.SchematicsException("Could not find any tsconfig file. Cannot run the transfer state migration.");
557
+ }
558
+ for (const tsconfigPath of allPaths) {
559
+ runMigration(tree, tsconfigPath, basePath);
560
+ }
561
+ });
562
+ }
563
+ function runMigration(tree, tsconfigPath, basePath) {
564
+ const program = createMigrationProgram(tree, tsconfigPath, basePath);
565
+ const sourceFiles = program.getSourceFiles().filter((sourceFile) => canMigrateFile(basePath, sourceFile, program));
566
+ for (const sourceFile of sourceFiles) {
567
+ let update = null;
568
+ const rewriter = (startPos, width, text) => {
569
+ if (update === null) {
570
+ update = tree.beginUpdate((0, import_path3.relative)(basePath, sourceFile.fileName));
571
+ }
572
+ update.remove(startPos, width);
573
+ if (text !== null) {
574
+ update.insertLeft(startPos, text);
575
+ }
576
+ };
577
+ migrateFile(sourceFile, rewriter);
578
+ if (update !== null) {
579
+ tree.commitUpdate(update);
580
+ }
581
+ }
582
+ }
583
+ // Annotate the CommonJS export names for ESM import in node:
584
+ 0 && (module.exports = {});
585
+ /**
586
+ * @license
587
+ * Copyright Google LLC All Rights Reserved.
588
+ *
589
+ * Use of this source code is governed by an MIT-style license that can be
590
+ * found in the LICENSE file at https://angular.io/license
591
+ */
592
+ //# sourceMappingURL=bundle.js.map