@tui-sandbox/library 10.0.0 → 10.2.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/CHANGELOG.md +14 -0
- package/dist/browser/assets/{index-Dm7lp9YI.js → index-BmeFKAKi.js} +6 -6
- package/dist/browser/index.html +1 -1
- package/dist/src/browser/neovim-client.js +2 -1
- package/dist/src/browser/neovim-client.js.map +1 -1
- package/dist/src/client/neovim-terminal-client.js +3 -3
- package/dist/src/client/neovim-terminal-client.js.map +1 -1
- package/dist/src/client/terminal-terminal-client.js +2 -2
- package/dist/src/client/terminal-terminal-client.js.map +1 -1
- package/dist/src/server/cypress-support/contents.js +10 -0
- package/dist/src/server/cypress-support/contents.js.map +1 -1
- package/dist/src/server/dirtree/index.d.ts +9 -4
- package/dist/src/server/dirtree/index.js +9 -0
- package/dist/src/server/dirtree/index.js.map +1 -1
- package/dist/src/server/dirtree/index.test.js +15 -0
- package/dist/src/server/dirtree/index.test.js.map +1 -1
- package/dist/src/server/neovim/environment/createTempDir.js +1 -1
- package/dist/src/server/server.d.ts +8 -0
- package/dist/src/server/server.js +3 -0
- package/dist/src/server/server.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/browser/neovim-client.ts +3 -1
- package/src/client/neovim-terminal-client.ts +3 -3
- package/src/client/terminal-terminal-client.ts +2 -2
- package/src/server/cypress-support/contents.ts +10 -0
- package/src/server/dirtree/index.test.ts +15 -0
- package/src/server/dirtree/index.ts +21 -5
- package/src/server/neovim/environment/createTempDir.ts +1 -1
- package/src/server/server.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tui-sandbox/library",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.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.
|
|
12
|
-
"@trpc/server": "11.0.
|
|
11
|
+
"@trpc/client": "11.0.2",
|
|
12
|
+
"@trpc/server": "11.0.2",
|
|
13
13
|
"@xterm/addon-attach": "0.11.0",
|
|
14
14
|
"@xterm/addon-fit": "0.10.0",
|
|
15
15
|
"@xterm/xterm": "5.5.0",
|
|
@@ -17,24 +17,24 @@
|
|
|
17
17
|
"core-js": "3.41.0",
|
|
18
18
|
"cors": "2.8.5",
|
|
19
19
|
"dree": "5.1.5",
|
|
20
|
-
"express": "
|
|
20
|
+
"express": "5.1.0",
|
|
21
21
|
"neovim": "5.3.0",
|
|
22
22
|
"node-pty": "1.0.0",
|
|
23
23
|
"prettier": "3.5.3",
|
|
24
24
|
"tsx": "4.19.3",
|
|
25
|
-
"type-fest": "4.
|
|
25
|
+
"type-fest": "4.39.1",
|
|
26
26
|
"winston": "3.17.0",
|
|
27
27
|
"zod": "3.24.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@runtyping/zod": "
|
|
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.
|
|
34
|
-
"@types/node": "22.
|
|
33
|
+
"@types/express": "5.0.1",
|
|
34
|
+
"@types/node": "22.14.0",
|
|
35
35
|
"nodemon": "3.1.9",
|
|
36
|
-
"vite": "6.2.
|
|
37
|
-
"vitest": "3.
|
|
36
|
+
"vite": "6.2.5",
|
|
37
|
+
"vitest": "3.1.1"
|
|
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
|
-
|
|
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,
|
|
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:
|
|
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.
|
|
59
|
+
trpc.neovim.initializeStdout.subscribe(
|
|
60
60
|
{ client: tabId },
|
|
61
61
|
{
|
|
62
62
|
onStarted() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createTRPCClient, httpBatchLink,
|
|
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:
|
|
24
|
+
true: httpSubscriptionLink({
|
|
25
25
|
url: "/trpc",
|
|
26
26
|
}),
|
|
27
27
|
false: httpBatchLink({
|
|
@@ -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
|
}
|
|
@@ -123,6 +123,18 @@ describe("dirtree", () => {
|
|
|
123
123
|
"subdirectory-file.txt": z.object({ name: z.literal("subdirectory-file.txt"), type: z.literal("file") }),
|
|
124
124
|
}),
|
|
125
125
|
}),
|
|
126
|
+
"symlink-target.txt": z.object({
|
|
127
|
+
name: z.literal("symlink-target.txt"),
|
|
128
|
+
type: z.literal("file-symlink"),
|
|
129
|
+
target: z.literal("symlink-test/symlink-target.txt"),
|
|
130
|
+
}),
|
|
131
|
+
"symlink-test": z.object({
|
|
132
|
+
name: z.literal("symlink-test/"),
|
|
133
|
+
type: z.literal("directory"),
|
|
134
|
+
contents: z.object({
|
|
135
|
+
"symlink-target.txt": z.object({ name: z.literal("symlink-target.txt"), type: z.literal("file") }),
|
|
136
|
+
}),
|
|
137
|
+
}),
|
|
126
138
|
}),
|
|
127
139
|
})
|
|
128
140
|
|
|
@@ -159,6 +171,9 @@ describe("dirtree", () => {
|
|
|
159
171
|
"routes",
|
|
160
172
|
"subdirectory/subdirectory-file.txt",
|
|
161
173
|
"subdirectory",
|
|
174
|
+
"symlink-target.txt",
|
|
175
|
+
"symlink-test/symlink-target.txt",
|
|
176
|
+
"symlink-test",
|
|
162
177
|
"."
|
|
163
178
|
])
|
|
164
179
|
export type MyTestDirectoryFile = z.infer<typeof testDirectoryFiles>"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Dree } from "dree"
|
|
2
2
|
import { scan, Type } from "dree"
|
|
3
|
+
import { readlinkSync } from "fs"
|
|
3
4
|
import { format, resolveConfig } from "prettier"
|
|
4
5
|
import { fileURLToPath } from "url"
|
|
5
6
|
import { jsonToZod } from "./json-to-zod.js"
|
|
@@ -29,28 +30,43 @@ export function getDirectoryTree(path: string): TreeResult {
|
|
|
29
30
|
return { dree: result ?? undefined, allFiles }
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
type TreeNode = FileNode | FileSymlinkNode | DirectoryNode
|
|
34
|
+
|
|
32
35
|
type FileNode = {
|
|
33
|
-
type:
|
|
36
|
+
type: "file"
|
|
37
|
+
name: string
|
|
38
|
+
}
|
|
39
|
+
type FileSymlinkNode = {
|
|
40
|
+
type: "file-symlink"
|
|
34
41
|
name: string
|
|
42
|
+
/** The target of the symlink, a filepath. */
|
|
43
|
+
target: string
|
|
35
44
|
}
|
|
36
45
|
type DirectoryNode = {
|
|
37
|
-
type:
|
|
46
|
+
type: "directory"
|
|
38
47
|
name: string
|
|
39
48
|
contents: Record<string, TreeNode>
|
|
40
49
|
}
|
|
41
50
|
|
|
42
|
-
type TreeNode = FileNode | DirectoryNode
|
|
43
|
-
|
|
44
51
|
export function convertDree(root: Dree | undefined): TreeNode {
|
|
45
52
|
if (!root) {
|
|
46
53
|
return { type: Type.DIRECTORY, name: "root", contents: {} }
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
if (root.type === Type.FILE) {
|
|
57
|
+
if (root.isSymbolicLink) {
|
|
58
|
+
const target = readlinkSync(root.path)
|
|
59
|
+
return {
|
|
60
|
+
name: root.name,
|
|
61
|
+
type: "file-symlink",
|
|
62
|
+
target,
|
|
63
|
+
} satisfies FileSymlinkNode
|
|
64
|
+
}
|
|
65
|
+
|
|
50
66
|
return {
|
|
51
67
|
name: root.name,
|
|
52
68
|
type: root.type,
|
|
53
|
-
}
|
|
69
|
+
} satisfies FileNode
|
|
54
70
|
}
|
|
55
71
|
|
|
56
72
|
const node: DirectoryNode = {
|
|
@@ -19,7 +19,7 @@ export async function createTempDir(config: DirectoriesConfig): Promise<TestDire
|
|
|
19
19
|
if (entry === ("testdirs" satisfies TestDirsPath)) return
|
|
20
20
|
if (entry === ".repro") return
|
|
21
21
|
|
|
22
|
-
execSync(`cp -
|
|
22
|
+
execSync(`cp -R '${path.join(config.testEnvironmentPath, entry)}' ${dir}/`)
|
|
23
23
|
})
|
|
24
24
|
console.log(`Created test directory at ${dir}`)
|
|
25
25
|
|
package/src/server/server.ts
CHANGED
|
@@ -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
|
}),
|