@flowscripter/dynamic-cli-framework 5.1.2 → 5.1.4
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/dist/src/service/plugin/SpawnInterfaceAdapter.d.ts +4 -2
- package/dist/src/service/plugin/SpawnInterfaceAdapter.d.ts.map +1 -1
- package/dist/src/service/plugin/SpawnInterfaceAdapter.js +13 -3
- package/dist/src/service/printer/DefaultPrinterService.d.ts +7 -0
- package/dist/src/service/printer/DefaultPrinterService.d.ts.map +1 -1
- package/dist/src/service/printer/DefaultPrinterService.js +15 -0
- package/dist/src/service/printer/terminal/Quote.js +1 -1
- package/dist/src/service/spawn/DefaultSpawnService.d.ts.map +1 -1
- package/dist/src/service/spawn/DefaultSpawnService.js +11 -2
- package/dist/src/terminal/Ansi.d.ts +2 -0
- package/dist/src/terminal/Ansi.d.ts.map +1 -1
- package/dist/src/terminal/Ansi.js +2 -0
- package/dist/src/terminal/Styler.d.ts +1 -0
- package/dist/src/terminal/Styler.d.ts.map +1 -1
- package/dist/src/terminal/TtyStyler.d.ts +1 -0
- package/dist/src/terminal/TtyStyler.d.ts.map +1 -1
- package/dist/src/terminal/TtyStyler.js +7 -1
- package/package.json +2 -2
- package/src/service/plugin/SpawnInterfaceAdapter.ts +12 -3
- package/src/service/printer/DefaultPrinterService.ts +17 -0
- package/src/service/printer/terminal/Quote.ts +1 -1
- package/src/service/spawn/DefaultSpawnService.ts +11 -2
- package/src/terminal/Ansi.ts +2 -0
- package/src/terminal/Styler.ts +1 -0
- package/src/terminal/TtyStyler.ts +9 -0
|
@@ -6,8 +6,10 @@ export interface SpawnInterfaceAdapterOptions {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Adapts a {@link SpawnService} to dynamic-plugin-framework's {@link SpawnInterface}, wrapping
|
|
9
|
-
* spawned process output in a quoted, marked block via {@link PrinterService}
|
|
10
|
-
*
|
|
9
|
+
* spawned process output in a quoted, marked block via {@link PrinterService}. On success the
|
|
10
|
+
* block is cleared once the process exits (subject to
|
|
11
|
+
* {@link SpawnInterfaceAdapterOptions.markMinimumDisplayTimeMs}); on failure the block is left
|
|
12
|
+
* on screen so the diagnostic output from the failing command remains visible.
|
|
11
13
|
*/
|
|
12
14
|
export default class SpawnInterfaceAdapter implements SpawnInterface {
|
|
13
15
|
#private;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpawnInterfaceAdapter.d.ts","sourceRoot":"","sources":["../../../../src/service/plugin/SpawnInterfaceAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAE1F,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED
|
|
1
|
+
{"version":3,"file":"SpawnInterfaceAdapter.d.ts","sourceRoot":"","sources":["../../../../src/service/plugin/SpawnInterfaceAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAE1F,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,YAAW,cAAc;;gBAOhE,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,OAAO,GAAE,4BAAiC;IAQ/B,KAAK,CAChB,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GACvB,OAAO,CAAC,WAAW,CAAC;CAsCxB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Adapts a {@link SpawnService} to dynamic-plugin-framework's {@link SpawnInterface}, wrapping
|
|
3
|
-
* spawned process output in a quoted, marked block via {@link PrinterService}
|
|
4
|
-
*
|
|
3
|
+
* spawned process output in a quoted, marked block via {@link PrinterService}. On success the
|
|
4
|
+
* block is cleared once the process exits (subject to
|
|
5
|
+
* {@link SpawnInterfaceAdapterOptions.markMinimumDisplayTimeMs}); on failure the block is left
|
|
6
|
+
* on screen so the diagnostic output from the failing command remains visible.
|
|
5
7
|
*/
|
|
6
8
|
export default class SpawnInterfaceAdapter {
|
|
7
9
|
#spawnService;
|
|
@@ -32,7 +34,15 @@ export default class SpawnInterfaceAdapter {
|
|
|
32
34
|
await writeQueue;
|
|
33
35
|
this.#printerService.endQuote();
|
|
34
36
|
this.#printerService.endMark();
|
|
35
|
-
|
|
37
|
+
if (result.ok) {
|
|
38
|
+
await this.#printerService.clearMarked(this.#markMinimumDisplayTimeMs);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// Leave the marked/quoted output on screen so the failing command's diagnostic output is
|
|
42
|
+
// visible, but still reset the mark/quote bookkeeping so a subsequent spawn() can start a
|
|
43
|
+
// fresh mark region.
|
|
44
|
+
this.#printerService.discardMark();
|
|
45
|
+
}
|
|
36
46
|
if (result.ok) {
|
|
37
47
|
return { ok: true, exitCode: result.exitCode };
|
|
38
48
|
}
|
|
@@ -22,6 +22,7 @@ export default class DefaultPrinterService implements PrinterService {
|
|
|
22
22
|
emphasised(message: string): string;
|
|
23
23
|
selected(message: string): string;
|
|
24
24
|
italic(message: string): string;
|
|
25
|
+
dim(message: string): string;
|
|
25
26
|
yellow(message: string): string;
|
|
26
27
|
orange(message: string): string;
|
|
27
28
|
red(message: string): string;
|
|
@@ -53,6 +54,12 @@ export default class DefaultPrinterService implements PrinterService {
|
|
|
53
54
|
endQuote(): void;
|
|
54
55
|
startMark(): void;
|
|
55
56
|
endMark(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Stop tracking rows for the current mark region without erasing them - e.g. when the marked
|
|
59
|
+
* output should be left on screen (such as a spawned command's output on failure), but the
|
|
60
|
+
* mark/quote bookkeeping still needs to be reset so a later startMark() doesn't throw.
|
|
61
|
+
*/
|
|
62
|
+
discardMark(): void;
|
|
56
63
|
clearMarked(minimumDisplayTimeMs?: number): Promise<void>;
|
|
57
64
|
setLevel(level: Level): Promise<void>;
|
|
58
65
|
getLevel(): Level;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultPrinterService.d.ts","sourceRoot":"","sources":["../../../../src/service/printer/DefaultPrinterService.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EACL,KAAK,IAAI,EACT,KAAK,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,qBAAsB,YAAW,cAAc;;IAClE,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;gBAyCtC,oBAAoB,EAAE,cAAc,EACpC,oBAAoB,EAAE,cAAc,EACpC,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,OAAO,EACtB,cAAc,EAAE,QAAQ,EACxB,cAAc,EAAE,QAAQ,EACxB,MAAM,EAAE,MAAM;IAgBhB,IAAI,YAAY,CAAC,OAAO,EAAE,OAAO,EAQhC;IAED,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,IAAI,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAErC;IAED,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AAI;CAMlF"}
|
|
@@ -118,6 +118,9 @@ export default class DefaultPrinterService {
|
|
|
118
118
|
italic(message) {
|
|
119
119
|
return this.#styler.italicText(message);
|
|
120
120
|
}
|
|
121
|
+
dim(message) {
|
|
122
|
+
return this.#styler.dimText(message);
|
|
123
|
+
}
|
|
121
124
|
yellow(message) {
|
|
122
125
|
return this.#styler.colorText(message, this.#theme[Color.YELLOW]);
|
|
123
126
|
}
|
|
@@ -241,6 +244,18 @@ export default class DefaultPrinterService {
|
|
|
241
244
|
}
|
|
242
245
|
this.#markEndedAt = Date.now();
|
|
243
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Stop tracking rows for the current mark region without erasing them - e.g. when the marked
|
|
249
|
+
* output should be left on screen (such as a spawned command's output on failure), but the
|
|
250
|
+
* mark/quote bookkeeping still needs to be reset so a later startMark() doesn't throw.
|
|
251
|
+
*/
|
|
252
|
+
discardMark() {
|
|
253
|
+
if (this.#markedLineCount === undefined) {
|
|
254
|
+
throw new Error("discardMark() called without a preceding startMark()");
|
|
255
|
+
}
|
|
256
|
+
this.#markedLineCount = undefined;
|
|
257
|
+
this.#markEndedAt = undefined;
|
|
258
|
+
}
|
|
244
259
|
async clearMarked(minimumDisplayTimeMs = 0) {
|
|
245
260
|
if (this.#markedLineCount === undefined || this.#markEndedAt === undefined) {
|
|
246
261
|
throw new Error("clearMarked() called without a preceding endMark()");
|
|
@@ -44,7 +44,7 @@ export default class Quote {
|
|
|
44
44
|
}
|
|
45
45
|
const endsWithNewline = message.endsWith("\n");
|
|
46
46
|
const raw = endsWithNewline ? message.slice(0, -1) : message;
|
|
47
|
-
const lines = raw.split("\n").map((line) => this.#prefixLine() + line);
|
|
47
|
+
const lines = raw.split("\n").map((line) => this.#prefixLine() + this.#styler.dimText(line));
|
|
48
48
|
return lines.join("\n") + (endsWithNewline ? "\n" : "");
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultSpawnService.d.ts","sourceRoot":"","sources":["../../../../src/service/spawn/DefaultSpawnService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,WAAW,EACX,YAAY,EACb,MAAM,yCAAyC,CAAC;AAOjD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAa3E;AAED,MAAM,CAAC,OAAO,OAAO,mBAAoB,YAAW,YAAY;;IAIvD,eAAe,CAAC,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,GAAG,IAAI;IAkDjF,KAAK,CAChB,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"DefaultSpawnService.d.ts","sourceRoot":"","sources":["../../../../src/service/spawn/DefaultSpawnService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,WAAW,EACX,YAAY,EACb,MAAM,yCAAyC,CAAC;AAOjD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAa3E;AAED,MAAM,CAAC,OAAO,OAAO,mBAAoB,YAAW,YAAY;;IAIvD,eAAe,CAAC,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,GAAG,IAAI;IAkDjF,KAAK,CAChB,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC;CAuFxB"}
|
|
@@ -99,14 +99,21 @@ export default class DefaultSpawnService {
|
|
|
99
99
|
}
|
|
100
100
|
await this.#terminate(proc, command);
|
|
101
101
|
});
|
|
102
|
+
// These are intentionally not awaited here - they only complete once the child's stdout/
|
|
103
|
+
// stderr streams reach EOF, which can happen slightly after proc.exited resolves. They are
|
|
104
|
+
// awaited below, before returning, so that every onOutput callback (and thus every write it
|
|
105
|
+
// triggers) is guaranteed to have completed before the caller acts on the result.
|
|
106
|
+
let pipeStdout = Promise.resolve();
|
|
107
|
+
let pipeStderr = Promise.resolve();
|
|
102
108
|
if (mode === "wrapped" && options.onOutput) {
|
|
103
109
|
const onOutput = options.onOutput;
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
pipeStdout = this.#pipeLines(proc.stdout, "stdout", onOutput);
|
|
111
|
+
pipeStderr = this.#pipeLines(proc.stderr, "stderr", onOutput);
|
|
106
112
|
}
|
|
107
113
|
try {
|
|
108
114
|
if (options.timeoutMs === undefined) {
|
|
109
115
|
const exitCode = await proc.exited;
|
|
116
|
+
await Promise.all([pipeStdout, pipeStderr]);
|
|
110
117
|
settled = true;
|
|
111
118
|
return exitCode === 0 ? { ok: true, exitCode } : { ok: false, exitCode };
|
|
112
119
|
}
|
|
@@ -121,10 +128,12 @@ export default class DefaultSpawnService {
|
|
|
121
128
|
if (timedOut) {
|
|
122
129
|
logger.debug(() => `Command '${command.join(" ")}' timed out after ${options.timeoutMs}ms`);
|
|
123
130
|
await this.#terminate(proc, command);
|
|
131
|
+
await Promise.all([pipeStdout, pipeStderr]);
|
|
124
132
|
settled = true;
|
|
125
133
|
return { ok: false, timedOut: true };
|
|
126
134
|
}
|
|
127
135
|
const exitCode = await proc.exited;
|
|
136
|
+
await Promise.all([pipeStdout, pipeStderr]);
|
|
128
137
|
settled = true;
|
|
129
138
|
return exitCode === 0 ? { ok: true, exitCode } : { ok: false, exitCode };
|
|
130
139
|
}
|
|
@@ -5,6 +5,8 @@ export declare const HIDE_CURSOR: string;
|
|
|
5
5
|
export declare const SHOW_CURSOR: string;
|
|
6
6
|
export declare const ITALIC_START: string;
|
|
7
7
|
export declare const ITALIC_END: string;
|
|
8
|
+
export declare const DIM_START: string;
|
|
9
|
+
export declare const DIM_END: string;
|
|
8
10
|
export declare const FOREGROUND_COLOR_END: string;
|
|
9
11
|
export declare const BACKGROUND_COLOR_END: string;
|
|
10
12
|
export declare const HYPERLINK_END = "\u001B]8;;\u0007";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ansi.d.ts","sourceRoot":"","sources":["../../../src/terminal/Ansi.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,QAAa,CAAC;AACrC,eAAO,MAAM,WAAW,QAAY,CAAC;AACrC,eAAO,MAAM,SAAS,QAAa,CAAC;AACpC,eAAO,MAAM,WAAW,QAAe,CAAC;AACxC,eAAO,MAAM,WAAW,QAAe,CAAC;AACxC,eAAO,MAAM,YAAY,QAAa,CAAC;AACvC,eAAO,MAAM,UAAU,QAAc,CAAC;AACtC,eAAO,MAAM,oBAAoB,QAAc,CAAC;AAChD,eAAO,MAAM,oBAAoB,QAAc,CAAC;AAChD,eAAO,MAAM,aAAa,qBAA8B,CAAC;AAEzD,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
1
|
+
{"version":3,"file":"Ansi.d.ts","sourceRoot":"","sources":["../../../src/terminal/Ansi.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU,QAAa,CAAC;AACrC,eAAO,MAAM,WAAW,QAAY,CAAC;AACrC,eAAO,MAAM,SAAS,QAAa,CAAC;AACpC,eAAO,MAAM,WAAW,QAAe,CAAC;AACxC,eAAO,MAAM,WAAW,QAAe,CAAC;AACxC,eAAO,MAAM,YAAY,QAAa,CAAC;AACvC,eAAO,MAAM,UAAU,QAAc,CAAC;AACtC,eAAO,MAAM,SAAS,QAAa,CAAC;AACpC,eAAO,MAAM,OAAO,QAAc,CAAC;AACnC,eAAO,MAAM,oBAAoB,QAAc,CAAC;AAChD,eAAO,MAAM,oBAAoB,QAAc,CAAC;AAChD,eAAO,MAAM,aAAa,qBAA8B,CAAC;AAEzD,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -9,6 +9,8 @@ export const HIDE_CURSOR = CSI + "?25l";
|
|
|
9
9
|
export const SHOW_CURSOR = CSI + "?25h";
|
|
10
10
|
export const ITALIC_START = CSI + "3m";
|
|
11
11
|
export const ITALIC_END = CSI + "23m";
|
|
12
|
+
export const DIM_START = CSI + "2m";
|
|
13
|
+
export const DIM_END = CSI + "22m";
|
|
12
14
|
export const FOREGROUND_COLOR_END = CSI + "39m";
|
|
13
15
|
export const BACKGROUND_COLOR_END = CSI + "49m";
|
|
14
16
|
export const HYPERLINK_END = `${OSC}8${SEP}${SEP}${BEL}`;
|
|
@@ -4,6 +4,7 @@ export default interface Styler {
|
|
|
4
4
|
colorText(text: string, colorValue: number): string;
|
|
5
5
|
backgroundColorText(text: string, colorValue: number): string;
|
|
6
6
|
italicText(text: string): string;
|
|
7
|
+
dimText(text: string): string;
|
|
7
8
|
hyperlink(text: string, url: string): string;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=Styler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styler.d.ts","sourceRoot":"","sources":["../../../src/terminal/Styler.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,MAAM;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IACpD,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9C"}
|
|
1
|
+
{"version":3,"file":"Styler.d.ts","sourceRoot":"","sources":["../../../src/terminal/Styler.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,MAAM;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IACpD,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9C"}
|
|
@@ -15,6 +15,7 @@ export default class TtyStyler implements Styler {
|
|
|
15
15
|
colorText(text: string, colorValue: number): string;
|
|
16
16
|
backgroundColorText(text: string, colorValue: number): string;
|
|
17
17
|
italicText(text: string): string;
|
|
18
|
+
dimText(text: string): string;
|
|
18
19
|
hyperlink(text: string, url: string): string;
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=TtyStyler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TtyStyler.d.ts","sourceRoot":"","sources":["../../../src/terminal/TtyStyler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TtyStyler.d.ts","sourceRoot":"","sources":["../../../src/terminal/TtyStyler.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,OAAO,OAAO,SAAU,YAAW,MAAM;IAC9C,YAAY,EAAE,OAAO,CAAQ;IAC7B,iBAAiB,EAAE,OAAO,CAAC;IAE3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B;;;;;;;OAOG;gBACS,UAAU,GAAE,MAAU,EAAE,iBAAiB,GAAE,OAAc;IAKrE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAgBnD,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAyB7D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAOhC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAO7B,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;CAM7C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BACKGROUND_COLOR_END, FOREGROUND_COLOR_END, HYPERLINK_END, hyperlinkStart, ITALIC_END, ITALIC_START, } from "./Ansi.js";
|
|
1
|
+
import { BACKGROUND_COLOR_END, DIM_END, DIM_START, FOREGROUND_COLOR_END, HYPERLINK_END, hyperlinkStart, ITALIC_END, ITALIC_START, } from "./Ansi.js";
|
|
2
2
|
export default class TtyStyler {
|
|
3
3
|
colorEnabled = true;
|
|
4
4
|
hyperlinksEnabled;
|
|
@@ -50,6 +50,12 @@ export default class TtyStyler {
|
|
|
50
50
|
}
|
|
51
51
|
return ITALIC_START + text + ITALIC_END;
|
|
52
52
|
}
|
|
53
|
+
dimText(text) {
|
|
54
|
+
if (!this.colorEnabled || this.colorLevel === 0) {
|
|
55
|
+
return text;
|
|
56
|
+
}
|
|
57
|
+
return DIM_START + text + DIM_END;
|
|
58
|
+
}
|
|
53
59
|
hyperlink(text, url) {
|
|
54
60
|
if (!this.hyperlinksEnabled) {
|
|
55
61
|
return `${text}: ${url}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowscripter/dynamic-cli-framework",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.4",
|
|
4
4
|
"description": "A framework for developing CLI applications which supports dynamic discovery and installation of new commands",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"build": "tsc -p tsconfig.build.json"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@flowscripter/dynamic-cli-framework-api": "^2.
|
|
51
|
+
"@flowscripter/dynamic-cli-framework-api": "^2.2.0",
|
|
52
52
|
"@flowscripter/dynamic-plugin-framework": "2.1.1",
|
|
53
53
|
"emphasize": "^7.0.0",
|
|
54
54
|
"fastest-levenshtein": "^1.0.16",
|
|
@@ -8,8 +8,10 @@ export interface SpawnInterfaceAdapterOptions {
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Adapts a {@link SpawnService} to dynamic-plugin-framework's {@link SpawnInterface}, wrapping
|
|
11
|
-
* spawned process output in a quoted, marked block via {@link PrinterService}
|
|
12
|
-
*
|
|
11
|
+
* spawned process output in a quoted, marked block via {@link PrinterService}. On success the
|
|
12
|
+
* block is cleared once the process exits (subject to
|
|
13
|
+
* {@link SpawnInterfaceAdapterOptions.markMinimumDisplayTimeMs}); on failure the block is left
|
|
14
|
+
* on screen so the diagnostic output from the failing command remains visible.
|
|
13
15
|
*/
|
|
14
16
|
export default class SpawnInterfaceAdapter implements SpawnInterface {
|
|
15
17
|
readonly #spawnService: SpawnService;
|
|
@@ -53,7 +55,14 @@ export default class SpawnInterfaceAdapter implements SpawnInterface {
|
|
|
53
55
|
|
|
54
56
|
this.#printerService.endQuote();
|
|
55
57
|
this.#printerService.endMark();
|
|
56
|
-
|
|
58
|
+
if (result.ok) {
|
|
59
|
+
await this.#printerService.clearMarked(this.#markMinimumDisplayTimeMs);
|
|
60
|
+
} else {
|
|
61
|
+
// Leave the marked/quoted output on screen so the failing command's diagnostic output is
|
|
62
|
+
// visible, but still reset the mark/quote bookkeeping so a subsequent spawn() can start a
|
|
63
|
+
// fresh mark region.
|
|
64
|
+
this.#printerService.discardMark();
|
|
65
|
+
}
|
|
57
66
|
|
|
58
67
|
if (result.ok) {
|
|
59
68
|
return { ok: true, exitCode: result.exitCode };
|
|
@@ -152,6 +152,10 @@ export default class DefaultPrinterService implements PrinterService {
|
|
|
152
152
|
return this.#styler.italicText(message);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
public dim(message: string): string {
|
|
156
|
+
return this.#styler.dimText(message);
|
|
157
|
+
}
|
|
158
|
+
|
|
155
159
|
public yellow(message: string): string {
|
|
156
160
|
return this.#styler.colorText(message, this.#theme[Color.YELLOW]!);
|
|
157
161
|
}
|
|
@@ -312,6 +316,19 @@ export default class DefaultPrinterService implements PrinterService {
|
|
|
312
316
|
this.#markEndedAt = Date.now();
|
|
313
317
|
}
|
|
314
318
|
|
|
319
|
+
/**
|
|
320
|
+
* Stop tracking rows for the current mark region without erasing them - e.g. when the marked
|
|
321
|
+
* output should be left on screen (such as a spawned command's output on failure), but the
|
|
322
|
+
* mark/quote bookkeeping still needs to be reset so a later startMark() doesn't throw.
|
|
323
|
+
*/
|
|
324
|
+
public discardMark(): void {
|
|
325
|
+
if (this.#markedLineCount === undefined) {
|
|
326
|
+
throw new Error("discardMark() called without a preceding startMark()");
|
|
327
|
+
}
|
|
328
|
+
this.#markedLineCount = undefined;
|
|
329
|
+
this.#markEndedAt = undefined;
|
|
330
|
+
}
|
|
331
|
+
|
|
315
332
|
public async clearMarked(minimumDisplayTimeMs = 0): Promise<void> {
|
|
316
333
|
if (this.#markedLineCount === undefined || this.#markEndedAt === undefined) {
|
|
317
334
|
throw new Error("clearMarked() called without a preceding endMark()");
|
|
@@ -60,7 +60,7 @@ export default class Quote {
|
|
|
60
60
|
}
|
|
61
61
|
const endsWithNewline = message.endsWith("\n");
|
|
62
62
|
const raw = endsWithNewline ? message.slice(0, -1) : message;
|
|
63
|
-
const lines = raw.split("\n").map((line) => this.#prefixLine() + line);
|
|
63
|
+
const lines = raw.split("\n").map((line) => this.#prefixLine() + this.#styler.dimText(line));
|
|
64
64
|
return lines.join("\n") + (endsWithNewline ? "\n" : "");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -129,15 +129,22 @@ export default class DefaultSpawnService implements SpawnService {
|
|
|
129
129
|
await this.#terminate(proc, command);
|
|
130
130
|
});
|
|
131
131
|
|
|
132
|
+
// These are intentionally not awaited here - they only complete once the child's stdout/
|
|
133
|
+
// stderr streams reach EOF, which can happen slightly after proc.exited resolves. They are
|
|
134
|
+
// awaited below, before returning, so that every onOutput callback (and thus every write it
|
|
135
|
+
// triggers) is guaranteed to have completed before the caller acts on the result.
|
|
136
|
+
let pipeStdout: Promise<void> = Promise.resolve();
|
|
137
|
+
let pipeStderr: Promise<void> = Promise.resolve();
|
|
132
138
|
if (mode === "wrapped" && options.onOutput) {
|
|
133
139
|
const onOutput = options.onOutput;
|
|
134
|
-
|
|
135
|
-
|
|
140
|
+
pipeStdout = this.#pipeLines(proc.stdout, "stdout", onOutput);
|
|
141
|
+
pipeStderr = this.#pipeLines(proc.stderr, "stderr", onOutput);
|
|
136
142
|
}
|
|
137
143
|
|
|
138
144
|
try {
|
|
139
145
|
if (options.timeoutMs === undefined) {
|
|
140
146
|
const exitCode = await proc.exited;
|
|
147
|
+
await Promise.all([pipeStdout, pipeStderr]);
|
|
141
148
|
settled = true;
|
|
142
149
|
return exitCode === 0 ? { ok: true, exitCode } : { ok: false, exitCode };
|
|
143
150
|
}
|
|
@@ -154,11 +161,13 @@ export default class DefaultSpawnService implements SpawnService {
|
|
|
154
161
|
if (timedOut) {
|
|
155
162
|
logger.debug(() => `Command '${command.join(" ")}' timed out after ${options.timeoutMs}ms`);
|
|
156
163
|
await this.#terminate(proc, command);
|
|
164
|
+
await Promise.all([pipeStdout, pipeStderr]);
|
|
157
165
|
settled = true;
|
|
158
166
|
return { ok: false, timedOut: true };
|
|
159
167
|
}
|
|
160
168
|
|
|
161
169
|
const exitCode = await proc.exited;
|
|
170
|
+
await Promise.all([pipeStdout, pipeStderr]);
|
|
162
171
|
settled = true;
|
|
163
172
|
return exitCode === 0 ? { ok: true, exitCode } : { ok: false, exitCode };
|
|
164
173
|
} finally {
|
package/src/terminal/Ansi.ts
CHANGED
|
@@ -10,6 +10,8 @@ export const HIDE_CURSOR = CSI + "?25l";
|
|
|
10
10
|
export const SHOW_CURSOR = CSI + "?25h";
|
|
11
11
|
export const ITALIC_START = CSI + "3m";
|
|
12
12
|
export const ITALIC_END = CSI + "23m";
|
|
13
|
+
export const DIM_START = CSI + "2m";
|
|
14
|
+
export const DIM_END = CSI + "22m";
|
|
13
15
|
export const FOREGROUND_COLOR_END = CSI + "39m";
|
|
14
16
|
export const BACKGROUND_COLOR_END = CSI + "49m";
|
|
15
17
|
export const HYPERLINK_END = `${OSC}8${SEP}${SEP}${BEL}`;
|
package/src/terminal/Styler.ts
CHANGED
|
@@ -4,5 +4,6 @@ export default interface Styler {
|
|
|
4
4
|
colorText(text: string, colorValue: number): string;
|
|
5
5
|
backgroundColorText(text: string, colorValue: number): string;
|
|
6
6
|
italicText(text: string): string;
|
|
7
|
+
dimText(text: string): string;
|
|
7
8
|
hyperlink(text: string, url: string): string;
|
|
8
9
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BACKGROUND_COLOR_END,
|
|
3
|
+
DIM_END,
|
|
4
|
+
DIM_START,
|
|
3
5
|
FOREGROUND_COLOR_END,
|
|
4
6
|
HYPERLINK_END,
|
|
5
7
|
hyperlinkStart,
|
|
@@ -75,6 +77,13 @@ export default class TtyStyler implements Styler {
|
|
|
75
77
|
return ITALIC_START + text + ITALIC_END;
|
|
76
78
|
}
|
|
77
79
|
|
|
80
|
+
dimText(text: string): string {
|
|
81
|
+
if (!this.colorEnabled || this.colorLevel === 0) {
|
|
82
|
+
return text;
|
|
83
|
+
}
|
|
84
|
+
return DIM_START + text + DIM_END;
|
|
85
|
+
}
|
|
86
|
+
|
|
78
87
|
hyperlink(text: string, url: string): string {
|
|
79
88
|
if (!this.hyperlinksEnabled) {
|
|
80
89
|
return `${text}: ${url}`;
|