@vite-hub/workspace 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -19
- package/dist/{abort-BCwpdrN0.js → abort-CQGxJBqa.js} +1 -2
- package/dist/{asset-registry-DfBV5kmw.js → asset-registry-0CdRAjIV.js} +2 -3
- package/dist/blob-database/postgres.d.ts +423 -0
- package/dist/blob-database/postgres.js +1 -0
- package/dist/blob-database-sources-CQPAyCz3.js +8 -0
- package/dist/blob-database.d.ts +29 -449
- package/dist/blob-database.js +636 -210
- package/dist/checkout.d.ts +1 -2
- package/dist/checkout.js +3 -4
- package/dist/cloudflare.d.ts +1 -5
- package/dist/cloudflare.js +1 -2
- package/dist/{config-B-863EgC.js → config-CsgNNVAI.js} +1 -2
- package/dist/{config-CDeGd0RB.d.ts → config-DeA287c0.d.ts} +1 -5
- package/dist/{config-D1QENneP.js → config-jo5QgE1w.js} +18 -27
- package/dist/{discard-CNNtCozM.js → discard-BkoLmmmN.js} +1 -2
- package/dist/durability.d.ts +10 -4
- package/dist/durability.js +47 -6
- package/dist/{error-diagnostics-B5s9kNEA.js → error-diagnostics-B4me-ouV.js} +11 -4
- package/dist/{error-diagnostics-CQ4BUqRe.js → error-diagnostics-kKXseq8d.js} +10 -3
- package/dist/{path-uxLkzrZm.d.ts → errors-CnFDXxeJ.d.ts} +0 -3
- package/dist/{file-CqG9zqiF.js → file-BrNAXQgY.js} +4 -8
- package/dist/{target-Dm9dHAVJ.js → file-metadata-Bpsvjw_X.js} +3 -32
- package/dist/{files-B6wpAhEx.js → files--z2dLC5z.js} +3 -4
- package/dist/files.d.ts +12 -8
- package/dist/files.js +7 -6
- package/dist/{github-DKAlO0Vh.js → github-k--_LCrX.js} +7 -9
- package/dist/{glob-BOqSKzSg.js → glob-BEutagp1.js} +9 -10
- package/dist/{glob-Cjxms1t7.js → glob-BreFjNAV.js} +3 -4
- package/dist/history-schema-BR4UDPHL.d.ts +434 -0
- package/dist/history-schema-postgres-DZepCSBq.js +40 -0
- package/dist/{host-Bf1a2uo_.js → host-C8yZizfk.js} +153 -22
- package/dist/{hosted-zG7HJaE4.js → hosted-8BTKAtMX.js} +27 -21
- package/dist/{hosted-vercel-blob-AbXG8fvR.js → hosted-vercel-blob-B6kygYqn.js} +10 -12
- package/dist/hosted-vercel-blob.d.ts +1 -3
- package/dist/hosted-vercel-blob.js +1 -2
- package/dist/hosted.d.ts +1 -3
- package/dist/hosted.js +1 -2
- package/dist/index.d.ts +11 -41
- package/dist/index.js +34 -116
- package/dist/internal/path.d.ts +1 -1
- package/dist/internal/path.js +1 -2
- package/dist/internal/workspace.d.ts +10 -0
- package/dist/internal/workspace.js +85 -0
- package/dist/{lifecycle-D8FdpBod.js → lifecycle-IReZfi0b.js} +15 -13
- package/dist/lineage.d.ts +1 -3
- package/dist/lineage.js +1 -2
- package/dist/loader.d.ts +1 -7
- package/dist/loader.js +4 -6
- package/dist/{mcp-resources-DntxtmDU.js → mcp-resources-DeJnbOaw.js} +4 -5
- package/dist/{memory-D5jq9HZW.js → memory-BlSRrBH1.js} +19 -13
- package/dist/{metadata-target-DDoOQNp1.js → metadata-target-CaGLY4ay.js} +214 -77
- package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
- package/dist/{operation-definition-nmRu_O3V.d.ts → operation-definition-CqZkx1Rm.d.ts} +8 -6
- package/dist/{operations-DsY2MQnG.js → operations-CtRDU3cA.js} +34 -29
- package/dist/{operations-D8uCpzhM.js → operations-DfbqHWAe.js} +7 -8
- package/dist/operations.d.ts +2 -6
- package/dist/operations.js +2 -2
- package/dist/{path--wrT_Azm.js → path-Bb9OIc_F.js} +3 -19
- package/dist/{path-zHxQUbqa.d.ts → path-C0uZxDdW.d.ts} +0 -2
- package/dist/{path-DrSIenjj.js → path-CuYE8-X6.js} +2 -4
- package/dist/{plugins-CsrXCA1Q.d.ts → plugins-CLc32jvL.d.ts} +1 -3
- package/dist/{provider-sm9uzkLg.js → provider-CN14ewvx.js} +30 -22
- package/dist/providers/github/store.d.ts +2 -4
- package/dist/providers/github/store.js +1 -2
- package/dist/{registry-CFl1Htyc.d.ts → registry-B0g19sdy.d.ts} +5 -8
- package/dist/{registry-DmVfUe4K.js → registry-BbUg9vJB.js} +10 -6
- package/dist/registry-s2Ob9PeX.d.ts +9 -0
- package/dist/{request-scope-Dw5n8bMC.js → request-scope-CXCI_wCb.js} +4 -4
- package/dist/{results-DgkZUmTL.js → results-z-HpV9EP.js} +1 -2
- package/dist/{rolldown-runtime-rQ84J-ij.js → rolldown-runtime-DnNXxpGL.js} +2 -3
- package/dist/rule-keys-BLEbi1h5.js +18 -0
- package/dist/rules-BPDXypZV.js +267 -0
- package/dist/runtime/assets.d.ts +2 -3
- package/dist/runtime/assets.js +5 -6
- package/dist/runtime/empty-assets-registry.d.ts +1 -3
- package/dist/runtime/empty-assets-registry.js +1 -2
- package/dist/runtime/empty-registry.d.ts +2 -4
- package/dist/runtime/empty-registry.js +1 -2
- package/dist/runtime/registry.d.ts +2 -2
- package/dist/runtime/registry.js +2 -3
- package/dist/runtime/request.d.ts +1 -3
- package/dist/runtime/request.js +2 -3
- package/dist/runtime/state.d.ts +5 -4
- package/dist/runtime/state.js +18 -7
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -2
- package/dist/runtime.d.ts +9 -24
- package/dist/runtime.js +29 -25
- package/dist/{search-C_RfoM2j.js → search-C_nVorq7.js} +3 -4
- package/dist/{server-Cd4-iCh5.js → server-aa1a4rkV.js} +8 -10
- package/dist/server.d.ts +3 -4
- package/dist/server.js +1 -2
- package/dist/{shared-ovXVSV3-.js → shared-C20Wh1mp.js} +23 -19
- package/dist/source-metadata.d.ts +2 -6
- package/dist/source-metadata.js +4 -5
- package/dist/state-BdDfBtOR.d.ts +17 -0
- package/dist/{store-NZoRto-Y.js → store-cx3OqNTi.js} +42 -44
- package/dist/{sync-CrT8zjwc.js → sync-BBfR4g5y.js} +6 -7
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -2
- package/dist/{types-1Z-tKK3g.d.ts → types-Bel5IDmF.d.ts} +52 -6
- package/dist/{use-CjbF8EO9.d.ts → use-CpphIBof.d.ts} +20 -32
- package/dist/{use-B0o5HoBl.js → use-D0DyTMxM.js} +19 -21
- package/dist/use-tools-CAK10LTc.d.ts +10 -0
- package/dist/{state-Cb_hIyAw.js → use-tools-CHduR5k6.js} +8 -24
- package/dist/{utils-Dw-WULEZ.js → utils-DXP9xfXo.js} +80 -273
- package/dist/vite.d.ts +30 -19
- package/dist/vite.js +1481 -1617
- package/dist/vitehub-grants-Co713QTg.js +36 -0
- package/dist/workspace-BOuxrZrP.d.ts +5 -0
- package/dist/{workspace-DvKu5PRa.js → workspace-CLuPkyZR.js} +28 -36
- package/package.json +34 -24
- package/dist/registry-CwryP59t.d.ts +0 -9
- package/dist/state-C-YtsaiJ.d.ts +0 -35
- package/dist/workspace-CIXgHeyX.d.ts +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { l as normalizeWorkspacePath } from "./path
|
|
3
|
-
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
|
|
2
|
+
import { l as normalizeWorkspacePath } from "./path-Bb9OIc_F.js";
|
|
3
|
+
// src/core/search.ts
|
|
4
4
|
var search_exports = /* @__PURE__ */ __exportAll({ searchText: () => searchText });
|
|
5
5
|
function toSearchRegExp(query) {
|
|
6
6
|
const source = query.regex ? query.pattern : escapeRegExp(query.pattern);
|
|
@@ -36,5 +36,4 @@ function searchText(path, content, query) {
|
|
|
36
36
|
function escapeRegExp(input) {
|
|
37
37
|
return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { search_exports as n, searchText as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as normalizeSafeWorkspacePath } from "./path-
|
|
2
|
-
import { s as matchesAny } from "./path
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { r as
|
|
6
|
-
import {
|
|
1
|
+
import { t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
|
|
2
|
+
import { s as matchesAny } from "./path-Bb9OIc_F.js";
|
|
3
|
+
import { i as workspaceDefinitionPlugins, n as resolveWorkspaceAutoCommit } from "./rules-BPDXypZV.js";
|
|
4
|
+
import { r as useWorkspaceFiles } from "./use-D0DyTMxM.js";
|
|
5
|
+
import { r as withWorkspaceProgress } from "./host-C8yZizfk.js";
|
|
6
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
|
|
7
7
|
import { getViteHubErrorShape } from "@vite-hub/runtime";
|
|
8
8
|
import { lookup } from "mrmime";
|
|
9
|
-
|
|
9
|
+
// ../internal/src/secret.ts
|
|
10
10
|
const secretEncoder = new TextEncoder();
|
|
11
11
|
/**
|
|
12
12
|
* Compares a request value with an expected secret in constant time for the length of `expected`. Returns `false`
|
|
@@ -21,8 +21,7 @@ function isViteHubSecretEqual(actual, expected) {
|
|
|
21
21
|
return difference === 0;
|
|
22
22
|
}
|
|
23
23
|
Object.freeze({ prefix: "sha256=" });
|
|
24
|
-
|
|
25
|
-
//#region src/server.ts
|
|
24
|
+
// src/server.ts
|
|
26
25
|
const workspaceDevRoute = "/__vitehub/workspace/dev";
|
|
27
26
|
const workspaceDevHeader = "x-vitehub-workspace-dev";
|
|
28
27
|
const workspaceDevHeaderValue = "1";
|
|
@@ -299,5 +298,4 @@ async function runWorkspaceDevCommand(input) {
|
|
|
299
298
|
await session.close();
|
|
300
299
|
return result;
|
|
301
300
|
}
|
|
302
|
-
//#endregion
|
|
303
301
|
export { refreshWorkspaceDevToken as a, workspaceDevHeader as c, workspaceDevTokenHeader as d, workspaceDevTokenServerId as f, readWorkspaceFileResponse as i, workspaceDevHeaderValue as l, ensureWorkspaceDevToken as n, runWorkspaceDevCommand as o, isViteHubSecretEqual as p, readWorkspaceDevToken as r, validateWorkspaceDevToken as s, defineWorkspaceFileHandler as t, workspaceDevRoute as u };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
//#region src/server.d.ts
|
|
1
|
+
import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles } from "./use-CpphIBof.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-Bel5IDmF.js";
|
|
4
3
|
export declare const workspaceDevRoute = "/__vitehub/workspace/dev";
|
|
5
4
|
export declare const workspaceDevHeader = "x-vitehub-workspace-dev";
|
|
6
5
|
export declare const workspaceDevHeaderValue = "1";
|
|
@@ -59,4 +58,4 @@ export declare function defineWorkspaceFileHandler<Name extends WorkspaceName>(o
|
|
|
59
58
|
fetch(request: Request): Promise<Response>;
|
|
60
59
|
};
|
|
61
60
|
export declare function runWorkspaceDevCommand<Name extends WorkspaceName>(input: WorkspaceDevCommandInput<Name>): Promise<ExecResult>;
|
|
62
|
-
|
|
61
|
+
export {};
|
package/dist/server.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { defineWorkspaceFileHandler, ensureWorkspaceDevToken, readWorkspaceDevToken, readWorkspaceFileResponse, refreshWorkspaceDevToken, runWorkspaceDevCommand, validateWorkspaceDevToken, workspaceDevHeader, workspaceDevHeaderValue, workspaceDevRoute, workspaceDevTokenHeader, workspaceDevTokenServerId };
|
|
1
|
+
export { t as defineWorkspaceFileHandler, n as ensureWorkspaceDevToken, r as readWorkspaceDevToken, i as readWorkspaceFileResponse, a as refreshWorkspaceDevToken, o as runWorkspaceDevCommand, s as validateWorkspaceDevToken, c as workspaceDevHeader, l as workspaceDevHeaderValue, u as workspaceDevRoute, d as workspaceDevTokenHeader, f as workspaceDevTokenServerId } from "./server-aa1a4rkV.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
1
|
+
import { t as abortable } from "./abort-CQGxJBqa.js";
|
|
2
|
+
import { t as internalErrorDiagnostics } from "./error-diagnostics-kKXseq8d.js";
|
|
3
|
+
import { a as workspaceConflict, s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
|
|
4
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
|
|
5
|
+
import { l as normalizeWorkspacePath } from "./path-Bb9OIc_F.js";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { gunzipSync } from "node:zlib";
|
|
8
|
-
|
|
8
|
+
// ../internal/src/forge.ts
|
|
9
9
|
/**
|
|
10
10
|
* Server Env of each Forge, keyed by the `env.server.<forge>.<field>` path.
|
|
11
11
|
* Channels, Capabilities, Workspaces and Sources read the same names.
|
|
@@ -53,6 +53,17 @@ const forgeEnv = {
|
|
|
53
53
|
names: ["VITEHUB_FORGEJO_WEBHOOK_SECRET", "FORGES_FORGEJO_WEBHOOK_SECRET"],
|
|
54
54
|
secret: true
|
|
55
55
|
}
|
|
56
|
+
},
|
|
57
|
+
gitea: {
|
|
58
|
+
baseUrl: { names: ["VITEHUB_GITEA_BASE_URL", "FORGES_GITEA_BASE_URL"] },
|
|
59
|
+
token: {
|
|
60
|
+
names: ["VITEHUB_GITEA_TOKEN", "FORGES_GITEA_TOKEN"],
|
|
61
|
+
secret: true
|
|
62
|
+
},
|
|
63
|
+
webhookSecret: {
|
|
64
|
+
names: ["VITEHUB_GITEA_WEBHOOK_SECRET", "FORGES_GITEA_WEBHOOK_SECRET"],
|
|
65
|
+
secret: true
|
|
66
|
+
}
|
|
56
67
|
}
|
|
57
68
|
};
|
|
58
69
|
/**
|
|
@@ -90,8 +101,7 @@ function forgeImportError(error, feature) {
|
|
|
90
101
|
function isMissingForge(error) {
|
|
91
102
|
return error instanceof Error && /(?:cannot find (?:package|module)|no such module|could not resolve) ['"]@vite-hub\/forge['"]/i.test(error.message);
|
|
92
103
|
}
|
|
93
|
-
|
|
94
|
-
//#region ../internal/src/runtime/cloudflare-env-lookup.ts
|
|
104
|
+
// ../internal/src/runtime/cloudflare-env-lookup.ts
|
|
95
105
|
/** The key of the AsyncLocalStorage store on `globalThis`. Every bundled copy of this module shares the store. */
|
|
96
106
|
const activeEnvStorageKey = Symbol.for("vitehub.cloudflare.env-storage");
|
|
97
107
|
let activeEnv;
|
|
@@ -108,8 +118,7 @@ function getActiveCloudflareEnv() {
|
|
|
108
118
|
const host = globalThis;
|
|
109
119
|
return Object.hasOwn(host, "__env__") && host.__env__ !== void 0 ? host.__env__ : activeEnv;
|
|
110
120
|
}
|
|
111
|
-
|
|
112
|
-
//#region ../internal/src/runtime/cloudflare-env.ts
|
|
121
|
+
// ../internal/src/runtime/cloudflare-env.ts
|
|
113
122
|
const runtimeGlobal = globalThis;
|
|
114
123
|
const activeEnvStorage = runtimeGlobal[activeEnvStorageKey] ||= new AsyncLocalStorage();
|
|
115
124
|
const globalEnvProbe = Symbol("vitehub.cloudflare.global-env-probe");
|
|
@@ -142,8 +151,7 @@ function getActiveCloudflareBinding(name) {
|
|
|
142
151
|
const env = getActiveCloudflareEnv();
|
|
143
152
|
return env && Object.hasOwn(env, name) ? env[name] : void 0;
|
|
144
153
|
}
|
|
145
|
-
|
|
146
|
-
//#region src/providers/github/bounded-map.ts
|
|
154
|
+
// src/providers/github/bounded-map.ts
|
|
147
155
|
/** A Map that keeps the `limit` most recently used entries. */
|
|
148
156
|
var BoundedMap = class extends Map {
|
|
149
157
|
limit;
|
|
@@ -168,8 +176,7 @@ var BoundedMap = class extends Map {
|
|
|
168
176
|
return this;
|
|
169
177
|
}
|
|
170
178
|
};
|
|
171
|
-
|
|
172
|
-
//#region src/providers/github/cache.ts
|
|
179
|
+
// src/providers/github/cache.ts
|
|
173
180
|
/** How long a kept answer stays in KV, in seconds. A commit that nobody reads for a week leaves KV. */
|
|
174
181
|
const kvTTL = 604800;
|
|
175
182
|
const stats = {
|
|
@@ -346,8 +353,7 @@ function fromBase64(text) {
|
|
|
346
353
|
for (let index = 0; index < binary.length; index++) bytes[index] = binary.charCodeAt(index);
|
|
347
354
|
return bytes;
|
|
348
355
|
}
|
|
349
|
-
|
|
350
|
-
//#region src/providers/github/tar.ts
|
|
356
|
+
// src/providers/github/tar.ts
|
|
351
357
|
const decoder = new TextDecoder();
|
|
352
358
|
function text(bytes) {
|
|
353
359
|
const end = bytes.indexOf(0);
|
|
@@ -399,8 +405,7 @@ function readTarGz(archive) {
|
|
|
399
405
|
}
|
|
400
406
|
return files;
|
|
401
407
|
}
|
|
402
|
-
|
|
403
|
-
//#region src/providers/github/shared.ts
|
|
408
|
+
// src/providers/github/shared.ts
|
|
404
409
|
const githubReadAttempts = 3;
|
|
405
410
|
function retryDelay(response, attempt) {
|
|
406
411
|
const retryAfter = response.headers.get("retry-after");
|
|
@@ -848,5 +853,4 @@ async function commitGitHubChanges(input) {
|
|
|
848
853
|
throw error;
|
|
849
854
|
}
|
|
850
855
|
}
|
|
851
|
-
//#endregion
|
|
852
856
|
export { setActiveCloudflareEnv as A, githubKVKey as C, writeWorkspaceKV as D, registerWorkspaceKV as E, readForgeEnv as M, BoundedMap as O, resolveGitHubRootOption as S, readWorkspaceKV as T, requireGitHubOption as _, gitFileMode as a, resolveGitHubRefsOption as b, githubRequestStatus as c, preloadGitHubFiles as d, readCurrentHead as f, readGitHubFile as g, readGitHubEnvToken as h, gitBlobSha as i, forgeEnv as j, getActiveCloudflareBinding as k, joinGitPath as l, readGitHubBranchState as m, commitGitHubChanges as n, githubBranchMovedConflict as o, readGitHubArchive as p, connectGitHubRepository as r, githubRequest as s, assertNoGitHubRepositoryKey as t, loadForge as u, resolveGitHubBranchOption as v, readGitHubReadStats as w, resolveGitHubRepositoryOption as x, resolveGitHubCredential as y };
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as workspaceSourceGrantPaths, n as normalizeWorkspaceSourceMetadata, r as normalizeWorkspaceSourcesMetadata, t as WorkspaceSourceMetadata } from "./config-
|
|
3
|
-
//#region src/core/rule-keys.d.ts
|
|
1
|
+
import { V as WorkspaceEntry, in as WorkspaceSourceMaterializationStatus, zt as WorkspaceRules } from "./types-Bel5IDmF.js";
|
|
2
|
+
import { i as workspaceSourceGrantPaths, n as normalizeWorkspaceSourceMetadata, r as normalizeWorkspaceSourcesMetadata, t as WorkspaceSourceMetadata } from "./config-DeA287c0.js";
|
|
4
3
|
/** Rejects rule keys that ViteHub does not enforce, such as `read`, so that a rule never looks like a protection it is not. */
|
|
5
4
|
export declare function assertWorkspaceRules(rules: WorkspaceRules | undefined): void;
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/source-metadata.d.ts
|
|
8
5
|
export declare function listMaterializedWorkspaceEntries(workspace: unknown): Promise<WorkspaceEntry[] | undefined>;
|
|
9
6
|
export declare function listMaterializedWorkspaceSourceEntries(workspace: unknown, source: WorkspaceSourceMetadata): Promise<WorkspaceEntry[] | undefined>;
|
|
10
7
|
export declare function readWorkspaceSourceMaterializationStatus(workspace: unknown, source: WorkspaceSourceMetadata): Promise<WorkspaceSourceMaterializationStatus | undefined>;
|
|
11
|
-
//#endregion
|
|
12
8
|
export { type WorkspaceSourceMetadata, normalizeWorkspaceSourceMetadata, normalizeWorkspaceSourcesMetadata, workspaceSourceGrantPaths };
|
package/dist/source-metadata.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { m as readCurrentSourceSnapshot, o as resolveWorkspaceMetadataTarget } from "./metadata-target-CaGLY4ay.js";
|
|
2
|
+
import { t as assertWorkspaceRules } from "./rule-keys-BLEbi1h5.js";
|
|
3
|
+
import { i as normalizeWorkspaceSourceMetadata, l as workspaceSourceGrantPaths, o as normalizeWorkspaceSourcesMetadata } from "./config-jo5QgE1w.js";
|
|
4
|
+
// src/source-metadata.ts
|
|
5
5
|
async function listMaterializedWorkspaceEntries(workspace) {
|
|
6
6
|
return await (await resolveWorkspaceMetadataTarget(workspace))?.list?.("", { recursive: true });
|
|
7
7
|
}
|
|
@@ -30,5 +30,4 @@ async function readWorkspaceSourceMaterializationStatus(workspace, source) {
|
|
|
30
30
|
status
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
33
|
export { assertWorkspaceRules, listMaterializedWorkspaceEntries, listMaterializedWorkspaceSourceEntries, normalizeWorkspaceSourceMetadata, normalizeWorkspaceSourcesMetadata, readWorkspaceSourceMaterializationStatus, workspaceSourceGrantPaths };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "./registry-s2Ob9PeX.js";
|
|
2
|
+
import { En as WorkspaceStore, T as VercelBlobWorkspaceStoreOptions, k as WorkspaceAssetsRegistry, s as GitHubWorkspaceStoreOptions, t as CloudflareArtifactsWorkspaceStoreOptions } from "./types-Bel5IDmF.js";
|
|
3
|
+
import "./use-tools-CAK10LTc.js";
|
|
4
|
+
import "./use-CpphIBof.js";
|
|
5
|
+
import { t as WorkspaceRegistry } from "./registry-B0g19sdy.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
|
+
declare function setWorkspaceHostedStoreLoader(loader: WorkspaceHostedStoreLoader | undefined): void;
|
|
10
|
+
declare function getWorkspaceHostedStoreLoader(): WorkspaceHostedStoreLoader | undefined;
|
|
11
|
+
type CloudflareWorkerEnv = Record<string, unknown>;
|
|
12
|
+
declare function setActiveCloudflareEnv(env: CloudflareWorkerEnv | undefined): void;
|
|
13
|
+
declare function resetWorkspaceStoreCache(): void;
|
|
14
|
+
declare function invalidateWorkspaceStore(name: string): Promise<void>;
|
|
15
|
+
declare function setWorkspaceRuntimeRegistry(registry: WorkspaceRegistry): void;
|
|
16
|
+
declare function setWorkspaceRuntimeAssetsRegistry(registry: WorkspaceAssetsRegistry): void;
|
|
17
|
+
export { setActiveCloudflareEnv as a, getWorkspaceHostedStoreLoader as c, resetWorkspaceStoreCache as i, setWorkspaceHostedStoreLoader as l, setWorkspaceRuntimeAssetsRegistry as n, HostedWorkspaceStoreOptions as o, setWorkspaceRuntimeRegistry as r, WorkspaceHostedStoreLoader as s, invalidateWorkspaceStore as t };
|
|
@@ -1,27 +1,17 @@
|
|
|
1
|
-
import { a as workspaceConflict, n as assertWorkspaceDigest, r as isWorkspaceConflict, s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-
|
|
2
|
-
import {
|
|
3
|
-
import { a as isExcludedWorkspacePath, c as normalizeSafeWorkspacePattern, i as decodeFile, l as normalizeWorkspacePath, n as contentStreamToBytes, r as contentToBytes } from "./path
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { C as githubKVKey, D as writeWorkspaceKV, O as BoundedMap, S as resolveGitHubRootOption, T as readWorkspaceKV, _ as requireGitHubOption, a as gitFileMode, b as resolveGitHubRefsOption, c as githubRequestStatus, d as preloadGitHubFiles, f as readCurrentHead, g as readGitHubFile, i as gitBlobSha, l as joinGitPath, m as readGitHubBranchState, n as commitGitHubChanges, o as githubBranchMovedConflict, p as readGitHubArchive, r as connectGitHubRepository, s as githubRequest, t as assertNoGitHubRepositoryKey, u as loadForge, v as resolveGitHubBranchOption, x as resolveGitHubRepositoryOption, y as resolveGitHubCredential } from "./shared-
|
|
8
|
-
import { t as
|
|
1
|
+
import { a as workspaceConflict, n as assertWorkspaceDigest, r as isWorkspaceConflict, s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
|
|
2
|
+
import { t as createWorkspaceGlobMatcher } from "./glob-BreFjNAV.js";
|
|
3
|
+
import { a as isExcludedWorkspacePath, c as normalizeSafeWorkspacePattern, i as decodeFile, l as normalizeWorkspacePath, n as contentStreamToBytes, r as contentToBytes } from "./path-Bb9OIc_F.js";
|
|
4
|
+
import { d as normalizeHistoryPath, f as normalizeHistoryRef, m as rejectHistoryHead, n as createSnapshotFromEntries, p as readHistoryDeleteRef, r as diffSnapshots, u as historyConflict } from "./utils-DXP9xfXo.js";
|
|
5
|
+
import { t as workspaceStoreDiscard } from "./discard-BkoLmmmN.js";
|
|
6
|
+
import { a as provideWorkspaceStoreTarget, n as provideWorkspaceRevisionMaterializer } from "./vitehub-grants-Co713QTg.js";
|
|
7
|
+
import { C as githubKVKey, D as writeWorkspaceKV, O as BoundedMap, S as resolveGitHubRootOption, T as readWorkspaceKV, _ as requireGitHubOption, a as gitFileMode, b as resolveGitHubRefsOption, c as githubRequestStatus, d as preloadGitHubFiles, f as readCurrentHead, g as readGitHubFile, i as gitBlobSha, l as joinGitPath, m as readGitHubBranchState, n as commitGitHubChanges, o as githubBranchMovedConflict, p as readGitHubArchive, r as connectGitHubRepository, s as githubRequest, t as assertNoGitHubRepositoryKey, u as loadForge, v as resolveGitHubBranchOption, x as resolveGitHubRepositoryOption, y as resolveGitHubCredential } from "./shared-C20Wh1mp.js";
|
|
8
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
|
|
9
9
|
import { ViteHubError } from "@vite-hub/runtime";
|
|
10
10
|
import { lookup } from "mrmime";
|
|
11
11
|
import { posix } from "node:path";
|
|
12
12
|
import { randomUUID } from "node:crypto";
|
|
13
13
|
import * as v from "valibot";
|
|
14
|
-
|
|
15
|
-
const workspaceRevisionMaterializer = Symbol.for("vitehub.workspace.revisionMaterializer");
|
|
16
|
-
function forwardWorkspaceRevisionMaterializer(source, target) {
|
|
17
|
-
const materializer = source[workspaceRevisionMaterializer];
|
|
18
|
-
if (materializer) target[workspaceRevisionMaterializer] = materializer;
|
|
19
|
-
}
|
|
20
|
-
function resolveWorkspaceRevisionMaterializer(workspace) {
|
|
21
|
-
return workspace[workspaceRevisionMaterializer];
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/providers/github/publish-reservation.ts
|
|
14
|
+
// src/providers/github/publish-reservation.ts
|
|
25
15
|
const githubPublishReservationMs = 3e5;
|
|
26
16
|
const zeroOid = "0".repeat(40);
|
|
27
17
|
const leaseSchema = v.object({
|
|
@@ -150,8 +140,7 @@ async function acquireGitHubPublishReservation(repository, options) {
|
|
|
150
140
|
}
|
|
151
141
|
};
|
|
152
142
|
}
|
|
153
|
-
|
|
154
|
-
//#region src/providers/github/history.ts
|
|
143
|
+
// src/providers/github/history.ts
|
|
155
144
|
/**
|
|
156
145
|
* How long `head()` keeps the head that it read for a branch, in milliseconds. A commit through this history replaces
|
|
157
146
|
* the head at once. A commit by another writer shows after this time at most.
|
|
@@ -1246,9 +1235,20 @@ function createGitHubWorkspaceHistory(input) {
|
|
|
1246
1235
|
await deleteBranch(temporary);
|
|
1247
1236
|
}
|
|
1248
1237
|
};
|
|
1238
|
+
const deleteRef = async (deleteOptions) => {
|
|
1239
|
+
const { ref, ifHead } = readHistoryDeleteRef(deleteOptions);
|
|
1240
|
+
if (toBranch(ref) === options.branch) throw workspaceErrorDiagnostics.WORKSPACE_DEFAULT_REF_DELETE();
|
|
1241
|
+
const { branch } = resolveRef(ref);
|
|
1242
|
+
const head = await readCurrentHead(client(), branch);
|
|
1243
|
+
if (ifHead !== void 0 && head !== ifHead) throw historyConflict(ref, ifHead, head, { repository: options.repository });
|
|
1244
|
+
if (!head) return false;
|
|
1245
|
+
await deleteBranch(branch);
|
|
1246
|
+
return true;
|
|
1247
|
+
};
|
|
1249
1248
|
return {
|
|
1250
1249
|
pullRequests,
|
|
1251
1250
|
openPullRequest,
|
|
1251
|
+
deleteRef,
|
|
1252
1252
|
merge: checkedMerge,
|
|
1253
1253
|
head: async (headOptions) => {
|
|
1254
1254
|
const { branch, ref } = resolveRef(headOptions?.ref);
|
|
@@ -1264,8 +1264,7 @@ function createGitHubWorkspaceHistory(input) {
|
|
|
1264
1264
|
commit
|
|
1265
1265
|
};
|
|
1266
1266
|
}
|
|
1267
|
-
|
|
1268
|
-
//#region src/providers/github/store.ts
|
|
1267
|
+
// src/providers/github/store.ts
|
|
1269
1268
|
const fileMetadataPrefix = ".vitehub/file-metadata/";
|
|
1270
1269
|
function isFileMetadataPath(path) {
|
|
1271
1270
|
return path.startsWith(fileMetadataPrefix) && path.endsWith(".json");
|
|
@@ -1375,9 +1374,8 @@ async function waitForGitHubOperation(read, signal) {
|
|
|
1375
1374
|
var GitHubWorkspaceStore = class {
|
|
1376
1375
|
options;
|
|
1377
1376
|
workspaceName;
|
|
1377
|
+
#sessionArchive;
|
|
1378
1378
|
#baseline;
|
|
1379
|
-
#archive;
|
|
1380
|
-
#archiveReads = /* @__PURE__ */ new Map();
|
|
1381
1379
|
#baselineRefSha;
|
|
1382
1380
|
#dirty = false;
|
|
1383
1381
|
#files = /* @__PURE__ */ new Map();
|
|
@@ -1391,6 +1389,8 @@ var GitHubWorkspaceStore = class {
|
|
|
1391
1389
|
constructor(options, workspaceName) {
|
|
1392
1390
|
this.options = options;
|
|
1393
1391
|
this.workspaceName = workspaceName;
|
|
1392
|
+
provideWorkspaceStoreTarget(this, () => this.#storeTarget());
|
|
1393
|
+
provideWorkspaceRevisionMaterializer(this, this.#revisionMaterializer);
|
|
1394
1394
|
}
|
|
1395
1395
|
/**
|
|
1396
1396
|
* The repository, branch, root, and token resolve on first use. The Store is created when the Workspace Definition
|
|
@@ -1435,7 +1435,7 @@ var GitHubWorkspaceStore = class {
|
|
|
1435
1435
|
this.#ready = void 0;
|
|
1436
1436
|
});
|
|
1437
1437
|
}
|
|
1438
|
-
|
|
1438
|
+
#storeTarget() {
|
|
1439
1439
|
return {
|
|
1440
1440
|
provider: "github",
|
|
1441
1441
|
branch: this.#branch,
|
|
@@ -1443,7 +1443,7 @@ var GitHubWorkspaceStore = class {
|
|
|
1443
1443
|
...this.options.database === void 0 ? {} : { database: this.options.database }
|
|
1444
1444
|
};
|
|
1445
1445
|
}
|
|
1446
|
-
|
|
1446
|
+
#revisionMaterializer = {
|
|
1447
1447
|
currentRevision: async (options) => {
|
|
1448
1448
|
await waitForGitHubOperation(this.#mutate(async () => await this.#ensure({ refresh: options?.refresh !== false })), options?.abortSignal);
|
|
1449
1449
|
return this.#baselineRefSha;
|
|
@@ -1453,22 +1453,9 @@ var GitHubWorkspaceStore = class {
|
|
|
1453
1453
|
const revision = this.#baselineRefSha;
|
|
1454
1454
|
const paths = options?.paths;
|
|
1455
1455
|
const files = [...this.#remoteFiles.keys()].filter((path) => !isReservedWorkspacePath(path) && (!paths || paths.some((root) => path === root || path.startsWith(`${root}/`)))).length;
|
|
1456
|
-
|
|
1457
|
-
let read = this.#archiveReads.get(revision);
|
|
1458
|
-
if (!read) {
|
|
1459
|
-
read = readGitHubArchive(this.#client, revision);
|
|
1460
|
-
this.#archiveReads.set(revision, read);
|
|
1461
|
-
read.finally(() => {
|
|
1462
|
-
if (this.#archiveReads.get(revision) === read) this.#archiveReads.delete(revision);
|
|
1463
|
-
}).catch(() => {});
|
|
1464
|
-
}
|
|
1465
|
-
this.#archive = {
|
|
1466
|
-
bytes: await waitForGitHubOperation(read, options?.abortSignal),
|
|
1467
|
-
revision
|
|
1468
|
-
};
|
|
1469
|
-
}
|
|
1456
|
+
const archive = !this.#dirty && paths === void 0 ? await waitForGitHubOperation(this.#readSessionArchive(revision), options?.abortSignal) : void 0;
|
|
1470
1457
|
return {
|
|
1471
|
-
...!this.#dirty &&
|
|
1458
|
+
...!this.#dirty && archive ? { archive: archive.slice() } : {},
|
|
1472
1459
|
files,
|
|
1473
1460
|
paths,
|
|
1474
1461
|
revision,
|
|
@@ -1476,6 +1463,18 @@ var GitHubWorkspaceStore = class {
|
|
|
1476
1463
|
};
|
|
1477
1464
|
}
|
|
1478
1465
|
};
|
|
1466
|
+
#readSessionArchive(revision) {
|
|
1467
|
+
if (this.#sessionArchive?.revision === revision) return this.#sessionArchive.read;
|
|
1468
|
+
const entry = {
|
|
1469
|
+
revision,
|
|
1470
|
+
read: readGitHubArchive(this.#client, revision)
|
|
1471
|
+
};
|
|
1472
|
+
this.#sessionArchive = entry;
|
|
1473
|
+
entry.read.catch(() => {
|
|
1474
|
+
if (this.#sessionArchive === entry) this.#sessionArchive = void 0;
|
|
1475
|
+
});
|
|
1476
|
+
return entry.read;
|
|
1477
|
+
}
|
|
1479
1478
|
async readFile(path) {
|
|
1480
1479
|
const normalized = normalizeSafeWorkspacePath(path);
|
|
1481
1480
|
await this.#mutate(async () => await this.#ensure({ refresh: "expired" }));
|
|
@@ -1969,5 +1968,4 @@ function createGitHubWorkspaceStore(options, workspaceName) {
|
|
|
1969
1968
|
assertNoGitHubRepositoryKey(options);
|
|
1970
1969
|
return new GitHubWorkspaceStore(options, workspaceName);
|
|
1971
1970
|
}
|
|
1972
|
-
|
|
1973
|
-
export { forwardWorkspaceRevisionMaterializer as n, resolveWorkspaceRevisionMaterializer as r, createGitHubWorkspaceStore as t };
|
|
1971
|
+
export { createGitHubWorkspaceStore as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { s as workspaceError } from "./path-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { s as workspaceError } from "./path-CuYE8-X6.js";
|
|
2
|
+
import { d as sha256, n as contentStreamToBytes } from "./path-Bb9OIc_F.js";
|
|
3
|
+
import { a as normalizeWorkspaceSources, f as prepareWorkspaceSource, n as createSourceContext, s as sourceMountContainsPath } from "./config-jo5QgE1w.js";
|
|
4
|
+
import { C as withWorkspaceStoreMutation, E as normalizeSourceFileMetadata, S as sourceMountOwnsPath, T as normalizeMetadataValue, w as normalizeSourceItemPath, x as createWorkspaceSourceMountAuthority } from "./metadata-target-CaGLY4ay.js";
|
|
5
|
+
import { d as sourceSyncPathClaims, f as workspaceSourceSyncStateEquals, l as readWorkspaceSourceSyncState, u as sourceSyncMetaKey } from "./workspace-CLuPkyZR.js";
|
|
6
|
+
// src/sources/sync.ts
|
|
7
7
|
const sourceSyncLocks = /* @__PURE__ */ new Map();
|
|
8
8
|
const sourceSyncGrants = createWorkspaceSourceMountAuthority("Source Sync");
|
|
9
9
|
function zeroCounts() {
|
|
@@ -286,5 +286,4 @@ async function syncWorkspaceSources(definition, store, options) {
|
|
|
286
286
|
for (const key of lockKeys) if (sourceSyncLocks.get(key) === promise) sourceSyncLocks.delete(key);
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
//#endregion
|
|
290
289
|
export { syncWorkspaceSources };
|
package/dist/test.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as registerWorkspace } from "./registry-s2Ob9PeX.js";
|
|
2
2
|
export { registerWorkspace };
|
package/dist/test.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { registerWorkspace };
|
|
1
|
+
export { r as registerWorkspace } from "./registry-BbUg9vJB.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExecutionAuthority } from "@vite-hub/runtime";
|
|
2
2
|
import { FileSourceOptions, GitHubSourceOptions, GlobSourceOptions, Source, SourceContext, SourceRevision } from "@vite-hub/source";
|
|
3
3
|
import { McpResourcesSourceOptions } from "@vite-hub/source/mcp";
|
|
4
|
-
//#region src/core/types.d.ts
|
|
5
4
|
type WorkspaceContent = string | Uint8Array;
|
|
6
5
|
type WorkspaceContentStream = ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>;
|
|
7
6
|
interface ReadFileOptions {
|
|
@@ -188,6 +187,8 @@ interface WorkspaceSessionHostFiles {
|
|
|
188
187
|
}): Promise<void>;
|
|
189
188
|
}
|
|
190
189
|
interface WorkspaceSessionHost {
|
|
190
|
+
/** Maximum compressed archive bytes accepted by `files.write`, after allowing for transport overhead. Omit to copy files individually. */
|
|
191
|
+
readonly archiveMaxBytes?: number;
|
|
191
192
|
readonly executionAuthority: ExecutionAuthority;
|
|
192
193
|
readonly inspectionConcurrency?: number;
|
|
193
194
|
/** Maximum independent workspace files copied into this host concurrently. Defaults to 1. */
|
|
@@ -253,8 +254,14 @@ declare global {
|
|
|
253
254
|
interface WorkspaceNameMap extends ViteHubWorkspaceNameMap {}
|
|
254
255
|
interface WorkspaceSourceResolutionContextMap extends ViteHubWorkspaceSourceResolutionContextMap {}
|
|
255
256
|
type WorkspaceName = [keyof ViteHubWorkspaceNameMap] extends [never] ? string : Extract<keyof ViteHubWorkspaceNameMap, string>;
|
|
257
|
+
declare const validatedWorkspaceName: unique symbol;
|
|
258
|
+
/** A name checked against the runtime Workspace registry by `isWorkspaceName()`. */
|
|
259
|
+
type ValidatedWorkspaceName = string & {
|
|
260
|
+
readonly [validatedWorkspaceName]: true;
|
|
261
|
+
};
|
|
262
|
+
type WorkspaceLookupName = WorkspaceName | ValidatedWorkspaceName;
|
|
256
263
|
type WorkspaceScopeName = [keyof ViteHubWorkspaceScopeNameMap] extends [never] ? string : Extract<keyof ViteHubWorkspaceScopeNameMap, string>;
|
|
257
|
-
type WorkspaceAssetPath<Name extends
|
|
264
|
+
type WorkspaceAssetPath<Name extends WorkspaceLookupName = WorkspaceName> = Name extends keyof ViteHubWorkspaceAssetMap ? Extract<ViteHubWorkspaceAssetMap[Name], string> : string;
|
|
258
265
|
interface WorkspaceAssets<TKey extends string = string> {
|
|
259
266
|
readFile<TOptions extends ReadFileOptions | undefined = undefined>(path: TKey, options?: TOptions): Promise<ReadFileResult<TOptions>>;
|
|
260
267
|
stat(path: TKey): Promise<WorkspaceStat>;
|
|
@@ -517,9 +524,39 @@ interface WorkspaceHistoryExtensions {
|
|
|
517
524
|
merge?(options: WorkspaceMergeOptions): Promise<WorkspaceRevision | null>;
|
|
518
525
|
/** Open a pull request from one ref into another. */
|
|
519
526
|
openPullRequest?(options: WorkspaceOpenPullRequestOptions): Promise<WorkspacePullRequest>;
|
|
527
|
+
/**
|
|
528
|
+
* Delete a ref. Returns false when it does not exist and no `ifHead` was supplied. Deleting `main` or the Store's
|
|
529
|
+
* working ref throws `WORKSPACE_DEFAULT_REF_DELETE`.
|
|
530
|
+
* Blob + Database also deletes the ref's revisions and file bytes not used by other revisions. GitHub only deletes
|
|
531
|
+
* the branch; commits and their bytes may still be readable by SHA.
|
|
532
|
+
*/
|
|
533
|
+
deleteRef?(options: WorkspaceHistoryDeleteRefOptions): Promise<boolean>;
|
|
534
|
+
}
|
|
535
|
+
interface WorkspaceHistoryDeleteRefOptions {
|
|
536
|
+
/** The ref to delete, such as `run-42`. */
|
|
537
|
+
ref: string;
|
|
538
|
+
/**
|
|
539
|
+
* The expected head of `ref`. A mismatch throws `WORKSPACE_CONFLICT`. Blob + Database checks the head atomically
|
|
540
|
+
* with ref deletion. GitHub checks the head before sending an unconditional branch deletion request.
|
|
541
|
+
*/
|
|
542
|
+
ifHead?: string;
|
|
543
|
+
}
|
|
544
|
+
interface WorkspaceHistoryDiffOptions {
|
|
545
|
+
/** The older revision id. Leave it out to list every file of `to` as added. */
|
|
546
|
+
from?: string;
|
|
547
|
+
/** The newer revision id. Revisions can be on different refs. */
|
|
548
|
+
to: string;
|
|
549
|
+
}
|
|
550
|
+
interface WorkspaceHistoryDiffOptions {
|
|
551
|
+
/** The older revision id. Leave it out to list every file of `to` as added. */
|
|
552
|
+
from?: string;
|
|
553
|
+
/** The newer revision id. Revisions can be on different refs. */
|
|
554
|
+
to: string;
|
|
520
555
|
}
|
|
521
556
|
interface WorkspaceRetainedHistory extends WorkspaceHistoryReader, WorkspaceHistoryExtensions {
|
|
522
557
|
commit(options: WorkspaceHistoryCommitOptions): Promise<WorkspaceRevision>;
|
|
558
|
+
/** The files that were added, modified, or removed from `from` to `to`, sorted by path. Changes to bytes or retained attributes count as modifications. */
|
|
559
|
+
diff(options: WorkspaceHistoryDiffOptions): Promise<WorkspaceDiff>;
|
|
523
560
|
}
|
|
524
561
|
/** Run the Workspace commit policy on a prepared merge before the Store advances its destination ref. */
|
|
525
562
|
type WorkspaceMergeCommit = (options: WorkspaceStoreHistoryCommitOptions, apply: (checked: WorkspaceStoreHistoryCommitOptions) => Promise<WorkspaceRevision>) => Promise<WorkspaceRevision>;
|
|
@@ -530,8 +567,12 @@ interface WorkspaceStoreHistory extends WorkspaceHistoryReader, Omit<WorkspaceHi
|
|
|
530
567
|
interface WorkspaceDiffEntry {
|
|
531
568
|
path: string;
|
|
532
569
|
type: "added" | "modified" | "removed";
|
|
533
|
-
before?: WorkspaceSnapshot["entries"][string]
|
|
534
|
-
|
|
570
|
+
before?: WorkspaceSnapshot["entries"][string] & {
|
|
571
|
+
mediaType?: string;
|
|
572
|
+
};
|
|
573
|
+
after?: WorkspaceSnapshot["entries"][string] & {
|
|
574
|
+
mediaType?: string;
|
|
575
|
+
};
|
|
535
576
|
}
|
|
536
577
|
interface WorkspaceDiff {
|
|
537
578
|
from?: string;
|
|
@@ -553,6 +594,12 @@ interface WorkspaceStore {
|
|
|
553
594
|
writeFileStream?(path: string, file: WorkspaceStreamFile): Promise<WorkspaceStat & {
|
|
554
595
|
digest: string;
|
|
555
596
|
}>;
|
|
597
|
+
/**
|
|
598
|
+
* Creates new files without replacing existing paths, then sets the metadata keys. Call `onWrite` with each file's
|
|
599
|
+
* path after it is created, so the Workspace can roll back those files if a later write fails. Startup Source
|
|
600
|
+
* materialization uses this for new files. Without it, each file and key is written on its own.
|
|
601
|
+
*/
|
|
602
|
+
writeFiles?(files: readonly WorkspaceFile[], meta?: Readonly<Record<string, unknown>>, onWrite?: (path: string) => void): Promise<void>;
|
|
556
603
|
list(prefix?: string, options?: ListOptions): Promise<WorkspaceEntry[]>;
|
|
557
604
|
glob(pattern: string | string[], options?: GlobOptions): Promise<WorkspaceEntry[]>;
|
|
558
605
|
stat(path: string): Promise<WorkspaceStat | undefined>;
|
|
@@ -976,5 +1023,4 @@ interface WorkspaceMaterializeSourcesResult {
|
|
|
976
1023
|
path: string;
|
|
977
1024
|
sources: WorkspaceSourceMaterializationStatus[];
|
|
978
1025
|
}
|
|
979
|
-
|
|
980
|
-
export { WorkspaceHistoryFileInput as $, WorkspaceSourceMaterializationPathResult as $t, WorkspaceAutoCommitPlan as A, WorkspaceValidateMode as An, WorkspaceRebaseOptions as At, WorkspaceEntry as B, WorkspaceSession as Bt, SourceContextWorkspaceFiles as C, WorkspaceStoreHistory as Cn, WorkspaceName as Ct, WorkspaceAssets as D, WorkspaceSyncOptions as Dn, WorkspacePlugin as Dt, WorkspaceAssetPath as E, WorkspaceStreamFile as En, WorkspaceOptions as Et, WorkspaceCustomSourceInput as F, WorkspaceWriteMode as Fn, WorkspaceRules as Ft, WorkspaceGitHubSourceInput as G, WorkspaceSessionWriteFileOptions as Gt, WorkspaceFetchSourceRequestOptions as H, WorkspaceSessionHostFileEntry as Ht, WorkspaceDefinition as I, WorkspaceWriteOperation as In, WorkspaceScopeName as It, WorkspaceHistoryChangesCommitOptions as J, WorkspaceSourceBindingInput as Jt, WorkspaceGlobSourceInput as K, WorkspaceSnapshot as Kt, WorkspaceDefinitionInput as L, WorkspaceWriteValidator as Ln, WorkspaceSearchHit as Lt, WorkspaceCapabilities as M, WorkspaceWriteErrorHook as Mn, WorkspaceRevision as Mt, WorkspaceContent as N, WorkspaceWriteHook as Nn, WorkspaceRevisionView as Nt, WorkspaceAssetsRegistry as O, WorkspaceSyncResultDetails as On, WorkspacePrepareSessionProgressEvent as Ot, WorkspaceContentStream as P, WorkspaceWriteInput as Pn, WorkspaceRule as Pt, WorkspaceHistoryFile as Q, WorkspaceSourceMaterializationCounts as Qt, WorkspaceDiff as R, WorkspaceWriteValidatorResult as Rn, WorkspaceSearchQuery as Rt, SourceContext$1 as S, WorkspaceStore as Sn, WorkspaceMergeResolution as St, Workspace as T, WorkspaceStoreOptions as Tn, WorkspaceOpenPullRequestOptions as Tt, WorkspaceFile as U, WorkspaceSessionHostFiles as Ut, WorkspaceFetchSourceInput as V, WorkspaceSessionHost as Vt, WorkspaceFileSourceInput as W, WorkspaceSessionOptions as Wt, WorkspaceHistoryCommitOptions as X, WorkspaceSourceInput as Xt, WorkspaceHistoryCommitBase as Y, WorkspaceSourceDefinition as Yt, WorkspaceHistoryExtensions as Z, WorkspaceSourceItem as Zt, ReadFileResult as _, WorkspaceSourceSyncPathResult as _n, WorkspaceMcpResourcesSourceInput as _t, GitHubWorkspaceOption as a, WorkspaceSourceRequestExecutionResult as an, WorkspaceHistoryRefOptions as at, RmOptions as b, WorkspaceSourceSyncStatus as bn, WorkspaceMergeConflictContext as bt, GlobOptions as c, WorkspaceSourceResolutionContext as cn, WorkspaceInstructionBinding as ct, LocalWorkspaceStoreOptions as d, WorkspaceSourceResolutionInvocation as dn, WorkspaceLoader as dt, WorkspaceSourceMaterializationStatus as en, WorkspaceHistoryFilesCommitOptions as et, Logger as f, WorkspaceSourceResolutionResult as fn, WorkspaceLoaderSource as ft, ReadFileOptions as g, WorkspaceSourceSyncCounts as gn, WorkspaceMaterializeSourcesResult as gt, MkdirOptions as h, WorkspaceSourceSyncConfig as hn, WorkspaceMaterializeSourcesProgressEvent as ht, ExecResult as i, WorkspaceSourceRequestExecutionInput as in, WorkspaceHistoryRef as it, WorkspaceCacheOptions as j, WorkspaceWriteCommit as jn, WorkspaceRetainedHistory as jt, WorkspaceAuthor as k, WorkspaceSyncSnapshotOptions as kn, WorkspacePullRequest as kt, ListOptions as l, WorkspaceSourceResolutionContextMap as ln, WorkspaceInstructionBindingValue as lt, MemoryWorkspaceStoreOptions as m, WorkspaceSourceSelection as mn, WorkspaceMaterializeSourcesOptions as mt, DiffOptions as n, WorkspaceSourceMountOptions as nn, WorkspaceHistoryListResult as nt, GitHubWorkspaceRefs as o, WorkspaceSourceRequestExecutor as on, WorkspaceHookContext as ot, MaybePromise as p, WorkspaceSourceResolver as pn, WorkspaceMaterializeMode as pt, WorkspaceHistoryChanges as q, WorkspaceSource as qt, ExecOptions as r, WorkspaceSourceRequestDescriptor as rn, WorkspaceHistoryReader as rt, GitHubWorkspaceStoreOptions as s, WorkspaceSourceRequestMethod as sn, WorkspaceHooks as st, CloudflareArtifactsWorkspaceStoreOptions as t, WorkspaceSourceMount as tn, WorkspaceHistoryListOptions as tt, LoaderContext as u, WorkspaceSourceResolutionContextValueReader as un, WorkspaceLastChange as ut, ResolvedWorkspaceModuleOptions as v, WorkspaceSourceSyncPolicy as vn, WorkspaceMergeCommit as vt, VercelBlobWorkspaceStoreOptions as w, WorkspaceStoreHistoryCommitOptions as wn, WorkspaceNameMap as wt, SnapshotOptions as x, WorkspaceStat as xn, WorkspaceMergeOptions as xt, ResolvedWorkspaceRule as y, WorkspaceSourceSyncResult as yn, WorkspaceMergeConflict as yt, WorkspaceDiffEntry as z, WriteFileOptions as zn, WorkspaceSelectedScope as zt };
|
|
1026
|
+
export { WorkspaceHistoryDiffOptions as $, WorkspaceSourceDefinition as $t, WorkspaceAuthor as A, WorkspaceStreamFile as An, WorkspaceOptions as At, WorkspaceDiffEntry as B, WorkspaceWriteOperation as Bn, WorkspaceScopeName as Bt, SourceContextWorkspaceFiles as C, WorkspaceSourceSyncResult as Cn, WorkspaceMergeConflict as Ct, WorkspaceAssetPath as D, WorkspaceStoreHistory as Dn, WorkspaceName as Dt, Workspace as E, WorkspaceStore as En, WorkspaceMergeResolution as Et, WorkspaceContentStream as F, WorkspaceWriteCommit as Fn, WorkspaceRetainedHistory as Ft, WorkspaceFileSourceInput as G, WorkspaceSessionHost as Gt, WorkspaceFetchSourceInput as H, WorkspaceWriteValidatorResult as Hn, WorkspaceSearchQuery as Ht, WorkspaceCustomSourceInput as I, WorkspaceWriteErrorHook as In, WorkspaceRevision as It, WorkspaceHistoryChanges as J, WorkspaceSessionOptions as Jt, WorkspaceGitHubSourceInput as K, WorkspaceSessionHostFileEntry as Kt, WorkspaceDefinition as L, WorkspaceWriteHook as Ln, WorkspaceRevisionView as Lt, WorkspaceCacheOptions as M, WorkspaceSyncResultDetails as Mn, WorkspacePrepareSessionProgressEvent as Mt, WorkspaceCapabilities as N, WorkspaceSyncSnapshotOptions as Nn, WorkspacePullRequest as Nt, WorkspaceAssets as O, WorkspaceStoreHistoryCommitOptions as On, WorkspaceNameMap as Ot, WorkspaceContent as P, WorkspaceValidateMode as Pn, WorkspaceRebaseOptions as Pt, WorkspaceHistoryDeleteRefOptions as Q, WorkspaceSourceBindingInput as Qt, WorkspaceDefinitionInput as R, WorkspaceWriteInput as Rn, WorkspaceRule as Rt, SourceContext$1 as S, WorkspaceSourceSyncPolicy as Sn, WorkspaceMergeCommit as St, VercelBlobWorkspaceStoreOptions as T, WorkspaceStat as Tn, WorkspaceMergeOptions as Tt, WorkspaceFetchSourceRequestOptions as U, WriteFileOptions as Un, WorkspaceSelectedScope as Ut, WorkspaceEntry as V, WorkspaceWriteValidator as Vn, WorkspaceSearchHit as Vt, WorkspaceFile as W, WorkspaceSession as Wt, WorkspaceHistoryCommitBase as X, WorkspaceSnapshot as Xt, WorkspaceHistoryChangesCommitOptions as Y, WorkspaceSessionWriteFileOptions as Yt, WorkspaceHistoryCommitOptions as Z, WorkspaceSource as Zt, ReadFileResult as _, WorkspaceSourceResolver as _n, WorkspaceMaterializeMode as _t, GitHubWorkspaceOption as a, WorkspaceSourceMount as an, WorkspaceHistoryListResult as at, RmOptions as b, WorkspaceSourceSyncCounts as bn, WorkspaceMaterializeSourcesResult as bt, GlobOptions as c, WorkspaceSourceRequestExecutionInput as cn, WorkspaceHistoryRefOptions as ct, LocalWorkspaceStoreOptions as d, WorkspaceSourceRequestMethod as dn, WorkspaceInstructionBinding as dt, WorkspaceSourceInput as en, WorkspaceHistoryExtensions as et, Logger as f, WorkspaceSourceResolutionContext as fn, WorkspaceInstructionBindingValue as ft, ReadFileOptions as g, WorkspaceSourceResolutionResult as gn, WorkspaceLookupName as gt, MkdirOptions as h, WorkspaceSourceResolutionInvocation as hn, WorkspaceLoaderSource as ht, ExecResult as i, WorkspaceSourceMaterializationStatus as in, WorkspaceHistoryListOptions as it, WorkspaceAutoCommitPlan as j, WorkspaceSyncOptions as jn, WorkspacePlugin as jt, WorkspaceAssetsRegistry as k, WorkspaceStoreOptions as kn, WorkspaceOpenPullRequestOptions as kt, ListOptions as l, WorkspaceSourceRequestExecutionResult as ln, WorkspaceHookContext as lt, MemoryWorkspaceStoreOptions as m, WorkspaceSourceResolutionContextValueReader as mn, WorkspaceLoader as mt, DiffOptions as n, WorkspaceSourceMaterializationCounts as nn, WorkspaceHistoryFileInput as nt, GitHubWorkspaceRefs as o, WorkspaceSourceMountOptions as on, WorkspaceHistoryReader as ot, MaybePromise as p, WorkspaceSourceResolutionContextMap as pn, WorkspaceLastChange as pt, WorkspaceGlobSourceInput as q, WorkspaceSessionHostFiles as qt, ExecOptions as r, WorkspaceSourceMaterializationPathResult as rn, WorkspaceHistoryFilesCommitOptions as rt, GitHubWorkspaceStoreOptions as s, WorkspaceSourceRequestDescriptor as sn, WorkspaceHistoryRef as st, CloudflareArtifactsWorkspaceStoreOptions as t, WorkspaceSourceItem as tn, WorkspaceHistoryFile as tt, LoaderContext as u, WorkspaceSourceRequestExecutor as un, WorkspaceHooks as ut, ResolvedWorkspaceModuleOptions as v, WorkspaceSourceSelection as vn, WorkspaceMaterializeSourcesOptions as vt, ValidatedWorkspaceName as w, WorkspaceSourceSyncStatus as wn, WorkspaceMergeConflictContext as wt, SnapshotOptions as x, WorkspaceSourceSyncPathResult as xn, WorkspaceMcpResourcesSourceInput as xt, ResolvedWorkspaceRule as y, WorkspaceSourceSyncConfig as yn, WorkspaceMaterializeSourcesProgressEvent as yt, WorkspaceDiff as z, WorkspaceWriteMode as zn, WorkspaceRules as zt };
|