@vite-hub/sandbox 0.0.2 → 0.0.3
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/dist/index.d.ts +1 -1
- package/dist/{module-types-Cjqo67ay.d.ts → module-types-DfXe133f.d.ts} +1 -1
- package/dist/{provider-loader-3ml65ZFy.d.ts → provider-loader-hL7uHVWp.d.ts} +1 -1
- package/dist/runtime/provider-loader.d.ts +1 -1
- package/dist/runtime/provider-loader.js +4 -4
- package/dist/runtime/providers/cloudflare.d.ts +4 -5
- package/dist/runtime/providers/cloudflare.js +3 -3
- package/dist/runtime/providers/vercel.d.ts +102 -4
- package/dist/runtime/providers/vercel.js +3 -3
- package/dist/runtime/state.d.ts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +8 -4
- package/package.json +3 -11
- package/dist/index-DiH4OGAU.d.ts +0 -101
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SandboxDefinitionBundle, c as SandboxDefinitionInput, d as SandboxExecutionOptions, f as SandboxProjectOptions, g as getSandboxFeatureProvider, h as VercelSandboxProviderOptions, i as SandboxDefinition, l as SandboxDefinitionOptions, m as SandboxRunResult, n as CloudflareSandboxDefinitionProviderOptions, o as SandboxDefinitionFromHandler, p as SandboxProvider, r as CloudflareSandboxOptions, s as SandboxDefinitionHandler, t as AgentSandboxConfig, u as SandboxDefinitionProviderOptions } from "./module-types-
|
|
1
|
+
import { a as SandboxDefinitionBundle, c as SandboxDefinitionInput, d as SandboxExecutionOptions, f as SandboxProjectOptions, g as getSandboxFeatureProvider, h as VercelSandboxProviderOptions, i as SandboxDefinition, l as SandboxDefinitionOptions, m as SandboxRunResult, n as CloudflareSandboxDefinitionProviderOptions, o as SandboxDefinitionFromHandler, p as SandboxProvider, r as CloudflareSandboxOptions, s as SandboxDefinitionHandler, t as AgentSandboxConfig, u as SandboxDefinitionProviderOptions } from "./module-types-DfXe133f.js";
|
|
2
2
|
import { H3Event } from "h3";
|
|
3
3
|
import { ExecutionAuthority } from "@vite-hub/runtime";
|
|
4
4
|
import { SandboxDefinitionModules } from "#vitehub-sandbox-registry";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ViteHubError } from "@vite-hub/runtime";
|
|
2
|
-
import { VercelBoxNetworkPolicy, VercelBoxSource } from "@vite-hub/box
|
|
2
|
+
import { VercelBoxNetworkPolicy, VercelBoxSource } from "@vite-hub/box";
|
|
3
3
|
|
|
4
4
|
//#region src/project.d.ts
|
|
5
5
|
type SandboxPackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as SandboxDefinitionOptions, p as SandboxProvider, u as SandboxDefinitionProviderOptions } from "./module-types-
|
|
1
|
+
import { l as SandboxDefinitionOptions, p as SandboxProvider, u as SandboxDefinitionProviderOptions } from "./module-types-DfXe133f.js";
|
|
2
2
|
import { Box } from "@vite-hub/box";
|
|
3
3
|
|
|
4
4
|
//#region src/runtime/provider-loader.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SandboxRuntimeProvider, r as loadSandboxRuntimeProvider, t as ResolvedSandboxBox } from "../provider-loader-
|
|
1
|
+
import { n as SandboxRuntimeProvider, r as loadSandboxRuntimeProvider, t as ResolvedSandboxBox } from "../provider-loader-hL7uHVWp.js";
|
|
2
2
|
export { ResolvedSandboxBox, SandboxRuntimeProvider, loadSandboxRuntimeProvider };
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
const dynamicImport = new Function("specifier", "return import(specifier)");
|
|
3
3
|
async function loadSandboxRuntimeProvider(provider) {
|
|
4
4
|
if (provider === "cloudflare") {
|
|
5
|
-
const {
|
|
6
|
-
return { resolveSandboxBox };
|
|
5
|
+
const { resolveCloudflareSandboxBox } = await dynamicImport("./providers/cloudflare.js");
|
|
6
|
+
return { resolveSandboxBox: resolveCloudflareSandboxBox };
|
|
7
7
|
}
|
|
8
8
|
if (provider === "vercel") {
|
|
9
|
-
const {
|
|
10
|
-
return { resolveSandboxBox };
|
|
9
|
+
const { resolveVercelSandboxBox } = await dynamicImport("./providers/vercel.js");
|
|
10
|
+
return { resolveSandboxBox: resolveVercelSandboxBox };
|
|
11
11
|
}
|
|
12
12
|
throw new Error(`[vitehub] Unsupported sandbox provider: ${provider}`);
|
|
13
13
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { l as SandboxDefinitionOptions, n as CloudflareSandboxDefinitionProviderOptions } from "../../module-types-
|
|
2
|
-
import { t as Box } from "../../index-DiH4OGAU.js";
|
|
1
|
+
import { l as SandboxDefinitionOptions, n as CloudflareSandboxDefinitionProviderOptions } from "../../module-types-DfXe133f.js";
|
|
3
2
|
|
|
4
3
|
//#region src/runtime/providers/cloudflare.d.ts
|
|
5
4
|
type SandboxOptions = {
|
|
@@ -18,13 +17,13 @@ type SandboxEvent = {
|
|
|
18
17
|
};
|
|
19
18
|
};
|
|
20
19
|
};
|
|
21
|
-
declare function
|
|
20
|
+
declare function resolveCloudflareSandboxBox(options: SandboxOptions, context?: {
|
|
22
21
|
event?: SandboxEvent;
|
|
23
22
|
}): Promise<{
|
|
24
23
|
closeAfterRun: boolean;
|
|
25
24
|
provider: "cloudflare";
|
|
26
25
|
sandboxId: string | undefined;
|
|
27
|
-
resolveBox: (requirements: readonly string[]) => Promise<Box>;
|
|
26
|
+
resolveBox: (requirements: readonly string[]) => Promise<import("@vite-hub/box").Box>;
|
|
28
27
|
}>;
|
|
29
28
|
//#endregion
|
|
30
|
-
export {
|
|
29
|
+
export { resolveCloudflareSandboxBox };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as getCloudflareEnv } from "../../cloudflare-env-2NctU8i7.js";
|
|
2
|
-
import { resolveCloudflareBox } from "@vite-hub/box/cloudflare";
|
|
2
|
+
import { resolveCloudflareBox } from "@vite-hub/box/_internal/cloudflare";
|
|
3
3
|
//#region src/runtime/providers/cloudflare.ts
|
|
4
|
-
async function
|
|
4
|
+
async function resolveCloudflareSandboxBox(options, context = {}) {
|
|
5
5
|
const env = getCloudflareEnv(context.event);
|
|
6
6
|
const bindingName = options.provider.binding || "SANDBOX";
|
|
7
7
|
const namespace = env?.[bindingName];
|
|
@@ -22,4 +22,4 @@ async function resolveSandboxBox(options, context = {}) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
25
|
-
export {
|
|
25
|
+
export { resolveCloudflareSandboxBox };
|
|
@@ -1,14 +1,112 @@
|
|
|
1
|
-
import { h as VercelSandboxProviderOptions, l as SandboxDefinitionOptions } from "../../module-types-
|
|
2
|
-
import {
|
|
1
|
+
import { h as VercelSandboxProviderOptions, l as SandboxDefinitionOptions } from "../../module-types-DfXe133f.js";
|
|
2
|
+
import { ExecutionAuthority } from "@vite-hub/runtime";
|
|
3
3
|
|
|
4
|
+
//#region ../box/dist/index-B2Wqvvhr.d.ts
|
|
5
|
+
interface BoxOpenOptions {
|
|
6
|
+
id?: string;
|
|
7
|
+
initialize?: (session: BoxSession, context: {
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
}) => Promise<void>;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
interface BoxExecOptions {
|
|
13
|
+
cwd?: string;
|
|
14
|
+
env?: Readonly<Record<string, string>>;
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
timeout?: number;
|
|
17
|
+
}
|
|
18
|
+
interface BoxExecResult {
|
|
19
|
+
readonly code: number;
|
|
20
|
+
readonly ok: boolean;
|
|
21
|
+
readonly stderr: string;
|
|
22
|
+
readonly stdout: string;
|
|
23
|
+
}
|
|
24
|
+
interface BoxProcessExit {
|
|
25
|
+
readonly code: number;
|
|
26
|
+
}
|
|
27
|
+
interface BoxProcess {
|
|
28
|
+
readonly pid?: number;
|
|
29
|
+
readonly stderr: ReadableStream<Uint8Array>;
|
|
30
|
+
readonly stdout: ReadableStream<Uint8Array>;
|
|
31
|
+
kill(signal?: string): Promise<void>;
|
|
32
|
+
wait(): Promise<BoxProcessExit>;
|
|
33
|
+
}
|
|
34
|
+
interface BoxFileEntry {
|
|
35
|
+
readonly path: string;
|
|
36
|
+
readonly size?: number;
|
|
37
|
+
readonly type: "directory" | "file" | "symlink";
|
|
38
|
+
}
|
|
39
|
+
interface BoxFileOptions {
|
|
40
|
+
signal?: AbortSignal;
|
|
41
|
+
}
|
|
42
|
+
interface BoxListFilesOptions extends BoxFileOptions {
|
|
43
|
+
recursive?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface BoxRemoveFileOptions extends BoxFileOptions {
|
|
46
|
+
recursive?: boolean;
|
|
47
|
+
}
|
|
48
|
+
interface BoxFiles {
|
|
49
|
+
exists(path: string, options?: BoxFileOptions): Promise<boolean>;
|
|
50
|
+
list(path: string, options?: BoxListFilesOptions): Promise<readonly BoxFileEntry[]>;
|
|
51
|
+
mkdir(path: string, options?: BoxFileOptions & {
|
|
52
|
+
recursive?: boolean;
|
|
53
|
+
}): Promise<void>;
|
|
54
|
+
move?(source: string, destination: string, options?: BoxFileOptions): Promise<void>;
|
|
55
|
+
read(path: string, options?: BoxFileOptions): Promise<Uint8Array | null>;
|
|
56
|
+
remove(path: string, options?: BoxRemoveFileOptions): Promise<void>;
|
|
57
|
+
write(path: string, contents: Uint8Array, options?: BoxFileOptions): Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
interface BoxPorts {
|
|
60
|
+
readonly values: readonly number[];
|
|
61
|
+
expose(port: number, options?: {
|
|
62
|
+
protocol?: "http" | "https" | "ws";
|
|
63
|
+
}): Promise<URL>;
|
|
64
|
+
}
|
|
65
|
+
interface BoxSession {
|
|
66
|
+
readonly cwd: string;
|
|
67
|
+
readonly executionAuthority: ExecutionAuthority;
|
|
68
|
+
readonly files: BoxFiles;
|
|
69
|
+
readonly id: string;
|
|
70
|
+
readonly ports?: BoxPorts;
|
|
71
|
+
readonly spawn?: (command: string, args?: readonly string[], options?: BoxExecOptions) => Promise<BoxProcess>;
|
|
72
|
+
close(): Promise<void>;
|
|
73
|
+
exec(command: string, args?: readonly string[], options?: BoxExecOptions): Promise<BoxExecResult>;
|
|
74
|
+
}
|
|
75
|
+
interface BoxEnvironment {
|
|
76
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
77
|
+
}
|
|
78
|
+
interface BoxResolvedRequirement {
|
|
79
|
+
readonly command: string;
|
|
80
|
+
readonly name: string;
|
|
81
|
+
}
|
|
82
|
+
interface BoxPlan {
|
|
83
|
+
readonly cache: {
|
|
84
|
+
readonly state: "disposable";
|
|
85
|
+
};
|
|
86
|
+
readonly environment: BoxEnvironment;
|
|
87
|
+
readonly executionAuthority: ExecutionAuthority;
|
|
88
|
+
readonly identity: string;
|
|
89
|
+
readonly requirements: readonly BoxResolvedRequirement[];
|
|
90
|
+
readonly runtime: string;
|
|
91
|
+
readonly workspace: {
|
|
92
|
+
readonly path?: string;
|
|
93
|
+
readonly state: "authoritative" | "disposable";
|
|
94
|
+
readonly workDir?: "." | "workspace";
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
interface Box {
|
|
98
|
+
readonly plan: BoxPlan;
|
|
99
|
+
open(options?: BoxOpenOptions): Promise<BoxSession>;
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
4
102
|
//#region src/runtime/providers/vercel.d.ts
|
|
5
103
|
type SandboxOptions = {
|
|
6
104
|
local: SandboxDefinitionOptions;
|
|
7
105
|
provider: VercelSandboxProviderOptions;
|
|
8
106
|
};
|
|
9
|
-
declare function
|
|
107
|
+
declare function resolveVercelSandboxBox(options: SandboxOptions): Promise<{
|
|
10
108
|
provider: "vercel";
|
|
11
109
|
resolveBox: (requirements: readonly string[]) => Promise<Box>;
|
|
12
110
|
}>;
|
|
13
111
|
//#endregion
|
|
14
|
-
export {
|
|
112
|
+
export { resolveVercelSandboxBox };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveVercelBox } from "@vite-hub/box/vercel";
|
|
1
|
+
import { resolveVercelBox } from "@vite-hub/box/_internal/vercel";
|
|
2
2
|
//#region src/internal/shared/env.ts
|
|
3
3
|
function readNonEmptyEnv(env, ...keys) {
|
|
4
4
|
for (const key of keys) {
|
|
@@ -31,7 +31,7 @@ function resolveCredentials(provider) {
|
|
|
31
31
|
projectId
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
async function
|
|
34
|
+
async function resolveVercelSandboxBox(options) {
|
|
35
35
|
const credentials = resolveCredentials(options.provider);
|
|
36
36
|
const boxOptions = {
|
|
37
37
|
runtime: options.provider.runtime || "node24",
|
|
@@ -48,4 +48,4 @@ async function resolveSandboxBox(options) {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
|
-
export {
|
|
51
|
+
export { resolveVercelSandboxBox };
|
package/dist/runtime/state.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SandboxDefinitionBundle, l as SandboxDefinitionOptions, t as AgentSandboxConfig } from "../module-types-
|
|
1
|
+
import { a as SandboxDefinitionBundle, l as SandboxDefinitionOptions, t as AgentSandboxConfig } from "../module-types-DfXe133f.js";
|
|
2
2
|
|
|
3
3
|
//#region src/runtime/state.d.ts
|
|
4
4
|
type SandboxRegistryEntry = {
|
package/dist/vite.d.ts
CHANGED
package/dist/vite.js
CHANGED
|
@@ -35,8 +35,8 @@ function includesNitroVitePlugin(value) {
|
|
|
35
35
|
if (!value || typeof value !== "object") return false;
|
|
36
36
|
return "name" in value && value.name === "nitro:main";
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return includesNitroVitePlugin(config.plugins);
|
|
38
|
+
function hasNitroConfigContext(config) {
|
|
39
|
+
return config["__vitehubNitroConfigContext"] === true || includesNitroVitePlugin(config.plugins);
|
|
40
40
|
}
|
|
41
41
|
function deploymentPresetFromNitro(value) {
|
|
42
42
|
const normalized = value?.trim().toLowerCase().replaceAll("_", "-");
|
|
@@ -1772,9 +1772,10 @@ function createSandboxRegistryContents(definitions) {
|
|
|
1772
1772
|
].join("\n");
|
|
1773
1773
|
}
|
|
1774
1774
|
function createSandboxProviderLoaderContents(provider) {
|
|
1775
|
+
const providerExport = sandboxProviderRuntimeExport(provider);
|
|
1775
1776
|
const providerLoaderPath = resolveFeatureRuntimePath(import.meta.url, "@vite-hub/sandbox", `./runtime/providers/${provider}`, `runtime/providers/${provider}.js`);
|
|
1776
1777
|
return [
|
|
1777
|
-
`import { resolveSandboxBox } from ${JSON.stringify(providerLoaderPath)}`,
|
|
1778
|
+
`import { ${providerExport} as resolveSandboxBox } from ${JSON.stringify(providerLoaderPath)}`,
|
|
1778
1779
|
"",
|
|
1779
1780
|
"export async function loadSandboxRuntimeProvider(selectedProvider) {",
|
|
1780
1781
|
` if (selectedProvider !== ${JSON.stringify(provider)})`,
|
|
@@ -1786,6 +1787,9 @@ function createSandboxProviderLoaderContents(provider) {
|
|
|
1786
1787
|
""
|
|
1787
1788
|
].join("\n");
|
|
1788
1789
|
}
|
|
1790
|
+
function sandboxProviderRuntimeExport(provider) {
|
|
1791
|
+
return provider === "cloudflare" ? "resolveCloudflareSandboxBox" : "resolveVercelSandboxBox";
|
|
1792
|
+
}
|
|
1789
1793
|
function resolveSandboxFeatureConfig(sandboxConfig, hosting) {
|
|
1790
1794
|
if (getSandboxFeatureProvider(sandboxConfig)?.provider) return { ...sandboxConfig };
|
|
1791
1795
|
const config = { ...sandboxConfig };
|
|
@@ -2286,7 +2290,7 @@ function hubSandbox(options) {
|
|
|
2286
2290
|
return prepared;
|
|
2287
2291
|
}
|
|
2288
2292
|
async function composeCloudflareSandbox(config, prepared) {
|
|
2289
|
-
if (!prepared.cloudflare || !
|
|
2293
|
+
if (!prepared.cloudflare || !hasNitroConfigContext(config) || getHostingProvider(prepared.hosting) !== "cloudflare") return false;
|
|
2290
2294
|
config.nitro = await configureCloudflareSandboxNitro(config.nitro, typeof config.root === "string" ? config.root : process.cwd(), prepared.cloudflare);
|
|
2291
2295
|
return true;
|
|
2292
2296
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/sandbox",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Sandbox execution primitives and Vite integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -48,14 +48,6 @@
|
|
|
48
48
|
"types": "./dist/runtime/provider-loader.d.ts",
|
|
49
49
|
"import": "./dist/runtime/provider-loader.js"
|
|
50
50
|
},
|
|
51
|
-
"./runtime/providers/cloudflare": {
|
|
52
|
-
"types": "./dist/runtime/providers/cloudflare.d.ts",
|
|
53
|
-
"import": "./dist/runtime/providers/cloudflare.js"
|
|
54
|
-
},
|
|
55
|
-
"./runtime/providers/vercel": {
|
|
56
|
-
"types": "./dist/runtime/providers/vercel.d.ts",
|
|
57
|
-
"import": "./dist/runtime/providers/vercel.js"
|
|
58
|
-
},
|
|
59
51
|
"./runtime/state": {
|
|
60
52
|
"types": "./dist/runtime/state.d.ts",
|
|
61
53
|
"import": "./dist/runtime/state.js"
|
|
@@ -77,8 +69,8 @@
|
|
|
77
69
|
"typescript": "^6.0.3",
|
|
78
70
|
"ufo": "^1.6.4",
|
|
79
71
|
"unimport": "^6.3.0",
|
|
80
|
-
"@vite-hub/
|
|
81
|
-
"@vite-hub/
|
|
72
|
+
"@vite-hub/box": "0.0.3",
|
|
73
|
+
"@vite-hub/runtime": "0.0.3"
|
|
82
74
|
},
|
|
83
75
|
"devDependencies": {
|
|
84
76
|
"ofetch": "^1.5.1",
|
package/dist/index-DiH4OGAU.d.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { ExecutionAuthority } from "@vite-hub/runtime";
|
|
2
|
-
|
|
3
|
-
//#region ../box/dist/index-Vc0GwE3_.d.ts
|
|
4
|
-
interface BoxOpenOptions {
|
|
5
|
-
id?: string;
|
|
6
|
-
initialize?: (session: BoxSession, context: {
|
|
7
|
-
signal?: AbortSignal;
|
|
8
|
-
}) => Promise<void>;
|
|
9
|
-
signal?: AbortSignal;
|
|
10
|
-
}
|
|
11
|
-
interface BoxExecOptions {
|
|
12
|
-
cwd?: string;
|
|
13
|
-
env?: Readonly<Record<string, string>>;
|
|
14
|
-
signal?: AbortSignal;
|
|
15
|
-
timeout?: number;
|
|
16
|
-
}
|
|
17
|
-
interface BoxExecResult {
|
|
18
|
-
readonly code: number;
|
|
19
|
-
readonly ok: boolean;
|
|
20
|
-
readonly stderr: string;
|
|
21
|
-
readonly stdout: string;
|
|
22
|
-
}
|
|
23
|
-
interface BoxProcessExit {
|
|
24
|
-
readonly code: number;
|
|
25
|
-
}
|
|
26
|
-
interface BoxProcess {
|
|
27
|
-
readonly pid?: number;
|
|
28
|
-
readonly stderr: ReadableStream<Uint8Array>;
|
|
29
|
-
readonly stdout: ReadableStream<Uint8Array>;
|
|
30
|
-
kill(signal?: string): Promise<void>;
|
|
31
|
-
wait(): Promise<BoxProcessExit>;
|
|
32
|
-
}
|
|
33
|
-
interface BoxFileEntry {
|
|
34
|
-
readonly path: string;
|
|
35
|
-
readonly size?: number;
|
|
36
|
-
readonly type: "directory" | "file" | "symlink";
|
|
37
|
-
}
|
|
38
|
-
interface BoxFileOptions {
|
|
39
|
-
signal?: AbortSignal;
|
|
40
|
-
}
|
|
41
|
-
interface BoxListFilesOptions extends BoxFileOptions {
|
|
42
|
-
recursive?: boolean;
|
|
43
|
-
}
|
|
44
|
-
interface BoxRemoveFileOptions extends BoxFileOptions {
|
|
45
|
-
recursive?: boolean;
|
|
46
|
-
}
|
|
47
|
-
interface BoxFiles {
|
|
48
|
-
exists(path: string, options?: BoxFileOptions): Promise<boolean>;
|
|
49
|
-
list(path: string, options?: BoxListFilesOptions): Promise<readonly BoxFileEntry[]>;
|
|
50
|
-
mkdir(path: string, options?: BoxFileOptions & {
|
|
51
|
-
recursive?: boolean;
|
|
52
|
-
}): Promise<void>;
|
|
53
|
-
move?(source: string, destination: string, options?: BoxFileOptions): Promise<void>;
|
|
54
|
-
read(path: string, options?: BoxFileOptions): Promise<Uint8Array | null>;
|
|
55
|
-
remove(path: string, options?: BoxRemoveFileOptions): Promise<void>;
|
|
56
|
-
write(path: string, contents: Uint8Array, options?: BoxFileOptions): Promise<void>;
|
|
57
|
-
}
|
|
58
|
-
interface BoxPorts {
|
|
59
|
-
readonly values: readonly number[];
|
|
60
|
-
expose(port: number, options?: {
|
|
61
|
-
protocol?: "http" | "https" | "ws";
|
|
62
|
-
}): Promise<URL>;
|
|
63
|
-
}
|
|
64
|
-
interface BoxSession {
|
|
65
|
-
readonly cwd: string;
|
|
66
|
-
readonly executionAuthority: ExecutionAuthority;
|
|
67
|
-
readonly files: BoxFiles;
|
|
68
|
-
readonly id: string;
|
|
69
|
-
readonly ports?: BoxPorts;
|
|
70
|
-
readonly spawn?: (command: string, args?: readonly string[], options?: BoxExecOptions) => Promise<BoxProcess>;
|
|
71
|
-
close(): Promise<void>;
|
|
72
|
-
exec(command: string, args?: readonly string[], options?: BoxExecOptions): Promise<BoxExecResult>;
|
|
73
|
-
}
|
|
74
|
-
interface BoxEnvironment {
|
|
75
|
-
readonly env: Readonly<Record<string, string | undefined>>;
|
|
76
|
-
}
|
|
77
|
-
interface BoxResolvedRequirement {
|
|
78
|
-
readonly command: string;
|
|
79
|
-
readonly name: string;
|
|
80
|
-
}
|
|
81
|
-
interface BoxPlan {
|
|
82
|
-
readonly cache: {
|
|
83
|
-
readonly state: "disposable";
|
|
84
|
-
};
|
|
85
|
-
readonly environment: BoxEnvironment;
|
|
86
|
-
readonly executionAuthority: ExecutionAuthority;
|
|
87
|
-
readonly identity: string;
|
|
88
|
-
readonly requirements: readonly BoxResolvedRequirement[];
|
|
89
|
-
readonly runtime: string;
|
|
90
|
-
readonly workspace: {
|
|
91
|
-
readonly path?: string;
|
|
92
|
-
readonly state: "authoritative" | "disposable";
|
|
93
|
-
readonly workDir?: "." | "workspace";
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
interface Box {
|
|
97
|
-
readonly plan: BoxPlan;
|
|
98
|
-
open(options?: BoxOpenOptions): Promise<BoxSession>;
|
|
99
|
-
}
|
|
100
|
-
//#endregion
|
|
101
|
-
export { Box as t };
|