@angular/core 18.0.0-next.5 → 18.0.0-next.6
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/primitives/event-dispatch/contract_binary.mjs +10 -0
- package/esm2022/primitives/event-dispatch/index.mjs +13 -0
- package/esm2022/primitives/event-dispatch/src/a11y_click.mjs +54 -0
- package/esm2022/primitives/event-dispatch/src/accessibility.mjs +35 -0
- package/esm2022/primitives/event-dispatch/src/attribute.mjs +72 -0
- package/esm2022/primitives/event-dispatch/src/base_dispatcher.mjs +196 -0
- package/esm2022/primitives/event-dispatch/src/cache.mjs +95 -0
- package/esm2022/primitives/event-dispatch/src/char.mjs +35 -0
- package/esm2022/primitives/event-dispatch/src/custom_events.mjs +63 -0
- package/esm2022/primitives/event-dispatch/src/dispatcher.mjs +254 -0
- package/esm2022/primitives/event-dispatch/src/dom.mjs +48 -0
- package/esm2022/primitives/event-dispatch/src/earlyeventcontract.mjs +36 -0
- package/esm2022/primitives/event-dispatch/src/event.mjs +638 -0
- package/esm2022/primitives/event-dispatch/src/event_contract_container.mjs +63 -0
- package/esm2022/primitives/event-dispatch/src/event_contract_defines.mjs +48 -0
- package/esm2022/primitives/event-dispatch/src/event_contract_multi_container.mjs +192 -0
- package/esm2022/primitives/event-dispatch/src/event_handler.mjs +9 -0
- package/esm2022/primitives/event-dispatch/src/event_info.mjs +199 -0
- package/esm2022/primitives/event-dispatch/src/event_type.mjs +244 -0
- package/esm2022/primitives/event-dispatch/src/eventcontract.mjs +675 -0
- package/esm2022/primitives/event-dispatch/src/key_code.mjs +21 -0
- package/esm2022/primitives/event-dispatch/src/legacy_dispatcher.mjs +9 -0
- package/esm2022/primitives/event-dispatch/src/property.mjs +35 -0
- package/esm2022/primitives/event-dispatch/src/register_events.mjs +32 -0
- package/esm2022/primitives/event-dispatch/src/replay.mjs +389 -0
- package/esm2022/primitives/event-dispatch/src/restriction.mjs +15 -0
- package/esm2022/primitives/signals/index.mjs +3 -3
- package/esm2022/primitives/signals/src/computed.mjs +5 -3
- package/esm2022/primitives/signals/src/graph.mjs +14 -9
- package/esm2022/primitives/signals/src/signal.mjs +2 -2
- package/esm2022/primitives/signals/src/watch.mjs +2 -2
- package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +50 -5
- package/esm2022/src/core.mjs +2 -1
- package/esm2022/src/core_private_export.mjs +2 -1
- package/esm2022/src/defer/instructions.mjs +31 -8
- package/esm2022/src/di/host_tag_name_token.mjs +65 -0
- package/esm2022/src/di/index.mjs +2 -1
- package/esm2022/src/errors.mjs +1 -1
- package/esm2022/src/hydration/annotate.mjs +15 -1
- package/esm2022/src/hydration/event_replay.mjs +181 -0
- package/esm2022/src/hydration/tokens.mjs +6 -1
- package/esm2022/src/pending_tasks.mjs +54 -11
- package/esm2022/src/render3/component_ref.mjs +1 -1
- package/esm2022/src/render3/context_discovery.mjs +15 -1
- package/esm2022/src/render3/instructions/control_flow.mjs +50 -3
- package/esm2022/src/render3/list_reconciliation.mjs +41 -1
- package/esm2022/src/util/callback_scheduler.mjs +13 -2
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/src/zone/ng_zone.mjs +22 -6
- package/esm2022/testing/src/async.mjs +2 -10
- package/esm2022/testing/src/defer.mjs +1 -2
- package/esm2022/testing/src/logger.mjs +3 -3
- package/event-dispatch-contract.min.js +1 -1
- package/fesm2022/core.mjs +516 -39
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +3044 -0
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -0
- package/fesm2022/primitives/signals.mjs +17 -10
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +3 -12
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +75 -13
- package/package.json +7 -1
- package/primitives/event-dispatch/index.d.ts +627 -0
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/migrations/{transfer-state → http-providers}/bundle.js +254 -68
- package/schematics/migrations/http-providers/bundle.js.map +7 -0
- package/schematics/migrations/invalid-two-way-bindings/bundle.js +659 -337
- package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +2 -2
- package/schematics/migrations.json +6 -16
- package/schematics/ng-generate/control-flow-migration/bundle.js +667 -345
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +2 -2
- package/schematics/ng-generate/standalone-migration/bundle.js +1030 -660
- package/schematics/ng-generate/standalone-migration/bundle.js.map +2 -2
- package/testing/index.d.ts +2 -9
- package/schematics/migrations/block-template-entities/bundle.js +0 -22808
- package/schematics/migrations/block-template-entities/bundle.js.map +0 -7
- package/schematics/migrations/compiler-options/bundle.js +0 -582
- package/schematics/migrations/compiler-options/bundle.js.map +0 -7
- package/schematics/migrations/transfer-state/bundle.js.map +0 -7
|
@@ -1,582 +0,0 @@
|
|
|
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/compiler-options/index.mjs
|
|
64
|
-
var compiler_options_exports = {};
|
|
65
|
-
__export(compiler_options_exports, {
|
|
66
|
-
default: () => compiler_options_default
|
|
67
|
-
});
|
|
68
|
-
module.exports = __toCommonJS(compiler_options_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/compiler-options/util.mjs
|
|
207
|
-
var import_typescript7 = __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(), { 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/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/imports.mjs
|
|
456
|
-
var import_typescript5 = __toESM(require("typescript"), 1);
|
|
457
|
-
function getImportSpecifier(sourceFile, moduleName, specifierName) {
|
|
458
|
-
var _a;
|
|
459
|
-
return (_a = getImportSpecifiers(sourceFile, moduleName, [specifierName])[0]) != null ? _a : null;
|
|
460
|
-
}
|
|
461
|
-
function getImportSpecifiers(sourceFile, moduleName, specifierNames) {
|
|
462
|
-
var _a;
|
|
463
|
-
const matches = [];
|
|
464
|
-
for (const node of sourceFile.statements) {
|
|
465
|
-
if (import_typescript5.default.isImportDeclaration(node) && import_typescript5.default.isStringLiteral(node.moduleSpecifier)) {
|
|
466
|
-
const isMatch = typeof moduleName === "string" ? node.moduleSpecifier.text === moduleName : moduleName.test(node.moduleSpecifier.text);
|
|
467
|
-
const namedBindings = (_a = node.importClause) == null ? void 0 : _a.namedBindings;
|
|
468
|
-
if (isMatch && namedBindings && import_typescript5.default.isNamedImports(namedBindings)) {
|
|
469
|
-
for (const specifierName of specifierNames) {
|
|
470
|
-
const match = findImportSpecifier(namedBindings.elements, specifierName);
|
|
471
|
-
if (match) {
|
|
472
|
-
matches.push(match);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
return matches;
|
|
479
|
-
}
|
|
480
|
-
function findImportSpecifier(nodes, specifierName) {
|
|
481
|
-
return nodes.find((element) => {
|
|
482
|
-
const { name, propertyName } = element;
|
|
483
|
-
return propertyName ? propertyName.text === specifierName : name.text === specifierName;
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/nodes.mjs
|
|
488
|
-
var import_typescript6 = __toESM(require("typescript"), 1);
|
|
489
|
-
function closestNode(node, predicate) {
|
|
490
|
-
let current = node.parent;
|
|
491
|
-
while (current && !import_typescript6.default.isSourceFile(current)) {
|
|
492
|
-
if (predicate(current)) {
|
|
493
|
-
return current;
|
|
494
|
-
}
|
|
495
|
-
current = current.parent;
|
|
496
|
-
}
|
|
497
|
-
return null;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/compiler-options/util.mjs
|
|
501
|
-
var coreModule = "@angular/core";
|
|
502
|
-
var compilerOptionsType = "CompilerOptions";
|
|
503
|
-
var deletedIdentifiers = /* @__PURE__ */ new Set(["useJit", "missingTranslation"]);
|
|
504
|
-
function migrateFile(sourceFile, rewriteFn) {
|
|
505
|
-
var _a;
|
|
506
|
-
const compilerOptionsImport = getImportSpecifier(sourceFile, coreModule, compilerOptionsType);
|
|
507
|
-
if (compilerOptionsImport === null) {
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
const changeTracker = new ChangeTracker(import_typescript7.default.createPrinter());
|
|
511
|
-
removeIdentifiers(sourceFile, changeTracker);
|
|
512
|
-
for (const changesInFile of changeTracker.recordChanges().values()) {
|
|
513
|
-
for (const change of changesInFile) {
|
|
514
|
-
rewriteFn(change.start, (_a = change.removeLength) != null ? _a : 0, change.text);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
function removeIdentifiers(sourceFile, changeTracker) {
|
|
519
|
-
const missingTranslationStrategyImport = getImportSpecifier(sourceFile, coreModule, "MissingTranslationStrategy");
|
|
520
|
-
const namedImports = missingTranslationStrategyImport ? closestNode(missingTranslationStrategyImport, import_typescript7.default.isNamedImports) : null;
|
|
521
|
-
const visitNode = (node) => {
|
|
522
|
-
var _a;
|
|
523
|
-
if (import_typescript7.default.isVariableDeclaration(node) && ((_a = node.type) == null ? void 0 : _a.getText()) !== compilerOptionsType) {
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
if (import_typescript7.default.isIdentifier(node) && deletedIdentifiers.has(node.text)) {
|
|
527
|
-
changeTracker.removeNode(node.parent);
|
|
528
|
-
if (node.text === "missingTranslation") {
|
|
529
|
-
if (namedImports && missingTranslationStrategyImport) {
|
|
530
|
-
changeTracker.removeNode(missingTranslationStrategyImport);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
import_typescript7.default.forEachChild(node, visitNode);
|
|
535
|
-
};
|
|
536
|
-
import_typescript7.default.forEachChild(sourceFile, visitNode);
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/compiler-options/index.mjs
|
|
540
|
-
function compiler_options_default() {
|
|
541
|
-
return (tree) => __async(this, null, function* () {
|
|
542
|
-
const { buildPaths, testPaths } = yield getProjectTsConfigPaths(tree);
|
|
543
|
-
const basePath = process.cwd();
|
|
544
|
-
const allPaths = [...buildPaths, ...testPaths];
|
|
545
|
-
if (!allPaths.length) {
|
|
546
|
-
throw new import_schematics.SchematicsException("Could not find any tsconfig file. Cannot run the guard and resolve interfaces migration.");
|
|
547
|
-
}
|
|
548
|
-
for (const tsconfigPath of allPaths) {
|
|
549
|
-
runGuardAndResolveInterfacesMigration(tree, tsconfigPath, basePath);
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
function runGuardAndResolveInterfacesMigration(tree, tsconfigPath, basePath) {
|
|
554
|
-
const program = createMigrationProgram(tree, tsconfigPath, basePath);
|
|
555
|
-
const sourceFiles = program.getSourceFiles().filter((sourceFile) => canMigrateFile(basePath, sourceFile, program));
|
|
556
|
-
for (const sourceFile of sourceFiles) {
|
|
557
|
-
let update = null;
|
|
558
|
-
const rewriter = (startPos, width, text) => {
|
|
559
|
-
if (update === null) {
|
|
560
|
-
update = tree.beginUpdate((0, import_path3.relative)(basePath, sourceFile.fileName));
|
|
561
|
-
}
|
|
562
|
-
update.remove(startPos, width);
|
|
563
|
-
if (text !== null) {
|
|
564
|
-
update.insertLeft(startPos, text);
|
|
565
|
-
}
|
|
566
|
-
};
|
|
567
|
-
migrateFile(sourceFile, rewriter);
|
|
568
|
-
if (update !== null) {
|
|
569
|
-
tree.commitUpdate(update);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
574
|
-
0 && (module.exports = {});
|
|
575
|
-
/**
|
|
576
|
-
* @license
|
|
577
|
-
* Copyright Google LLC All Rights Reserved.
|
|
578
|
-
*
|
|
579
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
580
|
-
* found in the LICENSE file at https://angular.io/license
|
|
581
|
-
*/
|
|
582
|
-
//# sourceMappingURL=bundle.js.map
|