@vite-hub/workspace 0.4.1 → 0.5.1
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 +62 -19
- package/dist/{abort-BCwpdrN0.js → abort-CQGxJBqa.js} +1 -2
- package/dist/{asset-registry-DfBV5kmw.js → asset-registry-0CdRAjIV.js} +2 -3
- package/dist/blob-database/postgres.d.ts +423 -0
- package/dist/blob-database/postgres.js +1 -0
- package/dist/blob-database-sources-CQPAyCz3.js +8 -0
- package/dist/blob-database.d.ts +29 -449
- package/dist/blob-database.js +636 -210
- package/dist/checkout.d.ts +1 -2
- package/dist/checkout.js +3 -4
- package/dist/cloudflare.d.ts +1 -5
- package/dist/cloudflare.js +1 -2
- package/dist/{config-B-863EgC.js → config-CsgNNVAI.js} +1 -2
- package/dist/{config-CDeGd0RB.d.ts → config-DeA287c0.d.ts} +1 -5
- package/dist/{config-D1QENneP.js → config-jo5QgE1w.js} +18 -27
- package/dist/{discard-CNNtCozM.js → discard-BkoLmmmN.js} +1 -2
- package/dist/durability.d.ts +10 -4
- package/dist/durability.js +47 -6
- package/dist/{error-diagnostics-B5s9kNEA.js → error-diagnostics-B4me-ouV.js} +11 -4
- package/dist/{error-diagnostics-CQ4BUqRe.js → error-diagnostics-kKXseq8d.js} +10 -3
- package/dist/{path-uxLkzrZm.d.ts → errors-CnFDXxeJ.d.ts} +0 -3
- package/dist/{file-CqG9zqiF.js → file-BrNAXQgY.js} +4 -8
- package/dist/{target-Dm9dHAVJ.js → file-metadata-Bpsvjw_X.js} +3 -32
- package/dist/{files-B6wpAhEx.js → files--z2dLC5z.js} +3 -4
- package/dist/files.d.ts +12 -8
- package/dist/files.js +7 -6
- package/dist/{github-DKAlO0Vh.js → github-k--_LCrX.js} +7 -9
- package/dist/{glob-BOqSKzSg.js → glob-BEutagp1.js} +9 -10
- package/dist/{glob-Cjxms1t7.js → glob-BreFjNAV.js} +3 -4
- package/dist/history-schema-BR4UDPHL.d.ts +434 -0
- package/dist/history-schema-postgres-DZepCSBq.js +40 -0
- package/dist/{host-Bf1a2uo_.js → host-C8yZizfk.js} +153 -22
- package/dist/{hosted-zG7HJaE4.js → hosted-8BTKAtMX.js} +27 -21
- package/dist/{hosted-vercel-blob-AbXG8fvR.js → hosted-vercel-blob-B6kygYqn.js} +10 -12
- package/dist/hosted-vercel-blob.d.ts +1 -3
- package/dist/hosted-vercel-blob.js +1 -2
- package/dist/hosted.d.ts +1 -3
- package/dist/hosted.js +1 -2
- package/dist/index.d.ts +11 -41
- package/dist/index.js +34 -116
- package/dist/internal/path.d.ts +1 -1
- package/dist/internal/path.js +1 -2
- package/dist/internal/workspace.d.ts +10 -0
- package/dist/internal/workspace.js +85 -0
- package/dist/{lifecycle-D8FdpBod.js → lifecycle-IReZfi0b.js} +15 -13
- package/dist/lineage.d.ts +1 -3
- package/dist/lineage.js +1 -2
- package/dist/loader.d.ts +1 -7
- package/dist/loader.js +4 -6
- package/dist/{mcp-resources-DntxtmDU.js → mcp-resources-DeJnbOaw.js} +4 -5
- package/dist/{memory-D5jq9HZW.js → memory-BlSRrBH1.js} +19 -13
- package/dist/{metadata-target-DDoOQNp1.js → metadata-target-CaGLY4ay.js} +214 -77
- package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
- package/dist/{operation-definition-nmRu_O3V.d.ts → operation-definition-CqZkx1Rm.d.ts} +8 -6
- package/dist/{operations-DsY2MQnG.js → operations-CtRDU3cA.js} +34 -29
- package/dist/{operations-D8uCpzhM.js → operations-DfbqHWAe.js} +7 -8
- package/dist/operations.d.ts +2 -6
- package/dist/operations.js +2 -2
- package/dist/{path--wrT_Azm.js → path-Bb9OIc_F.js} +3 -19
- package/dist/{path-zHxQUbqa.d.ts → path-C0uZxDdW.d.ts} +0 -2
- package/dist/{path-DrSIenjj.js → path-CuYE8-X6.js} +2 -4
- package/dist/{plugins-CsrXCA1Q.d.ts → plugins-CLc32jvL.d.ts} +1 -3
- package/dist/{provider-sm9uzkLg.js → provider-CN14ewvx.js} +30 -22
- package/dist/providers/github/store.d.ts +2 -4
- package/dist/providers/github/store.js +1 -2
- package/dist/{registry-CFl1Htyc.d.ts → registry-B0g19sdy.d.ts} +5 -8
- package/dist/{registry-DmVfUe4K.js → registry-BbUg9vJB.js} +10 -6
- package/dist/registry-s2Ob9PeX.d.ts +9 -0
- package/dist/{request-scope-Dw5n8bMC.js → request-scope-CXCI_wCb.js} +4 -4
- package/dist/{results-DgkZUmTL.js → results-z-HpV9EP.js} +1 -2
- package/dist/{rolldown-runtime-rQ84J-ij.js → rolldown-runtime-DnNXxpGL.js} +2 -3
- package/dist/rule-keys-BLEbi1h5.js +18 -0
- package/dist/rules-BPDXypZV.js +267 -0
- package/dist/runtime/assets.d.ts +2 -3
- package/dist/runtime/assets.js +5 -6
- package/dist/runtime/empty-assets-registry.d.ts +1 -3
- package/dist/runtime/empty-assets-registry.js +1 -2
- package/dist/runtime/empty-registry.d.ts +2 -4
- package/dist/runtime/empty-registry.js +1 -2
- package/dist/runtime/registry.d.ts +2 -2
- package/dist/runtime/registry.js +2 -3
- package/dist/runtime/request.d.ts +1 -3
- package/dist/runtime/request.js +2 -3
- package/dist/runtime/state.d.ts +5 -4
- package/dist/runtime/state.js +18 -7
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -2
- package/dist/runtime.d.ts +9 -24
- package/dist/runtime.js +29 -25
- package/dist/{search-C_RfoM2j.js → search-C_nVorq7.js} +3 -4
- package/dist/{server-Cd4-iCh5.js → server-aa1a4rkV.js} +8 -10
- package/dist/server.d.ts +3 -4
- package/dist/server.js +1 -2
- package/dist/{shared-ovXVSV3-.js → shared-C20Wh1mp.js} +23 -19
- package/dist/source-metadata.d.ts +2 -6
- package/dist/source-metadata.js +4 -5
- package/dist/state-BdDfBtOR.d.ts +17 -0
- package/dist/{store-NZoRto-Y.js → store-cx3OqNTi.js} +42 -44
- package/dist/{sync-CrT8zjwc.js → sync-BBfR4g5y.js} +6 -7
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -2
- package/dist/{types-1Z-tKK3g.d.ts → types-Bel5IDmF.d.ts} +52 -6
- package/dist/{use-CjbF8EO9.d.ts → use-CpphIBof.d.ts} +20 -32
- package/dist/{use-B0o5HoBl.js → use-D0DyTMxM.js} +19 -21
- package/dist/use-tools-CAK10LTc.d.ts +10 -0
- package/dist/{state-Cb_hIyAw.js → use-tools-CHduR5k6.js} +8 -24
- package/dist/{utils-Dw-WULEZ.js → utils-DXP9xfXo.js} +80 -273
- package/dist/vite.d.ts +30 -19
- package/dist/vite.js +1481 -1617
- package/dist/vitehub-grants-Co713QTg.js +36 -0
- package/dist/workspace-BOuxrZrP.d.ts +5 -0
- package/dist/{workspace-DvKu5PRa.js → workspace-CLuPkyZR.js} +28 -36
- package/package.json +34 -24
- package/dist/registry-CwryP59t.d.ts +0 -9
- package/dist/state-C-YtsaiJ.d.ts +0 -35
- package/dist/workspace-CIXgHeyX.d.ts +0 -7
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { s as workspaceError } from "./path-CuYE8-X6.js";
|
|
2
|
+
import { l as normalizeWorkspacePath, r as contentToBytes } from "./path-Bb9OIc_F.js";
|
|
3
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
|
|
4
|
+
import { n as cascadingRuleKeys, t as assertWorkspaceRules } from "./rule-keys-BLEbi1h5.js";
|
|
5
|
+
import { lookup } from "mrmime";
|
|
6
|
+
import { minimatch } from "minimatch";
|
|
7
|
+
// src/core/plugins.ts
|
|
8
|
+
const contributedPluginsKey = Symbol.for("vitehub.workspace.contributedPlugins");
|
|
9
|
+
function contributedPluginState() {
|
|
10
|
+
const scope = globalThis;
|
|
11
|
+
scope[contributedPluginsKey] ??= {
|
|
12
|
+
plugins: /* @__PURE__ */ new Map(),
|
|
13
|
+
version: 0
|
|
14
|
+
};
|
|
15
|
+
return scope[contributedPluginsKey];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Add a plugin's rules and hooks to a Workspace by name, including discovered Workspaces the caller does not define.
|
|
19
|
+
* Registering the same plugin id again replaces the earlier registration. A plugin declared by the Workspace Definition
|
|
20
|
+
* with the same id wins. The returned function removes this registration.
|
|
21
|
+
*/
|
|
22
|
+
function registerWorkspacePlugin(workspace, plugin) {
|
|
23
|
+
if (typeof workspace !== "string" || !workspace) throw workspaceErrorDiagnostics.WORKSPACE_R0022({ message: "[vitehub] registerWorkspacePlugin requires a Workspace name." });
|
|
24
|
+
if (!plugin || typeof plugin.id !== "string" || !plugin.id) throw workspaceErrorDiagnostics.WORKSPACE_R0024({ message: "[vitehub] Workspace plugins require an id." });
|
|
25
|
+
assertWorkspaceRules(plugin.rules);
|
|
26
|
+
const state = contributedPluginState();
|
|
27
|
+
let plugins = state.plugins.get(workspace);
|
|
28
|
+
if (!plugins) state.plugins.set(workspace, plugins = /* @__PURE__ */ new Map());
|
|
29
|
+
plugins.set(plugin.id, plugin);
|
|
30
|
+
state.version++;
|
|
31
|
+
return () => {
|
|
32
|
+
if (state.plugins.get(workspace)?.get(plugin.id) !== plugin) return;
|
|
33
|
+
plugins.delete(plugin.id);
|
|
34
|
+
if (!plugins.size) state.plugins.delete(workspace);
|
|
35
|
+
state.version++;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Changes whenever a contributed plugin is added, replaced, or removed. */
|
|
39
|
+
function workspacePluginsVersion() {
|
|
40
|
+
return contributedPluginState().version;
|
|
41
|
+
}
|
|
42
|
+
/** The Definition's own plugins followed by contributed plugins with other ids. */
|
|
43
|
+
function workspaceDefinitionPlugins(definition) {
|
|
44
|
+
const own = definition.plugins ?? [];
|
|
45
|
+
const contributed = contributedPluginState().plugins.get(definition.name);
|
|
46
|
+
if (!contributed?.size) return own;
|
|
47
|
+
const ids = new Set(own.map((plugin) => plugin?.id));
|
|
48
|
+
return [...own, ...[...contributed.values()].filter((plugin) => !ids.has(plugin.id))];
|
|
49
|
+
}
|
|
50
|
+
// src/core/rules.ts
|
|
51
|
+
function normalizeMaxBytes(value) {
|
|
52
|
+
if (value === void 0) return void 0;
|
|
53
|
+
if (typeof value === "number") return value;
|
|
54
|
+
const match = /^(\d+)(kb|mb)$/.exec(value.toLowerCase());
|
|
55
|
+
if (!match) throw workspaceErrorDiagnostics.WORKSPACE_R0023({ message: `[vitehub] Invalid workspace rule maxBytes value "${value}".` });
|
|
56
|
+
const count = Number(match[1]);
|
|
57
|
+
return match[2] === "kb" ? count * 1024 : count * 1024 * 1024;
|
|
58
|
+
}
|
|
59
|
+
function toArray(value) {
|
|
60
|
+
if (value === void 0) return [];
|
|
61
|
+
return Array.isArray(value) ? value : [value];
|
|
62
|
+
}
|
|
63
|
+
function mergeHooks(left = {}, right = {}) {
|
|
64
|
+
return {
|
|
65
|
+
"write:after": [...toArray(left["write:after"]), ...toArray(right["write:after"])],
|
|
66
|
+
"write:before": [...toArray(left["write:before"]), ...toArray(right["write:before"])],
|
|
67
|
+
"write:error": [...toArray(left["write:error"]), ...toArray(right["write:error"])],
|
|
68
|
+
"write:validate": [...toArray(left["write:validate"]), ...toArray(right["write:validate"])]
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Merges rules on the same pattern field by field. A later rule replaces only the fields it sets, and validators add up. */
|
|
72
|
+
function mergeRules(left, right = {}) {
|
|
73
|
+
assertWorkspaceRules(right);
|
|
74
|
+
const merged = { ...left };
|
|
75
|
+
for (const [pattern, rule] of Object.entries(right)) {
|
|
76
|
+
const previous = merged[pattern];
|
|
77
|
+
if (!previous) {
|
|
78
|
+
merged[pattern] = rule;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const next = {
|
|
82
|
+
...previous,
|
|
83
|
+
validate: [...toArray(previous.validate), ...toArray(rule.validate)]
|
|
84
|
+
};
|
|
85
|
+
if (rule.commit !== void 0) next.commit = rule.commit;
|
|
86
|
+
if (rule.maxBytes !== void 0) next.maxBytes = rule.maxBytes;
|
|
87
|
+
if (rule.mediaType !== void 0) next.mediaType = rule.mediaType;
|
|
88
|
+
if (rule.write !== void 0) next.write = rule.write;
|
|
89
|
+
merged[pattern] = next;
|
|
90
|
+
}
|
|
91
|
+
return merged;
|
|
92
|
+
}
|
|
93
|
+
function normalizeRules(rules) {
|
|
94
|
+
return Object.entries(rules).map(([pattern, rule]) => {
|
|
95
|
+
const normalizedPattern = normalizeWorkspacePath(pattern);
|
|
96
|
+
return {
|
|
97
|
+
...rule,
|
|
98
|
+
maxBytes: normalizeMaxBytes(rule.maxBytes),
|
|
99
|
+
pattern: normalizedPattern,
|
|
100
|
+
specificity: normalizedPattern.replace(/\*/g, "").length,
|
|
101
|
+
validate: toArray(rule.validate)
|
|
102
|
+
};
|
|
103
|
+
}).sort((left, right) => left.specificity - right.specificity || left.pattern.localeCompare(right.pattern));
|
|
104
|
+
}
|
|
105
|
+
function normalizePolicy(definition) {
|
|
106
|
+
let hooks = {};
|
|
107
|
+
let rules = {};
|
|
108
|
+
for (const plugin of workspaceDefinitionPlugins(definition)) {
|
|
109
|
+
if (!plugin?.id) throw workspaceErrorDiagnostics.WORKSPACE_R0024({ message: "[vitehub] Workspace plugins require an id." });
|
|
110
|
+
rules = mergeRules(rules, plugin.rules);
|
|
111
|
+
hooks = mergeHooks(hooks, plugin.hooks);
|
|
112
|
+
}
|
|
113
|
+
rules = mergeRules(rules, definition.rules);
|
|
114
|
+
hooks = mergeHooks(hooks, definition.hooks);
|
|
115
|
+
return {
|
|
116
|
+
hooks,
|
|
117
|
+
rules: normalizeRules(rules)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Resolves every rule that matches the path, from the least to the most specific. A more specific rule replaces a
|
|
122
|
+
* field only when it sets that field, so `"docs/**": { maxBytes }` keeps a broader `write: false`. Validators of every
|
|
123
|
+
* matching rule run, the least specific first.
|
|
124
|
+
*/
|
|
125
|
+
function matchRule(policy, path) {
|
|
126
|
+
const normalized = normalizeWorkspacePath(path);
|
|
127
|
+
let matched;
|
|
128
|
+
for (const rule of policy.rules) {
|
|
129
|
+
const globstarDirectory = rule.pattern.endsWith("/**") ? rule.pattern.slice(0, -3) : void 0;
|
|
130
|
+
if (!minimatch(normalized, rule.pattern, { dot: true }) && normalized !== globstarDirectory) continue;
|
|
131
|
+
matched ??= {
|
|
132
|
+
origins: {},
|
|
133
|
+
rule: {
|
|
134
|
+
pattern: rule.pattern,
|
|
135
|
+
validate: []
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
matched.rule.pattern = rule.pattern;
|
|
139
|
+
matched.rule.validate = [...matched.rule.validate, ...rule.validate];
|
|
140
|
+
for (const key of cascadingRuleKeys) {
|
|
141
|
+
if (rule[key] === void 0) continue;
|
|
142
|
+
matched.origins[key] = rule.pattern;
|
|
143
|
+
Object.assign(matched.rule, { [key]: rule[key] });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return matched;
|
|
147
|
+
}
|
|
148
|
+
function writeAllowed(write, operation, exists) {
|
|
149
|
+
if (write === void 0 || write === true) return true;
|
|
150
|
+
if (write === false) return false;
|
|
151
|
+
if (write === "delete") return operation === "rm";
|
|
152
|
+
if (write === "create") return operation !== "rm" && !exists;
|
|
153
|
+
if (write === "update") return operation === "writeFile" && exists;
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
function sizeOf(content) {
|
|
157
|
+
return content === void 0 ? 0 : contentToBytes(content).byteLength;
|
|
158
|
+
}
|
|
159
|
+
/** The media type that a file write stores: the one the caller passed, else the one its path implies. */
|
|
160
|
+
function writeMediaType(input) {
|
|
161
|
+
return input.mediaType || lookup(input.path) || "application/octet-stream";
|
|
162
|
+
}
|
|
163
|
+
function assertRuleAllows(input, matched) {
|
|
164
|
+
if (!matched) return;
|
|
165
|
+
const { origins, rule } = matched;
|
|
166
|
+
const exists = Boolean(input.previous);
|
|
167
|
+
if (!writeAllowed(rule.write, input.operation, exists)) throw workspaceError(`[vitehub] Workspace rule "${origins.write}" does not allow ${input.operation} for ${input.path}.`);
|
|
168
|
+
if (rule.maxBytes !== void 0 && sizeOf(input.content) > rule.maxBytes) throw workspaceError(`[vitehub] Workspace rule "${origins.maxBytes}" limits writes to ${rule.maxBytes} bytes: ${input.path}.`);
|
|
169
|
+
if (rule.mediaType && input.operation === "writeFile") {
|
|
170
|
+
const allowed = Array.isArray(rule.mediaType) ? rule.mediaType : [rule.mediaType];
|
|
171
|
+
const mediaType = writeMediaType(input);
|
|
172
|
+
if (!allowed.includes(mediaType)) throw workspaceError(`[vitehub] Workspace rule "${origins.mediaType}" does not allow media type ${mediaType}: ${input.path}.`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/** Stores the media type that the rule checked, so the stored file cannot get another type from the Store. */
|
|
176
|
+
function withCheckedMediaType(input, matched) {
|
|
177
|
+
if (!matched?.rule.mediaType || input.operation !== "writeFile" || input.mediaType) return input;
|
|
178
|
+
return {
|
|
179
|
+
...input,
|
|
180
|
+
mediaType: writeMediaType(input)
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
async function runHooks(hooks, name, input) {
|
|
184
|
+
for (const hook of toArray(hooks[name])) await hook(input);
|
|
185
|
+
}
|
|
186
|
+
async function runValidators(validators, input) {
|
|
187
|
+
let current = input;
|
|
188
|
+
for (const validate of validators) {
|
|
189
|
+
const result = await validate(current);
|
|
190
|
+
if (result === false) throw workspaceError(`[vitehub] Workspace validator rejected ${current.operation} for ${current.path}.`);
|
|
191
|
+
if (typeof result === "object" && result !== null) current = result;
|
|
192
|
+
}
|
|
193
|
+
return current;
|
|
194
|
+
}
|
|
195
|
+
function createWorkspaceWritePolicy(definition) {
|
|
196
|
+
let cached = {
|
|
197
|
+
version: workspacePluginsVersion(),
|
|
198
|
+
policy: normalizePolicy(definition)
|
|
199
|
+
};
|
|
200
|
+
const currentPolicy = () => {
|
|
201
|
+
const version = workspacePluginsVersion();
|
|
202
|
+
if (cached.version !== version) cached = {
|
|
203
|
+
version,
|
|
204
|
+
policy: normalizePolicy(definition)
|
|
205
|
+
};
|
|
206
|
+
return cached.policy;
|
|
207
|
+
};
|
|
208
|
+
return {
|
|
209
|
+
check(input) {
|
|
210
|
+
const matched = matchRule(currentPolicy(), input.path);
|
|
211
|
+
const checked = {
|
|
212
|
+
...input,
|
|
213
|
+
rule: matched?.rule
|
|
214
|
+
};
|
|
215
|
+
assertRuleAllows(checked, matched);
|
|
216
|
+
return withCheckedMediaType(checked, matched);
|
|
217
|
+
},
|
|
218
|
+
async before(input) {
|
|
219
|
+
const policy = currentPolicy();
|
|
220
|
+
const matched = matchRule(policy, input.path);
|
|
221
|
+
const rule = matched?.rule;
|
|
222
|
+
let current = {
|
|
223
|
+
...input,
|
|
224
|
+
rule
|
|
225
|
+
};
|
|
226
|
+
await runHooks(policy.hooks, "write:before", current);
|
|
227
|
+
current = {
|
|
228
|
+
...current,
|
|
229
|
+
rule
|
|
230
|
+
};
|
|
231
|
+
assertRuleAllows(current, matched);
|
|
232
|
+
if (rule?.validate.length) current = await runValidators(rule.validate, current);
|
|
233
|
+
await runHooks(policy.hooks, "write:validate", current);
|
|
234
|
+
current = {
|
|
235
|
+
...current,
|
|
236
|
+
rule
|
|
237
|
+
};
|
|
238
|
+
assertRuleAllows(current, matched);
|
|
239
|
+
return withCheckedMediaType(current, matched);
|
|
240
|
+
},
|
|
241
|
+
async after(input) {
|
|
242
|
+
await runHooks(currentPolicy().hooks, "write:after", input);
|
|
243
|
+
},
|
|
244
|
+
async error(input, error) {
|
|
245
|
+
for (const hook of toArray(currentPolicy().hooks["write:error"])) await hook({
|
|
246
|
+
...input,
|
|
247
|
+
error
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function resolveWorkspaceAutoCommit(definition, diff) {
|
|
253
|
+
if (!diff.entries.length) return;
|
|
254
|
+
if (definition.commit === true || typeof definition.commit === "string") return {
|
|
255
|
+
message: (typeof definition.commit === "string" ? definition.commit.trim() : "") || `chore: update ${definition.name} workspace`,
|
|
256
|
+
paths: diff.entries.map((entry) => normalizeWorkspacePath(entry.path))
|
|
257
|
+
};
|
|
258
|
+
const policy = normalizePolicy(definition);
|
|
259
|
+
const paths = diff.entries.map((entry) => normalizeWorkspacePath(entry.path));
|
|
260
|
+
const rules = paths.map((path) => matchRule(policy, path)?.rule);
|
|
261
|
+
if (!rules.length || rules.some((rule) => !rule?.commit)) return;
|
|
262
|
+
return {
|
|
263
|
+
message: rules.map((rule) => rule?.commit).find((commit) => typeof commit === "string" && commit.trim().length > 0)?.trim() || `chore: update ${definition.name} workspace`,
|
|
264
|
+
paths
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
export { workspaceDefinitionPlugins as i, resolveWorkspaceAutoCommit as n, registerWorkspacePlugin as r, createWorkspaceWritePolicy as t };
|
package/dist/runtime/assets.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/runtime/assets.d.ts
|
|
1
|
+
import { O as WorkspaceAssets, P as WorkspaceContent } from "../types-Bel5IDmF.js";
|
|
3
2
|
interface WorkspaceAssetFile {
|
|
4
3
|
load: () => Promise<WorkspaceContent>;
|
|
5
4
|
mediaType?: string;
|
|
@@ -7,4 +6,4 @@ interface WorkspaceAssetFile {
|
|
|
7
6
|
}
|
|
8
7
|
type WorkspaceAssetFiles<TKey extends string = string> = Record<TKey, WorkspaceAssetFile>;
|
|
9
8
|
export declare function createWorkspaceAssets<TKey extends string = string>(files: WorkspaceAssetFiles<TKey>): WorkspaceAssets<TKey>;
|
|
10
|
-
|
|
9
|
+
export {};
|
package/dist/runtime/assets.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as isWorkspaceError, s as workspaceError, t as normalizeSafeWorkspacePath } from "../path-
|
|
2
|
-
import { a as isExcludedWorkspacePath,
|
|
3
|
-
import { t as createWorkspaceGlobMatcher } from "../glob-
|
|
4
|
-
import { t as searchText } from "../search-
|
|
5
|
-
|
|
1
|
+
import { i as isWorkspaceError, s as workspaceError, t as normalizeSafeWorkspacePath } from "../path-CuYE8-X6.js";
|
|
2
|
+
import { a as isExcludedWorkspacePath, d as sha256, i as decodeFile, l as normalizeWorkspacePath } from "../path-Bb9OIc_F.js";
|
|
3
|
+
import { t as createWorkspaceGlobMatcher } from "../glob-BreFjNAV.js";
|
|
4
|
+
import { t as searchText } from "../search-C_nVorq7.js";
|
|
5
|
+
// src/runtime/assets.ts
|
|
6
6
|
function createMissingPathError(path) {
|
|
7
7
|
return workspaceError(`[vitehub] Workspace file does not exist: ${path}.`);
|
|
8
8
|
}
|
|
@@ -137,5 +137,4 @@ function createWorkspaceAssets(files) {
|
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
//#endregion
|
|
141
140
|
export { createWorkspaceAssets };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/runtime/empty-assets-registry.d.ts
|
|
1
|
+
import { k as WorkspaceAssetsRegistry } from "../types-Bel5IDmF.js";
|
|
3
2
|
declare const registry: WorkspaceAssetsRegistry;
|
|
4
|
-
//#endregion
|
|
5
3
|
export { registry as default };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { t as WorkspaceRegistry } from "../registry-
|
|
2
|
-
import "../registry-
|
|
3
|
-
//#region src/runtime/empty-registry.d.ts
|
|
1
|
+
import { t as WorkspaceRegistry } from "../registry-B0g19sdy.js";
|
|
2
|
+
import "../registry-s2Ob9PeX.js";
|
|
4
3
|
declare const registry: WorkspaceRegistry;
|
|
5
|
-
//#endregion
|
|
6
4
|
export { registry as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { WorkspaceRegistry, WorkspaceRegistryModule, resetWorkspaceRuntimeRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState };
|
|
1
|
+
import { a as setWorkspaceRuntimeRegistry, c as setWorkspaceRuntimeConfig, i as resetWorkspaceRuntimeRegistry, n as WorkspaceRegistryLoader, o as workspaceRuntimeRegistryState, r as WorkspaceRegistryModule, t as WorkspaceRegistry } from "../registry-B0g19sdy.js";
|
|
2
|
+
export { WorkspaceRegistry, WorkspaceRegistryLoader, WorkspaceRegistryModule, resetWorkspaceRuntimeRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState };
|
package/dist/runtime/registry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as setWorkspaceRuntimeConfig } from "../config-
|
|
1
|
+
import { n as setWorkspaceRuntimeConfig } from "../config-CsgNNVAI.js";
|
|
2
2
|
import runtimeRegistry from "#vitehub-workspace-registry";
|
|
3
|
-
|
|
3
|
+
// src/runtime/registry.ts
|
|
4
4
|
const workspaceRuntimeRegistryKey = Symbol.for("vitehub.workspace.runtimeRegistry");
|
|
5
5
|
function workspaceRuntimeRegistryState() {
|
|
6
6
|
const scope = globalThis;
|
|
@@ -19,5 +19,4 @@ function setWorkspaceRuntimeRegistry(registry) {
|
|
|
19
19
|
function resetWorkspaceRuntimeRegistry() {
|
|
20
20
|
setWorkspaceRuntimeRegistry(runtimeRegistry);
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { resetWorkspaceRuntimeRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState };
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
//#region src/runtime/request.d.ts
|
|
2
1
|
/** Nitro middleware: runs the rest of the request in its own Workspace request scope. */
|
|
3
|
-
export default function workspaceRequestMiddleware(_event: unknown, next: () => unknown): Promise<unknown>;
|
|
4
|
-
//#endregion
|
|
2
|
+
export default function workspaceRequestMiddleware(_event: unknown, next: () => unknown): Promise<unknown>;
|
package/dist/runtime/request.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { t as runWorkspaceRequest } from "../request-scope-
|
|
2
|
-
|
|
1
|
+
import { t as runWorkspaceRequest } from "../request-scope-CXCI_wCb.js";
|
|
2
|
+
// src/runtime/request.ts
|
|
3
3
|
/** Nitro middleware: runs the rest of the request in its own Workspace request scope. */
|
|
4
4
|
function workspaceRequestMiddleware(_event, next) {
|
|
5
5
|
return runWorkspaceRequest(next);
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { workspaceRequestMiddleware as default };
|
package/dist/runtime/state.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, h as WritableWorkspaceFacade, i as ReadonlyWorkspaceFacade, s as UseWorkspaceOptions, x as useWorkspaceFiles } from "../use-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, h as WritableWorkspaceFacade, i as ReadonlyWorkspaceFacade, s as UseWorkspaceOptions, x as useWorkspaceFiles } from "../use-CpphIBof.js";
|
|
2
|
+
import { c as setWorkspaceRuntimeConfig, s as getWorkspaceRuntimeConfig } from "../registry-B0g19sdy.js";
|
|
3
|
+
import { i as setWorkspaceRuntimeDefinitions, n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "../registry-s2Ob9PeX.js";
|
|
4
|
+
import { t as useWorkspace } from "../use-tools-CAK10LTc.js";
|
|
5
|
+
import { a as setActiveCloudflareEnv, c as getWorkspaceHostedStoreLoader, i as resetWorkspaceStoreCache, l as setWorkspaceHostedStoreLoader, n as setWorkspaceRuntimeAssetsRegistry, r as setWorkspaceRuntimeRegistry, t as invalidateWorkspaceStore } from "../state-BdDfBtOR.js";
|
|
5
6
|
export { type ReadonlyWorkspaceFacade, type ReadonlyWorkspaceFiles, type UseWorkspaceOptions, type WritableWorkspaceFacade, type WritableWorkspaceFiles, getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, invalidateWorkspaceStore, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setActiveCloudflareEnv, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeDefinitions, setWorkspaceRuntimeRegistry, useWorkspace, useWorkspaceFiles };
|
package/dist/runtime/state.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { r as useWorkspaceFiles } from "../use-
|
|
7
|
-
import {
|
|
1
|
+
import { a as setWorkspaceRegistry, i as resolveRegisteredWorkspaceDefinition, o as setWorkspaceRuntimeDefinitions, r as registerWorkspace } from "../registry-BbUg9vJB.js";
|
|
2
|
+
import { t as setWorkspaceAssetsRegistry } from "../asset-registry-0CdRAjIV.js";
|
|
3
|
+
import { n as invalidateCachedWorkspaceStore, r as resetWorkspaceStoreCache } from "../workspace-CLuPkyZR.js";
|
|
4
|
+
import { A as setActiveCloudflareEnv } from "../shared-C20Wh1mp.js";
|
|
5
|
+
import { t as useWorkspace } from "../use-tools-CHduR5k6.js";
|
|
6
|
+
import { r as useWorkspaceFiles } from "../use-D0DyTMxM.js";
|
|
7
|
+
import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "../provider-CN14ewvx.js";
|
|
8
|
+
import { n as setWorkspaceRuntimeConfig, t as getWorkspaceRuntimeConfig } from "../config-CsgNNVAI.js";
|
|
9
|
+
// src/runtime/state.ts
|
|
10
|
+
async function invalidateWorkspaceStore(name) {
|
|
11
|
+
invalidateCachedWorkspaceStore(await resolveRegisteredWorkspaceDefinition(name));
|
|
12
|
+
}
|
|
13
|
+
function setWorkspaceRuntimeRegistry(registry) {
|
|
14
|
+
setWorkspaceRegistry(registry);
|
|
15
|
+
}
|
|
16
|
+
function setWorkspaceRuntimeAssetsRegistry(registry) {
|
|
17
|
+
setWorkspaceAssetsRegistry(registry);
|
|
18
|
+
}
|
|
8
19
|
export { getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, invalidateWorkspaceStore, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setActiveCloudflareEnv, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeDefinitions, setWorkspaceRuntimeRegistry, useWorkspace, useWorkspaceFiles };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createWorkspace } from "../workspace-
|
|
1
|
+
import { t as createWorkspace } from "../workspace-BOuxrZrP.js";
|
|
2
2
|
export { createWorkspace };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createWorkspace };
|
|
1
|
+
export { t as createWorkspace } from "../workspace-CLuPkyZR.js";
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { c as setWorkspaceRuntimeConfig, s as getWorkspaceRuntimeConfig } from "./registry-B0g19sdy.js";
|
|
2
|
+
import { c as getWorkspaceHostedStoreLoader, i as resetWorkspaceStoreCache, l as setWorkspaceHostedStoreLoader, n as setWorkspaceRuntimeAssetsRegistry, o as HostedWorkspaceStoreOptions, r as setWorkspaceRuntimeRegistry, s as WorkspaceHostedStoreLoader, t as invalidateWorkspaceStore } from "./state-BdDfBtOR.js";
|
|
3
|
+
import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, h as WritableWorkspaceFacade, i as ReadonlyWorkspaceFacade, o as ReadonlyWorkspaceFs, s as UseWorkspaceOptions, v as WritableWorkspaceFs, x as useWorkspaceFiles } from "./use-CpphIBof.js";
|
|
4
|
+
import { i as setWorkspaceRuntimeDefinitions, n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "./registry-s2Ob9PeX.js";
|
|
5
|
+
import { Dt as WorkspaceName, E as Workspace, Ft as WorkspaceRetainedHistory, L as WorkspaceDefinition, Ut as WorkspaceSelectedScope, V as WorkspaceEntry, Zt as WorkspaceSource, bt as WorkspaceMaterializeSourcesResult, cn as WorkspaceSourceRequestExecutionInput, hn as WorkspaceSourceResolutionInvocation, ln as WorkspaceSourceRequestExecutionResult, ot as WorkspaceHistoryReader, sn as WorkspaceSourceRequestDescriptor } from "./types-Bel5IDmF.js";
|
|
6
|
+
import { t as useWorkspace } from "./use-tools-CAK10LTc.js";
|
|
7
|
+
import { t as registerWorkspacePlugin } from "./plugins-CLc32jvL.js";
|
|
8
|
+
import { a as getWorkspaceSourceRequestDescriptor, i as workspaceSourceGrantPaths, n as normalizeWorkspaceSourceMetadata, o as isWorkspaceSourceRequestOnly, r as normalizeWorkspaceSourcesMetadata, s as workspaceSourceRequestDescriptorPath, t as WorkspaceSourceMetadata } from "./config-DeA287c0.js";
|
|
9
9
|
interface WorkspaceDependencyRuntimeLoaders {
|
|
10
10
|
shellWorkspace: () => Promise<unknown>;
|
|
11
11
|
}
|
|
12
12
|
export declare function setWorkspaceDependencyRuntimeLoaders(loaders: Partial<WorkspaceDependencyRuntimeLoaders> | undefined): void;
|
|
13
13
|
export declare function getWorkspaceDependencyRuntimeLoaders(): WorkspaceDependencyRuntimeLoaders;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/sources/resolution.d.ts
|
|
16
14
|
interface WorkspaceSourceResolutionOptions {
|
|
17
15
|
invocation: WorkspaceSourceResolutionInvocation<object>;
|
|
18
16
|
overlay?: boolean;
|
|
@@ -27,15 +25,9 @@ export declare function hasWorkspaceSourceResolvers(definition: Pick<WorkspaceDe
|
|
|
27
25
|
export declare function forwardWorkspaceFacade(source: WritableWorkspaceFacade, target: WritableWorkspaceFacade): void;
|
|
28
26
|
export declare function resolveWorkspaceSources(definition: WorkspaceDefinition, options: WorkspaceSourceResolutionOptions): Promise<WorkspaceDefinition>;
|
|
29
27
|
export declare function createWorkspaceSourceResolutionFacade<Name extends WorkspaceName = WorkspaceName>(workspace: ReadonlyWorkspaceFacade<Name>, definition: WorkspaceDefinition, options: WorkspaceSourceResolutionOptions): Promise<WorkspaceSourceResolutionFacade<Name>>;
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/core/history.d.ts
|
|
32
28
|
/** Forward history only when the caller can inspect the complete folder. */
|
|
33
|
-
export declare function createWorkspaceHistoryReader(history: WorkspaceHistoryReader | undefined, complete: boolean): WorkspaceHistoryReader
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/sources/live.d.ts
|
|
29
|
+
export declare function createWorkspaceHistoryReader(history: WorkspaceHistoryReader | undefined, complete: boolean): WorkspaceHistoryReader & Pick<WorkspaceRetainedHistory, "diff">;
|
|
36
30
|
export declare function markLiveWorkspaceSource(source: WorkspaceSource, paths: Record<string, string>): WorkspaceSource;
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/storage/metadata-target.d.ts
|
|
39
31
|
/** An object that can carry a metadata target: a Workspace, a Workspace facade, or the `fs` of a facade. */
|
|
40
32
|
type WorkspaceMetadataCarrier = Workspace | ReadonlyWorkspaceFiles | WritableWorkspaceFiles | ReadonlyWorkspaceFs | WritableWorkspaceFs;
|
|
41
33
|
/**
|
|
@@ -45,16 +37,12 @@ type WorkspaceMetadataCarrier = Workspace | ReadonlyWorkspaceFiles | WritableWor
|
|
|
45
37
|
* Internal: `@vite-hub/agent` uses this for its Workspace facades.
|
|
46
38
|
*/
|
|
47
39
|
export declare function forwardWorkspaceMetadataView(source: unknown, target: WorkspaceMetadataCarrier, filterEntries?: (entries: WorkspaceEntry[]) => WorkspaceEntry[]): void;
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/sources/request-execution.d.ts
|
|
50
40
|
interface WorkspaceSourceRequestExecutionTarget {
|
|
51
41
|
executeSourceRequest(input: WorkspaceSourceRequestExecutionInput): Promise<WorkspaceSourceRequestExecutionResult>;
|
|
52
42
|
}
|
|
53
43
|
export declare function attachWorkspaceSourceRequestExecution<T extends object>(target: T, executor: WorkspaceSourceRequestExecutionTarget | undefined): T;
|
|
54
44
|
export declare function getWorkspaceSourceRequestExecution(input: unknown): WorkspaceSourceRequestExecutionTarget | undefined;
|
|
55
45
|
export declare function workspaceSourceRequestMatches(descriptor: WorkspaceSourceRequestDescriptor, input: WorkspaceSourceRequestExecutionInput): boolean;
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region src/runtime/preparation.d.ts
|
|
58
46
|
type WorkspacePreparationState = {
|
|
59
47
|
status: "stopped";
|
|
60
48
|
stoppedAt: string;
|
|
@@ -90,8 +78,6 @@ interface WorkspacePreparation {
|
|
|
90
78
|
stop(): Promise<void>;
|
|
91
79
|
}
|
|
92
80
|
export declare function createWorkspacePreparation<Name extends WorkspaceName = WorkspaceName>(options: WorkspacePreparationOptions<Name>): WorkspacePreparation;
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/storage/recover-local-locks.d.ts
|
|
95
81
|
/**
|
|
96
82
|
* Remove abandoned markers from a trusted, exclusively owned local store.
|
|
97
83
|
* Stop all store users and prevent changes to the store and its ancestor directories
|
|
@@ -104,5 +90,4 @@ export declare function recoverLocalWorkspaceLocks(options: {
|
|
|
104
90
|
}): Promise<{
|
|
105
91
|
removed: number;
|
|
106
92
|
}>;
|
|
107
|
-
//#endregion
|
|
108
93
|
export { type HostedWorkspaceStoreOptions, type ReadonlyWorkspaceFacade, type ReadonlyWorkspaceFiles, type UseWorkspaceOptions, type WorkspaceDependencyRuntimeLoaders, type WorkspaceHostedStoreLoader, type WorkspacePreparation, type WorkspacePreparationOptions, type WorkspacePreparationState, type WorkspaceSourceMetadata, type WorkspaceSourceResolutionFacade, type WorkspaceSourceResolutionOptions, type WritableWorkspaceFacade, type WritableWorkspaceFiles, getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, getWorkspaceSourceRequestDescriptor, invalidateWorkspaceStore, isWorkspaceSourceRequestOnly, normalizeWorkspaceSourceMetadata, normalizeWorkspaceSourcesMetadata, registerWorkspace, registerWorkspacePlugin, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeDefinitions, setWorkspaceRuntimeRegistry, useWorkspace, useWorkspaceFiles, workspaceSourceGrantPaths, workspaceSourceRequestDescriptorPath };
|
package/dist/runtime.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { a as
|
|
15
|
-
import { a as
|
|
1
|
+
import { n as setWorkspaceRuntimeConfig, t as getWorkspaceRuntimeConfig } from "./config-CsgNNVAI.js";
|
|
2
|
+
import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "./provider-CN14ewvx.js";
|
|
3
|
+
import { i as setWorkspaceDependencyRuntimeLoaders, n as createWorkspaceTools, r as getWorkspaceDependencyRuntimeLoaders, t as useWorkspace } from "./use-tools-CHduR5k6.js";
|
|
4
|
+
import { invalidateWorkspaceStore, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeRegistry } from "./runtime/state.js";
|
|
5
|
+
import { _ as isWorkspaceSourceRequestOnly, a as normalizeWorkspaceSources, b as markLiveWorkspaceSource, f as prepareWorkspaceSource, h as getWorkspaceSourceRequestDescriptor, i as normalizeWorkspaceSourceMetadata, l as workspaceSourceGrantPaths, o as normalizeWorkspaceSourcesMetadata, r as normalizeWorkspaceSource, t as copyWorkspaceSourceMetadata, u as ownSourceOption, v as workspaceSourceRequestDescriptorPath } from "./config-jo5QgE1w.js";
|
|
6
|
+
import { s as workspaceError } from "./path-CuYE8-X6.js";
|
|
7
|
+
import { l as normalizeWorkspacePath } from "./path-Bb9OIc_F.js";
|
|
8
|
+
import { a as createWorkspaceHistoryReader, c as forwardWorkspaceHistoryFiles, i as createWorkspaceHistory, l as forwardWorkspaceHistoryMerge } from "./utils-DXP9xfXo.js";
|
|
9
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
|
|
10
|
+
import { r as registerWorkspacePlugin, t as createWorkspaceWritePolicy } from "./rules-BPDXypZV.js";
|
|
11
|
+
import { a as copyWorkspacePath, i as appendWorkspaceFile, r as useWorkspaceFiles } from "./use-D0DyTMxM.js";
|
|
12
|
+
import { _ as workspaceSourceRequestMatches, a as isInternalWorkspaceMetaKey, c as isWorkspaceSourceSyncMetaKey, g as getWorkspaceSourceRequestExecution, h as createWorkspaceSourceRequestExecution, m as attachWorkspaceSourceRequestExecution, o as createWorkspaceSourceView, p as resolveWorkspacePath, r as resetWorkspaceStoreCache, v as createBasicWorkspaceSession } from "./workspace-CLuPkyZR.js";
|
|
13
|
+
import { t as createMemoryWorkspaceStore } from "./memory-BlSRrBH1.js";
|
|
14
|
+
import { M as registerWorkspaceStoreAlias, a as resolveWorkspaceMetadataMutationTarget, i as forwardWorkspaceMetadataView, n as createWorkspaceMetadataTarget, o as resolveWorkspaceMetadataTarget, r as forwardWorkspaceMetadataTarget, s as setWorkspaceMetadata, t as attachWorkspaceMetadataTarget } from "./metadata-target-CaGLY4ay.js";
|
|
15
|
+
import { a as provideWorkspaceStoreTarget, i as forwardWorkspaceStoreTarget, o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
|
|
16
|
+
import { t as isRecord } from "./object-CAK6UYR5.js";
|
|
17
|
+
import { i as resolveRegisteredWorkspaceDefinition, o as setWorkspaceRuntimeDefinitions, r as registerWorkspace } from "./registry-BbUg9vJB.js";
|
|
16
18
|
import { join, resolve } from "node:path";
|
|
17
19
|
import { randomUUID } from "node:crypto";
|
|
18
20
|
import { lstat, readdir, rename, rm } from "node:fs/promises";
|
|
19
|
-
|
|
21
|
+
// src/sources/resolution.ts
|
|
20
22
|
function hasWorkspaceSourceResolvers(definition) {
|
|
21
23
|
return normalizeWorkspaceSources(definition?.sources).some((source) => typeof source.source.resolve === "function");
|
|
22
24
|
}
|
|
@@ -144,8 +146,7 @@ function createOverlaySourceStore(workspace, fallback, backingMetadataTarget) {
|
|
|
144
146
|
return;
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
|
-
|
|
148
|
-
[workspaceStoreTarget]: async () => await resolveWorkspaceStoreTarget(workspace) ?? { provider: "memory" },
|
|
149
|
+
const store = {
|
|
149
150
|
isTombstoned,
|
|
150
151
|
async readFile(path) {
|
|
151
152
|
return await memory.readFile(path) || await readBaseFile(path);
|
|
@@ -191,6 +192,8 @@ function createOverlaySourceStore(workspace, fallback, backingMetadataTarget) {
|
|
|
191
192
|
await memory.setMeta?.(key, value);
|
|
192
193
|
}
|
|
193
194
|
};
|
|
195
|
+
provideWorkspaceStoreTarget(store, async () => await resolveWorkspaceStoreTarget(workspace) ?? { provider: "memory" });
|
|
196
|
+
return store;
|
|
194
197
|
}
|
|
195
198
|
const sourceSyncStores = /* @__PURE__ */ new WeakMap();
|
|
196
199
|
/** Preserve internal Source Sync routing when wrapping a writable facade. */
|
|
@@ -284,7 +287,7 @@ function createWritableFacadeStore(workspace, sourceSync) {
|
|
|
284
287
|
async function startOverlayWorkspaceSession(_definition, workspace, options) {
|
|
285
288
|
const host = options?.host;
|
|
286
289
|
if (host) {
|
|
287
|
-
const { createHostedWorkspaceSession } = await import("./host-
|
|
290
|
+
const { createHostedWorkspaceSession } = await import("./host-C8yZizfk.js").then((n) => n.n);
|
|
288
291
|
return await createHostedWorkspaceSession(workspace, {
|
|
289
292
|
...options,
|
|
290
293
|
host
|
|
@@ -549,7 +552,7 @@ async function createWorkspaceSourceResolutionFacade(workspace, definition, opti
|
|
|
549
552
|
},
|
|
550
553
|
stat: writeFs.stat,
|
|
551
554
|
sync: async (options) => {
|
|
552
|
-
const { syncWorkspaceSources } = await import("./sync-
|
|
555
|
+
const { syncWorkspaceSources } = await import("./sync-BBfR4g5y.js");
|
|
553
556
|
return await syncWorkspaceSources(resolvedDefinition, syncStore, options);
|
|
554
557
|
},
|
|
555
558
|
writeFile: writeFs.writeFile
|
|
@@ -592,6 +595,10 @@ async function createWorkspaceSourceResolutionFacade(workspace, definition, opti
|
|
|
592
595
|
requireCompleteHistory();
|
|
593
596
|
return await baseHistory.openPullRequest(options);
|
|
594
597
|
} } : {},
|
|
598
|
+
deleteRef: async (options) => {
|
|
599
|
+
requireCompleteHistory();
|
|
600
|
+
return await baseHistory.deleteRef(options);
|
|
601
|
+
},
|
|
595
602
|
commit: commitHistory,
|
|
596
603
|
checkpoint: baseHistory.checkpoint.bind(baseHistory),
|
|
597
604
|
rebase
|
|
@@ -860,8 +867,7 @@ function pathContains(container, path) {
|
|
|
860
867
|
function pathIntersects(left, right) {
|
|
861
868
|
return pathContains(left, right) || pathContains(right, left);
|
|
862
869
|
}
|
|
863
|
-
|
|
864
|
-
//#region src/runtime/preparation.ts
|
|
870
|
+
// src/runtime/preparation.ts
|
|
865
871
|
const MAX_TIMER_DELAY_MS = 2147483647;
|
|
866
872
|
async function waitForAbortable(operation, signal) {
|
|
867
873
|
let removeAbortListener = () => {};
|
|
@@ -1031,8 +1037,7 @@ function createWorkspacePreparation(options) {
|
|
|
1031
1037
|
}
|
|
1032
1038
|
});
|
|
1033
1039
|
}
|
|
1034
|
-
|
|
1035
|
-
//#region src/storage/recover-local-locks.ts
|
|
1040
|
+
// src/storage/recover-local-locks.ts
|
|
1036
1041
|
/**
|
|
1037
1042
|
* Remove abandoned markers from a trusted, exclusively owned local store.
|
|
1038
1043
|
* Stop all store users and prevent changes to the store and its ancestor directories
|
|
@@ -1072,5 +1077,4 @@ async function recoverLocalWorkspaceLocks(options) {
|
|
|
1072
1077
|
}
|
|
1073
1078
|
return { removed };
|
|
1074
1079
|
}
|
|
1075
|
-
//#endregion
|
|
1076
1080
|
export { attachWorkspaceSourceRequestExecution, createWorkspaceHistoryReader, createWorkspacePreparation, createWorkspaceSourceResolutionFacade, forwardWorkspaceFacade, forwardWorkspaceMetadataView, getWorkspaceDependencyRuntimeLoaders, getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, getWorkspaceSourceRequestDescriptor, getWorkspaceSourceRequestExecution, hasWorkspaceSourceResolvers, invalidateWorkspaceStore, isWorkspaceSourceRequestOnly, markLiveWorkspaceSource, normalizeWorkspaceSourceMetadata, normalizeWorkspaceSourcesMetadata, recoverLocalWorkspaceLocks, registerWorkspace, registerWorkspacePlugin, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, resolveWorkspaceSources, setWorkspaceDependencyRuntimeLoaders, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeDefinitions, setWorkspaceRuntimeRegistry, useWorkspace, useWorkspaceFiles, workspaceSourceGrantPaths, workspaceSourceRequestDescriptorPath, workspaceSourceRequestMatches };
|