@vite-hub/sandbox 0.0.1 → 0.0.2

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 (36) hide show
  1. package/README.md +35 -37
  2. package/dist/cloudflare-env-2NctU8i7.js +12 -0
  3. package/dist/index-DiH4OGAU.d.ts +101 -0
  4. package/dist/index.d.ts +23 -32
  5. package/dist/index.js +688 -265
  6. package/dist/module-types-Cjqo67ay.d.ts +91 -0
  7. package/dist/provider-loader-3ml65ZFy.d.ts +21 -0
  8. package/dist/runtime/provider-loader.d.ts +2 -17
  9. package/dist/runtime/provider-loader.js +4 -10
  10. package/dist/runtime/providers/cloudflare.d.ts +6 -11
  11. package/dist/runtime/providers/cloudflare.js +14 -11
  12. package/dist/runtime/providers/vercel.d.ts +5 -12
  13. package/dist/runtime/providers/vercel.js +16 -30
  14. package/dist/runtime/state.d.ts +1 -1
  15. package/dist/vite.d.ts +12 -28
  16. package/dist/vite.js +2276 -354
  17. package/package.json +68 -59
  18. package/dist/_shared-CJ2_pS4E.js +0 -53
  19. package/dist/cloudflare-retry-Cfra7MvS.js +0 -21
  20. package/dist/common-CS4FcWrh.d.ts +0 -369
  21. package/dist/index-B4j3Mvzr.d.ts +0 -146
  22. package/dist/integration-wkNE8jMO.js +0 -2032
  23. package/dist/module-types-CUcY8iuI.d.ts +0 -88
  24. package/dist/nitro.d.ts +0 -19
  25. package/dist/nitro.js +0 -488
  26. package/dist/provider-detection-IbezCeoR.js +0 -25
  27. package/dist/runtime/nitro-plugin.d.ts +0 -4
  28. package/dist/runtime/nitro-plugin.js +0 -8
  29. package/dist/sandbox/providers/cloudflare.d.ts +0 -7
  30. package/dist/sandbox/providers/cloudflare.js +0 -339
  31. package/dist/sandbox/providers/vercel.d.ts +0 -17
  32. package/dist/sandbox/providers/vercel.js +0 -538
  33. package/dist/shared-pqTHYWg1.d.ts +0 -8
  34. package/dist/utils-V7ODsDW_.js +0 -44
  35. package/dist/vercel-runtime-BPzvh_6V.js +0 -11
  36. /package/dist/{module-types-BomzaqnM.js → module-types-Dj1MFmHT.js} +0 -0
