@angular-devkit/schematics 18.1.0-next.3 → 18.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/schematics",
|
|
3
|
-
"version": "18.1.0-
|
|
3
|
+
"version": "18.1.0-rc.0",
|
|
4
4
|
"description": "Angular Schematics - Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"tooling"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@angular-devkit/core": "18.1.0-
|
|
22
|
-
"jsonc-parser": "3.
|
|
21
|
+
"@angular-devkit/core": "18.1.0-rc.0",
|
|
22
|
+
"jsonc-parser": "3.3.1",
|
|
23
23
|
"magic-string": "0.30.10",
|
|
24
24
|
"ora": "5.4.1",
|
|
25
25
|
"rxjs": "7.8.1"
|
package/src/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export * from './rules/url';
|
|
|
24
24
|
export * from './tree/delegate';
|
|
25
25
|
export * from './tree/empty';
|
|
26
26
|
export * from './tree/host-tree';
|
|
27
|
-
export { UpdateRecorder } from './tree/interface';
|
|
27
|
+
export type { UpdateRecorder } from './tree/interface';
|
|
28
28
|
export * from './engine/schematic';
|
|
29
29
|
export * from './sink/dryrun';
|
|
30
30
|
export * from './sink/host';
|
|
@@ -107,7 +107,7 @@ class FileSystemEngineHost extends file_system_engine_host_base_1.FileSystemEngi
|
|
|
107
107
|
try {
|
|
108
108
|
const path = require.resolve((0, path_1.join)(this._root, name));
|
|
109
109
|
// Default handling code is for old tasks that incorrectly export `default` with non-ESM module
|
|
110
|
-
return (0, rxjs_1.from)(Promise.resolve(`${path}`).then(s => __importStar(require(s))).then((mod) => (mod.default?.default || mod.default)())).pipe((0, rxjs_1.catchError)(() => (0, rxjs_1.throwError)(new src_1.UnregisteredTaskException(name))));
|
|
110
|
+
return (0, rxjs_1.from)(Promise.resolve(`${path}`).then(s => __importStar(require(s))).then((mod) => (mod.default?.default || mod.default)())).pipe((0, rxjs_1.catchError)(() => (0, rxjs_1.throwError)(() => new src_1.UnregisteredTaskException(name))));
|
|
111
111
|
}
|
|
112
112
|
catch { }
|
|
113
113
|
}
|
|
@@ -12,11 +12,18 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
|
12
12
|
const fs_1 = require("fs");
|
|
13
13
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
14
14
|
function readJsonFile(path) {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
let data;
|
|
16
|
+
try {
|
|
17
|
+
data = (0, fs_1.readFileSync)(path, 'utf-8');
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
if (e && typeof e === 'object' && 'code' in e && e.code === 'ENOENT') {
|
|
21
|
+
throw new schematics_1.FileDoesNotExistException(path);
|
|
22
|
+
}
|
|
23
|
+
throw e;
|
|
17
24
|
}
|
|
18
25
|
const errors = [];
|
|
19
|
-
const content = (0, jsonc_parser_1.parse)(
|
|
26
|
+
const content = (0, jsonc_parser_1.parse)(data, errors, { allowTrailingComma: true });
|
|
20
27
|
if (errors.length) {
|
|
21
28
|
const { error, offset } = errors[0];
|
|
22
29
|
throw new Error(`Failed to parse "${path}" as JSON AST Object. ${(0, jsonc_parser_1.printParseErrorCode)(error)} at location: ${offset}.`);
|
|
@@ -13,8 +13,7 @@ import { NodeModulesEngineHost } from './node-module-engine-host';
|
|
|
13
13
|
* revert back to using node modules resolution. This is done for testing.
|
|
14
14
|
*/
|
|
15
15
|
export declare class NodeModulesTestEngineHost extends NodeModulesEngineHost {
|
|
16
|
-
private
|
|
17
|
-
private _tasks;
|
|
16
|
+
#private;
|
|
18
17
|
get tasks(): TaskConfiguration<{}>[];
|
|
19
18
|
clearTasks(): void;
|
|
20
19
|
registerCollection(name: string, path: string): void;
|
|
@@ -14,31 +14,27 @@ const node_module_engine_host_1 = require("./node-module-engine-host");
|
|
|
14
14
|
* revert back to using node modules resolution. This is done for testing.
|
|
15
15
|
*/
|
|
16
16
|
class NodeModulesTestEngineHost extends node_module_engine_host_1.NodeModulesEngineHost {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
#collections = new Map();
|
|
18
|
+
#tasks = [];
|
|
19
19
|
get tasks() {
|
|
20
|
-
return this
|
|
20
|
+
return this.#tasks;
|
|
21
21
|
}
|
|
22
22
|
clearTasks() {
|
|
23
|
-
this
|
|
23
|
+
this.#tasks = [];
|
|
24
24
|
}
|
|
25
25
|
registerCollection(name, path) {
|
|
26
|
-
this.
|
|
26
|
+
this.#collections.set(name, path);
|
|
27
27
|
}
|
|
28
28
|
transformContext(context) {
|
|
29
|
-
const oldAddTask = context.addTask;
|
|
29
|
+
const oldAddTask = context.addTask.bind(context);
|
|
30
30
|
context.addTask = (task, dependencies) => {
|
|
31
|
-
this.
|
|
32
|
-
return oldAddTask
|
|
31
|
+
this.#tasks.push(task.toConfiguration());
|
|
32
|
+
return oldAddTask(task, dependencies);
|
|
33
33
|
};
|
|
34
34
|
return context;
|
|
35
35
|
}
|
|
36
36
|
_resolveCollectionPath(name, requester) {
|
|
37
|
-
|
|
38
|
-
if (maybePath) {
|
|
39
|
-
return maybePath;
|
|
40
|
-
}
|
|
41
|
-
return super._resolveCollectionPath(name, requester);
|
|
37
|
+
return this.#collections.get(name) ?? super._resolveCollectionPath(name, requester);
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
40
|
exports.NodeModulesTestEngineHost = NodeModulesTestEngineHost;
|