@vite-hub/workspace 0.0.4 → 0.1.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 +225 -58
- package/dist/{ai-CjxvGqM0.d.ts → ai-BW2ZhizI.d.ts} +22 -7
- package/dist/{ai-BqCC8BpY.js → ai-BZyLwULx.js} +147 -66
- package/dist/ai.d.ts +2 -2
- package/dist/ai.js +1 -1
- package/dist/{asset-registry-8QI3ML3K.js → asset-registry-DfBV5kmw.js} +3 -2
- package/dist/association-Cm0dUTDU-CDDhJnIh-Cv3bWnVb.js +19 -0
- package/dist/blob-database.d.ts +521 -0
- package/dist/blob-database.js +601 -0
- package/dist/cloudflare.d.ts +5 -6
- package/dist/cloudflare.js +1 -1
- package/dist/config-B7dmzDX3.js +1112 -0
- package/dist/{config-DE9xlaIw.d.ts → config-DLKdaFWN.d.ts} +1 -2
- package/dist/error-diagnostics-A_8Kp-48.js +116 -0
- package/dist/error-diagnostics-DY5GP47p.js +96 -0
- package/dist/events-7EBoeIPd-A2RUkJi5-BxrICQ17.js +354 -0
- package/dist/events-CRaLy7U3-3PNNp5WZ-Gv9nd0cH.js +214 -0
- package/dist/events-CeChclTf-CX-gD8oy-4aL2j6V-.js +527 -0
- package/dist/feed-DsC7Vws1-M_de2nSK-tKc0Pwo8.js +248 -0
- package/dist/feed-Dyf730Ys-D0HgBba6-BUnCa5gS.js +179 -0
- package/dist/file-C0_aPWSS.js +26 -0
- package/dist/file-metadata-CxDy-E2H.js +58 -0
- package/dist/{files-Q6xZjDHA.js → files-C7Px8uaC.js} +3 -3
- package/dist/forgejo-BN8ItCfl-Bbn4vhDd.js +2278 -0
- package/dist/{github-DHnjxQIX.js → github-CPxHtFB7.js} +16 -23
- package/dist/github-DtncTfmv-Du2S8lGF.js +4159 -0
- package/dist/gitlab-BoDm8-BC-xzZsW9eW.js +2530 -0
- package/dist/glob--XcLlcml.js +22 -0
- package/dist/glob--kNYDbfU.js +30 -0
- package/dist/graphql-DG5aJBT3-DceyFYdM-C4saqX37.js +489 -0
- package/dist/{host-DJH8cuoU.js → host-CFnrTXTK.js} +97 -41
- package/dist/{hosted-RPeJOCFz.js → hosted-acMA5XyL.js} +102 -19
- package/dist/hosted-vercel-blob-DKntsHaf.js +12603 -0
- package/dist/hosted-vercel-blob.d.ts +5 -6
- package/dist/hosted-vercel-blob.js +1 -1
- package/dist/hosted.d.ts +6 -7
- package/dist/hosted.js +1 -1
- package/dist/index.d.ts +57 -36
- package/dist/index.js +56 -56
- package/dist/inspect-BoObD2cJ.js +167 -0
- package/dist/internal/path.d.ts +2 -0
- package/dist/internal/path.js +2 -0
- package/dist/lifecycle-BwZ7c9hb.js +596 -0
- package/dist/loader.d.ts +5 -6
- package/dist/loader.js +3 -2
- package/dist/mcp-resources-BREFCmtn.js +39 -0
- package/dist/memory-BbwOqDXl.js +248 -0
- package/dist/metadata-target-DZEZQGHA.js +1588 -0
- package/dist/mountx.d.ts +4 -6
- package/dist/mountx.js +10 -8
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +1 -1
- package/dist/nuxt.d.ts +13 -12
- package/dist/nuxt.js +4 -8
- package/dist/operations-BcpWr41m.js +159 -0
- package/dist/operations-CGqY1XeG.js +965 -0
- package/dist/operations-DnOwKsJT.d.ts +136 -0
- package/dist/operations.d.ts +53 -0
- package/dist/operations.js +2 -0
- package/dist/path-CNAwN7pw.js +114 -0
- package/dist/path-DrSIenjj.js +59 -0
- package/dist/path-zHxQUbqa.d.ts +9 -0
- package/dist/plugins-DqQ8b4T5.d.ts +10 -0
- package/dist/provider-kXjfli9u.js +1457 -0
- package/dist/providers/github/store.d.ts +3 -5
- package/dist/providers/github/store.js +1 -1
- package/dist/{registry-D3yzt8HQ.js → registry-Bp-8UUfG.js} +9 -7
- package/dist/{registry-Uj6IVxes.d.ts → registry-Cg1TJVVZ.d.ts} +1 -2
- package/dist/{request-execution-B-dSFlGB.js → request-execution-Dk9rY-Yh.js} +19 -19
- package/dist/{chunk-2rV9d50f.js → rolldown-runtime-B4iAMlE-.js} +2 -2
- 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 +1 -2
- package/dist/runtime/state.d.ts +3 -3
- package/dist/runtime/state.js +6 -6
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +51 -17
- package/dist/runtime.js +320 -60
- package/dist/{search-BpiCF2Tw.js → search-CrTmXj5h.js} +10 -9
- package/dist/server-BNQ-Nbjj.js +290 -0
- package/dist/server.d.ts +22 -34
- package/dist/server.js +2 -328
- package/dist/shared-DalXdP0i.js +2158 -0
- package/dist/source-metadata.d.ts +6 -7
- package/dist/source-metadata.js +7 -7
- package/dist/{state-tYcRWEh2.d.ts → state-B8zbLi5t.d.ts} +3 -3
- package/dist/store-CXgmu-uw.js +1729 -0
- package/dist/{sync-DnTQwt8r.js → sync-CN6ec-5M.js} +61 -41
- package/dist/templates-Bn8a-pd2-D9DhJEVD-CBfXNRzz.js +125 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/{token-CVzURBxC.js → token-CO62GglH.js} +3 -3
- package/dist/{types-CYuwjJ4V.d.ts → types-DeK9GIxy.d.ts} +256 -24
- package/dist/{use-BTNDR5Rd.js → use-BQj7nSz6.js} +82 -41
- package/dist/{use-BiHzt0xA.d.ts → use-DhwhbAVV.d.ts} +16 -11
- package/dist/utils-Blrh4N2n.js +545 -0
- package/dist/vite-BEvgU2GY.js +20909 -0
- package/dist/vite-CcZmMQ7S.d.ts +476 -0
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +2 -2
- package/dist/webhooks-DgHwxxYz-D1V2LOr1-azofFOiP.js +1565 -0
- package/dist/{workspace-Dq08Yn72.js → workspace-6pxkOuxr.js} +361 -230
- package/dist/{workspace-Xddf4G1B.d.ts → workspace-BWJQBK1u.d.ts} +4 -3
- package/package.json +89 -55
- 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/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/runtime-options-BsPSv5O7.js +0 -13
- package/dist/runtime-type-iEE6BjQJ.js +0 -34
- package/dist/shared-DTR1Hhma.js +0 -331
- package/dist/store-Dt_Jyys3.js +0 -608
- package/dist/vite-BptCrpv2.js +0 -4526
- package/dist/vite-CtA9guIM.d.ts +0 -66
package/dist/path-Cp59koVz.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { n as __exportAll } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { relative, resolve, sep } from "node:path";
|
|
3
|
-
import { createHash } from "node:crypto";
|
|
4
|
-
import { minimatch } from "minimatch";
|
|
5
|
-
import { ViteHubError, getViteHubErrorShape } from "@vite-hub/runtime";
|
|
6
|
-
//#region src/core/errors.ts
|
|
7
|
-
function workspaceError(message, options) {
|
|
8
|
-
return new ViteHubError("WORKSPACE_FAILED", message, options);
|
|
9
|
-
}
|
|
10
|
-
function workspaceConflict(message, options) {
|
|
11
|
-
return new ViteHubError("WORKSPACE_CONFLICT", message, options);
|
|
12
|
-
}
|
|
13
|
-
function workspaceConflictError(path, expected, actual) {
|
|
14
|
-
return workspaceConflict(`[vitehub] Workspace path changed before the conditional write: ${path}.`, { details: {
|
|
15
|
-
actual,
|
|
16
|
-
expected,
|
|
17
|
-
path
|
|
18
|
-
} });
|
|
19
|
-
}
|
|
20
|
-
function assertWorkspaceDigest(path, expected, actual) {
|
|
21
|
-
if (expected === null ? actual !== void 0 : actual !== expected) throw workspaceConflictError(path, expected, actual);
|
|
22
|
-
}
|
|
23
|
-
function workspaceNotFoundError(name) {
|
|
24
|
-
return new ViteHubError("WORKSPACE_NOT_FOUND", `[vitehub] Workspace "${name}" is not registered.`, { details: { name } });
|
|
25
|
-
}
|
|
26
|
-
function workspacePathError(path) {
|
|
27
|
-
const publicPath = path.slice(0, 4096);
|
|
28
|
-
return new ViteHubError("WORKSPACE_PATH_INVALID", `[vitehub] Workspace path escapes the workspace root: ${JSON.stringify(publicPath)}.`, { details: { path: publicPath } });
|
|
29
|
-
}
|
|
30
|
-
function isWorkspaceError(value) {
|
|
31
|
-
const code = getViteHubErrorShape(value)?.code;
|
|
32
|
-
return code === "WORKSPACE_COLLECTION_CURSOR_INVALID" || code === "WORKSPACE_CONFLICT" || code === "WORKSPACE_FAILED" || code === "WORKSPACE_NOT_FOUND" || code === "WORKSPACE_PATH_INVALID";
|
|
33
|
-
}
|
|
34
|
-
function isWorkspaceConflict(value) {
|
|
35
|
-
return getViteHubErrorShape(value)?.code === "WORKSPACE_CONFLICT";
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/core/path.ts
|
|
39
|
-
var path_exports = /* @__PURE__ */ __exportAll({
|
|
40
|
-
contentStreamChunks: () => contentStreamChunks,
|
|
41
|
-
contentStreamToBytes: () => contentStreamToBytes,
|
|
42
|
-
contentToBytes: () => contentToBytes,
|
|
43
|
-
decodeFile: () => decodeFile,
|
|
44
|
-
isExcludedWorkspacePath: () => isExcludedWorkspacePath,
|
|
45
|
-
matchesAny: () => matchesAny,
|
|
46
|
-
normalizeSafeWorkspacePath: () => normalizeSafeWorkspacePath,
|
|
47
|
-
normalizeSafeWorkspacePattern: () => normalizeSafeWorkspacePattern,
|
|
48
|
-
normalizeWorkspacePath: () => normalizeWorkspacePath,
|
|
49
|
-
resolveInside: () => resolveInside,
|
|
50
|
-
sha256: () => sha256
|
|
51
|
-
});
|
|
52
|
-
function normalizeWorkspacePath(path = "") {
|
|
53
|
-
return path.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
54
|
-
}
|
|
55
|
-
function isExcludedWorkspacePath(path, excluded = []) {
|
|
56
|
-
const normalized = normalizeWorkspacePath(path);
|
|
57
|
-
return excluded.some((item) => {
|
|
58
|
-
const excludedPath = normalizeWorkspacePath(item);
|
|
59
|
-
return excludedPath === "" || normalized === excludedPath || normalized.startsWith(`${excludedPath}/`);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function normalizeSafeWorkspacePath(path = "", options = {}) {
|
|
63
|
-
const raw = path.replace(/\\/g, "/");
|
|
64
|
-
const normalized = normalizeWorkspacePath(path);
|
|
65
|
-
const parts = normalized.split("/").filter(Boolean);
|
|
66
|
-
if (!options.allowEmpty && !normalized) throw workspacePathError(path);
|
|
67
|
-
if (raw.startsWith("/") || parts.some((part) => part === "." || part === "..")) throw workspacePathError(path);
|
|
68
|
-
if (!options.allowReserved && (parts.some((part) => part.toLowerCase() === ".git") || parts[0] === ".vitehub")) throw workspacePathError(path);
|
|
69
|
-
return normalized;
|
|
70
|
-
}
|
|
71
|
-
function normalizeSafeWorkspacePattern(pattern) {
|
|
72
|
-
return normalizeSafeWorkspacePath(pattern, {
|
|
73
|
-
allowEmpty: true,
|
|
74
|
-
pattern: true
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function resolveInside(root, path = "") {
|
|
78
|
-
const resolvedRoot = resolve(root);
|
|
79
|
-
const resolved = resolve(resolvedRoot, normalizeWorkspacePath(path));
|
|
80
|
-
const rel = relative(resolvedRoot, resolved);
|
|
81
|
-
if (rel.startsWith("..") || rel === ".." || rel.includes(`..${sep}`) || rel === "") {
|
|
82
|
-
if (rel === "") return resolved;
|
|
83
|
-
throw workspacePathError(path);
|
|
84
|
-
}
|
|
85
|
-
return resolved;
|
|
86
|
-
}
|
|
87
|
-
function matchesAny(path, patterns) {
|
|
88
|
-
if (!patterns) return true;
|
|
89
|
-
const list = Array.isArray(patterns) ? patterns : [patterns];
|
|
90
|
-
const normalizedPath = normalizeWorkspacePath(path);
|
|
91
|
-
return list.some((pattern) => minimatch(normalizedPath, normalizeWorkspacePath(pattern), { dot: true }));
|
|
92
|
-
}
|
|
93
|
-
function contentToBytes(content) {
|
|
94
|
-
return typeof content === "string" ? new TextEncoder().encode(content) : content;
|
|
95
|
-
}
|
|
96
|
-
function isReadableStream(value) {
|
|
97
|
-
return Boolean(value && typeof value.getReader === "function");
|
|
98
|
-
}
|
|
99
|
-
async function* contentStreamChunks(stream) {
|
|
100
|
-
if (isReadableStream(stream)) {
|
|
101
|
-
const reader = stream.getReader();
|
|
102
|
-
try {
|
|
103
|
-
while (true) {
|
|
104
|
-
const chunk = await reader.read();
|
|
105
|
-
if (chunk.done) return;
|
|
106
|
-
yield chunk.value;
|
|
107
|
-
}
|
|
108
|
-
} finally {
|
|
109
|
-
reader.releaseLock();
|
|
110
|
-
}
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
yield* stream;
|
|
114
|
-
}
|
|
115
|
-
async function contentStreamToBytes(stream) {
|
|
116
|
-
const chunks = [];
|
|
117
|
-
let size = 0;
|
|
118
|
-
for await (const chunk of contentStreamChunks(stream)) {
|
|
119
|
-
chunks.push(chunk);
|
|
120
|
-
size += chunk.byteLength;
|
|
121
|
-
}
|
|
122
|
-
const bytes = new Uint8Array(size);
|
|
123
|
-
let offset = 0;
|
|
124
|
-
for (const chunk of chunks) {
|
|
125
|
-
bytes.set(chunk, offset);
|
|
126
|
-
offset += chunk.byteLength;
|
|
127
|
-
}
|
|
128
|
-
return bytes;
|
|
129
|
-
}
|
|
130
|
-
function decodeFile(content, options) {
|
|
131
|
-
if (options?.encoding === "binary") return content;
|
|
132
|
-
return typeof content === "string" ? content : new TextDecoder().decode(content);
|
|
133
|
-
}
|
|
134
|
-
async function sha256(input) {
|
|
135
|
-
const bytes = contentToBytes(typeof input === "string" || input instanceof Uint8Array ? input : JSON.stringify(input));
|
|
136
|
-
return createHash("sha256").update(bytes).digest("hex");
|
|
137
|
-
}
|
|
138
|
-
//#endregion
|
|
139
|
-
export { workspaceError as _, isExcludedWorkspacePath as a, normalizeSafeWorkspacePattern as c, resolveInside as d, sha256 as f, workspaceConflict as g, isWorkspaceError as h, decodeFile as i, normalizeWorkspacePath as l, isWorkspaceConflict as m, contentStreamToBytes as n, matchesAny as o, assertWorkspaceDigest as p, contentToBytes as r, normalizeSafeWorkspacePath as s, contentStreamChunks as t, path_exports as u, workspaceNotFoundError as v };
|