@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
package/dist/index.js
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import { n as __exportAll } from "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { t as file } from "./file-
|
|
11
|
-
import { t as github } from "./github-
|
|
12
|
-
import { t as glob } from "./glob-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-rQ84J-ij.js";
|
|
2
|
+
import { r as isWorkspaceConflict, s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
|
|
3
|
+
import { i as assertWorkspaceRules, n as resolveWorkspaceStoreTarget } from "./target-jWhTdIuF.js";
|
|
4
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CtKjGtGb.js";
|
|
5
|
+
import { g as registerWorkspacePlugin, h as resolveWorkspaceAutoCommit } from "./utils-CgMZCHsX.js";
|
|
6
|
+
import { t as createWorkspace } from "./workspace-sPWn2Jxj.js";
|
|
7
|
+
import { m as fetch } from "./config-BAgL2dtB.js";
|
|
8
|
+
import { r as resolveRegisteredWorkspaceDefinition } from "./registry-CNphafBx.js";
|
|
9
|
+
import { r as useWorkspaceFiles } from "./use-CSpT5W87.js";
|
|
10
|
+
import { r as withFileSourceOptions, t as file } from "./file-2pFYNtsU.js";
|
|
11
|
+
import { t as github } from "./github-CrYp4v8k.js";
|
|
12
|
+
import { t as glob } from "./glob-B8YGvTrZ.js";
|
|
13
|
+
import { t as mcpResources } from "./mcp-resources-DF0F5rcL.js";
|
|
14
|
+
import { a as createWorkspaceTools, i as useWorkspace, t as invalidateWorkspaceStore } from "./state-DbrW-njQ.js";
|
|
15
15
|
import { lookup } from "mrmime";
|
|
16
|
-
import { markdown as markdown$1 } from "@vite-hub/source
|
|
17
|
-
import { mcpResources as mcpResources$1 } from "@vite-hub/source/mcp";
|
|
16
|
+
import { markdown as markdown$1, sourceIgnores } from "@vite-hub/source";
|
|
18
17
|
//#region src/core/define.ts
|
|
19
|
-
const workspaceDefinitionKeys = new Set([
|
|
18
|
+
const workspaceDefinitionKeys = /* @__PURE__ */ new Set([
|
|
20
19
|
"bindings",
|
|
21
20
|
"commit",
|
|
22
21
|
"hooks",
|
|
23
22
|
"loaders",
|
|
24
23
|
"plugins",
|
|
25
|
-
"publish",
|
|
26
24
|
"rootDir",
|
|
27
25
|
"rules",
|
|
28
26
|
"sourceRootDir",
|
|
@@ -32,18 +30,20 @@ const workspaceDefinitionKeys = new Set([
|
|
|
32
30
|
function assertWorkspaceDefinitionKeys(definition) {
|
|
33
31
|
const unsupported = Object.keys(definition).filter((key) => !workspaceDefinitionKeys.has(key));
|
|
34
32
|
if (!unsupported.length) return;
|
|
35
|
-
throw
|
|
33
|
+
throw workspaceErrorDiagnostics.WORKSPACE_R0015({ message: `[vitehub] defineWorkspace does not support option${unsupported.length === 1 ? "" : "s"}: ${unsupported.join(", ")}.` });
|
|
36
34
|
}
|
|
37
35
|
function defineWorkspace(definition) {
|
|
38
|
-
if (!definition || typeof definition !== "object") throw
|
|
39
|
-
if ("name" in definition) throw
|
|
36
|
+
if (!definition || typeof definition !== "object") throw workspaceErrorDiagnostics.WORKSPACE_R0016({ message: "[vitehub] defineWorkspace requires a workspace definition." });
|
|
37
|
+
if ("name" in definition) throw workspaceErrorDiagnostics.WORKSPACE_R0017({ message: "[vitehub] Workspace names are inferred from definition filenames." });
|
|
40
38
|
assertWorkspaceDefinitionKeys(definition);
|
|
39
|
+
assertWorkspaceRules(definition.rules);
|
|
40
|
+
for (const plugin of definition.plugins ?? []) assertWorkspaceRules(plugin?.rules);
|
|
41
41
|
return definition;
|
|
42
42
|
}
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/sources/custom.ts
|
|
45
45
|
function custom(source) {
|
|
46
|
-
if (!("files"
|
|
46
|
+
if (!Object.hasOwn(source, "files") || !Array.isArray(source.files)) return source;
|
|
47
47
|
const { files: inputFiles, ...options } = source;
|
|
48
48
|
const files = inputFiles.map((file) => ({
|
|
49
49
|
...file,
|
|
@@ -70,41 +70,7 @@ function custom(source) {
|
|
|
70
70
|
//#endregion
|
|
71
71
|
//#region src/sources/markdown.ts
|
|
72
72
|
function markdown(options) {
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
...withWorkspaceRuntimeOptions(markdown$1(options), options),
|
|
76
|
-
probeKeys: options.probeKeys || [key]
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/sources/mcp-resources.ts
|
|
81
|
-
function mcpResources(options) {
|
|
82
|
-
const livePaths = {};
|
|
83
|
-
const baseSource = mcpResources$1({
|
|
84
|
-
...options,
|
|
85
|
-
cache: options.cache
|
|
86
|
-
});
|
|
87
|
-
return markLiveWorkspaceSource(withWorkspaceRuntimeOptions({
|
|
88
|
-
...baseSource,
|
|
89
|
-
async prepare(ctx) {
|
|
90
|
-
await prepareWorkspaceSource(baseSource, ctx);
|
|
91
|
-
resetLivePaths(livePaths, resolveMountPath(options.mount, ctx), await baseSource.getKeys(ctx));
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
...options,
|
|
95
|
-
materialize: options.materialize || (options.sync ? "none" : "lazy")
|
|
96
|
-
}), livePaths);
|
|
97
|
-
}
|
|
98
|
-
registerMcpResourcesSourceLoader((input) => mcpResources(input));
|
|
99
|
-
function resolveMountPath(mount, ctx) {
|
|
100
|
-
return normalizeSafeWorkspacePath((typeof mount === "string" ? mount : mount?.path) ?? ctx.mountPath ?? ctx.source ?? "", { allowEmpty: true });
|
|
101
|
-
}
|
|
102
|
-
function resetLivePaths(paths, mountPath, keys) {
|
|
103
|
-
for (const path of Object.keys(paths)) delete paths[path];
|
|
104
|
-
for (const key of keys) {
|
|
105
|
-
const path = normalizeSafeWorkspacePath(`${mountPath}/${key}`.replace(/\/+/g, "/"), { allowEmpty: false });
|
|
106
|
-
paths[path] = key;
|
|
107
|
-
}
|
|
73
|
+
return withFileSourceOptions(markdown$1(options), options);
|
|
108
74
|
}
|
|
109
75
|
//#endregion
|
|
110
76
|
//#region src/sources/index.ts
|
|
@@ -140,40 +106,8 @@ function boundedUtf8Bytes(value, limit) {
|
|
|
140
106
|
}
|
|
141
107
|
return bytes;
|
|
142
108
|
}
|
|
143
|
-
function findClosingBrace(pattern, opening) {
|
|
144
|
-
let depth = 0;
|
|
145
|
-
for (let index = opening; index < pattern.length; index++) {
|
|
146
|
-
if (pattern[index] === "\\") {
|
|
147
|
-
index++;
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
if (pattern[index] === "{") depth++;
|
|
151
|
-
else if (pattern[index] === "}" && --depth === 0) return index;
|
|
152
|
-
}
|
|
153
|
-
return -1;
|
|
154
|
-
}
|
|
155
|
-
function splitBraceParts(content, separator) {
|
|
156
|
-
const parts = [];
|
|
157
|
-
let depth = 0;
|
|
158
|
-
let start = 0;
|
|
159
|
-
for (let index = 0; index < content.length; index++) {
|
|
160
|
-
if (content[index] === "\\") {
|
|
161
|
-
index++;
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
if (content[index] === "{") depth++;
|
|
165
|
-
else if (content[index] === "}") depth--;
|
|
166
|
-
else if (depth === 0 && content.startsWith(separator, index)) {
|
|
167
|
-
parts.push(content.slice(start, index));
|
|
168
|
-
index += separator.length - 1;
|
|
169
|
-
start = index + 1;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
parts.push(content.slice(start));
|
|
173
|
-
return parts;
|
|
174
|
-
}
|
|
175
109
|
function sequenceComplexity(content, limit) {
|
|
176
|
-
const parts =
|
|
110
|
+
const parts = content.split("..");
|
|
177
111
|
if (parts.length < 2 || parts.length > 3) return void 0;
|
|
178
112
|
const [rawStart, rawEnd, rawStep] = parts;
|
|
179
113
|
const numeric = /^-?\d+$/;
|
|
@@ -193,18 +127,14 @@ function sequenceComplexity(content, limit) {
|
|
|
193
127
|
function patternComplexity(pattern, limit) {
|
|
194
128
|
let complexity = 1;
|
|
195
129
|
for (let index = 0; index < pattern.length; index++) {
|
|
196
|
-
if (pattern[index] === "\\") {
|
|
197
|
-
index++;
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
130
|
if (pattern[index] === "}") return limit + 1;
|
|
201
131
|
if (pattern[index] !== "{") continue;
|
|
202
|
-
const closing =
|
|
132
|
+
const closing = pattern.indexOf("}", index + 1);
|
|
203
133
|
if (closing === -1) return limit + 1;
|
|
204
134
|
const content = pattern.slice(index + 1, closing);
|
|
205
135
|
if (!content) return limit + 1;
|
|
206
136
|
if (content.includes("{") || content.includes("}")) return limit + 1;
|
|
207
|
-
const alternatives =
|
|
137
|
+
const alternatives = content.split(",");
|
|
208
138
|
let braceComplexity;
|
|
209
139
|
if (alternatives.length > 1) {
|
|
210
140
|
braceComplexity = 0;
|
|
@@ -221,19 +151,19 @@ function patternComplexity(pattern, limit) {
|
|
|
221
151
|
}
|
|
222
152
|
function assertModelWorkspaceGlobPattern(pattern, limits = modelWorkspaceGlobPatternLimits) {
|
|
223
153
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
224
|
-
if (patterns.length > limits.maxPatterns) throw
|
|
154
|
+
if (patterns.length > limits.maxPatterns) throw workspaceErrorDiagnostics.WORKSPACE_R0018({ message: `[vitehub] Workspace glob accepts at most ${limits.maxPatterns} model-facing patterns.` });
|
|
225
155
|
let bytes = 0;
|
|
226
156
|
for (const item of patterns) {
|
|
227
157
|
bytes = boundedAdd(bytes, boundedUtf8Bytes(item, limits.maxBytes), limits.maxBytes);
|
|
228
158
|
if (bytes > limits.maxBytes) break;
|
|
229
159
|
}
|
|
230
|
-
if (bytes > limits.maxBytes) throw
|
|
160
|
+
if (bytes > limits.maxBytes) throw workspaceErrorDiagnostics.WORKSPACE_R0019({ message: `[vitehub] Workspace glob pattern input exceeds the model-facing limit of ${limits.maxBytes} bytes.` });
|
|
231
161
|
let complexity = 0;
|
|
232
162
|
for (const item of patterns) {
|
|
233
163
|
const normalized = item.replace(/\\/g, "/");
|
|
234
164
|
complexity = boundedAdd(complexity, patternComplexity(normalized, limits.maxComplexity), limits.maxComplexity);
|
|
235
|
-
if (complexity > limits.maxComplexity) throw
|
|
165
|
+
if (complexity > limits.maxComplexity) throw workspaceErrorDiagnostics.WORKSPACE_R0020({ message: `[vitehub] Workspace glob pattern complexity exceeds the model-facing limit of ${limits.maxComplexity} expansions.` });
|
|
236
166
|
}
|
|
237
167
|
}
|
|
238
168
|
//#endregion
|
|
239
|
-
export { assertModelWorkspaceGlobPattern, createWorkspace, createWorkspaceTools, custom, defineWorkspace, fetch, file, github, glob, invalidateWorkspaceStore, isWorkspaceConflict, markdown, mcpResources, modelWorkspaceGlobPatternLimits, normalizeSafeWorkspacePath, resolveRegisteredWorkspaceDefinition, resolveWorkspaceAutoCommit, resolveWorkspaceStoreTarget, sources_exports as source, sourceIgnores, useWorkspace };
|
|
169
|
+
export { assertModelWorkspaceGlobPattern, createWorkspace, createWorkspaceTools, custom, defineWorkspace, fetch, file, github, glob, invalidateWorkspaceStore, isWorkspaceConflict, markdown, mcpResources, modelWorkspaceGlobPatternLimits, normalizeSafeWorkspacePath, registerWorkspacePlugin, resolveRegisteredWorkspaceDefinition, resolveWorkspaceAutoCommit, resolveWorkspaceStoreTarget, sources_exports as source, sourceIgnores, useWorkspace, useWorkspaceFiles };
|