@effected/cli 0.19.0 → 0.20.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.
Files changed (89) hide show
  1. package/Cancelled.js +1 -2
  2. package/CliAudience.js +1 -2
  3. package/CliColor.js +1 -2
  4. package/CliEnv.js +1 -2
  5. package/CliExit.js +1 -2
  6. package/CliFailure.js +1 -2
  7. package/CliInteractive.js +1 -2
  8. package/CliLinks.js +1 -2
  9. package/CliLog.js +1 -2
  10. package/CliLogger.js +1 -2
  11. package/CliMessage.js +1 -2
  12. package/CliPrompt.js +1 -2
  13. package/CliRuntime.js +1 -2
  14. package/CliTest.js +1 -2
  15. package/CliTheme.js +1 -2
  16. package/ConfigIssueRenderer.js +1 -2
  17. package/Doc.js +1 -2
  18. package/Fmt.js +1 -2
  19. package/GithubAnnotation.js +1 -2
  20. package/Glyphs.js +1 -2
  21. package/NotInteractive.js +1 -2
  22. package/Render.js +1 -2
  23. package/SchemaIssueRenderer.js +1 -2
  24. package/Status.js +1 -2
  25. package/TestTerminal.js +1 -2
  26. package/Token.js +1 -2
  27. package/index.d.ts +0 -48
  28. package/internal/ExitRequested.js +1 -2
  29. package/internal/HelpRouting.js +1 -2
  30. package/internal/ansi.js +1 -2
  31. package/internal/autoFormat.js +1 -2
  32. package/internal/canPrompt.js +1 -2
  33. package/internal/counts.js +1 -2
  34. package/internal/diagnostics.js +1 -2
  35. package/internal/displayWidth.js +1 -2
  36. package/internal/failureTarget.js +1 -2
  37. package/internal/fallbackAnswer.js +1 -2
  38. package/internal/fileSink.js +1 -2
  39. package/internal/format.js +1 -2
  40. package/internal/isExitCode.js +1 -2
  41. package/internal/layout.js +1 -2
  42. package/internal/linkScheme.js +1 -2
  43. package/internal/linkTarget.js +1 -2
  44. package/internal/logSafety.js +1 -2
  45. package/internal/renderAnsi.js +1 -2
  46. package/internal/renderDoc.js +1 -2
  47. package/internal/renderGithubLog.js +1 -2
  48. package/internal/renderMarkdown.js +1 -2
  49. package/internal/renderPlain.js +1 -2
  50. package/internal/scanAudience.js +1 -2
  51. package/internal/splitFrame.js +1 -2
  52. package/internal/wizardGate.js +1 -2
  53. package/package.json +6 -6
  54. package/testing.d.ts +0 -4
  55. package/ui/CliUi.js +2 -3
  56. package/ui/CliUiLive.js +1 -2
  57. package/ui/Confirm.js +1 -2
  58. package/ui/DocView.js +1 -2
  59. package/ui/KeyHelp.js +1 -2
  60. package/ui/KeyTable.js +1 -2
  61. package/ui/MultiSelect.js +1 -2
  62. package/ui/Select.js +1 -2
  63. package/ui/Tabs.js +1 -2
  64. package/ui/TextInput.js +1 -2
  65. package/ui/Toggle.js +1 -2
  66. package/ui/UiKey.js +1 -2
  67. package/ui/UiProvider.js +1 -2
  68. package/ui/UiStreams.js +1 -2
  69. package/ui/UiTheme.js +1 -2
  70. package/ui/Viewport.js +1 -2
  71. package/ui/internal/ErrorBoundary.js +1 -2
  72. package/ui/internal/Holder.js +1 -2
  73. package/ui/internal/ScreenContext.js +1 -2
  74. package/ui/internal/UiProviders.js +1 -2
  75. package/ui/internal/ink.js +1 -2
  76. package/ui/internal/inkChalk.js +1 -2
  77. package/ui/internal/inkConsole.js +1 -2
  78. package/ui/internal/lazyView.js +1 -2
  79. package/ui/internal/lineText.js +1 -2
  80. package/ui/internal/mountPermit.js +1 -2
  81. package/ui/internal/processStreams.js +1 -2
  82. package/ui/internal/renderOptions.js +1 -2
  83. package/ui/testing/CliUiTest.js +1 -2
  84. package/ui/testing/fakeStreams.js +1 -2
  85. package/ui/testing/terminalModel.js +1 -2
  86. package/ui-testing-serializer.d.ts +0 -2
  87. package/ui-testing-serializer.js +1 -2
  88. package/ui-testing.d.ts +0 -2
  89. package/ui.d.ts +0 -32
@@ -1,6 +1,6 @@
1
1
  import { fromReact, inkModules } from "./ink.js";
