@tui-sandbox/library 11.10.0 → 11.11.1

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 (48) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/browser/assets/{index-DCtcQK5s.js → index-BQzArJW3.js} +7 -7
  3. package/dist/browser/assets/index-hkmOP7rU.css +1 -0
  4. package/dist/browser/index.html +2 -2
  5. package/dist/src/client/neovim-terminal-client.js +1 -6
  6. package/dist/src/client/neovim-terminal-client.js.map +1 -1
  7. package/dist/src/client/validateMouseEvent.js +1 -0
  8. package/dist/src/client/validateMouseEvent.js.map +1 -1
  9. package/dist/src/scripts/tui.js +1 -1
  10. package/dist/src/scripts/tui.js.map +1 -1
  11. package/dist/src/server/TestServer.js +1 -1
  12. package/dist/src/server/TestServer.js.map +1 -1
  13. package/dist/src/server/applications/neovim/NeovimApplication.js +2 -6
  14. package/dist/src/server/applications/neovim/NeovimApplication.js.map +1 -1
  15. package/dist/src/server/applications/neovim/NeovimJavascriptApiClient.js +1 -1
  16. package/dist/src/server/applications/neovim/NeovimJavascriptApiClient.js.map +1 -1
  17. package/dist/src/server/applications/neovim/api.js +1 -2
  18. package/dist/src/server/applications/neovim/api.js.map +1 -1
  19. package/dist/src/server/applications/terminal/TerminalTestApplication.d.ts +2 -2
  20. package/dist/src/server/applications/terminal/TerminalTestApplication.js +1 -0
  21. package/dist/src/server/applications/terminal/TerminalTestApplication.js.map +1 -1
  22. package/dist/src/server/applications/terminal/api.js.map +1 -1
  23. package/dist/src/server/cypress-support/createCypressSupportFile.js +2 -2
  24. package/dist/src/server/cypress-support/createCypressSupportFile.js.map +1 -1
  25. package/dist/src/server/dirtree/json-to-zod.js +1 -1
  26. package/dist/src/server/dirtree/json-to-zod.js.map +1 -1
  27. package/dist/src/server/types.d.ts +12 -0
  28. package/dist/src/server/updateTestdirectorySchemaFile.js +1 -1
  29. package/dist/src/server/updateTestdirectorySchemaFile.js.map +1 -1
  30. package/dist/src/server/utilities/generator.js +0 -1
  31. package/dist/src/server/utilities/generator.js.map +1 -1
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +15 -15
  34. package/src/client/neovim-terminal-client.ts +1 -5
  35. package/src/client/validateMouseEvent.ts +1 -0
  36. package/src/scripts/tui.ts +1 -1
  37. package/src/server/TestServer.ts +1 -1
  38. package/src/server/applications/neovim/NeovimApplication.ts +2 -7
  39. package/src/server/applications/neovim/NeovimJavascriptApiClient.ts +1 -1
  40. package/src/server/applications/neovim/api.ts +2 -3
  41. package/src/server/applications/terminal/TerminalTestApplication.ts +3 -0
  42. package/src/server/applications/terminal/api.ts +2 -1
  43. package/src/server/cypress-support/createCypressSupportFile.ts +2 -2
  44. package/src/server/dirtree/json-to-zod.ts +1 -1
  45. package/src/server/types.ts +13 -5
  46. package/src/server/updateTestdirectorySchemaFile.ts +1 -1
  47. package/src/server/utilities/generator.ts +0 -1
  48. package/dist/browser/assets/index-BYvynUT_.css +0 -32
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tui-sandbox/library",
3
- "version": "11.10.0",
3
+ "version": "11.11.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mikavilpas/tui-sandbox"
@@ -12,32 +12,32 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@catppuccin/palette": "1.7.1",
15
- "@trpc/client": "11.7.0",
16
- "@trpc/server": "11.7.0",
15
+ "@trpc/client": "11.7.2",
16
+ "@trpc/server": "11.7.2",
17
17
  "@xterm/addon-fit": "0.10.0",
18
18
  "@xterm/addon-unicode11": "0.8.0",
19
19
  "@xterm/xterm": "5.5.0",
20
20
  "concurrently": "9.2.1",
21
21
  "cors": "2.8.5",
22
22
  "dree": "5.1.5",
23
- "express": "5.1.0",
23
+ "express": "5.2.1",
24
24
  "neovim": "5.4.0",
25
25
  "node-pty": "1.0.0",
