@yeoman/types 0.1.4 → 0.2.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.1.4",
3
+ "version": "0.2.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": "97588cdda4231d1e760707bca22f4bec65785cd3"
58
+ "gitHead": "1982816cfe6af4e92f999e344cf9b8539ff308eb"
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
- * Shows a color-based diff of two strings.
42
- *
43
- * @param actual The actual text.
44
- * @param expected The expected text.
45
- * @param changes The changes returned by `diff`.
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
  };
@@ -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, startQueue?: boolean }): void;
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
  };