@angular/core 15.1.0-next.3 → 15.1.0-rc.0

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 (74) hide show
  1. package/esm2020/src/application_ref.mjs +2 -2
  2. package/esm2020/src/di/injector_compatibility.mjs +2 -2
  3. package/esm2020/src/errors.mjs +1 -1
  4. package/esm2020/src/linker/view_ref.mjs +1 -1
  5. package/esm2020/src/render3/i18n/i18n_parse.mjs +17 -2
  6. package/esm2020/src/util/global.mjs +1 -1
  7. package/esm2020/src/version.mjs +1 -1
  8. package/esm2020/testing/src/component_fixture.mjs +1 -1
  9. package/esm2020/testing/src/logger.mjs +7 -7
  10. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  11. package/fesm2015/core.mjs +101 -1558
  12. package/fesm2015/core.mjs.map +1 -1
  13. package/fesm2015/testing.mjs +78 -1333
  14. package/fesm2015/testing.mjs.map +1 -1
  15. package/fesm2020/core.mjs +103 -1582
  16. package/fesm2020/core.mjs.map +1 -1
  17. package/fesm2020/testing.mjs +80 -1357
  18. package/fesm2020/testing.mjs.map +1 -1
  19. package/index.d.ts +3 -3
  20. package/package.json +1 -1
  21. package/schematics/migrations/relative-link-resolution/bundle.js +265 -0
  22. package/schematics/migrations/relative-link-resolution/bundle.js.map +7 -0
  23. package/schematics/migrations/relative-link-resolution/bundle_metadata.json +1 -0
  24. package/schematics/migrations/router-link-with-href/bundle.js +350 -0
  25. package/schematics/migrations/router-link-with-href/bundle.js.map +7 -0
  26. package/schematics/migrations/router-link-with-href/bundle_metadata.json +1 -0
  27. package/schematics/migrations.json +2 -2
  28. package/testing/index.d.ts +1 -1
  29. package/esm2020/src/render3/util/debug_utils.mjs +0 -40
  30. package/esm2020/testing/src/lang_utils.mjs +0 -14
  31. package/schematics/migrations/relative-link-resolution/index.d.ts +0 -10
  32. package/schematics/migrations/relative-link-resolution/index.js +0 -68
  33. package/schematics/migrations/relative-link-resolution/util.d.ts +0 -20
  34. package/schematics/migrations/relative-link-resolution/util.js +0 -82
  35. package/schematics/migrations/router-link-with-href/index.d.ts +0 -10
  36. package/schematics/migrations/router-link-with-href/index.js +0 -70
  37. package/schematics/migrations/router-link-with-href/util.d.ts +0 -19
  38. package/schematics/migrations/router-link-with-href/util.js +0 -111
  39. package/schematics/utils/import_manager.d.ts +0 -57
  40. package/schematics/utils/import_manager.js +0 -234
  41. package/schematics/utils/line_mappings.d.ts +0 -18
  42. package/schematics/utils/line_mappings.js +0 -75
  43. package/schematics/utils/load_esm.d.ts +0 -32
  44. package/schematics/utils/load_esm.js +0 -79
  45. package/schematics/utils/ng_component_template.d.ts +0 -44
  46. package/schematics/utils/ng_component_template.js +0 -131
  47. package/schematics/utils/ng_decorators.d.ts +0 -23
  48. package/schematics/utils/ng_decorators.js +0 -37
  49. package/schematics/utils/parse_html.d.ts +0 -14
  50. package/schematics/utils/parse_html.js +0 -37
  51. package/schematics/utils/project_tsconfig_paths.d.ts +0 -17
  52. package/schematics/utils/project_tsconfig_paths.js +0 -122
  53. package/schematics/utils/template_ast_visitor.d.ts +0 -55
  54. package/schematics/utils/template_ast_visitor.js +0 -73
  55. package/schematics/utils/typescript/class_declaration.d.ts +0 -15
  56. package/schematics/utils/typescript/class_declaration.js +0 -52
  57. package/schematics/utils/typescript/compiler_host.d.ts +0 -34
  58. package/schematics/utils/typescript/compiler_host.js +0 -85
  59. package/schematics/utils/typescript/decorators.d.ts +0 -11
  60. package/schematics/utils/typescript/decorators.js +0 -37
  61. package/schematics/utils/typescript/find_base_classes.d.ts +0 -14
  62. package/schematics/utils/typescript/find_base_classes.js +0 -47
  63. package/schematics/utils/typescript/functions.d.ts +0 -17
  64. package/schematics/utils/typescript/functions.js +0 -46
  65. package/schematics/utils/typescript/imports.d.ts +0 -53
  66. package/schematics/utils/typescript/imports.js +0 -128
  67. package/schematics/utils/typescript/nodes.d.ts +0 -20
  68. package/schematics/utils/typescript/nodes.js +0 -77
  69. package/schematics/utils/typescript/parse_tsconfig.d.ts +0 -10
  70. package/schematics/utils/typescript/parse_tsconfig.js +0 -66
  71. package/schematics/utils/typescript/property_name.d.ts +0 -19
  72. package/schematics/utils/typescript/property_name.js +0 -41
  73. package/schematics/utils/typescript/symbol.d.ts +0 -19
  74. package/schematics/utils/typescript/symbol.js +0 -93
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.1.0-next.3
2
+ * @license Angular v15.1.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -7155,7 +7155,7 @@ declare const enum RuntimeErrorCode {
7155
7155
  MULTIPLE_PLATFORMS = 400,
7156
7156
  PLATFORM_NOT_FOUND = 401,
7157
7157
  ERROR_HANDLER_NOT_FOUND = 402,
7158
- BOOTSTRAP_COMPONENTS_NOT_FOUND = 403,
7158
+ BOOTSTRAP_COMPONENTS_NOT_FOUND = -403,
7159
7159
  PLATFORM_ALREADY_DESTROYED = 404,
7160
7160
  ASYNC_INITIALIZERS_STILL_RUNNING = 405,
7161
7161
  APPLICATION_REF_ALREADY_DESTROYED = 406,
@@ -9462,7 +9462,7 @@ export declare abstract class ViewRef extends ChangeDetectorRef {
9462
9462
  * @param callback A handler function that cleans up developer-defined data
9463
9463
  * associated with a view. Called when the `destroy()` method is invoked.
9464
9464
  */
9465
- abstract onDestroy(callback: Function): any /** TODO #9100 */;
9465
+ abstract onDestroy(callback: Function): any /** TODO #9100, replace by void in a major release*/;
9466
9466
  }
9467
9467
 
9468
9468
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "15.1.0-next.3",
3
+ "version": "15.1.0-rc.0",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -0,0 +1,265 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var __async = (__this, __arguments, generator) => {
25
+ return new Promise((resolve2, reject) => {
26
+ var fulfilled = (value) => {
27
+ try {
28
+ step(generator.next(value));
29
+ } catch (e) {
30
+ reject(e);
31
+ }
32
+ };
33
+ var rejected = (value) => {
34
+ try {
35
+ step(generator.throw(value));
36
+ } catch (e) {
37
+ reject(e);
38
+ }
39
+ };
40
+ var step = (x) => x.done ? resolve2(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
41
+ step((generator = generator.apply(__this, __arguments)).next());
42
+ });
43
+ };
44
+
45
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/relative-link-resolution/index.mjs
46
+ var relative_link_resolution_exports = {};
47
+ __export(relative_link_resolution_exports, {
48
+ default: () => relative_link_resolution_default
49
+ });
50
+ module.exports = __toCommonJS(relative_link_resolution_exports);
51
+ var import_schematics = require("@angular-devkit/schematics");
52
+ var import_path2 = require("path");
53
+
54
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs
55
+ var import_core = require("@angular-devkit/core");
56
+ function getProjectTsConfigPaths(tree) {
57
+ return __async(this, null, function* () {
58
+ const buildPaths = /* @__PURE__ */ new Set();
59
+ const testPaths = /* @__PURE__ */ new Set();
60
+ const workspace = yield getWorkspace(tree);
61
+ for (const [, project] of workspace.projects) {
62
+ for (const [name, target] of project.targets) {
63
+ if (name !== "build" && name !== "test") {
64
+ continue;
65
+ }
66
+ for (const [, options] of allTargetOptions(target)) {
67
+ const tsConfig = options.tsConfig;
68
+ if (typeof tsConfig !== "string" || !tree.exists(tsConfig)) {
69
+ continue;
70
+ }
71
+ if (name === "build") {
72
+ buildPaths.add((0, import_core.normalize)(tsConfig));
73
+ } else {
74
+ testPaths.add((0, import_core.normalize)(tsConfig));
75
+ }
76
+ }
77
+ }
78
+ }
79
+ return {
80
+ buildPaths: [...buildPaths],
81
+ testPaths: [...testPaths]
82
+ };
83
+ });
84
+ }
85
+ function* allTargetOptions(target) {
86
+ if (target.options) {
87
+ yield [void 0, target.options];
88
+ }
89
+ if (!target.configurations) {
90
+ return;
91
+ }
92
+ for (const [name, options] of Object.entries(target.configurations)) {
93
+ if (options) {
94
+ yield [name, options];
95
+ }
96
+ }
97
+ }
98
+ function createHost(tree) {
99
+ return {
100
+ readFile(path2) {
101
+ return __async(this, null, function* () {
102
+ const data = tree.read(path2);
103
+ if (!data) {
104
+ throw new Error("File not found.");
105
+ }
106
+ return import_core.virtualFs.fileBufferToString(data);
107
+ });
108
+ },
109
+ writeFile(path2, data) {
110
+ return __async(this, null, function* () {
111
+ return tree.overwrite(path2, data);
112
+ });
113
+ },
114
+ isDirectory(path2) {
115
+ return __async(this, null, function* () {
116
+ return !tree.exists(path2) && tree.getDir(path2).subfiles.length > 0;
117
+ });
118
+ },
119
+ isFile(path2) {
120
+ return __async(this, null, function* () {
121
+ return tree.exists(path2);
122
+ });
123
+ }
124
+ };
125
+ }
126
+ function getWorkspace(tree) {
127
+ return __async(this, null, function* () {
128
+ const host = createHost(tree);
129
+ const { workspace } = yield import_core.workspaces.readWorkspace("/", host);
130
+ return workspace;
131
+ });
132
+ }
133
+
134
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
135
+ var import_path = require("path");
136
+ var import_typescript2 = __toESM(require("typescript"), 1);
137
+
138
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
139
+ var path = __toESM(require("path"), 1);
140
+ var import_typescript = __toESM(require("typescript"), 1);
141
+ function parseTsconfigFile(tsconfigPath, basePath) {
142
+ const { config } = import_typescript.default.readConfigFile(tsconfigPath, import_typescript.default.sys.readFile);
143
+ const parseConfigHost = {
144
+ useCaseSensitiveFileNames: import_typescript.default.sys.useCaseSensitiveFileNames,
145
+ fileExists: import_typescript.default.sys.fileExists,
146
+ readDirectory: import_typescript.default.sys.readDirectory,
147
+ readFile: import_typescript.default.sys.readFile
148
+ };
149
+ if (!path.isAbsolute(basePath)) {
150
+ throw Error("Unexpected relative base path has been specified.");
151
+ }
152
+ return import_typescript.default.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
153
+ }
154
+
155
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
156
+ function createMigrationProgram(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles) {
157
+ tsconfigPath = (0, import_path.resolve)(basePath, tsconfigPath);
158
+ const parsed = parseTsconfigFile(tsconfigPath, (0, import_path.dirname)(tsconfigPath));
159
+ const host = createMigrationCompilerHost(tree, parsed.options, basePath, fakeFileRead);
160
+ const program = import_typescript2.default.createProgram(parsed.fileNames.concat(additionalFiles || []), parsed.options, host);
161
+ return { parsed, host, program };
162
+ }
163
+ function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
164
+ const host = import_typescript2.default.createCompilerHost(options, true);
165
+ const defaultReadFile = host.readFile;
166
+ host.readFile = (fileName) => {
167
+ var _a;
168
+ const treeRelativePath = (0, import_path.relative)(basePath, fileName);
169
+ let result = fakeRead == null ? void 0 : fakeRead(treeRelativePath);
170
+ if (result === void 0) {
171
+ result = treeRelativePath.startsWith("..") ? defaultReadFile.call(host, fileName) : (_a = tree.read(treeRelativePath)) == null ? void 0 : _a.toString();
172
+ }
173
+ return result ? result.replace(/^\uFEFF/, "") : void 0;
174
+ };
175
+ return host;
176
+ }
177
+ function canMigrateFile(basePath, sourceFile, program) {
178
+ if (sourceFile.isDeclarationFile || program.isSourceFileFromExternalLibrary(sourceFile)) {
179
+ return false;
180
+ }
181
+ return !(0, import_path.relative)(basePath, sourceFile.fileName).startsWith("..");
182
+ }
183
+
184
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/relative-link-resolution/util.mjs
185
+ var import_typescript3 = __toESM(require("typescript"), 1);
186
+ var relativeLinkResolution = "relativeLinkResolution";
187
+ var knownConfigValues = /* @__PURE__ */ new Set([`'legacy'`, `'corrected'`]);
188
+ function migrateFile(sourceFile, rewriteFn) {
189
+ let rewrites = [];
190
+ const usages = getUsages(sourceFile);
191
+ for (const { objectLiteral, property } of usages) {
192
+ const replacementNode = import_typescript3.default.factory.updateObjectLiteralExpression(objectLiteral, objectLiteral.properties.filter((prop) => prop !== property));
193
+ const printer = import_typescript3.default.createPrinter();
194
+ const replacementText = printer.printNode(import_typescript3.default.EmitHint.Unspecified, replacementNode, sourceFile);
195
+ rewrites.push({
196
+ startPos: objectLiteral.getStart(),
197
+ width: objectLiteral.getWidth(),
198
+ replacement: replacementText
199
+ });
200
+ }
201
+ rewrites = sortByStartPosDescending(rewrites);
202
+ for (const rewrite of rewrites) {
203
+ rewriteFn(rewrite.startPos, rewrite.width, rewrite.replacement);
204
+ }
205
+ }
206
+ function getUsages(sourceFile) {
207
+ const usages = [];
208
+ const visitNode = (node) => {
209
+ if (import_typescript3.default.isObjectLiteralExpression(node)) {
210
+ const property = node.properties.find((prop) => import_typescript3.default.isPropertyAssignment(prop) && import_typescript3.default.isIdentifier(prop.name) && prop.name.text === relativeLinkResolution && knownConfigValues.has(prop.initializer.getText()));
211
+ if (property) {
212
+ usages.push({ objectLiteral: node, property });
213
+ }
214
+ }
215
+ import_typescript3.default.forEachChild(node, visitNode);
216
+ };
217
+ import_typescript3.default.forEachChild(sourceFile, visitNode);
218
+ return usages;
219
+ }
220
+ function sortByStartPosDescending(rewrites) {
221
+ return rewrites.sort((entityA, entityB) => entityB.startPos - entityA.startPos);
222
+ }
223
+
224
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/relative-link-resolution/index.mjs
225
+ function relative_link_resolution_default() {
226
+ return (tree) => __async(this, null, function* () {
227
+ const { buildPaths, testPaths } = yield getProjectTsConfigPaths(tree);
228
+ const basePath = process.cwd();
229
+ const allPaths = [...buildPaths, ...testPaths];
230
+ if (!allPaths.length) {
231
+ throw new import_schematics.SchematicsException("Could not find any tsconfig file. Cannot run a migration to cleanup the deprecated `relativeLinkResolution` config option.");
232
+ }
233
+ for (const tsconfigPath of allPaths) {
234
+ runRelativeLinkResolutionMigration(tree, tsconfigPath, basePath);
235
+ }
236
+ });
237
+ }
238
+ function runRelativeLinkResolutionMigration(tree, tsconfigPath, basePath) {
239
+ const { program } = createMigrationProgram(tree, tsconfigPath, basePath);
240
+ const sourceFiles = program.getSourceFiles().filter((sourceFile) => canMigrateFile(basePath, sourceFile, program));
241
+ for (const sourceFile of sourceFiles) {
242
+ let update = null;
243
+ const rewriter = (startPos, origLength, text) => {
244
+ if (update === null) {
245
+ update = tree.beginUpdate((0, import_path2.relative)(basePath, sourceFile.fileName));
246
+ }
247
+ update.remove(startPos, origLength);
248
+ update.insertLeft(startPos, text);
249
+ };
250
+ migrateFile(sourceFile, rewriter);
251
+ if (update !== null) {
252
+ tree.commitUpdate(update);
253
+ }
254
+ }
255
+ }
256
+ // Annotate the CommonJS export names for ESM import in node:
257
+ 0 && (module.exports = {});
258
+ /**
259
+ * @license
260
+ * Copyright Google LLC All Rights Reserved.
261
+ *
262
+ * Use of this source code is governed by an MIT-style license that can be
263
+ * found in the LICENSE file at https://angular.io/license
264
+ */
265
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../packages/core/schematics/migrations/relative-link-resolution/index.ts", "../../../../../../../../packages/core/schematics/utils/project_tsconfig_paths.ts", "../../../../../../../../packages/core/schematics/utils/typescript/compiler_host.ts", "../../../../../../../../packages/core/schematics/utils/typescript/parse_tsconfig.ts", "../../../../../../../../packages/core/schematics/migrations/relative-link-resolution/util.ts"],
4
+ "sourcesContent": ["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Rule, SchematicsException, Tree, UpdateRecorder} from '@angular-devkit/schematics';\nimport {relative} from 'path';\n\nimport {getProjectTsConfigPaths} from '../../utils/project_tsconfig_paths';\nimport {canMigrateFile, createMigrationProgram} from '../../utils/typescript/compiler_host';\n\nimport {migrateFile} from './util';\n\nexport default function(): Rule {\n return async (tree: Tree) => {\n const {buildPaths, testPaths} = await getProjectTsConfigPaths(tree);\n const basePath = process.cwd();\n const allPaths = [...buildPaths, ...testPaths];\n\n if (!allPaths.length) {\n throw new SchematicsException(\n 'Could not find any tsconfig file. ' +\n 'Cannot run a migration to cleanup the deprecated `relativeLinkResolution` config option.');\n }\n\n for (const tsconfigPath of allPaths) {\n runRelativeLinkResolutionMigration(tree, tsconfigPath, basePath);\n }\n };\n}\n\nfunction runRelativeLinkResolutionMigration(tree: Tree, tsconfigPath: string, basePath: string) {\n const {program} = createMigrationProgram(tree, tsconfigPath, basePath);\n const sourceFiles =\n program.getSourceFiles().filter(sourceFile => canMigrateFile(basePath, sourceFile, program));\n\n for (const sourceFile of sourceFiles) {\n let update: UpdateRecorder|null = null;\n\n const rewriter = (startPos: number, origLength: number, text: string) => {\n if (update === null) {\n // Lazily initialize update, because most files will not require migration.\n update = tree.beginUpdate(relative(basePath, sourceFile.fileName));\n }\n update.remove(startPos, origLength);\n update.insertLeft(startPos, text);\n };\n\n migrateFile(sourceFile, rewriter);\n\n if (update !== null) {\n tree.commitUpdate(update);\n }\n }\n}\n", "/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {json, normalize, virtualFs, workspaces} from '@angular-devkit/core';\nimport {Tree} from '@angular-devkit/schematics';\n\n/**\n * Gets all tsconfig paths from a CLI project by reading the workspace configuration\n * and looking for common tsconfig locations.\n */\nexport async function getProjectTsConfigPaths(tree: Tree):\n Promise<{buildPaths: string[]; testPaths: string[];}> {\n // Start with some tsconfig paths that are generally used within CLI projects. Note\n // that we are not interested in IDE-specific tsconfig files (e.g. /tsconfig.json)\n const buildPaths = new Set<string>();\n const testPaths = new Set<string>();\n\n const workspace = await getWorkspace(tree);\n for (const [, project] of workspace.projects) {\n for (const [name, target] of project.targets) {\n if (name !== 'build' && name !== 'test') {\n continue;\n }\n\n for (const [, options] of allTargetOptions(target)) {\n const tsConfig = options.tsConfig;\n // Filter out tsconfig files that don't exist in the CLI project.\n if (typeof tsConfig !== 'string' || !tree.exists(tsConfig)) {\n continue;\n }\n\n if (name === 'build') {\n buildPaths.add(normalize(tsConfig));\n } else {\n testPaths.add(normalize(tsConfig));\n }\n }\n }\n }\n\n return {\n buildPaths: [...buildPaths],\n testPaths: [...testPaths],\n };\n}\n\n/** Get options for all configurations for the passed builder target. */\nfunction*\n allTargetOptions(target: workspaces.TargetDefinition):\n Iterable<[string | undefined, Record<string, json.JsonValue|undefined>]> {\n if (target.options) {\n yield [undefined, target.options];\n }\n\n if (!target.configurations) {\n return;\n }\n\n for (const [name, options] of Object.entries(target.configurations)) {\n if (options) {\n yield [name, options];\n }\n }\n}\n\nfunction createHost(tree: Tree): workspaces.WorkspaceHost {\n return {\n async readFile(path: string): Promise<string> {\n const data = tree.read(path);\n if (!data) {\n throw new Error('File not found.');\n }\n\n return virtualFs.fileBufferToString(data);\n },\n async writeFile(path: string, data: string): Promise<void> {\n return tree.overwrite(path, data);\n },\n async isDirectory(path: string): Promise<boolean> {\n // Approximate a directory check.\n // We don't need to consider empty directories and hence this is a good enough approach.\n // This is also per documentation, see:\n // https://angular.io/guide/schematics-for-libraries#get-the-project-configuration\n return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;\n },\n async isFile(path: string): Promise<boolean> {\n return tree.exists(path);\n },\n };\n}\n\nasync function getWorkspace(tree: Tree): Promise<workspaces.WorkspaceDefinition> {\n const host = createHost(tree);\n const {workspace} = await workspaces.readWorkspace('/', host);\n\n return workspace;\n}\n", "/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Tree} from '@angular-devkit/schematics';\nimport {dirname, relative, resolve} from 'path';\nimport ts from 'typescript';\nimport {parseTsconfigFile} from './parse_tsconfig';\n\nexport type FakeReadFileFn = (fileName: string) => string|undefined;\n\n/**\n * Creates a TypeScript program instance for a TypeScript project within\n * the virtual file system tree.\n * @param tree Virtual file system tree that contains the source files.\n * @param tsconfigPath Virtual file system path that resolves to the TypeScript project.\n * @param basePath Base path for the virtual file system tree.\n * @param fakeFileRead Optional file reader function. Can be used to overwrite files in\n * the TypeScript program, or to add in-memory files (e.g. to add global types).\n * @param additionalFiles Additional file paths that should be added to the program.\n */\nexport function createMigrationProgram(\n tree: Tree, tsconfigPath: string, basePath: string, fakeFileRead?: FakeReadFileFn,\n additionalFiles?: string[]) {\n // Resolve the tsconfig path to an absolute path. This is needed as TypeScript otherwise\n // is not able to resolve root directories in the given tsconfig. More details can be found\n // in the following issue: https://github.com/microsoft/TypeScript/issues/37731.\n tsconfigPath = resolve(basePath, tsconfigPath);\n const parsed = parseTsconfigFile(tsconfigPath, dirname(tsconfigPath));\n const host = createMigrationCompilerHost(tree, parsed.options, basePath, fakeFileRead);\n const program =\n ts.createProgram(parsed.fileNames.concat(additionalFiles || []), parsed.options, host);\n return {parsed, host, program};\n}\n\nexport function createMigrationCompilerHost(\n tree: Tree, options: ts.CompilerOptions, basePath: string,\n fakeRead?: FakeReadFileFn): ts.CompilerHost {\n const host = ts.createCompilerHost(options, true);\n const defaultReadFile = host.readFile;\n\n // We need to overwrite the host \"readFile\" method, as we want the TypeScript\n // program to be based on the file contents in the virtual file tree. Otherwise\n // if we run multiple migrations we might have intersecting changes and\n // source files.\n host.readFile = fileName => {\n const treeRelativePath = relative(basePath, fileName);\n let result: string|undefined = fakeRead?.(treeRelativePath);\n\n if (result === undefined) {\n // If the relative path resolved to somewhere outside of the tree, fall back to\n // TypeScript's default file reading function since the `tree` will throw an error.\n result = treeRelativePath.startsWith('..') ? defaultReadFile.call(host, fileName) :\n tree.read(treeRelativePath)?.toString();\n }\n\n // Strip BOM as otherwise TSC methods (Ex: getWidth) will return an offset,\n // which breaks the CLI UpdateRecorder.\n // See: https://github.com/angular/angular/pull/30719\n return result ? result.replace(/^\\uFEFF/, '') : undefined;\n };\n\n return host;\n}\n\n/**\n * Checks whether a file can be migrate by our automated migrations.\n * @param basePath Absolute path to the project.\n * @param sourceFile File being checked.\n * @param program Program that includes the source file.\n */\nexport function canMigrateFile(\n basePath: string, sourceFile: ts.SourceFile, program: ts.Program): boolean {\n // We shouldn't migrate .d.ts files or files from an external library.\n if (sourceFile.isDeclarationFile || program.isSourceFileFromExternalLibrary(sourceFile)) {\n return false;\n }\n\n // Our migrations are set up to create a `Program` from the project's tsconfig and to migrate all\n // the files within the program. This can include files that are outside of the Angular CLI\n // project. We can't migrate files outside of the project, because our file system interactions\n // go through the CLI's `Tree` which assumes that all files are within the project. See:\n // https://github.com/angular/angular-cli/blob/0b0961c9c233a825b6e4bb59ab7f0790f9b14676/packages/angular_devkit/schematics/src/tree/host-tree.ts#L131\n return !relative(basePath, sourceFile.fileName).startsWith('..');\n}\n", "/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport * as path from 'path';\nimport ts from 'typescript';\n\nexport function parseTsconfigFile(tsconfigPath: string, basePath: string): ts.ParsedCommandLine {\n const {config} = ts.readConfigFile(tsconfigPath, ts.sys.readFile);\n const parseConfigHost = {\n useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,\n fileExists: ts.sys.fileExists,\n readDirectory: ts.sys.readDirectory,\n readFile: ts.sys.readFile,\n };\n\n // Throw if incorrect arguments are passed to this function. Passing relative base paths\n // results in root directories not being resolved and in later type checking runtime errors.\n // More details can be found here: https://github.com/microsoft/TypeScript/issues/37731.\n if (!path.isAbsolute(basePath)) {\n throw Error('Unexpected relative base path has been specified.');\n }\n\n return ts.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});\n}\n", "/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport ts from 'typescript';\n\nconst relativeLinkResolution = 'relativeLinkResolution';\nconst knownConfigValues = new Set([`'legacy'`, `'corrected'`]);\n\nexport interface RewriteEntity {\n startPos: number;\n width: number;\n replacement: string;\n}\n\nexport interface MigratableNode {\n objectLiteral: ts.ObjectLiteralExpression;\n property: ts.ObjectLiteralElementLike;\n}\n\nexport type RewriteFn = (startPos: number, origLength: number, text: string) => void;\n\nexport function migrateFile(sourceFile: ts.SourceFile, rewriteFn: RewriteFn) {\n let rewrites: RewriteEntity[] = [];\n const usages = getUsages(sourceFile);\n for (const {objectLiteral, property} of usages) {\n const replacementNode = ts.factory.updateObjectLiteralExpression(\n objectLiteral, objectLiteral.properties.filter(prop => prop !== property));\n const printer = ts.createPrinter();\n const replacementText = printer.printNode(ts.EmitHint.Unspecified, replacementNode, sourceFile);\n rewrites.push({\n startPos: objectLiteral.getStart(),\n width: objectLiteral.getWidth(),\n replacement: replacementText,\n });\n }\n\n // Process rewrites last-to-first (based on start pos) to avoid offset shifts during rewrites.\n rewrites = sortByStartPosDescending(rewrites);\n for (const rewrite of rewrites) {\n rewriteFn(rewrite.startPos, rewrite.width, rewrite.replacement);\n }\n}\n\nfunction getUsages(sourceFile: ts.SourceFile): MigratableNode[] {\n const usages: MigratableNode[] = [];\n const visitNode = (node: ts.Node) => {\n if (ts.isObjectLiteralExpression(node)) {\n // Look for patterns like the following:\n // ```\n // { ... relativeLinkResolution: 'legacy', ... }\n // ```\n // or:\n // ```\n // { ... relativeLinkResolution: 'corrected', ... }\n // ```\n // If the value is unknown (i.e. not 'legacy' or 'corrected'),\n // do not attempt to rewrite (this might be an application-specific\n // configuration, not a part of Router).\n const property = node.properties.find(\n prop => ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) &&\n prop.name.text === relativeLinkResolution &&\n knownConfigValues.has(prop.initializer.getText()));\n if (property) {\n usages.push({objectLiteral: node, property});\n }\n }\n ts.forEachChild(node, visitNode);\n };\n ts.forEachChild(sourceFile, visitNode);\n return usages;\n}\n\n/**\n * Sort all found usages based on their start positions in the source file in descending order (i.e.\n * last usage goes first on the list, etc). This is needed to avoid shifting offsets in the source\n * file (in case there are multiple usages) as we rewrite symbols.\n */\nfunction sortByStartPosDescending(rewrites: RewriteEntity[]): RewriteEntity[] {\n return rewrites.sort((entityA, entityB) => entityB.startPos - entityA.startPos);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAQA,wBAA8D;AAC9D,IAAAA,eAAuB;;;ACDvB,kBAAqD;AAOrD,SAAsB,wBAAwB,MAAU;;AAItD,UAAM,aAAa,oBAAI,IAAG;AAC1B,UAAM,YAAY,oBAAI,IAAG;AAEzB,UAAM,YAAY,MAAM,aAAa,IAAI;AACzC,eAAW,CAAC,EAAE,OAAO,KAAK,UAAU,UAAU;AAC5C,iBAAW,CAAC,MAAM,MAAM,KAAK,QAAQ,SAAS;AAC5C,YAAI,SAAS,WAAW,SA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G/C,uBAAAA,QAAG,aAAa,MAAM,SAAS;EACjC;AACA,qBAAAA,QAAG,aAAa,YAAY,SAAS;AACrC,SAAO;AACT;AAOA,SAAS,yBAAyB,UAAyB;AACzD,SAAO,SAAS,KAAK,CAAC,SAAS,YAAY,QAAQ,WAAW,QAAQ,QAAQ;AAChF;;;AJpEc,SAAP,mCAAO;AACZ,SAAO,CAAO,SAAc;AAC1B,UAAM,EAAC,YAAY,UAAS,IAAI,MAAM,wBAAwB,IAAI;AAClE,UAAM,WAAW,QAAQ,IAAG;AAC5B,UAAM,WAAW,CAAC,GAAG,YAAY,GAAG,SAAS;AAE7C,QAAI,CAAC,SAAS,QAAQ;AACpB,YAAM,IAAI,sCACN,4HAC0F;;AAGhG,eAAW,gBAAgB,UAAU;AACnC,yCAAmC,MAAM,cAAc,QAAQ;;EAEnE;AACF;AAEA,SAAS,mCAAmC,MAAY,cAAsB,UAAgB;AAC5F,QAAM,EAAC,QAAO,IAAI,uBAAuB,MAAM,cAAc,QAAQ;AACrE,QAAM,cACF,QAAQ,eAAc,EAAG,OAAO,gBAAc,eAAe,UAAU,YAAY,OAAO,CAAC;AAE/F,aAAW,cAAc,aAAa;AACpC,QAAI,SAA8B;AAElC,UAAM,WAAW,CAAC,UAAkB,YAAoB,SAAgB;AACtE,UAAI,WAAW,MAAM;AAEnB,iBAAS,KAAK,gBAAY,uBAAS,UAAU,WAAW,QAAQ,CAAC;;AAEnE,aAAO,OAAO,UAAU,UAAU;AAClC,aAAO,WAAW,UAAU,IAAI;IAClC;AAEA,gBAAY,YAAY,QAAQ;AAEhC,QAAI,WAAW,MAAM;AACnB,WAAK,aAAa,MAAM;;;AAG9B;",
6
+ "names": ["import_path", "path", "import_typescript", "ts", "ts", "import_typescript", "ts"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs":{"bytes":10701,"imports":[]},"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs":{"bytes":3789,"imports":[]},"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs":{"bytes":12420,"imports":[{"path":"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs","kind":"import-statement"}]},"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/relative-link-resolution/util.mjs":{"bytes":9829,"imports":[]},"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/relative-link-resolution/index.mjs":{"bytes":6980,"imports":[{"path":"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs","kind":"import-statement"},{"path":"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs","kind":"import-statement"},{"path":"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/relative-link-resolution/util.mjs","kind":"import-statement"}]}},"outputs":{"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/relative-link-resolution/bundle.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":18915},"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/relative-link-resolution/bundle.js":{"imports":[],"exports":[],"entryPoint":"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/relative-link-resolution/index.mjs","inputs":{"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/relative-link-resolution/index.mjs":{"bytesInOutput":1636},"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs":{"bytesInOutput":2237},"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs":{"bytesInOutput":1527},"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs":{"bytesInOutput":779},"bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/relative-link-resolution/util.mjs":{"bytesInOutput":1815}},"bytes":10705}}}