2
2
 
3
- //#region src/ui/internal/ScreenContext.ts
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
- //#region src/ui/internal/UiProviders.ts
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 };
@@ -1,7 +1,7 @@
1
1
  import { inkChalk } from "./inkChalk.js";
2
2
  import { Effect, Option } from "effect";
3
3
 
4
- //#region src/ui/internal/ink.ts
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 };
@@ -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
- //#region src/ui/internal/inkChalk.ts
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
- //#region src/ui/internal/inkConsole.ts
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 };
@@ -1,6 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
 
3
- //#region src/ui/internal/lazyView.ts
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 };
@@ -1,6 +1,6 @@
1
1
  import { sanitize } from "../../Fmt.js";
2
2
 
3
- //#region src/ui/internal/lineText.ts
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
- //#region src/ui/internal/mountPermit.ts
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
- //#region src/ui/internal/processStreams.ts
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
- //#region src/ui/internal/renderOptions.ts
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 };
@@ -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
- //#region src/ui/testing/CliUiTest.ts
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
- //#region src/ui/testing/fakeStreams.ts
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
- //#region src/ui/testing/terminalModel.ts
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
@@ -1,6 +1,6 @@
1
1
  import { CliUiTest } from "./ui/testing/CliUiTest.js";
2
2
 
3
- //#region src/ui-testing-serializer.ts
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
package/ui.d.ts CHANGED
@@ -4,7 +4,6 @@ import { Param } from "effect/cli";
4
4
  import { ReactElement, ReactNode } from "react";
5
5
  import { Key } from "ink";
6
6
  import { ColorLevel } from "@effected/env";
7
- //#region src/ui/CliUiLive.d.ts
8
7
  /**
9
8
  * Options for `CliUi.live`.
10
9
  *
@@ -178,8 +177,6 @@ interface LiveHandle<S> {
178
177
  */
179
178
  readonly close: Effect.Effect<void>;
180
179
  }
181
- //#endregion
182
- //#region src/ui/UiProvider.d.ts
183
180
  /**
184
181
  * What the kit's hooks read in a tree the kit did not mount: the theme, the glyph set, and optionally the size.
185
182
  *
@@ -245,8 +242,6 @@ interface UiProviderProps {
245
242
  * @public
246
243
  */
247
244
  export declare const UiProvider: (props: UiProviderProps) => ReactElement;
248
- //#endregion
249
- //#region src/ui/CliUi.d.ts
250
245
  /**
251
246
  * How a screen ends: with a result, or cancelled for a reason.
252
247
  *
@@ -598,8 +593,6 @@ export declare class CliUi {
598
593
  */
599
594
  static readonly map: <A, B>(screen: Screen<A>, f: (value: A) => B) => Screen<B>;
600
595
  }
601
- //#endregion
602
- //#region src/ui/UiKey.d.ts
603
596
  /**
604
597
  * The named keys a screen understands and a test can press.
605
598
  *
@@ -641,8 +634,6 @@ export declare const UiKey: {
641
634
  /** Typed text. */
642
635
  readonly char: (char: string) => UiKey;
643
636
  };
644
- //#endregion
645
- //#region src/ui/KeyTable.d.ts
646
637
  /**
647
638
  * One row of a {@link KeyTable}: the keys that trigger an action, and the help line that names it.
648
639
  *
@@ -751,8 +742,6 @@ export declare class KeyTable<Action> {
751
742
  * @public
752
743
  */
753
744
  export declare const useKeys: <Action>(table: KeyTable<Action>, dispatch: (action: Action) => void, options?: UseKeysOptions) => void;
754
- //#endregion
755
- //#region src/ui/Confirm.d.ts
756
745
  /**
757
746
  * An extra on/off row a {@link Confirm} hosts beneath its yes/no answer.
758
747
  *
@@ -903,8 +892,6 @@ export declare class Confirm {
903
892
  */
904
893
  static readonly screen: <K extends string>(options: ConfirmScreenOptions<K>) => Screen<ConfirmResult<K>>;
905
894
  }
906
- //#endregion
907
- //#region src/ui/DocView.d.ts
908
895
  /**
909
896
  * Props of {@link DocView}.
910
897
  *
@@ -941,8 +928,6 @@ interface DocViewProps {
941
928
  * @public
942
929
  */
943
930
  export declare const DocView: (props: DocViewProps) => ReactElement;
944
- //#endregion
945
- //#region src/ui/KeyHelp.d.ts
946
931
  /**
947
932
  * Props of {@link KeyHelp}.
948
933
  *
@@ -969,8 +954,6 @@ interface KeyHelpProps {
969
954
  * @public
970
955
  */
