@tui-sandbox/library 11.6.5 → 11.6.6
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 +7 -0
- package/dist/src/client/terminal-terminal-client.d.ts +2 -2
- package/dist/src/server/applications/neovim/neovimRouter.d.ts +6 -1
- package/dist/src/server/applications/neovim/neovimRouter.js +2 -0
- package/dist/src/server/applications/neovim/neovimRouter.js.map +1 -1
- package/dist/src/server/applications/terminal/api.d.ts +2 -2
- package/dist/src/server/applications/terminal/api.js +1 -0
- package/dist/src/server/applications/terminal/api.js.map +1 -1
- package/dist/src/server/applications/terminal/terminalRouter.d.ts +6 -1
- package/dist/src/server/applications/terminal/terminalRouter.js +5 -1
- package/dist/src/server/applications/terminal/terminalRouter.js.map +1 -1
- package/dist/src/server/server.d.ts +12 -2
- package/dist/src/server/types.d.ts +9 -1
- package/dist/src/server/types.js +7 -1
- package/dist/src/server/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/client/terminal-terminal-client.ts +2 -2
- package/src/server/applications/neovim/neovimRouter.ts +2 -0
- package/src/server/applications/terminal/api.ts +4 -2
- package/src/server/applications/terminal/terminalRouter.ts +7 -3
- package/src/server/types.ts +10 -1
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import "@xterm/xterm/css/xterm.css"
|
|
|
4
4
|
import type { StartTerminalBrowserArguments } from "../browser/neovim-client.js"
|
|
5
5
|
import type { BlockingCommandClientInput } from "../server/blockingCommandInputSchema.js"
|
|
6
6
|
import type { AppRouter } from "../server/server.js"
|
|
7
|
-
import type { BlockingShellCommandOutput,
|
|
7
|
+
import type { BlockingShellCommandOutput, ServerTestDirectory } from "../server/types.js"
|
|
8
8
|
import type { TuiTerminalApi } from "./startTerminal.js"
|
|
9
9
|
import { getTabId, startTerminal } from "./startTerminal.js"
|
|
10
10
|
import { supportDA1 } from "./terminal-config.js"
|
|
@@ -71,7 +71,7 @@ export class TerminalTerminalClient {
|
|
|
71
71
|
})
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
public async startTerminalApplication(args: StartTerminalBrowserArguments): Promise<
|
|
74
|
+
public async startTerminalApplication(args: StartTerminalBrowserArguments): Promise<ServerTestDirectory> {
|
|
75
75
|
await this.ready
|
|
76
76
|
|
|
77
77
|
args.browserSettings.configureTerminal?.({
|
|
@@ -2,6 +2,7 @@ import type { Except } from "type-fest"
|
|
|
2
2
|
import * as z from "zod"
|
|
3
3
|
import { blockingCommandInputSchema } from "../../blockingCommandInputSchema.js"
|
|
4
4
|
import { trpc } from "../../connection/trpc.js"
|
|
5
|
+
import { serverTestDirectorySchema } from "../../types.js"
|
|
5
6
|
import type { DirectoriesConfig } from "../../updateTestdirectorySchemaFile.js"
|
|
6
7
|
import { tabIdSchema } from "../../utilities/tabId.js"
|
|
7
8
|
import { timeoutable } from "../../utilities/timeoutable.js"
|
|
@@ -59,6 +60,7 @@ export function createNeovimRouter(config: DirectoriesConfig) {
|
|
|
59
60
|
}),
|
|
60
61
|
})
|
|
61
62
|
)
|
|
63
|
+
.output(serverTestDirectorySchema)
|
|
62
64
|
.mutation(options => {
|
|
63
65
|
return neovim.start(
|
|
64
66
|
options.input.startNeovimArguments,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from "assert"
|
|
2
2
|
import type { BlockingCommandInput } from "../../blockingCommandInputSchema.js"
|
|
3
|
-
import type { BlockingShellCommandOutput } from "../../types.js"
|
|
3
|
+
import type { BlockingShellCommandOutput, TestDirectory } from "../../types.js"
|
|
4
4
|
import type { DirectoriesConfig } from "../../updateTestdirectorySchemaFile.js"
|
|
5
5
|
import { convertEventEmitterToAsyncGenerator } from "../../utilities/generator.js"
|
|
6
6
|
import { Lazy } from "../../utilities/Lazy.js"
|
|
@@ -18,7 +18,7 @@ const resources: Lazy<AsyncDisposableStack> = new Lazy(() => {
|
|
|
18
18
|
export async function start(
|
|
19
19
|
{ tabId, startTerminalArguments }: StartTerminalInput,
|
|
20
20
|
config: DirectoriesConfig
|
|
21
|
-
): Promise<
|
|
21
|
+
): Promise<TestDirectory> {
|
|
22
22
|
const app = terminals.get(tabId.tabId)
|
|
23
23
|
assert(app, `Terminal with tabId ${tabId.tabId} not found.`)
|
|
24
24
|
const testDirectory = await prepareNewTestDirectory(config)
|
|
@@ -30,6 +30,8 @@ export async function start(
|
|
|
30
30
|
},
|
|
31
31
|
startTerminalArguments.terminalDimensions
|
|
32
32
|
)
|
|
33
|
+
|
|
34
|
+
return testDirectory
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
export async function initializeStdout(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod"
|
|
2
2
|
import { blockingCommandInputSchema } from "../../blockingCommandInputSchema.js"
|
|
3
3
|
import { trpc } from "../../connection/trpc.js"
|
|
4
|
+
import { serverTestDirectorySchema } from "../../types.js"
|
|
4
5
|
import type { DirectoriesConfig } from "../../updateTestdirectorySchemaFile.js"
|
|
5
6
|
import { tabIdSchema } from "../../utilities/tabId.js"
|
|
6
7
|
import * as terminal from "./api.js"
|
|
@@ -26,9 +27,12 @@ export function createTerminalRouter(config: DirectoriesConfig) {
|
|
|
26
27
|
return terminal.initializeStdout(options.input, options.signal)
|
|
27
28
|
}),
|
|
28
29
|
|
|
29
|
-
start: trpc.procedure
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
start: trpc.procedure
|
|
31
|
+
.input(startTerminalInputSchema)
|
|
32
|
+
.output(serverTestDirectorySchema)
|
|
33
|
+
.mutation(options => {
|
|
34
|
+
return terminal.start(options.input, config)
|
|
35
|
+
}),
|
|
32
36
|
|
|
33
37
|
sendStdin: trpc.procedure.input(z.object({ tabId: tabIdSchema, data: z.string() })).mutation(options => {
|
|
34
38
|
return terminal.sendStdin(options.input)
|
package/src/server/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { VimValue } from "neovim/lib/types/VimValue.js"
|
|
2
|
+
import * as z from "zod"
|
|
2
3
|
|
|
3
4
|
/** Describes the contents of the test directory, which is a blueprint for
|
|
4
5
|
* files and directories. Tests can create a unique, safe environment for
|
|
@@ -8,7 +9,7 @@ import type { VimValue } from "neovim/lib/types/VimValue.js"
|
|
|
8
9
|
* be written with confidence that the files and directories they expect are
|
|
9
10
|
* actually found. Otherwise the tests are brittle and can break easily.
|
|
10
11
|
*/
|
|
11
|
-
export type TestDirectory<TContents extends
|
|
12
|
+
export type TestDirectory<TContents extends Record<string, unknown> = Record<string, unknown>> = {
|
|
12
13
|
/** The path to the unique test directory (the root).
|
|
13
14
|
*
|
|
14
15
|
* @example /Users/mikavilpas/git/tui-sandbox/packages/integration-tests/test-environment/testdirs/dir-0199UZ
|
|
@@ -31,6 +32,14 @@ export type TestDirectory<TContents extends object = object> = {
|
|
|
31
32
|
contents: TContents
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
export const serverTestDirectorySchema = z.object({
|
|
36
|
+
rootPathAbsolute: z.string(),
|
|
37
|
+
testEnvironmentPath: z.string(),
|
|
38
|
+
testEnvironmentPathRelative: z.string(),
|
|
39
|
+
contents: z.record(z.string(), z.unknown()),
|
|
40
|
+
})
|
|
41
|
+
export type ServerTestDirectory = z.infer<typeof serverTestDirectorySchema>
|
|
42
|
+
|
|
34
43
|
export type TestEnvironmentCommonEnvironmentVariables = {
|
|
35
44
|
HOME: string
|
|
36
45
|
|