@yeoman/types 1.0.0 → 1.1.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.0.0",
3
+ "version": "1.1.0",
4
4
  "private": false,
5
5
  "description": "Common API for yeoman's generator/environment stack",
6
6
  "keywords": [
@@ -56,5 +56,9 @@
56
56
  "access": "public",
57
57
  "registry": "https://registry.npmjs.org/"
58
58
  },
59
- "gitHead": "cb5b453d1e92fcc70874d4cdaea77cf90fdd60f7"
59
+ "acceptDependencies": {
60
+ "mem-fs": ">=3.0.0",
61
+ "mem-fs-editor": ">=10.0.2"
62
+ },
63
+ "gitHead": "2baf8182008a615c9354e4bf980b7dba4d74b81d"
60
64
  }
@@ -42,6 +42,10 @@ type Task<TaskResultType> =
42
42
  | ((adapter: InputOutputAdapter) => PromiseLike<TaskResultType>)
43
43
  | ((adapter: InputOutputAdapter) => TaskResultType);
44
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
+
45
48
  export type QueuedAdapter = InputOutputAdapter & {
46
49
  queue<TaskResultType>(fn: Task<TaskResultType>): Promise<void | TaskResultType>;
50
+ progress<ResultType>(fn: ProgressCallback<ResultType>, options?: ProgressOptions): Promise<void | ResultType>;
47
51
  };
@@ -16,16 +16,22 @@ import type {
16
16
  } from './methods-options.js';
17
17
 
18
18
  export type EnvironmentConstructor<A extends InputOutputAdapter = InputOutputAdapter> = new (
19
- options?: BaseEnvironmentOptions,
19
+ options?: BaseEnvironmentOptions<A>,
20
+ /** @deprecated */
20
21
  adapter?: A,
21
22
  ) => BaseEnvironment<A>;
22
23
 
23
- export type BaseEnvironmentOptions = BaseGeneratorOptions & {
24
+ export type BaseEnvironmentOptions<A extends InputOutputAdapter = InputOutputAdapter> = BaseGeneratorOptions & {
24
25
  /**
25
26
  * The working-directory of the environment.
26
27
  */
27
28
  cwd?: string | undefined;
28
29
 
30
+ /**
31
+ * The working-directory for logs.
32
+ */
33
+ logCwd?: string | undefined;
34
+
29
35
  /**
30
36
  * A value indicating whether the experimental features should be enabled.
31
37
  */
@@ -40,6 +46,11 @@ export type BaseEnvironmentOptions = BaseGeneratorOptions & {
40
46
  * `mem-fs` Store.
41
47
  */
42
48
  sharedFs?: Store;
49
+
50
+ /**
51
+ * Input/Output adapter.
52
+ */
53
+ adapter?: A;
43
54
  };
44
55
 
45
56
  export type ApplyTransformsOptions = {
@@ -56,6 +67,10 @@ export type BaseEnvironment<A = InputOutputAdapter, S extends Store<MemFsEditorF
56
67
  cwd: string;
57
68
  adapter: A;
58
69
  sharedFs: S;
70
+ /**
71
+ * The working-directory for logs.
72
+ */
73
+ logCwd: string;
59
74
 
60
75
  emit(eventName: string | symbol, ...args: any[]): boolean;
61
76
  on(eventName: string | symbol, listener: (...args: any[]) => void): unknown;