@angular-devkit/schematics 14.0.0-next.6 → 14.0.0-next.7

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": "14.0.0-next.6",
3
+ "version": "14.0.0-next.7",
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.6",
21
+ "@angular-devkit/core": "14.0.0-next.7",
22
22
  "jsonc-parser": "3.0.0",
23
23
  "magic-string": "0.26.1",
24
24
  "ora": "5.4.1",
@@ -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>): string[];
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>;
@@ -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>): string[];
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.substr(fromPath.length)));
31
+ tree.rename(path, (0, core_1.join)(toPath, path.slice(fromPath.length)));
32
32
  });
33
33
  }
34
34
  return tree;
@@ -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>): string[];
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.listSchematicNames(collection.description).forEach((name) => allNames.add(name));
63
+ host
64
+ .listSchematicNames(collection.description, includeHidden)
65
+ .forEach((name) => allNames.add(name));
64
66
  }
65
67
  catch (_) { }
66
68
  });
@@ -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.substr(0, index) : null;
167
- const schematicName = index === -1 ? partialDesc.extends : partialDesc.extends.substr(index + 1);
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);