yeoman-environment 4.0.0-alpha.4 → 4.0.0-alpha.6

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 (86) hide show
  1. package/bin/bin.cjs +4 -0
  2. package/dist/cli/index.d.ts +0 -1
  3. package/dist/cli/index.js +18 -15
  4. package/dist/cli/utils.js +6 -7
  5. package/dist/commands.d.ts +23 -0
  6. package/dist/commands.js +45 -0
  7. package/dist/commit.d.ts +17 -0
  8. package/dist/commit.js +22 -0
  9. package/dist/composed-store.d.ts +26 -0
  10. package/dist/composed-store.js +68 -0
  11. package/dist/constants.d.ts +3 -0
  12. package/dist/constants.js +17 -0
  13. package/dist/environment-base.d.ts +259 -0
  14. package/dist/environment-base.js +638 -0
  15. package/dist/environment-full.d.ts +115 -0
  16. package/dist/environment-full.js +321 -0
  17. package/dist/generator-lookup.d.ts +56 -0
  18. package/dist/generator-lookup.js +97 -0
  19. package/dist/index.d.ts +10 -4
  20. package/dist/index.js +9 -5
  21. package/dist/module-lookup.d.ts +59 -0
  22. package/dist/module-lookup.js +227 -0
  23. package/dist/package-manager.d.ts +17 -31
  24. package/dist/package-manager.js +52 -69
  25. package/dist/store.d.ts +19 -19
  26. package/dist/store.js +76 -47
  27. package/dist/util/command.d.ts +17 -14
  28. package/dist/util/command.js +32 -17
  29. package/dist/util/namespace.d.ts +19 -73
  30. package/dist/util/namespace.js +56 -190
  31. package/dist/util/resolve.d.ts +6 -0
  32. package/dist/util/resolve.js +40 -0
  33. package/dist/util/util.d.ts +5 -12
  34. package/dist/util/util.js +24 -23
  35. package/package.json +20 -33
  36. package/readme.md +2 -3
  37. package/dist/adapter.d.ts +0 -54
  38. package/dist/adapter.js +0 -97
  39. package/dist/adapter.js.map +0 -1
  40. package/dist/cli/index.js.map +0 -1
  41. package/dist/cli/utils.js.map +0 -1
  42. package/dist/command.d.ts +0 -24
  43. package/dist/command.js +0 -74
  44. package/dist/command.js.map +0 -1
  45. package/dist/composability.d.ts +0 -25
  46. package/dist/composability.js +0 -78
  47. package/dist/composability.js.map +0 -1
  48. package/dist/environment.d.ts +0 -409
  49. package/dist/environment.js +0 -1221
  50. package/dist/environment.js.map +0 -1
  51. package/dist/generator-features.d.ts +0 -39
  52. package/dist/generator-features.js +0 -69
  53. package/dist/generator-features.js.map +0 -1
  54. package/dist/index.js.map +0 -1
  55. package/dist/namespace-composability.d.ts +0 -36
  56. package/dist/namespace-composability.js +0 -340
  57. package/dist/namespace-composability.js.map +0 -1
  58. package/dist/package-manager.js.map +0 -1
  59. package/dist/resolver.d.ts +0 -146
  60. package/dist/resolver.js +0 -421
  61. package/dist/resolver.js.map +0 -1
  62. package/dist/spawn-command.d.ts +0 -21
  63. package/dist/spawn-command.js +0 -30
  64. package/dist/spawn-command.js.map +0 -1
  65. package/dist/store.js.map +0 -1
  66. package/dist/util/binary-diff.d.ts +0 -2
  67. package/dist/util/binary-diff.js +0 -36
  68. package/dist/util/binary-diff.js.map +0 -1
  69. package/dist/util/command.js.map +0 -1
  70. package/dist/util/conflicter.d.ts +0 -76
  71. package/dist/util/conflicter.js +0 -346
  72. package/dist/util/conflicter.js.map +0 -1
  73. package/dist/util/esm.d.ts +0 -1
  74. package/dist/util/esm.js +0 -22
  75. package/dist/util/esm.js.map +0 -1
  76. package/dist/util/log.d.ts +0 -12
  77. package/dist/util/log.js +0 -165
  78. package/dist/util/log.js.map +0 -1
  79. package/dist/util/namespace.js.map +0 -1
  80. package/dist/util/repository.d.ts +0 -116
  81. package/dist/util/repository.js +0 -223
  82. package/dist/util/repository.js.map +0 -1
  83. package/dist/util/transform.d.ts +0 -55
  84. package/dist/util/transform.js +0 -149
  85. package/dist/util/transform.js.map +0 -1
  86. package/dist/util/util.js.map +0 -1
