@tui-sandbox/library 11.1.0 → 11.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/browser/assets/{index-0fX9G5V_.js → index-VJaZoTqH.js} +6 -6
  3. package/dist/browser/index.html +1 -1
  4. package/dist/src/client/MyNeovimConfigModification.d.ts +4 -0
  5. package/dist/src/client/MyNeovimConfigModification.js +2 -0
  6. package/dist/src/client/MyNeovimConfigModification.js.map +1 -0
  7. package/dist/src/client/MyNeovimConfigModification.test.d.ts +1 -0
  8. package/dist/src/client/MyNeovimConfigModification.test.js +13 -0
  9. package/dist/src/client/MyNeovimConfigModification.test.js.map +1 -0
  10. package/dist/src/client/websocket-client.js +1 -1
  11. package/dist/src/client/websocket-client.js.map +1 -1
  12. package/dist/src/server/applications/neovim/neovimRouter.d.ts +1 -1
  13. package/dist/src/server/applications/neovim/neovimRouter.js +1 -1
  14. package/dist/src/server/applications/neovim/neovimRouter.js.map +1 -1
  15. package/dist/src/server/applications/terminal/terminalRouter.d.ts +1 -1
  16. package/dist/src/server/applications/terminal/terminalRouter.js +1 -1
  17. package/dist/src/server/applications/terminal/terminalRouter.js.map +1 -1
  18. package/dist/src/server/blockingCommandInputSchema.d.ts +1 -1
  19. package/dist/src/server/blockingCommandInputSchema.js +1 -1
  20. package/dist/src/server/blockingCommandInputSchema.js.map +1 -1
  21. package/dist/src/server/cypress-support/contents.js +2 -1
  22. package/dist/src/server/cypress-support/contents.js.map +1 -1
  23. package/dist/src/server/dirtree/index.test.js +14 -2
  24. package/dist/src/server/dirtree/index.test.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/utilities/tabId.d.ts +1 -1
  28. package/dist/src/server/utilities/tabId.js +1 -1
  29. package/dist/src/server/utilities/tabId.js.map +1 -1
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +4 -4
  32. package/src/client/MyNeovimConfigModification.test.ts +24 -0
  33. package/src/client/MyNeovimConfigModification.ts +8 -0
  34. package/src/client/websocket-client.ts +1 -1
  35. package/src/server/applications/neovim/neovimRouter.ts +1 -1
  36. package/src/server/applications/terminal/terminalRouter.ts +1 -1
  37. package/src/server/blockingCommandInputSchema.ts +1 -1
  38. package/src/server/cypress-support/contents.ts +2 -1
  39. package/src/server/dirtree/index.test.ts +14 -2
  40. package/src/server/dirtree/json-to-zod.ts +1 -1
  41. package/src/server/utilities/tabId.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tui-sandbox/library",
3
- "version": "11.1.0",
3
+ "version": "11.2.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mikavilpas/tui-sandbox"
@@ -32,11 +32,11 @@
32
32
  "@types/command-exists": "1.2.3",
33
33
  "@types/cors": "2.8.19",
34
34
  "@types/express": "5.0.3",
35
- "@types/node": "24.0.13",
35
+ "@types/node": "24.1.0",
36
36
  "nodemon": "3.1.10",
37
- "vite": "7.0.4",
37
+ "vite": "7.0.6",
38
38
  "vitest": "3.2.4",
39
- "zod": "4.0.5"
39
+ "zod": "4.0.14"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "cypress": "^13 || ^14",
@@ -0,0 +1,24 @@
1
+ import * as z from "zod"
2
+ import type { MyNeovimConfigModification } from "./MyNeovimConfigModification.js"
3
+
4
+ const testDirectoryFiles = z.enum([
5
+ "config-modifications/add_command_to_count_open_buffers.lua",
6
+ "config-modifications/add_command_to_update_buffer_after_timeout.lua",
7
+ "config-modifications/don't_crash_when_modification_contains_unescaped_characters\".lua",
8
+ "config-modifications/subdir/subdir-modification.lua",
9
+ "config-modifications/subdir",
10
+ "config-modifications",
11
+ ])
12
+ type MyTestDirectoryFile = z.infer<typeof testDirectoryFiles>
13
+
14
+ type result = MyNeovimConfigModification<MyTestDirectoryFile>
15
+
16
+ it("returns config-modifications recursively", () => {
17
+ assertType<
18
+ | "add_command_to_count_open_buffers.lua"
19
+ | "add_command_to_update_buffer_after_timeout.lua"
20
+ | "don't_crash_when_modification_contains_unescaped_characters\".lua"
21
+ | "subdir/subdir-modification.lua"
22
+ | "subdir"
23
+ >(1 as unknown as result)
24
+ })
@@ -0,0 +1,8 @@
1
+ /** Returns all the available Neovim config-modifications, recursively.
2
+ * @type T - the MyTestDirectoryFile type, which is generated by tui-sandbox
3
+ */
4
+ export type MyNeovimConfigModification<T extends string> = T extends `config-modifications/${infer Rest}`
5
+ ? Rest extends ""
6
+ ? never
7
+ : Rest
8
+ : never
@@ -2,7 +2,7 @@ import { flavors } from "@catppuccin/palette"
2
2
  import { FitAddon } from "@xterm/addon-fit"
