@angular-devkit/schematics 14.0.0-next.1 → 14.0.0-next.12
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 +4 -4
- package/src/engine/engine.d.ts +2 -2
- package/src/engine/engine.js +5 -5
- package/src/engine/index.js +5 -1
- package/src/engine/interface.d.ts +2 -2
- package/src/index.d.ts +2 -2
- package/src/index.js +8 -2
- package/src/rules/move.js +1 -1
- package/src/tree/delegate.d.ts +3 -0
- package/src/tree/delegate.js +6 -0
- package/src/tree/host-tree.d.ts +3 -1
- package/src/tree/host-tree.js +30 -0
- package/src/tree/interface.d.ts +23 -1
- package/src/tree/null.d.ts +3 -1
- package/src/tree/null.js +6 -0
- package/src/tree/scoped.d.ts +3 -1
- package/src/tree/scoped.js +6 -0
- package/src/workflow/index.js +5 -1
- package/tasks/node/index.js +5 -1
- package/tasks/package-manager/executor.js +5 -1
- package/tasks/repo-init/executor.js +5 -1
- package/testing/index.js +5 -1
- package/tools/description.d.ts +1 -0
- package/tools/fallback-engine-host.d.ts +1 -1
- package/tools/fallback-engine-host.js +4 -2
- package/tools/file-system-engine-host-base.d.ts +4 -4
- package/tools/file-system-engine-host-base.js +5 -5
- package/tools/file-system-engine-host.js +5 -1
- package/tools/index.js +5 -1
- package/tools/node-module-engine-host.d.ts +1 -1
- package/tools/node-module-engine-host.js +1 -1
- package/tools/schema-option-transform.d.ts +1 -1
- package/tools/workflow/node-workflow.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/schematics",
|
|
3
|
-
"version": "14.0.0-next.
|
|
3
|
+
"version": "14.0.0-next.12",
|
|
4
4
|
"description": "Angular Schematics - Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"schematics"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@angular-devkit/core": "14.0.0-next.
|
|
21
|
+
"@angular-devkit/core": "14.0.0-next.12",
|
|
22
22
|
"jsonc-parser": "3.0.0",
|
|
23
|
-
"magic-string": "0.
|
|
23
|
+
"magic-string": "0.26.1",
|
|
24
24
|
"ora": "5.4.1",
|
|
25
25
|
"rxjs": "6.6.7"
|
|
26
26
|
},
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"url": "https://github.com/angular/angular-cli.git"
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|
|
32
|
-
"node": "^
|
|
32
|
+
"node": "^14.15.0 || >=16.10.0",
|
|
33
33
|
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
|
|
34
34
|
"yarn": ">= 1.13.0"
|
|
35
35
|
},
|
package/src/engine/engine.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export declare class CollectionImpl<CollectionT extends object, SchematicT exten
|
|
|
44
44
|
get description(): CollectionDescription<CollectionT>;
|
|
45
45
|
get name(): string;
|
|
46
46
|
createSchematic(name: string, allowPrivate?: boolean): Schematic<CollectionT, SchematicT>;
|
|
47
|
-
listSchematicNames(): string[];
|
|
47
|
+
listSchematicNames(includeHidden?: boolean): string[];
|
|
48
48
|
}
|
|
49
49
|
export declare class TaskScheduler {
|
|
50
50
|
private _context;
|
|
@@ -70,7 +70,7 @@ export declare class SchematicEngine<CollectionT extends object, SchematicT exte
|
|
|
70
70
|
private _createCollectionDescription;
|
|
71
71
|
createContext(schematic: Schematic<CollectionT, SchematicT>, parent?: Partial<TypedSchematicContext<CollectionT, SchematicT>>, executionOptions?: Partial<ExecutionOptions>): TypedSchematicContext<CollectionT, SchematicT>;
|
|
72
72
|
createSchematic(name: string, collection: Collection<CollectionT, SchematicT>, allowPrivate?: boolean): Schematic<CollectionT, SchematicT>;
|
|
73
|
-
listSchematicNames(collection: Collection<CollectionT, SchematicT
|
|
73
|
+
listSchematicNames(collection: Collection<CollectionT, SchematicT>, includeHidden?: boolean): string[];
|
|
74
74
|
transformOptions<OptionT extends object, ResultT extends object>(schematic: Schematic<CollectionT, SchematicT>, options: OptionT, context?: TypedSchematicContext<CollectionT, SchematicT>): Observable<ResultT>;
|
|
75
75
|
createSourceFromUrl(url: Url, context: TypedSchematicContext<CollectionT, SchematicT>): Source;
|
|
76
76
|
executePostTasks(): Observable<void>;
|
package/src/engine/engine.js
CHANGED
|
@@ -79,8 +79,8 @@ class CollectionImpl {
|
|
|
79
79
|
createSchematic(name, allowPrivate = false) {
|
|
80
80
|
return this._engine.createSchematic(name, this, allowPrivate);
|
|
81
81
|
}
|
|
82
|
-
listSchematicNames() {
|
|
83
|
-
return this._engine.listSchematicNames(this);
|
|
82
|
+
listSchematicNames(includeHidden) {
|
|
83
|
+
return this._engine.listSchematicNames(this, includeHidden);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
exports.CollectionImpl = CollectionImpl;
|
|
@@ -249,11 +249,11 @@ class SchematicEngine {
|
|
|
249
249
|
schematicMap === null || schematicMap === void 0 ? void 0 : schematicMap.set(name, schematic);
|
|
250
250
|
return schematic;
|
|
251
251
|
}
|
|
252
|
-
listSchematicNames(collection) {
|
|
253
|
-
const names = this._host.listSchematicNames(collection.description);
|
|
252
|
+
listSchematicNames(collection, includeHidden) {
|
|
253
|
+
const names = this._host.listSchematicNames(collection.description, includeHidden);
|
|
254
254
|
if (collection.baseDescriptions) {
|
|
255
255
|
for (const base of collection.baseDescriptions) {
|
|
256
|
-
names.push(...this._host.listSchematicNames(base));
|
|
256
|
+
names.push(...this._host.listSchematicNames(base, includeHidden));
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
// remove duplicates
|
package/src/engine/index.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -64,7 +64,7 @@ export declare type SchematicDescription<CollectionMetadataT extends object, Sch
|
|
|
64
64
|
*/
|
|
65
65
|
export interface EngineHost<CollectionMetadataT extends object, SchematicMetadataT extends object> {
|
|
66
66
|
createCollectionDescription(name: string, requester?: CollectionDescription<CollectionMetadataT>): CollectionDescription<CollectionMetadataT>;
|
|
67
|
-
listSchematicNames(collection: CollectionDescription<CollectionMetadataT
|
|
67
|
+
listSchematicNames(collection: CollectionDescription<CollectionMetadataT>, includeHidden?: boolean): string[];
|
|
68
68
|
createSchematicDescription(name: string, collection: CollectionDescription<CollectionMetadataT>): SchematicDescription<CollectionMetadataT, SchematicMetadataT> | null;
|
|
69
69
|
getSchematicRuleFactory<OptionT extends object>(schematic: SchematicDescription<CollectionMetadataT, SchematicMetadataT>, collection: CollectionDescription<CollectionMetadataT>): RuleFactory<OptionT>;
|
|
70
70
|
createSourceFromUrl(url: Url, context: TypedSchematicContext<CollectionMetadataT, SchematicMetadataT>): Source | null;
|
|
@@ -102,7 +102,7 @@ export interface Collection<CollectionMetadataT extends object, SchematicMetadat
|
|
|
102
102
|
readonly description: CollectionDescription<CollectionMetadataT>;
|
|
103
103
|
readonly baseDescriptions?: Array<CollectionDescription<CollectionMetadataT>>;
|
|
104
104
|
createSchematic(name: string, allowPrivate?: boolean): Schematic<CollectionMetadataT, SchematicMetadataT>;
|
|
105
|
-
listSchematicNames(): string[];
|
|
105
|
+
listSchematicNames(includeHidden?: boolean): string[];
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* A Schematic as created by the Engine. This should be used by the tool to execute the main
|
package/src/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
+
import { strings } from '@angular-devkit/core';
|
|
8
9
|
import * as formats from './formats/index';
|
|
9
10
|
import { FilePredicate, MergeStrategy, Tree as TreeInterface } from './tree/interface';
|
|
10
11
|
import * as workflow from './workflow/index';
|
|
@@ -28,8 +29,7 @@ export * from './engine/schematic';
|
|
|
28
29
|
export * from './sink/dryrun';
|
|
29
30
|
export * from './sink/host';
|
|
30
31
|
export * from './sink/sink';
|
|
31
|
-
export { formats };
|
|
32
|
-
export { workflow };
|
|
32
|
+
export { formats, strings, workflow };
|
|
33
33
|
export interface TreeConstructor {
|
|
34
34
|
empty(): TreeInterface;
|
|
35
35
|
branch(tree: TreeInterface): TreeInterface;
|
package/src/index.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -29,7 +33,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
29
33
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
30
34
|
};
|
|
31
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.Tree = exports.workflow = exports.formats = exports.SchematicsException = void 0;
|
|
36
|
+
exports.Tree = exports.workflow = exports.strings = exports.formats = exports.SchematicsException = void 0;
|
|
37
|
+
const core_1 = require("@angular-devkit/core");
|
|
38
|
+
Object.defineProperty(exports, "strings", { enumerable: true, get: function () { return core_1.strings; } });
|
|
33
39
|
const formats = __importStar(require("./formats/index"));
|
|
34
40
|
exports.formats = formats;
|
|
35
41
|
const interface_1 = require("./tree/interface");
|
package/src/rules/move.js
CHANGED
|
@@ -28,7 +28,7 @@ function move(from, to) {
|
|
|
28
28
|
else {
|
|
29
29
|
// fromPath is a directory
|
|
30
30
|
tree.getDir(fromPath).visit((path) => {
|
|
31
|
-
tree.rename(path, (0, core_1.join)(toPath, path.
|
|
31
|
+
tree.rename(path, (0, core_1.join)(toPath, path.slice(fromPath.length)));
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
return tree;
|
package/src/tree/delegate.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
/// <reference types="node" />
|
|
9
|
+
import { JsonValue } from '@angular-devkit/core';
|
|
9
10
|
import { Action } from './action';
|
|
10
11
|
import { DirEntry, FileEntry, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface';
|
|
11
12
|
export declare class DelegateTree implements Tree {
|
|
@@ -15,6 +16,8 @@ export declare class DelegateTree implements Tree {
|
|
|
15
16
|
merge(other: Tree, strategy?: MergeStrategy): void;
|
|
16
17
|
get root(): DirEntry;
|
|
17
18
|
read(path: string): Buffer | null;
|
|
19
|
+
readText(path: string): string;
|
|
20
|
+
readJson(path: string): JsonValue;
|
|
18
21
|
exists(path: string): boolean;
|
|
19
22
|
get(path: string): FileEntry | null;
|
|
20
23
|
getDir(path: string): DirEntry;
|
package/src/tree/delegate.js
CHANGED
|
@@ -26,6 +26,12 @@ class DelegateTree {
|
|
|
26
26
|
read(path) {
|
|
27
27
|
return this._other.read(path);
|
|
28
28
|
}
|
|
29
|
+
readText(path) {
|
|
30
|
+
return this._other.readText(path);
|
|
31
|
+
}
|
|
32
|
+
readJson(path) {
|
|
33
|
+
return this._other.readJson(path);
|
|
34
|
+
}
|
|
29
35
|
exists(path) {
|
|
30
36
|
return this._other.exists(path);
|
|
31
37
|
}
|
package/src/tree/host-tree.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
/// <reference types="node" />
|
|
9
|
-
import { Path, PathFragment, virtualFs } from '@angular-devkit/core';
|
|
9
|
+
import { JsonValue, Path, PathFragment, virtualFs } from '@angular-devkit/core';
|
|
10
10
|
import { Action } from './action';
|
|
11
11
|
import { DirEntry, FileEntry, FilePredicate, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface';
|
|
12
12
|
export declare class HostDirEntry implements DirEntry {
|
|
@@ -41,6 +41,8 @@ export declare class HostTree implements Tree {
|
|
|
41
41
|
merge(other: Tree, strategy?: MergeStrategy): void;
|
|
42
42
|
get root(): DirEntry;
|
|
43
43
|
read(path: string): Buffer | null;
|
|
44
|
+
readText(path: string): string;
|
|
45
|
+
readJson(path: string): JsonValue;
|
|
44
46
|
exists(path: string): boolean;
|
|
45
47
|
get(path: string): FileEntry | null;
|
|
46
48
|
getDir(path: string): DirEntry;
|
package/src/tree/host-tree.js
CHANGED
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.FilterHostTree = exports.HostCreateTree = exports.HostTree = exports.HostDirEntry = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
|
+
const jsonc_parser_1 = require("jsonc-parser");
|
|
12
13
|
const rxjs_1 = require("rxjs");
|
|
13
14
|
const operators_1 = require("rxjs/operators");
|
|
15
|
+
const util_1 = require("util");
|
|
14
16
|
const exception_1 = require("../exception/exception");
|
|
15
17
|
const delegate_1 = require("./delegate");
|
|
16
18
|
const entry_1 = require("./entry");
|
|
@@ -208,6 +210,34 @@ class HostTree {
|
|
|
208
210
|
const entry = this.get(path);
|
|
209
211
|
return entry ? entry.content : null;
|
|
210
212
|
}
|
|
213
|
+
readText(path) {
|
|
214
|
+
const data = this.read(path);
|
|
215
|
+
if (data === null) {
|
|
216
|
+
throw new exception_1.FileDoesNotExistException(path);
|
|
217
|
+
}
|
|
218
|
+
const decoder = new util_1.TextDecoder('utf-8', { fatal: true });
|
|
219
|
+
try {
|
|
220
|
+
// With the `fatal` option enabled, invalid data will throw a TypeError
|
|
221
|
+
return decoder.decode(data);
|
|
222
|
+
}
|
|
223
|
+
catch (e) {
|
|
224
|
+
if (e instanceof TypeError) {
|
|
225
|
+
throw new Error(`Failed to decode "${path}" as UTF-8 text.`);
|
|
226
|
+
}
|
|
227
|
+
throw e;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
readJson(path) {
|
|
231
|
+
const content = this.readText(path);
|
|
232
|
+
const errors = [];
|
|
233
|
+
const result = (0, jsonc_parser_1.parse)(content, errors, { allowTrailingComma: true });
|
|
234
|
+
// If there is a parse error throw with the error information
|
|
235
|
+
if (errors[0]) {
|
|
236
|
+
const { error, offset } = errors[0];
|
|
237
|
+
throw new Error(`Failed to parse "${path}" as JSON. ${(0, jsonc_parser_1.printParseErrorCode)(error)} at offset: ${offset}.`);
|
|
238
|
+
}
|
|
239
|
+
return result;
|
|
240
|
+
}
|
|
211
241
|
exists(path) {
|
|
212
242
|
return this._recordSync.isFile(this._normalizePath(path));
|
|
213
243
|
}
|
package/src/tree/interface.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
/// <reference types="node" />
|
|
9
|
-
import { Path, PathFragment } from '@angular-devkit/core';
|
|
9
|
+
import { JsonValue, Path, PathFragment } from '@angular-devkit/core';
|
|
10
10
|
import { Action } from './action';
|
|
11
11
|
export declare enum MergeStrategy {
|
|
12
12
|
AllowOverwriteConflict = 2,
|
|
@@ -41,6 +41,28 @@ export interface Tree {
|
|
|
41
41
|
merge(other: Tree, strategy?: MergeStrategy): void;
|
|
42
42
|
readonly root: DirEntry;
|
|
43
43
|
read(path: string): Buffer | null;
|
|
44
|
+
/**
|
|
45
|
+
* Reads a file from the Tree as a UTF-8 encoded text file.
|
|
46
|
+
*
|
|
47
|
+
* @param path The path of the file to read.
|
|
48
|
+
* @returns A string containing the contents of the file.
|
|
49
|
+
* @throws {@link FileDoesNotExistException} if the file is not found.
|
|
50
|
+
* @throws An error if the file contains invalid UTF-8 characters.
|
|
51
|
+
*/
|
|
52
|
+
readText(path: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Reads and parses a file from the Tree as a UTF-8 encoded JSON file.
|
|
55
|
+
* Supports parsing JSON (RFC 8259) with the following extensions:
|
|
56
|
+
* * Single-line and multi-line JavaScript comments
|
|
57
|
+
* * Trailing commas within objects and arrays
|
|
58
|
+
*
|
|
59
|
+
* @param path The path of the file to read.
|
|
60
|
+
* @returns A JsonValue containing the parsed contents of the file.
|
|
61
|
+
* @throws {@link FileDoesNotExistException} if the file is not found.
|
|
62
|
+
* @throws An error if the file contains invalid UTF-8 characters.
|
|
63
|
+
* @throws An error if the file contains malformed JSON.
|
|
64
|
+
*/
|
|
65
|
+
readJson(path: string): JsonValue;
|
|
44
66
|
exists(path: string): boolean;
|
|
45
67
|
get(path: string): FileEntry | null;
|
|
46
68
|
getDir(path: string): DirEntry;
|
package/src/tree/null.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
/// <reference types="node" />
|
|
9
|
-
import { BaseException, Path, PathFragment } from '@angular-devkit/core';
|
|
9
|
+
import { BaseException, JsonValue, Path, PathFragment } from '@angular-devkit/core';
|
|
10
10
|
import { Action } from './action';
|
|
11
11
|
import { DirEntry, MergeStrategy, Tree, UpdateRecorder } from './interface';
|
|
12
12
|
export declare class CannotCreateFileException extends BaseException {
|
|
@@ -28,6 +28,8 @@ export declare class NullTree implements Tree {
|
|
|
28
28
|
readonly root: DirEntry;
|
|
29
29
|
exists(_path: string): boolean;
|
|
30
30
|
read(_path: string): null;
|
|
31
|
+
readText(path: string): string;
|
|
32
|
+
readJson(path: string): JsonValue;
|
|
31
33
|
get(_path: string): null;
|
|
32
34
|
getDir(path: string): NullTreeDirEntry;
|
|
33
35
|
visit(): void;
|
package/src/tree/null.js
CHANGED
|
@@ -54,6 +54,12 @@ class NullTree {
|
|
|
54
54
|
read(_path) {
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
57
|
+
readText(path) {
|
|
58
|
+
throw new exception_1.FileDoesNotExistException(path);
|
|
59
|
+
}
|
|
60
|
+
readJson(path) {
|
|
61
|
+
throw new exception_1.FileDoesNotExistException(path);
|
|
62
|
+
}
|
|
57
63
|
get(_path) {
|
|
58
64
|
return null;
|
|
59
65
|
}
|
package/src/tree/scoped.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
/// <reference types="node" />
|
|
9
|
-
import { Path, PathFragment } from '@angular-devkit/core';
|
|
9
|
+
import { JsonValue, Path, PathFragment } from '@angular-devkit/core';
|
|
10
10
|
import { Action } from './action';
|
|
11
11
|
import { DirEntry, FileEntry, FileVisitor, MergeStrategy, Tree, UpdateRecorder } from './interface';
|
|
12
12
|
declare class ScopedDirEntry implements DirEntry {
|
|
@@ -29,6 +29,8 @@ export declare class ScopedTree implements Tree {
|
|
|
29
29
|
branch(): Tree;
|
|
30
30
|
merge(other: Tree, strategy?: MergeStrategy): void;
|
|
31
31
|
read(path: string): Buffer | null;
|
|
32
|
+
readText(path: string): string;
|
|
33
|
+
readJson(path: string): JsonValue;
|
|
32
34
|
exists(path: string): boolean;
|
|
33
35
|
get(path: string): FileEntry | null;
|
|
34
36
|
getDir(path: string): DirEntry;
|
package/src/tree/scoped.js
CHANGED
|
@@ -83,6 +83,12 @@ class ScopedTree {
|
|
|
83
83
|
read(path) {
|
|
84
84
|
return this._base.read(this._fullPath(path));
|
|
85
85
|
}
|
|
86
|
+
readText(path) {
|
|
87
|
+
return this._base.readText(this._fullPath(path));
|
|
88
|
+
}
|
|
89
|
+
readJson(path) {
|
|
90
|
+
return this._base.readJson(this._fullPath(path));
|
|
91
|
+
}
|
|
86
92
|
exists(path) {
|
|
87
93
|
return this._base.exists(this._fullPath(path));
|
|
88
94
|
}
|
package/src/workflow/index.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
package/tasks/node/index.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
package/testing/index.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
package/tools/description.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare class FallbackEngineHost implements EngineHost<{}, {}> {
|
|
|
30
30
|
createSourceFromUrl(url: Url, context: FallbackContext): Source | null;
|
|
31
31
|
transformOptions<OptionT extends object, ResultT extends object>(schematic: SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription>, options: OptionT, context?: FallbackContext): Observable<ResultT>;
|
|
32
32
|
transformContext(context: FallbackContext): FallbackContext;
|
|
33
|
-
listSchematicNames(collection: CollectionDescription<FallbackCollectionDescription
|
|
33
|
+
listSchematicNames(collection: CollectionDescription<FallbackCollectionDescription>, includeHidden?: boolean): string[];
|
|
34
34
|
createTaskExecutor(name: string): Observable<TaskExecutor>;
|
|
35
35
|
hasTaskExecutor(name: string): boolean;
|
|
36
36
|
}
|
|
@@ -56,11 +56,13 @@ class FallbackEngineHost {
|
|
|
56
56
|
});
|
|
57
57
|
return result;
|
|
58
58
|
}
|
|
59
|
-
listSchematicNames(collection) {
|
|
59
|
+
listSchematicNames(collection, includeHidden) {
|
|
60
60
|
const allNames = new Set();
|
|
61
61
|
this._hosts.forEach((host) => {
|
|
62
62
|
try {
|
|
63
|
-
host
|
|
63
|
+
host
|
|
64
|
+
.listSchematicNames(collection.description, includeHidden)
|
|
65
|
+
.forEach((name) => allNames.add(name));
|
|
64
66
|
}
|
|
65
67
|
catch (_) { }
|
|
66
68
|
});
|
|
@@ -11,7 +11,7 @@ import { Observable } from 'rxjs';
|
|
|
11
11
|
import { Url } from 'url';
|
|
12
12
|
import { RuleFactory, Source, TaskExecutor, TaskExecutorFactory } from '../src';
|
|
13
13
|
import { FileSystemCollectionDesc, FileSystemEngineHost, FileSystemSchematicContext, FileSystemSchematicDesc, FileSystemSchematicDescription } from './description';
|
|
14
|
-
export declare type OptionTransform<T extends object, R extends object> = (schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext) => Observable<R> | PromiseLike<R> | R;
|
|
14
|
+
export declare type OptionTransform<T extends object | null, R extends object> = (schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext) => Observable<R> | PromiseLike<R> | R;
|
|
15
15
|
export declare type ContextTransform = (context: FileSystemSchematicContext) => FileSystemSchematicContext;
|
|
16
16
|
export declare class CollectionCannotBeResolvedException extends BaseException {
|
|
17
17
|
constructor(name: string);
|
|
@@ -46,7 +46,7 @@ export declare class SchematicNameCollisionException extends BaseException {
|
|
|
46
46
|
*/
|
|
47
47
|
export declare abstract class FileSystemEngineHostBase implements FileSystemEngineHost {
|
|
48
48
|
protected abstract _resolveCollectionPath(name: string, requester?: string): string;
|
|
49
|
-
protected abstract _resolveReferenceString(name: string, parentPath: string): {
|
|
49
|
+
protected abstract _resolveReferenceString(name: string, parentPath: string, collectionDescription: FileSystemCollectionDesc): {
|
|
50
50
|
ref: RuleFactory<{}>;
|
|
51
51
|
path: string;
|
|
52
52
|
} | null;
|
|
@@ -55,8 +55,8 @@ export declare abstract class FileSystemEngineHostBase implements FileSystemEngi
|
|
|
55
55
|
private _transforms;
|
|
56
56
|
private _contextTransforms;
|
|
57
57
|
private _taskFactories;
|
|
58
|
-
listSchematicNames(collection: FileSystemCollectionDesc): string[];
|
|
59
|
-
registerOptionsTransform<T extends object, R extends object>(t: OptionTransform<T, R>): void;
|
|
58
|
+
listSchematicNames(collection: FileSystemCollectionDesc, includeHidden?: boolean): string[];
|
|
59
|
+
registerOptionsTransform<T extends object | null, R extends object>(t: OptionTransform<T, R>): void;
|
|
60
60
|
registerContextTransform(t: ContextTransform): void;
|
|
61
61
|
/**
|
|
62
62
|
*
|
|
@@ -85,11 +85,11 @@ class FileSystemEngineHostBase {
|
|
|
85
85
|
this._contextTransforms = [];
|
|
86
86
|
this._taskFactories = new Map();
|
|
87
87
|
}
|
|
88
|
-
listSchematicNames(collection) {
|
|
88
|
+
listSchematicNames(collection, includeHidden) {
|
|
89
89
|
const schematics = [];
|
|
90
90
|
for (const key of Object.keys(collection.schematics)) {
|
|
91
91
|
const schematic = collection.schematics[key];
|
|
92
|
-
if (schematic.hidden || schematic.private) {
|
|
92
|
+
if ((schematic.hidden && !includeHidden) || schematic.private) {
|
|
93
93
|
continue;
|
|
94
94
|
}
|
|
95
95
|
// If extends is present without a factory it is an alias, do not return it
|
|
@@ -163,8 +163,8 @@ class FileSystemEngineHostBase {
|
|
|
163
163
|
}
|
|
164
164
|
if (partialDesc.extends) {
|
|
165
165
|
const index = partialDesc.extends.indexOf(':');
|
|
166
|
-
const collectionName = index !== -1 ? partialDesc.extends.
|
|
167
|
-
const schematicName = index === -1 ? partialDesc.extends : partialDesc.extends.
|
|
166
|
+
const collectionName = index !== -1 ? partialDesc.extends.slice(0, index) : null;
|
|
167
|
+
const schematicName = index === -1 ? partialDesc.extends : partialDesc.extends.slice(index + 1);
|
|
168
168
|
if (collectionName !== null) {
|
|
169
169
|
const extendCollection = this.createCollectionDescription(collectionName);
|
|
170
170
|
return this.createSchematicDescription(schematicName, extendCollection);
|
|
@@ -178,7 +178,7 @@ class FileSystemEngineHostBase {
|
|
|
178
178
|
if (!partialDesc.factory) {
|
|
179
179
|
throw new SchematicMissingFactoryException(name);
|
|
180
180
|
}
|
|
181
|
-
const resolvedRef = this._resolveReferenceString(partialDesc.factory, collectionPath);
|
|
181
|
+
const resolvedRef = this._resolveReferenceString(partialDesc.factory, collectionPath, collection);
|
|
182
182
|
if (!resolvedRef) {
|
|
183
183
|
throw new FactoryCannotBeResolvedException(name);
|
|
184
184
|
}
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
package/tools/index.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -20,7 +20,7 @@ export declare class NodeModulesEngineHost extends FileSystemEngineHostBase {
|
|
|
20
20
|
constructor(paths?: string[] | undefined);
|
|
21
21
|
private resolve;
|
|
22
22
|
protected _resolveCollectionPath(name: string, requester?: string): string;
|
|
23
|
-
protected _resolveReferenceString(refString: string, parentPath: string): {
|
|
23
|
+
protected _resolveReferenceString(refString: string, parentPath: string, collectionDescription?: FileSystemCollectionDesc): {
|
|
24
24
|
ref: RuleFactory<{}>;
|
|
25
25
|
path: string;
|
|
26
26
|
} | null;
|
|
@@ -81,7 +81,7 @@ class NodeModulesEngineHost extends file_system_engine_host_base_1.FileSystemEng
|
|
|
81
81
|
(0, file_system_utility_1.readJsonFile)(collectionPath);
|
|
82
82
|
return collectionPath;
|
|
83
83
|
}
|
|
84
|
-
_resolveReferenceString(refString, parentPath) {
|
|
84
|
+
_resolveReferenceString(refString, parentPath, collectionDescription) {
|
|
85
85
|
const ref = new export_ref_1.ExportStringRef(refString, parentPath);
|
|
86
86
|
if (!ref.ref) {
|
|
87
87
|
return null;
|
|
@@ -11,4 +11,4 @@ import { FileSystemSchematicContext, FileSystemSchematicDescription } from './de
|
|
|
11
11
|
export declare class InvalidInputOptions<T = {}> extends schema.SchemaValidationException {
|
|
12
12
|
constructor(options: T, errors: schema.SchemaValidatorError[]);
|
|
13
13
|
}
|
|
14
|
-
export declare function validateOptionsWithSchema(registry: schema.SchemaRegistry): <T extends {}>(schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext | undefined) => Observable<T>;
|
|
14
|
+
export declare function validateOptionsWithSchema(registry: schema.SchemaRegistry): <T extends {} | null>(schematic: FileSystemSchematicDescription, options: T, context?: FileSystemSchematicContext | undefined) => Observable<T>;
|
|
@@ -19,7 +19,7 @@ export interface NodeWorkflowOptions {
|
|
|
19
19
|
registry?: schema.CoreSchemaRegistry;
|
|
20
20
|
resolvePaths?: string[];
|
|
21
21
|
schemaValidation?: boolean;
|
|
22
|
-
optionTransforms?: OptionTransform<
|
|
22
|
+
optionTransforms?: OptionTransform<Record<string, unknown> | null, object>[];
|
|
23
23
|
engineHostCreator?: (options: NodeWorkflowOptions) => NodeModulesEngineHost;
|
|
24
24
|
}
|
|
25
25
|
/**
|