@vite-hub/sandbox 0.1.0 → 0.3.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 +118 -53
- package/dist/abortable-CR01hzfi.js +57 -0
- package/dist/cloudflare-Cog_r2Me.js +910 -0
- package/dist/cloudflare-env-lookup-DzI6Xv1Y.js +16 -0
- package/dist/cloudflare-failure-CFQhalfh.js +50 -0
- package/dist/container-CqfD8yuE.js +868 -0
- package/dist/{crabbox-BFCdf41h.js → crabbox-sbV3Zjuo.js} +10 -6
- package/dist/error-diagnostics-5QT_BjbQ.js +354 -0
- package/dist/error-diagnostics-BJtLRL9w.js +536 -0
- package/dist/{file-listing-DECFTdSl.js → file-listing-CHtRrfo1.js} +1 -1
- package/dist/{file-lock-CxyVl4Cv.js → file-lock-D0-XPogS.js} +3 -2
- package/dist/{index-CXej1Bt0.d.ts → index-DsoQAUb7.d.ts} +94 -19
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -10
- package/dist/internal/cloudflare.d.ts +173 -1
- package/dist/internal/cloudflare.js +4 -12
- package/dist/internal/host-toolchain.d.ts +1 -1
- package/dist/internal/host-toolchain.js +6 -7
- package/dist/internal/vercel.d.ts +1 -1
- package/dist/internal/vercel.js +3 -11
- package/dist/invariant-DolT9EEx.js +22 -0
- package/dist/module-types-B0LQ5H2S.js +7 -0
- package/dist/module-types-DCeJbS9Z.d.ts +110 -0
- package/dist/process-sweep-CMaujWE5.js +33 -0
- package/dist/provider-resolution-C6AQzuFG.js +133 -0
- package/dist/{remote-1Jz2oUMK.js → remote-70ZVZZlq.js} +32 -14
- package/dist/runtime-type-Deo4qzxN.js +9 -0
- package/dist/{session-DD0S1PDC.js → session-e0lyzjJ3.js} +2 -1
- package/dist/size-7AkVwGZb.js +118 -0
- package/dist/ssh.d.ts +8 -0
- package/dist/ssh.js +107 -40
- package/dist/task/index.d.ts +19 -17
- package/dist/task/index.js +92 -201
- package/dist/task/runtime/provider-loader.d.ts +7 -9
- package/dist/task/runtime/provider-loader.js +2 -5
- package/dist/task/runtime/providers/cloudflare.d.ts +5 -19
- package/dist/task/runtime/providers/cloudflare.js +7 -6
- package/dist/task/runtime/providers/vercel.d.ts +3 -3
- package/dist/task/runtime/providers/vercel.js +35 -4
- package/dist/task/runtime/state.d.ts +4 -1
- package/dist/task/runtime/state.js +11 -2
- package/dist/task/vite.d.ts +143 -17
- package/dist/task/vite.js +723 -400
- package/dist/{toolchain-BUVXtQ2m.js → toolchain-BIVGMRty.js} +12 -11
- package/dist/{trusted-host-DNMJ-Oig.js → trusted-host-kxkpaQcs.js} +21 -179
- package/dist/{vercel-Jtxa9TJx.js → vercel-BGGrNpza.js} +107 -34
- package/package.json +15 -12
- package/dist/cloudflare-DO0h3Ncf.js +0 -281
- package/dist/cloudflare-env-BBJaBbuQ.js +0 -39
- package/dist/error-diagnostics-BSysPv-D.js +0 -166
- package/dist/error-diagnostics-dGQqfgLt.js +0 -99
- package/dist/module-types-BfyRBaiP.js +0 -7
- package/dist/module-types-Cis4hrF1.d.ts +0 -95
- package/dist/runtime-type-DrmrW5m5.js +0 -42
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as markBuiltInSandboxRuntime } from "./runtime-DHp6ImeP.js";
|
|
2
|
-
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
+
import { t as sandboxErrorDiagnostics } from "./error-diagnostics-BJtLRL9w.js";
|
|
3
3
|
import { t as shellQuote } from "./shell-quote-Q3u3plif.js";
|
|
4
|
-
import { t as listCommandFiles } from "./file-listing-
|
|
5
|
-
import { a as sandboxRequirementSecrets, i as sandboxRequirementPlan, o as sandboxRequirementSignal, r as sandboxRequirementError, s as materializeGitCheckout, t as createSandboxSession } from "./session-
|
|
4
|
+
import { t as listCommandFiles } from "./file-listing-CHtRrfo1.js";
|
|
5
|
+
import { a as sandboxRequirementSecrets, i as sandboxRequirementPlan, o as sandboxRequirementSignal, r as sandboxRequirementError, s as materializeGitCheckout, t as createSandboxSession } from "./session-e0lyzjJ3.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";
|
|
@@ -140,7 +140,7 @@ function createCrabboxProvider(options) {
|
|
|
140
140
|
abortSignal: bootstrapSignal,
|
|
141
141
|
command: `${shellQuote(materialized.environmentFile)} git ${args.map(shellQuote).join(" ")}`
|
|
142
142
|
});
|
|
143
|
-
if (result.exitCode !== 0) throw sandboxErrorDiagnostics.
|
|
143
|
+
if (result.exitCode !== 0) throw sandboxErrorDiagnostics.SANDBOX_R0120({ message: `[vitehub] Sandbox checkout Git command exited with code ${result.exitCode}.` });
|
|
144
144
|
return { stdout: result.stdout };
|
|
145
145
|
}
|
|
146
146
|
});
|
|
@@ -292,7 +292,7 @@ function environmentWrapper(assignments) {
|
|
|
292
292
|
*/
|
|
293
293
|
async function provisionCrabboxToolchain(toolchain, session, context) {
|
|
294
294
|
const { abortSignal, leaseId, options } = context;
|
|
295
|
-
const { provisionToolchain, readProjectFilesWithShell, verifyToolchain } = await import("./toolchain-
|
|
295
|
+
const { provisionToolchain, readProjectFilesWithShell, verifyToolchain } = await import("./toolchain-BIVGMRty.js").then((n) => n.i);
|
|
296
296
|
const run = async (script) => await runCrabbox(options, leaseId, {
|
|
297
297
|
abortSignal,
|
|
298
298
|
command: `sh -c ${shellQuote(script)}`
|
|
@@ -841,7 +841,11 @@ function processHandle(child, abortSignal) {
|
|
|
841
841
|
},
|
|
842
842
|
stdout: Readable.toWeb(child.stdout),
|
|
843
843
|
wait: () => wait,
|
|
844
|
-
async kill() {
|
|
844
|
+
async kill(signal) {
|
|
845
|
+
if (signal !== void 0 && signal.toUpperCase().replace(/^SIG/, "") !== "TERM") throw sandboxErrorDiagnostics.SANDBOX_R0165({
|
|
846
|
+
runtime: "Crabbox",
|
|
847
|
+
signal: String(signal)
|
|
848
|
+
});
|
|
845
849
|
child.kill();
|
|
846
850
|
await wait.catch(() => void 0);
|
|
847
851
|
}
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { defineDiagnostics } from "nostics";
|
|
2
|
+
//#region src/task/error-diagnostics.ts
|
|
3
|
+
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
4
|
+
const sandboxTaskErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
5
|
+
docsBase: "https://vitehub.dev/docs/sandbox/diagnostics",
|
|
6
|
+
codes: {
|
|
7
|
+
SANDBOX_TASK_R0001: {
|
|
8
|
+
...dynamicError,
|
|
9
|
+
fix: "Add a `package.json` between the Definition file and the project root, or remove `project: true` from `defineSandboxTask()`."
|
|
10
|
+
},
|
|
11
|
+
SANDBOX_TASK_R0002: {
|
|
12
|
+
...dynamicError,
|
|
13
|
+
fix: "Remove `project: false` from `defineSandboxTask()` so that the Sandbox installs the package, or import only modules that ViteHub can bundle."
|
|
14
|
+
},
|
|
15
|
+
SANDBOX_TASK_R0003: {
|
|
16
|
+
...dynamicError,
|
|
17
|
+
fix: "Install `@cloudflare/sandbox` 1.x in the app, for example `pnpm add @cloudflare/sandbox`."
|
|
18
|
+
},
|
|
19
|
+
SANDBOX_TASK_R0004: {
|
|
20
|
+
...dynamicError,
|
|
21
|
+
fix: "Install `@cloudflare/sandbox` again, for example `pnpm add @cloudflare/sandbox`. Its `package.json` must have a `version`."
|
|
22
|
+
},
|
|
23
|
+
SANDBOX_TASK_R0006: {
|
|
24
|
+
...dynamicError,
|
|
25
|
+
fix: "Remove `exports` from the Wrangler config, or declare the Sandbox Durable Object class, binding, and migration in it yourself."
|
|
26
|
+
},
|
|
27
|
+
SANDBOX_TASK_R0007: {
|
|
28
|
+
...dynamicError,
|
|
29
|
+
fix: "Set `migrationTag` in `vitehub({ sandboxTask: { migrationTag } })` or `hubSandboxTask()` to a tag that the Wrangler `migrations` do not use yet, for example `\"vitehub-sandbox-v1\"`."
|
|
30
|
+
},
|
|
31
|
+
SANDBOX_TASK_R0008: {
|
|
32
|
+
...dynamicError,
|
|
33
|
+
fix: "Set `binding` in `vitehub({ sandboxTask: { binding } })` or `hubSandboxTask()` to a name that no other Durable Object binding uses, or rename the other binding in the Wrangler config."
|
|
34
|
+
},
|
|
35
|
+
SANDBOX_TASK_C0001: {
|
|
36
|
+
...dynamicError,
|
|
37
|
+
fix: "Write each array item in the `defineSandboxTask()` options as a literal value, without spread items or empty slots."
|
|
38
|
+
},
|
|
39
|
+
SANDBOX_TASK_C0002: {
|
|
40
|
+
...dynamicError,
|
|
41
|
+
fix: "Write each object in the `defineSandboxTask()` options with `key: value` pairs only, without spread, shorthand properties, methods, or accessors."
|
|
42
|
+
},
|
|
43
|
+
SANDBOX_TASK_C0003: {
|
|
44
|
+
...dynamicError,
|
|
45
|
+
fix: "Write each key in the `defineSandboxTask()` options as a name or a string literal, such as `env: { API_URL: \"https://example.com\" }`. Do not use computed or numeric keys."
|
|
46
|
+
},
|
|
47
|
+
SANDBOX_TASK_C0004: {
|
|
48
|
+
...dynamicError,
|
|
49
|
+
fix: "Write each option value in `defineSandboxTask()` as a literal: a string, number, boolean, `null`, array, or object. Do not use variables, calls, or `process.env` reads."
|
|
50
|
+
},
|
|
51
|
+
SANDBOX_TASK_C0005: {
|
|
52
|
+
...dynamicError,
|
|
53
|
+
fix: "Pass one object literal to `defineSandboxTask()` in the default export, such as `export default defineSandboxTask({ handler })`."
|
|
54
|
+
},
|
|
55
|
+
SANDBOX_TASK_C0006: {
|
|
56
|
+
...dynamicError,
|
|
57
|
+
fix: "Write each option of `defineSandboxTask()` as `key: value` with a name or string key, without spread, computed keys, or accessors. Only `handler` can be a shorthand property or a method."
|
|
58
|
+
},
|
|
59
|
+
SANDBOX_TASK_C0007: {
|
|
60
|
+
...dynamicError,
|
|
61
|
+
fix: "Write `timeout`, `env`, and `project` in `defineSandboxTask()` as `key: value` with a literal value. Only `handler` can be a method."
|
|
62
|
+
},
|
|
63
|
+
SANDBOX_TASK_C0008: {
|
|
64
|
+
...dynamicError,
|
|
65
|
+
fix: "Set `project` in `defineSandboxTask()` to the literal `true` or `false`, or remove it to detect project use automatically."
|
|
66
|
+
},
|
|
67
|
+
SANDBOX_TASK_C0009: {
|
|
68
|
+
...dynamicError,
|
|
69
|
+
fix: "Add a `handler` function to `defineSandboxTask()`, such as `defineSandboxTask({ handler: async (payload) => { ... } })`."
|
|
70
|
+
},
|
|
71
|
+
SANDBOX_TASK_R0009: {
|
|
72
|
+
...dynamicError,
|
|
73
|
+
fix: "Keep one entrypoint in the Sandbox package that the message names: `index.ts`, `index.mts`, `index.js`, or `index.mjs`. Remove the others."
|
|
74
|
+
},
|
|
75
|
+
SANDBOX_TASK_R0010: {
|
|
76
|
+
...dynamicError,
|
|
77
|
+
fix: "Add one ESM entrypoint to the Sandbox package that the message names: `index.ts`, `index.mts`, `index.js`, or `index.mjs`."
|
|
78
|
+
},
|
|
79
|
+
SANDBOX_TASK_R0011: {
|
|
80
|
+
...dynamicError,
|
|
81
|
+
fix: "Make the options of the Sandbox Task Definition that the message names JSON-serializable. Remove functions, class instances, and cycles; `error.cause` shows the failure."
|
|
82
|
+
},
|
|
83
|
+
SANDBOX_TASK_R0012: {
|
|
84
|
+
...dynamicError,
|
|
85
|
+
fix: "Set `driver` to `\"cloudflare\"` or `\"vercel\"` in `vitehub({ sandboxTask: { driver } })` or `hubSandboxTask()`, because this host has no built-in Sandbox driver."
|
|
86
|
+
},
|
|
87
|
+
SANDBOX_TASK_R0013: {
|
|
88
|
+
...dynamicError,
|
|
89
|
+
fix: "Rename one of the two Sandbox Task Definitions that the message names, so that their names do not map to the same file."
|
|
90
|
+
},
|
|
91
|
+
SANDBOX_TASK_R0015: {
|
|
92
|
+
...dynamicError,
|
|
93
|
+
fix: "Check that the file that the message names exists in the Sandbox package, and that no ignore file removes it from the project."
|
|
94
|
+
},
|
|
95
|
+
SANDBOX_TASK_R0016: {
|
|
96
|
+
...dynamicError,
|
|
97
|
+
fix: "Make the `package.json` that the message names valid JSON. `error.cause` shows the parse error."
|
|
98
|
+
},
|
|
99
|
+
SANDBOX_TASK_R0017: {
|
|
100
|
+
...dynamicError,
|
|
101
|
+
fix: "Set `\"type\": \"module\"` in the `package.json` that the message names."
|
|
102
|
+
},
|
|
103
|
+
SANDBOX_TASK_R0018: {
|
|
104
|
+
...dynamicError,
|
|
105
|
+
fix: "Build the workspace dependency that the message names to JavaScript, and point its `exports`, `imports`, or `main` at the built files, not at `.ts` source."
|
|
106
|
+
},
|
|
107
|
+
SANDBOX_TASK_R0019: {
|
|
108
|
+
...dynamicError,
|
|
109
|
+
fix: "Build the workspace dependency that the message names to JavaScript, and point its `exports`, `imports`, or `main` at the built files, not at `.ts` source."
|
|
110
|
+
},
|
|
111
|
+
SANDBOX_TASK_R0020: {
|
|
112
|
+
...dynamicError,
|
|
113
|
+
fix: "Build the workspace dependency that the message names to JavaScript, and point its `exports`, `imports`, or `main` at the built files, not at `.ts` source."
|
|
114
|
+
},
|
|
115
|
+
SANDBOX_TASK_R0021: {
|
|
116
|
+
...dynamicError,
|
|
117
|
+
fix: "Correct the TypeScript syntax errors that the message lists in the module that it names."
|
|
118
|
+
},
|
|
119
|
+
SANDBOX_TASK_R0022: {
|
|
120
|
+
...dynamicError,
|
|
121
|
+
fix: "Replace `require()`, `module.exports`, and `exports` in the module that the message names with `import` and `export`."
|
|
122
|
+
},
|
|
123
|
+
SANDBOX_TASK_R0023: {
|
|
124
|
+
...dynamicError,
|
|
125
|
+
fix: "Use a string literal in `import()` in the module that the message names, for example `import(\"./worker.ts\")`."
|
|
126
|
+
},
|
|
127
|
+
SANDBOX_TASK_R0024: {
|
|
128
|
+
...dynamicError,
|
|
129
|
+
fix: "Replace the `#` import alias with a relative import, such as `./lib/util.ts`."
|
|
130
|
+
},
|
|
131
|
+
SANDBOX_TASK_R0025: {
|
|
132
|
+
...dynamicError,
|
|
133
|
+
fix: "Replace the import of the package's own name with a relative import, such as `./lib/util.ts`."
|
|
134
|
+
},
|
|
135
|
+
SANDBOX_TASK_R0026: {
|
|
136
|
+
...dynamicError,
|
|
137
|
+
fix: "Replace the absolute path or URL import with a relative import inside the package, or with a package dependency that ships JavaScript."
|
|
138
|
+
},
|
|
139
|
+
SANDBOX_TASK_R0027: {
|
|
140
|
+
...dynamicError,
|
|
141
|
+
fix: "Move the imported file into the Sandbox package, or add it as a package dependency that ships JavaScript."
|
|
142
|
+
},
|
|
143
|
+
SANDBOX_TASK_R0028: {
|
|
144
|
+
...dynamicError,
|
|
145
|
+
fix: "Write the import with the extension of a file that exists in the package, for example `./util.ts` instead of `./util`."
|
|
146
|
+
},
|
|
147
|
+
SANDBOX_TASK_R0029: {
|
|
148
|
+
...dynamicError,
|
|
149
|
+
fix: "Convert the imported `.cjs` or `.cts` module to ESM with a `.js`, `.mjs`, `.ts`, or `.mts` extension."
|
|
150
|
+
},
|
|
151
|
+
SANDBOX_TASK_R0030: {
|
|
152
|
+
...dynamicError,
|
|
153
|
+
fix: "Move the JSX code out of the Sandbox package, or compile it to JavaScript first."
|
|
154
|
+
},
|
|
155
|
+
SANDBOX_TASK_R0031: {
|
|
156
|
+
...dynamicError,
|
|
157
|
+
fix: "Use `import type` for the declaration file that the message names."
|
|
158
|
+
},
|
|
159
|
+
SANDBOX_TASK_R0032: {
|
|
160
|
+
...dynamicError,
|
|
161
|
+
fix: "Rename the `.mjs` file that the message names. ViteHub writes the compiled JavaScript of the `.ts` module next to it with that name."
|
|
162
|
+
},
|
|
163
|
+
SANDBOX_TASK_R0033: {
|
|
164
|
+
...dynamicError,
|
|
165
|
+
fix: "Another build or dev server holds the Sandbox runtime lock in the directory that the message names. Wait for it to end or stop it, then build again."
|
|
166
|
+
},
|
|
167
|
+
SANDBOX_TASK_R0034: {
|
|
168
|
+
...dynamicError,
|
|
169
|
+
fix: "Another build or dev server changed the Sandbox runtime lock in the directory that the message names. Run one build or dev server at a time for that directory, then build again."
|
|
170
|
+
},
|
|
171
|
+
SANDBOX_TASK_R0035: {
|
|
172
|
+
...dynamicError,
|
|
173
|
+
fix: "Another build or dev server changed the Sandbox runtime lock in the directory that the message names. Run one build or dev server at a time for that directory, then build again."
|
|
174
|
+
},
|
|
175
|
+
SANDBOX_TASK_R0036: {
|
|
176
|
+
...dynamicError,
|
|
177
|
+
fix: "Another build or dev server changed the Sandbox runtime lock in the directory that the message names. Run one build or dev server at a time for that directory, then build again."
|
|
178
|
+
},
|
|
179
|
+
SANDBOX_TASK_R0037: {
|
|
180
|
+
...dynamicError,
|
|
181
|
+
fix: "Another build or dev server changed the Sandbox runtime lock in the directory that the message names. Run one build or dev server at a time for that directory, then build again."
|
|
182
|
+
},
|
|
183
|
+
SANDBOX_TASK_R0038: {
|
|
184
|
+
...dynamicError,
|
|
185
|
+
fix: "Another build or dev server changed the Sandbox runtime lock in the directory that the message names. Run one build or dev server at a time for that directory, then build again."
|
|
186
|
+
},
|
|
187
|
+
SANDBOX_TASK_R0039: {
|
|
188
|
+
...dynamicError,
|
|
189
|
+
fix: "Another build or dev server changed the Sandbox runtime lock in the directory that the message names. Run one build or dev server at a time for that directory, then build again."
|
|
190
|
+
},
|
|
191
|
+
SANDBOX_TASK_R0041: {
|
|
192
|
+
...dynamicError,
|
|
193
|
+
fix: "Another build or dev server changed the Sandbox runtime during activation. Run one build or dev server at a time for the project, then build again."
|
|
194
|
+
},
|
|
195
|
+
SANDBOX_TASK_R0042: {
|
|
196
|
+
...dynamicError,
|
|
197
|
+
fix: "Set `sandboxTask` in `vitehub()`, or the options of `hubSandboxTask()`, to an object such as `{ driver: \"vercel\" }`, or to `false`."
|
|
198
|
+
},
|
|
199
|
+
SANDBOX_TASK_R0045: {
|
|
200
|
+
...dynamicError,
|
|
201
|
+
fix: "Remove the duplicate Cloudflare entry that the message names from the Wrangler config, or give both entries the same values."
|
|
202
|
+
},
|
|
203
|
+
SANDBOX_TASK_R0046: {
|
|
204
|
+
...dynamicError,
|
|
205
|
+
fix: "Add a Wrangler migration with `new_sqlite_classes` for each Durable Object class that the message names."
|
|
206
|
+
},
|
|
207
|
+
SANDBOX_TASK_C0010: {
|
|
208
|
+
...dynamicError,
|
|
209
|
+
fix: "Set `handler` in `defineSandboxTask()` to a function, such as `handler: async (payload) => { ... }`."
|
|
210
|
+
},
|
|
211
|
+
SANDBOX_TASK_C0011: {
|
|
212
|
+
...dynamicError,
|
|
213
|
+
fix: "Pass one options object to `defineSandboxTask()`, such as `defineSandboxTask({ handler })`."
|
|
214
|
+
},
|
|
215
|
+
SANDBOX_TASK_C0012: {
|
|
216
|
+
...dynamicError,
|
|
217
|
+
fix: "Use only the `handler`, `timeout`, `env`, and `project` options in `defineSandboxTask()`. Remove the other keys that the message lists."
|
|
218
|
+
},
|
|
219
|
+
SANDBOX_TASK_C0013: {
|
|
220
|
+
...dynamicError,
|
|
221
|
+
fix: "Install TypeScript in the app, for example with `pnpm add -D typescript`."
|
|
222
|
+
},
|
|
223
|
+
SANDBOX_TASK_C0014: {
|
|
224
|
+
...dynamicError,
|
|
225
|
+
fix: "Rename `run` to `handler`: `defineSandboxTask({ handler })`. Run `npx @vite-hub/codemods define-forms` to rename it in every Sandbox Task."
|
|
226
|
+
},
|
|
227
|
+
SANDBOX_TASK_R0052: {
|
|
228
|
+
...dynamicError,
|
|
229
|
+
fix: "Pass the Sandbox Task name to `resolveSandboxTaskRunner()`, for example `resolveSandboxTaskRunner(\"release-notes\")`."
|
|
230
|
+
},
|
|
231
|
+
SANDBOX_TASK_R0053: {
|
|
232
|
+
...dynamicError,
|
|
233
|
+
fix: "Use the name of a Definition in `server/sandbox-tasks/` or of a `*.sandbox-task.ts` file. If the message says that Sandbox Tasks are not enabled, set `sandboxTask: true` in the ViteHub config."
|
|
234
|
+
},
|
|
235
|
+
SANDBOX_TASK_R0054: {
|
|
236
|
+
...dynamicError,
|
|
237
|
+
fix: "Build the app again, so that ViteHub writes a valid bundle for the Sandbox Task that the message names."
|
|
238
|
+
},
|
|
239
|
+
SANDBOX_TASK_R0055: {
|
|
240
|
+
...dynamicError,
|
|
241
|
+
fix: "Replace the symbolic link that the message names with a real file, or move its target inside the project."
|
|
242
|
+
},
|
|
243
|
+
SANDBOX_TASK_R0056: {
|
|
244
|
+
...dynamicError,
|
|
245
|
+
fix: "Make the `package.json` that the message names valid JSON. `error.cause` shows the parse error."
|
|
246
|
+
},
|
|
247
|
+
SANDBOX_TASK_R0057: {
|
|
248
|
+
...dynamicError,
|
|
249
|
+
fix: "Set `vitehub` in the `package.json` that the message names to an object, for example `\"vitehub\": { \"sandboxTask\": { \"timeout\": 30000 } }`."
|
|
250
|
+
},
|
|
251
|
+
SANDBOX_TASK_R0058: {
|
|
252
|
+
...dynamicError,
|
|
253
|
+
fix: "Set `vitehub.sandboxTask` in the `package.json` that the message names to an object, for example `{ \"timeout\": 30000 }`."
|
|
254
|
+
},
|
|
255
|
+
SANDBOX_TASK_R0059: {
|
|
256
|
+
...dynamicError,
|
|
257
|
+
fix: "Remove the keys that the message names from `vitehub.sandboxTask` in `package.json`. It supports only `timeout`."
|
|
258
|
+
},
|
|
259
|
+
SANDBOX_TASK_R0060: {
|
|
260
|
+
...dynamicError,
|
|
261
|
+
fix: "Set `vitehub.sandboxTask.timeout` in `package.json` to a whole number of milliseconds from 1 to 2147483647."
|
|
262
|
+
},
|
|
263
|
+
SANDBOX_TASK_R0061: {
|
|
264
|
+
...dynamicError,
|
|
265
|
+
fix: "Add the package that the message names to the pnpm Workspace, or remove the `workspace:` dependency on it."
|
|
266
|
+
},
|
|
267
|
+
SANDBOX_TASK_R0062: {
|
|
268
|
+
...dynamicError,
|
|
269
|
+
fix: "Move the Sandbox Task Definition file inside the project, or replace the symbolic link to it with the real file."
|
|
270
|
+
},
|
|
271
|
+
SANDBOX_TASK_R0063: {
|
|
272
|
+
...dynamicError,
|
|
273
|
+
fix: "Add a `package.json` to the directory of the Definition file, or to a parent directory inside the project root that the message names."
|
|
274
|
+
},
|
|
275
|
+
SANDBOX_TASK_R0064: {
|
|
276
|
+
...dynamicError,
|
|
277
|
+
fix: "Move the pnpm patch file that the message names inside the install root, and update `patchedDependencies` in `package.json`."
|
|
278
|
+
},
|
|
279
|
+
SANDBOX_TASK_R0065: {
|
|
280
|
+
...dynamicError,
|
|
281
|
+
fix: "Move the pnpm patch file that the message names inside the install root, and update `patchedDependencies` in `pnpm-workspace.yaml`."
|
|
282
|
+
},
|
|
283
|
+
SANDBOX_TASK_R0066: {
|
|
284
|
+
...dynamicError,
|
|
285
|
+
fix: "Write the file before you read it, or check it with `exists()` first."
|
|
286
|
+
},
|
|
287
|
+
SANDBOX_TASK_R0067: {
|
|
288
|
+
...dynamicError,
|
|
289
|
+
fix: "Keep each file of the Sandbox project inside the project directory. Remove the absolute path or the `..` segments from the path that the message names."
|
|
290
|
+
},
|
|
291
|
+
SANDBOX_TASK_R0068: {
|
|
292
|
+
...dynamicError,
|
|
293
|
+
fix: "Set the Sandbox driver to `\"cloudflare\"` or `\"vercel\"`, in `vitehub({ sandboxTask: { driver } })`, `hubSandboxTask({ driver })`, or the `SANDBOX_PROVIDER` env variable."
|
|
294
|
+
},
|
|
295
|
+
SANDBOX_TASK_R0069: {
|
|
296
|
+
...dynamicError,
|
|
297
|
+
fix: "Remove the options that the message names from `defineSandboxTask()`. A Definition supports only `handler`, `timeout`, `env`, and `project`."
|
|
298
|
+
},
|
|
299
|
+
SANDBOX_TASK_R0070: {
|
|
300
|
+
...dynamicError,
|
|
301
|
+
fix: "Set `timeout` of `defineSandboxTask()` to a whole number of milliseconds from 1 to 2147483647."
|
|
302
|
+
},
|
|
303
|
+
SANDBOX_TASK_R0071: {
|
|
304
|
+
...dynamicError,
|
|
305
|
+
fix: "Add the Sandbox Durable Object binding to the Worker, or set `binding` in `vitehub({ sandboxTask: { binding } })` or `hubSandboxTask()` to its name. To run locally, build, then run `npx wrangler dev --config .output/server/wrangler.json`."
|
|
306
|
+
},
|
|
307
|
+
SANDBOX_TASK_R0072: {
|
|
308
|
+
...dynamicError,
|
|
309
|
+
fix: "Pass an options object to the function that the message names, for example `defineSandboxTask({ handler })`."
|
|
310
|
+
},
|
|
311
|
+
SANDBOX_TASK_R0073: {
|
|
312
|
+
...dynamicError,
|
|
313
|
+
fix: "Set `project` of `defineSandboxTask()` to `true` or `false`, or remove it."
|
|
314
|
+
},
|
|
315
|
+
SANDBOX_TASK_R0074: {
|
|
316
|
+
...dynamicError,
|
|
317
|
+
fix: "Restart the dev server or build again, so that ViteHub generates the Sandbox Task Definition again. Check that its file still exists."
|
|
318
|
+
},
|
|
319
|
+
SANDBOX_TASK_R0075: {
|
|
320
|
+
...dynamicError,
|
|
321
|
+
fix: "Restart the dev server or build again, so that ViteHub generates the Sandbox Task Definition again. Check that its file still exists."
|
|
322
|
+
},
|
|
323
|
+
SANDBOX_TASK_R0076: {
|
|
324
|
+
...dynamicError,
|
|
325
|
+
fix: "Use the Sandbox driver that the build selected, or build again with `driver` in `vitehub({ sandboxTask: { driver } })` or `hubSandboxTask()` set to the driver that you need."
|
|
326
|
+
},
|
|
327
|
+
SANDBOX_TASK_CLOUDFLARE_INSTANCE_TYPE_TOO_SMALL: {
|
|
328
|
+
why: ({ className, instanceType, size }) => `[vitehub] The Cloudflare containers entry of class ${className} sets the instance type ${instanceType}, which is smaller than the Sandbox Task size (${size}).`,
|
|
329
|
+
fix: "Remove `instance_type` from your `containers` entry so that ViteHub writes the size from `cpu` and `memory`, or set a larger `instance_type`, or lower `cpu` and `memory`. ViteHub never changes an instance type that you wrote."
|
|
330
|
+
},
|
|
331
|
+
SANDBOX_TASK_CLOUDFLARE_MAX_INSTANCES_CONFLICT: {
|
|
332
|
+
why: ({ className, configured, requested }) => `[vitehub] The Cloudflare containers entry of class ${className} sets max_instances ${configured}, but the Sandbox Task option maxInstances is ${requested}.`,
|
|
333
|
+
fix: "Set the instance limit in one place: remove `maxInstances` from the Sandbox Task options, or remove `max_instances` from your `containers` entry."
|
|
334
|
+
},
|
|
335
|
+
SANDBOX_TASK_RENAMED_PROVIDER_KEY: {
|
|
336
|
+
why: ({ value }) => `\`sandboxTask.provider\` is ${value}. ViteHub renamed this key to \`driver\`, and it does not read \`provider\`, so the Sandbox Task would not use the driver you chose.`,
|
|
337
|
+
fix: ({ value }) => `Set \`sandboxTask: { driver: ${value} }\`, or run \`npx @vite-hub/codemods driver-key\` to rename it in every config file.`
|
|
338
|
+
},
|
|
339
|
+
SANDBOX_TASK_SIZE_INVALID: {
|
|
340
|
+
why: ({ key, value }) => `[vitehub] Sandbox Task option ${key} must be a positive number${key === "maxInstances" ? " and a whole number" : ""}. Received ${value}.`,
|
|
341
|
+
fix: "Set `cpu` to a number of vCPUs, such as `2` or `0.5`, `memory` to a number of MiB, such as `4096`, and `maxInstances` to a whole number, such as `20`."
|
|
342
|
+
},
|
|
343
|
+
SANDBOX_TASK_SIZE_TOO_LARGE: {
|
|
344
|
+
why: ({ max, provider, size }) => `[vitehub] ${provider} has no Sandbox size for ${size}. The largest size is ${max}.`,
|
|
345
|
+
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."
|
|
346
|
+
},
|
|
347
|
+
SANDBOX_TASK_VERCEL_TIMEOUT_LIMIT: {
|
|
348
|
+
why: ({ limit, timeout }) => `Vercel rejected the Sandbox session timeout of ${timeout}ms: ${limit}.`,
|
|
349
|
+
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."
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
//#endregion
|
|
354
|
+
export { sandboxTaskErrorDiagnostics as t };
|