26
- "prettier": "3.6.2",
27
- "tsx": "4.20.6",
28
- "winston": "3.18.3",
29
- "zod": "4.1.12"
26
+ "prettier": "3.7.4",
27
+ "tsx": "4.21.0",
28
+ "winston": "3.19.0",
29
+ "zod": "4.1.13"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/command-exists": "1.2.3",
33
33
  "@types/cors": "2.8.19",
34
- "@types/express": "5.0.4",
35
- "@types/node": "24.9.1",
36
- "cypress": "15.5.0",
37
- "nodemon": "3.1.10",
38
- "type-fest": "5.1.0",
39
- "vite": "7.1.12",
40
- "vitest": "4.0.3"
34
+ "@types/express": "5.0.6",
35
+ "@types/node": "24.10.3",
36
+ "cypress": "15.7.1",
37
+ "nodemon": "3.1.11",
38
+ "type-fest": "5.3.1",
39
+ "vite": "7.2.7",
40
+ "vitest": "4.0.15"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "cypress": "^13 || ^14 || ^15",
@@ -120,11 +120,7 @@ export class NeovimTerminalClient {
120
120
 
121
121
  public async waitForLuaCode(input: PollLuaCodeClientInput): Promise<RunLuaCodeOutput> {
122
122
  await this.ready
123
- try {
124
- return await this.trpc.neovim.waitForLuaCode.mutate({ ...input, tabId: this.tabId })
125
- } catch (e) {
126
- throw e
127
- }
123
+ return this.trpc.neovim.waitForLuaCode.mutate({ ...input, tabId: this.tabId })
128
124
  }
129
125
 
130
126
  public async runExCommand(input: ExCommandClientInput): Promise<RunExCommandOutput> {
@@ -1,6 +1,7 @@
1
1
  // Function to parse mouse events
2
2
  // https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Button-event-tracking
3
3
  export function validateMouseEvent(data: string): string | undefined {
4
+ // oxlint-disable-next-line no-control-regex
4
5
  const match = /\x1b\[<(\d+);(\d+);(\d+)([mM])/.exec(data)
5
6
  if (!match) {
6
7
  return
@@ -56,7 +56,7 @@ switch (command?.action) {
56
56
  process.exitCode = typeof result === "number" ? result : 1
57
57
  break
58
58
  }
59
- default: {
59
+ case undefined: {
60
60
  command satisfies undefined
61
61
  showUsageAndExit()
62
62
  }
@@ -38,7 +38,7 @@ export class TestServer {
38
38
  const publicPath = path.resolve(__dirname, "..", "..", "browser")
39
39
  try {
40
40
  accessSync(publicPath)
41
- } catch (e) {
41
+ } catch {
42
42
  // This is normal when developing the tui-sandbox library locally. It
43
43
  // should always exist when using it as an npm package, however.
44
44
  console.warn(
@@ -204,14 +204,9 @@ export class NeovimApplication implements AsyncDisposable {
204
204
  ...process.env,
205
205
  ...({
206
206
  HOME: testDirectory.rootPathAbsolute,
207
-
208
- // this is needed so that neovim can load its configuration, emulating
209
- // a common setup real neovim users have
210
207
  XDG_CONFIG_HOME: join(testDirectory.rootPathAbsolute, ".config"),
211
- // the data directory is where lazy.nvim stores its plugins. To prevent
212
- // downloading a new set of plugins for each test, share the data
213
- // directory.
214
208
  XDG_DATA_HOME: join(testDirectory.testEnvironmentPath, ".repro", "data"),
209
+ TUI_SANDBOX_TEST_ENVIRONMENT_PATH: testDirectory.testEnvironmentPath,
215
210
  } satisfies TestEnvironmentCommonEnvironmentVariables),
216
211
  NVIM_APPNAME: NVIM_APPNAME ?? "nvim",
217
212
 
@@ -232,7 +227,7 @@ export class NeovimApplication implements AsyncDisposable {
232
227
  // happens. It's better to report it than to hide it.
233
228
  log(`Socket file ${this.state.socketPath} should have been removed by neovim when it exited.`)
234
229
  return
235
- } catch (e) {
230
+ } catch {
236
231
  // all good
237
232
  } finally {
238
233
  this.state = undefined
@@ -47,7 +47,7 @@ export function connectNeovimApi(socketPath: string): Lazy<Promise<NeovimJavascr
47
47
  await access(socketPath)
48
48
  // log(`socket file ${socketPath} created after at attempt ${i + 1}`)
49
49
  break
50
- } catch (e) {
50
+ } catch {
51
51
  // log(`polling for socket file ${socketPath} to be created (attempt ${i + 1})`)
52
52
  await new Promise(resolve => setTimeout(resolve, 100 satisfies PollingInterval))
53
53
  }
@@ -34,7 +34,7 @@ export async function installDependencies(NVIM_APPNAME: string | undefined, conf
34
34
  const prepareFilePath = path.join(testDirectory.rootPathAbsolute, ".config", NVIM_APPNAME ?? "nvim", "prepare.lua")
35
35
  try {
36
36
  await access(prepareFilePath)
37
- } catch (e) {
37
+ } catch {
38
38
  // show the output here because it's typically shown in the console before
39
39
  // the tests start. It's also sensitive to outside changes.
40
40
  //
@@ -82,7 +82,7 @@ export async function initializeStdout(
82
82
  resources.get().use(neovim)
83
83
  }
84
84
 
85
- const stdout = convertEventEmitterToAsyncGenerator(neovim.events, "stdout")
85
+ const stdout = convertEventEmitterToAsyncGenerator(neovim.events, "stdout" satisfies StdoutOrStderrMessage)
86
86
  if (signal) {
87
87
  signal.addEventListener("abort", () => {
88
88
  void neovim[Symbol.asyncDispose]().finally(() => {
@@ -205,7 +205,6 @@ export async function waitForLuaCode(
205
205
 
206
206
  const maxIterations = 100
207
207
  for (let iteration = 1; iteration <= maxIterations; iteration++) {
208
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
209
208
  if (!running) {
210
209
  reportFailure()
211
210
  throw new Error(`Polling Lua code: '${options.luaAssertion}' was aborted after ${iteration} iterations`)
@@ -8,6 +8,8 @@ import { DisposableSingleApplication } from "../../utilities/DisposableSingleApp
8
8
  import { TerminalApplication } from "../../utilities/TerminalApplication.js"
9
9
  import type { StdoutOrStderrMessage, TerminalDimensions } from "../neovim/NeovimApplication.js"
10
10
 
11
+ export type { StdoutOrStderrMessage }
12
+
11
13
  const log = debuglog("tui-sandbox.terminal.TerminalTestApplication")
12
14
 
13
15
  type ResettableState = {
@@ -82,6 +84,7 @@ export default class TerminalTestApplication implements AsyncDisposable {
82
84
  HOME: testDirectory.rootPathAbsolute,
83
85
  XDG_CONFIG_HOME: join(testDirectory.rootPathAbsolute, ".config"),
84
86
  XDG_DATA_HOME: join(testDirectory.testEnvironmentPath, ".repro", "data"),
87
+ TUI_SANDBOX_TEST_ENVIRONMENT_PATH: testDirectory.testEnvironmentPath,
85
88
  ...additionalEnvironmentVariables,
86
89
  } satisfies TestEnvironmentCommonEnvironmentVariables
87
90
  }
@@ -8,6 +8,7 @@ import type { TabId } from "../../utilities/tabId.js"
8
8
  import { prepareNewTestDirectory } from "../neovim/prepareNewTestDirectory.js"
9
9
  import { executeBlockingShellCommand } from "./runBlockingShellCommand.js"
10
10
  import type { StartTerminalInput } from "./terminalRouter.js"
11
+ import type { StdoutOrStderrMessage } from "./TerminalTestApplication.js"
11
12
  import TerminalTestApplication from "./TerminalTestApplication.js"
12
13
 
13
14
  const terminals = new Map<TabId["tabId"], TerminalTestApplication>()
@@ -45,7 +46,7 @@ export async function initializeStdout(
45
46
  resources.get().use(app)
46
47
  }
47
48
 
48
- const stdout = convertEventEmitterToAsyncGenerator(app.events, "stdout")
49
+ const stdout = convertEventEmitterToAsyncGenerator(app.events, "stdout" satisfies StdoutOrStderrMessage)
49
50
  signal?.addEventListener("abort", () => {
50
51
  void app[Symbol.asyncDispose]().finally(() => {
51
52
  terminals.delete(tabId)
@@ -26,7 +26,7 @@ export async function createCypressSupportFile({
26
26
  const configModificationsDirectoryPath = path.join(cypressSupportDirectoryPath, "config-modifications")
27
27
  try {
28
28
  await stat(configModificationsDirectoryPath)
29
- } catch (error) {
29
+ } catch {
30
30
  console.info(
31
31
  `Creating config-modifications directory at ${configModificationsDirectoryPath}. You can put Neovim startup scripts into this directory, and load them when starting your Neovim test.`
32
32
  )
@@ -39,7 +39,7 @@ export async function createCypressSupportFile({
39
39
  const outputFilePath = path.join(cypressSupportDirectoryPath, supportFileName)
40
40
  try {
41
41
  oldSchema = readFileSync(outputFilePath, "utf-8")
42
- } catch (error) {
42
+ } catch {
43
43
  console.warn(`No existing cypress support file found at ${outputFilePath}`)
44
44
  }
45
45
 
@@ -53,7 +53,7 @@ export async function jsonToZod(object: unknown, name: string = "schema"): Promi
53
53
  const prettierConfig = await resolveConfig(__filename)
54
54
 
55
55
  return format(`import * as z from "zod"\n\nexport const ${name}=${parse(object, [])}`, {
56
- ...(prettierConfig || {}),
56
+ ...prettierConfig,
57
57
  parser: "babel",
58
58
  plugins: [babelParser],
59
59
  })
@@ -46,14 +46,22 @@ export type ServerTestDirectory = z.infer<typeof serverTestDirectorySchema>
46
46
  export type TestEnvironmentCommonEnvironmentVariables = {
47
47
  HOME: string
48
48
 
49
- // this is needed so that the application being tested can load its
50
- // configuration, emulating a common setup real users have
49
+ /** This is needed so that the application being tested can load its
50
+ * configuration, emulating a common setup real users have
51
+ */
51
52
  XDG_CONFIG_HOME: string
52
53
 
53
- // the data directory is where the application stores its data. To prevent
54
- // downloading a new set of plugins/whatever for each test, share the data
55
- // directory.
54
+ /** The data directory is where the application stores its data. To prevent
55
+ * downloading a new set of plugins/whatever for each test, share the data
56
+ * directory.
57
+ */
56
58
  XDG_DATA_HOME: string
59
+
60
+ /** The path to the test environment directory, which is the blueprint for
61
+ * the test directory.
62
+ * @example /Users/mikavilpas/git/tui-sandbox/packages/integration-tests/test-environment
63
+ * */
64
+ TUI_SANDBOX_TEST_ENVIRONMENT_PATH: string
57
65
  }
58
66
 
59
67
  export type { StartNeovimGenericArguments } from "./applications/neovim/NeovimApplication.js"
@@ -55,7 +55,7 @@ export async function updateTestdirectorySchemaFile(
55
55
 
56
56
  try {
57
57
  oldSchema = readFileSync(config.directories.outputFilePath, "utf-8")
58
- } catch (error) {
58
+ } catch {
59
59
  log("No existing schema file found, creating a new one")
60
60
  }
61
61
 
@@ -4,7 +4,6 @@ export async function* convertEventEmitterToAsyncGenerator(
4
4
  emitter: EventEmitter,
5
5
  eventName: string
6
6
  ): AsyncGenerator<string, void, unknown> {
7
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
8
7
  while (true) {
9
8
  yield await new Promise(resolve => {
10
9
  emitter.once(eventName, resolve)
@@ -1,32 +0,0 @@
1
- /**
2
- * Copyright (c) 2014 The xterm.js authors. All rights reserved.
3
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
4
- * https://github.com/chjj/term.js
5
- * @license MIT
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in
15
- * all copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- * THE SOFTWARE.
24
- *
25
- * Originally forked from (with the author's permission):
26
- * Fabrice Bellard's javascript vt100 for jslinux:
27
- * http://bellard.org/jslinux/
28
- * Copyright (c) 2011 Fabrice Bellard
29
- * The original design remains. The terminal itself
30
- * has been extended to include xterm CSI codes, among
31
- * other features.
32
- */.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;inset:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;inset:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}@font-face{font-family:DejaVuSansMNerdFontMono;src:url(/assets/DejaVuSansMNerdFontMono-Regular-CRJgiq0O.ttf);font-weight:400;font-style:normal}:root{color-scheme:dark;background-color:#000}#app{display:flex;height:100vh;width:100vw}*{font-family:DejaVuSansMNerdFontMono,monospace}.xterm .xterm-viewport{overflow-y:hidden}body{overflow-y:hidden;overflow-x:hidden;margin:0}