@tui-sandbox/library 9.6.0 → 10.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tui-sandbox/library",
3
- "version": "9.6.0",
3
+ "version": "10.1.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,8 +8,8 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@catppuccin/palette": "1.7.1",
11
- "@trpc/client": "11.0.0-rc.824",
12
- "@trpc/server": "11.0.0-rc.824",
11
+ "@trpc/client": "11.0.1",
12
+ "@trpc/server": "11.0.1",
13
13
  "@xterm/addon-attach": "0.11.0",
14
14
  "@xterm/addon-fit": "0.10.0",
15
15
  "@xterm/xterm": "5.5.0",
@@ -22,19 +22,19 @@
22
22
  "node-pty": "1.0.0",
23
23
  "prettier": "3.5.3",
24
24
  "tsx": "4.19.3",
25
- "type-fest": "4.37.0",
25
+ "type-fest": "4.38.0",
26
26
  "winston": "3.17.0",
27
27
  "zod": "3.24.2"
28
28
  },
29
29
  "devDependencies": {
30
- "@runtyping/zod": "2.1.1",
30
+ "@runtyping/zod": "3.0.0",
31
31
  "@types/command-exists": "1.2.3",
32
32
  "@types/cors": "2.8.17",
33
- "@types/express": "5.0.0",
34
- "@types/node": "22.13.9",
33
+ "@types/express": "5.0.1",
34
+ "@types/node": "22.13.14",
35
35
  "nodemon": "3.1.9",
36
- "vite": "6.2.0",
37
- "vitest": "3.0.7"
36
+ "vite": "6.2.3",
37
+ "vitest": "3.0.9"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "cypress": "^13 || ^14",
@@ -75,10 +75,12 @@ window.startTerminalApplication = async function (
75
75
  ): Promise<GenericTerminalBrowserApi> {
76
76
  const terminal = terminalClient.get()
77
77
  const testDirectory = await terminal.startTerminalApplication(args)
78
- return {
78
+
79
+ const terminalBrowserApi: GenericTerminalBrowserApi = {
79
80
  dir: testDirectory,
80
81
  runBlockingShellCommand(input) {
81
82
  return terminal.runBlockingShellCommand(input)
82
83
  },
83
84
  }
85
+ return terminalBrowserApi
84
86
  }
@@ -1,4 +1,4 @@
1
- import { createTRPCClient, httpBatchLink, splitLink, unstable_httpSubscriptionLink } from "@trpc/client"
1
+ import { createTRPCClient, httpBatchLink, httpSubscriptionLink, splitLink } from "@trpc/client"
2
2
  import type { Terminal } from "@xterm/xterm"
3
3
  import "@xterm/xterm/css/xterm.css"
4
4
  import type { BlockingCommandClientInput } from "../server/blockingCommandInputSchema.js"
@@ -26,7 +26,7 @@ export class NeovimTerminalClient {
26
26
  links: [
27
27
  splitLink({
28
28
  condition: operation => operation.type === "subscription",
29
- true: unstable_httpSubscriptionLink({
29
+ true: httpSubscriptionLink({
30
30
  url: "/trpc",
31
31
  }),
32
32
  false: httpBatchLink({
@@ -56,7 +56,7 @@ export class NeovimTerminalClient {
56
56
  // time to complete
57
57
  this.ready = new Promise<void>(resolve => {
58
58
  console.log("Subscribing to stdout")
59
- trpc.neovim.onStdout.subscribe(
59
+ trpc.neovim.initializeStdout.subscribe(
60
60
  { client: tabId },
61
61
  {
62
62
  onStarted() {
@@ -1,4 +1,4 @@
1
- import { createTRPCClient, httpBatchLink, splitLink, unstable_httpSubscriptionLink } from "@trpc/client"
1
+ import { createTRPCClient, httpBatchLink, httpSubscriptionLink, splitLink } from "@trpc/client"
2
2
  import type { Terminal } from "@xterm/xterm"
3
3
  import "@xterm/xterm/css/xterm.css"
4
4
  import type { BlockingCommandClientInput } from "../server/blockingCommandInputSchema.js"
@@ -21,7 +21,7 @@ export class TerminalTerminalClient {
21
21
  links: [
22
22
  splitLink({
23
23
  condition: operation => operation.type === "subscription",
24
- true: unstable_httpSubscriptionLink({
24
+ true: httpSubscriptionLink({
25
25
  url: "/trpc",
26
26
  }),
27
27
  false: httpBatchLink({
@@ -3,6 +3,7 @@ import path from "node:path"
3
3
  import { createCypressSupportFile } from "../server/cypress-support/createCypressSupportFile.js"
4
4
  import type { TestServerConfig } from "../server/index.js"
5
5
  import { startTestServer, updateTestdirectorySchemaFile } from "../server/index.js"
6
+ import { installDependencies } from "../server/neovim/index.js"
6
7
  import type { StdoutOrStderrMessage } from "../server/neovim/NeovimApplication.js"
7
8
  import { NeovimApplication } from "../server/neovim/NeovimApplication.js"
8
9
  import { prepareNewTestDirectory } from "../server/neovim/prepareNewTestDirectory.js"
@@ -28,6 +29,15 @@ const config = {
28
29
  const args = process.argv.slice(2)
29
30
 
30
31
  if (args[0] === "neovim") {
32
+ if (args[1] === "prepare" && args.length === 2) {
33
+ console.log("🚀 Installing neovim dependencies...")
34
+ await installDependencies(config.directories.testEnvironmentPath, config.directories).catch((err: unknown) => {
35
+ console.error("Error installing neovim dependencies", err)
36
+ process.exit(1)
37
+ })
38
+ process.exit(0)
39
+ }
40
+
31
41
  if (!(args[1] === "exec" && args.length === 3)) {
32
42
  showUsageAndExit()
33
43
  }
@@ -125,6 +125,12 @@ Cypress.Commands.add("startNeovim", (startArguments?: MyStartNeovimServerArgumen
125
125
  })
126
126
  })
127
127
 
128
+ Cypress.Commands.add("nvim_isRunning", () => {
129
+ return cy.window().then(async _ => {
130
+ return !!testNeovim
131
+ })
132
+ })
133
+
128
134
  Cypress.Commands.add("startTerminalApplication", (args: StartTerminalGenericArguments) => {
129
135
  cy.window().then(async win => {
130
136
  const terminal: GenericTerminalBrowserApi = await win.startTerminalApplication(args)
@@ -189,6 +195,10 @@ declare global {
189
195
  */
190
196
  nvim_runExCommand(input: ExCommandClientInput): Chainable<RunExCommandOutput>
191
197
 
198
+ /** Returns true if neovim is running. Useful to conditionally run
199
+ * afterEach actions based on whether it's running. */
200
+ nvim_isRunning(): Chainable<boolean>
201
+
192
202
  terminal_runBlockingShellCommand(input: MyBlockingCommandClientInput): Chainable<BlockingShellCommandOutput>
193
203
  }
194
204
  }
@@ -103,6 +103,10 @@ export async function createAppRouter(config: DirectoriesConfig) {
103
103
  onStdout: trpc.procedure.input(z.object({ client: tabIdSchema })).subscription(options => {
104
104
  return neovim.initializeStdout(options.input, options.signal, config.testEnvironmentPath)
105
105
  }),
106
+
107
+ initializeStdout: trpc.procedure.input(z.object({ client: tabIdSchema })).subscription(options => {
108
+ return neovim.initializeStdout(options.input, options.signal, config.testEnvironmentPath)
109
+ }),
106
110
  sendStdin: trpc.procedure.input(z.object({ tabId: tabIdSchema, data: z.string() })).mutation(options => {
107
111
  return neovim.sendStdin(options.input)
108
112
  }),
@@ -116,15 +120,8 @@ export async function createAppRouter(config: DirectoriesConfig) {
116
120
  }),
117
121
 
118
122
  waitForLuaCode: trpc.procedure.input(pollLuaCodeInputSchema).mutation(async options => {
119
- try {
120
- const result = await timeoutable(
121
- options.input.timeoutMs,
122
- neovim.waitForLuaCode(options.input, options.signal)
123
- )
124
- return result
125
- } catch (e) {
126
- throw e
127
- }
123
+ const result = await timeoutable(options.input.timeoutMs, neovim.waitForLuaCode(options.input, options.signal))
124
+ return result
128
125
  }),
129
126
 
130
127
  runExCommand: trpc.procedure.input(exCommandInputSchema).mutation(options => {
@@ -139,26 +136,14 @@ export async function createAppRouter(config: DirectoriesConfig) {
139
136
  export type AppRouter = Awaited<ReturnType<typeof createAppRouter>>
140
137
  export type RouterInput = inferRouterInputs<AppRouter>
141
138
 
142
- export async function startTestServer(config: TestServerConfig): Promise<TestServer> {
139
+ export async function startTestServer(config: TestServerConfig): Promise<void> {
143
140
  try {
144
141
  const testServer = new TestServer({
145
142
  port: config.port,
146
143
  })
147
144
  const appRouter = await createAppRouter(config.directories)
148
145
 
149
- const neovimTask: Promise<void> = neovim
150
- .installDependencies(config.directories.testEnvironmentPath, config.directories)
151
- .catch((err: unknown) => {
152
- console.error("Error installing neovim dependencies", err)
153
- // suppress the error because neovim is optional - other applications
154
- // can still be tested
155
- })
156
-
157
- const startServerTask = testServer.startAndRun(appRouter)
158
-
159
- await Promise.all([neovimTask, startServerTask])
160
-
161
- return testServer
146
+ await testServer.startAndRun(appRouter)
162
147
  } catch (err: unknown) {
163
148
  console.error("Error starting test server", err)
164
149
  throw err