@vite-hub/sandbox 0.5.0 → 0.5.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/dist/{abortable-CR01hzfi.js → abortable-DrHeTo1e.js} +1 -2
- package/dist/{cloudflare-DOrMY3MJ.js → cloudflare-DrNRQPeh.js} +13 -17
- package/dist/{cloudflare-env-lookup-DzI6Xv1Y.js → cloudflare-env-lookup-BNbNil7g.js} +1 -2
- package/dist/{cloudflare-failure-CFQhalfh.js → cloudflare-failure-f-3P3ul-.js} +1 -2
- package/dist/{container-BVb0fw3z.js → container-DOadzngt.js} +7 -9
- package/dist/{crabbox-BU8W1gVC.js → crabbox-C7KeIKnH.js} +7 -8
- package/dist/{error-diagnostics-BJtLRL9w.js → error-diagnostics-CApUyzzu.js} +1 -2
- package/dist/{error-diagnostics-BNQwU9yq.js → error-diagnostics-ClSiUwCm.js} +1 -2
- package/dist/{file-listing-CHtRrfo1.js → file-listing-BF122soX.js} +3 -4
- package/dist/{file-lock-D0-XPogS.js → file-lock-CqA7b491.js} +3 -4
- package/dist/{index-DHl0T43e.d.ts → index-D9DogaoF.d.ts} +0 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -13
- package/dist/internal/cloudflare.d.ts +2 -5
- package/dist/internal/cloudflare.js +3 -4
- package/dist/internal/host-toolchain.d.ts +2 -4
- package/dist/internal/host-toolchain.js +4 -5
- package/dist/internal/vercel.d.ts +2 -4
- package/dist/internal/vercel.js +3 -4
- package/dist/{invariant-DolT9EEx.js → invariant-Dj2R1eMr.js} +1 -2
- package/dist/{module-types-NYnG3NGz.d.ts → module-types-B3uJG1po.d.ts} +1 -9
- package/dist/{module-types-B0LQ5H2S.js → module-types-CWcBHyEs.js} +1 -2
- package/dist/{process-sweep-CMaujWE5.js → process-sweep-DVaTb2pO.js} +1 -2
- package/dist/{provider-loader-Cvqoz7_Z.d.ts → provider-loader-CNKHrWXG.d.ts} +2 -6
- package/dist/{provider-resolution-BrQfEQo0.js → provider-resolution-Cl2NKhRP.js} +5 -8
- package/dist/{remote-fjUPBiLJ.js → remote-DlyX1drC.js} +5 -6
- package/dist/{rolldown-runtime-8H4AJuhK.js → rolldown-runtime-BJohB4LM.js} +1 -2
- package/dist/{runtime-DHp6ImeP.js → runtime-EtWFVKud.js} +1 -2
- package/dist/{runtime-type-Deo4qzxN.js → runtime-type-Dk-rJXlr.js} +1 -2
- package/dist/{session-e0lyzjJ3.js → session-DmUiyj4O.js} +5 -8
- package/dist/{shell-quote-Q3u3plif.js → shell-quote-MrD49m3N.js} +1 -2
- package/dist/ssh.d.ts +1 -3
- package/dist/ssh.js +5 -7
- package/dist/task/index.d.ts +1 -15
- package/dist/task/index.js +21 -37
- package/dist/task/runtime/empty-registry.d.ts +0 -2
- package/dist/task/runtime/empty-registry.js +1 -2
- package/dist/task/runtime/provider-loader.d.ts +1 -1
- package/dist/task/runtime/provider-loader.js +2 -3
- package/dist/task/runtime/providers/cloudflare.d.ts +3 -4
- package/dist/task/runtime/providers/cloudflare.js +3 -4
- package/dist/task/runtime/providers/local.d.ts +2 -4
- package/dist/task/runtime/providers/local.js +3 -4
- package/dist/task/runtime/providers/vercel.d.ts +3 -4
- package/dist/task/runtime/providers/vercel.js +6 -8
- package/dist/task/runtime/state.d.ts +3 -4
- package/dist/task/runtime/state.js +2 -3
- package/dist/task/vite.d.ts +22 -23
- package/dist/task/vite.js +53 -68
- package/dist/{toolchain-DF9eutyQ.js → toolchain-DFFxmw3N.js} +6 -7
- package/dist/{trusted-host-DLYiKP8a.js → trusted-host-CwMs64h1.js} +8 -9
- package/dist/{trusted-host-environment-CWKJ7DD_.js → trusted-host-environment-BJE5hGtQ.js} +1 -2
- package/dist/{vercel-qyDr7NvU.js → vercel-DT74kDyI.js} +9 -13
- package/dist/{vercel-credentials-BNTh2X-Y.js → vercel-credentials-BGuXoKxG.js} +3 -5
- package/package.json +10 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/abortable.ts
|
|
2
2
|
/**
|
|
3
3
|
* Wait for a promise until the caller's signal aborts.
|
|
4
4
|
*
|
|
@@ -53,5 +53,4 @@ function killOnAbort(process, signal) {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
//#endregion
|
|
57
56
|
export { killOnAbort as n, abortable as t };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { n as killOnAbort } from "./abortable-
|
|
10
|
-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.js";
|
|
2
|
+
import { t as listCommandFiles } from "./file-listing-BF122soX.js";
|
|
3
|
+
import { i as resolveRemoteEnvironment, n as openRemoteSandbox, o as snapshotStream, r as remoteSandboxPlan } from "./remote-DlyX1drC.js";
|
|
4
|
+
import { t as shellQuote } from "./shell-quote-MrD49m3N.js";
|
|
5
|
+
import { n as invariantError } from "./invariant-Dj2R1eMr.js";
|
|
6
|
+
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-CApUyzzu.js";
|
|
7
|
+
import { n as cloudflareRetryDelays, r as readCloudflareFailure, t as canRetryCloudflareRequest } from "./cloudflare-failure-f-3P3ul-.js";
|
|
8
|
+
import { r as markBuiltInSandboxRuntime } from "./runtime-EtWFVKud.js";
|
|
9
|
+
import { n as killOnAbort } from "./abortable-DrHeTo1e.js";
|
|
10
|
+
// src/internal/cloudflare-transport.ts
|
|
11
11
|
const cloudflareControlPlaneTimeout = 15e3;
|
|
12
12
|
const cloudflareReadTimeout = 15e3;
|
|
13
13
|
const cloudflareStopTimeout = 1e4;
|
|
@@ -66,8 +66,7 @@ async function waitForRetry(timeout, signal) {
|
|
|
66
66
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
//#region src/internal/cloudflare-durable-object.ts
|
|
69
|
+
// src/internal/cloudflare-durable-object.ts
|
|
71
70
|
const configurationKey = "vitehub:configuration";
|
|
72
71
|
const defaultSleepAfter = 6e5;
|
|
73
72
|
const keepAliveTimeout = 216e5;
|
|
@@ -505,8 +504,7 @@ function encodeBase64$1(value) {
|
|
|
505
504
|
for (let offset = 0; offset < value.length; offset += 8192) binary += String.fromCharCode(...value.subarray(offset, offset + 8192));
|
|
506
505
|
return btoa(binary);
|
|
507
506
|
}
|
|
508
|
-
|
|
509
|
-
//#region src/internal/network-policy.ts
|
|
507
|
+
// src/internal/network-policy.ts
|
|
510
508
|
const maxCloudflareAllowedHosts = 64;
|
|
511
509
|
const label = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
|
|
512
510
|
const hostPattern = new RegExp(`^(?:\\*\\.)?(?:${label}\\.)+${label}$|^${label}$`);
|
|
@@ -546,8 +544,7 @@ const cloudflareInterceptedHttpsEnv = Object.freeze({
|
|
|
546
544
|
REQUESTS_CA_BUNDLE: cloudflareContainerCa,
|
|
547
545
|
SSL_CERT_FILE: cloudflareContainerCa
|
|
548
546
|
});
|
|
549
|
-
|
|
550
|
-
//#region src/cloudflare.ts
|
|
547
|
+
// src/cloudflare.ts
|
|
551
548
|
var cloudflare_exports = /* @__PURE__ */ __exportAll({ createCloudflareRuntime: () => createCloudflareRuntime });
|
|
552
549
|
const cloudflareExecutionAuthority = {
|
|
553
550
|
credentials: "unknown",
|
|
@@ -896,5 +893,4 @@ async function abortable(operation, signal, abort) {
|
|
|
896
893
|
});
|
|
897
894
|
});
|
|
898
895
|
}
|
|
899
|
-
//#endregion
|
|
900
896
|
export { createCloudflareSandboxOutbound as i, createCloudflareRuntime as n, createCloudflareSandboxDurableObject as r, cloudflare_exports as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../internal/src/runtime/cloudflare-env-lookup.ts
|
|
2
2
|
/** The key of the AsyncLocalStorage store on `globalThis`. Every bundled copy of this module shares the store. */
|
|
3
3
|
const activeEnvStorageKey = Symbol.for("vitehub.cloudflare.env-storage");
|
|
4
4
|
let activeEnv;
|
|
@@ -12,5 +12,4 @@ function getActiveCloudflareEnv() {
|
|
|
12
12
|
const host = globalThis;
|
|
13
13
|
return Object.hasOwn(host, "__env__") && host.__env__ !== void 0 ? host.__env__ : activeEnv;
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { getActiveCloudflareEnv as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/cloudflare-failure.ts
|
|
2
2
|
/** Waits before each retry of a Cloudflare Sandbox request or Sandbox Task run. */
|
|
3
3
|
const cloudflareRetryDelays = [
|
|
4
4
|
1e3,
|
|
@@ -46,5 +46,4 @@ function errorFlag(error, name) {
|
|
|
46
46
|
function errorProperty(error, name) {
|
|
47
47
|
return typeof error === "object" && error !== null && name in error ? Reflect.get(error, name) : void 0;
|
|
48
48
|
}
|
|
49
|
-
//#endregion
|
|
50
49
|
export { cloudflareRetryDelays as n, readCloudflareFailure as r, canRetryCloudflareRequest as t };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-CApUyzzu.js";
|
|
2
|
+
import { t as listCommandFiles } from "./file-listing-BF122soX.js";
|
|
3
|
+
import { i as resolveRemoteEnvironment, n as openRemoteSandbox, r as remoteSandboxPlan } from "./remote-DlyX1drC.js";
|
|
4
|
+
import { r as markBuiltInSandboxRuntime } from "./runtime-EtWFVKud.js";
|
|
5
|
+
import { t as shellQuote } from "./shell-quote-MrD49m3N.js";
|
|
6
6
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
7
7
|
import { posix } from "node:path";
|
|
8
8
|
import { spawn } from "node:child_process";
|
|
9
9
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
10
10
|
import { Readable, Writable } from "node:stream";
|
|
11
|
-
|
|
11
|
+
// src/internal/container-broker.ts
|
|
12
12
|
/**
|
|
13
13
|
* mitmproxy addon for the container runtime broker. It is the only network exit of a
|
|
14
14
|
* caged Sandbox. It enforces the egress allowlist and swaps credential placeholders for
|
|
@@ -185,8 +185,7 @@ const containerBrokerEntrypoint = [
|
|
|
185
185
|
"exec mitmdump --listen-host 0.0.0.0 --listen-port 8080 --quiet --set connection_strategy=lazy --set rawtcp=false --set confdir=/tmp/vitehub-broker -s /tmp/vitehub-broker/addon.py"
|
|
186
186
|
].join("\n");
|
|
187
187
|
const containerBrokerCaPath = "/tmp/vitehub-broker/mitmproxy-ca-cert.pem";
|
|
188
|
-
|
|
189
|
-
//#region src/internal/container.ts
|
|
188
|
+
// src/internal/container.ts
|
|
190
189
|
const defaultContainerBrokerImage = "mitmproxy/mitmproxy:12.2.3";
|
|
191
190
|
const brokerAlias = "vitehub-broker";
|
|
192
191
|
const brokerPort = 8080;
|
|
@@ -860,5 +859,4 @@ function sandboxPath(path) {
|
|
|
860
859
|
function messageOf(error) {
|
|
861
860
|
return error instanceof Error ? error.message || error.name : String(error);
|
|
862
861
|
}
|
|
863
|
-
//#endregion
|
|
864
862
|
export { createContainerRuntime };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
1
|
+
import { t as listCommandFiles } from "./file-listing-BF122soX.js";
|
|
2
|
+
import { a as sandboxRequirementSecrets, i as sandboxRequirementPlan, o as sandboxRequirementSignal, r as sandboxRequirementError, s as materializeGitCheckout, t as createSandboxSession } from "./session-DmUiyj4O.js";
|
|
3
|
+
import { r as markBuiltInSandboxRuntime } from "./runtime-EtWFVKud.js";
|
|
4
|
+
import { t as shellQuote } from "./shell-quote-MrD49m3N.js";
|
|
5
|
+
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-CApUyzzu.js";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
7
|
import { cp, lstat, mkdtemp, readFile, realpath, rename, rm, rmdir, stat, writeFile } from "node:fs/promises";
|
|
8
8
|
import { dirname, join, posix, resolve } from "node:path";
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
10
10
|
import { tmpdir } from "node:os";
|
|
11
11
|
import { Readable, Writable } from "node:stream";
|
|
12
|
-
|
|
12
|
+
// src/internal/crabbox.ts
|
|
13
13
|
const workspaceSessions = /* @__PURE__ */ new Map();
|
|
14
14
|
const crabboxSessionEnvironmentKey = "VITEHUB_SANDBOX_SESSION";
|
|
15
15
|
const runtimeEnvironmentKeys = /* @__PURE__ */ new Set([
|
|
@@ -288,7 +288,7 @@ function environmentWrapper(assignments) {
|
|
|
288
288
|
}
|
|
289
289
|
async function provisionCrabboxToolchain(toolchain, session, context) {
|
|
290
290
|
const { abortSignal, leaseId, options } = context;
|
|
291
|
-
const { provisionToolchain, readProjectFilesWithShell, verifyToolchain } = await import("./toolchain-
|
|
291
|
+
const { provisionToolchain, readProjectFilesWithShell, verifyToolchain } = await import("./toolchain-DFFxmw3N.js").then((n) => n.i);
|
|
292
292
|
const run = async (script) => await runCrabbox(options, leaseId, {
|
|
293
293
|
abortSignal,
|
|
294
294
|
command: `sh -c ${shellQuote(script)}`
|
|
@@ -1102,5 +1102,4 @@ function waitForExit(child) {
|
|
|
1102
1102
|
if (child.exitCode !== null || child.signalCode !== null) return Promise.resolve();
|
|
1103
1103
|
return new Promise((resolvePromise) => child.once("close", () => resolvePromise()));
|
|
1104
1104
|
}
|
|
1105
|
-
//#endregion
|
|
1106
1105
|
export { createCrabboxRuntime };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// src/error-diagnostics.ts
|
|
3
3
|
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
4
4
|
const sandboxErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
5
5
|
docsBase: "https://vitehub.dev/docs/sandbox/diagnostics",
|
|
@@ -532,5 +532,4 @@ const sandboxErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
});
|
|
535
|
-
//#endregion
|
|
536
535
|
export { sandboxErrorDiagnostics as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// src/task/error-diagnostics.ts
|
|
3
3
|
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
4
4
|
const sandboxTaskErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
5
5
|
docsBase: "https://vitehub.dev/docs/sandbox/diagnostics",
|
|
@@ -362,5 +362,4 @@ const sandboxTaskErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
});
|
|
365
|
-
//#endregion
|
|
366
365
|
export { sandboxTaskErrorDiagnostics as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import { t as shellQuote } from "./shell-quote-
|
|
3
|
-
|
|
1
|
+
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-CApUyzzu.js";
|
|
2
|
+
import { t as shellQuote } from "./shell-quote-MrD49m3N.js";
|
|
3
|
+
// src/internal/file-listing.ts
|
|
4
4
|
async function listCommandFiles(run, options, failure) {
|
|
5
5
|
options.abortSignal?.throwIfAborted();
|
|
6
6
|
const result = await run({
|
|
@@ -22,5 +22,4 @@ async function listCommandFiles(run, options, failure) {
|
|
|
22
22
|
};
|
|
23
23
|
}).sort((left, right) => left.path.localeCompare(right.path));
|
|
24
24
|
}
|
|
25
|
-
//#endregion
|
|
26
25
|
export { listCommandFiles as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as abortable } from "./abortable-
|
|
2
|
-
import { t as runtimeRecord } from "./runtime-type-
|
|
1
|
+
import { t as abortable } from "./abortable-DrHeTo1e.js";
|
|
2
|
+
import { t as runtimeRecord } from "./runtime-type-Dk-rJXlr.js";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { hostname } from "node:os";
|
|
7
|
-
|
|
7
|
+
// src/internal/file-lock.ts
|
|
8
8
|
/**
|
|
9
9
|
* Acquire a cross-process lock directory. A lock whose owner process is gone
|
|
10
10
|
* on this host, or whose owner record stays unreadable, is treated as stale.
|
|
@@ -70,5 +70,4 @@ async function staleLock(path) {
|
|
|
70
70
|
return error instanceof Error && "code" in error && error.code === "ESRCH" ? token : void 0;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
//#endregion
|
|
74
73
|
export { acquireFileLock as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ExecutionAuthority } from "@vite-hub/runtime";
|
|
2
|
-
//#region src/internal/network-policy.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* The outbound network of a Sandbox. The `vercel` and `cloudflare` runtimes take this form.
|
|
5
4
|
* - `"allow-all"`: no limit. This is the default.
|
|
@@ -10,8 +9,6 @@ import { ExecutionAuthority } from "@vite-hub/runtime";
|
|
|
10
9
|
type SandboxNetworkPolicy = "allow-all" | "deny-all" | {
|
|
11
10
|
allow: readonly string[];
|
|
12
11
|
};
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/cloudflare.d.ts
|
|
15
12
|
interface CloudflareSandboxOptions {
|
|
16
13
|
cloudflare?: {
|
|
17
14
|
keepAlive?: boolean;
|
|
@@ -108,8 +105,6 @@ interface CloudflareSandboxStub {
|
|
|
108
105
|
success: boolean;
|
|
109
106
|
} | void>;
|
|
110
107
|
}
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region src/internal/container.d.ts
|
|
113
108
|
/** A credential that stays on the ViteHub host. The Sandbox sees only a placeholder. */
|
|
114
109
|
interface ContainerSandboxCredential {
|
|
115
110
|
/** Hosts that receive the real value, such as `api.github.com` or `*.example.com:8443`. */
|
|
@@ -149,8 +144,6 @@ interface ContainerSandboxOptions {
|
|
|
149
144
|
/** Container user, as for `docker run --user`. Defaults to the image user. */
|
|
150
145
|
user?: string;
|
|
151
146
|
}
|
|
152
|
-
//#endregion
|
|
153
|
-
//#region src/internal/crabbox.d.ts
|
|
154
147
|
interface CrabboxOptions {
|
|
155
148
|
/** Enables loopback port URLs when the target shares the ViteHub process network namespace. */
|
|
156
149
|
network?: "direct";
|
|
@@ -160,13 +153,9 @@ interface CrabboxOptions {
|
|
|
160
153
|
/** Private durable storage on the target host for writable Sandbox state. */
|
|
161
154
|
stateRoot?: string;
|
|
162
155
|
}
|
|
163
|
-
//#endregion
|
|
164
|
-
//#region src/internal/trusted-host.d.ts
|
|
165
156
|
interface TrustedHostOptions {
|
|
166
157
|
stateRoot?: string;
|
|
167
158
|
}
|
|
168
|
-
//#endregion
|
|
169
|
-
//#region src/vercel.d.ts
|
|
170
159
|
type VercelSandboxSource = {
|
|
171
160
|
depth?: number;
|
|
172
161
|
revision?: string;
|
|
@@ -311,8 +300,6 @@ interface VercelFileStat {
|
|
|
311
300
|
isSymbolicLink(): boolean;
|
|
312
301
|
size: number;
|
|
313
302
|
}
|
|
314
|
-
//#endregion
|
|
315
|
-
//#region src/index.d.ts
|
|
316
303
|
type SandboxRequirement = string | {
|
|
317
304
|
args?: readonly string[];
|
|
318
305
|
command: string;
|
|
@@ -589,5 +576,4 @@ interface ResolveSandboxOptions {
|
|
|
589
576
|
requires?: readonly SandboxRequirement[];
|
|
590
577
|
}
|
|
591
578
|
declare function resolveSandbox<Context>(definition: SandboxDefinition<Context>, context: Context, options?: ResolveSandboxOptions): Promise<Sandbox>;
|
|
592
|
-
//#endregion
|
|
593
579
|
export { TrustedHostOptions as $, SandboxRuntime as A, SandboxToolchainPackageManagerPin as B, SandboxPorts as C, SandboxRequirement as D, SandboxRemoveFileOptions as E, SandboxSession as F, resolveSandbox as G, SandboxToolchainPins as H, SandboxSpawnOptions as I, VercelSandboxCreateOptions as J, VercelFileStat as K, SandboxToolchain as L, SandboxRuntimeInput as M, SandboxRuntimeOpenOptions as N, SandboxResolvedRequirement as O, SandboxRuntimePlan as P, VercelSandboxSource as Q, SandboxToolchainInput as R, SandboxPlan as S, SandboxProcessExit as T, SandboxToolchainPlan as U, SandboxToolchainPin as V, SandboxValue as W, VercelSandboxNetworkPolicy as X, VercelSandboxInstance as Y, VercelSandboxOptions as Z, SandboxFileOptions as _, ResolvedSandboxFile as a, CloudflareSandboxOptions as at, SandboxListFilesOptions as b, ResolvedSandboxState as c, SandboxDefinition as d, CrabboxOptions as et, SandboxEnvironment as f, SandboxFileEntry as g, SandboxFile as h, ResolvedSandboxCheckout as i, CloudflareDurableObjectNamespace as it, SandboxRuntimeDefinition as j, SandboxResolvedToolchain as k, Sandbox as l, SandboxExecResult as m, BuiltInSandboxRuntimeName as n, ContainerSandboxEgress as nt, ResolvedSandboxPlan as o, CloudflareSandboxStub as ot, SandboxExecOptions as p, VercelSandboxCommand as q, ResolveSandboxOptions as r, ContainerSandboxOptions as rt, ResolvedSandboxRequirementInput as s, SandboxNetworkPolicy as st, BuiltInSandboxRuntime as t, ContainerSandboxCredential as tt, SandboxCheckout as u, SandboxFiles as v, SandboxProcess as w, SandboxOpenOptions as x, SandboxHome as y, SandboxToolchainOptions as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as TrustedHostOptions, A as SandboxRuntime, B as SandboxToolchainPackageManagerPin, C as SandboxPorts, D as SandboxRequirement, E as SandboxRemoveFileOptions, F as SandboxSession, G as resolveSandbox, H as SandboxToolchainPins, I as SandboxSpawnOptions, J as VercelSandboxCreateOptions, K as VercelFileStat, L as SandboxToolchain, M as SandboxRuntimeInput, N as SandboxRuntimeOpenOptions, O as SandboxResolvedRequirement, P as SandboxRuntimePlan, Q as VercelSandboxSource, R as SandboxToolchainInput, S as SandboxPlan, T as SandboxProcessExit, U as SandboxToolchainPlan, V as SandboxToolchainPin, W as SandboxValue, X as VercelSandboxNetworkPolicy, Y as VercelSandboxInstance, Z as VercelSandboxOptions, _ as SandboxFileOptions, a as ResolvedSandboxFile, at as CloudflareSandboxOptions, b as SandboxListFilesOptions, c as ResolvedSandboxState, d as SandboxDefinition, et as CrabboxOptions, f as SandboxEnvironment, g as SandboxFileEntry, h as SandboxFile, i as ResolvedSandboxCheckout, it as CloudflareDurableObjectNamespace, j as SandboxRuntimeDefinition, k as SandboxResolvedToolchain, l as Sandbox, m as SandboxExecResult, n as BuiltInSandboxRuntimeName, nt as ContainerSandboxEgress, o as ResolvedSandboxPlan, ot as CloudflareSandboxStub, p as SandboxExecOptions, q as VercelSandboxCommand, r as ResolveSandboxOptions, rt as ContainerSandboxOptions, s as ResolvedSandboxRequirementInput, st as SandboxNetworkPolicy, t as BuiltInSandboxRuntime, tt as ContainerSandboxCredential, u as SandboxCheckout, v as SandboxFiles, w as SandboxProcess, x as SandboxOpenOptions, y as SandboxHome, z as SandboxToolchainOptions } from "./index-
|
|
1
|
+
import { $ as TrustedHostOptions, A as SandboxRuntime, B as SandboxToolchainPackageManagerPin, C as SandboxPorts, D as SandboxRequirement, E as SandboxRemoveFileOptions, F as SandboxSession, G as resolveSandbox, H as SandboxToolchainPins, I as SandboxSpawnOptions, J as VercelSandboxCreateOptions, K as VercelFileStat, L as SandboxToolchain, M as SandboxRuntimeInput, N as SandboxRuntimeOpenOptions, O as SandboxResolvedRequirement, P as SandboxRuntimePlan, Q as VercelSandboxSource, R as SandboxToolchainInput, S as SandboxPlan, T as SandboxProcessExit, U as SandboxToolchainPlan, V as SandboxToolchainPin, W as SandboxValue, X as VercelSandboxNetworkPolicy, Y as VercelSandboxInstance, Z as VercelSandboxOptions, _ as SandboxFileOptions, a as ResolvedSandboxFile, at as CloudflareSandboxOptions, b as SandboxListFilesOptions, c as ResolvedSandboxState, d as SandboxDefinition, et as CrabboxOptions, f as SandboxEnvironment, g as SandboxFileEntry, h as SandboxFile, i as ResolvedSandboxCheckout, it as CloudflareDurableObjectNamespace, j as SandboxRuntimeDefinition, k as SandboxResolvedToolchain, l as Sandbox, m as SandboxExecResult, n as BuiltInSandboxRuntimeName, nt as ContainerSandboxEgress, o as ResolvedSandboxPlan, ot as CloudflareSandboxStub, p as SandboxExecOptions, q as VercelSandboxCommand, r as ResolveSandboxOptions, rt as ContainerSandboxOptions, s as ResolvedSandboxRequirementInput, st as SandboxNetworkPolicy, t as BuiltInSandboxRuntime, tt as ContainerSandboxCredential, u as SandboxCheckout, v as SandboxFiles, w as SandboxProcess, x as SandboxOpenOptions, y as SandboxHome, z as SandboxToolchainOptions } from "./index-D9DogaoF.js";
|
|
2
2
|
export { BuiltInSandboxRuntime, BuiltInSandboxRuntimeName, type CloudflareDurableObjectNamespace, type CloudflareSandboxOptions, type CloudflareSandboxStub, type ContainerSandboxCredential, type ContainerSandboxEgress, type ContainerSandboxOptions, type CrabboxOptions, ResolveSandboxOptions, ResolvedSandboxCheckout, ResolvedSandboxFile, ResolvedSandboxPlan, ResolvedSandboxRequirementInput, ResolvedSandboxState, Sandbox, SandboxCheckout, SandboxDefinition, SandboxEnvironment, SandboxExecOptions, SandboxExecResult, SandboxFile, SandboxFileEntry, SandboxFileOptions, SandboxFiles, SandboxHome, SandboxListFilesOptions, type SandboxNetworkPolicy, SandboxOpenOptions, SandboxPlan, SandboxPorts, SandboxProcess, SandboxProcessExit, SandboxRemoveFileOptions, SandboxRequirement, SandboxResolvedRequirement, SandboxResolvedToolchain, SandboxRuntime, SandboxRuntimeDefinition, SandboxRuntimeInput, SandboxRuntimeOpenOptions, SandboxRuntimePlan, SandboxSession, SandboxSpawnOptions, SandboxToolchain, SandboxToolchainInput, SandboxToolchainOptions, SandboxToolchainPackageManagerPin, SandboxToolchainPin, SandboxToolchainPins, SandboxToolchainPlan, SandboxValue, type TrustedHostOptions, type VercelFileStat, type VercelSandboxCommand, type VercelSandboxCreateOptions, type VercelSandboxInstance, type VercelSandboxNetworkPolicy, type VercelSandboxOptions, type VercelSandboxSource, resolveSandbox };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as isBuiltInSandboxRuntime, t as hasDeclaredSandboxRuntimeMember } from "./runtime-
|
|
2
|
-
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { n as isBuiltInSandboxRuntime, t as hasDeclaredSandboxRuntimeMember } from "./runtime-EtWFVKud.js";
|
|
2
|
+
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-CApUyzzu.js";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { readFile, realpath } from "node:fs/promises";
|
|
5
5
|
import { isAbsolute, posix, relative, resolve } from "node:path";
|
|
6
6
|
import { normalizeExecutionAuthority } from "@vite-hub/runtime";
|
|
7
|
-
|
|
7
|
+
// src/index.ts
|
|
8
8
|
const reservedRuntimeNames = /* @__PURE__ */ new Set([
|
|
9
9
|
"cloudflare",
|
|
10
10
|
"container",
|
|
@@ -22,15 +22,15 @@ async function resolveSandboxRuntime(value) {
|
|
|
22
22
|
}
|
|
23
23
|
if (typeof value === "string") {
|
|
24
24
|
if (value === "crabbox") {
|
|
25
|
-
const { createCrabboxRuntime } = await import("./crabbox-
|
|
25
|
+
const { createCrabboxRuntime } = await import("./crabbox-C7KeIKnH.js");
|
|
26
26
|
return createCrabboxRuntime();
|
|
27
27
|
}
|
|
28
28
|
if (value === "trusted-host") {
|
|
29
|
-
const { createTrustedHostRuntime } = await import("./trusted-host-
|
|
29
|
+
const { createTrustedHostRuntime } = await import("./trusted-host-CwMs64h1.js").then((n) => n.n);
|
|
30
30
|
return createTrustedHostRuntime();
|
|
31
31
|
}
|
|
32
32
|
if (value === "vercel") {
|
|
33
|
-
const { createVercelRuntime } = await import("./vercel-
|
|
33
|
+
const { createVercelRuntime } = await import("./vercel-DT74kDyI.js").then((n) => n.r);
|
|
34
34
|
return createVercelRuntime();
|
|
35
35
|
}
|
|
36
36
|
throw sandboxErrorDiagnostics.SANDBOX_R0031({ message: `[vitehub] Unknown Sandbox runtime "${value}". Expected "crabbox", "trusted-host", "vercel", a tagged built-in configuration, or a custom runtime.` });
|
|
@@ -40,27 +40,27 @@ async function resolveSandboxRuntime(value) {
|
|
|
40
40
|
const kind = config.kind;
|
|
41
41
|
if (config.kind === "crabbox") {
|
|
42
42
|
const options = withoutKind(config);
|
|
43
|
-
const { createCrabboxRuntime } = await import("./crabbox-
|
|
43
|
+
const { createCrabboxRuntime } = await import("./crabbox-C7KeIKnH.js");
|
|
44
44
|
return createCrabboxRuntime(options);
|
|
45
45
|
}
|
|
46
46
|
if (config.kind === "trusted-host") {
|
|
47
47
|
const options = withoutKind(config);
|
|
48
|
-
const { createTrustedHostRuntime } = await import("./trusted-host-
|
|
48
|
+
const { createTrustedHostRuntime } = await import("./trusted-host-CwMs64h1.js").then((n) => n.n);
|
|
49
49
|
return createTrustedHostRuntime(options);
|
|
50
50
|
}
|
|
51
51
|
if (config.kind === "cloudflare") {
|
|
52
52
|
const options = withoutKind(config);
|
|
53
|
-
const { createCloudflareRuntime } = await import("./cloudflare-
|
|
53
|
+
const { createCloudflareRuntime } = await import("./cloudflare-DrNRQPeh.js").then((n) => n.t);
|
|
54
54
|
return createCloudflareRuntime(options);
|
|
55
55
|
}
|
|
56
56
|
if (config.kind === "vercel") {
|
|
57
57
|
const options = withoutKind(config);
|
|
58
|
-
const { createVercelRuntime } = await import("./vercel-
|
|
58
|
+
const { createVercelRuntime } = await import("./vercel-DT74kDyI.js").then((n) => n.r);
|
|
59
59
|
return createVercelRuntime(options);
|
|
60
60
|
}
|
|
61
61
|
if (config.kind === "container") {
|
|
62
62
|
const options = withoutKind(config);
|
|
63
|
-
const { createContainerRuntime } = await import("./container-
|
|
63
|
+
const { createContainerRuntime } = await import("./container-DOadzngt.js");
|
|
64
64
|
return createContainerRuntime(options);
|
|
65
65
|
}
|
|
66
66
|
throw sandboxErrorDiagnostics.SANDBOX_R0033({ message: `[vitehub] Unknown Sandbox runtime kind "${String(kind)}". Expected "crabbox", "trusted-host", "cloudflare", "container", or "vercel".` });
|
|
@@ -150,7 +150,7 @@ async function resolveSandbox(definition, context, options = {}) {
|
|
|
150
150
|
}
|
|
151
151
|
async function resolveToolchain(declaration, projectRoot) {
|
|
152
152
|
if (declaration === void 0) return;
|
|
153
|
-
const [{ normalizeToolchain, readToolchainPins, toolchainReadsProject }, { readHostProjectFiles }] = await Promise.all([import("./toolchain-
|
|
153
|
+
const [{ normalizeToolchain, readToolchainPins, toolchainReadsProject }, { readHostProjectFiles }] = await Promise.all([import("./toolchain-DFFxmw3N.js").then((n) => n.i), import("./internal/host-toolchain.js")]);
|
|
154
154
|
const toolchain = normalizeToolchain(declaration, "sandbox.toolchain");
|
|
155
155
|
if (!toolchain) return;
|
|
156
156
|
if (!projectRoot && toolchainReadsProject(toolchain)) return toolchain;
|
|
@@ -322,5 +322,4 @@ function resolveSha(value) {
|
|
|
322
322
|
async function resolveValue(value, context) {
|
|
323
323
|
return typeof value === "function" ? await value(context) : value;
|
|
324
324
|
}
|
|
325
|
-
//#endregion
|
|
326
325
|
export { resolveSandbox };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { at as CloudflareSandboxOptions, l as Sandbox } from "../index-
|
|
2
|
-
//#region src/internal/cloudflare-durable-object.d.ts
|
|
1
|
+
import { at as CloudflareSandboxOptions, l as Sandbox } from "../index-D9DogaoF.js";
|
|
3
2
|
interface CloudflareContainerExecProcess {
|
|
4
3
|
readonly exitCode: Promise<number>;
|
|
5
4
|
readonly stderr: ReadableStream<Uint8Array> | null;
|
|
@@ -170,7 +169,5 @@ export declare function createCloudflareSandboxOutbound(dependencies: Cloudflare
|
|
|
170
169
|
fetch(request: Request): Promise<Response>;
|
|
171
170
|
};
|
|
172
171
|
export declare function createCloudflareSandboxDurableObject(dependencies: CloudflareSandboxDurableObjectDependencies): new (ctx: CloudflareDurableObjectState, env: unknown) => CloudflareSandboxDurableObject;
|
|
173
|
-
//#endregion
|
|
174
|
-
//#region src/internal/cloudflare.d.ts
|
|
175
172
|
export declare function resolveCloudflareSandbox(options: CloudflareSandboxOptions, requirements: readonly string[]): Promise<Sandbox>;
|
|
176
|
-
|
|
173
|
+
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { i as createCloudflareSandboxOutbound, n as createCloudflareRuntime, r as createCloudflareSandboxDurableObject } from "../cloudflare-DrNRQPeh.js";
|
|
2
|
+
import { a as resolveRemoteSandboxRuntime } from "../remote-DlyX1drC.js";
|
|
3
|
+
// src/internal/cloudflare.ts
|
|
4
4
|
async function resolveCloudflareSandbox(options, requirements) {
|
|
5
5
|
return await resolveRemoteSandboxRuntime(createCloudflareRuntime(options), requirements);
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { createCloudflareSandboxDurableObject, createCloudflareSandboxOutbound, resolveCloudflareSandbox };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { L as SandboxToolchain, R as SandboxToolchainInput, k as SandboxResolvedToolchain } from "../index-
|
|
2
|
-
//#region src/internal/host-toolchain.d.ts
|
|
1
|
+
import { L as SandboxToolchain, R as SandboxToolchainInput, k as SandboxResolvedToolchain } from "../index-D9DogaoF.js";
|
|
3
2
|
export interface HostToolchainOptions {
|
|
4
3
|
abortSignal?: AbortSignal;
|
|
5
4
|
/** Shared cache directory. Defaults to `$XDG_CACHE_HOME/vitehub/toolchains`. */
|
|
@@ -18,5 +17,4 @@ export declare function provisionHostToolchain(toolchain: SandboxToolchainInput,
|
|
|
18
17
|
/** PATH with the toolchain entries before the base PATH. */
|
|
19
18
|
export declare function toolchainPath(toolchain: SandboxResolvedToolchain, base: string | undefined): string;
|
|
20
19
|
/** Validate a toolchain declaration and provision it for a host directory. */
|
|
21
|
-
export declare function prepareHostToolchain(declaration: SandboxToolchain, directory: string, options?: HostToolchainOptions): Promise<SandboxResolvedToolchain>;
|
|
22
|
-
//#endregion
|
|
20
|
+
export declare function prepareHostToolchain(declaration: SandboxToolchain, directory: string, options?: HostToolchainOptions): Promise<SandboxResolvedToolchain>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as sandboxErrorDiagnostics } from "../error-diagnostics-
|
|
2
|
-
import { t as acquireFileLock } from "../file-lock-
|
|
3
|
-
import { a as verifyToolchain, n as provisionToolchain, r as toolchainProjectFiles, t as normalizeToolchain } from "../toolchain-
|
|
1
|
+
import { t as sandboxErrorDiagnostics } from "../error-diagnostics-CApUyzzu.js";
|
|
2
|
+
import { t as acquireFileLock } from "../file-lock-CqA7b491.js";
|
|
3
|
+
import { a as verifyToolchain, n as provisionToolchain, r as toolchainProjectFiles, t as normalizeToolchain } from "../toolchain-DFFxmw3N.js";
|
|
4
4
|
import { lstat, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
5
5
|
import { delimiter, dirname, join, resolve } from "node:path";
|
|
6
6
|
import { execFile } from "node:child_process";
|
|
7
7
|
import { promisify } from "node:util";
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
|
-
|
|
9
|
+
// src/internal/host-toolchain.ts
|
|
10
10
|
/** Default host cache. A configured Sandbox stateRoot keeps toolchains beside durable state. */
|
|
11
11
|
function hostToolchainCacheRoot(stateRoot) {
|
|
12
12
|
return stateRoot ? join(stateRoot, "toolchains") : join(process.env.XDG_CACHE_HOME || join(homedir(), ".cache"), "vitehub", "toolchains");
|
|
@@ -92,5 +92,4 @@ function toolchainPath(toolchain, base) {
|
|
|
92
92
|
async function prepareHostToolchain(declaration, directory, options = {}) {
|
|
93
93
|
return await provisionHostToolchain(normalizeToolchain(declaration), directory, options);
|
|
94
94
|
}
|
|
95
|
-
//#endregion
|
|
96
95
|
export { hostToolchainCacheRoot, prepareHostToolchain, provisionHostToolchain, readHostProjectFiles, toolchainPath };
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { Z as VercelSandboxOptions, l as Sandbox } from "../index-
|
|
2
|
-
|
|
3
|
-
export declare function resolveVercelSandbox(options: VercelSandboxOptions, requirements: readonly string[]): Promise<Sandbox>;
|
|
4
|
-
//#endregion
|
|
1
|
+
import { Z as VercelSandboxOptions, l as Sandbox } from "../index-D9DogaoF.js";
|
|
2
|
+
export declare function resolveVercelSandbox(options: VercelSandboxOptions, requirements: readonly string[]): Promise<Sandbox>;
|
package/dist/internal/vercel.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { t as createVercelRuntime } from "../vercel-DT74kDyI.js";
|
|
2
|
+
import { a as resolveRemoteSandboxRuntime } from "../remote-DlyX1drC.js";
|
|
3
|
+
// src/internal/vercel.ts
|
|
4
4
|
async function resolveVercelSandbox(options, requirements) {
|
|
5
5
|
return await resolveRemoteSandboxRuntime(createVercelRuntime(options), requirements);
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { resolveVercelSandbox };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// ../internal/src/invariant.ts
|
|
3
3
|
const invariantDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
4
4
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
5
5
|
codes: { INTERNAL_INVARIANT_FAILED: {
|
|
@@ -18,5 +18,4 @@ function invariantError(what) {
|
|
|
18
18
|
function invariant(condition, what) {
|
|
19
19
|
if (!condition) throw invariantError(what);
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { invariantError as n, invariant as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Q as VercelSandboxSource, X as VercelSandboxNetworkPolicy, st as SandboxNetworkPolicy } from "./index-
|
|
1
|
+
import { Q as VercelSandboxSource, X as VercelSandboxNetworkPolicy, st as SandboxNetworkPolicy } from "./index-D9DogaoF.js";
|
|
2
2
|
import { ViteHubError } from "@vite-hub/runtime";
|
|
3
|
-
//#region src/task/project.d.ts
|
|
4
3
|
type SandboxTaskPackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
|
|
5
4
|
interface SandboxTaskProjectFile {
|
|
6
5
|
contents: string;
|
|
@@ -18,8 +17,6 @@ interface SandboxTaskProject {
|
|
|
18
17
|
options?: SandboxTaskProjectOptions;
|
|
19
18
|
packagePath: string;
|
|
20
19
|
}
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/task/runtime/result.d.ts
|
|
23
20
|
declare const sandboxTaskRunErrors: import("@vite-hub/runtime").ErrorCatalog<{
|
|
24
21
|
readonly SANDBOX_TASK_RUN_FAILED: {
|
|
25
22
|
readonly why: ({ name, code }: {
|
|
@@ -36,8 +33,6 @@ declare const sandboxTaskRunErrors: import("@vite-hub/runtime").ErrorCatalog<{
|
|
|
36
33
|
};
|
|
37
34
|
};
|
|
38
35
|
}>;
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/task/size.d.ts
|
|
41
36
|
/** The size of the machine that runs every Sandbox Task. Both values are minimums. */
|
|
42
37
|
interface SandboxTaskSizeOptions {
|
|
43
38
|
/** Minimum vCPUs. ViteHub picks the smallest provider size that gives at least this many. */
|
|
@@ -45,8 +40,6 @@ interface SandboxTaskSizeOptions {
|
|
|
45
40
|
/** Minimum memory in MiB. ViteHub picks the smallest provider size that gives at least this much. */
|
|
46
41
|
memory?: number;
|
|
47
42
|
}
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/task/module-types.d.ts
|
|
50
43
|
type SandboxTaskDriver = 'cloudflare' | 'vercel';
|
|
51
44
|
interface CloudflareSandboxTaskOptions {
|
|
52
45
|
sleepAfter?: string | number;
|
|
@@ -134,5 +127,4 @@ type SandboxTaskDefinitionFromHandler<THandler extends (...args: any[]) => any>
|
|
|
134
127
|
*/
|
|
135
128
|
type SandboxTaskRunResult<TResult = unknown> = [error: ReturnType<typeof sandboxTaskRunErrors.SANDBOX_TASK_RUN_FAILED>, data: undefined] | [error: undefined, data: TResult];
|
|
136
129
|
declare function getSandboxTaskFeatureDriver(config?: AgentSandboxTaskConfig | false): SandboxTaskDefinitionDriverOptions | undefined;
|
|
137
|
-
//#endregion
|
|
138
130
|
export { VercelSandboxTaskDriverOptions as _, SandboxTaskDefinitionBundle as a, SandboxTaskDefinitionHandler as c, SandboxTaskDevOptions as d, SandboxTaskDriver as f, SandboxTaskRunResult as g, SandboxTaskRunArguments as h, SandboxTaskDefinition as i, SandboxTaskDefinitionInput as l, SandboxTaskProjectOptions as m, CloudflareSandboxTaskDefinitionDriverOptions as n, SandboxTaskDefinitionDriverOptions as o, SandboxTaskExecutionOptions as p, CloudflareSandboxTaskOptions as r, SandboxTaskDefinitionFromHandler as s, AgentSandboxTaskConfig as t, SandboxTaskDefinitionOptions as u, getSandboxTaskFeatureDriver as v, SandboxTaskSizeOptions as y };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// src/task/module-types.ts
|
|
2
2
|
function getSandboxTaskFeatureDriver(config) {
|
|
3
3
|
if (!config || typeof config !== "object" || typeof config.driver !== "string") return void 0;
|
|
4
4
|
return config;
|
|
5
5
|
}
|
|
6
|
-
//#endregion
|
|
7
6
|
export { getSandboxTaskFeatureDriver as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile, readdir } from "node:fs/promises";
|
|
2
2
|
import { setTimeout } from "node:timers/promises";
|
|
3
|
-
|
|
3
|
+
// ../internal/src/process-sweep.ts
|
|
4
4
|
const maxRounds = 10;
|
|
5
5
|
/**
|
|
6
6
|
* Stops every process of this user that started with `name=value` in its environment: SIGTERM, then
|
|
@@ -29,5 +29,4 @@ function signal(pid, name) {
|
|
|
29
29
|
process.kill(pid, name);
|
|
30
30
|
} catch {}
|
|
31
31
|
}
|
|
32
|
-
//#endregion
|
|
33
32
|
export { stopMarkedProcesses as t };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { l as Sandbox } from "./index-
|
|
2
|
-
import { f as SandboxTaskDriver, o as SandboxTaskDefinitionDriverOptions, u as SandboxTaskDefinitionOptions } from "./module-types-
|
|
1
|
+
import { l as Sandbox } from "./index-D9DogaoF.js";
|
|
2
|
+
import { f as SandboxTaskDriver, o as SandboxTaskDefinitionDriverOptions, u as SandboxTaskDefinitionOptions } from "./module-types-B3uJG1po.js";
|
|
3
3
|
import { ExecutionAuthority } from "@vite-hub/runtime";
|
|
4
|
-
//#region src/task/runtime/task-sandbox.d.ts
|
|
5
4
|
/** `local` runs a Sandbox Task as a process on this machine, which only `vite dev` does. */
|
|
6
5
|
type SandboxTaskExecutionProvider = 'cloudflare' | 'vercel' | 'local';
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/task/runtime/provider-loader.d.ts
|
|
9
6
|
interface ResolvedTaskSandbox {
|
|
10
7
|
provider: SandboxTaskExecutionProvider;
|
|
11
8
|
resolveSandbox: (requirements: readonly string[]) => Promise<Sandbox>;
|
|
@@ -20,5 +17,4 @@ interface SandboxTaskRuntimeProvider {
|
|
|
20
17
|
} | any) => Promise<ResolvedTaskSandbox>;
|
|
21
18
|
}
|
|
22
19
|
declare function loadSandboxTaskRuntimeProvider(provider: SandboxTaskDriver): Promise<SandboxTaskRuntimeProvider>;
|
|
23
|
-
//#endregion
|
|
24
20
|
export { SandboxTaskRuntimeProvider as n, loadSandboxTaskRuntimeProvider as r, ResolvedTaskSandbox as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as
|
|
1
|
+
import { t as getActiveCloudflareEnv } from "./cloudflare-env-lookup-BNbNil7g.js";
|
|
2
|
+
import { t as sandboxTaskErrorDiagnostics } from "./error-diagnostics-ClSiUwCm.js";
|
|
3
3
|
import { ViteHubError, getViteHubErrorShape } from "@vite-hub/runtime";
|
|
4
|
-
|
|
4
|
+
// src/task/sandbox-task/errors.ts
|
|
5
5
|
function sanitizeSandboxTaskDetail(value, depth = 0, seen = /* @__PURE__ */ new WeakSet()) {
|
|
6
6
|
if (value === null || typeof value === "boolean") return value;
|
|
7
7
|
if (typeof value === "string") return value.slice(0, 16384);
|
|
@@ -45,8 +45,7 @@ function sandboxTaskError(message, metadata = {}) {
|
|
|
45
45
|
function isSandboxTaskError(value) {
|
|
46
46
|
return getViteHubErrorShape(value)?.code.startsWith("SANDBOX_TASK_") === true;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
//#region src/task/internal/shared/provider-detection.ts
|
|
48
|
+
// src/task/internal/shared/provider-detection.ts
|
|
50
49
|
function createProviderDetector(rules) {
|
|
51
50
|
return () => {
|
|
52
51
|
for (const rule of rules) if (rule.when()) return rule.provider;
|
|
@@ -63,8 +62,7 @@ const isVercel = () => {
|
|
|
63
62
|
const env = getRuntimeEnv();
|
|
64
63
|
return !!(env.VERCEL || env.VERCEL_ENV);
|
|
65
64
|
};
|
|
66
|
-
|
|
67
|
-
//#region src/task/runtime/provider-resolution.ts
|
|
65
|
+
// src/task/runtime/provider-resolution.ts
|
|
68
66
|
const allowedDefinitionKeys = /* @__PURE__ */ new Set(["timeout", "env"]);
|
|
69
67
|
const maxTimeout = 2147483647;
|
|
70
68
|
/** The timeout of a Sandbox Task run that sets no `timeout`, on every provider. */
|
|
@@ -129,5 +127,4 @@ function withSandboxTaskProvider(provider, options) {
|
|
|
129
127
|
driver: provider
|
|
130
128
|
};
|
|
131
129
|
}
|
|
132
|
-
//#endregion
|
|
133
130
|
export { resolveTaskSandbox as a, isSandboxTaskError as c, resolveRuntimeProvider as i, sandboxTaskError as l, assertSandboxTaskDefinitionOptions as n, unsupportedHostedSandboxTaskProviderError as o, createCloudflareExecutionSandboxId as r, withSandboxTaskProvider as s, DEFAULT_SANDBOX_TASK_TIMEOUT_MS as t };
|