@@ -1,409 +0,0 @@
1
- export default Environment;
2
- declare class Environment {
3
- static get UNKNOWN_NAMESPACE(): string;
4
- static get UNKNOWN_RESOLVED(): string;
5
- static get queues(): string[];
6
- static get lookups(): string[];
7
- /**
8
- * Make sure the Environment present expected methods if an old version is
9
- * passed to a Generator.
10
- * @param {Environment} env
11
- * @return {Environment} The updated env
12
- */
13
- static enforceUpdate(env: Environment): Environment;
14
- /**
15
- * Prepare a commander instance for cli support.
16
- *
17
- * @param {Class} GeneratorClass - Generator to create Command
18
- * @return {Command} Return a Command instance
19
- */
20
- static prepareCommand(GeneratorClass: Class, command?: YeomanCommand): Command;
21
- /**
22
- * Prepare a commander instance for cli support.
23
- *
24
- * @param {Command} command - Command to be prepared
25
- * @param {Class} GeneratorClass - Generator to create Command
26
- * @return {Command} return command
27
- */
28
- static prepareGeneratorCommand(command: Command, GeneratorClass: Class, namespace: any): Command;
29
- /**
30
- * Factory method to create an environment instance. Take same parameters as the
31
- * Environment constructor.
32
- *
33
- * @deprecated
34
- * @param {string[]} [args] - arguments.
35
- * @param {object} [options] - Environment options.
36
- * @param {Adapter} [adapter] - Terminal adapter.
37
- *
38
- * @return {Environment} a new Environment instance
39
- */
40
- static createEnv(args?: string[] | undefined, options?: object | undefined, adapter?: any): Environment;
41
- /**
42
- * Factory method to create an environment instance. Take same parameters as the
43
- * Environment constructor.
44
- *
45
- * @param {String} version - Version of the Environment
46
- * @param {...any} args - Same arguments as {@link Environment}#createEnv.
47
- * @return {Environment} a new Environment instance
48
- */
49
- static createEnvWithVersion(version: string, ...args: any[]): Environment;
50
- /**
51
- * Convert a generators namespace to its name
52
- *
53
- * @param {String} namespace
54
- * @return {String}
55
- */
56
- static namespaceToName(namespace: string): string;
57
- /**
58
- * Lookup for a specific generator.
59
- *
60
- * @param {String} namespace
61
- * @param {Object} [options]
62
- * @param {Boolean} [options.localOnly=false] - Set true to skip lookups of
63
- * globally-installed generators.
64
- * @param {Boolean} [options.packagePath=false] - Set true to return the package
65
- * path instead of generators file.
66
- * @param {Boolean} [options.singleResult=true] - Set false to return multiple values.
67
- * @return {String} generator
68
- */
69
- static lookupGenerator(namespace: string, options?: {
70
- localOnly?: boolean | undefined;
71
- packagePath?: boolean | undefined;
72
- singleResult?: boolean | undefined;
73
- } | undefined): string;
74
- /**
75
- * @classdesc `Environment` object is responsible of handling the lifecyle and bootstrap
76
- * of generators in a specific environment (your app).
77
- *
78
- * It provides a high-level API to create and run generators, as well as further
79
- * tuning where and how a generator is resolved.
80
- *
81
- * An environment is created using a list of `arguments` and a Hash of
82
- * `options`. Usually, this is the list of arguments you get back from your CLI
83
- * options parser.
84
- *
85
- * An optional adapter can be passed to provide interaction in non-CLI environment
86
- * (e.g. IDE plugins), otherwise a `TerminalAdapter` is instantiated by default
87
- *
88
- * @constructor
89
- * @implements {import('@yeoman/types').BaseEnvironment}
90
- * @mixes env/resolver
91
- * @mixes env/composability
92
- * @param {String|Array} args
93
- * @param {Object} opts
94
- * @param {Boolean} [opts.experimental]
95
- * @param {Object} [opts.sharedOptions]
96
- * @param {Console} [opts.console]
97
- * @param {Stream} [opts.stdin]
98
- * @param {Stream} [opts.stdout]
99
- * @param {Stream} [opts.stderr]
100
- * @param {TerminalAdapter} [adapter] - A TerminalAdapter instance or another object
101
- * implementing this adapter interface. This is how
102
- * you'd interface Yeoman with a GUI or an editor.
103
- */
104
- constructor(options: any, adapter?: TerminalAdapter | undefined);
105
- options: any;
106
- adapter: TerminalAdapter;
107
- cwd: string;
108
- logCwd: any;
109
- store: Store;
110
- command: any;
111
- runLoop: any;
112
- sharedFs: any;
113
- fs: import("mem-fs-editor").MemFsEditor<import("mem-fs-editor").VinylMemFsEditorFile>;
114
- lookups: string[];
115
- aliases: any[];
116
- sharedOptions: any;
117
- repository: YeomanRepository;
118
- _generatorsForPath: {};
119
- _generators: {};
120
- _composeStore: {};
121
- enableConflicterIgnore: boolean;
122
- /**
123
- * Load options passed to the Generator that should be used by the Environment.
124
- *
125
- * @param {Object} options
126
- */
127
- loadEnvironmentOptions(options: Object): Partial<Object>;
128
- /**
129
- * Load options passed to the Environment that should be forwarded to the Generator.
130
- *
131
- * @param {Object} options
132
- */
133
- loadSharedOptions(options: Object): Partial<Object>;
134
- /**
135
- * @deprecated
136
- * Error handler taking `err` instance of Error.
137
- *
138
- * The `error` event is emitted with the error object, if no `error` listener
139
- * is registered, then we throw the error.
140
- *
141
- * @param {Object} err
142
- * @return {Error} err
143
- */
144
- error(error: any): Error;
145
- /**
146
- * Outputs the general help and usage. Optionally, if generators have been
147
- * registered, the list of available generators is also displayed.
148
- *
149
- * @param {String} name
150
- */
151
- help(name?: string): string;
152
- /**
153
- * Registers a specific `generator` to this environment. This generator is stored under
154
- * provided namespace, or a default namespace format if none if available.
155
- *
156
- * @param {String} name - Filepath to the a generator or a npm package name
157
- * @param {String} namespace - Namespace under which register the generator (optional)
158
- * @param {String} packagePath - PackagePath to the generator npm package (optional)
159
- * @return {Object} environment - This environment
160
- */
161
- register(name: string, namespace: string, packagePath: string): Object;
162
- /**
163
- * Register a stubbed generator to this environment. This method allow to register raw
164
- * functions under the provided namespace. `registerStub` will enforce the function passed
165
- * to extend the Base generator automatically.
166
- *
167
- * @param {Function} Generator - A Generator constructor or a simple function
168
- * @param {String} namespace - Namespace under which register the generator
169
- * @param {String} [resolved] - The file path to the generator
170
- * @param {String} [packagePath] - The generator's package path
171
- * @return {this}
172
- */
173
- registerStub(Generator: Function, namespace: string, resolved?: string | undefined, packagePath?: string | undefined): this;
174
- /**
175
- * Returns the list of registered namespace.
176
- * @return {Array}
177
- */
178
- namespaces(): any[];
179
- /**
180
- * Returns the environment or dependency version.
181
- * @param {String} packageName - Module to get version.
182
- * @return {String} Environment version.
183
- */
184
- getVersion(packageName: string): string;
185
- /**
186
- * Returns stored generators meta
187
- * @return {Object}
188
- */
189
- getGeneratorsMeta(): Object;
190
- /**
191
- * Returns stored generators meta
192
- * @param {string} namespace
193
- * @return {any}
194
- */
195
- getGeneratorMeta(namespace: string): any;
196
- /**
197
- * Get registered generators names
198
- *
199
- * @return {Array}
200
- */
201
- getGeneratorNames(): any[];
202
- /**
203
- * Verify if a package namespace already have been registered.
204
- *
205
- * @param {String} [packageNS] - namespace of the package.
206
- * @return {boolean} - true if any generator of the package has been registered
207
- */
208
- isPackageRegistered(packageNS?: string | undefined): boolean;
209
- /**
210
- * Get all registered packages namespaces.
211
- *
212
- * @return {Array} - array of namespaces.
213
- */
214
- getRegisteredPackages(): any[];
215
- /**
216
- * Get last added path for a namespace
217
- *
218
- * @param {String} - namespace
219
- * @return {String} - path of the package
220
- */
221
- getPackagePath(namespace: any): string;
222
- /**
223
- * Get paths for a namespace
224
- *
225
- * @param {String} - namespace
226
- * @return {Array} - array of paths.
227
- */
228
- getPackagePaths(namespace: any): any[];
229
- /**
230
- * Get a single generator from the registered list of generators. The lookup is
231
- * based on generator's namespace, "walking up" the namespaces until a matching
232
- * is found. Eg. if an `angular:common` namespace is registered, and we try to
233
- * get `angular:common:all` then we get `angular:common` as a fallback (unless
234
- * an `angular:common:all` generator is registered).
235
- *
236
- * @param {String} namespaceOrPath
237
- * @return {import('@yeoman/api').BaseGenerator|Promise<import('@yeoman/api').BaseGenerator>|null} - the generator registered under the namespace
238
- */
239
- get(namespaceOrPath: string): any | Promise<any> | null;
240
- /**
241
- * Get a generator by path instead of namespace.
242
- * @param {String} path
243
- * @return {Generator|null} - the generator found at the location
244
- */
245
- getByPath(path: string): Generator | null;
246
- /**
247
- * Find generator's class constructor.
248
- * @private
249
- * @param {Object} Generator - Object containing the class.
250
- * @return {Function} Generator's constructor.
251
- */
252
- private _findGeneratorClass;
253
- /**
254
- * Create is the Generator factory. It takes a namespace to lookup and optional
255
- * hash of options, that lets you define `arguments` and `options` to
256
- * instantiate the generator with.
257
- *
258
- * An error is raised on invalid namespace.
259
- *
260
- * @param {String} namespaceOrPath
261
- * @param {Array} [args]
262
- * @param {Object} [options]
263
- * @return {Generator} The instantiated generator
264
- */
265
- create(namespaceOrPath: string, args?: any[] | undefined, options?: Object | undefined): Generator;
266
- /**
267
- * Instantiate a Generator with metadatas
268
- *
269
- * @param {Class<Generator>} generator Generator class
270
- * @param {Array} [args] Arguments to pass the instance
271
- * @param {Object} [options] Options to pass the instance
272
- * @return {Generator} The instantiated generator
273
- */
274
- instantiate(Generator: any, args?: any[] | undefined, options?: Object | undefined): Generator;
275
- /**
276
- * Compose with the generator.
277
- *
278
- * @param {String} namespaceOrPath
279
- * @param {Array} [args]
280
- * @param {Object} [options]
281
- * @param {Boolean} [schedule]
282
- * @return {Generator} The instantiated generator or the singleton instance.
283
- */
284
- composeWith(generator: any, args?: any[] | undefined, options?: Object | undefined, schedule?: boolean | undefined): Generator;
285
- /**
286
- * @private
287
- */
288
- private getGeneratorsForPath;
289
- /**
290
- * @private
291
- */
292
- private getGenerator;
293
- /**
294
- * @private
295
- */
296
- private getAllGenerators;
297
- /**
298
- * @private
299
- */
300
- private setGenerator;
301
- /**
302
- * Queue generator run (queue itself tasks).
303
- *
304
- * @param {Generator} generator Generator instance
305
- * @param {boolean} [schedule=false] Whether to schedule the generator run.
306
- * @return {Generator} The generator or singleton instance.
307
- */
308
- queueGenerator(generator: Generator, schedule?: boolean | undefined): Generator;
309
- /**
310
- * Tries to locate and run a specific generator. The lookup is done depending
311
- * on the provided arguments, options and the list of registered generators.
312
- *
313
- * When the environment was unable to resolve a generator, an error is raised.
314
- *
315
- * @param {String|Array} args
316
- * @param {Object} [options]
317
- */
318
- run(args: string | any[], options?: Object | undefined, done: any): Promise<any>;
319
- /**
320
- * Start Environment queue
321
- * @param {Object} options - Conflicter options.
322
- */
323
- start(options: Object): Promise<any>;
324
- conflicter: Conflicter | undefined;
325
- /**
326
- * Convenience method to run the generator with callbackWrapper.
327
- * See https://github.com/yeoman/environment/pull/101
328
- *
329
- * @param {Object} generator
330
- */
331
- runGenerator(generator: Object): Promise<any>;
332
- compatibilityMode: string | boolean | undefined;
333
- _rootGenerator: any;
334
- /**
335
- * Get the first generator that was queued to run in this environment.
336
- *
337
- * @return {Generator} generator queued to run in this environment.
338
- */
339
- rootGenerator(): Generator;
340
- /**
341
- * Given a String `filepath`, tries to figure out the relative namespace.
342
- *
343
- * ### Examples:
344
- *
345
- * this.namespace('backbone/all/index.js');
346
- * // => backbone:all
347
- *
348
- * this.namespace('generator-backbone/model');
349
- * // => backbone:model
350
- *
351
- * this.namespace('backbone.js');
352
- * // => backbone
353
- *
354
- * this.namespace('generator-mocha/backbone/model/index.js');
355
- * // => mocha:backbone:model
356
- *
357
- * @param {String} filepath
358
- * @param {Array} lookups paths
359
- */
360
- namespace(filepath: string, lookups?: any[]): string;
361
- /**
362
- * Resolve a module path
363
- * @param {String} moduleId - Filepath or module name
364
- * @return {String} - The resolved path leading to the module
365
- */
366
- resolveModulePath(moduleId: string): string;
367
- /**
368
- * Apply transform streams to file in MemFs.
369
- * @param {Transform[]} transformStreams - transform streams to be applied.
370
- * @param {Stream} [stream] - files stream, defaults to this.sharedFs.stream().
371
- * @return {Promise<void>}
372
- */
373
- applyTransforms(transformStreams: Transform[], options?: {}): Promise<void>;
374
- /**
375
- * Commits the MemFs to the disc.
376
- * @param {Stream} [stream] - files stream, defaults to this.sharedFs.stream().
377
- * @return {Promise}
378
- */
379
- commitSharedFs(stream?: any): Promise<any>;
380
- /**
381
- * Queue environment's commit task.
382
- */
383
- queueConflicter(): void;
384
- /**
385
- * Queue environment's package manager install task.
386
- */
387
- queuePackageManagerInstall(): void;
388
- /**
389
- * Queue tasks
390
- * @param {string} priority
391
- * @param {(...args: any[]) => void | Promise<void>} task
392
- * @param {{ once?: string, startQueue?: boolean }} [options]
393
- */
394
- queueTask(priority: string, task: (...args: any[]) => void | Promise<void>, options?: {
395
- once?: string | undefined;
396
- startQueue?: boolean | undefined;
397
- } | undefined): Promise<any>;
398
- /**
399
- * Add priority
400
- * @param {string} priority
401
- * @param {string} [before]
402
- */
403
- addPriority(priority: string, before?: string | undefined): void;
404
- }
405
- import TerminalAdapter from './adapter.js';
406
- import Store from './store.js';
407
- import YeomanRepository from './util/repository.js';
408
- import Conflicter from './util/conflicter.js';
409
- import YeomanCommand from './util/command.js';