@vite-hub/workspace 0.0.4 → 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 +339 -115
- package/dist/abort-BCwpdrN0.js +32 -0
- package/dist/{asset-registry-8QI3ML3K.js → asset-registry-DfBV5kmw.js} +3 -2
- package/dist/blob-database.d.ts +474 -0
- package/dist/blob-database.js +608 -0
- package/dist/checkout.d.ts +128 -0
- package/dist/checkout.js +849 -0
- package/dist/cloudflare.d.ts +6 -7
- package/dist/cloudflare.js +1 -1
- package/dist/config-B-863EgC.js +15 -0
- package/dist/config-BAgL2dtB.js +1076 -0
- package/dist/{config-DE9xlaIw.d.ts → config-BQKcPawI.d.ts} +1 -2
- package/dist/discard-CNNtCozM.js +8 -0
- package/dist/durability.d.ts +22 -0
- package/dist/durability.js +70 -0
- package/dist/error-diagnostics-CtKjGtGb.js +188 -0
- package/dist/error-diagnostics-DSkCJC_L.js +266 -0
- package/dist/file-2pFYNtsU.js +22 -0
- package/dist/{files-Q6xZjDHA.js → files-BOo4SbwE.js} +3 -3
- package/dist/files.d.ts +38 -0
- package/dist/files.js +6 -0
- package/dist/{github-DHnjxQIX.js → github-CrYp4v8k.js} +44 -24
- package/dist/glob-B8YGvTrZ.js +21 -0
- package/dist/glob-Cjxms1t7.js +30 -0
- package/dist/{host-DJH8cuoU.js → host-BFBpXn0N.js} +144 -77
- package/dist/{hosted-RPeJOCFz.js → hosted-KcUR_jPv.js} +303 -97
- package/dist/hosted-vercel-blob-B3-wRdUm.js +410 -0
- package/dist/hosted-vercel-blob.d.ts +6 -7
- package/dist/hosted-vercel-blob.js +1 -1
- package/dist/hosted.d.ts +10 -9
- package/dist/hosted.js +2 -2
- package/dist/index.d.ts +26 -47
- package/dist/index.js +30 -100
- package/dist/internal/path.d.ts +2 -0
- package/dist/internal/path.js +2 -0
- package/dist/lifecycle-B-enk_4A.js +596 -0
- package/dist/lineage.d.ts +26 -0
- package/dist/lineage.js +76 -0
- package/dist/loader.d.ts +5 -6
- package/dist/loader.js +3 -2
- package/dist/mcp-resources-DF0F5rcL.js +39 -0
- package/dist/memory-BOexthyW.js +247 -0
- package/dist/metadata-target-CWz6KHKq.js +1589 -0
- package/dist/object-Da1zyPCR.js +11 -0
- package/dist/operation-definition-8gOe-ubD.d.ts +234 -0
- package/dist/operations-C6FpR8Rr.js +389 -0
- package/dist/operations-CE2drFih.js +1234 -0
- package/dist/operations.d.ts +90 -0
- package/dist/operations.js +3 -0
- package/dist/path--wrT_Azm.js +113 -0
- package/dist/path-AxMho1wo.d.ts +7 -0
- package/dist/path-DrSIenjj.js +59 -0
- package/dist/path-zHxQUbqa.d.ts +9 -0
- package/dist/plugins-C8C0auoW.d.ts +10 -0
- package/dist/provider-9s4Ufkm5.js +1479 -0
- package/dist/providers/github/store.d.ts +3 -5
- package/dist/providers/github/store.js +1 -1
- package/dist/registry-B3BBm4Ts.d.ts +19 -0
- package/dist/{registry-D3yzt8HQ.js → registry-CNphafBx.js} +60 -23
- package/dist/registry-CYNN623b.d.ts +9 -0
- package/dist/request-scope-Dw5n8bMC.js +83 -0
- package/dist/results-DgkZUmTL.js +8 -0
- package/dist/{chunk-2rV9d50f.js → rolldown-runtime-rQ84J-ij.js} +3 -4
- package/dist/runtime/assets.d.ts +3 -5
- package/dist/runtime/assets.js +7 -6
- package/dist/runtime/empty-assets-registry.d.ts +1 -2
- package/dist/runtime/empty-registry.d.ts +2 -2
- package/dist/runtime/registry.d.ts +2 -0
- package/dist/runtime/registry.js +23 -0
- package/dist/runtime/request.d.ts +4 -0
- package/dist/runtime/request.js +8 -0
- package/dist/runtime/state.d.ts +5 -4
- package/dist/runtime/state.js +8 -18
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +52 -17
- package/dist/runtime.js +324 -67
- package/dist/{search-BpiCF2Tw.js → search-C_RfoM2j.js} +10 -9
- package/dist/server-8tGltlGz.js +303 -0
- package/dist/server.d.ts +36 -39
- package/dist/server.js +2 -328
- package/dist/shared-B3_EUk89.js +848 -0
- package/dist/source-metadata.d.ts +10 -7
- package/dist/source-metadata.js +12 -12
- package/dist/state-BISnUf1s.d.ts +35 -0
- package/dist/{ai-BqCC8BpY.js → state-DbrW-njQ.js} +237 -114
- package/dist/store-ybhyD38Z.js +1873 -0
- package/dist/{sync-DnTQwt8r.js → sync-CCD_VYC8.js} +61 -41
- package/dist/target-jWhTdIuF.js +89 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/{types-CYuwjJ4V.d.ts → types-BbtwmBZ5.d.ts} +321 -35
- package/dist/use-C6lV3-wC.d.ts +321 -0
- package/dist/{use-BTNDR5Rd.js → use-CSpT5W87.js} +141 -107
- package/dist/utils-CgMZCHsX.js +616 -0
- package/dist/vite.d.ts +585 -2
- package/dist/vite.js +21369 -2
- package/dist/workspace-CYB2xZ1T.d.ts +7 -0
- package/dist/{workspace-Dq08Yn72.js → workspace-sPWn2Jxj.js} +441 -225
- package/package.json +97 -72
- package/dist/ai-CjxvGqM0.d.ts +0 -162
- package/dist/ai.d.ts +0 -3
- package/dist/ai.js +0 -2
- package/dist/collections/client.d.ts +0 -39
- package/dist/collections/client.js +0 -137
- package/dist/collections.d.ts +0 -59
- package/dist/collections.js +0 -159
- package/dist/config-Bc3c4Su1.js +0 -7904
- package/dist/config-CHLLWklZ.js +0 -36
- package/dist/file-Bc1X7pco.js +0 -23
- package/dist/glob-CEZKeZFC.js +0 -18
- package/dist/hosted-vercel-blob-d6C8ND5j.js +0 -23580
- package/dist/lifecycle-LrL3sA4n.js +0 -316
- package/dist/metadata-target-B0tOmVW7.js +0 -717
- package/dist/mountx.d.ts +0 -10
- package/dist/mountx.js +0 -143
- package/dist/nitro.d.ts +0 -2
- package/dist/nitro.js +0 -2
- package/dist/nuxt.d.ts +0 -26
- package/dist/nuxt.js +0 -42
- package/dist/path-Cp59koVz.js +0 -139
- package/dist/provider-B1yLjCJJ.js +0 -746
- package/dist/publish.d.ts +0 -35
- package/dist/publish.js +0 -112
- package/dist/registry-Uj6IVxes.d.ts +0 -11
- package/dist/request-execution-B-dSFlGB.js +0 -84
- package/dist/runtime-options-BsPSv5O7.js +0 -13
- package/dist/runtime-type-iEE6BjQJ.js +0 -34
- package/dist/shared-DTR1Hhma.js +0 -331
- package/dist/state-tYcRWEh2.d.ts +0 -26
- package/dist/store-Dt_Jyys3.js +0 -608
- package/dist/target-D4Bqb1eH.js +0 -11
- package/dist/token-CVzURBxC.js +0 -61
- package/dist/use-BiHzt0xA.d.ts +0 -103
- package/dist/vite-BptCrpv2.js +0 -4526
- package/dist/vite-CtA9guIM.d.ts +0 -66
- package/dist/workspace-Xddf4G1B.d.ts +0 -6
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { I as WorkspaceDefinition, Kt as WorkspaceSource, Yt as WorkspaceSourceInput, _n as WorkspaceSourceSyncPolicy, ft as WorkspaceMaterializeMode, j as WorkspaceCacheOptions, kn as WorkspaceValidateMode, nn as WorkspaceSourceRequestDescriptor } from "./types-BbtwmBZ5.js";
|
|
3
2
|
//#region src/sources/request-metadata.d.ts
|
|
4
3
|
declare function getWorkspaceSourceRequestDescriptor(source: WorkspaceSource): WorkspaceSourceRequestDescriptor | undefined;
|
|
5
4
|
declare function isWorkspaceSourceRequestOnly(source: WorkspaceSource): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/storage/discard.ts
|
|
2
|
+
/**
|
|
3
|
+
* Drops the writes that a Store keeps staged until `snapshot()`, so it loads the branch again on its next call. Only
|
|
4
|
+
* the GitHub and Cloudflare Artifacts Stores stage writes. Other Stores write through and do not have it.
|
|
5
|
+
*/
|
|
6
|
+
const workspaceStoreDiscard = Symbol.for("vitehub.workspace.storeDiscard");
|
|
7
|
+
//#endregion
|
|
8
|
+
export { workspaceStoreDiscard as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { L as WorkspaceDefinitionInput, v as ResolvedWorkspaceModuleOptions } from "./types-BbtwmBZ5.js";
|
|
2
|
+
import { Durability, DurabilityContext } from "@vite-hub/runtime/durability";
|
|
3
|
+
//#region src/durability.d.ts
|
|
4
|
+
/** What the build passes to `workspaceDurability()`. */
|
|
5
|
+
export interface WorkspaceDurabilityInput {
|
|
6
|
+
/** The app passes its own `WorkspaceStore` object. */
|
|
7
|
+
custom?: true;
|
|
8
|
+
/** The build chose the store, so `BLOB_STORE_ID` or `BLOB_READ_WRITE_TOKEN` can switch it to Vercel Blob at boot. */
|
|
9
|
+
inferred?: boolean;
|
|
10
|
+
driver?: string;
|
|
11
|
+
/** The folder of the local store, relative to the project. */
|
|
12
|
+
root?: string;
|
|
13
|
+
}
|
|
14
|
+
/** The durability of Workspace files, from the store driver. */
|
|
15
|
+
export declare function workspaceDurability(input: WorkspaceDurabilityInput, { env }: DurabilityContext): Durability[];
|
|
16
|
+
/** Read the Definitions of the eager generated registry, whose loaders return the module without a Promise. */
|
|
17
|
+
export declare function workspaceRegistryDefinitions(registry: Record<string, () => {
|
|
18
|
+
default?: WorkspaceDefinitionInput;
|
|
19
|
+
}>): Record<string, WorkspaceDefinitionInput | undefined>;
|
|
20
|
+
/** Read evaluated Definitions, including Agent Workspace options, with the runtime's store precedence. */
|
|
21
|
+
export declare function workspaceDefinitionsDurability(definitions: Record<string, WorkspaceDefinitionInput | undefined>, config: false | ResolvedWorkspaceModuleOptions, context: DurabilityContext): Durability[];
|
|
22
|
+
//#endregion
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { c as resolveWorkspaceDefinitionStore, n as isWorkspaceStore } from "./provider-9s4Ufkm5.js";
|
|
2
|
+
import { s as workspaceRegistryLoadError, t as normalizeWorkspaceDefinition } from "./registry-CNphafBx.js";
|
|
3
|
+
//#region src/durability.ts
|
|
4
|
+
const sharedDrivers = {
|
|
5
|
+
"cloudflare": "Cloudflare Artifacts.",
|
|
6
|
+
"github": "A GitHub repository.",
|
|
7
|
+
"vercel": "Vercel Blob."
|
|
8
|
+
};
|
|
9
|
+
const fix = "Use a shared Workspace store, such as `workspace: { store: { driver: \"github\" } }` or Vercel Blob.";
|
|
10
|
+
/** The durability of Workspace files, from the store driver. */
|
|
11
|
+
function workspaceDurability(input, { env }) {
|
|
12
|
+
if (input.custom) return [{
|
|
13
|
+
primitive: "workspace",
|
|
14
|
+
store: "custom",
|
|
15
|
+
scope: "shared",
|
|
16
|
+
reason: "A custom Workspace store. ViteHub cannot see where it keeps files, so check that every instance reads the same store."
|
|
17
|
+
}];
|
|
18
|
+
const driver = input.inferred && input.driver === "local" && (env.BLOB_STORE_ID?.trim() || env.BLOB_READ_WRITE_TOKEN?.trim()) ? "vercel" : input.driver ?? "local";
|
|
19
|
+
const shared = sharedDrivers[driver];
|
|
20
|
+
if (shared) return [{
|
|
21
|
+
primitive: "workspace",
|
|
22
|
+
store: driver,
|
|
23
|
+
scope: "shared",
|
|
24
|
+
reason: shared
|
|
25
|
+
}];
|
|
26
|
+
if (driver === "memory") return [{
|
|
27
|
+
primitive: "workspace",
|
|
28
|
+
store: "memory",
|
|
29
|
+
scope: "process",
|
|
30
|
+
reason: "Workspace files live in the memory of this process.",
|
|
31
|
+
fix
|
|
32
|
+
}];
|
|
33
|
+
return [{
|
|
34
|
+
primitive: "workspace",
|
|
35
|
+
store: "local",
|
|
36
|
+
scope: "host",
|
|
37
|
+
reason: `Files in ${input.root ?? ".vitehub/workspaces"} on this host.`,
|
|
38
|
+
fix
|
|
39
|
+
}];
|
|
40
|
+
}
|
|
41
|
+
/** Read the Definitions of the eager generated registry, whose loaders return the module without a Promise. */
|
|
42
|
+
function workspaceRegistryDefinitions(registry) {
|
|
43
|
+
return Object.fromEntries(Object.entries(registry).map(([name, load]) => {
|
|
44
|
+
try {
|
|
45
|
+
return [name, load().default];
|
|
46
|
+
} catch (error) {
|
|
47
|
+
throw workspaceRegistryLoadError(name, error);
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
/** Read evaluated Definitions, including Agent Workspace options, with the runtime's store precedence. */
|
|
52
|
+
function workspaceDefinitionsDurability(definitions, config, context) {
|
|
53
|
+
const entries = Object.entries(definitions);
|
|
54
|
+
return (entries.length ? entries : [["default", {}]]).flatMap(([name, input]) => {
|
|
55
|
+
const definition = normalizeWorkspaceDefinition(name, input);
|
|
56
|
+
const store = resolveWorkspaceDefinitionStore(definition, config, {
|
|
57
|
+
env: context.env,
|
|
58
|
+
hosting: context.env.VITEHUB_HOST
|
|
59
|
+
});
|
|
60
|
+
return workspaceDurability(isWorkspaceStore(store) ? { custom: true } : {
|
|
61
|
+
driver: store?.driver,
|
|
62
|
+
root: store && "root" in store && typeof store.root === "string" ? store.root : config ? `${config.root}/${name}` : void 0
|
|
63
|
+
}, context).map((entry) => ({
|
|
64
|
+
...entry,
|
|
65
|
+
...entries.length ? { name } : {}
|
|
66
|
+
}));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { workspaceDefinitionsDurability, workspaceDurability, workspaceRegistryDefinitions };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { defineDiagnostics } from "nostics";
|
|
2
|
+
//#region src/error-diagnostics.ts
|
|
3
|
+
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
4
|
+
/** A code whose call site passes the message as `why`, with the fix that the reader applies. */
|
|
5
|
+
const withFix = (fix) => ({
|
|
6
|
+
...dynamicError,
|
|
7
|
+
fix
|
|
8
|
+
});
|
|
9
|
+
const workspaceErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
10
|
+
docsBase: "https://vitehub.dev/docs/workspace/diagnostics",
|
|
11
|
+
codes: {
|
|
12
|
+
WORKSPACE_FORBIDDEN: {
|
|
13
|
+
why: "An Agent may not write past an edit lease that a person holds.",
|
|
14
|
+
fix: "Tell the person you work for who is editing the files, and try again after they finish. A developer allows overrides with operations({ overrideLeases: true })."
|
|
15
|
+
},
|
|
16
|
+
WORKSPACE_HISTORY_FAILED: {
|
|
17
|
+
why: ({ workspace }) => `The history operation of Workspace "${workspace}" failed.`,
|
|
18
|
+
fix: "Read `error.cause` for the Store error. Check that the Store of the Workspace is reachable, then retry."
|
|
19
|
+
},
|
|
20
|
+
WORKSPACE_HISTORY_INVALID: {
|
|
21
|
+
why: ({ problem }) => problem === "empty-commit" ? "The commit has no changes. Pass `put` or `delete`." : "The cursor belongs to one ref. Pass the same ref.",
|
|
22
|
+
fix: "Pass `put` or `delete` to `workspace.commit`, and pass a `cursor` only with the `ref` of the `workspace.history` call that returned it."
|
|
23
|
+
},
|
|
24
|
+
WORKSPACE_NOT_FOUND: {
|
|
25
|
+
why: ({ id, path, problem, workspace }) => ({
|
|
26
|
+
path: `Revision ${id} has no path "${path}".`,
|
|
27
|
+
revision: `The Workspace has no revision "${id}". Pull again without a base revision.`,
|
|
28
|
+
target: `Workspace "${workspace}" has no ref or revision "${id}". Run \`vitehub workspace refs ${workspace}\` to list refs.`,
|
|
29
|
+
workspace: `Unknown Workspace: ${workspace}.`
|
|
30
|
+
})[problem],
|
|
31
|
+
fix: "Check the Workspace name, the ref or revision, and the path. `vitehub workspace refs <workspace>` lists the refs, and `vitehub workspace show <workspace> <ref>` lists the files. When a base revision is gone, pull again without it."
|
|
32
|
+
},
|
|
33
|
+
WORKSPACE_CHECKOUT_CONFLICT: {
|
|
34
|
+
why: ({ conflicted, workspace }) => `Workspace "${workspace}" has unresolved conflicts: ${conflicted}.`,
|
|
35
|
+
fix: "Edit each file and remove the conflict markers, or run `vitehub resolve` for a binary file. Then push again."
|
|
36
|
+
},
|
|
37
|
+
WORKSPACE_CHECKOUT_DIR: {
|
|
38
|
+
why: ({ dir, workspace }) => dir === void 0 ? `Workspace "${workspace}" is not checked out yet.` : `The checkout folder "${dir}" must be a folder inside the project, not the project root.`,
|
|
39
|
+
fix: "Pass `--dir` with a folder inside the project, such as `vitehub pull <workspace> --dir content`."
|
|
40
|
+
},
|
|
41
|
+
WORKSPACE_CHECKOUT_FAILED: {
|
|
42
|
+
why: ({ message }) => message,
|
|
43
|
+
fix: "Read the message. Run `vitehub status` to see the state of the checkout, then run the command again."
|
|
44
|
+
},
|
|
45
|
+
WORKSPACE_CHECKOUT_MISSING: {
|
|
46
|
+
why: ({ workspace }) => workspace === void 0 ? "vitehub.lock has no checked-out Workspace." : `Workspace "${workspace}" is not checked out.`,
|
|
47
|
+
fix: "Run `vitehub pull <workspace> --dir <folder>` first."
|
|
48
|
+
},
|
|
49
|
+
WORKSPACE_CHECKOUT_OPTIONS: {
|
|
50
|
+
why: ({ actual, expected, key, workspace }) => workspace === void 0 ? `This checkout uses ${expected}, not "${actual}".` : `Workspace "${workspace}" is checked out with ${key} "${expected}", not "${actual}".`,
|
|
51
|
+
fix: "Edit `vitehub.lock` to change the `dir` or `ref` of the entry. To change the remote, remove the entry from `vitehub.lock` and pull into a new folder."
|
|
52
|
+
},
|
|
53
|
+
WORKSPACE_CHECKOUT_OVERLAP: {
|
|
54
|
+
why: ({ dir, other, otherDir, workspace }) => `Workspace "${workspace}" folder "${dir}" overlaps Workspace "${other}" folder "${otherDir}".`,
|
|
55
|
+
fix: "Use separate checkout folders that do not contain one another."
|
|
56
|
+
},
|
|
57
|
+
WORKSPACE_CHECKOUT_PATH: {
|
|
58
|
+
why: ({ other, path, problem }) => ({
|
|
59
|
+
"excluded": `The path "${path}" is excluded from the checkout.`,
|
|
60
|
+
"not-portable": `The path "${path}" has a component that is not portable between file systems.`,
|
|
61
|
+
"not-relative": `The remote path "${path}" is not a relative Workspace path.`,
|
|
62
|
+
"reserved": `The top-level file name "${path}" is reserved by the operation input map.`,
|
|
63
|
+
"spelling": `The checkout paths "${other}" and "${path}" use different spellings for one file-system path, or replace a file with a directory.`
|
|
64
|
+
})[problem],
|
|
65
|
+
fix: "Rename the path to a portable name that the checkout does not exclude, before you pull or push it. For two spellings of one path, rename one. For a file that a folder replaces, keep local edits elsewhere, remove the `vitehub.lock` entry, and pull into a new empty folder."
|
|
66
|
+
},
|
|
67
|
+
WORKSPACE_CHECKOUT_SYMLINK: {
|
|
68
|
+
why: ({ path }) => path === "vitehub.lock" ? "vitehub.lock is a symbolic link. A checkout reads and writes only a real lock file." : `${path} is a symbolic link. A checkout reads and writes only real files and folders.`,
|
|
69
|
+
fix: "Replace the symbolic link with a real folder or file, then try again."
|
|
70
|
+
},
|
|
71
|
+
WORKSPACE_CHECKOUT_TOO_LARGE: {
|
|
72
|
+
why: ({ largest, limit, size, workspace }) => `The push of Workspace "${workspace}" is ${size}, over the ${limit} limit of one push.${largest ? ` Largest files: ${largest}.` : ""}`,
|
|
73
|
+
fix: "A push is one revision and sends each changed file whole, with binary files in base64. Keep large media in Blob, or add new files in smaller groups with a push after each group."
|
|
74
|
+
},
|
|
75
|
+
WORKSPACE_CHECKOUT_USAGE: {
|
|
76
|
+
why: ({ command, flag, problem }) => ({
|
|
77
|
+
flag: `Unknown flag --${flag}.`,
|
|
78
|
+
names: `${command} accepts at most one Workspace name.`,
|
|
79
|
+
value: `--${flag} needs a value.`
|
|
80
|
+
})[problem],
|
|
81
|
+
fix: "Pass only the flags of the command, each with its value, and at most one Workspace name, for example `vitehub pull docs --dir content`."
|
|
82
|
+
},
|
|
83
|
+
WORKSPACE_LOCK_BUSY: {
|
|
84
|
+
why: "Another vitehub command is writing vitehub.lock: vitehub.lock.lock exists.",
|
|
85
|
+
fix: "Wait for that command to finish and try again. If no vitehub command runs, delete `vitehub.lock.lock`."
|
|
86
|
+
},
|
|
87
|
+
WORKSPACE_LOCK_INVALID: {
|
|
88
|
+
why: ({ problem }) => problem === "json" ? "vitehub.lock is not valid JSON." : "vitehub.lock has no `version: 1` and `workspaces` object.",
|
|
89
|
+
fix: "Fix the conflict in `vitehub.lock`, or delete the entry and pull again."
|
|
90
|
+
},
|
|
91
|
+
WORKSPACE_RENAMED_STORE_PROVIDER_KEY: {
|
|
92
|
+
why: ({ provider }) => `The Workspace \`store\` sets \`provider: ${provider}\`. ViteHub renamed this key to \`driver\`, and it does not read \`provider\`, so the Store would not be the one you chose.`,
|
|
93
|
+
fix: ({ driver }) => `Set \`store: { driver: ${driver} }\`, or run \`npx @vite-hub/codemods driver-key\` to rename it in every config file.`
|
|
94
|
+
},
|
|
95
|
+
WORKSPACE_UNKNOWN_STORE_DRIVER: {
|
|
96
|
+
why: ({ driver, renamed }) => renamed ? `The Workspace \`store.driver\` is ${driver}. ViteHub renamed this driver to "${renamed}", and it does not read ${driver}.` : `The Workspace \`store.driver\` ${driver} is not a Workspace Store driver.`,
|
|
97
|
+
fix: ({ renamed }) => renamed ? `Set \`store: { driver: "${renamed}" }\`, or run \`npx @vite-hub/codemods driver-key\` to rename it in every config file.` : "Set `store.driver` to \"local\", \"memory\", \"github\", \"cloudflare\", or \"vercel\", or pass a Store object."
|
|
98
|
+
},
|
|
99
|
+
WORKSPACE_REGISTRY_LOAD_FAILED: {
|
|
100
|
+
why: ({ reason, workspace }) => `The module of Workspace "${workspace}" did not load: ${reason}`,
|
|
101
|
+
fix: "Read `error.cause` for the first error. Make sure that the module of the Workspace loads without errors and exports its Definition: the default export of a file in `server/workspaces/`, or the export that the Vite plugin names in its Workspace contribution. Then restart the dev server or build again."
|
|
102
|
+
},
|
|
103
|
+
WORKSPACE_SOURCE_ACCESS_FAILED: {
|
|
104
|
+
why: ({ source, workspace }) => `Source "${source}" of Workspace "${workspace}" cannot reach its data with the credentials of the build. The deployed app would fail on its first read.`,
|
|
105
|
+
fix: "Read `error.cause` for the response of the provider. For a GitHub Source, check that `repo` and `ref` exist and that the token of the build (`auth`, `VITEHUB_GITHUB_TOKEN`, or `gh auth token`) can read the repository. Then build again."
|
|
106
|
+
},
|
|
107
|
+
WORKSPACE_R0069: withFix("Use a Store with retained history: `createBlobDatabaseWorkspaceStore()` or the `github` Store. Open the Workspace with a scope that grants the complete Workspace, not selected paths."),
|
|
108
|
+
WORKSPACE_R0070: withFix("Pass a `limit` from 1 to 100, and pass a `cursor` only with the `ref` of the `history.list()` call that returned it."),
|
|
109
|
+
WORKSPACE_R0071: withFix("Use a ref name with up to 128 letters, numbers, `_`, and `-`, joined by single `.` or `/`, for example `draft` or `team/review`. In a GitHub Store with `refs`, use `published` or `draft`, not the branch name."),
|
|
110
|
+
WORKSPACE_R0072: withFix("Set the `repository` option of the GitHub Store or `VITEHUB_WORKSPACE_GITHUB_REPOSITORY`, for example `owner/repo`. Set the `token` option or `VITEHUB_GITHUB_TOKEN`."),
|
|
111
|
+
WORKSPACE_R0073: withFix("Make the commit message or metadata shorter, as the message says. Remove each `Vitehub-Metadata:` line from the message, and pass the values in the `metadata` option."),
|
|
112
|
+
WORKSPACE_R0001: withFix("Pass the path of a file or folder in the Workspace, for example `docs/guide.md`. The Workspace root itself cannot be written, moved, or deleted."),
|
|
113
|
+
WORKSPACE_R0002: withFix("Enable at least one operation in `createWorkspaceTools(workspace, { operations })`, for example `{ operations: { read: true } }`."),
|
|
114
|
+
WORKSPACE_R0003: withFix("Get write tools from `useWorkspace(name, { mode: \"write\" }).tools.write()`. Do not pass the result of `useWorkspace()` to `createWorkspaceTools()`. Or remove `write` from `operations`."),
|
|
115
|
+
WORKSPACE_B0001: withFix("Export the Workspace Definition from the file, for example `export default defineWorkspace({ ... })`. For a contributed Workspace, set `definition.export` to the name of the export."),
|
|
116
|
+
WORKSPACE_B0002: withFix("Use `defineWorkspace()` in `server/workspaces/<name>.ts`. Move the `defineAgent()` call to `server/agents/<name>/agent.ts`."),
|
|
117
|
+
WORKSPACE_B0003: withFix("Rename or remove one of the definitions that the message lists. Each Workspace name has one definition."),
|
|
118
|
+
WORKSPACE_B0004: withFix("Set `vitehub.workspaces` in the plugin to an array of `{ name, definition: { module, export? }, reason? }` entries, or to a function that returns one. Set `module` to an absolute path, a `file:` URL, or a package specifier."),
|
|
119
|
+
WORKSPACE_B0005: withFix("Set the Cloudflare Artifacts Store in the `workspace` config, for example `vitehub({ workspace: { store: { driver: \"cloudflare\", binding: \"WORKSPACE_ARTIFACTS\", namespace: \"vitehub\" } } })`, and remove `store` from the Workspace Definition. Or remove the import that the build cannot load from the Definition file, so that the build can read its `store`."),
|
|
120
|
+
WORKSPACE_R0004: withFix("Put a value after the option, for example `--timeout 30000` or `--url http://localhost:5173`."),
|
|
121
|
+
WORKSPACE_R0005: withFix("Pass a whole number of milliseconds from 1 to 2147483647, for example `--timeout 30000`."),
|
|
122
|
+
WORKSPACE_R0006: withFix("Pass a whole number of milliseconds from 1 to 2147483647, for example `--timeout 30000`."),
|
|
123
|
+
WORKSPACE_R0007: withFix("Remove the option. `vitehub workspace dev --help` lists the options."),
|
|
124
|
+
WORKSPACE_R0008: withFix("Put a command after `exec`, for example `vitehub workspace dev docs exec ls`."),
|
|
125
|
+
WORKSPACE_R0009: withFix("Put `exec` before the command, for example `vitehub workspace dev docs exec ls -la`. Or omit the command to open the interactive command loop."),
|
|
126
|
+
WORKSPACE_C0001: withFix("Set `workspace` to an object, for example `workspace: { store: { driver: \"memory\" } }`, or to `false`."),
|
|
127
|
+
WORKSPACE_C0002: withFix("Remove the option. The `workspace` config accepts `assets`, `projectRoot`, `root`, and `store`."),
|
|
128
|
+
WORKSPACE_R0015: withFix("Remove the option. `defineWorkspace()` accepts `bindings`, `commit`, `hooks`, `loaders`, `plugins`, `rootDir`, `rules`, `sourceRootDir`, `sources`, and `store`."),
|
|
129
|
+
WORKSPACE_R0016: withFix("Pass an object to `defineWorkspace()`, for example `defineWorkspace({ sources: {} })`."),
|
|
130
|
+
WORKSPACE_R0017: withFix("Remove `name` from the Workspace Definition. The file name sets the Workspace name, for example `server/workspaces/docs.ts` defines `docs`."),
|
|
131
|
+
WORKSPACE_R0018: withFix("Use fewer and shorter glob patterns with fewer `{a,b}` and `*` parts, for example `docs/**/*.md` in place of a list of patterns."),
|
|
132
|
+
WORKSPACE_R0019: withFix("Use fewer and shorter glob patterns with fewer `{a,b}` and `*` parts, for example `docs/**/*.md` in place of a list of patterns."),
|
|
133
|
+
WORKSPACE_R0020: withFix("Use fewer and shorter glob patterns with fewer `{a,b}` and `*` parts, for example `docs/**/*.md` in place of a list of patterns."),
|
|
134
|
+
WORKSPACE_R0021: withFix("Remove `name` from the Workspace Definition. The file name sets the Workspace name, for example `server/workspaces/docs.ts` defines `docs`."),
|
|
135
|
+
WORKSPACE_R0022: withFix("Pass the Workspace name as a non-empty string, for example `registerWorkspace(\"docs\", definition)` or `registerWorkspacePlugin(\"docs\", plugin)`."),
|
|
136
|
+
WORKSPACE_R0023: withFix("Set `maxBytes` to a number of bytes or to a string such as `\"512kb\"` or `\"10mb\"`."),
|
|
137
|
+
WORKSPACE_R0024: withFix("Give each Workspace plugin a non-empty string `id`, for example `{ id: \"my-plugin\", rules }`."),
|
|
138
|
+
WORKSPACE_R0025: withFix("Declare the target as a `fetch()` Source in the Workspace Definition, and make the Source visible in the Workspace scope."),
|
|
139
|
+
WORKSPACE_R0026: withFix("Use a Store that supports rebase: `github` or `cloudflare`. Or do not call `rebase()` on this Workspace."),
|
|
140
|
+
WORKSPACE_R0027: withFix("Set another `binding` in the Workspace `store` options, or set `namespace` to the namespace that Wrangler config already has for that binding."),
|
|
141
|
+
WORKSPACE_R0028: withFix("The client closed the Workspace Dev connection before the command finished. Run the command again and keep the connection open."),
|
|
142
|
+
WORKSPACE_R0029: withFix("Give each Cloudflare Artifacts namespace its own `binding` in the Workspace `store` options."),
|
|
143
|
+
WORKSPACE_R0033: withFix("Run the operation again. If it fails again, check the Blob store of the project in the Vercel dashboard."),
|
|
144
|
+
WORKSPACE_R0034: withFix("Pass the Workspace name, for example `createWorkspacePreparation({ workspace: \"docs\" })`."),
|
|
145
|
+
WORKSPACE_R0035: withFix("Pass Source keys of the Workspace as non-empty strings, for example `sources: [\"handbook\"]`, or omit `sources`."),
|
|
146
|
+
WORKSPACE_R0036: withFix("Set `retryDelayMs` to a number of milliseconds from 0 to 2147483647, or omit it to use 10000."),
|
|
147
|
+
WORKSPACE_R0037: withFix("Set `materialize: \"startup\"` on the Sources to prepare, or pass their keys in `sources`."),
|
|
148
|
+
WORKSPACE_R0038: withFix("Check each Source that the message names: its URL, repository, or files, and its credentials. Without `requireNonEmpty`, an empty Source is ready."),
|
|
149
|
+
WORKSPACE_R0039: withFix("`stop()` cancelled this preparation. Call `start()` again to prepare the Workspace."),
|
|
150
|
+
WORKSPACE_R0040: withFix("Pass a non-empty command, for example `vitehub workspace dev docs exec ls`."),
|
|
151
|
+
WORKSPACE_R0041: withFix("Pass a Workspace name, or a Workspace from `useWorkspace(name, { mode: \"write\" })`, that can start a Workspace Session."),
|
|
152
|
+
WORKSPACE_R0042: withFix("This is a ViteHub bug. Report it at https://github.com/vite-hub/vitehub/issues with the message and your Workspace Definition."),
|
|
153
|
+
WORKSPACE_R0043: withFix("This is a ViteHub bug. Report it at https://github.com/vite-hub/vitehub/issues with the message and your Workspace Definition."),
|
|
154
|
+
WORKSPACE_R0044: withFix("Make sure that the Workspace Session host can run `readlink` and can read the path in the message."),
|
|
155
|
+
WORKSPACE_R0045: withFix("Set `executionAuthority` on the Workspace Session host. Use `unknownExecutionAuthority` from `@vite-hub/runtime` when the host cannot describe it."),
|
|
156
|
+
WORKSPACE_C0003: withFix("Rename the Source key to one file name without `/` and without a `.json` ending, for example `issues`. ViteHub keeps the request descriptor at `.vitehub/sources/<key>.json`."),
|
|
157
|
+
WORKSPACE_C0004: withFix("Set `mount` on the Source to a folder, for example `mount: \"docs\"`, or set `probeKeys`. A Workspace Scope grant needs paths, and a Source at the root has none."),
|
|
158
|
+
WORKSPACE_C0005: withFix("Use a Source helper so that the Source kind is explicit, for example `github({ repo: \"owner/name\" })`, `fetch({ url, workspacePath: \"issues.json\" })`, or `file({ path: \"README.md\" })`. A `{ source: { ... } }` wrapper does not help, because ViteHub reads the options in it the same way."),
|
|
159
|
+
WORKSPACE_C0006: withFix("Pass `path` or `workspacePath` to `file()`, for example `file({ path: \"README.md\" })`."),
|
|
160
|
+
WORKSPACE_C0007: withFix("When the URL has a query, set `path` on the Source config, for example `{ url, path: \"issues.json\" }`. Or use the `fetch()` helper with `workspacePath: \"issues.json\"`."),
|
|
161
|
+
WORKSPACE_R0046: withFix("Set `workspacePath` on the `fetch()` Source to read the response as a file. A request-only Source answers only `curl` Source requests."),
|
|
162
|
+
WORKSPACE_R0047: withFix("Read the `fetch()` Source at its `workspacePath`. The Source has no other file."),
|
|
163
|
+
WORKSPACE_R0048: withFix("Read this Source in an Agent Invocation. The Agent runs the resolver with the Invocation context before it reads the Source. Outside an Invocation, the Source has no files."),
|
|
164
|
+
WORKSPACE_R0049: withFix("Set `responseType` to `\"json\"` or `\"text\"`."),
|
|
165
|
+
WORKSPACE_R0050: withFix("Set `method` to `\"GET\"`, `\"HEAD\"`, or `\"POST\"`."),
|
|
166
|
+
WORKSPACE_R0051: withFix("Use `query` for a fixed query or `querySchema` for a query that the Agent sets. Remove the other one, and remove the query from `url` when you use `querySchema`."),
|
|
167
|
+
WORKSPACE_R0052: withFix("Use `body` for a fixed body or `bodySchema` for a body that the Agent sets. Remove the other one."),
|
|
168
|
+
WORKSPACE_R0053: withFix("Set `method: \"POST\"` to send a body, or remove `body` and `bodySchema`."),
|
|
169
|
+
WORKSPACE_R0054: withFix("Pass a schema that has `~standard.jsonSchema.input()`, the Standard JSON Schema interface. Or use a fixed `query` or `body`."),
|
|
170
|
+
WORKSPACE_R0055: withFix("Send the request with the method, URL, query, and body that the Source declares. Read `.vitehub/sources/<source>.json` in the Workspace to get them."),
|
|
171
|
+
WORKSPACE_R0056: withFix("Send the request with the method, URL, query, and body that the Source declares. Read `.vitehub/sources/<source>.json` in the Workspace to get them."),
|
|
172
|
+
WORKSPACE_R0057: withFix("Send the request with the method, URL, query, and body that the Source declares. Read `.vitehub/sources/<source>.json` in the Workspace to get them."),
|
|
173
|
+
WORKSPACE_R0058: withFix("Send the request with the method, URL, query, and body that the Source declares. Read `.vitehub/sources/<source>.json` in the Workspace to get them."),
|
|
174
|
+
WORKSPACE_R0059: withFix("Send the request with the method, URL, query, and body that the Source declares. Read `.vitehub/sources/<source>.json` in the Workspace to get them."),
|
|
175
|
+
WORKSPACE_R0060: withFix("Read this Source in an Agent Invocation. The Agent runs the resolver with the Invocation context before it reads the Source. Outside an Invocation, the Source has no files."),
|
|
176
|
+
WORKSPACE_R0061: withFix("Return `repo` from the `github()` resolver, for example `{ repo: \"owner/name\" }`, or start the Agent Invocation with a `pullRequest` context value."),
|
|
177
|
+
WORKSPACE_R0063: withFix("Use the URL of exactly one Source that the Workspace scope can see. Read `.vitehub/sources/<source>.json` in the Workspace and send the URL, method, query, and body that it declares."),
|
|
178
|
+
WORKSPACE_R0064: withFix("This is a ViteHub bug. Report it at https://github.com/vite-hub/vitehub/issues with the message and your Workspace Definition."),
|
|
179
|
+
WORKSPACE_R0065: withFix("The Cloudflare Artifacts Store keeps its Git checkout in memory. A Git step used the path in the message in a way that the error code rejects, for example `ENOENT` for a missing file. Run the operation again. If it fails again, report it at https://github.com/vite-hub/vitehub/issues with the message."),
|
|
180
|
+
WORKSPACE_R0066: withFix("Connect a Blob store to the Vercel project so that it gets `BLOB_STORE_ID`. Off Vercel, set `BLOB_READ_WRITE_TOKEN`."),
|
|
181
|
+
WORKSPACE_R0074: withFix("The Workspace Store keeps no file revisions, so ViteHub cannot prove that the file at the path in the message is the one it started to remove. Check the file. If it must go, delete it in the Store itself, for example in its directory or bucket, because the Workspace rejects writes under a Source. Then run the Source operation again."),
|
|
182
|
+
WORKSPACE_R0075: withFix("Remove `read` from the rule. Workspace rules limit writes only, so `read: false` would not hide the files. Keep files that a reader must not see out of the Workspace, for example in another Workspace or in an Env secret."),
|
|
183
|
+
WORKSPACE_R0076: withFix("Remove the option from the rule. A Workspace rule accepts `commit`, `maxBytes`, `mediaType`, `validate`, and `write`."),
|
|
184
|
+
WORKSPACE_R0077: withFix("Pass the Drizzle database of the history Database: `database: () => useDatabase(\"history\").db` with `import { useDatabase } from \"vite-hub/database\"`. A Database Definition from `defineDatabase()` is not a Drizzle database.")
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
//#endregion
|
|
188
|
+
export { workspaceErrorDiagnostics as t };
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { defineDiagnostics } from "nostics";
|
|
2
|
+
//#region ../internal/src/error-diagnostics.ts
|
|
3
|
+
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
4
|
+
const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
5
|
+
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
6
|
+
codes: {
|
|
7
|
+
INTERNAL_R0012: {
|
|
8
|
+
...dynamicError,
|
|
9
|
+
fix: "Check the URL, the headers, and the credentials of the HTTP request. `error.status` holds the status that the server sent."
|
|
10
|
+
},
|
|
11
|
+
INTERNAL_R0013: {
|
|
12
|
+
...dynamicError,
|
|
13
|
+
fix: "Check that the provider token can manage the resource in the path that the message names. `error.kind` and `error.codes` hold the provider failure."
|
|
14
|
+
},
|
|
15
|
+
INTERNAL_R0014: {
|
|
16
|
+
why: ({ path }) => `Cannot read Provision State from "${path}".`,
|
|
17
|
+
fix: "Check file access and restore valid JSON while preserving existing resource IDs."
|
|
18
|
+
},
|
|
19
|
+
INTERNAL_R0020: {
|
|
20
|
+
fix: "Give the operation a name like `content.publish`, a description, a section, a kind, an input schema, and a run function.",
|
|
21
|
+
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
22
|
+
},
|
|
23
|
+
INTERNAL_R0021: {
|
|
24
|
+
fix: "Run `vitehub inspect definitions --kind operation` to list the operations of this app.",
|
|
25
|
+
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
26
|
+
},
|
|
27
|
+
INTERNAL_R0022: {
|
|
28
|
+
fix: "Send input that matches the schema of the operation. `vitehub <namespace> <command> --help` shows the fields.",
|
|
29
|
+
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
30
|
+
},
|
|
31
|
+
INTERNAL_R0024: {
|
|
32
|
+
fix: "Start the dev server with `vite dev`, or pass `--url <origin>` of a deployed app and set VITEHUB_CONSOLE_PRIVATE_KEY_<NAME> to a private key whose public key the app has in VITEHUB_CONSOLE_KEY_<NAME>.",
|
|
33
|
+
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
34
|
+
},
|
|
35
|
+
INTERNAL_R0023: {
|
|
36
|
+
fix: "Ask for access to the section of this operation.",
|
|
37
|
+
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
38
|
+
},
|
|
39
|
+
INTERNAL_B0001: {
|
|
40
|
+
...dynamicError,
|
|
41
|
+
fix: "Give the resource that the message names another name or binding in the `vitehub()` options of its feature, so that two different Cloudflare resources do not share one name."
|
|
42
|
+
},
|
|
43
|
+
INTERNAL_B0015: {
|
|
44
|
+
...dynamicError,
|
|
45
|
+
fix: "Install one version of the package that the message names, for example with `pnpm dedupe` or an `overrides` entry in `package.json`."
|
|
46
|
+
},
|
|
47
|
+
INTERNAL_B0016: {
|
|
48
|
+
...dynamicError,
|
|
49
|
+
fix: "Correct the field that the message names in the `package.json` of a runtime dependency of the app, such as a workspace package, or run `pnpm install` again to restore an installed package."
|
|
50
|
+
},
|
|
51
|
+
INTERNAL_B0017: {
|
|
52
|
+
...dynamicError,
|
|
53
|
+
fix: "Correct the field that the message names in the `package.json` of a runtime dependency of the app, such as a workspace package, or run `pnpm install` again to restore an installed package."
|
|
54
|
+
},
|
|
55
|
+
INTERNAL_B0018: {
|
|
56
|
+
...dynamicError,
|
|
57
|
+
fix: "Correct the field that the message names in the `package.json` of a runtime dependency of the app, such as a workspace package, or run `pnpm install` again to restore an installed package."
|
|
58
|
+
},
|
|
59
|
+
INTERNAL_B0019: {
|
|
60
|
+
...dynamicError,
|
|
61
|
+
fix: "Correct the field that the message names in the `package.json` of a runtime dependency of the app, such as a workspace package, or run `pnpm install` again to restore an installed package."
|
|
62
|
+
},
|
|
63
|
+
INTERNAL_B0020: {
|
|
64
|
+
...dynamicError,
|
|
65
|
+
fix: "Correct the field that the message names in the `package.json` of a runtime dependency of the app, such as a workspace package, or run `pnpm install` again to restore an installed package."
|
|
66
|
+
},
|
|
67
|
+
INTERNAL_B0021: {
|
|
68
|
+
...dynamicError,
|
|
69
|
+
fix: "Install the package that the message names in the app, for example with `pnpm add <name>`, then build again."
|
|
70
|
+
},
|
|
71
|
+
INTERNAL_B0022: {
|
|
72
|
+
...dynamicError,
|
|
73
|
+
fix: "Install one version of the package that the message names, for example with `pnpm dedupe` or an `overrides` entry in `package.json`."
|
|
74
|
+
},
|
|
75
|
+
INTERNAL_B0025: {
|
|
76
|
+
...dynamicError,
|
|
77
|
+
fix: "Replace the `new URL(\"./...\", import.meta.url)` in the project-root `main.ts`, or in a Schedule file of `server/schedules/` and the files it imports, with a static `import` of that file."
|
|
78
|
+
},
|
|
79
|
+
INTERNAL_B0026: {
|
|
80
|
+
...dynamicError,
|
|
81
|
+
fix: "Replace the computed `import()` in the project-root `main.ts`, or in a Schedule file of `server/schedules/` and the files it imports, with a static `import` or with `import(\"<literal path>\")`."
|
|
82
|
+
},
|
|
83
|
+
INTERNAL_B0027: {
|
|
84
|
+
...dynamicError,
|
|
85
|
+
fix: "Replace the computed `require()` in the project-root `main.ts`, or in a Schedule file of `server/schedules/` and the files it imports, with a static `import`."
|
|
86
|
+
},
|
|
87
|
+
INTERNAL_B0028: {
|
|
88
|
+
...dynamicError,
|
|
89
|
+
fix: "Wait for the other build of this app to finish, or stop the process that the message names, then build again."
|
|
90
|
+
},
|
|
91
|
+
INTERNAL_B0029: {
|
|
92
|
+
...dynamicError,
|
|
93
|
+
fix: "Stop the other builds that write the same Deno output folder, delete the `.vitehub-lock` folder next to that output folder, such as `.output.vitehub-lock`, then build again."
|
|
94
|
+
},
|
|
95
|
+
INTERNAL_B0031: {
|
|
96
|
+
...dynamicError,
|
|
97
|
+
fix: "Import `./schedule/deno-cron.mjs` at the top level of the project-root `main.ts`, for example with `await import(new URL(\"./schedule/deno-cron.mjs\", import.meta.url).href)` outside any condition."
|
|
98
|
+
},
|
|
99
|
+
INTERNAL_B0032: {
|
|
100
|
+
...dynamicError,
|
|
101
|
+
fix: "Import `./server/index.mjs` at the top level of the project-root `main.ts`, for example with `await import(new URL(\"./server/index.mjs\", import.meta.url).href)` outside any condition."
|
|
102
|
+
},
|
|
103
|
+
INTERNAL_B0035: {
|
|
104
|
+
...dynamicError,
|
|
105
|
+
fix: "Delete the provider output folder that holds the file that the message names, such as `dist/<app>` for Cloudflare, and build again."
|
|
106
|
+
},
|
|
107
|
+
INTERNAL_B0039: {
|
|
108
|
+
...dynamicError,
|
|
109
|
+
fix: "Fix the build error that ViteHub showed before this one. ViteHub stops writing the provider output when another part of the build fails."
|
|
110
|
+
},
|
|
111
|
+
INTERNAL_B0040: {
|
|
112
|
+
...dynamicError,
|
|
113
|
+
fix: "Remove the custom Nitro `output.serverDir`, so that the Nitro preset of the host writes the server entry that the message names."
|
|
114
|
+
},
|
|
115
|
+
INTERNAL_B0043: {
|
|
116
|
+
...dynamicError,
|
|
117
|
+
fix: "Delete the build output folder, such as `.output` or `.vercel/output`, and build again."
|
|
118
|
+
},
|
|
119
|
+
INTERNAL_B0046: {
|
|
120
|
+
...dynamicError,
|
|
121
|
+
fix: "Install the package that the message names in the app, for example with `pnpm add <name>`, then build again."
|
|
122
|
+
},
|
|
123
|
+
INTERNAL_B0047: {
|
|
124
|
+
...dynamicError,
|
|
125
|
+
fix: "Correct the `package.json` file that the message names so that it holds one JSON object, or run `pnpm install` again to restore an installed package."
|
|
126
|
+
},
|
|
127
|
+
INTERNAL_B0048: {
|
|
128
|
+
fix: "Rename one of the two operations. A name is `<section>.<verb>` and is unique in the app.",
|
|
129
|
+
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
130
|
+
},
|
|
131
|
+
INTERNAL_B0049: {
|
|
132
|
+
fix: "Set `cli: { namespace, command }` on one of the two operations.",
|
|
133
|
+
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
134
|
+
},
|
|
135
|
+
INTERNAL_B0050: {
|
|
136
|
+
fix: "Rename one of the two operations, or set `mcp: false` on it. MCP tool names replace every character outside letters, digits, `_`, and `-` with `_`.",
|
|
137
|
+
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
138
|
+
},
|
|
139
|
+
INTERNAL_B0051: {
|
|
140
|
+
why: ({ field, generated, name, path, project, scope }) => `The Cloudflare ${path} entry "${name}"${scope} is written by ViteHub and by the project's Wrangler config with a different ${field}: ${generated} and ${project}.`,
|
|
141
|
+
fix: "Remove the entry from the project's Wrangler config, since ViteHub writes it, or give one of them another name."
|
|
142
|
+
},
|
|
143
|
+
INTERNAL_B0052: {
|
|
144
|
+
why: ({ column, section }) => `The column "${column}" of the Console section "${section}" needs both \`format: "switch"\` and a \`switch\` operation name such as "skills.set".`,
|
|
145
|
+
fix: "Give a switch column `format: \"switch\"` and `switch: { operation, input }` with a registered operation name, or remove both."
|
|
146
|
+
},
|
|
147
|
+
INTERNAL_R0025: {
|
|
148
|
+
fix: "Start `vite dev` in the project that you run the command from, or pass `--url` of that server.",
|
|
149
|
+
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
150
|
+
},
|
|
151
|
+
INTERNAL_R0026: {
|
|
152
|
+
why: "The server parsed a destructive operation that the CLI did not confirm.",
|
|
153
|
+
fix: "Review the operation, then run it again with --yes to confirm the change."
|
|
154
|
+
},
|
|
155
|
+
INTERNAL_C0001: {
|
|
156
|
+
...dynamicError,
|
|
157
|
+
fix: "Rename or remove one of the two files that the message lists. ViteHub takes the Definition name from the file path."
|
|
158
|
+
},
|
|
159
|
+
INTERNAL_C0002: {
|
|
160
|
+
...dynamicError,
|
|
161
|
+
fix: "Rename or remove one of the two files that the message lists. ViteHub takes the Definition name from the file path."
|
|
162
|
+
},
|
|
163
|
+
INTERNAL_R0001: {
|
|
164
|
+
...dynamicError,
|
|
165
|
+
fix: "Set `host` in `vitehub()`, or in the `vitehub` options of `nuxt.config.ts`, to `cloudflare`, `deno`, `netlify`, `node`, or `vercel`. Or remove `host` so that ViteHub finds the host from the environment."
|
|
166
|
+
},
|
|
167
|
+
INTERNAL_R0002: {
|
|
168
|
+
...dynamicError,
|
|
169
|
+
fix: "Stop using the feature that the message names, or set `host` in `vitehub()` to a host that provides it. For Blob, you can also set `blob: { driver: \"s3\" }` with a remote store."
|
|
170
|
+
},
|
|
171
|
+
INTERNAL_R0004: {
|
|
172
|
+
...dynamicError,
|
|
173
|
+
fix: "Set a larger `maxResponseBytes` on the HTTP request, such as the `fetch()` Source options, or ask the server for a smaller response."
|
|
174
|
+
},
|
|
175
|
+
INTERNAL_R0005: {
|
|
176
|
+
...dynamicError,
|
|
177
|
+
fix: "Set `method` of the HTTP request to `GET`, `HEAD`, or `POST`."
|
|
178
|
+
},
|
|
179
|
+
INTERNAL_R0006: {
|
|
180
|
+
...dynamicError,
|
|
181
|
+
fix: "Set `timeout` of the HTTP request to a number of milliseconds from 1 to 2147483647, or remove it to use the default."
|
|
182
|
+
},
|
|
183
|
+
INTERNAL_R0007: {
|
|
184
|
+
...dynamicError,
|
|
185
|
+
fix: "Set `maxResponseBytes` of the HTTP request to a positive integer no greater than the limit that the message names, or remove it to use the default."
|
|
186
|
+
},
|
|
187
|
+
INTERNAL_R0008: {
|
|
188
|
+
...dynamicError,
|
|
189
|
+
fix: "Make the value that the message names match its schema: the input, query, or body that you send, or the response schema that you declare for the request."
|
|
190
|
+
},
|
|
191
|
+
INTERNAL_R0009: {
|
|
192
|
+
...dynamicError,
|
|
193
|
+
fix: "Use a Standard Schema whose `validate()` returns `{ value }` or `{ issues }` for the value that the message names."
|
|
194
|
+
},
|
|
195
|
+
INTERNAL_R0010: {
|
|
196
|
+
...dynamicError,
|
|
197
|
+
fix: "Run the command again. If the error stays, check the Cloudflare API status, because Cloudflare sent a response that ViteHub cannot read."
|
|
198
|
+
},
|
|
199
|
+
INTERNAL_R0011: {
|
|
200
|
+
...dynamicError,
|
|
201
|
+
fix: "Pass an h3 app, an object with a `fetch(request)` method, or a fetch function as `app`."
|
|
202
|
+
},
|
|
203
|
+
INTERNAL_CONSOLE_KEY_NAME_INVALID: {
|
|
204
|
+
why: ({ name }) => `[vitehub] The Console key name ${JSON.stringify(name)} must be 1 to 64 of A-Z, 0-9, and _.`,
|
|
205
|
+
fix: "Name the Console key with 1 to 64 characters from A-Z, 0-9, and _, such as `CI`. The app reads its public key from `VITEHUB_CONSOLE_KEY_<NAME>`."
|
|
206
|
+
},
|
|
207
|
+
INTERNAL_CONSOLE_PRIVATE_KEY_INVALID: {
|
|
208
|
+
why: "[vitehub] A Console private key is the 32-byte Ed25519 seed as base64url (43 characters). `vitehub secret console-key` makes one.",
|
|
209
|
+
fix: "Run `vitehub secret console-key` and use the 43-character private key that it prints, without spaces or quotes."
|
|
210
|
+
},
|
|
211
|
+
INTERNAL_CONSOLE_PRIVATE_KEY_VARIABLES_MULTIPLE: {
|
|
212
|
+
why: ({ prefix, variables }) => `[vitehub] Set one ${prefix}<NAME> variable. This environment has ${variables}.`,
|
|
213
|
+
fix: "Keep one `VITEHUB_CONSOLE_PRIVATE_KEY_<NAME>` variable in the environment of the command, and unset the others that the message names."
|
|
214
|
+
},
|
|
215
|
+
INTERNAL_CONSOLE_PRIVATE_KEY_VARIABLE_INVALID: {
|
|
216
|
+
why: ({ variable }) => `[vitehub] ${variable} must be the 43-character private key that \`vitehub secret console-key\` prints, and its name 1 to 64 of A-Z, 0-9, and _.`,
|
|
217
|
+
fix: "Set the variable that the message names to the private key that `vitehub secret console-key` prints, and name it `VITEHUB_CONSOLE_PRIVATE_KEY_<NAME>` with A-Z, 0-9, and _ in `<NAME>`."
|
|
218
|
+
},
|
|
219
|
+
INTERNAL_FORGE_NOT_INSTALLED: {
|
|
220
|
+
why: ({ feature }) => `${feature} needs @vite-hub/forge, and the app did not install it.`,
|
|
221
|
+
fix: "Install Forge in your app with `pnpm add @vite-hub/forge`, then build again."
|
|
222
|
+
},
|
|
223
|
+
INTERNAL_MCP_ARGUMENTS_INVALID: {
|
|
224
|
+
why: ({ detail }) => detail,
|
|
225
|
+
fix: "Pass the prompt or resource the arguments that `prompts/list` or `resources/templates/list` describes for it."
|
|
226
|
+
},
|
|
227
|
+
INTERNAL_MCP_METHOD_FAILED: {
|
|
228
|
+
why: ({ name }) => `${name} failed on the server.`,
|
|
229
|
+
fix: "Read the server log for the error of the MCP prompt or resource that the message names, and fix its handler."
|
|
230
|
+
},
|
|
231
|
+
INTERNAL_MCP_RESOURCE_NOT_FOUND: {
|
|
232
|
+
why: ({ uri }) => `Resource not found: ${uri}. Call resources/list or resources/templates/list for the resources of this server.`,
|
|
233
|
+
fix: "Call `resources/list` or `resources/templates/list`, and read a URI that one of them returns."
|
|
234
|
+
},
|
|
235
|
+
INTERNAL_PRESET_OPTION_UNKNOWN: {
|
|
236
|
+
why: ({ key, label }) => `[vitehub] Unknown ${label} option "${key}".`,
|
|
237
|
+
fix: "Remove the option that the message names from the preset options, or correct its spelling to an option that the preset declares."
|
|
238
|
+
},
|
|
239
|
+
INTERNAL_PRESET_TUPLE_INVALID: {
|
|
240
|
+
why: ({ owner }) => `[vitehub] ${owner} extends tuple requires [preset, options] with an options object.`,
|
|
241
|
+
fix: "Set `extends` to a preset, or to a two-item tuple `[preset, { ...options }]` whose second item is a plain object."
|
|
242
|
+
},
|
|
243
|
+
INTERNAL_SECRET_PURPOSE_MISSING: {
|
|
244
|
+
why: "[vitehub] A derived secret requires a purpose.",
|
|
245
|
+
fix: "Pass a non-empty purpose to `deriveSecret()`, such as `deriveSecret(\"my-module:session\")`."
|
|
246
|
+
},
|
|
247
|
+
INTERNAL_SECRET_TOO_SHORT: {
|
|
248
|
+
why: ({ minimum }) => `[vitehub] VITEHUB_SECRET must be at least ${minimum} characters. Generate one with \`openssl rand -base64 32\`.`,
|
|
249
|
+
fix: "Set `VITEHUB_SECRET` to the output of `openssl rand -base64 32`, which has 44 characters."
|
|
250
|
+
},
|
|
251
|
+
INTERNAL_SQLITE_ARGUMENT_INVALID: {
|
|
252
|
+
why: ({ value }) => value === "undefined" ? "undefined cannot be passed as argument to the database" : "Only finite numbers (not Infinity or NaN) can be passed as arguments",
|
|
253
|
+
fix: "Pass query arguments as finite numbers, strings, booleans, bigints, dates, byte arrays, or null. Replace undefined with null, and check numbers with `Number.isFinite()` before the query."
|
|
254
|
+
},
|
|
255
|
+
INTERNAL_SQLITE_INTEGER_UNSAFE: {
|
|
256
|
+
why: "Received integer which cannot be safely represented as a JavaScript number",
|
|
257
|
+
fix: "Create the client with `intMode: \"bigint\"` or `intMode: \"string\"`, or read the column with `CAST(column AS TEXT)` in the query."
|
|
258
|
+
},
|
|
259
|
+
INTERNAL_VALIBOT_JSON_SCHEMA_TARGET_UNSUPPORTED: {
|
|
260
|
+
why: ({ target }) => `[vitehub] Valibot cannot convert a schema to the ${target} JSON Schema target.`,
|
|
261
|
+
fix: "Ask for the `draft-07`, `draft-2020-12`, or `openapi-3.0` JSON Schema target, or pass one of them as `withValibotJsonSchema(schema, { target })`."
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
//#endregion
|
|
266
|
+
export { internalErrorDiagnostics as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-rQ84J-ij.js";
|
|
2
|
+
import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-BAgL2dtB.js";
|
|
3
|
+
import { file } from "@vite-hub/source";
|
|
4
|
+
//#region src/sources/file.ts
|
|
5
|
+
var file_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
file: () => file$1,
|
|
7
|
+
withFileSourceOptions: () => withFileSourceOptions
|
|
8
|
+
});
|
|
9
|
+
function file$1(input) {
|
|
10
|
+
const options = typeof input === "string" ? { path: input } : input;
|
|
11
|
+
return withFileSourceOptions(file(options), options);
|
|
12
|
+
}
|
|
13
|
+
/** Adds Workspace binding options to a file Source. Workspace normalization picks the default mount and probe keys. */
|
|
14
|
+
function withFileSourceOptions(source, options) {
|
|
15
|
+
const probeKeys = ownSourceOption(options, "probeKeys");
|
|
16
|
+
return {
|
|
17
|
+
...withWorkspaceRuntimeOptions(source, options),
|
|
18
|
+
...probeKeys ? { probeKeys } : {}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { file_exports as n, withFileSourceOptions as r, file$1 as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as normalizeWorkspacePath, o as matchesAny } from "./path
|
|
2
|
-
import {
|
|
1
|
+
import { l as normalizeWorkspacePath, o as isWorkspaceBytes, s as matchesAny } from "./path--wrT_Azm.js";
|
|
2
|
+
import { f as prepareWorkspaceSource, n as createSourceContext } from "./config-BAgL2dtB.js";
|
|
3
3
|
//#region src/loaders/files.ts
|
|
4
4
|
function shouldLoad(path, options) {
|
|
5
5
|
if (options.include && !matchesAny(path, options.include)) return false;
|
|
@@ -30,7 +30,7 @@ function files(options = {}) {
|
|
|
30
30
|
if (!shouldLoad(rawPath, options)) continue;
|
|
31
31
|
const transformed = options.transform ? await options.transform(rawItem) : rawItem;
|
|
32
32
|
ctx.abortSignal?.throwIfAborted();
|
|
33
|
-
const item = typeof transformed === "string" || transformed
|
|
33
|
+
const item = typeof transformed === "string" || isWorkspaceBytes(transformed) ? {
|
|
34
34
|
...rawItem,
|
|
35
35
|
content: transformed
|
|
36
36
|
} : transformed;
|