@tui-sandbox/library 9.3.0 → 9.5.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.
- package/CHANGELOG.md +21 -0
- package/dist/browser/assets/{index-CwXs-hE_.js → index-BZnWo448.js} +6 -6
- package/dist/browser/index.html +1 -1
- package/dist/src/server/cypress-support/contents.js +1 -1
- package/dist/src/server/server.js +3 -2
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/terminal/runBlockingShellCommand.js +1 -1
- package/dist/src/server/terminal/runBlockingShellCommand.js.map +1 -1
- package/dist/src/server/utilities/timeoutable.d.ts +1 -0
- package/dist/src/server/utilities/timeoutable.js +16 -0
- package/dist/src/server/utilities/timeoutable.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/server/cypress-support/contents.ts +1 -1
- package/src/server/server.ts +3 -2
- package/src/server/terminal/runBlockingShellCommand.ts +1 -1
- package/src/server/utilities/timeoutable.ts +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tui-sandbox/library",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.1",
|
|
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.
|
|
12
|
-
"@trpc/server": "11.0.0-rc.
|
|
11
|
+
"@trpc/client": "11.0.0-rc.819",
|
|
12
|
+
"@trpc/server": "11.0.0-rc.819",
|
|
13
13
|
"@xterm/addon-attach": "0.11.0",
|
|
14
14
|
"@xterm/addon-fit": "0.10.0",
|
|
15
15
|
"@xterm/xterm": "5.5.0",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"express": "4.21.2",
|
|
21
21
|
"neovim": "5.3.0",
|
|
22
22
|
"node-pty": "1.0.0",
|
|
23
|
-
"prettier": "3.5.
|
|
23
|
+
"prettier": "3.5.2",
|
|
24
24
|
"tsx": "4.19.3",
|
|
25
25
|
"type-fest": "4.35.0",
|
|
26
26
|
"winston": "3.17.0",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"@types/command-exists": "1.2.3",
|
|
32
32
|
"@types/cors": "2.8.17",
|
|
33
33
|
"@types/express": "5.0.0",
|
|
34
|
-
"@types/node": "22.13.
|
|
34
|
+
"@types/node": "22.13.7",
|
|
35
35
|
"nodemon": "3.1.9",
|
|
36
|
-
"vite": "6.
|
|
37
|
-
"vitest": "3.0.
|
|
36
|
+
"vite": "6.2.0",
|
|
37
|
+
"vitest": "3.0.7"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"cypress": "^13 || ^14",
|
|
@@ -65,7 +65,7 @@ export type NeovimContext = {
|
|
|
65
65
|
|
|
66
66
|
/** Arguments for starting the neovim server. They are built based on your test
|
|
67
67
|
* environment in a type safe manner. */
|
|
68
|
-
type MyStartNeovimServerArguments = OverrideProperties<
|
|
68
|
+
export type MyStartNeovimServerArguments = OverrideProperties<
|
|
69
69
|
StartNeovimGenericArguments,
|
|
70
70
|
{
|
|
71
71
|
filename?: MyTestDirectoryFile | { openInVerticalSplits: MyTestDirectoryFile[] }
|
package/src/server/server.ts
CHANGED
|
@@ -9,6 +9,7 @@ import * as terminal from "./terminal/index.js"
|
|
|
9
9
|
import { TestServer } from "./TestServer.js"
|
|
10
10
|
import type { DirectoriesConfig, TestServerConfig } from "./updateTestdirectorySchemaFile.js"
|
|
11
11
|
import { tabIdSchema } from "./utilities/tabId.js"
|
|
12
|
+
import { timeoutable } from "./utilities/timeoutable.js"
|
|
12
13
|
|
|
13
14
|
const luaCodeInputSchema = z.object({ tabId: tabIdSchema, luaCode: z.string() })
|
|
14
15
|
export type LuaCodeClientInput = Except<LuaCodeInput, "tabId">
|
|
@@ -104,11 +105,11 @@ export async function createAppRouter(config: DirectoriesConfig) {
|
|
|
104
105
|
}),
|
|
105
106
|
|
|
106
107
|
runLuaCode: trpc.procedure.input(luaCodeInputSchema).mutation(options => {
|
|
107
|
-
return neovim.runLuaCode(options.input)
|
|
108
|
+
return timeoutable(10_000, neovim.runLuaCode(options.input))
|
|
108
109
|
}),
|
|
109
110
|
|
|
110
111
|
runExCommand: trpc.procedure.input(exCommandInputSchema).mutation(options => {
|
|
111
|
-
return neovim.runExCommand(options.input)
|
|
112
|
+
return timeoutable(10_000, neovim.runExCommand(options.input))
|
|
112
113
|
}),
|
|
113
114
|
}),
|
|
114
115
|
})
|
|
@@ -31,7 +31,7 @@ export async function executeBlockingShellCommand(
|
|
|
31
31
|
env,
|
|
32
32
|
})
|
|
33
33
|
console.log(
|
|
34
|
-
`Successfully ran shell blockingCommand (${input.command}) with stdout: ${result.stdout}, stderr: ${result.stderr}`
|
|
34
|
+
`Successfully ran shell blockingCommand (${input.command}) in cwd: '${cwd}' with stdout: ${result.stdout}, stderr: ${result.stderr}`
|
|
35
35
|
)
|
|
36
36
|
return {
|
|
37
37
|
type: "success",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export async function timeoutable<T>(ms: number, promise: Promise<T>): Promise<T> {
|
|
2
|
+
let timeoutId: NodeJS.Timeout | undefined = undefined
|
|
3
|
+
const timeout = new Promise<void>((_, reject) => {
|
|
4
|
+
timeoutId = setTimeout(() => {
|
|
5
|
+
reject(new Error(`Timeout after ${ms}ms`))
|
|
6
|
+
}, ms)
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
await Promise.race([timeout, promise])
|
|
11
|
+
return await promise
|
|
12
|
+
} finally {
|
|
13
|
+
clearTimeout(timeoutId) // Ensure the timeout is cleared
|
|
14
|
+
}
|
|
15
|
+
}
|