@yeoman/types 1.2.1 → 1.4.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": "@yeoman/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Common API for yeoman's generator/environment stack",
|
|
6
6
|
"keywords": [
|
|
@@ -25,22 +25,20 @@
|
|
|
25
25
|
"test": ""
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@types/node": "^16.18.26"
|
|
28
|
+
"@types/node": "^16.18.26",
|
|
29
|
+
"@yeoman/adapter": "^1.6.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@
|
|
32
|
+
"@yeoman/adapter": "^1.6.0",
|
|
32
33
|
"mem-fs": "^3.0.0",
|
|
33
34
|
"mem-fs-editor": "^10.0.2"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
36
|
-
"@
|
|
37
|
+
"@yeoman/adapter": "^1.6.0",
|
|
37
38
|
"mem-fs": "^3.0.0",
|
|
38
39
|
"mem-fs-editor": "^10.0.2"
|
|
39
40
|
},
|
|
40
41
|
"peerDependenciesMeta": {
|
|
41
|
-
"inquirer": {
|
|
42
|
-
"optional": true
|
|
43
|
-
},
|
|
44
42
|
"mem-fs": {
|
|
45
43
|
"optional": true
|
|
46
44
|
},
|
|
@@ -59,5 +57,5 @@
|
|
|
59
57
|
"mem-fs": "^4.0.0-beta.1",
|
|
60
58
|
"mem-fs-editor": ">=10.0.2"
|
|
61
59
|
},
|
|
62
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "7c9c24374b1b166bd01b3dbcfdd6ce6976de87b3"
|
|
63
61
|
}
|
|
@@ -5,7 +5,7 @@ import type { MemFsEditorFile } from 'mem-fs-editor';
|
|
|
5
5
|
import type { BaseGeneratorOptions } from '../generator/generator-options.js';
|
|
6
6
|
import type { BaseGenerator, BaseGeneratorConstructor } from '../generator/generator.js';
|
|
7
7
|
import type { GetGeneratorConstructor } from '../generator/utils.js';
|
|
8
|
-
import type { InputOutputAdapter } from '
|
|
8
|
+
import type { InputOutputAdapter } from '@yeoman/adapter/types';
|
|
9
9
|
import type {
|
|
10
10
|
BaseGeneratorMeta,
|
|
11
11
|
ComposeOptions,
|
|
@@ -72,9 +72,9 @@ export type BaseEnvironment<A = InputOutputAdapter, S extends Store<MemFsEditorF
|
|
|
72
72
|
*/
|
|
73
73
|
logCwd: string;
|
|
74
74
|
|
|
75
|
-
emit(eventName: string | symbol, ...
|
|
76
|
-
on(eventName: string | symbol, listener: (...
|
|
77
|
-
once(eventName: string | symbol, listener: (...
|
|
75
|
+
emit(eventName: string | symbol, ...arguments_: any[]): boolean;
|
|
76
|
+
on(eventName: string | symbol, listener: (...arguments_: any[]) => void): unknown;
|
|
77
|
+
once(eventName: string | symbol, listener: (...arguments_: any[]) => void): unknown;
|
|
78
78
|
|
|
79
79
|
applyTransforms(transformStreams: Transform[], options?: ApplyTransformsOptions): Promise<void>;
|
|
80
80
|
|
|
@@ -178,7 +178,11 @@ export type BaseEnvironment<A = InputOutputAdapter, S extends Store<MemFsEditorF
|
|
|
178
178
|
* @param task
|
|
179
179
|
* @param options
|
|
180
180
|
*/
|
|
181
|
-
queueTask(
|
|
181
|
+
queueTask(
|
|
182
|
+
priority: string,
|
|
183
|
+
task: (...arguments_: any[]) => void | Promise<void>,
|
|
184
|
+
options?: { once?: string; startQueue?: boolean },
|
|
185
|
+
): void;
|
|
182
186
|
|
|
183
187
|
/**
|
|
184
188
|
* Add priority
|
|
@@ -71,7 +71,7 @@ export type GeneratorMeta = BaseGeneratorMeta & {
|
|
|
71
71
|
/** Import the module `import(meta.resolved)` */
|
|
72
72
|
importModule?: () => Promise<unknown>;
|
|
73
73
|
/** Intantiate the Generator `env.instantiate(await meta.importGenerator())` */
|
|
74
|
-
instantiate: (
|
|
74
|
+
instantiate: (arguments_?: string[], options?: any) => Promise<BaseGenerator>;
|
|
75
75
|
/** Intantiate the Generator passing help option */
|
|
76
76
|
instantiateHelp: () => Promise<BaseGenerator>;
|
|
77
77
|
};
|
|
@@ -6,9 +6,9 @@ export type EnvironmentGenerator = {
|
|
|
6
6
|
readonly env: BaseEnvironment;
|
|
7
7
|
readonly features: unknown;
|
|
8
8
|
|
|
9
|
-
emit(eventName: string | symbol, ...
|
|
10
|
-
on(eventName: string | symbol, listener: (...
|
|
11
|
-
once(eventName: string | symbol, listener: (...
|
|
9
|
+
emit(eventName: string | symbol, ...arguments_: any[]): boolean;
|
|
10
|
+
on(eventName: string | symbol, listener: (...arguments_: any[]) => void): unknown;
|
|
11
|
+
once(eventName: string | symbol, listener: (...arguments_: any[]) => void): unknown;
|
|
12
12
|
|
|
13
13
|
_postConstruct?(): Promise<void>;
|
|
14
14
|
|
|
@@ -38,4 +38,5 @@ export type BaseGenerator<
|
|
|
38
38
|
export type BaseGeneratorConstructor<
|
|
39
39
|
O extends GeneratorOptions = GeneratorOptions,
|
|
40
40
|
F extends GeneratorFeatures = GeneratorFeatures,
|
|
41
|
-
> = (new (
|
|
41
|
+
> = (new (arguments_?: string[], options?: O, features?: F) => BaseGenerator<O, F>) &
|
|
42
|
+
(new (options?: O, features?: F) => BaseGenerator<O, F>);
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from '@yeoman/adapter/types';
|
|
2
2
|
export * from './environment/environment.js';
|
|
3
|
-
export * from './environment/logger.js';
|
|
4
3
|
export * from './environment/methods-options.js';
|
|
5
4
|
|
|
6
5
|
export * from './generator/generator-features.js';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { DistinctQuestion, Answers as InquirerAnswers } from 'inquirer';
|
|
2
|
-
import type { Logger } from './logger.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Represents an answer-hash.
|
|
6
|
-
*/
|
|
7
|
-
export type PromptAnswers = InquirerAnswers;
|
|
8
|
-
|
|
9
|
-
export type PromptQuestion<A extends PromptAnswers = PromptAnswers> = DistinctQuestion<A>;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Provides a set of questions.
|
|
13
|
-
*/
|
|
14
|
-
export type PromptQuestions<A extends PromptAnswers = PromptAnswers> = PromptQuestion<A> | Array<PromptQuestion<A>>; // | Observable<Question<A>>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Abstraction layer that defines the I/O interactions.
|
|
18
|
-
*
|
|
19
|
-
* It provides a CLI interaction
|
|
20
|
-
*/
|
|
21
|
-
export type InputOutputAdapter = {
|
|
22
|
-
/**
|
|
23
|
-
* A component for logging messages.
|
|
24
|
-
*/
|
|
25
|
-
log: Logger;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Prompts the user for one or more questions.
|
|
29
|
-
*
|
|
30
|
-
* @param questions The questions to prompt.
|
|
31
|
-
* @param initialAnswers Initial answers.
|
|
32
|
-
*/
|
|
33
|
-
prompt<A extends PromptAnswers = PromptAnswers>(questions: PromptQuestions<A>, initialAnswers?: Partial<A>): Promise<A>;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Close underline inputs.
|
|
37
|
-
*/
|
|
38
|
-
close(): void;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
type Task<TaskResultType> =
|
|
42
|
-
| ((adapter: InputOutputAdapter) => PromiseLike<TaskResultType>)
|
|
43
|
-
| ((adapter: InputOutputAdapter) => TaskResultType);
|
|
44
|
-
|
|
45
|
-
export type ProgressCallback<ReturnType> = (progress: { step: (prefix: string, message: string, ...args: any[]) => void }) => ReturnType;
|
|
46
|
-
export type ProgressOptions = { disabled?: boolean; name?: string };
|
|
47
|
-
|
|
48
|
-
export type QueuedAdapter = InputOutputAdapter & {
|
|
49
|
-
queue<TaskResultType>(fn: Task<TaskResultType>): Promise<void | TaskResultType>;
|
|
50
|
-
progress<ResultType>(fn: ProgressCallback<ResultType>, options?: ProgressOptions): Promise<void | ResultType>;
|
|
51
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { format } from 'node:util';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Provides default color-categories.
|
|
5
|
-
*/
|
|
6
|
-
export type DefaultLoggerCategories = 'skip' | 'force' | 'create' | 'invoke' | 'conflict' | 'identical' | 'info' | 'added' | 'removed';
|
|
7
|
-
|
|
8
|
-
export type ColoredMessage<Color extends string | number | symbol = DefaultLoggerCategories> = {
|
|
9
|
-
/**
|
|
10
|
-
* Text content.
|
|
11
|
-
*/
|
|
12
|
-
message: string;
|
|
13
|
-
/**
|
|
14
|
-
* Color to apply.
|
|
15
|
-
*/
|
|
16
|
-
color?: Color;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Provides the functionality to log messages.
|
|
21
|
-
*/
|
|
22
|
-
export type Logger<LoggerCategories extends string | number | symbol = DefaultLoggerCategories> = {
|
|
23
|
-
/**
|
|
24
|
-
* Logs a message of the specified category.
|
|
25
|
-
*/
|
|
26
|
-
[P in LoggerCategories]: (...args: Parameters<typeof format>) => Logger<LoggerCategories>;
|
|
27
|
-
} & {
|
|
28
|
-
/**
|
|
29
|
-
* Writes a log-message.
|
|
30
|
-
*
|
|
31
|
-
* @param format
|
|
32
|
-
* The format of the log-messages.
|
|
33
|
-
* See <https://github.com/mikeal/logref> for more info.
|
|
34
|
-
*
|
|
35
|
-
* @param params
|
|
36
|
-
* The parameters to replace variables with.
|
|
37
|
-
*/
|
|
38
|
-
(format?: string, parameters?: Record<string, any>): Logger<LoggerCategories>;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Writes a log-message.
|
|
42
|
-
*/
|
|
43
|
-
(message?: any, ...optionalParameters: any[]): Logger<LoggerCategories>;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Writes a log-message.
|
|
47
|
-
*/
|
|
48
|
-
write(...args: Parameters<typeof format>): Logger<LoggerCategories>;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Writes a log-message with an appended newline character.
|
|
52
|
-
*/
|
|
53
|
-
writeln(...args: Parameters<typeof format>): Logger<LoggerCategories>;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Writes a success status with a check mark `✔`.
|
|
57
|
-
*/
|
|
58
|
-
ok(...args: Parameters<typeof format>): Logger<LoggerCategories>;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Writes an error-message with a prepended cross mark.
|
|
62
|
-
*/
|
|
63
|
-
error(...args: Parameters<typeof format>): Logger<LoggerCategories>;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @since `yeoman-environment` version 3.17.0
|
|
67
|
-
* Shows a colored message.
|
|
68
|
-
*/
|
|
69
|
-
colored(coloredMessage: Array<ColoredMessage<LoggerCategories>>): Logger<LoggerCategories>;
|
|
70
|
-
};
|