@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,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { s as GitHubWorkspaceStoreOptions, xn as WorkspaceStore } from "../../types-BbtwmBZ5.js";
|
|
3
2
|
//#region src/providers/github/store.d.ts
|
|
4
|
-
declare function createGitHubWorkspaceStore(options: GitHubWorkspaceStoreOptions, workspaceName: string): WorkspaceStore;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { createGitHubWorkspaceStore };
|
|
3
|
+
export declare function createGitHubWorkspaceStore(options: GitHubWorkspaceStoreOptions, workspaceName: string): WorkspaceStore;
|
|
4
|
+
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createGitHubWorkspaceStore } from "../../store-
|
|
1
|
+
import { t as createGitHubWorkspaceStore } from "../../store-ybhyD38Z.js";
|
|
2
2
|
export { createGitHubWorkspaceStore };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { L as WorkspaceDefinitionInput, v as ResolvedWorkspaceModuleOptions } from "./types-BbtwmBZ5.js";
|
|
2
|
+
//#region src/runtime/config.d.ts
|
|
3
|
+
declare function setWorkspaceRuntimeConfig(config: false | ResolvedWorkspaceModuleOptions): void;
|
|
4
|
+
declare function getWorkspaceRuntimeConfig(): false | ResolvedWorkspaceModuleOptions;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/runtime/registry.d.ts
|
|
7
|
+
type WorkspaceRegistryModule = {
|
|
8
|
+
default?: WorkspaceDefinitionInput;
|
|
9
|
+
};
|
|
10
|
+
type WorkspaceRegistry = Record<string, () => Promise<WorkspaceRegistryModule>>;
|
|
11
|
+
interface WorkspaceRuntimeRegistryState {
|
|
12
|
+
loaders: WorkspaceRegistry;
|
|
13
|
+
version: number;
|
|
14
|
+
}
|
|
15
|
+
declare function workspaceRuntimeRegistryState(): Readonly<WorkspaceRuntimeRegistryState>;
|
|
16
|
+
declare function setWorkspaceRuntimeRegistry(registry: WorkspaceRegistry): void;
|
|
17
|
+
declare function resetWorkspaceRuntimeRegistry(): void;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { workspaceRuntimeRegistryState as a, setWorkspaceRuntimeRegistry as i, WorkspaceRegistryModule as n, getWorkspaceRuntimeConfig as o, resetWorkspaceRuntimeRegistry as r, setWorkspaceRuntimeConfig as s, WorkspaceRegistry as t };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as createWorkspace } from "./workspace-
|
|
4
|
-
import
|
|
1
|
+
import { c as workspaceNotFoundError } from "./path-DrSIenjj.js";
|
|
2
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CtKjGtGb.js";
|
|
3
|
+
import { t as createWorkspace } from "./workspace-sPWn2Jxj.js";
|
|
4
|
+
import { setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState } from "./runtime/registry.js";
|
|
5
|
+
import { getViteHubErrorShape, isRuntimeDiagnostic } from "@vite-hub/runtime";
|
|
5
6
|
//#region src/core/registry.ts
|
|
6
7
|
const workspaceRegistryStateKey = Symbol.for("vitehub.workspace.registryState");
|
|
7
8
|
function workspaceRegistryState() {
|
|
@@ -10,23 +11,45 @@ function workspaceRegistryState() {
|
|
|
10
11
|
loadingDefinitions: /* @__PURE__ */ new Map(),
|
|
11
12
|
loadGenerations: /* @__PURE__ */ new Map(),
|
|
12
13
|
loadedDefinitions: /* @__PURE__ */ new Map(),
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
registeredDefinitions: /* @__PURE__ */ new Map(),
|
|
15
|
+
registryVersion: workspaceRuntimeRegistryState().version,
|
|
16
|
+
scopedDefinitions: /* @__PURE__ */ new Map()
|
|
15
17
|
};
|
|
16
|
-
scope[workspaceRegistryStateKey]
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const state = scope[workspaceRegistryStateKey];
|
|
19
|
+
state.loadingDefinitions ??= /* @__PURE__ */ new Map();
|
|
20
|
+
state.loadGenerations ??= /* @__PURE__ */ new Map();
|
|
21
|
+
state.scopedDefinitions ??= /* @__PURE__ */ new Map();
|
|
22
|
+
const { version } = workspaceRuntimeRegistryState();
|
|
23
|
+
if (state.registryVersion !== version) {
|
|
24
|
+
invalidateWorkspaceLoads(state);
|
|
25
|
+
state.loadedDefinitions.clear();
|
|
26
|
+
state.registryVersion = version;
|
|
27
|
+
}
|
|
28
|
+
return state;
|
|
19
29
|
}
|
|
20
30
|
function pickWorkspaceFields(definition) {
|
|
21
31
|
const { __vitehubWorkspaceAgent: _agent, __vitehubWorkspaceAgentOptions: _agentOptions, description: _description, fallback: _fallback, instructions: _instructions, model: _model, name: _agentName, resolve: _resolve, run: _run, stepLimit: _stepLimit, workspace: _workspace, ...workspace } = definition;
|
|
22
32
|
return workspace;
|
|
23
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* The error for a failed loader of the generated Workspace registry. The registry runs plain source text without the
|
|
36
|
+
* Workspace catalog, so its own failures and the errors of the Definition module get a code here. A coded error passes.
|
|
37
|
+
*/
|
|
38
|
+
function workspaceRegistryLoadError(workspace, error) {
|
|
39
|
+
if (isRuntimeDiagnostic(error) || getViteHubErrorShape(error)) return error;
|
|
40
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
41
|
+
return workspaceErrorDiagnostics.WORKSPACE_REGISTRY_LOAD_FAILED({
|
|
42
|
+
reason,
|
|
43
|
+
workspace,
|
|
44
|
+
cause: error
|
|
45
|
+
});
|
|
46
|
+
}
|
|
24
47
|
function normalizeWorkspaceDefinition(name, definition) {
|
|
25
48
|
if (!definition) throw workspaceNotFoundError(name);
|
|
26
49
|
const workspaceAgentOptions = definition.__vitehubWorkspaceAgentOptions;
|
|
27
50
|
if (workspaceAgentOptions?.workspace) {
|
|
28
51
|
const injectedWorkspace = pickWorkspaceFields(definition);
|
|
29
|
-
const configuredWorkspace =
|
|
52
|
+
const configuredWorkspace = typeof workspaceAgentOptions.workspace === "string" ? {} : workspaceAgentOptions.workspace;
|
|
30
53
|
const sources = mergeWorkspaceSources(injectedWorkspace.sources, configuredWorkspace.sources);
|
|
31
54
|
const normalizedWorkspace = {
|
|
32
55
|
...injectedWorkspace,
|
|
@@ -38,7 +61,7 @@ function normalizeWorkspaceDefinition(name, definition) {
|
|
|
38
61
|
if (sources) normalizedWorkspace.sources = sources;
|
|
39
62
|
return normalizedWorkspace;
|
|
40
63
|
}
|
|
41
|
-
if ("name" in definition) throw
|
|
64
|
+
if ("name" in definition) throw workspaceErrorDiagnostics.WORKSPACE_R0021({ message: `[vitehub] Workspace definition "${name}" must not declare a name. Workspace names are inferred from filenames.` });
|
|
42
65
|
return {
|
|
43
66
|
...pickWorkspaceFields(definition),
|
|
44
67
|
name
|
|
@@ -52,16 +75,21 @@ function mergeWorkspaceSources(injected, configured) {
|
|
|
52
75
|
};
|
|
53
76
|
}
|
|
54
77
|
function registerWorkspace(name, definition) {
|
|
55
|
-
if (!name ||
|
|
78
|
+
if (!name || typeof name !== "string") throw workspaceErrorDiagnostics.WORKSPACE_R0022({ message: "[vitehub] registerWorkspace requires a string name." });
|
|
56
79
|
const registered = normalizeWorkspaceDefinition(name, definition);
|
|
57
80
|
workspaceRegistryState().registeredDefinitions.set(name, registered);
|
|
58
81
|
return registered;
|
|
59
82
|
}
|
|
60
|
-
|
|
83
|
+
/** Replace one generated catalog's definitions without replacing application registrations. */
|
|
84
|
+
function setWorkspaceRuntimeDefinitions(scope, definitions) {
|
|
85
|
+
const normalized = new Map(Object.entries(definitions).map(([name, definition]) => [name, normalizeWorkspaceDefinition(name, definition)]));
|
|
61
86
|
const state = workspaceRegistryState();
|
|
62
|
-
|
|
63
|
-
state.
|
|
64
|
-
|
|
87
|
+
if (normalized.size) state.scopedDefinitions.set(scope, normalized);
|
|
88
|
+
else state.scopedDefinitions.delete(scope);
|
|
89
|
+
}
|
|
90
|
+
function setWorkspaceRegistry(registry) {
|
|
91
|
+
setWorkspaceRuntimeRegistry(registry);
|
|
92
|
+
workspaceRegistryState();
|
|
65
93
|
}
|
|
66
94
|
function invalidateWorkspaceLoads(state) {
|
|
67
95
|
for (const [name, loading] of state.loadingDefinitions) if (state.loadGenerations.get(name) === loading.generation) state.loadGenerations.set(name, loading.generation + 1);
|
|
@@ -69,17 +97,25 @@ function invalidateWorkspaceLoads(state) {
|
|
|
69
97
|
}
|
|
70
98
|
async function resolveWorkspaceDefinition(name, abortSignal) {
|
|
71
99
|
const state = workspaceRegistryState();
|
|
72
|
-
const
|
|
100
|
+
const registered = state.registeredDefinitions.get(name);
|
|
101
|
+
if (registered) return registered;
|
|
102
|
+
for (const definitions of state.scopedDefinitions.values()) {
|
|
103
|
+
const definition = definitions.get(name);
|
|
104
|
+
if (definition) return definition;
|
|
105
|
+
}
|
|
106
|
+
const existing = state.loadedDefinitions.get(name);
|
|
73
107
|
if (existing) return existing;
|
|
74
|
-
const load =
|
|
108
|
+
const load = workspaceRuntimeRegistryState().loaders[name];
|
|
75
109
|
if (!load) throw workspaceNotFoundError(name);
|
|
76
110
|
let loading = state.loadingDefinitions.get(name);
|
|
77
111
|
if (!loading || loading.load !== load) {
|
|
78
112
|
const generation = (state.loadGenerations.get(name) ?? 0) + 1;
|
|
79
113
|
state.loadGenerations.set(name, generation);
|
|
80
|
-
const promise = load().
|
|
114
|
+
const promise = (async () => load())().catch((error) => {
|
|
115
|
+
throw workspaceRegistryLoadError(name, error);
|
|
116
|
+
}).then((mod) => {
|
|
81
117
|
const definition = normalizeWorkspaceDefinition(name, mod.default);
|
|
82
|
-
if (state.loadGenerations.get(name) === generation &&
|
|
118
|
+
if (state.loadGenerations.get(name) === generation && workspaceRuntimeRegistryState().loaders[name] === load) state.loadedDefinitions.set(name, definition);
|
|
83
119
|
return definition;
|
|
84
120
|
});
|
|
85
121
|
loading = {
|
|
@@ -120,8 +156,9 @@ async function resolveWorkspaceDefinition(name, abortSignal) {
|
|
|
120
156
|
async function resolveRegisteredWorkspaceDefinition(name, abortSignal) {
|
|
121
157
|
return resolveWorkspaceDefinition(name, abortSignal);
|
|
122
158
|
}
|
|
123
|
-
async function useRegisteredWorkspace(name) {
|
|
124
|
-
|
|
159
|
+
async function useRegisteredWorkspace(name, options = {}) {
|
|
160
|
+
const definition = await resolveWorkspaceDefinition(name);
|
|
161
|
+
return createWorkspace(definition, options);
|
|
125
162
|
}
|
|
126
163
|
//#endregion
|
|
127
|
-
export {
|
|
164
|
+
export { setWorkspaceRuntimeDefinitions as a, setWorkspaceRegistry as i, registerWorkspace as n, useRegisteredWorkspace as o, resolveRegisteredWorkspaceDefinition as r, workspaceRegistryLoadError as s, normalizeWorkspaceDefinition as t };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { I as WorkspaceDefinition, L as WorkspaceDefinitionInput } from "./types-BbtwmBZ5.js";
|
|
2
|
+
import "./registry-B3BBm4Ts.js";
|
|
3
|
+
//#region src/core/registry.d.ts
|
|
4
|
+
declare function registerWorkspace(name: string, definition: WorkspaceDefinitionInput): WorkspaceDefinition;
|
|
5
|
+
/** Replace one generated catalog's definitions without replacing application registrations. */
|
|
6
|
+
declare function setWorkspaceRuntimeDefinitions(scope: string, definitions: Record<string, WorkspaceDefinitionInput>): void;
|
|
7
|
+
declare function resolveRegisteredWorkspaceDefinition(name: string, abortSignal?: AbortSignal): Promise<WorkspaceDefinition>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { resolveRegisteredWorkspaceDefinition as n, setWorkspaceRuntimeDefinitions as r, registerWorkspace as t };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { t as workspaceStoreDiscard } from "./discard-CNNtCozM.js";
|
|
2
|
+
import { registerRunScope } from "@vite-hub/runtime/internal/run-scope";
|
|
3
|
+
//#region src/core/request-scope.ts
|
|
4
|
+
const runtimeGlobal = globalThis;
|
|
5
|
+
const storageKey = Symbol.for("vitehub.workspace.request");
|
|
6
|
+
const writersKey = Symbol.for("vitehub.workspace.writers");
|
|
7
|
+
/** Writes made outside a request and a run, such as at startup, which no request may drop. */
|
|
8
|
+
const outsideRequest = { staged: /* @__PURE__ */ new Set() };
|
|
9
|
+
function requestStorage() {
|
|
10
|
+
const existing = runtimeGlobal[storageKey];
|
|
11
|
+
if (existing) return existing;
|
|
12
|
+
const Storage = globalThis.process?.getBuiltinModule?.("node:async_hooks")?.AsyncLocalStorage;
|
|
13
|
+
if (!Storage) return;
|
|
14
|
+
const storage = new Storage();
|
|
15
|
+
runtimeGlobal[storageKey] = storage;
|
|
16
|
+
return storage;
|
|
17
|
+
}
|
|
18
|
+
/** The requests that staged writes in each Store since its last snapshot. */
|
|
19
|
+
function writers() {
|
|
20
|
+
return runtimeGlobal[writersKey] ??= /* @__PURE__ */ new WeakMap();
|
|
21
|
+
}
|
|
22
|
+
function isDiscardable(store) {
|
|
23
|
+
return typeof store[workspaceStoreDiscard] === "function";
|
|
24
|
+
}
|
|
25
|
+
const stagingMethods = [
|
|
26
|
+
"mkdir",
|
|
27
|
+
"rebase",
|
|
28
|
+
"removeEmptyDirectory",
|
|
29
|
+
"rm",
|
|
30
|
+
"setMeta",
|
|
31
|
+
"writeFile",
|
|
32
|
+
"writeFileConditional",
|
|
33
|
+
"writeFileStream"
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* Records which request stages writes in a Store that keeps them until `snapshot()`, for every caller of the Store:
|
|
37
|
+
* Workspace methods, Source materialization, and sync. Other Stores write through and are returned as they are.
|
|
38
|
+
*/
|
|
39
|
+
function trackStagedWrites(store) {
|
|
40
|
+
if (!isDiscardable(store)) return store;
|
|
41
|
+
for (const name of stagingMethods) {
|
|
42
|
+
const method = store[name];
|
|
43
|
+
if (typeof method !== "function") continue;
|
|
44
|
+
Reflect.set(store, name, (...args) => {
|
|
45
|
+
const request = requestStorage()?.getStore() ?? outsideRequest;
|
|
46
|
+
if (request !== outsideRequest) request.staged.add(store);
|
|
47
|
+
const staged = writers().get(store);
|
|
48
|
+
if (staged) staged.add(request);
|
|
49
|
+
else writers().set(store, /* @__PURE__ */ new Set([request]));
|
|
50
|
+
return Reflect.apply(method, store, args);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const snapshot = store.snapshot;
|
|
54
|
+
store.snapshot = async (options) => {
|
|
55
|
+
const result = await Reflect.apply(snapshot, store, [options]);
|
|
56
|
+
writers().delete(store);
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
return store;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Runs one request. When it throws, each Store that only this request staged writes in since its last snapshot drops
|
|
63
|
+
* them, so a later snapshot cannot commit them. Facades that hold the Store see the same branch as a new request.
|
|
64
|
+
*/
|
|
65
|
+
async function runWorkspaceRequest(next) {
|
|
66
|
+
const storage = requestStorage();
|
|
67
|
+
if (!storage) return await next();
|
|
68
|
+
const request = { staged: /* @__PURE__ */ new Set() };
|
|
69
|
+
try {
|
|
70
|
+
return await storage.run(request, next);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
for (const store of request.staged) {
|
|
73
|
+
const staged = writers().get(store);
|
|
74
|
+
if (staged?.size !== 1 || !staged.has(request) || !isDiscardable(store)) continue;
|
|
75
|
+
writers().delete(store);
|
|
76
|
+
await store[workspaceStoreDiscard]();
|
|
77
|
+
}
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
registerRunScope(runWorkspaceRequest);
|
|
82
|
+
//#endregion
|
|
83
|
+
export { trackStagedWrites as n, runWorkspaceRequest as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/results.ts
|
|
2
|
+
/**
|
|
3
|
+
* The largest `workspace.commit` request body: 4 MiB of JSON, with base64 for binary files. Vercel Functions accept
|
|
4
|
+
* request bodies up to 4.5 MB and Cloudflare Workers up to 100 MB, so one push works on every host.
|
|
5
|
+
*/
|
|
6
|
+
const workspaceCommitRequestBytes = 4194304;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { workspaceCommitRequestBytes as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "node:module";
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -26,10 +26,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
26
26
|
}
|
|
27
27
|
return to;
|
|
28
28
|
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
30
30
|
value: mod,
|
|
31
31
|
enumerable: true
|
|
32
32
|
}) : target, mod));
|
|
33
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
34
33
|
//#endregion
|
|
35
|
-
export {
|
|
34
|
+
export { __exportAll as n, __toESM as r, __commonJSMin as t };
|
package/dist/runtime/assets.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { D as WorkspaceAssets,
|
|
2
|
-
|
|
1
|
+
import { D as WorkspaceAssets, N as WorkspaceContent } from "../types-BbtwmBZ5.js";
|
|
3
2
|
//#region src/runtime/assets.d.ts
|
|
4
3
|
interface WorkspaceAssetFile {
|
|
5
4
|
load: () => Promise<WorkspaceContent>;
|
|
@@ -7,6 +6,5 @@ interface WorkspaceAssetFile {
|
|
|
7
6
|
metadata?: Record<string, unknown>;
|
|
8
7
|
}
|
|
9
8
|
type WorkspaceAssetFiles<TKey extends string = string> = Record<TKey, WorkspaceAssetFile>;
|
|
10
|
-
declare function createWorkspaceAssets<TKey extends string = string>(files: WorkspaceAssetFiles<TKey>): WorkspaceAssets<TKey>;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { createWorkspaceAssets };
|
|
9
|
+
export declare function createWorkspaceAssets<TKey extends string = string>(files: WorkspaceAssetFiles<TKey>): WorkspaceAssets<TKey>;
|
|
10
|
+
//#endregion
|
package/dist/runtime/assets.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { i as isWorkspaceError, s as workspaceError, t as normalizeSafeWorkspacePath } from "../path-DrSIenjj.js";
|
|
2
|
+
import { a as isExcludedWorkspacePath, f as sha256, i as decodeFile, l as normalizeWorkspacePath } from "../path--wrT_Azm.js";
|
|
3
|
+
import { t as createWorkspaceGlobMatcher } from "../glob-Cjxms1t7.js";
|
|
4
|
+
import { t as searchText } from "../search-C_RfoM2j.js";
|
|
3
5
|
//#region src/runtime/assets.ts
|
|
4
6
|
function createMissingPathError(path) {
|
|
5
7
|
return workspaceError(`[vitehub] Workspace file does not exist: ${path}.`);
|
|
@@ -112,10 +114,9 @@ function createWorkspaceAssets(files) {
|
|
|
112
114
|
async list(path, options) {
|
|
113
115
|
return await listEntries(path || "", options);
|
|
114
116
|
},
|
|
115
|
-
async glob(pattern,
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
return entries.filter((entry) => entry.type === "file" && patterns.some((item) => matchesAny(entry.path, item)));
|
|
117
|
+
async glob(pattern, options = {}) {
|
|
118
|
+
const { cwd, matches } = createWorkspaceGlobMatcher(pattern, options);
|
|
119
|
+
return (await listEntries(cwd, { recursive: true })).filter((entry) => entry.type === "file" && matches(entry.path));
|
|
119
120
|
},
|
|
120
121
|
async search(query) {
|
|
121
122
|
const result = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as WorkspaceRegistry } from "../registry-
|
|
2
|
-
|
|
1
|
+
import { t as WorkspaceRegistry } from "../registry-B3BBm4Ts.js";
|
|
2
|
+
import "../registry-CYNN623b.js";
|
|
3
3
|
//#region src/runtime/empty-registry.d.ts
|
|
4
4
|
declare const registry: WorkspaceRegistry;
|
|
5
5
|
//#endregion
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as workspaceRuntimeRegistryState, i as setWorkspaceRuntimeRegistry, n as WorkspaceRegistryModule, r as resetWorkspaceRuntimeRegistry, s as setWorkspaceRuntimeConfig, t as WorkspaceRegistry } from "../registry-B3BBm4Ts.js";
|
|
2
|
+
export { WorkspaceRegistry, WorkspaceRegistryModule, resetWorkspaceRuntimeRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { n as setWorkspaceRuntimeConfig } from "../config-B-863EgC.js";
|
|
2
|
+
import runtimeRegistry from "#vitehub-workspace-registry";
|
|
3
|
+
//#region src/runtime/registry.ts
|
|
4
|
+
const workspaceRuntimeRegistryKey = Symbol.for("vitehub.workspace.runtimeRegistry");
|
|
5
|
+
function workspaceRuntimeRegistryState() {
|
|
6
|
+
const scope = globalThis;
|
|
7
|
+
return scope[workspaceRuntimeRegistryKey] ??= {
|
|
8
|
+
loaders: runtimeRegistry,
|
|
9
|
+
version: 0
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function setWorkspaceRuntimeRegistry(registry) {
|
|
13
|
+
const scope = globalThis;
|
|
14
|
+
scope[workspaceRuntimeRegistryKey] = {
|
|
15
|
+
loaders: registry,
|
|
16
|
+
version: workspaceRuntimeRegistryState().version + 1
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function resetWorkspaceRuntimeRegistry() {
|
|
20
|
+
setWorkspaceRuntimeRegistry(runtimeRegistry);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { resetWorkspaceRuntimeRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as runWorkspaceRequest } from "../request-scope-Dw5n8bMC.js";
|
|
2
|
+
//#region src/runtime/request.ts
|
|
3
|
+
/** Nitro middleware: runs the rest of the request in its own Workspace request scope. */
|
|
4
|
+
function workspaceRequestMiddleware(_event, next) {
|
|
5
|
+
return runWorkspaceRequest(next);
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { workspaceRequestMiddleware as default };
|
package/dist/runtime/state.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, h as WritableWorkspaceFacade, i as ReadonlyWorkspaceFacade, s as UseWorkspaceOptions, x as useWorkspaceFiles } from "../use-C6lV3-wC.js";
|
|
2
|
+
import { o as getWorkspaceRuntimeConfig, s as setWorkspaceRuntimeConfig } from "../registry-B3BBm4Ts.js";
|
|
3
|
+
import { n as resolveRegisteredWorkspaceDefinition, r as setWorkspaceRuntimeDefinitions, t as registerWorkspace } from "../registry-CYNN623b.js";
|
|
4
|
+
import { c as resetWorkspaceStoreCache, l as useWorkspace, n as setWorkspaceRuntimeAssetsRegistry, o as getWorkspaceHostedStoreLoader, r as setWorkspaceRuntimeRegistry, s as setWorkspaceHostedStoreLoader, t as invalidateWorkspaceStore, u as setActiveCloudflareEnv } from "../state-BISnUf1s.js";
|
|
5
|
+
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,18 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
invalidateCachedWorkspaceStore(await resolveRegisteredWorkspaceDefinition(name));
|
|
10
|
-
}
|
|
11
|
-
function setWorkspaceRuntimeRegistry(registry) {
|
|
12
|
-
setWorkspaceRegistry(registry);
|
|
13
|
-
}
|
|
14
|
-
function setWorkspaceRuntimeAssetsRegistry(registry) {
|
|
15
|
-
setWorkspaceAssetsRegistry(registry);
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, invalidateWorkspaceStore, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setActiveCloudflareEnv, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, useWorkspace };
|
|
1
|
+
import { E as setActiveCloudflareEnv } from "../shared-B3_EUk89.js";
|
|
2
|
+
import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "../provider-9s4Ufkm5.js";
|
|
3
|
+
import { n as setWorkspaceRuntimeConfig, t as getWorkspaceRuntimeConfig } from "../config-B-863EgC.js";
|
|
4
|
+
import { r as resetWorkspaceStoreCache } from "../workspace-sPWn2Jxj.js";
|
|
5
|
+
import { a as setWorkspaceRuntimeDefinitions, n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "../registry-CNphafBx.js";
|
|
6
|
+
import { r as useWorkspaceFiles } from "../use-CSpT5W87.js";
|
|
7
|
+
import { i as useWorkspace, n as setWorkspaceRuntimeAssetsRegistry, r as setWorkspaceRuntimeRegistry, t as invalidateWorkspaceStore } from "../state-DbrW-njQ.js";
|
|
8
|
+
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-CYB2xZ1T.js";
|
|
2
2
|
export { createWorkspace };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createWorkspace } from "../workspace-
|
|
1
|
+
import { t as createWorkspace } from "../workspace-sPWn2Jxj.js";
|
|
2
2
|
export { createWorkspace };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { B as WorkspaceEntry, I as WorkspaceDefinition, Kt as WorkspaceSource, Rt as WorkspaceSelectedScope, St as WorkspaceName, T as Workspace, ht as WorkspaceMaterializeSourcesResult, in as WorkspaceSourceRequestExecutionResult, nn as WorkspaceSourceRequestDescriptor, rn as WorkspaceSourceRequestExecutionInput, rt as WorkspaceHistoryReader, un as WorkspaceSourceResolutionInvocation } from "./types-BbtwmBZ5.js";
|
|
2
|
+
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-C6lV3-wC.js";
|
|
3
|
+
import { t as registerWorkspacePlugin } from "./plugins-C8C0auoW.js";
|
|
4
|
+
import { o as getWorkspaceRuntimeConfig, s as setWorkspaceRuntimeConfig } from "./registry-B3BBm4Ts.js";
|
|
5
|
+
import { n as resolveRegisteredWorkspaceDefinition, r as setWorkspaceRuntimeDefinitions, t as registerWorkspace } from "./registry-CYNN623b.js";
|
|
6
|
+
import { a as WorkspaceHostedStoreLoader, c as resetWorkspaceStoreCache, i as HostedWorkspaceStoreOptions, l as useWorkspace, n as setWorkspaceRuntimeAssetsRegistry, o as getWorkspaceHostedStoreLoader, r as setWorkspaceRuntimeRegistry, s as setWorkspaceHostedStoreLoader, t as invalidateWorkspaceStore } from "./state-BISnUf1s.js";
|
|
7
|
+
import { a as getWorkspaceSourceRequestDescriptor, i as workspaceSourceGrantPaths, n as normalizeWorkspaceSourceMetadata, o as isWorkspaceSourceRequestOnly, r as normalizeWorkspaceSourcesMetadata, s as workspaceSourceRequestDescriptorPath, t as WorkspaceSourceMetadata } from "./config-BQKcPawI.js";
|
|
7
8
|
//#region src/runtime/dependency-loaders.d.ts
|
|
8
9
|
interface WorkspaceDependencyRuntimeLoaders {
|
|
9
10
|
shellWorkspace: () => Promise<unknown>;
|
|
10
11
|
}
|
|
11
|
-
declare function setWorkspaceDependencyRuntimeLoaders(loaders: Partial<WorkspaceDependencyRuntimeLoaders> | undefined): void;
|
|
12
|
-
declare function getWorkspaceDependencyRuntimeLoaders(): WorkspaceDependencyRuntimeLoaders;
|
|
12
|
+
export declare function setWorkspaceDependencyRuntimeLoaders(loaders: Partial<WorkspaceDependencyRuntimeLoaders> | undefined): void;
|
|
13
|
+
export declare function getWorkspaceDependencyRuntimeLoaders(): WorkspaceDependencyRuntimeLoaders;
|
|
13
14
|
//#endregion
|
|
14
15
|
//#region src/sources/resolution.d.ts
|
|
15
16
|
interface WorkspaceSourceResolutionOptions {
|
|
@@ -21,19 +22,37 @@ interface WorkspaceSourceResolutionFacade<Name extends WorkspaceName = Workspace
|
|
|
21
22
|
definition: WorkspaceDefinition;
|
|
22
23
|
workspace: ReadonlyWorkspaceFacade<Name>;
|
|
23
24
|
}
|
|
24
|
-
declare function hasWorkspaceSourceResolvers(definition: Pick<WorkspaceDefinition, "sources"> | undefined): boolean;
|
|
25
|
-
|
|
26
|
-
declare function
|
|
25
|
+
export declare function hasWorkspaceSourceResolvers(definition: Pick<WorkspaceDefinition, "sources"> | undefined): boolean;
|
|
26
|
+
/** Preserve internal Source Sync routing when wrapping a writable facade. */
|
|
27
|
+
export declare function forwardWorkspaceFacade(source: WritableWorkspaceFacade, target: WritableWorkspaceFacade): void;
|
|
28
|
+
export declare function resolveWorkspaceSources(definition: WorkspaceDefinition, options: WorkspaceSourceResolutionOptions): Promise<WorkspaceDefinition>;
|
|
29
|
+
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
|
+
/** Forward history only when the caller can inspect the complete folder. */
|
|
33
|
+
export declare function createWorkspaceHistoryReader(history: WorkspaceHistoryReader | undefined, complete: boolean): WorkspaceHistoryReader;
|
|
27
34
|
//#endregion
|
|
28
35
|
//#region src/sources/live.d.ts
|
|
29
|
-
declare function markLiveWorkspaceSource(source: WorkspaceSource, paths: Record<string, string>): WorkspaceSource;
|
|
36
|
+
export declare function markLiveWorkspaceSource(source: WorkspaceSource, paths: Record<string, string>): WorkspaceSource;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/storage/metadata-target.d.ts
|
|
39
|
+
/** An object that can carry a metadata target: a Workspace, a Workspace facade, or the `fs` of a facade. */
|
|
40
|
+
type WorkspaceMetadataCarrier = Workspace | ReadonlyWorkspaceFiles | WritableWorkspaceFiles | ReadonlyWorkspaceFs | WritableWorkspaceFs;
|
|
41
|
+
/**
|
|
42
|
+
* Attaches a read-only metadata view of `source` to `target`.
|
|
43
|
+
* The view has the Workspace name, `getMeta`, `list`, and the Store target. It never has Store writes.
|
|
44
|
+
* `filterEntries` limits the listed entries, for example to an access scope.
|
|
45
|
+
* Internal: `@vite-hub/agent` uses this for its Workspace facades.
|
|
46
|
+
*/
|
|
47
|
+
export declare function forwardWorkspaceMetadataView(source: unknown, target: WorkspaceMetadataCarrier, filterEntries?: (entries: WorkspaceEntry[]) => WorkspaceEntry[]): void;
|
|
30
48
|
//#endregion
|
|
31
49
|
//#region src/sources/request-execution.d.ts
|
|
32
50
|
interface WorkspaceSourceRequestExecutionTarget {
|
|
33
51
|
executeSourceRequest(input: WorkspaceSourceRequestExecutionInput): Promise<WorkspaceSourceRequestExecutionResult>;
|
|
34
52
|
}
|
|
35
|
-
declare function attachWorkspaceSourceRequestExecution<T extends object>(target: T, executor: WorkspaceSourceRequestExecutionTarget | undefined): T;
|
|
36
|
-
declare function getWorkspaceSourceRequestExecution(input: unknown): WorkspaceSourceRequestExecutionTarget | undefined;
|
|
53
|
+
export declare function attachWorkspaceSourceRequestExecution<T extends object>(target: T, executor: WorkspaceSourceRequestExecutionTarget | undefined): T;
|
|
54
|
+
export declare function getWorkspaceSourceRequestExecution(input: unknown): WorkspaceSourceRequestExecutionTarget | undefined;
|
|
55
|
+
export declare function workspaceSourceRequestMatches(descriptor: WorkspaceSourceRequestDescriptor, input: WorkspaceSourceRequestExecutionInput): boolean;
|
|
37
56
|
//#endregion
|
|
38
57
|
//#region src/runtime/preparation.d.ts
|
|
39
58
|
type WorkspacePreparationState = {
|
|
@@ -57,6 +76,8 @@ type WorkspacePreparationState = {
|
|
|
57
76
|
};
|
|
58
77
|
interface WorkspacePreparationOptions<Name extends WorkspaceName = WorkspaceName> {
|
|
59
78
|
onStateChange?: (state: WorkspacePreparationState) => void;
|
|
79
|
+
/** Fail readiness when a selected source contains no files. Empty sources are allowed by default. */
|
|
80
|
+
requireNonEmpty?: boolean;
|
|
60
81
|
retryDelayMs?: number;
|
|
61
82
|
sources?: readonly string[];
|
|
62
83
|
validate?: (result: WorkspaceMaterializeSourcesResult) => void | Promise<void>;
|
|
@@ -64,10 +85,24 @@ interface WorkspacePreparationOptions<Name extends WorkspaceName = WorkspaceName
|
|
|
64
85
|
}
|
|
65
86
|
interface WorkspacePreparation {
|
|
66
87
|
getState(): WorkspacePreparationState;
|
|
67
|
-
response(): Response;
|
|
88
|
+
response(method?: string): Response;
|
|
68
89
|
start(): Promise<WorkspacePreparationState>;
|
|
69
90
|
stop(): Promise<void>;
|
|
70
91
|
}
|
|
71
|
-
declare function createWorkspacePreparation<Name extends WorkspaceName = WorkspaceName>(options: WorkspacePreparationOptions<Name>): WorkspacePreparation;
|
|
92
|
+
export declare function createWorkspacePreparation<Name extends WorkspaceName = WorkspaceName>(options: WorkspacePreparationOptions<Name>): WorkspacePreparation;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/storage/recover-local-locks.d.ts
|
|
95
|
+
/**
|
|
96
|
+
* Remove abandoned markers from a trusted, exclusively owned local store.
|
|
97
|
+
* Stop all store users and prevent changes to the store and its ancestor directories
|
|
98
|
+
* for the entire call. Path checks catch existing symlinks; they do not provide
|
|
99
|
+
* protection against concurrent filesystem mutation.
|
|
100
|
+
*/
|
|
101
|
+
export declare function recoverLocalWorkspaceLocks(options: {
|
|
102
|
+
root: string;
|
|
103
|
+
offline: true;
|
|
104
|
+
}): Promise<{
|
|
105
|
+
removed: number;
|
|
106
|
+
}>;
|
|
72
107
|
//#endregion
|
|
73
|
-
export { type HostedWorkspaceStoreOptions, type ReadonlyWorkspaceFacade, type UseWorkspaceOptions, type WorkspaceDependencyRuntimeLoaders, type WorkspaceHostedStoreLoader, type WorkspacePreparation, type WorkspacePreparationOptions, type WorkspacePreparationState, type WorkspaceSourceMetadata, type WorkspaceSourceResolutionFacade, type WorkspaceSourceResolutionOptions, type WritableWorkspaceFacade,
|
|
108
|
+
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 };
|