971
956
  export declare const KeyHelp: (props: KeyHelpProps) => ReactElement;
972
- //#endregion
973
- //#region src/ui/Viewport.d.ts
974
957
  /**
975
958
  * Where a viewport is: the selected item, the first item in view, how many items fit, and how many there are.
976
959
  *
@@ -1069,8 +1052,6 @@ export declare class Viewport {
1069
1052
  */
1070
1053
  static readonly View: (props: ViewportViewProps) => ReactElement;
1071
1054
  }
1072
- //#endregion
1073
- //#region src/ui/MultiSelect.d.ts
1074
1055
  /**
1075
1056
  * One item of a {@link MultiSelect} section.
1076
1057
  *
@@ -1234,8 +1215,6 @@ export declare class MultiSelect {
1234
1215
  */
1235
1216
  static readonly screen: <A>(options: MultiSelectScreenOptions<A>) => Screen<ReadonlyArray<A>>;
1236
1217
  }
1237
- //#endregion
1238
- //#region src/ui/Select.d.ts
1239
1218
  /**
1240
1219
  * One choice of a {@link Select}.
1241
1220
  *
@@ -1393,8 +1372,6 @@ export declare class Select {
1393
1372
  */
1394
1373
  static readonly screen: <A>(options: SelectScreenOptions<A>) => Screen<A>;
1395
1374
  }
1396
- //#endregion
1397
- //#region src/ui/Tabs.d.ts
1398
1375
  /**
1399
1376
  * What a key does to a {@link Tabs} row: move to the previous or next tab (wrapping), or jump to one by index.
1400
1377
  *
@@ -1482,8 +1459,6 @@ export declare class Tabs {
1482
1459
  */
1483
1460
  static readonly View: <N extends string>(props: TabsProps<N>) => ReactElement;
1484
1461
  }
1485
- //#endregion
1486
- //#region src/ui/TextInput.d.ts
1487
1462
  /**
1488
1463
  * Where a {@link TextInput} is: its value, the cursor within it, and whether enter was pressed.
1489
1464
  *
@@ -1629,8 +1604,6 @@ export declare class TextInput {
1629
1604
  */
1630
1605
  static readonly screen: (options: TextInputScreenOptions) => Screen<string>;
1631
1606
  }
1632
- //#endregion
1633
- //#region src/ui/Toggle.d.ts
1634
1607
  /**
1635
1608
  * Props of {@link Toggle.View}.
1636
1609
  *
@@ -1659,8 +1632,6 @@ export declare class Toggle {
1659
1632
  */
1660
1633
  static readonly View: (props: ToggleViewProps) => ReactElement;
1661
1634
  }
1662
- //#endregion
1663
- //#region src/ui/UiStreams.d.ts
1664
1635
  /**
1665
1636
  * The streams a screen mounts on: Node streams, because Ink's stream contract is Node's.
1666
1637
  *
@@ -1693,8 +1664,6 @@ declare const UiStreams_base: Context.Reference<UiStreamsShape>;
1693
1664
  * @public
1694
1665
  */
1695
1666
  export declare class UiStreams extends UiStreams_base {}
1696
- //#endregion
1697
- //#region src/ui/UiTheme.d.ts
1698
1667
  /**
1699
1668
  * The styling props of an Ink `Text` that a {@link @effected/cli!Style} maps to.
1700
1669
  *
@@ -1812,6 +1781,5 @@ export declare const Styled: (props: StyledProps) => ReactElement;
1812
1781
  * @public
1813
1782
  */
1814
1783
  export declare const useTerminalSize: () => TerminalSize;
1815
- //#endregion
1816
1784
  export type { Binding, CliUiFallbackOptions, CliUiPromptOptions, CliUiRunOptions, ConfirmAction, ConfirmInitOptions, ConfirmResult, ConfirmScreenOptions, ConfirmState, ConfirmToggle, ConfirmViewProps, DocViewProps, InkTextProps, KeyHelpProps, KeyHelpRow, KeyName, LiveHandle, LiveOptions, MultiSelectAction, MultiSelectInitOptions, MultiSelectItem, MultiSelectScreenOptions, MultiSelectSection, MultiSelectState, MultiSelectViewProps, Screen, ScreenControl, SelectAction, SelectChoice, SelectInitOptions, SelectScreenOptions, SelectState, SelectViewProps, StyledProps, Tab, TabsAction, TabsProps, TerminalSize, TextInputInitOptions, TextInputScreenOptions, TextInputState, TextInputViewProps, ToggleViewProps, UiContextValue, UiProviderProps, UiStreamsShape, UseKeysOptions, ViewportMove, ViewportRow, ViewportState, ViewportViewProps };
1817
1785
  //# sourceMappingURL=ui.d.ts.map