@angular-devkit/schematics 14.0.0-next.6 → 14.0.0-next.9
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 +2 -2
- package/src/engine/engine.d.ts +2 -2
- package/src/engine/engine.js +5 -5
- package/src/engine/interface.d.ts +2 -2
- package/src/rules/move.js +1 -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 +2 -2
- package/tools/file-system-engine-host-base.js +5 -5
- package/tools/node-module-engine-host.d.ts +1 -1
- package/tools/node-module-engine-host.js +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.9",
|
|
4
4
|
"description": "Angular Schematics - Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"schematics"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@angular-devkit/core": "14.0.0-next.
|
|
21
|
+
"@angular-devkit/core": "14.0.0-next.9",
|
|
22
22
|
"jsonc-parser": "3.0.0",
|
|
23
23
|
"magic-string": "0.26.1",
|
|
24
24
|
"ora": "5.4.1",
|
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
|
|
@@ -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/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/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
|
});
|
|
@@ -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,7 +55,7 @@ export declare abstract class FileSystemEngineHostBase implements FileSystemEngi
|
|
|
55
55
|
private _transforms;
|
|
56
56
|
private _contextTransforms;
|
|
57
57
|
private _taskFactories;
|
|
58
|
-
listSchematicNames(collection: FileSystemCollectionDesc): string[];
|
|
58
|
+
listSchematicNames(collection: FileSystemCollectionDesc, includeHidden?: boolean): string[];
|
|
59
59
|
registerOptionsTransform<T extends object, R extends object>(t: OptionTransform<T, R>): void;
|
|
60
60
|
registerContextTransform(t: ContextTransform): void;
|
|
61
61
|
/**
|
|
@@ -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
|
}
|
|
@@ -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;
|