@angular/core 18.1.0-next.1 → 18.1.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.
- package/esm2022/src/core.mjs +1 -1
- package/esm2022/src/event_emitter.mjs +20 -11
- package/esm2022/src/pending_tasks.mjs +15 -20
- package/esm2022/src/render3/after_render_hooks.mjs +67 -132
- package/esm2022/src/render3/component_ref.mjs +1 -1
- package/esm2022/src/render3/instructions/change_detection.mjs +27 -24
- package/esm2022/src/render3/reactive_lview_consumer.mjs +56 -3
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/fesm2022/core.mjs +344 -349
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/index.d.ts +212 -28
- package/package.json +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/migrations/after-render-phase/bundle.js +602 -0
- package/schematics/migrations/after-render-phase/bundle.js.map +7 -0
- package/schematics/migrations/http-providers/bundle.js +15 -15
- package/schematics/migrations/invalid-two-way-bindings/bundle.js +158 -158
- package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +1 -1
- package/schematics/migrations.json +5 -0
- package/schematics/ng-generate/control-flow-migration/bundle.js +166 -166
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +1 -1
- package/schematics/ng-generate/standalone-migration/bundle.js +483 -1096
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
|
@@ -0,0 +1,602 @@
|
|
|
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/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/after-render-phase/index.mjs
|
|
64
|
+
var after_render_phase_exports = {};
|
|
65
|
+
__export(after_render_phase_exports, {
|
|
66
|
+
default: () => after_render_phase_default
|
|
67
|
+
});
|
|
68
|
+
module.exports = __toCommonJS(after_render_phase_exports);
|
|
69
|
+
var import_schematics = require("@angular-devkit/schematics");
|
|
70
|
+
var import_path3 = require("path");
|
|
71
|
+
|
|
72
|
+
// bazel-out/darwin_arm64-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/darwin_arm64-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/darwin_arm64-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/darwin_arm64-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/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/after-render-phase/migration.mjs
|
|
207
|
+
var import_typescript6 = __toESM(require("typescript"), 1);
|
|
208
|
+
|
|
209
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
|
|
210
|
+
var import_typescript4 = __toESM(require("typescript"), 1);
|
|
211
|
+
|
|
212
|
+
// bazel-out/darwin_arm64-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/darwin_arm64-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(), {
|
|
422
|
+
start: node.getStart(),
|
|
423
|
+
removeLength: node.getWidth(),
|
|
424
|
+
text: ""
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
addImport(sourceFile, symbolName, moduleName, alias = null, keepSymbolName = false) {
|
|
428
|
+
if (this._importRemapper) {
|
|
429
|
+
moduleName = this._importRemapper(moduleName, sourceFile.fileName);
|
|
430
|
+
}
|
|
431
|
+
moduleName = normalizePath(moduleName);
|
|
432
|
+
return this._importManager.addImportToSourceFile(sourceFile, symbolName, moduleName, alias, false, keepSymbolName);
|
|
433
|
+
}
|
|
434
|
+
recordChanges() {
|
|
435
|
+
this._importManager.recordChanges();
|
|
436
|
+
return this._changes;
|
|
437
|
+
}
|
|
438
|
+
clearChanges() {
|
|
439
|
+
this._changes.clear();
|
|
440
|
+
}
|
|
441
|
+
_trackChange(file, change) {
|
|
442
|
+
const changes = this._changes.get(file);
|
|
443
|
+
if (changes) {
|
|
444
|
+
const insertIndex = changes.findIndex((current) => current.start <= change.start);
|
|
445
|
+
if (insertIndex === -1) {
|
|
446
|
+
changes.push(change);
|
|
447
|
+
} else {
|
|
448
|
+
changes.splice(insertIndex, 0, change);
|
|
449
|
+
}
|
|
450
|
+
} else {
|
|
451
|
+
this._changes.set(file, [change]);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
function normalizePath(path2) {
|
|
456
|
+
return path2.replace(/\\/g, "/");
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/imports.mjs
|
|
460
|
+
var import_typescript5 = __toESM(require("typescript"), 1);
|
|
461
|
+
function getImportOfIdentifier(typeChecker, node) {
|
|
462
|
+
const symbol = typeChecker.getSymbolAtLocation(node);
|
|
463
|
+
if (!symbol || symbol.declarations === void 0 || !symbol.declarations.length) {
|
|
464
|
+
return null;
|
|
465
|
+
}
|
|
466
|
+
const decl = symbol.declarations[0];
|
|
467
|
+
if (!import_typescript5.default.isImportSpecifier(decl)) {
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
const importDecl = decl.parent.parent.parent;
|
|
471
|
+
if (!import_typescript5.default.isImportDeclaration(importDecl) || !import_typescript5.default.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
return {
|
|
475
|
+
name: decl.propertyName ? decl.propertyName.text : decl.name.text,
|
|
476
|
+
importModule: importDecl.moduleSpecifier.text,
|
|
477
|
+
node: importDecl
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function getImportSpecifier(sourceFile, moduleName, specifierName) {
|
|
481
|
+
var _a;
|
|
482
|
+
return (_a = getImportSpecifiers(sourceFile, moduleName, [specifierName])[0]) != null ? _a : null;
|
|
483
|
+
}
|
|
484
|
+
function getImportSpecifiers(sourceFile, moduleName, specifierNames) {
|
|
485
|
+
var _a;
|
|
486
|
+
const matches = [];
|
|
487
|
+
for (const node of sourceFile.statements) {
|
|
488
|
+
if (import_typescript5.default.isImportDeclaration(node) && import_typescript5.default.isStringLiteral(node.moduleSpecifier)) {
|
|
489
|
+
const isMatch = typeof moduleName === "string" ? node.moduleSpecifier.text === moduleName : moduleName.test(node.moduleSpecifier.text);
|
|
490
|
+
const namedBindings = (_a = node.importClause) == null ? void 0 : _a.namedBindings;
|
|
491
|
+
if (isMatch && namedBindings && import_typescript5.default.isNamedImports(namedBindings)) {
|
|
492
|
+
for (const specifierName of specifierNames) {
|
|
493
|
+
const match = findImportSpecifier(namedBindings.elements, specifierName);
|
|
494
|
+
if (match) {
|
|
495
|
+
matches.push(match);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return matches;
|
|
502
|
+
}
|
|
503
|
+
function findImportSpecifier(nodes, specifierName) {
|
|
504
|
+
return nodes.find((element) => {
|
|
505
|
+
const { name, propertyName } = element;
|
|
506
|
+
return propertyName ? propertyName.text === specifierName : name.text === specifierName;
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/after-render-phase/migration.mjs
|
|
511
|
+
var CORE = "@angular/core";
|
|
512
|
+
var AFTER_RENDER_PHASE_ENUM = "AfterRenderPhase";
|
|
513
|
+
var AFTER_RENDER_FNS = /* @__PURE__ */ new Set(["afterRender", "afterNextRender"]);
|
|
514
|
+
function migrateFile(sourceFile, typeChecker, rewriteFn) {
|
|
515
|
+
var _a;
|
|
516
|
+
const changeTracker = new ChangeTracker(import_typescript6.default.createPrinter());
|
|
517
|
+
const phaseEnum = getImportSpecifier(sourceFile, CORE, AFTER_RENDER_PHASE_ENUM);
|
|
518
|
+
if (phaseEnum) {
|
|
519
|
+
changeTracker.removeNode(phaseEnum);
|
|
520
|
+
import_typescript6.default.forEachChild(sourceFile, function visit(node) {
|
|
521
|
+
var _a2;
|
|
522
|
+
import_typescript6.default.forEachChild(node, visit);
|
|
523
|
+
if (import_typescript6.default.isCallExpression(node) && import_typescript6.default.isIdentifier(node.expression) && AFTER_RENDER_FNS.has(((_a2 = getImportOfIdentifier(typeChecker, node.expression)) == null ? void 0 : _a2.name) || "")) {
|
|
524
|
+
let phase;
|
|
525
|
+
const [callback, options] = node.arguments;
|
|
526
|
+
if (import_typescript6.default.isObjectLiteralExpression(options)) {
|
|
527
|
+
const phaseProp = options.properties.find((p) => {
|
|
528
|
+
var _a3;
|
|
529
|
+
return ((_a3 = p.name) == null ? void 0 : _a3.getText()) === "phase";
|
|
530
|
+
});
|
|
531
|
+
if (phaseProp && import_typescript6.default.isPropertyAssignment(phaseProp) && import_typescript6.default.isPropertyAccessExpression(phaseProp.initializer) && phaseProp.initializer.expression.getText() === AFTER_RENDER_PHASE_ENUM) {
|
|
532
|
+
phaseProp.initializer.expression;
|
|
533
|
+
phase = phaseProp.initializer.name.getText();
|
|
534
|
+
if (options.properties.length === 1) {
|
|
535
|
+
changeTracker.removeNode(options);
|
|
536
|
+
} else {
|
|
537
|
+
const newOptions = import_typescript6.default.factory.createObjectLiteralExpression(options.properties.filter((p) => p !== phaseProp));
|
|
538
|
+
changeTracker.replaceNode(options, newOptions);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (phase) {
|
|
543
|
+
phase = phase.substring(0, 1).toLocaleLowerCase() + phase.substring(1);
|
|
544
|
+
const spec = import_typescript6.default.factory.createObjectLiteralExpression([
|
|
545
|
+
import_typescript6.default.factory.createPropertyAssignment(import_typescript6.default.factory.createIdentifier(phase), callback)
|
|
546
|
+
]);
|
|
547
|
+
changeTracker.replaceNode(callback, spec);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
for (const changesInFile of changeTracker.recordChanges().values()) {
|
|
553
|
+
for (const change of changesInFile) {
|
|
554
|
+
rewriteFn(change.start, (_a = change.removeLength) != null ? _a : 0, change.text);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/after-render-phase/index.mjs
|
|
560
|
+
function after_render_phase_default() {
|
|
561
|
+
return (tree) => __async(this, null, function* () {
|
|
562
|
+
const { buildPaths, testPaths } = yield getProjectTsConfigPaths(tree);
|
|
563
|
+
const basePath = process.cwd();
|
|
564
|
+
const allPaths = [...buildPaths, ...testPaths];
|
|
565
|
+
if (!allPaths.length) {
|
|
566
|
+
throw new import_schematics.SchematicsException("Could not find any tsconfig file. Cannot run the afterRender phase migration.");
|
|
567
|
+
}
|
|
568
|
+
for (const tsconfigPath of allPaths) {
|
|
569
|
+
runMigration(tree, tsconfigPath, basePath);
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
function runMigration(tree, tsconfigPath, basePath) {
|
|
574
|
+
const program = createMigrationProgram(tree, tsconfigPath, basePath);
|
|
575
|
+
const sourceFiles = program.getSourceFiles().filter((sourceFile) => canMigrateFile(basePath, sourceFile, program));
|
|
576
|
+
for (const sourceFile of sourceFiles) {
|
|
577
|
+
let update = null;
|
|
578
|
+
const rewriter = (startPos, width, text) => {
|
|
579
|
+
if (update === null) {
|
|
580
|
+
update = tree.beginUpdate((0, import_path3.relative)(basePath, sourceFile.fileName));
|
|
581
|
+
}
|
|
582
|
+
update.remove(startPos, width);
|
|
583
|
+
if (text !== null) {
|
|
584
|
+
update.insertLeft(startPos, text);
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
migrateFile(sourceFile, program.getTypeChecker(), rewriter);
|
|
588
|
+
if (update !== null) {
|
|
589
|
+
tree.commitUpdate(update);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
594
|
+
0 && (module.exports = {});
|
|
595
|
+
/**
|
|
596
|
+
* @license
|
|
597
|
+
* Copyright Google LLC All Rights Reserved.
|
|
598
|
+
*
|
|
599
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
600
|
+
* found in the LICENSE file at https://angular.io/license
|
|
601
|
+
*/
|
|
602
|
+
//# sourceMappingURL=bundle.js.map
|