@yeoman/types 0.1.4 → 0.3.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": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Common API for yeoman's generator/environment stack",
|
|
6
6
|
"keywords": [
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"access": "public",
|
|
56
56
|
"registry": "https://registry.npmjs.org/"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "6d33420db41115e6d1867dede74000470d245a6e"
|
|
59
59
|
}
|
|
@@ -36,14 +36,12 @@ export type InputOutputAdapter = {
|
|
|
36
36
|
* Close underline inputs.
|
|
37
37
|
*/
|
|
38
38
|
close(): void;
|
|
39
|
+
};
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
* @returns The formatted message.
|
|
47
|
-
*/
|
|
48
|
-
diff(actual: string, expected: string, changes: unknown[]): string;
|
|
41
|
+
type Task<TaskResultType> =
|
|
42
|
+
| ((adapter: InputOutputAdapter) => PromiseLike<TaskResultType>)
|
|
43
|
+
| ((adapter: InputOutputAdapter) => TaskResultType);
|
|
44
|
+
|
|
45
|
+
export type QueuedAdapter = InputOutputAdapter & {
|
|
46
|
+
queue<TaskResultType>(fn: Task<TaskResultType>): Promise<void | TaskResultType>;
|
|
49
47
|
};
|
|
@@ -2,7 +2,7 @@ import type { Transform } from 'node:stream';
|
|
|
2
2
|
import type { Store } from 'mem-fs';
|
|
3
3
|
import type { MemFsEditorFile } from 'mem-fs-editor';
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type { BaseGeneratorOptions } from '../generator/generator-options.js';
|
|
6
6
|
import type { BaseGenerator } from '../generator/generator.js';
|
|
7
7
|
import type { GetGeneratorConstructor, GetGeneratorOptions } from '../generator/utils.js';
|
|
8
8
|
import type { InputOutputAdapter } from './adapter.js';
|
|
@@ -12,7 +12,7 @@ export type EnvironmentConstructor<A extends InputOutputAdapter = InputOutputAda
|
|
|
12
12
|
adapter?: A,
|
|
13
13
|
) => BaseEnvironment<A>;
|
|
14
14
|
|
|
15
|
-
export type BaseEnvironmentOptions =
|
|
15
|
+
export type BaseEnvironmentOptions = BaseGeneratorOptions & {
|
|
16
16
|
/**
|
|
17
17
|
* The working-directory of the environment.
|
|
18
18
|
*/
|
|
@@ -26,7 +26,7 @@ export type BaseEnvironmentOptions = GeneratorBaseOptions & {
|
|
|
26
26
|
/**
|
|
27
27
|
* Options to pass to every generator instantiated by this Environment.
|
|
28
28
|
*/
|
|
29
|
-
sharedOptions?:
|
|
29
|
+
sharedOptions?: BaseGeneratorOptions;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* `mem-fs` Store.
|
|
@@ -41,7 +41,7 @@ export type ApplyTransformsOptions = {
|
|
|
41
41
|
streamOptions: Parameters<Store<MemFsEditorFile>['stream']>[0];
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export type BaseEnvironment<A = InputOutputAdapter, S extends Store = Store
|
|
44
|
+
export type BaseEnvironment<A = InputOutputAdapter, S extends Store<MemFsEditorFile> = Store<MemFsEditorFile>> = {
|
|
45
45
|
cwd: string;
|
|
46
46
|
adapter: A;
|
|
47
47
|
sharedFs: S;
|
|
@@ -53,13 +53,13 @@ export type BaseEnvironment<A = InputOutputAdapter, S extends Store = Store> = {
|
|
|
53
53
|
create<G extends BaseGenerator = BaseGenerator>(
|
|
54
54
|
namespaceOrPath: string | GetGeneratorConstructor<G>,
|
|
55
55
|
args: string[],
|
|
56
|
-
options?: Partial<Omit<GetGeneratorOptions<G>, 'env' | 'resolved' | '
|
|
56
|
+
options?: Partial<Omit<GetGeneratorOptions<G>, 'env' | 'resolved' | 'namespace'>>,
|
|
57
57
|
): Promise<G>;
|
|
58
58
|
|
|
59
59
|
instantiate<G extends BaseGenerator = BaseGenerator>(
|
|
60
60
|
generator: GetGeneratorConstructor<G>,
|
|
61
61
|
args: string[],
|
|
62
|
-
options?: Partial<Omit<GetGeneratorOptions<G>, 'env' | 'resolved' | '
|
|
62
|
+
options?: Partial<Omit<GetGeneratorOptions<G>, 'env' | 'resolved' | 'namespace'>>,
|
|
63
63
|
): Promise<G>;
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -97,7 +97,7 @@ export type BaseEnvironment<A = InputOutputAdapter, S extends Store = Store> = {
|
|
|
97
97
|
* @param namespace The namespace under which the generator should be registered.
|
|
98
98
|
* @param packagePath The path to the npm package of the generator.
|
|
99
99
|
*/
|
|
100
|
-
register(filePath: string, namespace?: string, packagePath?: string):
|
|
100
|
+
register(filePath: string, namespace?: string, packagePath?: string): void;
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* Registers a stubbed generator to this environment.
|
|
@@ -115,7 +115,7 @@ export type BaseEnvironment<A = InputOutputAdapter, S extends Store = Store> = {
|
|
|
115
115
|
* @param task
|
|
116
116
|
* @param options
|
|
117
117
|
*/
|
|
118
|
-
queueTask(priority: string, task: (...args: any[]) => void | Promise<void>, options?: { once?: string
|
|
118
|
+
queueTask(priority: string, task: (...args: any[]) => void | Promise<void>, options?: { once?: string; startQueue?: boolean }): void;
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
121
|
* Add priority
|
|
@@ -3,7 +3,18 @@ import type { format } from 'node:util';
|
|
|
3
3
|
/**
|
|
4
4
|
* Provides default color-categories.
|
|
5
5
|
*/
|
|
6
|
-
export type DefaultLoggerCategories = 'skip' | 'force' | 'create' | 'invoke' | 'conflict' | 'identical' | 'info';
|
|
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
|
+
};
|
|
7
18
|
|
|
8
19
|
/**
|
|
9
20
|
* Provides the functionality to log messages.
|
|
@@ -50,4 +61,10 @@ export type Logger<LoggerCategories extends string | number | symbol = DefaultLo
|
|
|
50
61
|
* Writes an error-message with a prepended cross mark.
|
|
51
62
|
*/
|
|
52
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>;
|
|
53
70
|
};
|
|
@@ -2,7 +2,7 @@ import type { BaseEnvironment } from '../environment/environment.js';
|
|
|
2
2
|
|
|
3
3
|
export type GeneratorCustomOptions = Record<string, unknown>;
|
|
4
4
|
|
|
5
|
-
export type
|
|
5
|
+
export type BaseGeneratorOptions = {
|
|
6
6
|
/**
|
|
7
7
|
* Skip package manager install task.
|
|
8
8
|
*/
|
|
@@ -58,7 +58,7 @@ type GeneratorHelpOptions<H extends boolean | undefined> = {
|
|
|
58
58
|
help: H;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
export type GeneratorOptions =
|
|
61
|
+
export type GeneratorOptions = BaseGeneratorOptions &
|
|
62
62
|
GeneratorNamespace &
|
|
63
63
|
(
|
|
64
64
|
| (GeneratorHelpOptions<false | undefined> & GeneratorEnvironmentOptions)
|