@elench/testkit 0.1.114 → 0.1.116
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/README.md +33 -8
- package/lib/cli/args.mjs +3 -3
- package/lib/cli/assistant/app.mjs +4 -2
- package/lib/cli/assistant/session.mjs +5 -1
- package/lib/cli/assistant/state.mjs +1 -2
- package/lib/cli/command-flags.mjs +4 -0
- package/lib/cli/commands/db/schema/refresh.mjs +21 -0
- package/lib/cli/commands/db/schema/verify.mjs +27 -0
- package/lib/cli/components/blocks/run-tree.mjs +7 -2
- package/lib/cli/components/hooks/use-element-layout.mjs +63 -0
- package/lib/cli/components/hooks/use-spinner-frame.mjs +26 -0
- package/lib/cli/entrypoint.mjs +1 -0
- package/lib/cli/operations/db/schema/refresh/operation.mjs +56 -0
- package/lib/cli/operations/db/{snapshot/capture → schema/verify}/operation.mjs +6 -27
- package/lib/cli/operations/run/operation.mjs +1 -0
- package/lib/cli/renderers/db-schema/text.mjs +7 -0
- package/lib/config/database.mjs +64 -0
- package/lib/config-api/index.d.ts +16 -1
- package/lib/config-api/index.mjs +31 -16
- package/lib/database/fingerprint.mjs +2 -0
- package/lib/database/index.mjs +142 -104
- package/lib/database/schema-source.mjs +295 -0
- package/lib/database/template-steps.mjs +158 -38
- package/lib/runner/orchestrator.mjs +4 -3
- package/lib/runner/template-steps.mjs +12 -1
- package/lib/runner/template.mjs +16 -1
- package/node_modules/@alcalzone/ansi-tokenize/README.md +0 -5
- package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.d.ts +8 -0
- package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js +10 -8
- package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js.map +1 -1
- package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.d.ts +1 -5
- package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js +9 -45
- package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js.map +1 -1
- package/node_modules/@alcalzone/ansi-tokenize/package.json +1 -1
- package/node_modules/@elench/next-analysis/package.json +1 -1
- package/node_modules/@elench/testkit-bridge/package.json +2 -2
- package/node_modules/@elench/testkit-protocol/package.json +1 -1
- package/node_modules/@elench/ts-analysis/package.json +1 -1
- package/node_modules/cli-boxes/index.d.ts +95 -90
- package/node_modules/cli-boxes/index.js +5 -2
- package/node_modules/cli-boxes/package.json +6 -13
- package/node_modules/cli-boxes/readme.md +15 -3
- package/node_modules/cli-truncate/index.d.ts +1 -1
- package/node_modules/cli-truncate/package.json +4 -4
- package/node_modules/cli-truncate/readme.md +1 -0
- package/node_modules/es-toolkit/CHANGELOG.md +801 -0
- package/node_modules/es-toolkit/src/compat/_internal/Equals.d.ts +1 -0
- package/node_modules/es-toolkit/src/compat/_internal/IsWritable.d.ts +3 -0
- package/node_modules/es-toolkit/src/compat/_internal/MutableList.d.ts +4 -0
- package/node_modules/es-toolkit/src/compat/_internal/RejectReadonly.d.ts +4 -0
- package/node_modules/esprima/ChangeLog +235 -0
- package/node_modules/ink/build/apply-styles.js +175 -0
- package/node_modules/ink/build/build-layout.js +77 -0
- package/node_modules/ink/build/calculate-wrapped-text.js +53 -0
- package/node_modules/ink/build/components/App.d.ts +1 -4
- package/node_modules/ink/build/components/App.js +22 -142
- package/node_modules/ink/build/components/App.js.map +1 -1
- package/node_modules/ink/build/components/AppContext.d.ts +3 -23
- package/node_modules/ink/build/components/AppContext.js +4 -7
- package/node_modules/ink/build/components/AppContext.js.map +1 -1
- package/node_modules/ink/build/components/Box.d.ts +3 -16
- package/node_modules/ink/build/components/Color.js +62 -0
- package/node_modules/ink/build/components/Cursor.d.ts +83 -0
- package/node_modules/ink/build/components/Cursor.js +53 -0
- package/node_modules/ink/build/components/Cursor.js.map +1 -0
- package/node_modules/ink/build/components/ErrorBoundary.d.ts +2 -2
- package/node_modules/ink/build/components/ErrorOverview.js +6 -6
- package/node_modules/ink/build/components/ErrorOverview.js.map +1 -1
- package/node_modules/ink/build/components/Static.js.map +1 -1
- package/node_modules/ink/build/components/StdinContext.d.ts +1 -7
- package/node_modules/ink/build/components/StdinContext.js +0 -1
- package/node_modules/ink/build/components/StdinContext.js.map +1 -1
- package/node_modules/ink/build/components/Text.d.ts +1 -1
- package/node_modules/ink/build/components/Text.js +1 -1
- package/node_modules/ink/build/components/Text.js.map +1 -1
- package/node_modules/ink/build/components/Transform.d.ts +1 -1
- package/node_modules/ink/build/devtools-window-polyfill.js +4 -7
- package/node_modules/ink/build/devtools-window-polyfill.js.map +1 -1
- package/node_modules/ink/build/devtools.js +6 -31
- package/node_modules/ink/build/devtools.js.map +1 -1
- package/node_modules/ink/build/dom.d.ts +1 -5
- package/node_modules/ink/build/dom.js +1 -20
- package/node_modules/ink/build/dom.js.map +1 -1
- package/node_modules/ink/build/experimental/apply-style.js +140 -0
- package/node_modules/ink/build/experimental/dom.js +123 -0
- package/node_modules/ink/build/experimental/output.js +91 -0
- package/node_modules/ink/build/experimental/reconciler.js +141 -0
- package/node_modules/ink/build/experimental/renderer.js +81 -0
- package/node_modules/ink/build/hooks/use-app.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-app.js +1 -1
- package/node_modules/ink/build/hooks/use-cursor.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-cursor.js +1 -1
- package/node_modules/ink/build/hooks/use-focus-manager.d.ts +2 -17
- package/node_modules/ink/build/hooks/use-focus-manager.js +1 -2
- package/node_modules/ink/build/hooks/use-focus-manager.js.map +1 -1
- package/node_modules/ink/build/hooks/use-focus.d.ts +1 -2
- package/node_modules/ink/build/hooks/use-focus.js +4 -5
- package/node_modules/ink/build/hooks/use-focus.js.map +1 -1
- package/node_modules/ink/build/hooks/use-input.d.ts +1 -2
- package/node_modules/ink/build/hooks/use-input.js +80 -82
- package/node_modules/ink/build/hooks/use-input.js.map +1 -1
- package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.d.ts +1 -2
- package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js +1 -2
- package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js.map +1 -1
- package/node_modules/ink/build/hooks/use-stderr.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-stderr.js +1 -1
- package/node_modules/ink/build/hooks/use-stdin.d.ts +2 -4
- package/node_modules/ink/build/hooks/use-stdin.js +1 -2
- package/node_modules/ink/build/hooks/use-stdin.js.map +1 -1
- package/node_modules/ink/build/hooks/use-stdout.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-stdout.js +1 -1
- package/node_modules/ink/build/hooks/useInput.js +38 -0
- package/node_modules/ink/build/index.d.ts +1 -8
- package/node_modules/ink/build/index.js +0 -4
- package/node_modules/ink/build/index.js.map +1 -1
- package/node_modules/ink/build/ink.d.ts +3 -48
- package/node_modules/ink/build/ink.js +155 -325
- package/node_modules/ink/build/ink.js.map +1 -1
- package/node_modules/ink/build/input-parser.d.ts +1 -4
- package/node_modules/ink/build/input-parser.js +30 -70
- package/node_modules/ink/build/input-parser.js.map +1 -1
- package/node_modules/ink/build/instance.js +205 -0
- package/node_modules/ink/build/layout.d.ts +7 -0
- package/node_modules/ink/build/layout.js +33 -0
- package/node_modules/ink/build/layout.js.map +1 -0
- package/node_modules/ink/build/log-update.d.ts +0 -1
- package/node_modules/ink/build/log-update.js +1 -13
- package/node_modules/ink/build/log-update.js.map +1 -1
- package/node_modules/ink/build/measure-element.d.ts +0 -4
- package/node_modules/ink/build/measure-element.js +0 -4
- package/node_modules/ink/build/measure-element.js.map +1 -1
- package/node_modules/ink/build/options.d.ts +52 -0
- package/node_modules/ink/build/options.js +2 -0
- package/node_modules/ink/build/options.js.map +1 -0
- package/node_modules/ink/build/output.js +0 -25
- package/node_modules/ink/build/output.js.map +1 -1
- package/node_modules/ink/build/parse-keypress.d.ts +3 -1
- package/node_modules/ink/build/parse-keypress.js +17 -19
- package/node_modules/ink/build/parse-keypress.js.map +1 -1
- package/node_modules/ink/build/reconciler.js +27 -46
- package/node_modules/ink/build/reconciler.js.map +1 -1
- package/node_modules/ink/build/render-border.js +18 -29
- package/node_modules/ink/build/render-border.js.map +1 -1
- package/node_modules/ink/build/render-to-string.js +1 -2
- package/node_modules/ink/build/render-to-string.js.map +1 -1
- package/node_modules/ink/build/render.d.ts +2 -57
- package/node_modules/ink/build/render.js +11 -18
- package/node_modules/ink/build/render.js.map +1 -1
- package/node_modules/ink/build/screen-reader-update.d.ts +13 -0
- package/node_modules/ink/build/screen-reader-update.js +38 -0
- package/node_modules/ink/build/screen-reader-update.js.map +1 -0
- package/node_modules/ink/build/styles.d.ts +16 -78
- package/node_modules/ink/build/styles.js +31 -102
- package/node_modules/ink/build/styles.js.map +1 -1
- package/node_modules/ink/build/utils.d.ts +2 -9
- package/node_modules/ink/build/utils.js +3 -18
- package/node_modules/ink/build/utils.js.map +1 -1
- package/node_modules/ink/build/wrap-text.js +0 -7
- package/node_modules/ink/build/wrap-text.js.map +1 -1
- package/node_modules/ink/build/write-synchronized.d.ts +1 -1
- package/node_modules/ink/build/write-synchronized.js +2 -4
- package/node_modules/ink/build/write-synchronized.js.map +1 -1
- package/node_modules/ink/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/ink/node_modules/emoji-regex/README.md +107 -0
- package/node_modules/ink/node_modules/emoji-regex/index.d.ts +3 -0
- package/node_modules/ink/node_modules/emoji-regex/index.js +4 -0
- package/node_modules/ink/node_modules/emoji-regex/index.mjs +4 -0
- package/node_modules/ink/node_modules/emoji-regex/package.json +45 -0
- package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/index.d.ts +1 -1
- package/node_modules/ink/node_modules/wrap-ansi/index.js +222 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.d.ts +39 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.js +82 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/license +9 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/package.json +64 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/readme.md +66 -0
- package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/package.json +11 -11
- package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/readme.md +0 -2
- package/node_modules/ink/package.json +98 -34
- package/node_modules/ink/readme.md +48 -554
- package/node_modules/slice-ansi/index.d.ts +1 -1
- package/node_modules/slice-ansi/index.js +89 -146
- package/node_modules/slice-ansi/package.json +5 -5
- package/node_modules/slice-ansi/readme.md +0 -1
- package/node_modules/slice-ansi/tokenize-ansi.js +1 -1
- package/package.json +14 -10
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts +188 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts.map +1 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js +293 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js.map +1 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/package.json +25 -0
- package/lib/cli/commands/db/snapshot/capture.mjs +0 -26
- package/lib/cli/renderers/db-snapshot-capture/text.mjs +0 -3
- package/node_modules/@alcalzone/ansi-tokenize/build/consts.d.ts +0 -17
- package/node_modules/@alcalzone/ansi-tokenize/build/consts.js +0 -28
- package/node_modules/@alcalzone/ansi-tokenize/build/consts.js.map +0 -1
- package/node_modules/ink/build/components/AnimationContext.d.ts +0 -9
- package/node_modules/ink/build/components/AnimationContext.js +0 -13
- package/node_modules/ink/build/components/AnimationContext.js.map +0 -1
- package/node_modules/ink/build/hooks/use-animation.d.ts +0 -49
- package/node_modules/ink/build/hooks/use-animation.js +0 -87
- package/node_modules/ink/build/hooks/use-animation.js.map +0 -1
- package/node_modules/ink/build/hooks/use-box-metrics.d.ts +0 -59
- package/node_modules/ink/build/hooks/use-box-metrics.js +0 -88
- package/node_modules/ink/build/hooks/use-box-metrics.js.map +0 -1
- package/node_modules/ink/build/hooks/use-paste.d.ts +0 -35
- package/node_modules/ink/build/hooks/use-paste.js +0 -62
- package/node_modules/ink/build/hooks/use-paste.js.map +0 -1
- package/node_modules/ink/build/hooks/use-window-size.d.ts +0 -18
- package/node_modules/ink/build/hooks/use-window-size.js +0 -22
- package/node_modules/ink/build/hooks/use-window-size.js.map +0 -1
- package/node_modules/wrap-ansi/index.js +0 -468
- /package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/license +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-border.js","sourceRoot":"","sources":["../src/render-border.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,eAAe,CAAC;AAIrC,MAAM,
|
|
1
|
+
{"version":3,"file":"render-border.js","sourceRoot":"","sources":["../src/render-border.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,eAAe,CAAC;AAIrC,MAAM,YAAY,GAAG,CACpB,CAAS,EACT,CAAS,EACT,IAAa,EACb,MAAc,EACP,EAAE;IACT,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,QAAS,CAAC,gBAAgB,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAS,CAAC,iBAAiB,EAAE,CAAC;QAClD,MAAM,GAAG,GACR,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,QAAQ;YACzC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;YAClC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QAE3B,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QAC3E,MAAM,iBAAi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Error
|
|
85
85
|
? uncaughtError
|
|
86
|
-
:
|
|
87
|
-
new Error(String(uncaughtError));
|
|
86
|
+
: new Error(String(uncaughtError));
|
|
88
87
|
}
|
|
89
88
|
// The renderer appends a trailing newline to static output for terminal
|
|
90
89
|
// rendering (so dynamic output starts on a fresh line). Strip it here
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-to-string.js","sourceRoot":"","sources":["../src/render-to-string.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAC,MAAM,+BAA+B,CAAC;AACzD,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,EAAC,UAAU,EAAkB,MAAM,UAAU,CAAC;AAWrD;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BE;AACF,MAAM,cAAc,GAAG,CACtB,IAAe,EACf,OAA+B,EACtB,EAAE;IACX,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC;IAEvC,yEAAyE;IACzE,MAAM,QAAQ,GAAe,UAAU,CAAC,UAAU,CAAC,CAAC;IAEpD,mDAAmD;IACnD,0EAA0E;IAC1E,8EAA8E;IAC9E,uEAAuE;IACvE,2EAA2E;IAC3E,+BAA+B;IAC/B,IAAI,oBAAoB,GAAG,EAAE,CAAC;IAE9B,QAAQ,CAAC,eAAe,GAAG,GAAG,EAAE;QAC/B,QAAQ,CAAC,QAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACrC,QAAQ,CAAC,QAAS,CAAC,eAAe,CACjC,SAAS,EACT,SAAS,EACT,IAAI,CAAC,aAAa,CAClB,CAAC;IACH,CAAC,CAAC;IAEF,QAAQ,CAAC,iBAAiB,GAAG,GAAG,EAAE;QACjC,MAAM,EAAC,YAAY,EAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjD,IAAI,YAA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GAAG,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjE,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACnC,CAAC,CAAC,oBAAoB,CAAC;QAExB,IAAI,sBAAsB,IAAI,MAAM,EAAE,CAAC;YACtC,OAAO,sBAAsB,GAAG,IAAI,GAAG,MAAM,CAAC;QAC/C,CAAC;QAED,OAAO,sBAAsB,IAAI,MAAM,CAAC;IACzC,CAAC;YAAS,CAAC;QACV,0EAA0E;QAC1E,wDAAwD;QACxD,IAAI,CAAC,iBAAiB,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAC7C,IAAI,CAAC;gBACJ,oEAAoE;gBACpE,uEAAuE;gBACvE,QAAQ,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;YACnC,CAAC;YAAC,MAAM,CAAC;gBACR,mDAAmD;YACpD,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -34,16 +34,11 @@ export type RenderOptions = {
|
|
|
34
34
|
/**
|
|
35
35
|
Patch console methods to ensure console output doesn't mix with Ink's output.
|
|
36
36
|
|
|
37
|
-
Note: Once unmount starts, Ink restores the native console before React cleanup runs. Teardown-time `console.*` output then follows the normal console behavior instead of being rerouted through Ink.
|
|
38
|
-
|
|
39
37
|
@default true
|
|
40
38
|
*/
|
|
41
39
|
patchConsole?: boolean;
|
|
42
40
|
/**
|
|
43
|
-
Runs the given callback after each render and re-render
|
|
44
|
-
|
|
45
|
-
Note: this callback runs after Ink commits a frame, but it does not wait for `stdout`/`stderr` stream callbacks.
|
|
46
|
-
To run code after output is flushed, use `waitUntilRenderFlush()`.
|
|
41
|
+
Runs the given callback after each render and re-render.
|
|
47
42
|
*/
|
|
48
43
|
onRender?: (metrics: RenderMetrics) => void;
|
|
49
44
|
/**
|
|
@@ -75,7 +70,7 @@ export type RenderOptions = {
|
|
|
75
70
|
- `useTransition` and `useDeferredValue` are fully functional
|
|
76
71
|
- Updates can be interrupted for higher priority work
|
|
77
72
|
|
|
78
|
-
Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates.
|
|
73
|
+
Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. The `concurrent` option only takes effect on the first render for a given stdout. If you need to change the rendering mode, call `unmount()` first.
|
|
79
74
|
|
|
80
75
|
@default false
|
|
81
76
|
*/
|
|
@@ -88,34 +83,6 @@ export type RenderOptions = {
|
|
|
88
83
|
@see https://sw.kovidgoyal.net/kitty/keyboard-protocol/
|
|
89
84
|
*/
|
|
90
85
|
kittyKeyboard?: KittyKeyboardOptions;
|
|
91
|
-
/**
|
|
92
|
-
Override automatic interactive mode detection.
|
|
93
|
-
|
|
94
|
-
By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
|
|
95
|
-
|
|
96
|
-
When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
|
|
97
|
-
|
|
98
|
-
Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
|
|
99
|
-
|
|
100
|
-
Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
|
|
101
|
-
|
|
102
|
-
@default true (false if in CI or `stdout.isTTY` is falsy)
|
|
103
|
-
*/
|
|
104
|
-
interactive?: boolean;
|
|
105
|
-
/**
|
|
106
|
-
Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
|
|
107
|
-
|
|
108
|
-
Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
|
|
109
|
-
|
|
110
|
-
Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
|
|
111
|
-
|
|
112
|
-
Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
|
|
113
|
-
|
|
114
|
-
Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
|
|
115
|
-
|
|
116
|
-
@default false
|
|
117
|
-
*/
|
|
118
|
-
alternateScreen?: boolean;
|
|
119
86
|
};
|
|
120
87
|
export type Instance = {
|
|
121
88
|
/**
|
|
@@ -130,7 +97,6 @@ export type Instance = {
|
|
|
130
97
|
Returns a promise that settles when the app is unmounted.
|
|
131
98
|
|
|
132
99
|
It resolves with the value passed to `exit(value)` and rejects with the error passed to `exit(error)`.
|
|
133
|
-
When `unmount()` is called manually, it settles after unmount-related stdout writes complete.
|
|
134
100
|
|
|
135
101
|
@example
|
|
136
102
|
```jsx
|
|
@@ -142,27 +108,6 @@ export type Instance = {
|
|
|
142
108
|
```
|
|
143
109
|
*/
|
|
144
110
|
waitUntilExit: Ink['waitUntilExit'];
|
|
145
|
-
/**
|
|
146
|
-
Returns a promise that settles after pending render output is flushed to stdout.
|
|
147
|
-
|
|
148
|
-
This can be used after `rerender()` when you need to run code only after the frame is written.
|
|
149
|
-
|
|
150
|
-
@example
|
|
151
|
-
```jsx
|
|
152
|
-
const {rerender, waitUntilRenderFlush} = render(<MyApp step="loading" />);
|
|
153
|
-
|
|
154
|
-
rerender(<MyApp step="ready" />);
|
|
155
|
-
await waitUntilRenderFlush(); // output for "ready" is flushed
|
|
156
|
-
|
|
157
|
-
runNextCommand();
|
|
158
|
-
```
|
|
159
|
-
*/
|
|
160
|
-
waitUntilRenderFlush: Ink['waitUntilRenderFlush'];
|
|
161
|
-
/**
|
|
162
|
-
Unmount the current app and remove the internal Ink instance for this stdout.
|
|
163
|
-
|
|
164
|
-
This is mostly useful for advanced cases where you need `render()` to create a fresh instance for the same stream without leaving terminal state such as the alternate screen behind.
|
|
165
|
-
*/
|
|
166
111
|
cleanup: () => void;
|
|
167
112
|
/**
|
|
168
113
|
Clear output.
|
|
@@ -16,10 +16,9 @@ const render = (node, options) => {
|
|
|
16
16
|
maxFps: 30,
|
|
17
17
|
incrementalRendering: false,
|
|
18
18
|
concurrent: false,
|
|
19
|
-
alternateScreen: false,
|
|
20
19
|
...getOptions(options),
|
|
21
20
|
};
|
|
22
|
-
const instance = getInstance(inkOptions.stdout, () => new Ink(inkOptions));
|
|
21
|
+
const instance = getInstance(inkOptions.stdout, () => new Ink(inkOptions), inkOptions.concurrent ?? false);
|
|
23
22
|
instance.render(node);
|
|
24
23
|
return {
|
|
25
24
|
rerender: instance.render,
|
|
@@ -27,10 +26,7 @@ const render = (node, options) => {
|
|
|
27
26
|
instance.unmount();
|
|
28
27
|
},
|
|
29
28
|
waitUntilExit: instance.waitUntilExit,
|
|
30
|
-
|
|
31
|
-
cleanup() {
|
|
32
|
-
instance.unmount();
|
|
33
|
-
},
|
|
29
|
+
cleanup: () => instances.delete(inkOptions.stdout),
|
|
34
30
|
clear: instance.clear,
|
|
35
31
|
};
|
|
36
32
|
};
|
|
@@ -44,19 +40,16 @@ const getOptions = (stdout = {}) => {
|
|
|
44
40
|
}
|
|
45
41
|
return stdout;
|
|
46
42
|
};
|
|
47
|
-
const getInstance = (stdout, createInstance) => {
|
|
48
|
-
|
|
49
|
-
if (instance
|
|
50
|
-
|
|
51
|
-
instances.set(stdout,
|
|
52
|
-
|
|
43
|
+
const getInstance = (stdout, createInstance, concurrent) => {
|
|
44
|
+
let instance = instances.get(stdout);
|
|
45
|
+
if (!instance) {
|
|
46
|
+
instance = createInstance();
|
|
47
|
+
instances.set(stdout, instance);
|
|
48
|
+
}
|
|
49
|
+
else if (instance.isConcurrent !== concurrent) {
|
|
50
|
+
console.warn(`Warning: render() was called with concurrent: ${concurrent}, but the existing instance for this stdout uses concurrent: ${instance.isConcurrent}. ` +
|
|
51
|
+
`The concurrent option only takes effect on the first render. Call unmount() first if you need to change the rendering mode.`);
|
|
53
52
|
}
|
|
54
|
-
// Ink keeps one live renderer per stdout. Reusing the same stream without
|
|
55
|
-
// unmounting is unsupported, but return the existing instance so we don't
|
|
56
|
-
// create two renderers that compete for the same output. Write the warning
|
|
57
|
-
// directly to native stderr so an existing alternate-screen renderer cannot
|
|
58
|
-
// swallow it via patchConsole.
|
|
59
|
-
process.stderr.write('Warning: render() was called again for the same stdout before the previous Ink instance was unmounted. Reusing stdout across multiple render() calls is unsupported. Call unmount() first.\n');
|
|
60
53
|
return instance;
|
|
61
54
|
};
|
|
62
55
|
//# sourceMappingURL=render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,GAAqD,MAAM,UAAU,CAAC;AAC7E,OAAO,SAAS,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,GAAqD,MAAM,UAAU,CAAC;AAC7E,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAqIvC;;EAEE;AACF,MAAM,MAAM,GAAG,CACd,IAAe,EACf,OAA4C,EACjC,EAAE;IACb,MAAM,UAAU,GAAe;QAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,IAAI;QAClB,MAAM,EAAE,EAAE;QACV,oBAAoB,EAAE,KAAK;QAC3B,UA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IAAI;YACnJ,6HAA6H,CAC9H,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type WriteStream } from 'node:tty';
|
|
2
|
+
declare class ScreenReaderUpdate {
|
|
3
|
+
private readonly stdout;
|
|
4
|
+
private readonly stderr;
|
|
5
|
+
private previousOutput;
|
|
6
|
+
private previousLineCount;
|
|
7
|
+
constructor(stdout: WriteStream, stderr: WriteStream);
|
|
8
|
+
private wrap;
|
|
9
|
+
render(output: string): void;
|
|
10
|
+
writeStdout(data: string): void;
|
|
11
|
+
writeStderr(data: string): void;
|
|
12
|
+
}
|
|
13
|
+
export default ScreenReaderUpdate;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ansiEscapes from 'ansi-escapes';
|
|
2
|
+
import wrapAnsi from 'wrap-ansi';
|
|
3
|
+
class ScreenReaderUpdate {
|
|
4
|
+
stdout;
|
|
5
|
+
stderr;
|
|
6
|
+
previousOutput = '';
|
|
7
|
+
previousLineCount = 0;
|
|
8
|
+
constructor(stdout, stderr) {
|
|
9
|
+
this.stdout = stdout;
|
|
10
|
+
this.stderr = stderr;
|
|
11
|
+
}
|
|
12
|
+
wrap(output) {
|
|
13
|
+
const width = this.stdout.columns || 80;
|
|
14
|
+
return wrapAnsi(output, width, { trim: false, hard: true });
|
|
15
|
+
}
|
|
16
|
+
render(output) {
|
|
17
|
+
const wrapped = this.wrap(output);
|
|
18
|
+
if (wrapped === this.previousOutput) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const erase = this.previousLineCount > 0 ? ansiEscapes.eraseLines(this.previousLineCount) : '';
|
|
22
|
+
this.stdout.write(erase + wrapped);
|
|
23
|
+
this.previousOutput = wrapped;
|
|
24
|
+
this.previousLineCount = wrapped === '' ? 0 : wrapped.split('\n').length;
|
|
25
|
+
}
|
|
26
|
+
writeStdout(data) {
|
|
27
|
+
const erase = this.previousLineCount > 0 ? ansiEscapes.eraseLines(this.previousLineCount) : '';
|
|
28
|
+
this.stdout.write(erase + data + this.previousOutput);
|
|
29
|
+
}
|
|
30
|
+
writeStderr(data) {
|
|
31
|
+
const erase = this.previousLineCount > 0 ? ansiEscapes.eraseLines(this.previousLineCount) : '';
|
|
32
|
+
this.stdout.write(erase);
|
|
33
|
+
this.stderr.write(data);
|
|
34
|
+
this.stdout.write(this.previousOutput);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export default ScreenReaderUpdate;
|
|
38
|
+
//# sourceMappingURL=screen-reader-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-reader-update.js","sourceRoot":"","sources":["../src/screen-reader-update.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC,MAAM,kBAAkB;IAKH;IACA;IALX,cAAc,GAAG,EAAE,CAAC;IACpB,iBAAiB,GAAG,CAAC,CAAC;IAE9B,YACmB,MAAmB,EACnB,MAAmB;QADnB,WAAM,GAAN,MAAM,CAAa;QACnB,WAAM,GAAN,MAAM,CAAa;IACnC,CAAC;IAEI,IAAI,CAAC,MAAc;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QACxC,OAAO,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,OAAO,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC;YACpC,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/F,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC;QAEnC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,IAAI,CAAC,iBAAiB,GAAG,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IAC3E,CAAC;IAED,WAAW,CAAC,IAAY;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/F,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC;IACxD,CAAC;IAED,WAAW,CAAC,IAAY;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/F,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACzC,CAAC;CACF;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -3,29 +3,8 @@ import { type LiteralUnion } from 'type-fest';
|
|
|
3
3
|
import { type ForegroundColorName } from 'ansi-styles';
|
|
4
4
|
import { type Node as YogaNode } from 'yoga-layout';
|
|
5
5
|
export type Styles = {
|
|
6
|
-
readonly textWrap?: 'wrap' | '
|
|
7
|
-
|
|
8
|
-
Controls how the element is positioned.
|
|
9
|
-
|
|
10
|
-
When `position` is `static`, `top`, `right`, `bottom`, and `left` are ignored.
|
|
11
|
-
*/
|
|
12
|
-
readonly position?: 'absolute' | 'relative' | 'static';
|
|
13
|
-
/**
|
|
14
|
-
Top offset for positioned elements.
|
|
15
|
-
*/
|
|
16
|
-
readonly top?: number | string;
|
|
17
|
-
/**
|
|
18
|
-
Right offset for positioned elements.
|
|
19
|
-
*/
|
|
20
|
-
readonly right?: number | string;
|
|
21
|
-
/**
|
|
22
|
-
Bottom offset for positioned elements.
|
|
23
|
-
*/
|
|
24
|
-
readonly bottom?: number | string;
|
|
25
|
-
/**
|
|
26
|
-
Left offset for positioned elements.
|
|
27
|
-
*/
|
|
28
|
-
readonly left?: number | string;
|
|
6
|
+
readonly textWrap?: 'wrap' | 'end' | 'middle' | 'truncate-end' | 'truncate' | 'truncate-middle' | 'truncate-start';
|
|
7
|
+
readonly position?: 'absolute' | 'relative';
|
|
29
8
|
/**
|
|
30
9
|
Size of the gap between an element's columns.
|
|
31
10
|
*/
|
|
@@ -123,17 +102,12 @@ export type Styles = {
|
|
|
123
102
|
The align-items property defines the default behavior for how items are laid out along the cross axis (perpendicular to the main axis).
|
|
124
103
|
See [align-items](https://css-tricks.com/almanac/properties/a/align-items/).
|
|
125
104
|
*/
|
|
126
|
-
readonly alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch'
|
|
105
|
+
readonly alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch';
|
|
127
106
|
/**
|
|
128
107
|
It makes possible to override the align-items value for specific flex items.
|
|
129
108
|
See [align-self](https://css-tricks.com/almanac/properties/a/align-self/).
|
|
130
109
|
*/
|
|
131
|
-
readonly alignSelf?: 'flex-start' | 'center' | 'flex-end' | 'auto'
|
|
132
|
-
/**
|
|
133
|
-
It defines the alignment along the cross axis when there are multiple lines of flex items (when using flex-wrap).
|
|
134
|
-
See [align-content](https://css-tricks.com/almanac/properties/a/align-content/).
|
|
135
|
-
*/
|
|
136
|
-
readonly alignContent?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'space-between' | 'space-around' | 'space-evenly';
|
|
110
|
+
readonly alignSelf?: 'flex-start' | 'center' | 'flex-end' | 'auto';
|
|
137
111
|
/**
|
|
138
112
|
It defines the alignment along the main axis.
|
|
139
113
|
See [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).
|
|
@@ -149,29 +123,13 @@ export type Styles = {
|
|
|
149
123
|
readonly height?: number | string;
|
|
150
124
|
/**
|
|
151
125
|
Sets a minimum width of the element.
|
|
152
|
-
Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
|
|
153
126
|
*/
|
|
154
127
|
readonly minWidth?: number | string;
|
|
155
128
|
/**
|
|
156
|
-
Sets a minimum height of the element
|
|
129
|
+
Sets a minimum height of the element.
|
|
157
130
|
*/
|
|
158
131
|
readonly minHeight?: number | string;
|
|
159
132
|
/**
|
|
160
|
-
Sets a maximum width of the element.
|
|
161
|
-
Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
|
|
162
|
-
*/
|
|
163
|
-
readonly maxWidth?: number | string;
|
|
164
|
-
/**
|
|
165
|
-
Sets a maximum height of the element in lines (rows). You can also set it as a percentage, which will calculate the maximum height based on the height of the parent element.
|
|
166
|
-
*/
|
|
167
|
-
readonly maxHeight?: number | string;
|
|
168
|
-
/**
|
|
169
|
-
Defines the aspect ratio (width/height) for the element.
|
|
170
|
-
|
|
171
|
-
Use it with at least one size constraint (`width`, `height`, `minHeight`, or `maxHeight`) so Ink can derive the missing dimension.
|
|
172
|
-
*/
|
|
173
|
-
readonly aspectRatio?: number;
|
|
174
|
-
/**
|
|
175
133
|
Set this property to `none` to hide the element.
|
|
176
134
|
*/
|
|
177
135
|
readonly display?: 'flex' | 'none';
|
|
@@ -181,25 +139,25 @@ export type Styles = {
|
|
|
181
139
|
readonly borderStyle?: keyof Boxes | BoxStyle;
|
|
182
140
|
/**
|
|
183
141
|
Determines whether the top border is visible.
|
|
184
|
-
|
|
142
|
+
|
|
185
143
|
@default true
|
|
186
144
|
*/
|
|
187
145
|
readonly borderTop?: boolean;
|
|
188
146
|
/**
|
|
189
147
|
Determines whether the bottom border is visible.
|
|
190
|
-
|
|
148
|
+
|
|
191
149
|
@default true
|
|
192
150
|
*/
|
|
193
151
|
readonly borderBottom?: boolean;
|
|
194
152
|
/**
|
|
195
153
|
Determines whether the left border is visible.
|
|
196
|
-
|
|
154
|
+
|
|
197
155
|
@default true
|
|
198
156
|
*/
|
|
199
157
|
readonly borderLeft?: boolean;
|
|
200
158
|
/**
|
|
201
159
|
Determines whether the right border is visible.
|
|
202
|
-
|
|
160
|
+
|
|
203
161
|
@default true
|
|
204
162
|
*/
|
|
205
163
|
readonly borderRight?: boolean;
|
|
@@ -231,51 +189,31 @@ export type Styles = {
|
|
|
231
189
|
readonly borderDimColor?: boolean;
|
|
232
190
|
/**
|
|
233
191
|
Dim the top border color.
|
|
234
|
-
|
|
192
|
+
|
|
235
193
|
@default false
|
|
236
194
|
*/
|
|
237
195
|
readonly borderTopDimColor?: boolean;
|
|
238
196
|
/**
|
|
239
197
|
Dim the bottom border color.
|
|
240
|
-
|
|
198
|
+
|
|
241
199
|
@default false
|
|
242
200
|
*/
|
|
243
201
|
readonly borderBottomDimColor?: boolean;
|
|
244
202
|
/**
|
|
245
203
|
Dim the left border color.
|
|
246
|
-
|
|
204
|
+
|
|
247
205
|
@default false
|
|
248
206
|
*/
|
|
249
207
|
readonly borderLeftDimColor?: boolean;
|
|
250
208
|
/**
|
|
251
209
|
Dim the right border color.
|
|
252
|
-
|
|
210
|
+
|
|
253
211
|
@default false
|
|
254
212
|
*/
|
|
255
213
|
readonly borderRightDimColor?: boolean;
|
|
256
214
|
/**
|
|
257
|
-
Change border background color. A shorthand for setting `borderTopBackgroundColor`, `borderRightBackgroundColor`, `borderBottomBackgroundColor`, and `borderLeftBackgroundColor`.
|
|
258
|
-
*/
|
|
259
|
-
readonly borderBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
|
|
260
|
-
/**
|
|
261
|
-
Change top border background color. Accepts the same values as `backgroundColor` in `Text` component.
|
|
262
|
-
*/
|
|
263
|
-
readonly borderTopBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
|
|
264
|
-
/**
|
|
265
|
-
Change bottom border background color. Accepts the same values as `backgroundColor` in `Text` component.
|
|
266
|
-
*/
|
|
267
|
-
readonly borderBottomBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
|
|
268
|
-
/**
|
|
269
|
-
Change left border background color. Accepts the same values as `backgroundColor` in `Text` component.
|
|
270
|
-
*/
|
|
271
|
-
readonly borderLeftBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
|
|
272
|
-
/**
|
|
273
|
-
Change right border background color. Accepts the same values as `backgroundColor` in `Text` component.
|
|
274
|
-
*/
|
|
275
|
-
readonly borderRightBackgroundColor?: LiteralUnion<ForegroundColorName, string>;
|
|
276
|
-
/**
|
|
277
215
|
Behavior for an element's overflow in both directions.
|
|
278
|
-
|
|
216
|
+
|
|
279
217
|
@default 'visible'
|
|
280
218
|
*/
|
|
281
219
|
readonly overflow?: 'visible' | 'hidden';
|
|
@@ -293,10 +231,10 @@ export type Styles = {
|
|
|
293
231
|
readonly overflowY?: 'visible' | 'hidden';
|
|
294
232
|
/**
|
|
295
233
|
Background color for the element.
|
|
296
|
-
|
|
234
|
+
|
|
297
235
|
Accepts the same values as `color` in the `<Text>` component.
|
|
298
236
|
*/
|
|
299
237
|
readonly backgroundColor?: LiteralUnion<ForegroundColorName, string>;
|
|
300
238
|
};
|
|
301
|
-
declare const styles: (node: YogaNode, style?: Styles
|
|
239
|
+
declare const styles: (node: YogaNode, style?: Styles) => void;
|
|
302
240
|
export default styles;
|