3
3
  import { Terminal } from "@xterm/xterm"
4
4
  import "@xterm/xterm/css/xterm.css"
5
- import { z } from "zod"
5
+ import * as z from "zod"
6
6
  import type { TabId } from "../server/utilities/tabId.ts"
7
7
  import "./style.css"
8
8
  import { validateMouseEvent } from "./validateMouseEvent.js"
@@ -1,5 +1,5 @@
1
1
  import type { Except } from "type-fest"
2
- import { z } from "zod"
2
+ import * as z from "zod"
3
3
  import { blockingCommandInputSchema } from "../../blockingCommandInputSchema.js"
4
4
  import { trpc } from "../../connection/trpc.js"
5
5
  import type { DirectoriesConfig } from "../../updateTestdirectorySchemaFile.js"
@@ -1,4 +1,4 @@
1
- import { z } from "zod"
1
+ import * as z from "zod"
2
2
  import { blockingCommandInputSchema } from "../../blockingCommandInputSchema.js"
3
3
  import { trpc } from "../../connection/trpc.js"
4
4
  import type { DirectoriesConfig } from "../../updateTestdirectorySchemaFile.js"
@@ -1,5 +1,5 @@
1
1
  import type { Except } from "type-fest"
2
- import { z } from "zod"
2
+ import * as z from "zod"
3
3
  import { tabIdSchema } from "./utilities/tabId.js"
4
4
 
5
5
  export const blockingCommandInputSchema = z
@@ -23,6 +23,7 @@ import type {
23
23
  StartNeovimGenericArguments,
24
24
  TestDirectory,
25
25
  } from "@tui-sandbox/library/dist/src/server/types"
26
+ import type { MyNeovimConfigModification } from "@tui-sandbox/library/src/client/MyNeovimConfigModification"
26
27
  import type {
27
28
  ExCommandClientInput,
28
29
  LuaCodeClientInput,
@@ -85,7 +86,7 @@ export type MyStartNeovimServerArguments = OverrideProperties<
85
86
  StartNeovimGenericArguments,
86
87
  {
87
88
  filename?: MyTestDirectoryFile | { openInVerticalSplits: MyTestDirectoryFile[] }
88
- startupScriptModifications?: Array<keyof MyTestDirectory["config-modifications"]["contents"]>
89
+ startupScriptModifications?: Array<MyNeovimConfigModification<MyTestDirectoryFile>>
89
90
  }
90
91
  >
91
92
 
@@ -33,7 +33,7 @@ describe("dirtree", () => {
33
33
  // be written with confidence that the files and directories they expect are
34
34
  // actually found. Otherwise the tests are brittle and can break easily.
35
35
 
36
- import { z } from "zod"
36
+ import * as z from "zod"
37
37
 
38
38
  export const MyDirectoryTreeSchema = z.object({
39
39
  name: z.literal("test-environment/"),
@@ -79,6 +79,16 @@ describe("dirtree", () => {
79
79
  name: z.literal("don't_crash_when_modification_contains_unescaped_characters\\".lua"),
80
80
  type: z.literal("file"),
81
81
  }),
82
+ subdir: z.object({
83
+ name: z.literal("subdir/"),
84
+ type: z.literal("directory"),
85
+ contents: z.object({
86
+ "subdir-modification.lua": z.object({
87
+ name: z.literal("subdir-modification.lua"),
88
+ type: z.literal("file"),
89
+ }),
90
+ }),
91
+ }),
82
92
  }),
83
93
  }),
84
94
  "dir with spaces": z.object({
@@ -165,6 +175,8 @@ describe("dirtree", () => {
165
175
  "config-modifications/add_command_to_count_open_buffers.lua",
166
176
  "config-modifications/add_command_to_update_buffer_after_timeout.lua",
167
177
  "config-modifications/don't_crash_when_modification_contains_unescaped_characters\\".lua",
178
+ "config-modifications/subdir/subdir-modification.lua",
179
+ "config-modifications/subdir",
168
180
  "config-modifications",
169
181
  "dir with spaces/file1.txt",
170
182
  "dir with spaces/file2.txt",
@@ -208,7 +220,7 @@ describe("dirtree", () => {
208
220
  // be written with confidence that the files and directories they expect are
209
221
  // actually found. Otherwise the tests are brittle and can break easily.
210
222
 
211
- import { z } from "zod"
223
+ import * as z from "zod"
212
224
 
213
225
  export const MyDirectoryTreeSchema = z.object({
214
226
  type: z.literal("directory"),
@@ -52,7 +52,7 @@ export async function jsonToZod(object: unknown, name: string = "schema"): Promi
52
52
  }
53
53
  const prettierConfig = await resolveConfig(__filename)
54
54
 
55
- return format(`import {z} from "zod"\n\nexport const ${name}=${parse(object, [])}`, {
55
+ return format(`import * as z from "zod"\n\nexport const ${name}=${parse(object, [])}`, {
56
56
  ...(prettierConfig || {}),
57
57
  parser: "babel",
58
58
  plugins: [babelParser],
@@ -1,4 +1,4 @@
1
- import { z } from "zod"
1
+ import * as z from "zod"
2
2
 
3
3
  export type TabId = z.infer<typeof tabIdSchema>
4
4
  export const tabIdSchema = z.object({ tabId: z.string() })