package/package.json CHANGED
@@ -1,26 +1,29 @@
1
1
  {
2
2
  "name": "@vite-hub/sandbox",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Sandbox execution primitives and Vite integration for ViteHub.",
5
- "author": "onmax <maximogarciamtnez@gmail.com>",
6
- "license": "Apache-2.0",
5
+ "keywords": [
6
+ "cloudflare",
7
+ "sandbox",
8
+ "vercel",
9
+ "vite",
10
+ "vitehub"
11
+ ],
7
12
  "homepage": "https://github.com/vite-hub/vitehub#readme",
13
+ "bugs": "https://github.com/vite-hub/vitehub/issues",
14
+ "license": "Apache-2.0",
15
+ "author": "onmax <maximogarciamtnez@gmail.com>",
8
16
  "repository": {
9
17
  "type": "git",
10
18
  "url": "git+https://github.com/vite-hub/vitehub.git",
11
19
  "directory": "packages/sandbox"
12
20
  },
13
- "bugs": "https://github.com/vite-hub/vitehub/issues",
14
- "keywords": [
15
- "vitehub",
16
- "vite",
17
- "nitro",
18
- "sandbox",
19
- "cloudflare",
20
- "vercel"
21
+ "files": [
22
+ "dist",
23
+ "package.json"
21
24
  ],
22
- "sideEffects": false,
23
25
  "type": "module",
26
+ "sideEffects": false,
24
27
  "types": "./dist/index.d.ts",
25
28
  "imports": {
26
29
  "#vitehub-sandbox-provider-loader": {
@@ -33,42 +36,61 @@
33
36
  }
34
37
  },
35
38
  "exports": {
36
- ".": "./dist/index.js",
37
- "./nitro": "./dist/nitro.js",
38
- "./runtime/empty-registry": "./dist/runtime/empty-registry.js",
39
- "./runtime/nitro-plugin": "./dist/runtime/nitro-plugin.js",
40
- "./runtime/provider-loader": "./dist/runtime/provider-loader.js",
41
- "./runtime/providers/cloudflare": "./dist/runtime/providers/cloudflare.js",
42
- "./runtime/providers/vercel": "./dist/runtime/providers/vercel.js",
43
- "./runtime/state": "./dist/runtime/state.js",
44
- "./sandbox/providers/cloudflare": "./dist/sandbox/providers/cloudflare.js",
45
- "./sandbox/providers/vercel": "./dist/sandbox/providers/vercel.js",
46
- "./vite": "./dist/vite.js",
39
+ ".": {
40
+ "types": "./dist/index.d.ts",
41
+ "import": "./dist/index.js"
42
+ },
43
+ "./runtime/empty-registry": {
44
+ "types": "./dist/runtime/empty-registry.d.ts",
45
+ "import": "./dist/runtime/empty-registry.js"
46
+ },
47
+ "./runtime/provider-loader": {
48
+ "types": "./dist/runtime/provider-loader.d.ts",
49
+ "import": "./dist/runtime/provider-loader.js"
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
+ "./runtime/state": {
60
+ "types": "./dist/runtime/state.d.ts",
61
+ "import": "./dist/runtime/state.js"
62
+ },
63
+ "./vite": {
64
+ "types": "./dist/vite.d.ts",
65
+ "import": "./dist/vite.js"
66
+ },
47
67
  "./package.json": "./package.json"
48
68
  },
49
- "files": [
50
- "dist",
51
- "package.json"
52
- ],
53
69
  "dependencies": {
54
- "esbuild": "^0.28.0",
55
- "exsolve": "^1.0.8",
56
- "h3": "2.0.1-rc.20",
57
- "local-pkg": "^1.1.2",
58
- "mlly": "^1.8.1",
70
+ "esbuild": "^0.28.1",
71
+ "h3": "2.0.1-rc.25",
72
+ "local-pkg": "^1.2.1",
73
+ "mlly": "^1.8.2",
59
74
  "pathe": "^2.0.3",
60
- "pkg-types": "^2.3.0",
61
- "rollup": "^4.53.3",
75
+ "rollup": "^4.62.2",
62
76
  "scule": "^1.3.0",
63
- "typescript": "^6.0.2",
64
- "ufo": "^1.6.1",
65
- "unctx": "^2.4.1",
66
- "unimport": "^6.0.2"
77
+ "typescript": "^6.0.3",
78
+ "ufo": "^1.6.4",
79
+ "unimport": "^6.3.0",
80
+ "@vite-hub/runtime": "0.0.2",
81
+ "@vite-hub/box": "0.0.2"
82
+ },
83
+ "devDependencies": {
84
+ "ofetch": "^1.5.1",
85
+ "publint": "^0.3.21",
86
+ "vite": "^8.0.8",
87
+ "vite-plus": "^0.1.24",
88
+ "vitest": "^4.1.4",
89
+ "@vite-hub/internal": "0.0.1"
67
90
  },
68
91
  "peerDependencies": {
69
- "@cloudflare/sandbox": "^0.8.11",
70
- "@vercel/sandbox": "^1.10.0",
71
- "nitro": "^3.0.0-0",
92
+ "@cloudflare/sandbox": "^0.8.14",
93
+ "@vercel/sandbox": "^1.10.2",
72
94
  "vite": ">=8.0.0"
73
95
  },
74
96
  "peerDependenciesMeta": {
@@ -78,30 +100,17 @@
78
100
  "@vercel/sandbox": {
79
101
  "optional": true
80
102
  },
81
- "nitro": {
82
- "optional": true
83
- },
84
103
  "vite": {
85
104
  "optional": true
86
105
  }
87
106
  },
88
- "devDependencies": {
89
- "@cloudflare/sandbox": "^0.8.11",
90
- "@vercel/sandbox": "^1.10.0",
91
- "nitro": "3.0.260311-beta",
92
- "ofetch": "^1.5.1",
93
- "publint": "^0.3.15",
94
- "tsdown": "^0.21.8",
95
- "tsx": "^4.21.0",
96
- "vite": "^8.0.8",
97
- "vitest": "^4.1.4",
98
- "@vite-hub/internal": "0.0.1"
107
+ "engines": {
108
+ "node": ">=24.0.0"
99
109
  },
100
110
  "scripts": {
101
- "build": "tsdown --tsconfig tsconfig.build.json",
102
- "dev": "tsdown --watch",
111
+ "build": "vp pack",
112
+ "dev": "vp pack --watch",
103
113
  "typecheck": "tsc --noEmit -p ./tsconfig.json",
104
- "test": "pnpm --filter @vite-hub/agent... build && pnpm --dir ../blob build && pnpm --dir ../kv build && pnpm --dir ../queue build && pnpm --dir . build && vitest run",
105
- "test:e2e": "tsx ./test/e2e.ts"
114
+ "test": "vp run -t @vite-hub/sandbox#build && vp test"
106
115
  }
107
116
  }
@@ -1,53 +0,0 @@
1
- import { n as SandboxError, r as NotSupportedError, t as sleep } from "./utils-V7ODsDW_.js";
2
- import { hasProtocol } from "ufo";
3
- //#region src/sandbox/adapters/base.ts
4
- var BaseSandboxAdapter = class {
5
- async listFiles(_path, _opts) {
6
- throw new NotSupportedError("listFiles", this.provider);
7
- }
8
- async exists(_path) {
9
- throw new NotSupportedError("exists", this.provider);
10
- }
11
- async deleteFile(_path) {
12
- throw new NotSupportedError("deleteFile", this.provider);
13
- }
14
- async moveFile(_src, _dst) {
15
- throw new NotSupportedError("moveFile", this.provider);
16
- }
17
- get vercel() {
18
- throw new NotSupportedError("vercel namespace", this.provider);
19
- }
20
- get cloudflare() {
21
- throw new NotSupportedError("cloudflare namespace", this.provider);
22
- }
23
- };
24
- //#endregion
25
- //#region src/sandbox/adapters/_shared.ts
26
- function normalizeLogPattern(pattern) {
27
- return typeof pattern === "string" ? new RegExp(pattern) : new RegExp(pattern.source, pattern.flags.replace(/g/g, ""));
28
- }
29
- function resolvePortProbeUrl(port, opts, resolvePortUrl) {
30
- if (opts?.hostname) return hasProtocol(opts.hostname, { acceptRelative: false }) ? opts.hostname : `http://${opts.hostname}:${port}`;
31
- if (resolvePortUrl) try {
32
- return resolvePortUrl();
33
- } catch {
34
- return `http://localhost:${port}`;
35
- }
36
- return `http://localhost:${port}`;
37
- }
38
- async function waitForPortProbe(fetcher, port, opts, resolvePortUrl) {
39
- const timeout = opts?.timeout ?? 3e4;
40
- const startTime = Date.now();
41
- while (Date.now() - startTime < timeout) try {
42
- const controller = new AbortController();
43
- const timeoutId = setTimeout(() => controller.abort(), 1e3);
44
- await fetcher(resolvePortProbeUrl(port, opts, resolvePortUrl), { signal: controller.signal });
45
- clearTimeout(timeoutId);
46
- return;
47
- } catch {
48
- await sleep(100);
49
- }
50
- throw new SandboxError(`Timeout waiting for port ${port}`, "TIMEOUT");
51
- }
52
- //#endregion
53
- export { waitForPortProbe as n, BaseSandboxAdapter as r, normalizeLogPattern as t };
@@ -1,21 +0,0 @@
1
- import { n as SandboxError } from "./utils-V7ODsDW_.js";
2
- //#region src/internal/shared/cloudflare-retry.ts
3
- const CLOUDFLARE_SANDBOX_RETRY_DELAYS_MS = [
4
- 1e3,
5
- 2e3,
6
- 5e3,
7
- 1e4,
8
- 15e3
9
- ];
10
- const CLOUDFLARE_RETRIABLE_STARTUP_ERROR_RE = /container is starting|currently provisioning|retry in a moment|network connection lost|not listening in the tcp address|durable object reset|code was updated|aborterror|aborted|maximum number of running container instances exceeded|there is no container instance that can be provided to this durable object/i;
11
- function collectCloudflareErrorMessages(error, ...extraMessages) {
12
- const sandboxError = error instanceof SandboxError ? error : void 0;
13
- return [
14
- error instanceof Error ? error.message : String(error),
15
- error instanceof Error && error.cause instanceof Error ? error.cause.message : "",
16
- sandboxError?.cause instanceof Error ? sandboxError.cause.message : "",
17
- ...extraMessages
18
- ].filter(Boolean).join("\n");
19
- }
20
- //#endregion
21
- export { CLOUDFLARE_SANDBOX_RETRY_DELAYS_MS as n, collectCloudflareErrorMessages as r, CLOUDFLARE_RETRIABLE_STARTUP_ERROR_RE as t };
@@ -1,369 +0,0 @@
1
- //#region src/sandbox/types/vercel.d.ts
2
- interface VercelSandboxRunCommandParams {
3
- cmd: string;
4
- args?: string[];
5
- cwd?: string;
6
- env?: Record<string, string>;
7
- sudo?: boolean;
8
- detached?: boolean;
9
- stdout?: NodeJS.WritableStream;
10
- stderr?: NodeJS.WritableStream;
11
- signal?: AbortSignal;
12
- }
13
- interface VercelSandboxInstance {
14
- fs?: {
15
- readFile: {
16
- (path: string, options?: {
17
- encoding?: null;
18
- signal?: AbortSignal;
19
- } | null): Promise<Uint8Array>;
20
- (path: string, options: {
21
- encoding: BufferEncoding;
22
- signal?: AbortSignal;
23
- } | BufferEncoding): Promise<string>;
24
- };
25
- writeFile: (path: string, data: string | Uint8Array, options?: {
26
- encoding?: BufferEncoding;
27
- signal?: AbortSignal;
28
- } | BufferEncoding) => Promise<void>;
29
- mkdir: (path: string, options?: {
30
- recursive?: boolean;
31
- signal?: AbortSignal;
32
- } | number) => Promise<string | undefined>;
33
- readdir: (path: string, options?: {
34
- signal?: AbortSignal;
35
- withFileTypes?: false;
36
- }) => Promise<string[]>;
37
- stat: (path: string, options?: {
38
- signal?: AbortSignal;
39
- }) => Promise<{
40
- isFile(): boolean;
41
- isDirectory(): boolean;
42
- isSymbolicLink(): boolean;
43
- size: number;
44
- mtime?: Date;
45
- mtimeMs?: number;
46
- }>;
47
- rm: (path: string, options?: {
48
- recursive?: boolean;
49
- force?: boolean;
50
- signal?: AbortSignal;
51
- }) => Promise<void>;
52
- rename: (oldPath: string, newPath: string, options?: {
53
- signal?: AbortSignal;
54
- }) => Promise<void>;
55
- exists?: (path: string, options?: {
56
- signal?: AbortSignal;
57
- }) => Promise<boolean>;
58
- access?: (path: string, options?: {
59
- signal?: AbortSignal;
60
- }) => Promise<void>;
61
- };
62
- runCommand: {
63
- (cmd: string, args?: string[], opts?: {
64
- signal?: AbortSignal;
65
- }): Promise<VercelSandboxCommandResult>;
66
- (params: VercelSandboxRunCommandParams & {
67
- detached: true;
68
- }): Promise<VercelSandboxCommandResult>;
69
- (params: VercelSandboxRunCommandParams): Promise<VercelSandboxCommandResult>;
70
- };
71
- writeFiles: (files: Array<{
72
- path: string;
73
- content: ArrayBufferView<ArrayBufferLike>;
74
- }>, opts?: {
75
- signal?: AbortSignal;
76
- }) => Promise<void>;
77
- readFileToBuffer: (opts: {
78
- path: string;
79
- cwd?: string;
80
- }, opts2?: {
81
- signal?: AbortSignal;
82
- }) => Promise<Uint8Array | null>;
83
- readFile: (opts: {
84
- path: string;
85
- cwd?: string;
86
- }, opts2?: {
87
- signal?: AbortSignal;
88
- }) => Promise<NodeJS.ReadableStream | null>;
89
- mkDir: (path: string, opts?: {
90
- signal?: AbortSignal;
91
- }) => Promise<void>;
92
- domain: (port: number) => string;
93
- stop?: (opts?: {
94
- signal?: AbortSignal;
95
- blocking?: boolean;
96
- }) => Promise<unknown>;
97
- [Symbol.asyncDispose]?: () => Promise<void>;
98
- }
99
- interface VercelSandboxCommandResult {
100
- exitCode: number;
101
- stdout: () => Promise<string>;
102
- stderr: () => Promise<string>;
103
- logs: () => AsyncGenerator<{
104
- stream: 'stdout' | 'stderr';
105
- data: string;
106
- }>;
107
- kill: () => Promise<void>;
108
- wait: () => Promise<{
109
- exitCode: number;
110
- }>;
111
- }
112
- type VercelSandboxSource = {
113
- type: 'git';
114
- url: string;
115
- depth?: number;
116
- revision?: string;
117
- } | {
118
- type: 'git';
119
- url: string;
120
- username: string;
121
- password: string;
122
- depth?: number;
123
- revision?: string;
124
- } | {
125
- type: 'tarball';
126
- url: string;
127
- } | {
128
- type: 'snapshot';
129
- snapshotId: string;
130
- };
131
- interface VercelSandboxListItem {
132
- id: string;
133
- status: string;
134
- createdAt: string | number;
135
- }
136
- interface VercelSandboxSnapshot {
137
- id: string;
138
- sandboxId: string;
139
- createdAt: string;
140
- }
141
- type SandboxNetworkPolicy = 'allow-all' | 'deny-all' | {
142
- allow?: string[] | Record<string, Array<{
143
- transform?: Array<{
144
- headers?: Record<string, string>;
145
- }>;
146
- }>>;
147
- subnets?: {
148
- allow?: string[];
149
- deny?: string[];
150
- };
151
- };
152
- interface VercelSandboxMetadata {
153
- id: string;
154
- runtime: string;
155
- status: string;
156
- createdAt: string;
157
- }
158
- interface VercelSandboxNamespace {
159
- readonly native: VercelSandboxInstance;
160
- snapshot: () => Promise<VercelSandboxSnapshot>;
161
- getSnapshot: (id: string) => Promise<VercelSandboxSnapshot>;
162
- listSnapshots: () => Promise<{
163
- snapshots: VercelSandboxSnapshot[];
164
- }>;
165
- deleteSnapshot: (id: string) => Promise<void>;
166
- domain: (port: number) => string;
167
- extendTimeout: (durationMs: number) => Promise<void>;
168
- updateNetworkPolicy: (policy: SandboxNetworkPolicy) => Promise<void>;
169
- getMetadata: () => VercelSandboxMetadata;
170
- }
171
- //#endregion
172
- //#region src/sandbox/types/common.d.ts
173
- type SandboxProvider = 'vercel' | 'cloudflare';
174
- type SandboxFileContent = string | Uint8Array;
175
- interface SandboxReadFileOptions {
176
- encoding?: 'utf8' | 'binary';
177
- }
178
- interface SandboxExecOptions {
179
- cwd?: string;
180
- env?: Record<string, string>;
181
- timeout?: number;
182
- sudo?: boolean;
183
- onStdout?: (data: string) => void;
184
- onStderr?: (data: string) => void;
185
- }
186
- interface SandboxExecResult {
187
- ok: boolean;
188
- stdout: string;
189
- stderr: string;
190
- code: number | null;
191
- meta?: Record<string, unknown>;
192
- }
193
- interface SandboxCapabilities {
194
- execEnv: boolean;
195
- execCwd: boolean;
196
- execSudo: boolean;
197
- listFiles: boolean;
198
- exists: boolean;
199
- deleteFile: boolean;
200
- moveFile: boolean;
201
- readFileStream: boolean;
202
- startProcess: boolean;
203
- }
204
- interface SandboxFileEntry {
205
- name: string;
206
- path: string;
207
- type: 'file' | 'directory';
208
- size?: number;
209
- mtime?: string;
210
- }
211
- interface SandboxListFilesOptions {
212
- recursive?: boolean;
213
- }
214
- interface SandboxProcessOptions {
215
- cwd?: string;
216
- env?: Record<string, string>;
217
- }
218
- interface SandboxWaitForPortOptions {
219
- timeout?: number;
220
- hostname?: string;
221
- }
222
- interface SandboxProcess {
223
- readonly id: string;
224
- readonly command: string;
225
- kill: (signal?: string) => Promise<void>;
226
- logs: () => Promise<{
227
- stdout: string;
228
- stderr: string;
229
- }>;
230
- wait: (timeout?: number) => Promise<{
231
- exitCode: number;
232
- }>;
233
- waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
234
- line: string;
235
- }>;
236
- waitForPort: (port: number, opts?: SandboxWaitForPortOptions) => Promise<void>;
237
- }
238
- interface CloudflareSandboxOptions {
239
- sleepAfter?: string | number;
240
- keepAlive?: boolean;
241
- normalizeId?: boolean;
242
- }
243
- interface DurableObjectNamespaceLike {
244
- idFromName: (name: string) => unknown;
245
- get: (id: unknown) => unknown;
246
- }
247
- interface VercelSandboxProviderOptions {
248
- provider: 'vercel';
249
- /**
250
- * Canonical Vercel sandbox image name.
251
- * Use `node22` or `node24`.
252
- */
253
- runtime?: string;
254
- timeout?: number;
255
- cpu?: number;
256
- ports?: number[];
257
- source?: VercelSandboxSource;
258
- networkPolicy?: SandboxNetworkPolicy;
259
- token?: string;
260
- teamId?: string;
261
- projectId?: string;
262
- }
263
- interface CloudflareSandboxProviderOptions {
264
- provider: 'cloudflare';
265
- namespace: DurableObjectNamespaceLike;
266
- sandboxId?: string;
267
- cloudflare?: CloudflareSandboxOptions;
268
- getSandbox?: (ns: DurableObjectNamespaceLike, id: string, opts?: CloudflareSandboxOptions) => CloudflareSandboxStub;
269
- }
270
- type SandboxProviderOptions = VercelSandboxProviderOptions | CloudflareSandboxProviderOptions;
271
- interface CloudflareSandboxExecResult {
272
- success: boolean;
273
- exitCode: number;
274
- stdout: string;
275
- stderr: string;
276
- command: string;
277
- duration: number;
278
- timestamp: string;
279
- sessionId?: string;
280
- }
281
- interface CloudflareSandboxWriteFileResult {
282
- success: boolean;
283
- path: string;
284
- timestamp: string;
285
- exitCode?: number;
286
- }
287
- interface CloudflareSandboxReadFileResult {
288
- success: boolean;
289
- path: string;
290
- content: string;
291
- timestamp: string;
292
- exitCode?: number;
293
- encoding?: 'utf-8' | 'base64';
294
- isBinary?: boolean;
295
- mimeType?: string;
296
- size?: number;
297
- }
298
- interface CloudflareSandboxStub {
299
- exec: (cmd: string, opts?: {
300
- timeout?: number;
301
- env?: Record<string, string | undefined>;
302
- cwd?: string;
303
- stream?: boolean;
304
- onOutput?: (stream: 'stdout' | 'stderr', data: string) => void;
305
- }) => Promise<CloudflareSandboxExecResult>;
306
- writeFile: (path: string, content: string, opts?: {
307
- encoding?: string;
308
- }) => Promise<CloudflareSandboxWriteFileResult>;
309
- readFile: (path: string, opts?: {
310
- encoding?: string;
311
- }) => Promise<CloudflareSandboxReadFileResult>;
312
- readFileStream?: (path: string) => Promise<ReadableStream<Uint8Array>>;
313
- mkdir?: (path: string, opts?: {
314
- recursive?: boolean;
315
- }) => Promise<{
316
- success: boolean;
317
- }>;
318
- listFiles?: (path: string, opts?: {
319
- recursive?: boolean;
320
- }) => Promise<{
321
- files: Array<{
322
- name: string;
323
- absolutePath: string;
324
- relativePath: string;
325
- type: 'file' | 'directory' | 'symlink' | 'other';
326
- size: number;
327
- modifiedAt: string;
328
- }>;
329
- }>;
330
- exists?: (path: string) => Promise<{
331
- exists: boolean;
332
- success?: boolean;
333
- path?: string;
334
- timestamp?: string;
335
- }>;
336
- deleteFile?: (path: string) => Promise<{
337
- success: boolean;
338
- }>;
339
- moveFile?: (src: string, dst: string) => Promise<{
340
- success: boolean;
341
- }>;
342
- startProcess?: (cmd: string, opts?: {
343
- cwd?: string;
344
- env?: Record<string, string>;
345
- onOutput?: (stream: 'stdout' | 'stderr', data: string) => void;
346
- }) => Promise<CloudflareSandboxProcessInfo>;
347
- destroy: () => Promise<void>;
348
- }
349
- interface CloudflareSandboxProcessInfo {
350
- id: string;
351
- command: string;
352
- kill: (signal?: string) => Promise<void>;
353
- getLogs: () => Promise<{
354
- stdout: string;
355
- stderr: string;
356
- }>;
357
- waitForExit: (timeout?: number) => Promise<{
358
- exitCode: number;
359
- }>;
360
- waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
361
- line: string;
362
- }>;
363
- waitForPort: (port: number, opts?: {
364
- timeout?: number;
365
- hostname?: string;
366
- }) => Promise<void>;
367
- }
368
- //#endregion
369
- export { SandboxNetworkPolicy as _, SandboxCapabilities as a, VercelSandboxNamespace as b, SandboxFileContent as c, SandboxProcess as d, SandboxProcessOptions as f, VercelSandboxProviderOptions as g, SandboxReadFileOptions as h, DurableObjectNamespaceLike as i, SandboxFileEntry as l, SandboxProviderOptions as m, CloudflareSandboxProviderOptions as n, SandboxExecOptions as o, SandboxProvider as p, CloudflareSandboxStub as r, SandboxExecResult as s, CloudflareSandboxOptions as t, SandboxListFilesOptions as u, VercelSandboxInstance as v, VercelSandboxSource as x, VercelSandboxListItem as y };