@effected/cli 0.19.0 → 0.21.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/Cancelled.js +1 -2
- package/CliAudience.js +1 -2
- package/CliColor.js +1 -2
- package/CliEnv.js +1 -2
- package/CliExit.js +1 -2
- package/CliFailure.js +1 -2
- package/CliInteractive.js +1 -2
- package/CliLinks.js +1 -2
- package/CliLog.js +1 -2
- package/CliLogger.js +1 -2
- package/CliMessage.js +1 -2
- package/CliPrompt.js +1 -2
- package/CliRuntime.js +1 -2
- package/CliTest.js +1 -2
- package/CliTheme.js +1 -2
- package/ConfigIssueRenderer.js +1 -2
- package/Doc.js +1 -2
- package/Fmt.js +15 -6
- package/GithubAnnotation.js +1 -2
- package/Glyphs.js +1 -2
- package/NotInteractive.js +1 -2
- package/Render.js +1 -2
- package/SchemaIssueRenderer.js +1 -2
- package/Status.js +1 -2
- package/TestTerminal.js +1 -2
- package/Token.js +1 -2
- package/index.d.ts +10 -53
- package/internal/ExitRequested.js +1 -2
- package/internal/HelpRouting.js +1 -2
- package/internal/ansi.js +1 -2
- package/internal/autoFormat.js +1 -2
- package/internal/canPrompt.js +1 -2
- package/internal/counts.js +1 -2
- package/internal/diagnostics.js +1 -2
- package/internal/displayWidth.js +1 -2
- package/internal/failureTarget.js +1 -2
- package/internal/fallbackAnswer.js +1 -2
- package/internal/fileSink.js +1 -2
- package/internal/format.js +1 -2
- package/internal/isExitCode.js +1 -2
- package/internal/layout.js +1 -2
- package/internal/linkScheme.js +1 -2
- package/internal/linkTarget.js +1 -2
- package/internal/logSafety.js +1 -2
- package/internal/renderAnsi.js +1 -2
- package/internal/renderDoc.js +1 -2
- package/internal/renderGithubLog.js +1 -2
- package/internal/renderMarkdown.js +1 -2
- package/internal/renderPlain.js +1 -2
- package/internal/scanAudience.js +1 -2
- package/internal/splitFrame.js +1 -2
- package/internal/wizardGate.js +1 -2
- package/package.json +6 -6
- package/testing.d.ts +0 -4
- package/ui/CliUi.js +3 -4
- package/ui/CliUiLive.js +1 -2
- package/ui/Confirm.js +1 -2
- package/ui/DocView.js +1 -2
- package/ui/KeyHelp.js +1 -2
- package/ui/KeyTable.js +1 -2
- package/ui/MultiSelect.js +1 -2
- package/ui/Select.js +1 -2
- package/ui/Tabs.js +1 -2
- package/ui/TextInput.js +1 -2
- package/ui/Toggle.js +1 -2
- package/ui/UiKey.js +2 -3
- package/ui/UiProvider.js +1 -2
- package/ui/UiStreams.js +1 -2
- package/ui/UiTheme.js +1 -2
- package/ui/Viewport.js +1 -2
- package/ui/internal/ErrorBoundary.js +1 -2
- package/ui/internal/Holder.js +1 -2
- package/ui/internal/ScreenContext.js +1 -2
- package/ui/internal/UiProviders.js +1 -2
- package/ui/internal/ink.js +1 -2
- package/ui/internal/inkChalk.js +1 -2
- package/ui/internal/inkConsole.js +1 -2
- package/ui/internal/lazyView.js +1 -2
- package/ui/internal/lineText.js +1 -2
- package/ui/internal/mountPermit.js +1 -2
- package/ui/internal/processStreams.js +1 -2
- package/ui/internal/renderOptions.js +1 -2
- package/ui/testing/CliUiTest.js +1 -2
- package/ui/testing/fakeStreams.js +1 -2
- package/ui/testing/terminalModel.js +1 -2
- package/ui-testing-serializer.d.ts +0 -2
- package/ui-testing-serializer.js +1 -2
- package/ui-testing.d.ts +0 -2
- package/ui.d.ts +5 -37
package/testing.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Effect, FileSystem, Layer, Path, PlatformError, Scope, Terminal } from "effect";
|
|
2
2
|
import { ChildProcessSpawner } from "effect/process";
|
|
3
|
-
//#region src/CliTest.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* A hermetic temp directory minted by {@link CliTest.sandbox}, removed when its
|
|
6
5
|
* scope closes.
|
|
@@ -105,8 +104,6 @@ export declare class CliTest {
|
|
|
105
104
|
*/
|
|
106
105
|
static readonly run: (bin: string, args: ReadonlyArray<string>, options: RunOptions) => Effect.Effect<RunResult, PlatformError.PlatformError, ChildProcessSpawner.ChildProcessSpawner>;
|
|
107
106
|
}
|
|
108
|
-
//#endregion
|
|
109
|
-
//#region src/TestTerminal.d.ts
|
|
110
107
|
/**
|
|
111
108
|
* One key press for {@link TestTerminal}.
|
|
112
109
|
*
|
|
@@ -175,6 +172,5 @@ export declare class TestTerminal {
|
|
|
175
172
|
readonly rows?: number | undefined;
|
|
176
173
|
}) => Effect.Effect<TestTerminalHandle>;
|
|
177
174
|
}
|
|
178
|
-
//#endregion
|
|
179
175
|
export type { KeyInput, RunOptions, RunResult, Sandbox, TestTerminalHandle };
|
|
180
176
|
//# sourceMappingURL=testing.d.ts.map
|
package/ui/CliUi.js
CHANGED
|
@@ -18,7 +18,7 @@ import { Cause, Deferred, Effect, Exit, Option, Semaphore } from "effect";
|
|
|
18
18
|
import { Audience } from "@effected/env";
|
|
19
19
|
import { Prompt } from "effect/cli";
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// src/ui/CliUi.ts
|
|
22
22
|
/**
|
|
23
23
|
* stdout's theme as the audience sees it: colourless for an agent (as `Render.context` makes it), so a screen's
|
|
24
24
|
* `useTheme`, `Styled` and the widgets' colour-none markers never carry an escape for one. `Audience` is read only when
|
|
@@ -159,7 +159,7 @@ var CliUi = class CliUi {
|
|
|
159
159
|
const crashed = crash.current;
|
|
160
160
|
const interrupted = Exit.isFailure(exit) && Cause.hasInterruptsOnly(exit.cause);
|
|
161
161
|
if (crashed === void 0 || interrupted) return yield* exit;
|
|
162
|
-
const dies = Exit.isFailure(exit) ? exit.cause.reasons.filter(Cause.isDieReason) : [];
|
|
162
|
+
const dies = Exit.isFailure(exit) ? exit.cause.reasons.filter((reason) => Cause.isDieReason(reason) && !(reason.defect instanceof Cancelled)) : [];
|
|
163
163
|
if (dies.some((reason) => reason.defect === crashed.defect)) return yield* exit;
|
|
164
164
|
return yield* Effect.failCause(Cause.fromReasons([Cause.makeDieReason(crashed.defect), ...dies]));
|
|
165
165
|
});
|
|
@@ -306,7 +306,7 @@ var CliUi = class CliUi {
|
|
|
306
306
|
* so core renders its own message and `CliRuntime.main` exits `64`. Name the parameter with `flag` (the name
|
|
307
307
|
* without dashes) or `argument` so that error can be built.
|
|
308
308
|
*
|
|
309
|
-
* The options are
|
|
309
|
+
* The options are `CliPromptFallbackOptions` (from `@effected/cli`), the same as `CliPrompt.fallback`'s, and `clear`
|
|
310
310
|
* as for {@link CliUi.run}.
|
|
311
311
|
*
|
|
312
312
|
* It runs during parsing, whose environment is core's alone, so it reads `CliTheme` if one is there: with
|
|
@@ -429,5 +429,4 @@ var CliUi = class CliUi {
|
|
|
429
429
|
});
|
|
430
430
|
};
|
|
431
431
|
|
|
432
|
-
//#endregion
|
|
433
432
|
export { CliUi };
|
package/ui/CliUiLive.js
CHANGED
|
@@ -17,7 +17,7 @@ import { Cause, Clock, Duration, Effect, Exit, Fiber, Option, PubSub, Pull, Queu
|
|
|
17
17
|
import { Audience, TerminalEnv } from "@effected/env";
|
|
18
18
|
import { CommandNeutralizer } from "@effected/github-commands";
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
// src/ui/CliUiLive.ts
|
|
21
21
|
/**
|
|
22
22
|
* The live tree's height clamp: at most the terminal's rows less one, re-read on every render and when the terminal
|
|
23
23
|
* resizes, so a tall frame never takes Ink's clear-terminal path, which wipes the scrollback. No width: Ink sizes the root itself.
|
|
@@ -436,5 +436,4 @@ const live = (options) => Effect.gen(function* () {
|
|
|
436
436
|
};
|
|
437
437
|
});
|
|
438
438
|
|
|
439
|
-
//#endregion
|
|
440
439
|
export { live };
|
package/ui/Confirm.js
CHANGED
|
@@ -8,7 +8,7 @@ import { KeyHelp } from "./KeyHelp.js";
|
|
|
8
8
|
import { Toggle } from "./Toggle.js";
|
|
9
9
|
import { Viewport } from "./Viewport.js";
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// src/ui/Confirm.ts
|
|
12
12
|
const assertUniqueKeys = (toggles) => {
|
|
13
13
|
const seen = /* @__PURE__ */ new Set();
|
|
14
14
|
for (const toggle of toggles) {
|
|
@@ -241,5 +241,4 @@ var Confirm = class Confirm {
|
|
|
241
241
|
};
|
|
242
242
|
};
|
|
243
243
|
|
|
244
|
-
//#endregion
|
|
245
244
|
export { Confirm };
|
package/ui/DocView.js
CHANGED
|
@@ -3,7 +3,7 @@ import { fromReact, inkModules } from "./internal/ink.js";
|
|
|
3
3
|
import { screenContext } from "./internal/ScreenContext.js";
|
|
4
4
|
import { useTerminalSize } from "./UiTheme.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/ui/DocView.ts
|
|
7
7
|
const OUTSIDE = "@effected/cli/ui: DocView was drawn with no ctx outside a screen, a live view or a UiProvider, so it has no theme";
|
|
8
8
|
/** The context a `DocView` builds from its tree's theme: the theme's own paint, so token overrides hold. */
|
|
9
9
|
const contextOf = (theme, width, neutralize) => ({
|
|
@@ -70,5 +70,4 @@ const docView = fromReact((react) => {
|
|
|
70
70
|
*/
|
|
71
71
|
const DocView = (props) => inkModules().react.createElement(docView(), props);
|
|
72
72
|
|
|
73
|
-
//#endregion
|
|
74
73
|
export { DocView };
|
package/ui/KeyHelp.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Styled, useGlyphs, useTerminalSize } from "./UiTheme.js";
|
|
|
4
4
|
import { KeyTable } from "./KeyTable.js";
|
|
5
5
|
import { lineText } from "./internal/lineText.js";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/ui/KeyHelp.ts
|
|
8
8
|
/** The fewest cells worth giving the widget's own keys when the line is cut; below it they are left out. */
|
|
9
9
|
const MIN_OWN = 4;
|
|
10
10
|
/**
|
|
@@ -58,5 +58,4 @@ const KeyHelp = (props) => {
|
|
|
58
58
|
return inkModules().react.createElement(Styled, { token: "muted" }, line);
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
//#endregion
|
|
62
61
|
export { KeyHelp };
|
package/ui/KeyTable.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useScreenGuard } from "./internal/ScreenContext.js";
|
|
|
4
4
|
import { UiKey } from "./UiKey.js";
|
|
5
5
|
import { Option } from "effect";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/ui/KeyTable.ts
|
|
8
8
|
/** Arrows under a Unicode glyph set; everything else, and everything under ASCII, as words. */
|
|
9
9
|
const ARROWS = {
|
|
10
10
|
up: "↑",
|
|
@@ -195,5 +195,4 @@ const useKeys = (table, dispatch, options = {}) => {
|
|
|
195
195
|
}), { isActive: options.isActive ?? true });
|
|
196
196
|
};
|
|
197
197
|
|
|
198
|
-
//#endregion
|
|
199
198
|
export { KeyTable, useKeys };
|
package/ui/MultiSelect.js
CHANGED
|
@@ -7,7 +7,7 @@ import { lineText } from "./internal/lineText.js";
|
|
|
7
7
|
import { KeyHelp } from "./KeyHelp.js";
|
|
8
8
|
import { Viewport } from "./Viewport.js";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// src/ui/MultiSelect.ts
|
|
11
11
|
/** Every item with its section's index, numbered across sections in order. */
|
|
12
12
|
const flatten = (sections) => sections.flatMap((section, index) => section.items.map((item) => ({
|
|
13
13
|
section: index,
|
|
@@ -256,5 +256,4 @@ var MultiSelect = class MultiSelect {
|
|
|
256
256
|
};
|
|
257
257
|
};
|
|
258
258
|
|
|
259
|
-
//#endregion
|
|
260
259
|
export { MultiSelect };
|
package/ui/Select.js
CHANGED
|
@@ -8,7 +8,7 @@ import { KeyHelp } from "./KeyHelp.js";
|
|
|
8
8
|
import { Viewport } from "./Viewport.js";
|
|
9
9
|
import { Option } from "effect";
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// src/ui/Select.ts
|
|
12
12
|
const enabled = (choices, index) => index >= 0 && index < choices.length && choices[index]?.disabled !== true;
|
|
13
13
|
/** The nearest enabled index from `from` in `direction`, or `undefined`. */
|
|
14
14
|
const nearest = (choices, from, direction) => {
|
|
@@ -226,5 +226,4 @@ var Select = class Select {
|
|
|
226
226
|
};
|
|
227
227
|
};
|
|
228
228
|
|
|
229
|
-
//#endregion
|
|
230
229
|
export { Select };
|
package/ui/Tabs.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Styled, useGlyphs, useTerminalSize, useTheme } from "./UiTheme.js";
|
|
|
4
4
|
import { KeyTable, useKeys } from "./KeyTable.js";
|
|
5
5
|
import { lineText } from "./internal/lineText.js";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/ui/Tabs.ts
|
|
8
8
|
const step = (index, count, action) => {
|
|
9
9
|
if (count <= 0) return index;
|
|
10
10
|
if (action === "prev") return (index - 1 + count) % count;
|
|
@@ -198,5 +198,4 @@ var Tabs = class {
|
|
|
198
198
|
};
|
|
199
199
|
};
|
|
200
200
|
|
|
201
|
-
//#endregion
|
|
202
201
|
export { Tabs };
|
package/ui/TextInput.js
CHANGED
|
@@ -7,7 +7,7 @@ import { KeyTable } from "./KeyTable.js";
|
|
|
7
7
|
import { lineText } from "./internal/lineText.js";
|
|
8
8
|
import { KeyHelp } from "./KeyHelp.js";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// src/ui/TextInput.ts
|
|
11
11
|
const init = (options = {}) => {
|
|
12
12
|
const value = options.initial ?? "";
|
|
13
13
|
return {
|
|
@@ -286,5 +286,4 @@ var TextInput = class TextInput {
|
|
|
286
286
|
});
|
|
287
287
|
};
|
|
288
288
|
|
|
289
|
-
//#endregion
|
|
290
289
|
export { TextInput };
|
package/ui/Toggle.js
CHANGED
|
@@ -3,7 +3,7 @@ import { inkModules } from "./internal/ink.js";
|
|
|
3
3
|
import { Styled, useGlyphs, useTerminalSize } from "./UiTheme.js";
|
|
4
4
|
import { lineText } from "./internal/lineText.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/ui/Toggle.ts
|
|
7
7
|
/**
|
|
8
8
|
* An on/off row: a check glyph and a label.
|
|
9
9
|
*
|
|
@@ -28,5 +28,4 @@ var Toggle = class {
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
//#endregion
|
|
32
31
|
export { Toggle };
|
package/ui/UiKey.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
// src/ui/UiKey.ts
|
|
2
2
|
const named = (name) => ({
|
|
3
3
|
_tag: "Named",
|
|
4
4
|
name
|
|
5
5
|
});
|
|
6
6
|
const CONTROL = /[\u0000-\u001f\u007f]/;
|
|
7
7
|
/**
|
|
8
|
-
* Normalising Ink's input into {@link UiKey}s.
|
|
8
|
+
* Normalising Ink's input into {@link (UiKey:type)}s.
|
|
9
9
|
*
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
@@ -40,5 +40,4 @@ const UiKey = {
|
|
|
40
40
|
})
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
//#endregion
|
|
44
43
|
export { UiKey };
|
package/ui/UiProvider.js
CHANGED
|
@@ -2,7 +2,7 @@ import { inkModules } from "./internal/ink.js";
|
|
|
2
2
|
import { screenContext } from "./internal/ScreenContext.js";
|
|
3
3
|
import { uiProviders } from "./internal/UiProviders.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/ui/UiProvider.ts
|
|
6
6
|
/**
|
|
7
7
|
* Provide the kit's context to an Ink tree the kit did not mount, so `useTheme`, `useGlyphs`, `Styled` and
|
|
8
8
|
* `useTerminalSize` work in it.
|
|
@@ -56,5 +56,4 @@ const UiProvider = (props) => {
|
|
|
56
56
|
return uiProviders(value, props.children);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
//#endregion
|
|
60
59
|
export { UiProvider };
|
package/ui/UiStreams.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { processStreams } from "./internal/processStreams.js";
|
|
2
2
|
import { Context } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/ui/UiStreams.ts
|
|
5
5
|
/**
|
|
6
6
|
* The streams a screen mounts on, the process's own standard streams by default.
|
|
7
7
|
*
|
|
@@ -14,5 +14,4 @@ import { Context } from "effect";
|
|
|
14
14
|
*/
|
|
15
15
|
var UiStreams = class extends Context.Reference("@effected/cli/ui/UiStreams", { defaultValue: () => processStreams() }) {};
|
|
16
16
|
|
|
17
|
-
//#endregion
|
|
18
17
|
export { UiStreams };
|
package/ui/UiTheme.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { inkModules } from "./internal/ink.js";
|
|
2
2
|
import { screenContext } from "./internal/ScreenContext.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/ui/UiTheme.ts
|
|
5
5
|
const OUTSIDE = "@effected/cli/ui: a theme hook was used outside a screen mounted by CliUi.run or a UiProvider";
|
|
6
6
|
const useScreen = () => {
|
|
7
7
|
const screen = inkModules().react.useContext(screenContext());
|
|
@@ -144,5 +144,4 @@ const useTerminalSize = () => {
|
|
|
144
144
|
};
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
//#endregion
|
|
148
147
|
export { Styled, inkProps, useGlyphs, useTerminalSize, useTheme };
|
package/ui/Viewport.js
CHANGED
|
@@ -2,7 +2,7 @@ import { inkModules } from "./internal/ink.js";
|
|
|
2
2
|
import { useTerminalSize } from "./UiTheme.js";
|
|
3
3
|
import { KeyTable } from "./KeyTable.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/ui/Viewport.ts
|
|
6
6
|
/**
|
|
7
7
|
* Throws on a repeated item key. Checked before React sees the rows: React reports a duplicate key on
|
|
8
8
|
* `console.error`, which under a screen's unpatched console lands on the real stderr, over the frame.
|
|
@@ -200,5 +200,4 @@ var Viewport = class {
|
|
|
200
200
|
};
|
|
201
201
|
};
|
|
202
202
|
|
|
203
|
-
//#endregion
|
|
204
203
|
export { Viewport };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fromReact } from "./ink.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ui/internal/ErrorBoundary.ts
|
|
4
4
|
/**
|
|
5
5
|
* The screen's error boundary: catches a render error anywhere in the screen, renders nothing, and reports it.
|
|
6
6
|
*
|
|
@@ -26,5 +26,4 @@ const errorBoundary = fromReact((react) => class ScreenErrorBoundary extends rea
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
//#endregion
|
|
30
29
|
export { errorBoundary };
|
package/ui/internal/Holder.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fromReact } from "./ink.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ui/internal/Holder.ts
|
|
4
4
|
/**
|
|
5
5
|
* A component that shows one element and lets its owner swap it in place.
|
|
6
6
|
*
|
|
@@ -70,5 +70,4 @@ const holderSlot = () => {
|
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
//#endregion
|
|
74
73
|
export { holder, holderSlot };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fromReact, inkModules } from "./ink.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ui/internal/ScreenContext.ts
|
|
4
4
|
/**
|
|
5
5
|
* The React context carrying {@link ScreenContextValue}, built on the loaded React.
|
|
6
6
|
*
|
|
@@ -48,5 +48,4 @@ const useScreenGuard = () => {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
//#endregion
|
|
52
51
|
export { screenContext, useScreenCancel, useScreenGuard };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { inkModules } from "./ink.js";
|
|
2
2
|
import { screenContext } from "./ScreenContext.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/ui/internal/UiProviders.ts
|
|
5
5
|
/**
|
|
6
6
|
* Wrap `children` in the kit's providers: the theme, the glyph set, the optional size override, and a screen's cancel
|
|
7
7
|
* and defect route when it has them.
|
|
@@ -17,5 +17,4 @@ const uiProviders = (value, children) => inkModules().react.createElement(screen
|
|
|
17
17
|
children
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
//#endregion
|
|
21
20
|
export { uiProviders };
|
package/ui/internal/ink.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { inkChalk } from "./inkChalk.js";
|
|
2
2
|
import { Effect, Option } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/ui/internal/ink.ts
|
|
5
5
|
const MISSING_PEERS = "@effected/cli/ui could not load its optional peers ink and react: install both beside @effected/cli to mount a screen";
|
|
6
6
|
const READ_BEFORE_LOAD = "@effected/cli/ui read Ink before loading it: run CliUi.context (or mount a screen with CliUi.run) before rendering UiProvider or a kit component in a tree of your own";
|
|
7
7
|
const UNRESOLVED_CHALK = "@effected/cli/ui could not resolve the chalk Ink uses (is ink bundled?), so Ink decides its own colour level";
|
|
@@ -118,5 +118,4 @@ const holdChalkLevel = (found, colour) => Option.match(found, {
|
|
|
118
118
|
*/
|
|
119
119
|
const withInkColour = (colour) => Effect.flatMap(resolveChalk, (found) => holdChalkLevel(found, colour));
|
|
120
120
|
|
|
121
|
-
//#endregion
|
|
122
121
|
export { fromReact, holdChalkLevel, inkModules, levelOf, loadInk, withInkColour };
|
package/ui/internal/inkChalk.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Option } from "effect";
|
|
|
3
3
|
import { realpathSync } from "node:fs";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/ui/internal/inkChalk.ts
|
|
7
7
|
const isInkChalk = (value) => (typeof value === "function" || typeof value === "object" && value !== null) && typeof value.level === "number";
|
|
8
8
|
/** The runtime's `import.meta.resolve`, when it has one. */
|
|
9
9
|
const esmResolve = typeof import.meta.resolve === "function" ? (specifier) => import.meta.resolve(specifier) : void 0;
|
|
@@ -54,5 +54,4 @@ const inkChalk = async (inkEntryOf = () => resolveInkEntry()) => {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
//#endregion
|
|
58
57
|
export { inkChalk, resolveInkEntry };
|
|
@@ -2,7 +2,7 @@ import { inkModules } from "./ink.js";
|
|
|
2
2
|
import { UiStreams } from "../UiStreams.js";
|
|
3
3
|
import { Effect, Inspectable } from "effect";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/ui/internal/inkConsole.ts
|
|
6
6
|
/** One argument as a console shows it: a string as is, an `Error` with its stack, anything else as data (JSON). */
|
|
7
7
|
const shown = (arg) => arg instanceof Error ? arg.stack ?? String(arg) : Inspectable.toStringUnknown(arg, 0);
|
|
8
8
|
/** A console call's arguments as one line of text, joined by spaces. */
|
|
@@ -147,5 +147,4 @@ const makeInkConsole = Effect.gen(function* () {
|
|
|
147
147
|
};
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
//#endregion
|
|
151
150
|
export { makeInkConsole };
|
package/ui/internal/lazyView.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ui/internal/lazyView.ts
|
|
4
4
|
/** Where a lazy view keeps its loader: a `Symbol.for` key, so two copies of the package agree on it. */
|
|
5
5
|
const LOAD = Symbol.for("@effected/cli/ui/lazyView");
|
|
6
6
|
const NOT_LOADED = "@effected/cli/ui: a CliUi.lazyView render was called before its module loaded; only CliUi.live loads it first";
|
|
@@ -70,5 +70,4 @@ const loadView = (render) => {
|
|
|
70
70
|
}));
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
//#endregion
|
|
74
73
|
export { LazyViewShapeError, lazyView, loadView };
|
package/ui/internal/lineText.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sanitize } from "../../Fmt.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ui/internal/lineText.ts
|
|
4
4
|
/**
|
|
5
5
|
* Consumer text made safe for one row of a widget: sanitised as `Fmt.sanitize` does (no escape sequence, no other
|
|
6
6
|
* control character), with each line break (CR, LF or CR LF) folded to a space.
|
|
@@ -15,5 +15,4 @@ import { sanitize } from "../../Fmt.js";
|
|
|
15
15
|
*/
|
|
16
16
|
const lineText = (text) => sanitize(text).replace(/\r\n|\r|\n/g, " ");
|
|
17
17
|
|
|
18
|
-
//#endregion
|
|
19
18
|
export { lineText };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Semaphore } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ui/internal/mountPermit.ts
|
|
4
4
|
/**
|
|
5
5
|
* One Ink mount at a time, process-wide: a `CliUi.run` screen, or one run of a live view.
|
|
6
6
|
*
|
|
@@ -12,5 +12,4 @@ import { Semaphore } from "effect";
|
|
|
12
12
|
*/
|
|
13
13
|
const mountPermit = Semaphore.makeUnsafe(1);
|
|
14
14
|
|
|
15
|
-
//#endregion
|
|
16
15
|
export { mountPermit };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/ui/internal/processStreams.ts
|
|
2
2
|
/**
|
|
3
3
|
* The process's own standard streams, the default `UiStreams`.
|
|
4
4
|
*
|
|
@@ -15,5 +15,4 @@ const processStreams = () => ({
|
|
|
15
15
|
stderr: process.stderr
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
//#endregion
|
|
19
18
|
export { processStreams };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ui/internal/renderOptions.ts
|
|
4
4
|
/**
|
|
5
5
|
* The render-option overrides in force: none by default. Internal, so `CliUi.run`'s public signature stays as
|
|
6
6
|
* specified; `CliUiTest` sets it.
|
|
@@ -9,5 +9,4 @@ import { Context } from "effect";
|
|
|
9
9
|
*/
|
|
10
10
|
var UiRenderOptions = class extends Context.Reference("@effected/cli/ui/UiRenderOptions", { defaultValue: () => ({}) }) {};
|
|
11
11
|
|
|
12
|
-
//#endregion
|
|
13
12
|
export { UiRenderOptions };
|
package/ui/testing/CliUiTest.js
CHANGED
|
@@ -11,7 +11,7 @@ import { Cause, Console, Effect, Exit, Fiber, Inspectable, Layer, Option, Queue,
|
|
|
11
11
|
import { TerminalEnv } from "@effected/env";
|
|
12
12
|
import { TestClock } from "effect/testing";
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// src/ui/testing/CliUiTest.ts
|
|
15
15
|
/** The tokens, in the order their marker colours are numbered. */
|
|
16
16
|
const TOKENS = [
|
|
17
17
|
"success",
|
|
@@ -786,5 +786,4 @@ var CliUiTest = class {
|
|
|
786
786
|
};
|
|
787
787
|
};
|
|
788
788
|
|
|
789
|
-
//#endregion
|
|
790
789
|
export { CliUiTest };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PassThrough, Writable } from "node:stream";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ui/testing/fakeStreams.ts
|
|
4
4
|
/** The hide-cursor escape `cli-cursor` writes to a TTY stream as it arms the restore. */
|
|
5
5
|
const HIDE_CURSOR = `${String.fromCharCode(27)}[?25l`;
|
|
6
6
|
/** A cursor-show escape in a listener's source, as `restore-cursor` writes it (`'\u001B[?25h'`) or as the raw byte. */
|
|
@@ -101,5 +101,4 @@ const makeFakeStreams = (options = {}) => {
|
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
//#endregion
|
|
105
104
|
export { makeFakeStreams };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/ui/testing/terminalModel.ts
|
|
2
2
|
const ESC = String.fromCharCode(27);
|
|
3
3
|
/**
|
|
4
4
|
* A small terminal model for the production render path: what a terminal shows after `written`, as its non-empty
|
|
@@ -64,5 +64,4 @@ const screenAfter = (written, rows) => {
|
|
|
64
64
|
return lines.map((line) => line.trimEnd()).filter((line) => line !== "");
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
//#endregion
|
|
68
67
|
export { screenAfter };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/ui-testing-serializer.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* `CliUiTest.serializer`: it claims a string carrying escapes or token markup and prints it as token markup with each
|
|
4
3
|
* line's trailing spaces trimmed. See `CliUiTest.serializer` for what it claims.
|
|
@@ -9,6 +8,5 @@ declare const serializer: {
|
|
|
9
8
|
readonly test: (value: unknown) => boolean;
|
|
10
9
|
readonly serialize: (value: unknown) => string;
|
|
11
10
|
};
|
|
12
|
-
//#endregion
|
|
13
11
|
export { serializer as default };
|
|
14
12
|
//# sourceMappingURL=ui-testing-serializer.d.ts.map
|
package/ui-testing-serializer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CliUiTest } from "./ui/testing/CliUiTest.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ui-testing-serializer.ts
|
|
4
4
|
/**
|
|
5
5
|
* `CliUiTest.serializer` as a module's default export, for Vitest's `snapshotSerializers` config.
|
|
6
6
|
*
|
|
@@ -29,5 +29,4 @@ import { CliUiTest } from "./ui/testing/CliUiTest.js";
|
|
|
29
29
|
*/
|
|
30
30
|
const serializer = CliUiTest.serializer;
|
|
31
31
|
|
|
32
|
-
//#endregion
|
|
33
32
|
export { serializer as default };
|
package/ui-testing.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { KeyName, LiveHandle, LiveOptions, Screen } from "@effected/cli/ui";
|
|
|
3
3
|
import { ColorLevel } from "@effected/env";
|
|
4
4
|
import { Cause, Duration, Effect, Exit, Layer, Option, Scope } from "effect";
|
|
5
5
|
import { ReactElement } from "react";
|
|
6
|
-
//#region src/ui/testing/CliUiTest.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Options for {@link CliUiTest.render}, {@link CliUiTest.view} and {@link CliUiTest.session}, and the terminal's
|
|
9
8
|
* half of {@link CliUiTest.live}'s.
|
|
@@ -555,6 +554,5 @@ export declare class CliUiTest {
|
|
|
555
554
|
readonly serialize: (value: unknown) => string;
|
|
556
555
|
};
|
|
557
556
|
}
|
|
558
|
-
//#endregion
|
|
559
557
|
export type { CliUiTestHandle, CliUiTestLive, CliUiTestNextOptions, CliUiTestOptions, CliUiTestScreen, CliUiTestSession, CliUiTestSessionOptions, CliUiTestView };
|
|
560
558
|
//# sourceMappingURL=ui-testing.d.ts.map
|