@vite-hub/sandbox 0.5.0 → 0.6.0
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/README.md +20 -0
- 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-D9n0ZmdN.js} +8 -5
- 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-B0LQ5H2S.js → module-types-CWcBHyEs.js} +1 -2
- package/dist/{module-types-NYnG3NGz.d.ts → module-types-DHr6oC3h.d.ts} +18 -13
- package/dist/{process-sweep-CMaujWE5.js → process-sweep-DVaTb2pO.js} +1 -2
- package/dist/{provider-loader-Cvqoz7_Z.d.ts → provider-loader-CLIIEEmR.d.ts} +2 -6
- package/dist/{provider-resolution-BrQfEQo0.js → provider-resolution-qvRcW1PC.js} +13 -10
- 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 +2 -16
- package/dist/task/index.js +345 -142
- 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 +23 -24
- package/dist/task/vite.js +63 -74
- package/dist/{toolchain-DF9eutyQ.js → toolchain-DFFxmw3N.js} +6 -7
- package/dist/transfer-options-LTUzbHDw.js +18 -0
- 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-BH5lPJxs.js} +3 -5
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -446,6 +446,7 @@ The Definition entrypoint does not import `@vite-hub/sandbox/task`. ViteHub call
|
|
|
446
446
|
- Set `cpu` (vCPUs) and `memory` (MiB) next to `driver`, such as `hubSandboxTask({ driver: "cloudflare", cpu: 1, memory: 4096 })`. They are minimums, and ViteHub picks the smallest driver size that fits both. Vercel gets `resources.vcpus`: 1 or an even number up to 32, with 2048 MiB for each vCPU. Cloudflare gets the smallest instance type from `lite` to `standard-4`, and the default is `standard-1` (1/2 vCPU, 4096 MiB). On Cloudflare the size belongs to the Container class, so it applies to every task of the app. ViteHub keeps the `instance_type` of your own `containers` entry and fails the build when it is smaller than `cpu` or `memory`. `maxInstances` sets the Cloudflare Container limit (default 12).
|
|
447
447
|
- Driver selection belongs to application or host configuration, not to a Definition. `hubSandboxTask({ driver: "vercel" })` and `hubSandboxTask({ driver: "cloudflare" })` are the direct-package forms. The `vite-hub` distribution infers the driver from its Vercel and Cloudflare hosts, and takes the same options in `vitehub({ sandboxTask: { ... } })`.
|
|
448
448
|
- `vitehub.sandboxTask.timeout` must be a positive integer no greater than `2_147_483_647`. Without it, a run stops after 5 minutes on every driver. It bounds one execution attempt after driver startup, including package preparation, staging, and execution. Queueing, Sandbox startup, and retry delays can make the complete `runSandboxTask()` call take longer. An elapsed attempt timeout sends an internal abort signal to cancellable driver operations and returns `SANDBOX_TASK_RUN_FAILED` with `error.data.code` set to `SANDBOX_TASK_TIMEOUT` and status 504. On Vercel, the Sandbox session gets the task timeout plus 30 seconds, because its clock starts before Sandbox setup. ViteHub then ends the run at the task timeout, not the VM.
|
|
449
|
+
- `vitehub.sandboxTask.transfer` accepts the same transfer limits as `defineSandboxTask()`.
|
|
449
450
|
- Pass `signal` to `runSandboxTask()` when it belongs to a request or Agent Invocation. ViteHub forwards it to Sandbox startup and execution, cancels queued Cloudflare runs and retry backoff, and preserves the caller's abort reason. A Definition timeout remains the independent bound for each execution attempt.
|
|
450
451
|
- A failed run returns `SANDBOX_TASK_RUN_FAILED`. `error.cause` keeps the failure's code, message, and every detail for server logs. `toResponse(error)` from `@vite-hub/runtime` sends only `code`, `why`, and `fix`, so no stack or process output reaches the client. `resolveSandboxTaskRunner(name).run()` throws the same failure.
|
|
451
452
|
- Vercel Sandbox sessions are closed in a `finally` block after success or failure. Cloudflare also creates and closes a unique Sandbox for each run unless you configure `sandboxId` or pass one to `runSandboxTask()`. Session cleanup failures return an error, even after a successful handler. So do Cloudflare invocation-file cleanup failures in a Sandbox that stays open after the run. A Sandbox that ViteHub closes after the run loses its files when it closes, so ViteHub does not delete them separately.
|
|
@@ -471,6 +472,25 @@ The descriptor reports the provider's complete `ExecutionAuthority`, including d
|
|
|
471
472
|
|
|
472
473
|
Payloads, context, and results must be JSON-serializable. Nested `Blob` and `Uint8Array` values cross the Sandbox boundary through invocation-local binary files, and Node.js `Buffer` values retain their type.
|
|
473
474
|
|
|
475
|
+
ViteHub limits what one run can send across the Sandbox boundary. The payload and context JSON can have at most 4 MiB of UTF-8 text, and so can the result JSON. Each direction can also have at most 64 binary files, 64 MiB of binary data, and 32 levels of nested arrays and objects. Set `transfer` on a Definition to change these limits:
|
|
476
|
+
|
|
477
|
+
```ts
|
|
478
|
+
import { defineSandboxTask } from "@vite-hub/sandbox/task";
|
|
479
|
+
|
|
480
|
+
export default defineSandboxTask({
|
|
481
|
+
transfer: {
|
|
482
|
+
maxInputBytes: 2_097_152,
|
|
483
|
+
maxOutputBytes: 8_388_608,
|
|
484
|
+
maxDepth: 24,
|
|
485
|
+
maxSidecars: 16,
|
|
486
|
+
maxSidecarBytes: 16_777_216,
|
|
487
|
+
},
|
|
488
|
+
handler: async (payload: { image: Blob }) => payload,
|
|
489
|
+
});
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
Each limit is a whole number from 1 to 1073741824. A run that exceeds a limit fails with `SANDBOX_TASK_TRANSFER_LIMIT`. For input, the run fails before the handler starts and before ViteHub writes a binary file. For output, the run fails before ViteHub parses the result or reads a binary file. The byte limits count the UTF-8 JSON and the bytes of the binary values. The provider still sets its own execution and timeout limits.
|
|
493
|
+
|
|
474
494
|
### Package projects
|
|
475
495
|
|
|
476
496
|
ViteHub uses the package manifest's `packageManager`, then a lockfile at that package root, then npm. A matching `pnpm-workspace.yaml` moves preparation to the pnpm Workspace root and carries the transitive `workspace:*` dependency closure into the Sandbox while the entrypoint still runs from its package directory.
|
|
@@ -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",
|
|
@@ -58,7 +58,7 @@ const sandboxTaskErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
58
58
|
},
|
|
59
59
|
SANDBOX_TASK_C0007: {
|
|
60
60
|
...dynamicError,
|
|
61
|
-
fix: "Write `timeout`, `env`, and `project` in `defineSandboxTask()` as `key: value` with a literal value. Only `handler` can be a method."
|
|
61
|
+
fix: "Write `timeout`, `env`, `transfer`, and `project` in `defineSandboxTask()` as `key: value` with a literal value. Only `handler` can be a method."
|
|
62
62
|
},
|
|
63
63
|
SANDBOX_TASK_C0008: {
|
|
64
64
|
...dynamicError,
|
|
@@ -214,7 +214,7 @@ const sandboxTaskErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
214
214
|
},
|
|
215
215
|
SANDBOX_TASK_C0012: {
|
|
216
216
|
...dynamicError,
|
|
217
|
-
fix: "Use only the `handler`, `timeout`, `env`, and `project` options in `defineSandboxTask()`. Remove the other keys that the message lists."
|
|
217
|
+
fix: "Use only the `handler`, `timeout`, `env`, `transfer`, and `project` options in `defineSandboxTask()`. Remove the other keys that the message lists."
|
|
218
218
|
},
|
|
219
219
|
SANDBOX_TASK_C0013: {
|
|
220
220
|
...dynamicError,
|
|
@@ -294,7 +294,7 @@ const sandboxTaskErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
294
294
|
},
|
|
295
295
|
SANDBOX_TASK_R0069: {
|
|
296
296
|
...dynamicError,
|
|
297
|
-
fix: "Remove the options that the message names from `defineSandboxTask()`. A Definition supports only `handler`, `timeout`, `env`, and `project`."
|
|
297
|
+
fix: "Remove the options that the message names from `defineSandboxTask()`. A Definition supports only `handler`, `timeout`, `env`, `transfer`, and `project`."
|
|
298
298
|
},
|
|
299
299
|
SANDBOX_TASK_R0070: {
|
|
300
300
|
...dynamicError,
|
|
@@ -356,11 +356,14 @@ const sandboxTaskErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
356
356
|
why: ({ max, provider, size }) => `[vitehub] ${provider} has no Sandbox size for ${size}. The largest size is ${max}.`,
|
|
357
357
|
fix: "Lower `cpu` or `memory` in the Sandbox Task options. On Cloudflare the largest Container has 4 vCPU and 12288 MiB memory. On Vercel the largest Sandbox has 32 vCPU and 65536 MiB memory, and your plan can allow fewer."
|
|
358
358
|
},
|
|
359
|
+
SANDBOX_TASK_TRANSFER_INVALID: {
|
|
360
|
+
why: ({ problem }) => `[vitehub] The \`transfer\` option of the Sandbox Task Definition ${problem}.`,
|
|
361
|
+
fix: "Set `transfer` in `defineSandboxTask()` or `vitehub.sandboxTask.transfer` in `package.json` to an object that uses only `maxInputBytes`, `maxOutputBytes`, `maxDepth`, `maxSidecars`, and `maxSidecarBytes`. Set each one to a whole number from 1 to 1073741824, or remove it."
|
|
362
|
+
},
|
|
359
363
|
SANDBOX_TASK_VERCEL_TIMEOUT_LIMIT: {
|
|
360
364
|
why: ({ limit, timeout }) => `Vercel rejected the Sandbox session timeout of ${timeout}ms: ${limit}.`,
|
|
361
365
|
fix: "Set a lower Sandbox Task `timeout`. Vercel allows up to 45 minutes on Hobby and 24 hours on Pro. The Vercel session gets the task timeout plus 30 seconds."
|
|
362
366
|
}
|
|
363
367
|
}
|
|
364
368
|
});
|
|
365
|
-
//#endregion
|
|
366
369
|
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,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 };
|