@vite-hub/workspace 0.0.3 → 0.0.4
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/LICENSE +201 -0
- package/README.md +13 -2
- package/dist/{ai-Ce3PtWFW.js → ai-BqCC8BpY.js} +2 -2
- package/dist/{ai-nmHdzjCM.d.ts → ai-CjxvGqM0.d.ts} +1 -1
- package/dist/ai.d.ts +2 -2
- package/dist/ai.js +1 -1
- package/dist/{asset-registry-CaG9b7tf.js → asset-registry-8QI3ML3K.js} +1 -1
- package/dist/chunk-2rV9d50f.js +35 -0
- package/dist/cloudflare.d.ts +1 -1
- package/dist/cloudflare.js +1 -1
- package/dist/collections.d.ts +2 -2
- package/dist/collections.js +1 -1
- package/dist/{config-CZLO0m9h.js → config-Bc3c4Su1.js} +213 -120
- package/dist/{config-CDoyls2X.js → config-CHLLWklZ.js} +9 -3
- package/dist/{config-3I1BnsdO.d.ts → config-DE9xlaIw.d.ts} +1 -1
- package/dist/{file-CHfsZpso.js → file-Bc1X7pco.js} +3 -3
- package/dist/{files-QRV55OCx.js → files-Q6xZjDHA.js} +20 -9
- package/dist/{github-CfA5vpJ5.js → github-DHnjxQIX.js} +24 -15
- package/dist/{glob-D0vD_wRY.js → glob-CEZKeZFC.js} +5 -4
- package/dist/host-DJH8cuoU.js +1030 -0
- package/dist/{hosted-C1-tTTTf.js → hosted-RPeJOCFz.js} +121 -31
- package/dist/hosted-vercel-blob-d6C8ND5j.js +23580 -0
- package/dist/hosted-vercel-blob.d.ts +1 -1
- package/dist/hosted-vercel-blob.js +1 -1
- package/dist/hosted.d.ts +1 -1
- package/dist/hosted.js +1 -1
- package/dist/index.d.ts +42 -51
- package/dist/index.js +124 -419
- package/dist/lifecycle-LrL3sA4n.js +316 -0
- package/dist/loader.d.ts +1 -1
- package/dist/loader.js +1 -1
- package/dist/metadata-target-B0tOmVW7.js +717 -0
- package/dist/mountx.d.ts +1 -1
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +8 -2
- package/dist/{path-CNI6wKIU.js → path-Cp59koVz.js} +28 -4
- package/dist/{provider-C3_elpEh.js → provider-B1yLjCJJ.js} +194 -47
- package/dist/providers/github/store.d.ts +1 -1
- package/dist/providers/github/store.js +1 -1
- package/dist/publish.d.ts +1 -1
- package/dist/publish.js +2 -2
- package/dist/registry-D3yzt8HQ.js +127 -0
- package/dist/{registry-BIQVCBWI.d.ts → registry-Uj6IVxes.d.ts} +3 -3
- package/dist/{request-execution-u9mgUXKX.js → request-execution-B-dSFlGB.js} +8 -4
- package/dist/runtime/assets.d.ts +1 -1
- package/dist/runtime/assets.js +4 -2
- package/dist/runtime/empty-assets-registry.d.ts +1 -1
- package/dist/runtime/empty-registry.d.ts +1 -1
- package/dist/runtime/state.d.ts +4 -4
- package/dist/runtime/state.js +10 -7
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime-type-iEE6BjQJ.js +34 -0
- package/dist/runtime.d.ts +42 -7
- package/dist/runtime.js +275 -82
- package/dist/{search-C4REyHj9.js → search-BpiCF2Tw.js} +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +23 -50
- package/dist/{shared-jfogBrd5.js → shared-DTR1Hhma.js} +97 -39
- package/dist/source-metadata.d.ts +9 -2
- package/dist/source-metadata.js +34 -2
- package/dist/{state-TTqa3x3Y.d.ts → state-tYcRWEh2.d.ts} +13 -12
- package/dist/store-Dt_Jyys3.js +608 -0
- package/dist/{sync-DiuDmSGk.js → sync-DnTQwt8r.js} +6 -5
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/token-CVzURBxC.js +61 -0
- package/dist/{types-60Yn149G.d.ts → types-CYuwjJ4V.d.ts} +94 -27
- package/dist/{use-CsV3oIxH.js → use-BTNDR5Rd.js} +145 -31
- package/dist/{use-CUFSnFCS.d.ts → use-BiHzt0xA.d.ts} +21 -4
- package/dist/vite-BptCrpv2.js +4526 -0
- package/dist/vite-CtA9guIM.d.ts +66 -0
- package/dist/vite.d.ts +2 -50
- package/dist/vite.js +2 -2
- package/dist/{workspace-C4k92Ow8.js → workspace-Dq08Yn72.js} +224 -529
- package/dist/{workspace-66SKyiec.d.ts → workspace-Xddf4G1B.d.ts} +1 -1
- package/package.json +15 -18
- package/dist/chunk-8H4AJuhK.js +0 -14
- package/dist/host-CAnbugpI.js +0 -370
- package/dist/hosted-vercel-blob-CWBILDVo.js +0 -257
- package/dist/lifecycle-BYoa9hVb.js +0 -176
- package/dist/registry-CqyDTW9Y.js +0 -74
- package/dist/store-Bs1SLh55.js +0 -414
- package/dist/vite-tbfDxtlu.js +0 -2191
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { v as workspaceNotFoundError } from "./path-Cp59koVz.js";
|
|
2
|
+
import { t as hasRuntimeType } from "./runtime-type-iEE6BjQJ.js";
|
|
3
|
+
import { t as createWorkspace } from "./workspace-Dq08Yn72.js";
|
|
4
|
+
import runtimeRegistry from "#vitehub-workspace-registry";
|
|
5
|
+
//#region src/core/registry.ts
|
|
6
|
+
const workspaceRegistryStateKey = Symbol.for("vitehub.workspace.registryState");
|
|
7
|
+
function workspaceRegistryState() {
|
|
8
|
+
const scope = globalThis;
|
|
9
|
+
scope[workspaceRegistryStateKey] ??= {
|
|
10
|
+
loadingDefinitions: /* @__PURE__ */ new Map(),
|
|
11
|
+
loadGenerations: /* @__PURE__ */ new Map(),
|
|
12
|
+
loadedDefinitions: /* @__PURE__ */ new Map(),
|
|
13
|
+
loaders: runtimeRegistry,
|
|
14
|
+
registeredDefinitions: /* @__PURE__ */ new Map()
|
|
15
|
+
};
|
|
16
|
+
scope[workspaceRegistryStateKey].loadingDefinitions ??= /* @__PURE__ */ new Map();
|
|
17
|
+
scope[workspaceRegistryStateKey].loadGenerations ??= /* @__PURE__ */ new Map();
|
|
18
|
+
return scope[workspaceRegistryStateKey];
|
|
19
|
+
}
|
|
20
|
+
function pickWorkspaceFields(definition) {
|
|
21
|
+
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
|
+
return workspace;
|
|
23
|
+
}
|
|
24
|
+
function normalizeWorkspaceDefinition(name, definition) {
|
|
25
|
+
if (!definition) throw workspaceNotFoundError(name);
|
|
26
|
+
const workspaceAgentOptions = definition.__vitehubWorkspaceAgentOptions;
|
|
27
|
+
if (workspaceAgentOptions?.workspace) {
|
|
28
|
+
const injectedWorkspace = pickWorkspaceFields(definition);
|
|
29
|
+
const configuredWorkspace = hasRuntimeType(workspaceAgentOptions.workspace, "string") ? {} : workspaceAgentOptions.workspace;
|
|
30
|
+
const sources = mergeWorkspaceSources(injectedWorkspace.sources, configuredWorkspace.sources);
|
|
31
|
+
const normalizedWorkspace = {
|
|
32
|
+
...injectedWorkspace,
|
|
33
|
+
...configuredWorkspace,
|
|
34
|
+
rootDir: configuredWorkspace.rootDir ?? injectedWorkspace.rootDir,
|
|
35
|
+
sourceRootDir: configuredWorkspace.sourceRootDir ?? injectedWorkspace.sourceRootDir,
|
|
36
|
+
name
|
|
37
|
+
};
|
|
38
|
+
if (sources) normalizedWorkspace.sources = sources;
|
|
39
|
+
return normalizedWorkspace;
|
|
40
|
+
}
|
|
41
|
+
if ("name" in definition) throw new TypeError(`[vitehub] Workspace definition "${name}" must not declare a name. Workspace names are inferred from filenames.`);
|
|
42
|
+
return {
|
|
43
|
+
...pickWorkspaceFields(definition),
|
|
44
|
+
name
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function mergeWorkspaceSources(injected, configured) {
|
|
48
|
+
if (!injected && !configured) return void 0;
|
|
49
|
+
return {
|
|
50
|
+
...injected,
|
|
51
|
+
...configured
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function registerWorkspace(name, definition) {
|
|
55
|
+
if (!name || !hasRuntimeType(name, "string")) throw new TypeError("[vitehub] registerWorkspace requires a string name.");
|
|
56
|
+
const registered = normalizeWorkspaceDefinition(name, definition);
|
|
57
|
+
workspaceRegistryState().registeredDefinitions.set(name, registered);
|
|
58
|
+
return registered;
|
|
59
|
+
}
|
|
60
|
+
function setWorkspaceRegistry(registry) {
|
|
61
|
+
const state = workspaceRegistryState();
|
|
62
|
+
invalidateWorkspaceLoads(state);
|
|
63
|
+
state.loaders = registry;
|
|
64
|
+
state.loadedDefinitions.clear();
|
|
65
|
+
}
|
|
66
|
+
function invalidateWorkspaceLoads(state) {
|
|
67
|
+
for (const [name, loading] of state.loadingDefinitions) if (state.loadGenerations.get(name) === loading.generation) state.loadGenerations.set(name, loading.generation + 1);
|
|
68
|
+
state.loadingDefinitions.clear();
|
|
69
|
+
}
|
|
70
|
+
async function resolveWorkspaceDefinition(name, abortSignal) {
|
|
71
|
+
const state = workspaceRegistryState();
|
|
72
|
+
const existing = state.registeredDefinitions.get(name) || state.loadedDefinitions.get(name);
|
|
73
|
+
if (existing) return existing;
|
|
74
|
+
const load = state.loaders[name];
|
|
75
|
+
if (!load) throw workspaceNotFoundError(name);
|
|
76
|
+
let loading = state.loadingDefinitions.get(name);
|
|
77
|
+
if (!loading || loading.load !== load) {
|
|
78
|
+
const generation = (state.loadGenerations.get(name) ?? 0) + 1;
|
|
79
|
+
state.loadGenerations.set(name, generation);
|
|
80
|
+
const promise = load().then((mod) => {
|
|
81
|
+
const definition = normalizeWorkspaceDefinition(name, mod.default);
|
|
82
|
+
if (state.loadGenerations.get(name) === generation && state.loaders[name] === load) state.loadedDefinitions.set(name, definition);
|
|
83
|
+
return definition;
|
|
84
|
+
});
|
|
85
|
+
loading = {
|
|
86
|
+
consumers: 0,
|
|
87
|
+
generation,
|
|
88
|
+
load,
|
|
89
|
+
promise
|
|
90
|
+
};
|
|
91
|
+
state.loadingDefinitions.set(name, loading);
|
|
92
|
+
promise.finally(() => {
|
|
93
|
+
if (state.loadingDefinitions.get(name) === loading) state.loadingDefinitions.delete(name);
|
|
94
|
+
}).catch(() => {});
|
|
95
|
+
}
|
|
96
|
+
loading.consumers++;
|
|
97
|
+
let aborted = false;
|
|
98
|
+
let rejectAbort;
|
|
99
|
+
const abort = new Promise((_resolve, reject) => {
|
|
100
|
+
rejectAbort = reject;
|
|
101
|
+
});
|
|
102
|
+
const onAbort = () => {
|
|
103
|
+
aborted = true;
|
|
104
|
+
rejectAbort(abortSignal?.reason);
|
|
105
|
+
};
|
|
106
|
+
if (abortSignal?.aborted) onAbort();
|
|
107
|
+
else abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
108
|
+
try {
|
|
109
|
+
if (!abortSignal) return await loading.promise;
|
|
110
|
+
return await Promise.race([loading.promise, abort]);
|
|
111
|
+
} finally {
|
|
112
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
113
|
+
loading.consumers--;
|
|
114
|
+
if (aborted && loading.consumers === 0 && state.loadingDefinitions.get(name) === loading) {
|
|
115
|
+
state.loadingDefinitions.delete(name);
|
|
116
|
+
if (state.loadGenerations.get(name) === loading.generation) state.loadGenerations.set(name, loading.generation + 1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async function resolveRegisteredWorkspaceDefinition(name, abortSignal) {
|
|
121
|
+
return resolveWorkspaceDefinition(name, abortSignal);
|
|
122
|
+
}
|
|
123
|
+
async function useRegisteredWorkspace(name) {
|
|
124
|
+
return createWorkspace(await resolveWorkspaceDefinition(name));
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
export { useRegisteredWorkspace as a, setWorkspaceRegistry as i, registerWorkspace as n, resolveRegisteredWorkspaceDefinition as r, normalizeWorkspaceDefinition as t };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { F as
|
|
1
|
+
import { F as WorkspaceDefinition, I as WorkspaceDefinitionInput } from "./types-CYuwjJ4V.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/registry.d.ts
|
|
4
4
|
type WorkspaceRegistryModule = {
|
|
5
5
|
default?: WorkspaceDefinitionInput;
|
|
6
6
|
};
|
|
7
7
|
type WorkspaceRegistry = Record<string, () => Promise<WorkspaceRegistryModule>>;
|
|
8
|
-
declare function registerWorkspace(name: string, definition: WorkspaceDefinitionInput):
|
|
9
|
-
declare function resolveRegisteredWorkspaceDefinition(name: string): Promise<WorkspaceDefinition>;
|
|
8
|
+
declare function registerWorkspace(name: string, definition: WorkspaceDefinitionInput): WorkspaceDefinition;
|
|
9
|
+
declare function resolveRegisteredWorkspaceDefinition(name: string, abortSignal?: AbortSignal): Promise<WorkspaceDefinition>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { registerWorkspace as n, resolveRegisteredWorkspaceDefinition as r, WorkspaceRegistry as t };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { a as normalizeWorkspaceSources, h as
|
|
1
|
+
import { _ as workspaceSourceRequestDescriptorPath, a as normalizeWorkspaceSources, h as getWorkspaceSourceRequestExecutor, n as createSourceContext } from "./config-Bc3c4Su1.js";
|
|
2
2
|
//#region src/sources/request-execution.ts
|
|
3
3
|
const sourceRequestExecutions = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
function isWeakKey(value) {
|
|
5
|
+
return Object(value) === value;
|
|
6
|
+
}
|
|
4
7
|
function attachWorkspaceSourceRequestExecution(target, executor) {
|
|
5
8
|
if (!executor) return target;
|
|
6
9
|
sourceRequestExecutions.set(target, executor);
|
|
7
10
|
return target;
|
|
8
11
|
}
|
|
9
12
|
function getWorkspaceSourceRequestExecution(input) {
|
|
13
|
+
if (!isWeakKey(input)) return void 0;
|
|
10
14
|
return sourceRequestExecutions.get(input);
|
|
11
15
|
}
|
|
12
16
|
function createWorkspaceSourceRequestExecution(definition, options = {}) {
|
|
@@ -53,12 +57,12 @@ function requestShapeMatches(descriptor, input) {
|
|
|
53
57
|
}
|
|
54
58
|
function bodyShapeMatches(request, input) {
|
|
55
59
|
if (request?.bodySchema) return true;
|
|
56
|
-
if (
|
|
57
|
-
return
|
|
60
|
+
if (request && "body" in request) return jsonEqual(input.body, request.body);
|
|
61
|
+
return input.body === void 0;
|
|
58
62
|
}
|
|
59
63
|
function queryFromUrl(url) {
|
|
60
64
|
const query = {};
|
|
61
|
-
for (const key of new Set(
|
|
65
|
+
for (const key of new Set(url.searchParams.keys())) {
|
|
62
66
|
const values = url.searchParams.getAll(key);
|
|
63
67
|
query[key] = values.length > 1 ? values : values[0];
|
|
64
68
|
}
|
package/dist/runtime/assets.d.ts
CHANGED
package/dist/runtime/assets.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as searchText } from "../search-
|
|
1
|
+
import { _ as workspaceError, a as isExcludedWorkspacePath, f as sha256, h as isWorkspaceError, i as decodeFile, l as normalizeWorkspacePath, o as matchesAny, s as normalizeSafeWorkspacePath } from "../path-Cp59koVz.js";
|
|
2
|
+
import { t as searchText } from "../search-BpiCF2Tw.js";
|
|
3
3
|
//#region src/runtime/assets.ts
|
|
4
4
|
function createMissingPathError(path) {
|
|
5
5
|
return workspaceError(`[vitehub] Workspace file does not exist: ${path}.`);
|
|
@@ -79,12 +79,14 @@ function createWorkspaceAssets(files) {
|
|
|
79
79
|
const result = /* @__PURE__ */ new Map();
|
|
80
80
|
for (const directory of directorySet) {
|
|
81
81
|
if (directory === normalizedPrefix) continue;
|
|
82
|
+
if (isExcludedWorkspacePath(directory, options.exclude)) continue;
|
|
82
83
|
if (normalizedPrefix && !isNestedUnder(directory, normalizedPrefix)) continue;
|
|
83
84
|
if (!options.recursive && normalizeWorkspacePath(directory.slice(normalizedPrefix.length)).replace(/^\//, "").includes("/")) continue;
|
|
84
85
|
result.set(directory, createDirectoryEntry(directory));
|
|
85
86
|
}
|
|
86
87
|
for (const path of paths) {
|
|
87
88
|
if (path === normalizedPrefix) continue;
|
|
89
|
+
if (isExcludedWorkspacePath(path, options.exclude)) continue;
|
|
88
90
|
if (normalizedPrefix && !isNestedUnder(path, normalizedPrefix)) continue;
|
|
89
91
|
if (!options.recursive && normalizeWorkspacePath(path.slice(normalizedPrefix.length)).replace(/^\//, "").includes("/")) continue;
|
|
90
92
|
result.set(path, await statFile(path));
|
package/dist/runtime/state.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "../registry-
|
|
3
|
-
import { c as
|
|
4
|
-
export { type ReadonlyWorkspaceFacade, type UseWorkspaceOptions, type WritableWorkspaceFacade, getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setActiveCloudflareEnv, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, useWorkspace };
|
|
1
|
+
import { _ as useWorkspace, i as ReadonlyWorkspaceFacade, m as WritableWorkspaceFacade, o as UseWorkspaceOptions } from "../use-BiHzt0xA.js";
|
|
2
|
+
import { n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "../registry-Uj6IVxes.js";
|
|
3
|
+
import { a as setWorkspaceRuntimeConfig, c as getWorkspaceHostedStoreLoader, d as setActiveCloudflareEnv, i as getWorkspaceRuntimeConfig, l as setWorkspaceHostedStoreLoader, n as setWorkspaceRuntimeAssetsRegistry, r as setWorkspaceRuntimeRegistry, t as invalidateWorkspaceStore, u as resetWorkspaceStoreCache } from "../state-tYcRWEh2.js";
|
|
4
|
+
export { type ReadonlyWorkspaceFacade, type UseWorkspaceOptions, type WritableWorkspaceFacade, getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, invalidateWorkspaceStore, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setActiveCloudflareEnv, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, useWorkspace };
|
package/dist/runtime/state.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { c as getWorkspaceHostedStoreLoader, d as setWorkspaceRuntimeConfig, l as setWorkspaceHostedStoreLoader, u as getWorkspaceRuntimeConfig } from "../provider-
|
|
2
|
-
import {
|
|
3
|
-
import { t as setWorkspaceAssetsRegistry } from "../asset-registry-
|
|
4
|
-
import { n as resetWorkspaceStoreCache } from "../workspace-
|
|
5
|
-
import { i as setWorkspaceRegistry, n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "../registry-
|
|
6
|
-
import { t as useWorkspace } from "../use-
|
|
1
|
+
import { c as getWorkspaceHostedStoreLoader, d as setWorkspaceRuntimeConfig, l as setWorkspaceHostedStoreLoader, u as getWorkspaceRuntimeConfig } from "../provider-B1yLjCJJ.js";
|
|
2
|
+
import { v as setActiveCloudflareEnv } from "../shared-DTR1Hhma.js";
|
|
3
|
+
import { t as setWorkspaceAssetsRegistry } from "../asset-registry-8QI3ML3K.js";
|
|
4
|
+
import { n as invalidateCachedWorkspaceStore, r as resetWorkspaceStoreCache } from "../workspace-Dq08Yn72.js";
|
|
5
|
+
import { i as setWorkspaceRegistry, n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "../registry-D3yzt8HQ.js";
|
|
6
|
+
import { t as useWorkspace } from "../use-BTNDR5Rd.js";
|
|
7
7
|
//#region src/runtime/state.ts
|
|
8
|
+
async function invalidateWorkspaceStore(name) {
|
|
9
|
+
invalidateCachedWorkspaceStore(await resolveRegisteredWorkspaceDefinition(name));
|
|
10
|
+
}
|
|
8
11
|
function setWorkspaceRuntimeRegistry(registry) {
|
|
9
12
|
setWorkspaceRegistry(registry);
|
|
10
13
|
}
|
|
@@ -12,4 +15,4 @@ function setWorkspaceRuntimeAssetsRegistry(registry) {
|
|
|
12
15
|
setWorkspaceAssetsRegistry(registry);
|
|
13
16
|
}
|
|
14
17
|
//#endregion
|
|
15
|
-
export { getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setActiveCloudflareEnv, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, useWorkspace };
|
|
18
|
+
export { getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, invalidateWorkspaceStore, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, setActiveCloudflareEnv, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, useWorkspace };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createWorkspace } from "../workspace-
|
|
1
|
+
import { t as createWorkspace } from "../workspace-Xddf4G1B.js";
|
|
2
2
|
export { createWorkspace };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createWorkspace } from "../workspace-
|
|
1
|
+
import { t as createWorkspace } from "../workspace-Dq08Yn72.js";
|
|
2
2
|
export { createWorkspace };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/internal/runtime-type.ts
|
|
2
|
+
function isCallableRepresentation(value) {
|
|
3
|
+
if (value === null || value === void 0 || Object(value) !== value) return false;
|
|
4
|
+
try {
|
|
5
|
+
Function.prototype.toString.call(value);
|
|
6
|
+
return true;
|
|
7
|
+
} catch {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** Parses JavaScript runtime representation categories at Workspace boundaries. */
|
|
12
|
+
function hasRuntimeType(value, expected) {
|
|
13
|
+
if (expected === "undefined") return value === void 0;
|
|
14
|
+
if (expected === "object" && value === null) return true;
|
|
15
|
+
if (value === null || value === void 0) return false;
|
|
16
|
+
const isPrimitive = Object(value) !== value;
|
|
17
|
+
if (!isPrimitive) {
|
|
18
|
+
if (expected === "function") return isCallableRepresentation(value);
|
|
19
|
+
return expected === "object" && !isCallableRepresentation(value);
|
|
20
|
+
}
|
|
21
|
+
const tag = Object.prototype.toString.call(value);
|
|
22
|
+
switch (expected) {
|
|
23
|
+
case "bigint": return isPrimitive && tag === "[object BigInt]";
|
|
24
|
+
case "boolean": return isPrimitive && tag === "[object Boolean]";
|
|
25
|
+
case "function": return false;
|
|
26
|
+
case "number": return isPrimitive && tag === "[object Number]";
|
|
27
|
+
case "object": return false;
|
|
28
|
+
case "string": return isPrimitive && tag === "[object String]";
|
|
29
|
+
case "symbol": return isPrimitive && tag === "[object Symbol]";
|
|
30
|
+
}
|
|
31
|
+
throw new TypeError(`Unsupported runtime type: ${expected}`);
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { hasRuntimeType as t };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "./registry-
|
|
4
|
-
import { a as
|
|
5
|
-
import { a as getWorkspaceSourceRequestDescriptor, i as workspaceSourceGrantPaths, n as normalizeWorkspaceSourceMetadata, o as isWorkspaceSourceRequestOnly, r as normalizeWorkspaceSourcesMetadata, s as workspaceSourceRequestDescriptorPath, t as WorkspaceSourceMetadata } from "./config-
|
|
1
|
+
import { F as WorkspaceDefinition, Ft as WorkspaceSourceRequestExecutionInput, Ht as WorkspaceSourceResolutionInvocation, It as WorkspaceSourceRequestExecutionResult, gt as WorkspaceSelectedScope, it as WorkspaceName, tt as WorkspaceMaterializeSourcesResult, wt as WorkspaceSource } from "./types-CYuwjJ4V.js";
|
|
2
|
+
import { _ as useWorkspace, i as ReadonlyWorkspaceFacade, m as WritableWorkspaceFacade, o as UseWorkspaceOptions } from "./use-BiHzt0xA.js";
|
|
3
|
+
import { n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "./registry-Uj6IVxes.js";
|
|
4
|
+
import { a as setWorkspaceRuntimeConfig, c as getWorkspaceHostedStoreLoader, i as getWorkspaceRuntimeConfig, l as setWorkspaceHostedStoreLoader, n as setWorkspaceRuntimeAssetsRegistry, o as HostedWorkspaceStoreOptions, r as setWorkspaceRuntimeRegistry, s as WorkspaceHostedStoreLoader, t as invalidateWorkspaceStore, u as resetWorkspaceStoreCache } from "./state-tYcRWEh2.js";
|
|
5
|
+
import { a as getWorkspaceSourceRequestDescriptor, i as workspaceSourceGrantPaths, n as normalizeWorkspaceSourceMetadata, o as isWorkspaceSourceRequestOnly, r as normalizeWorkspaceSourcesMetadata, s as workspaceSourceRequestDescriptorPath, t as WorkspaceSourceMetadata } from "./config-DE9xlaIw.js";
|
|
6
6
|
|
|
7
7
|
//#region src/runtime/dependency-loaders.d.ts
|
|
8
8
|
interface WorkspaceDependencyRuntimeLoaders {
|
|
@@ -33,6 +33,41 @@ interface WorkspaceSourceRequestExecutionTarget {
|
|
|
33
33
|
executeSourceRequest(input: WorkspaceSourceRequestExecutionInput): Promise<WorkspaceSourceRequestExecutionResult>;
|
|
34
34
|
}
|
|
35
35
|
declare function attachWorkspaceSourceRequestExecution<T extends object>(target: T, executor: WorkspaceSourceRequestExecutionTarget | undefined): T;
|
|
36
|
-
declare function getWorkspaceSourceRequestExecution(input:
|
|
36
|
+
declare function getWorkspaceSourceRequestExecution(input: unknown): WorkspaceSourceRequestExecutionTarget | undefined;
|
|
37
37
|
//#endregion
|
|
38
|
-
|
|
38
|
+
//#region src/runtime/preparation.d.ts
|
|
39
|
+
type WorkspacePreparationState = {
|
|
40
|
+
status: "stopped";
|
|
41
|
+
stoppedAt: string;
|
|
42
|
+
} | {
|
|
43
|
+
startedAt: string;
|
|
44
|
+
status: "preparing";
|
|
45
|
+
} | {
|
|
46
|
+
durationMs: number;
|
|
47
|
+
finishedAt: string;
|
|
48
|
+
result: WorkspaceMaterializeSourcesResult;
|
|
49
|
+
startedAt: string;
|
|
50
|
+
status: "ready";
|
|
51
|
+
} | {
|
|
52
|
+
durationMs: number;
|
|
53
|
+
error: string;
|
|
54
|
+
finishedAt: string;
|
|
55
|
+
startedAt: string;
|
|
56
|
+
status: "error";
|
|
57
|
+
};
|
|
58
|
+
interface WorkspacePreparationOptions<Name extends WorkspaceName = WorkspaceName> {
|
|
59
|
+
onStateChange?: (state: WorkspacePreparationState) => void;
|
|
60
|
+
retryDelayMs?: number;
|
|
61
|
+
sources?: readonly string[];
|
|
62
|
+
validate?: (result: WorkspaceMaterializeSourcesResult) => void | Promise<void>;
|
|
63
|
+
workspace: Name;
|
|
64
|
+
}
|
|
65
|
+
interface WorkspacePreparation {
|
|
66
|
+
getState(): WorkspacePreparationState;
|
|
67
|
+
response(): Response;
|
|
68
|
+
start(): Promise<WorkspacePreparationState>;
|
|
69
|
+
stop(): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
declare function createWorkspacePreparation<Name extends WorkspaceName = WorkspaceName>(options: WorkspacePreparationOptions<Name>): WorkspacePreparation;
|
|
72
|
+
//#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, attachWorkspaceSourceRequestExecution, createWorkspacePreparation, createWorkspaceSourceResolutionFacade, getWorkspaceDependencyRuntimeLoaders, getWorkspaceHostedStoreLoader, getWorkspaceRuntimeConfig, getWorkspaceSourceRequestDescriptor, getWorkspaceSourceRequestExecution, hasWorkspaceSourceResolvers, invalidateWorkspaceStore, isWorkspaceSourceRequestOnly, markLiveWorkspaceSource, normalizeWorkspaceSourceMetadata, normalizeWorkspaceSourcesMetadata, registerWorkspace, resetWorkspaceStoreCache, resolveRegisteredWorkspaceDefinition, resolveWorkspaceSources, setWorkspaceDependencyRuntimeLoaders, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, useWorkspace, workspaceSourceGrantPaths, workspaceSourceRequestDescriptorPath };
|