@vite-hub/workspace 0.6.0 → 0.7.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 +5 -5
- package/dist/{asset-registry-0CdRAjIV.js → asset-registry-DJyE42kr.js} +1 -1
- package/dist/blob-database.d.ts +1 -1
- package/dist/blob-database.js +6 -6
- package/dist/checkout.js +2 -2
- package/dist/cloudflare.d.ts +1 -1
- package/dist/cloudflare.js +1 -1
- package/dist/{config-jo5QgE1w.js → config--ZzAvhMp.js} +14 -9
- package/dist/{config-DeA287c0.d.ts → config-DF6sqKXB.d.ts} +1 -1
- package/dist/durability.d.ts +1 -1
- package/dist/durability.js +2 -2
- package/dist/{error-diagnostics-B4me-ouV.js → error-diagnostics-CHgE8TQM.js} +16 -0
- package/dist/{error-diagnostics-kKXseq8d.js → error-diagnostics-CsiNo_oI.js} +3 -3
- package/dist/{file-BrNAXQgY.js → file-DQ5-TBTD.js} +1 -1
- package/dist/{file-metadata-Bpsvjw_X.js → file-metadata-Dqpldj0h.js} +7 -2
- package/dist/{files--z2dLC5z.js → files-D1UkSjzX.js} +2 -2
- package/dist/files.d.ts +5 -5
- package/dist/files.js +5 -5
- package/dist/{github-k--_LCrX.js → github-BECfOMaw.js} +4 -4
- package/dist/{glob-BreFjNAV.js → glob-BIg9O4yY.js} +2 -2
- package/dist/{glob-BEutagp1.js → glob-BIsxLusH.js} +1 -1
- package/dist/{host-C8yZizfk.js → host-BYBRcSnh.js} +7 -7
- package/dist/hosted-vercel-blob.d.ts +1 -1
- package/dist/hosted-vercel-blob.js +464 -1
- package/dist/hosted.d.ts +1 -1
- package/dist/hosted.js +917 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.js +13 -13
- package/dist/internal/path.js +108 -1
- package/dist/internal/workspace.d.ts +2 -3
- package/dist/internal/workspace.js +2 -2
- package/dist/{lifecycle-IReZfi0b.js → lifecycle-BK7WNfcP.js} +8 -8
- package/dist/loader.d.ts +1 -1
- package/dist/loader.js +2 -2
- package/dist/{mcp-resources-DeJnbOaw.js → mcp-resources-F4SJF4_P.js} +2 -2
- package/dist/{memory-BlSRrBH1.js → memory-BCZl_ZsJ.js} +26 -4
- package/dist/{metadata-target-CaGLY4ay.js → metadata-target-DPGF6L68.js} +59 -24
- package/dist/{operation-definition-CqZkx1Rm.d.ts → operations-BALFFdKj.d.ts} +1 -0
- package/dist/{operations-BIaK_uYG.js → operations-DJ_7W0gs.js} +8 -7
- package/dist/operations.d.ts +2 -2
- package/dist/operations.js +1327 -2
- package/dist/{path-Bb9OIc_F.js → path-DYHw5KNk.js} +11 -3
- package/dist/plugins-BYxsPDBH.d.ts +12 -0
- package/dist/{provider-CN14ewvx.js → provider-fcI7kJ5k.js} +256 -70
- package/dist/providers/github/store.d.ts +1 -1
- package/dist/providers/github/store.js +1994 -1
- package/dist/{registry-BbUg9vJB.js → registry-CFeUQsja.js} +3 -3
- package/dist/{registry-B0g19sdy.d.ts → registry-h1-cT-cE.d.ts} +1 -1
- package/dist/{registry-s2Ob9PeX.d.ts → registry-hnARUKNF.d.ts} +2 -2
- package/dist/replacement-CVZVsflC.js +76 -0
- package/dist/{request-scope-CXCI_wCb.js → request-scope-jH4H0Sbm.js} +3 -1
- package/dist/{rule-keys-BLEbi1h5.js → rule-keys-xMpiTLq1.js} +1 -1
- package/dist/{rules-BPDXypZV.js → rules-DYQCKYdt.js} +4 -4
- package/dist/runtime/assets.d.ts +1 -1
- package/dist/runtime/assets.js +4 -4
- package/dist/runtime/empty-assets-registry.d.ts +1 -1
- package/dist/runtime/empty-registry.d.ts +2 -2
- package/dist/runtime/registry.d.ts +1 -1
- package/dist/runtime/request.js +1 -1
- package/dist/runtime/state.d.ts +17 -6
- package/dist/runtime/state.js +7 -7
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +8 -8
- package/dist/runtime.js +38 -23
- package/dist/{search-C_nVorq7.js → search-CG6UNOtn.js} +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +301 -1
- package/dist/{shared-C20Wh1mp.js → shared-PFnkYidS.js} +59 -21
- package/dist/source-metadata.d.ts +2 -2
- package/dist/source-metadata.js +3 -3
- package/dist/{sync-BBfR4g5y.js → sync-CUkCuP_g.js} +5 -5
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/{types-Bel5IDmF.d.ts → types-BnSUug2v.d.ts} +13 -1
- package/dist/{use-D0DyTMxM.js → use-BCMkT-kC.js} +15 -51
- package/dist/{use-CpphIBof.d.ts → use-CJ5rdIrW.d.ts} +1 -1
- package/dist/{use-tools-CHduR5k6.js → use-tools-CcXs2hFA.js} +4 -4
- package/dist/{use-tools-CAK10LTc.d.ts → use-tools-DFVqZwgc.d.ts} +2 -2
- package/dist/{utils-DXP9xfXo.js → utils-Bv1NBg8r.js} +5 -5
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +368 -62
- package/dist/{workspace-BOuxrZrP.d.ts → workspace-B6QreLJd.d.ts} +1 -1
- package/dist/{workspace-CLuPkyZR.js → workspace-D1m00MCM.js} +340 -104
- package/dist/workspace-inspection-scanner-BlJ8bCAB.js +140 -0
- package/package.json +12 -12
- package/dist/errors-CnFDXxeJ.d.ts +0 -4
- package/dist/hosted-8BTKAtMX.js +0 -883
- package/dist/hosted-vercel-blob-B6kygYqn.js +0 -408
- package/dist/operations-DS1C4uXd.js +0 -1308
- package/dist/path-CuYE8-X6.js +0 -57
- package/dist/plugins-CLc32jvL.d.ts +0 -8
- package/dist/server-aa1a4rkV.js +0 -301
- package/dist/state-BdDfBtOR.d.ts +0 -17
- package/dist/store-cx3OqNTi.js +0 -1971
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createWorkspace } from "./workspace-
|
|
1
|
+
import { s as workspaceNotFoundError } from "./internal/path.js";
|
|
2
|
+
import { t as createWorkspace } from "./workspace-D1m00MCM.js";
|
|
3
3
|
import { setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState } from "./runtime/registry.js";
|
|
4
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-
|
|
4
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
5
5
|
import { getViteHubErrorShape, isRuntimeDiagnostic } from "@vite-hub/runtime";
|
|
6
6
|
// src/core/registry.ts
|
|
7
7
|
const workspaceRegistryStateKey = Symbol.for("vitehub.workspace.registryState");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as WorkspaceDefinitionInput, v as ResolvedWorkspaceModuleOptions } from "./types-
|
|
1
|
+
import { R as WorkspaceDefinitionInput, v as ResolvedWorkspaceModuleOptions } from "./types-BnSUug2v.js";
|
|
2
2
|
declare function setWorkspaceRuntimeConfig(config: false | ResolvedWorkspaceModuleOptions): void;
|
|
3
3
|
declare function getWorkspaceRuntimeConfig(): false | ResolvedWorkspaceModuleOptions;
|
|
4
4
|
type WorkspaceRegistryModule = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as WorkspaceDefinition, R as WorkspaceDefinitionInput, w as ValidatedWorkspaceName } from "./types-
|
|
2
|
-
import "./registry-
|
|
1
|
+
import { L as WorkspaceDefinition, R as WorkspaceDefinitionInput, w as ValidatedWorkspaceName } from "./types-BnSUug2v.js";
|
|
2
|
+
import "./registry-h1-cT-cE.js";
|
|
3
3
|
declare function registerWorkspace(name: string, definition: WorkspaceDefinitionInput): WorkspaceDefinition;
|
|
4
4
|
/** Replace one generated catalog's definitions without replacing application registrations. */
|
|
5
5
|
declare function setWorkspaceRuntimeDefinitions(scope: string, definitions: Record<string, WorkspaceDefinitionInput>): void;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { o as workspaceError } from "./internal/path.js";
|
|
2
|
+
import { t as assertPublicFileMetadata } from "./file-metadata-Dqpldj0h.js";
|
|
3
|
+
import { l as normalizeWorkspacePath } from "./path-DYHw5KNk.js";
|
|
4
|
+
// src/storage/replacement.ts
|
|
5
|
+
const replaceStorePath = Symbol.for("vitehub.workspace.replace-path");
|
|
6
|
+
const replacements = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function attachWorkspaceReplacement(owner, replace) {
|
|
8
|
+
replacements.set(owner, replace);
|
|
9
|
+
}
|
|
10
|
+
function getWorkspaceReplacement(owner) {
|
|
11
|
+
return replacements.get(owner);
|
|
12
|
+
}
|
|
13
|
+
function requireWorkspaceReplacement(owner) {
|
|
14
|
+
const replace = getWorkspaceReplacement(owner);
|
|
15
|
+
if (!replace) throw workspaceError("[vitehub] This Workspace does not support safe path replacement.");
|
|
16
|
+
return replace;
|
|
17
|
+
}
|
|
18
|
+
function prepareWorkspaceReplacement(context, replace) {
|
|
19
|
+
return async (replacement, check) => {
|
|
20
|
+
const prepared = [];
|
|
21
|
+
async function prepare(input) {
|
|
22
|
+
await context.grant(input.path);
|
|
23
|
+
const path = normalizeWorkspacePath(input.path);
|
|
24
|
+
const previous = !replacement.removeTree || input.operation === "rm" ? await context.stat(path) : void 0;
|
|
25
|
+
const next = await context.policy.before({
|
|
26
|
+
...input,
|
|
27
|
+
path,
|
|
28
|
+
workspace: context.name,
|
|
29
|
+
previous
|
|
30
|
+
});
|
|
31
|
+
prepared.push(next);
|
|
32
|
+
if (next.path !== path) throw workspaceError(`[vitehub] Workspace validator cannot rewrite preserved path: ${path} -> ${next.path}.`);
|
|
33
|
+
await context.grant(path);
|
|
34
|
+
return next;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
if (replacement.removeTree) await prepare({
|
|
38
|
+
operation: "rm",
|
|
39
|
+
path: replacement.path
|
|
40
|
+
});
|
|
41
|
+
for (const path of replacement.directories) await prepare({
|
|
42
|
+
operation: "mkdir",
|
|
43
|
+
path
|
|
44
|
+
});
|
|
45
|
+
const files = [];
|
|
46
|
+
for (const file of replacement.files) {
|
|
47
|
+
const next = await prepare({
|
|
48
|
+
...file,
|
|
49
|
+
metadata: assertPublicFileMetadata(file.path, file.metadata),
|
|
50
|
+
operation: "writeFile"
|
|
51
|
+
});
|
|
52
|
+
files.push({
|
|
53
|
+
path: next.path,
|
|
54
|
+
content: next.content ?? file.content,
|
|
55
|
+
mediaType: next.mediaType,
|
|
56
|
+
metadata: assertPublicFileMetadata(next.path, next.metadata)
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
await replace({
|
|
60
|
+
...replacement,
|
|
61
|
+
files
|
|
62
|
+
}, async () => {
|
|
63
|
+
await check?.();
|
|
64
|
+
for (const input of prepared) await context.check(input.path);
|
|
65
|
+
});
|
|
66
|
+
} catch (error) {
|
|
67
|
+
for (const input of prepared) await context.policy.error(input, error);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
for (const input of prepared) await context.policy.after(input);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function replacementRecoveryError(path, error, failures) {
|
|
74
|
+
return workspaceError(`[vitehub] Workspace copy failed and could not restore the destination: ${path}.`, { cause: new AggregateError([error, ...failures]) });
|
|
75
|
+
}
|
|
76
|
+
export { replacementRecoveryError as a, replaceStorePath as i, getWorkspaceReplacement as n, requireWorkspaceReplacement as o, prepareWorkspaceReplacement as r, attachWorkspaceReplacement as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as workspaceStoreDiscard } from "./discard-BkoLmmmN.js";
|
|
2
|
+
import { i as replaceStorePath } from "./replacement-CVZVsflC.js";
|
|
2
3
|
import { registerRunScope } from "@vite-hub/runtime/internal/run-scope";
|
|
3
4
|
// src/core/request-scope.ts
|
|
4
5
|
const runtimeGlobal = globalThis;
|
|
@@ -31,7 +32,8 @@ const stagingMethods = [
|
|
|
31
32
|
"writeFile",
|
|
32
33
|
"writeFileConditional",
|
|
33
34
|
"writeFileStream",
|
|
34
|
-
"writeFiles"
|
|
35
|
+
"writeFiles",
|
|
36
|
+
replaceStorePath
|
|
35
37
|
];
|
|
36
38
|
/**
|
|
37
39
|
* Records which request stages writes in a Store that keeps them until `snapshot()`, for every caller of the Store:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
2
2
|
// src/core/rule-keys.ts
|
|
3
3
|
/** The rule fields that a more specific rule replaces only when it sets them. */
|
|
4
4
|
const cascadingRuleKeys = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as normalizeWorkspacePath, r as contentToBytes } from "./path-
|
|
3
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-
|
|
4
|
-
import { n as cascadingRuleKeys, t as assertWorkspaceRules } from "./rule-keys-
|
|
1
|
+
import { o as workspaceError } from "./internal/path.js";
|
|
2
|
+
import { l as normalizeWorkspacePath, r as contentToBytes } from "./path-DYHw5KNk.js";
|
|
3
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
4
|
+
import { n as cascadingRuleKeys, t as assertWorkspaceRules } from "./rule-keys-xMpiTLq1.js";
|
|
5
5
|
import { lookup } from "mrmime";
|
|
6
6
|
import { minimatch } from "minimatch";
|
|
7
7
|
// src/core/plugins.ts
|
package/dist/runtime/assets.d.ts
CHANGED
package/dist/runtime/assets.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as isExcludedWorkspacePath,
|
|
3
|
-
import { t as createWorkspaceGlobMatcher } from "../glob-
|
|
4
|
-
import { t as searchText } from "../search-
|
|
1
|
+
import { normalizeSafeWorkspacePath, o as workspaceError, r as isWorkspaceError } from "../internal/path.js";
|
|
2
|
+
import { a as isExcludedWorkspacePath, f as sha256, i as decodeFile, l as normalizeWorkspacePath } from "../path-DYHw5KNk.js";
|
|
3
|
+
import { t as createWorkspaceGlobMatcher } from "../glob-BIg9O4yY.js";
|
|
4
|
+
import { t as searchText } from "../search-CG6UNOtn.js";
|
|
5
5
|
// src/runtime/assets.ts
|
|
6
6
|
function createMissingPathError(path) {
|
|
7
7
|
return workspaceError(`[vitehub] Workspace file does not exist: ${path}.`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as WorkspaceRegistry } from "../registry-
|
|
2
|
-
import "../registry-
|
|
1
|
+
import { t as WorkspaceRegistry } from "../registry-h1-cT-cE.js";
|
|
2
|
+
import "../registry-hnARUKNF.js";
|
|
3
3
|
declare const registry: WorkspaceRegistry;
|
|
4
4
|
export { registry as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-h1-cT-cE.js";
|
|
2
2
|
export { WorkspaceRegistry, WorkspaceRegistryLoader, WorkspaceRegistryModule, resetWorkspaceRuntimeRegistry, setWorkspaceRuntimeConfig, setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState };
|
package/dist/runtime/request.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as runWorkspaceRequest } from "../request-scope-
|
|
1
|
+
import { t as runWorkspaceRequest } from "../request-scope-jH4H0Sbm.js";
|
|
2
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) {
|
package/dist/runtime/state.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { i as setWorkspaceRuntimeDefinitions, n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "../registry-hnARUKNF.js";
|
|
2
|
+
import { En as WorkspaceStore, T as VercelBlobWorkspaceStoreOptions, k as WorkspaceAssetsRegistry, s as GitHubWorkspaceStoreOptions, t as CloudflareArtifactsWorkspaceStoreOptions } from "../types-BnSUug2v.js";
|
|
3
|
+
import { t as useWorkspace } from "../use-tools-DFVqZwgc.js";
|
|
4
|
+
import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, h as WritableWorkspaceFacade, i as ReadonlyWorkspaceFacade, s as UseWorkspaceOptions, x as useWorkspaceFiles } from "../use-CJ5rdIrW.js";
|
|
5
|
+
import { c as setWorkspaceRuntimeConfig, s as getWorkspaceRuntimeConfig, t as WorkspaceRegistry } from "../registry-h1-cT-cE.js";
|
|
6
|
+
type HostedWorkspaceStoreOptions = CloudflareArtifactsWorkspaceStoreOptions | GitHubWorkspaceStoreOptions | VercelBlobWorkspaceStoreOptions;
|
|
7
|
+
/** Returns `undefined` when no installed hosted store handles `options.provider`. */
|
|
8
|
+
type WorkspaceHostedStoreLoader = (options: HostedWorkspaceStoreOptions, workspaceName: string) => WorkspaceStore | undefined;
|
|
9
|
+
export declare function setWorkspaceHostedStoreLoader(loader: WorkspaceHostedStoreLoader | undefined): void;
|
|
10
|
+
export declare function getWorkspaceHostedStoreLoader(): WorkspaceHostedStoreLoader | undefined;
|
|
11
|
+
type CloudflareWorkerEnv = Record<string, unknown>;
|
|
12
|
+
export declare function setActiveCloudflareEnv(env: CloudflareWorkerEnv | undefined): void;
|
|
13
|
+
export declare function resetWorkspaceStoreCache(): void;
|
|
14
|
+
export declare function invalidateWorkspaceStore(name: string): Promise<void>;
|
|
15
|
+
export declare function setWorkspaceRuntimeRegistry(registry: WorkspaceRegistry): void;
|
|
16
|
+
export declare function setWorkspaceRuntimeAssetsRegistry(registry: WorkspaceAssetsRegistry): void;
|
|
17
|
+
export { type ReadonlyWorkspaceFacade, type ReadonlyWorkspaceFiles, type UseWorkspaceOptions, type WritableWorkspaceFacade, type WritableWorkspaceFiles, getWorkspaceRuntimeConfig, WorkspaceHostedStoreLoader as n, registerWorkspace, resolveRegisteredWorkspaceDefinition, setWorkspaceRuntimeConfig, setWorkspaceRuntimeDefinitions, HostedWorkspaceStoreOptions as t, useWorkspace, useWorkspaceFiles };
|
package/dist/runtime/state.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as setWorkspaceRegistry, i as resolveRegisteredWorkspaceDefinition, o as setWorkspaceRuntimeDefinitions, r as registerWorkspace } from "../registry-
|
|
2
|
-
import { t as setWorkspaceAssetsRegistry } from "../asset-registry-
|
|
3
|
-
import { n as invalidateCachedWorkspaceStore, r as resetWorkspaceStoreCache } from "../workspace-
|
|
4
|
-
import { A as setActiveCloudflareEnv } from "../shared-
|
|
5
|
-
import { t as useWorkspace } from "../use-tools-
|
|
6
|
-
import { r as useWorkspaceFiles } from "../use-
|
|
7
|
-
import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "../provider-
|
|
1
|
+
import { a as setWorkspaceRegistry, i as resolveRegisteredWorkspaceDefinition, o as setWorkspaceRuntimeDefinitions, r as registerWorkspace } from "../registry-CFeUQsja.js";
|
|
2
|
+
import { t as setWorkspaceAssetsRegistry } from "../asset-registry-DJyE42kr.js";
|
|
3
|
+
import { n as invalidateCachedWorkspaceStore, r as resetWorkspaceStoreCache } from "../workspace-D1m00MCM.js";
|
|
4
|
+
import { A as setActiveCloudflareEnv } from "../shared-PFnkYidS.js";
|
|
5
|
+
import { t as useWorkspace } from "../use-tools-CcXs2hFA.js";
|
|
6
|
+
import { r as useWorkspaceFiles } from "../use-BCMkT-kC.js";
|
|
7
|
+
import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "../provider-fcI7kJ5k.js";
|
|
8
8
|
import { n as setWorkspaceRuntimeConfig, t as getWorkspaceRuntimeConfig } from "../config-CsgNNVAI.js";
|
|
9
9
|
// src/runtime/state.ts
|
|
10
10
|
async function invalidateWorkspaceStore(name) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createWorkspace } from "../workspace-
|
|
1
|
+
import { t as createWorkspace } from "../workspace-B6QreLJd.js";
|
|
2
2
|
export { createWorkspace };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as createWorkspace } from "../workspace-
|
|
1
|
+
export { t as createWorkspace } from "../workspace-D1m00MCM.js";
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { c as setWorkspaceRuntimeConfig, s as getWorkspaceRuntimeConfig } from "./registry-
|
|
2
|
-
import {
|
|
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-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as useWorkspace } from "./use-tools-
|
|
7
|
-
import { t as registerWorkspacePlugin } from "./plugins-
|
|
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-
|
|
1
|
+
import { c as setWorkspaceRuntimeConfig, s as getWorkspaceRuntimeConfig } from "./registry-h1-cT-cE.js";
|
|
2
|
+
import { getWorkspaceHostedStoreLoader, invalidateWorkspaceStore, n as WorkspaceHostedStoreLoader, resetWorkspaceStoreCache, setWorkspaceHostedStoreLoader, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeRegistry, t as HostedWorkspaceStoreOptions } from "./runtime/state.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-CJ5rdIrW.js";
|
|
4
|
+
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-BnSUug2v.js";
|
|
5
|
+
import { i as setWorkspaceRuntimeDefinitions, n as registerWorkspace, r as resolveRegisteredWorkspaceDefinition } from "./registry-hnARUKNF.js";
|
|
6
|
+
import { t as useWorkspace } from "./use-tools-DFVqZwgc.js";
|
|
7
|
+
import { t as registerWorkspacePlugin } from "./plugins-BYxsPDBH.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-DF6sqKXB.js";
|
|
9
9
|
interface WorkspaceDependencyRuntimeLoaders {
|
|
10
10
|
shellWorkspace: () => Promise<unknown>;
|
|
11
11
|
}
|
package/dist/runtime.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { n as setWorkspaceRuntimeConfig, t as getWorkspaceRuntimeConfig } from "./config-CsgNNVAI.js";
|
|
2
|
-
import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "./provider-
|
|
3
|
-
import { i as setWorkspaceDependencyRuntimeLoaders, n as createWorkspaceTools, r as getWorkspaceDependencyRuntimeLoaders, t as useWorkspace } from "./use-tools-
|
|
2
|
+
import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "./provider-fcI7kJ5k.js";
|
|
3
|
+
import { i as setWorkspaceDependencyRuntimeLoaders, n as createWorkspaceTools, r as getWorkspaceDependencyRuntimeLoaders, t as useWorkspace } from "./use-tools-CcXs2hFA.js";
|
|
4
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
|
|
6
|
-
import {
|
|
7
|
-
import { l as normalizeWorkspacePath } from "./path-
|
|
8
|
-
import { a as createWorkspaceHistoryReader, c as forwardWorkspaceHistoryFiles, i as createWorkspaceHistory, l as forwardWorkspaceHistoryMerge } from "./utils-
|
|
9
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-
|
|
10
|
-
import { r as registerWorkspacePlugin, t as createWorkspaceWritePolicy } from "./rules-
|
|
11
|
-
import { a as copyWorkspacePath,
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
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";
|
|
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--ZzAvhMp.js";
|
|
6
|
+
import { o as workspaceError } from "./internal/path.js";
|
|
7
|
+
import { l as normalizeWorkspacePath, u as readStoredFile } from "./path-DYHw5KNk.js";
|
|
8
|
+
import { a as createWorkspaceHistoryReader, c as forwardWorkspaceHistoryFiles, i as createWorkspaceHistory, l as forwardWorkspaceHistoryMerge } from "./utils-Bv1NBg8r.js";
|
|
9
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
10
|
+
import { r as registerWorkspacePlugin, t as createWorkspaceWritePolicy } from "./rules-DYQCKYdt.js";
|
|
11
|
+
import { _ as attachWorkspaceSourceRequestExecution, a as isInternalWorkspaceMetaKey, b as workspaceSourceRequestMatches, c as isWorkspaceSourceSyncMetaKey, g as copyWorkspacePath, h as appendWorkspaceFile, m as appendCondition, o as createWorkspaceSourceView, p as resolveWorkspacePath, r as resetWorkspaceStoreCache, v as createWorkspaceSourceRequestExecution, x as createBasicWorkspaceSession, y as getWorkspaceSourceRequestExecution } from "./workspace-D1m00MCM.js";
|
|
12
|
+
import { t as createMemoryWorkspaceStore } from "./memory-BCZl_ZsJ.js";
|
|
13
|
+
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-DPGF6L68.js";
|
|
15
14
|
import { a as provideWorkspaceStoreTarget, i as forwardWorkspaceStoreTarget, o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
|
|
15
|
+
import { n as getWorkspaceReplacement, r as prepareWorkspaceReplacement, t as attachWorkspaceReplacement } from "./replacement-CVZVsflC.js";
|
|
16
16
|
import { t as isRecord } from "./object-CAK6UYR5.js";
|
|
17
|
-
import { i as resolveRegisteredWorkspaceDefinition, o as setWorkspaceRuntimeDefinitions, r as registerWorkspace } from "./registry-
|
|
17
|
+
import { i as resolveRegisteredWorkspaceDefinition, o as setWorkspaceRuntimeDefinitions, r as registerWorkspace } from "./registry-CFeUQsja.js";
|
|
18
|
+
import { r as useWorkspaceFiles } from "./use-BCMkT-kC.js";
|
|
18
19
|
import { join, resolve } from "node:path";
|
|
19
20
|
import { randomUUID } from "node:crypto";
|
|
20
21
|
import { lstat, readdir, rename, rm } from "node:fs/promises";
|
|
@@ -118,7 +119,7 @@ function createOverlaySourceStore(workspace, fallback, backingMetadataTarget) {
|
|
|
118
119
|
const stat = await workspace.fs.stat(path).catch(() => void 0);
|
|
119
120
|
if (stat?.type === "directory") return;
|
|
120
121
|
return {
|
|
121
|
-
content: await workspace.fs
|
|
122
|
+
content: await readStoredFile(workspace.fs, path),
|
|
122
123
|
mediaType: stat?.mediaType,
|
|
123
124
|
metadata: stat?.metadata,
|
|
124
125
|
path
|
|
@@ -215,7 +216,7 @@ function createWritableFacadeStore(workspace, sourceSync) {
|
|
|
215
216
|
const stat = await workspace.fs.stat(path);
|
|
216
217
|
if (stat.type === "directory") return;
|
|
217
218
|
return {
|
|
218
|
-
content: await workspace.fs
|
|
219
|
+
content: await readStoredFile(workspace.fs, path),
|
|
219
220
|
mediaType: stat.mediaType,
|
|
220
221
|
metadata: stat.metadata,
|
|
221
222
|
path
|
|
@@ -287,7 +288,7 @@ function createWritableFacadeStore(workspace, sourceSync) {
|
|
|
287
288
|
async function startOverlayWorkspaceSession(_definition, workspace, options) {
|
|
288
289
|
const host = options?.host;
|
|
289
290
|
if (host) {
|
|
290
|
-
const { createHostedWorkspaceSession } = await import("./host-
|
|
291
|
+
const { createHostedWorkspaceSession } = await import("./host-BYBRcSnh.js").then((n) => n.n);
|
|
291
292
|
return await createHostedWorkspaceSession(workspace, {
|
|
292
293
|
...options,
|
|
293
294
|
host
|
|
@@ -473,10 +474,7 @@ async function createWorkspaceSourceResolutionFacade(workspace, definition, opti
|
|
|
473
474
|
};
|
|
474
475
|
}
|
|
475
476
|
const writeFs = attachWorkspaceSourceRequestExecution({
|
|
476
|
-
appendFile: async (path, content) =>
|
|
477
|
-
await sourceView.assertWritable(path);
|
|
478
|
-
await appendWorkspaceFile(writeWorkspace, path, content);
|
|
479
|
-
},
|
|
477
|
+
appendFile: async (path, content) => await appendWorkspaceFile(writeWorkspace, path, content),
|
|
480
478
|
copyPath: async (from, to, options) => {
|
|
481
479
|
await sourceView.assertWritable(to);
|
|
482
480
|
await copyWorkspacePath(writeWorkspace, from, to, options?.overwrite);
|
|
@@ -516,6 +514,10 @@ async function createWorkspaceSourceResolutionFacade(workspace, definition, opti
|
|
|
516
514
|
operation: "writeFile",
|
|
517
515
|
path
|
|
518
516
|
}, async (next, grant) => {
|
|
517
|
+
if (options?.[appendCondition]) {
|
|
518
|
+
if (!selectedScopeCanRead(selectedWorkspaceScope, next.path)) throw workspaceError(`[vitehub] Cannot append to ${next.path}: this Source scope cannot read the path.`);
|
|
519
|
+
if (!canUseBase(next.path) && await workspace.fs.exists(next.path)) throw workspaceError(`[vitehub] Cannot append to ${next.path}: this Source view hides the backing file.`);
|
|
520
|
+
}
|
|
519
521
|
const writeOptions = options === void 0 && next.mediaType === void 0 && next.metadata === void 0 ? void 0 : {
|
|
520
522
|
...options,
|
|
521
523
|
mediaType: next.mediaType,
|
|
@@ -552,11 +554,24 @@ async function createWorkspaceSourceResolutionFacade(workspace, definition, opti
|
|
|
552
554
|
},
|
|
553
555
|
stat: writeFs.stat,
|
|
554
556
|
sync: async (options) => {
|
|
555
|
-
const { syncWorkspaceSources } = await import("./sync-
|
|
557
|
+
const { syncWorkspaceSources } = await import("./sync-CUkCuP_g.js");
|
|
556
558
|
return await syncWorkspaceSources(resolvedDefinition, syncStore, options);
|
|
557
559
|
},
|
|
558
560
|
writeFile: writeFs.writeFile
|
|
559
561
|
}, sourceRequestExecution);
|
|
562
|
+
const replaceBase = getWorkspaceReplacement(workspace.fs);
|
|
563
|
+
if (replaceBase) {
|
|
564
|
+
const replace = prepareWorkspaceReplacement({
|
|
565
|
+
name: resolvedDefinition.name,
|
|
566
|
+
policy: writePolicy,
|
|
567
|
+
stat: previousStat,
|
|
568
|
+
grant: sourceView.assertWritable,
|
|
569
|
+
check: sourceView.assertWritableCurrentPath
|
|
570
|
+
}, replaceBase);
|
|
571
|
+
attachWorkspaceReplacement(writeWorkspace, replace);
|
|
572
|
+
attachWorkspaceReplacement(writeFs, replace);
|
|
573
|
+
}
|
|
574
|
+
forwardWorkspaceStoreTarget(workspace, writeWorkspace);
|
|
560
575
|
const createWriteTools = (options) => createWorkspaceTools(writeWorkspace, {
|
|
561
576
|
broadSearchPaths: options?.broadSearchPaths,
|
|
562
577
|
cwd: options?.cwd,
|
|
@@ -1062,8 +1077,8 @@ async function recoverLocalWorkspaceLocks(options) {
|
|
|
1062
1077
|
}
|
|
1063
1078
|
let removed = 0;
|
|
1064
1079
|
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
1065
|
-
const markerName = /^[a-f0-9]{64}\.(gate|readers|writers)$/.test(entry.name);
|
|
1066
|
-
const quarantineName = /^\.recovery-[a-f0-9]{64}\.(gate|readers|writers)-[0-9a-f-]+$/.test(entry.name);
|
|
1080
|
+
const markerName = /^[a-f0-9]{64}\.(gate|gate\.reclaim|readers|writers)$/.test(entry.name);
|
|
1081
|
+
const quarantineName = /^\.recovery-[a-f0-9]{64}\.(gate|gate\.reclaim|readers|writers)-[0-9a-f-]+$/.test(entry.name);
|
|
1067
1082
|
if (!markerName && !quarantineName) continue;
|
|
1068
1083
|
if (markerName && (!entry.isDirectory() || entry.isSymbolicLink())) throw workspaceError(`[vitehub] Expected a real Workspace lock marker directory: ${entry.name}.`);
|
|
1069
1084
|
const source = join(directory, entry.name);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
|
|
2
|
-
import { l as normalizeWorkspacePath } from "./path-
|
|
2
|
+
import { l as normalizeWorkspacePath } from "./path-DYHw5KNk.js";
|
|
3
3
|
// src/core/search.ts
|
|
4
4
|
var search_exports = /* @__PURE__ */ __exportAll({ searchText: () => searchText });
|
|
5
5
|
function toSearchRegExp(query) {
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles } from "./use-
|
|
2
|
-
import { Dt as WorkspaceName, Gt as WorkspaceSessionHost, Jt as WorkspaceSessionOptions, L as WorkspaceDefinition, Mt as WorkspacePrepareSessionProgressEvent, Wt as WorkspaceSession, i as ExecResult } from "./types-
|
|
1
|
+
import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles } from "./use-CJ5rdIrW.js";
|
|
2
|
+
import { Dt as WorkspaceName, Gt as WorkspaceSessionHost, Jt as WorkspaceSessionOptions, L as WorkspaceDefinition, Mt as WorkspacePrepareSessionProgressEvent, Wt as WorkspaceSession, i as ExecResult } from "./types-BnSUug2v.js";
|
|
3
3
|
export declare const workspaceDevRoute = "/__vitehub/workspace/dev";
|
|
4
4
|
export declare const workspaceDevHeader = "x-vitehub-workspace-dev";
|
|
5
5
|
export declare const workspaceDevHeaderValue = "1";
|