@tui-sandbox/library 10.1.0 → 10.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tui-sandbox/library",
3
- "version": "10.1.0",
3
+ "version": "10.2.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.1",
12
- "@trpc/server": "11.0.1",
11
+ "@trpc/client": "11.1.0",
12
+ "@trpc/server": "11.1.0",
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,23 @@
17
17
  "core-js": "3.41.0",
18
18
  "cors": "2.8.5",
19
19
  "dree": "5.1.5",
20
- "express": "4.21.2",
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.38.0",
25
+ "type-fest": "4.39.1",
26
26
  "winston": "3.17.0",
27
- "zod": "3.24.2"
27
+ "zod": "4.0.0-beta.20250412T085909"
28
28
  },
29
29
  "devDependencies": {
30
- "@runtyping/zod": "3.0.0",
31
30
  "@types/command-exists": "1.2.3",
32
31
  "@types/cors": "2.8.17",
33
32
  "@types/express": "5.0.1",
34
- "@types/node": "22.13.14",
33
+ "@types/node": "22.14.1",
35
34
  "nodemon": "3.1.9",
36
- "vite": "6.2.3",
37
- "vitest": "3.0.9"
35
+ "vite": "6.2.6",
36
+ "vitest": "3.1.1"
38
37
  },
39
38
  "peerDependencies": {
40
39
  "cypress": "^13 || ^14",
@@ -11,13 +11,15 @@ describe("blockingCommandInputSchema", () => {
11
11
  } satisfies Partial<BlockingCommandInput>)
12
12
 
13
13
  expect(fails.error).toMatchInlineSnapshot(`
14
- [ZodError: [
15
- {
16
- "code": "custom",
17
- "message": "Both cwd and cwdRelative provided. Please provide either but not both at the same time.",
18
- "path": []
19
- }
20
- ]]
14
+ ZodError {
15
+ "issues": [
16
+ {
17
+ "code": "custom",
18
+ "message": "Both cwd and cwdRelative provided. Please provide either but not both at the same time.",
19
+ "path": [],
20
+ },
21
+ ],
22
+ }
21
23
  `)
22
24
  })
23
25
  })
@@ -13,7 +13,7 @@ export const blockingCommandInputSchema = z
13
13
  // absolute cwd
14
14
  cwd: z.string().optional(),
15
15
  cwdRelative: z.string().optional(),
16
- envOverrides: z.record(z.string()).optional(),
16
+ envOverrides: z.record(z.string(), z.string()).optional(),
17
17
  uid: z.number().optional(),
18
18
  gid: z.number().optional(),
19
19
  })
@@ -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: Type.FILE
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: Type.DIRECTORY
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 -a '${path.join(config.testEnvironmentPath, entry)}' ${dir}/`)
22
+ execSync(`cp -R '${path.join(config.testEnvironmentPath, entry)}' ${dir}/`)
23
23
  })
24
24
  console.log(`Created test directory at ${dir}`)
25
25
 
@@ -45,7 +45,7 @@ export async function createAppRouter(config: DirectoriesConfig) {
45
45
  tabId: tabIdSchema,
46
46
  startTerminalArguments: z.object({
47
47
  commandToRun: z.array(z.string()),
48
- additionalEnvironmentVariables: z.record(z.string()).optional(),
48
+ additionalEnvironmentVariables: z.record(z.string(), z.string()).optional(),
49
49
  terminalDimensions: z.object({
50
50
  cols: z.number(),
51
51
  rows: z.number(),
@@ -88,7 +88,7 @@ export async function createAppRouter(config: DirectoriesConfig) {
88
88
  cols: z.number(),
89
89
  rows: z.number(),
90
90
  }),
91
- additionalEnvironmentVariables: z.record(z.string()).optional(),
91
+ additionalEnvironmentVariables: z.record(z.string(), z.string()).optional(),
92
92
  }),
93
93
  })
94
94
  )