@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.
Files changed (116) hide show
  1. package/README.md +62 -19
  2. package/dist/{abort-BCwpdrN0.js → abort-CQGxJBqa.js} +1 -2
  3. package/dist/{asset-registry-DfBV5kmw.js → asset-registry-0CdRAjIV.js} +2 -3
  4. package/dist/blob-database/postgres.d.ts +423 -0
  5. package/dist/blob-database/postgres.js +1 -0
  6. package/dist/blob-database-sources-CQPAyCz3.js +8 -0
  7. package/dist/blob-database.d.ts +29 -449
  8. package/dist/blob-database.js +636 -210
  9. package/dist/checkout.d.ts +1 -2
  10. package/dist/checkout.js +3 -4
  11. package/dist/cloudflare.d.ts +1 -5
  12. package/dist/cloudflare.js +1 -2
  13. package/dist/{config-B-863EgC.js → config-CsgNNVAI.js} +1 -2
  14. package/dist/{config-CDeGd0RB.d.ts → config-DeA287c0.d.ts} +1 -5
  15. package/dist/{config-D1QENneP.js → config-jo5QgE1w.js} +18 -27
  16. package/dist/{discard-CNNtCozM.js → discard-BkoLmmmN.js} +1 -2
  17. package/dist/durability.d.ts +10 -4
  18. package/dist/durability.js +47 -6
  19. package/dist/{error-diagnostics-B5s9kNEA.js → error-diagnostics-B4me-ouV.js} +11 -4
  20. package/dist/{error-diagnostics-CQ4BUqRe.js → error-diagnostics-kKXseq8d.js} +10 -3
  21. package/dist/{path-uxLkzrZm.d.ts → errors-CnFDXxeJ.d.ts} +0 -3
  22. package/dist/{file-CqG9zqiF.js → file-BrNAXQgY.js} +4 -8
  23. package/dist/{target-Dm9dHAVJ.js → file-metadata-Bpsvjw_X.js} +3 -32
  24. package/dist/{files-B6wpAhEx.js → files--z2dLC5z.js} +3 -4
  25. package/dist/files.d.ts +12 -8
  26. package/dist/files.js +7 -6
  27. package/dist/{github-DKAlO0Vh.js → github-k--_LCrX.js} +7 -9
  28. package/dist/{glob-BOqSKzSg.js → glob-BEutagp1.js} +9 -10
  29. package/dist/{glob-Cjxms1t7.js → glob-BreFjNAV.js} +3 -4
  30. package/dist/history-schema-BR4UDPHL.d.ts +434 -0
  31. package/dist/history-schema-postgres-DZepCSBq.js +40 -0
  32. package/dist/{host-Bf1a2uo_.js → host-C8yZizfk.js} +153 -22
  33. package/dist/{hosted-zG7HJaE4.js → hosted-8BTKAtMX.js} +27 -21
  34. package/dist/{hosted-vercel-blob-AbXG8fvR.js → hosted-vercel-blob-B6kygYqn.js} +10 -12
  35. package/dist/hosted-vercel-blob.d.ts +1 -3
  36. package/dist/hosted-vercel-blob.js +1 -2
  37. package/dist/hosted.d.ts +1 -3
  38. package/dist/hosted.js +1 -2
  39. package/dist/index.d.ts +11 -41
  40. package/dist/index.js +34 -116
  41. package/dist/internal/path.d.ts +1 -1
  42. package/dist/internal/path.js +1 -2
  43. package/dist/internal/workspace.d.ts +10 -0
  44. package/dist/internal/workspace.js +85 -0
  45. package/dist/{lifecycle-D8FdpBod.js → lifecycle-IReZfi0b.js} +15 -13
  46. package/dist/lineage.d.ts +1 -3
  47. package/dist/lineage.js +1 -2
  48. package/dist/loader.d.ts +1 -7
  49. package/dist/loader.js +4 -6
  50. package/dist/{mcp-resources-DntxtmDU.js → mcp-resources-DeJnbOaw.js} +4 -5
  51. package/dist/{memory-D5jq9HZW.js → memory-BlSRrBH1.js} +19 -13
  52. package/dist/{metadata-target-DDoOQNp1.js → metadata-target-CaGLY4ay.js} +214 -77
  53. package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
  54. package/dist/{operation-definition-nmRu_O3V.d.ts → operation-definition-CqZkx1Rm.d.ts} +8 -6
  55. package/dist/{operations-DsY2MQnG.js → operations-CtRDU3cA.js} +34 -29
  56. package/dist/{operations-D8uCpzhM.js → operations-DfbqHWAe.js} +7 -8
  57. package/dist/operations.d.ts +2 -6
  58. package/dist/operations.js +2 -2
  59. package/dist/{path--wrT_Azm.js → path-Bb9OIc_F.js} +3 -19
  60. package/dist/{path-zHxQUbqa.d.ts → path-C0uZxDdW.d.ts} +0 -2
  61. package/dist/{path-DrSIenjj.js → path-CuYE8-X6.js} +2 -4
  62. package/dist/{plugins-CsrXCA1Q.d.ts → plugins-CLc32jvL.d.ts} +1 -3
  63. package/dist/{provider-sm9uzkLg.js → provider-CN14ewvx.js} +30 -22
  64. package/dist/providers/github/store.d.ts +2 -4
  65. package/dist/providers/github/store.js +1 -2
  66. package/dist/{registry-CFl1Htyc.d.ts → registry-B0g19sdy.d.ts} +5 -8
  67. package/dist/{registry-DmVfUe4K.js → registry-BbUg9vJB.js} +10 -6
  68. package/dist/registry-s2Ob9PeX.d.ts +9 -0
  69. package/dist/{request-scope-Dw5n8bMC.js → request-scope-CXCI_wCb.js} +4 -4
  70. package/dist/{results-DgkZUmTL.js → results-z-HpV9EP.js} +1 -2
  71. package/dist/{rolldown-runtime-rQ84J-ij.js → rolldown-runtime-DnNXxpGL.js} +2 -3
  72. package/dist/rule-keys-BLEbi1h5.js +18 -0
  73. package/dist/rules-BPDXypZV.js +267 -0
  74. package/dist/runtime/assets.d.ts +2 -3
  75. package/dist/runtime/assets.js +5 -6
  76. package/dist/runtime/empty-assets-registry.d.ts +1 -3
  77. package/dist/runtime/empty-assets-registry.js +1 -2
  78. package/dist/runtime/empty-registry.d.ts +2 -4
  79. package/dist/runtime/empty-registry.js +1 -2
  80. package/dist/runtime/registry.d.ts +2 -2
  81. package/dist/runtime/registry.js +2 -3
  82. package/dist/runtime/request.d.ts +1 -3
  83. package/dist/runtime/request.js +2 -3
  84. package/dist/runtime/state.d.ts +5 -4
  85. package/dist/runtime/state.js +18 -7
  86. package/dist/runtime/workspace.d.ts +1 -1
  87. package/dist/runtime/workspace.js +1 -2
  88. package/dist/runtime.d.ts +9 -24
  89. package/dist/runtime.js +29 -25
  90. package/dist/{search-C_RfoM2j.js → search-C_nVorq7.js} +3 -4
  91. package/dist/{server-Cd4-iCh5.js → server-aa1a4rkV.js} +8 -10
  92. package/dist/server.d.ts +3 -4
  93. package/dist/server.js +1 -2
  94. package/dist/{shared-ovXVSV3-.js → shared-C20Wh1mp.js} +23 -19
  95. package/dist/source-metadata.d.ts +2 -6
  96. package/dist/source-metadata.js +4 -5
  97. package/dist/state-BdDfBtOR.d.ts +17 -0
  98. package/dist/{store-NZoRto-Y.js → store-cx3OqNTi.js} +42 -44
  99. package/dist/{sync-CrT8zjwc.js → sync-BBfR4g5y.js} +6 -7
  100. package/dist/test.d.ts +1 -1
  101. package/dist/test.js +1 -2
  102. package/dist/{types-1Z-tKK3g.d.ts → types-Bel5IDmF.d.ts} +52 -6
  103. package/dist/{use-CjbF8EO9.d.ts → use-CpphIBof.d.ts} +20 -32
  104. package/dist/{use-B0o5HoBl.js → use-D0DyTMxM.js} +19 -21
  105. package/dist/use-tools-CAK10LTc.d.ts +10 -0
  106. package/dist/{state-Cb_hIyAw.js → use-tools-CHduR5k6.js} +8 -24
  107. package/dist/{utils-Dw-WULEZ.js → utils-DXP9xfXo.js} +80 -273
  108. package/dist/vite.d.ts +30 -19
  109. package/dist/vite.js +1481 -1617
  110. package/dist/vitehub-grants-Co713QTg.js +36 -0
  111. package/dist/workspace-BOuxrZrP.d.ts +5 -0
  112. package/dist/{workspace-DvKu5PRa.js → workspace-CLuPkyZR.js} +28 -36
  113. package/package.json +34 -24
  114. package/dist/registry-CwryP59t.d.ts +0 -9
  115. package/dist/state-C-YtsaiJ.d.ts +0 -35
  116. package/dist/workspace-CIXgHeyX.d.ts +0 -7
@@ -1,5 +1,4 @@
1
1
  import { WorkspaceStaleFile } from "./lineage.js";
2
- //#region src/checkout.d.ts
3
2
  /** The lock file at the project root. Commit it: it records the remote revision that each checkout folder matches. */
4
3
  export declare const workspaceLockFile = "vitehub.lock";
5
4
  /** Calls one operation of the app, as `callOperationFromCli()` does. Tests pass a direct call. */
@@ -125,4 +124,4 @@ export declare function formatWorkspaceStatus(status: WorkspaceStatus): string;
125
124
  export declare function localCheckoutStatus(rootDir: string): Promise<WorkspaceStatus[] | undefined>;
126
125
  /** Marks conflicts without markers, such as binary files, as resolved: the local file is what the next push sends. */
127
126
  export declare function resolveWorkspaceConflicts(rootDir: string, workspace: string, paths: readonly string[]): Promise<string[]>;
128
- //#endregion
127
+ export {};
package/dist/checkout.js CHANGED
@@ -1,13 +1,13 @@
1
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B5s9kNEA.js";
1
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
2
2
  import { staleDerivedFiles } from "./lineage.js";
3
- import { t as workspaceCommitRequestBytes } from "./results-DgkZUmTL.js";
3
+ import { t as workspaceCommitRequestBytes } from "./results-z-HpV9EP.js";
4
4
  import { isRuntimeDiagnostic } from "@vite-hub/runtime";
5
5
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
6
6
  import { createHash, randomBytes } from "node:crypto";
7
7
  import { Diagnostic } from "nostics";
8
8
  import { constants } from "node:fs";
9
9
  import { lstat, mkdir, open, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
10
- //#region src/checkout.ts
10
+ // src/checkout.ts
11
11
  /** The lock file at the project root. Commit it: it records the remote revision that each checkout folder matches. */
12
12
  const workspaceLockFile = "vitehub.lock";
13
13
  /** A failed remote operation, with the code, message, and fix of the app's diagnostic. */
@@ -845,5 +845,4 @@ async function resolveWorkspaceConflicts(rootDir, workspace, paths) {
845
845
  await saveWorkspaceLock(rootDir, lock, [workspace]);
846
846
  return resolved;
847
847
  }
848
- //#endregion
849
848
  export { assertNoSymlinks, checkoutFailure, conflictMarkerPatterns, folderOf, formatWorkspaceStatus, ignoredName, localCheckoutStatus, mergeText, pullWorkspaces, pushWorkspaces, resolveWorkspaceConflicts, workspaceLockFile, workspaceStatus };
@@ -1,9 +1,6 @@
1
- import { Sn as WorkspaceStore, s as GitHubWorkspaceStoreOptions, t as CloudflareArtifactsWorkspaceStoreOptions, v as ResolvedWorkspaceModuleOptions } from "./types-1Z-tKK3g.js";
1
+ import { En as WorkspaceStore, s as GitHubWorkspaceStoreOptions, t as CloudflareArtifactsWorkspaceStoreOptions, v as ResolvedWorkspaceModuleOptions } from "./types-Bel5IDmF.js";
2
2
  import { configureHostedWorkspaceRuntime } from "./hosted.js";
3
- //#region src/providers/cloudflare/artifacts-store.d.ts
4
3
  export declare function createCloudflareArtifactsWorkspaceStore(options: CloudflareArtifactsWorkspaceStoreOptions, workspaceName: string): WorkspaceStore;
5
- //#endregion
6
- //#region src/cloudflare.d.ts
7
4
  export type CloudflareWorkspaceRuntimeStoreOptions = Partial<CloudflareArtifactsWorkspaceStoreOptions> | (Partial<GitHubWorkspaceStoreOptions> & {
8
5
  driver: "github";
9
6
  });
@@ -13,5 +10,4 @@ export interface CloudflareWorkspaceRuntimeOptions {
13
10
  root?: string;
14
11
  store?: CloudflareWorkspaceRuntimeStoreOptions;
15
12
  }
16
- //#endregion
17
13
  export { type CloudflareArtifactsWorkspaceStoreOptions, type GitHubWorkspaceStoreOptions, type ResolvedWorkspaceModuleOptions, configureHostedWorkspaceRuntime as configureCloudflareWorkspaceRuntime };
@@ -1,2 +1 @@
1
- import { a as createCloudflareArtifactsWorkspaceStore, t as configureHostedWorkspaceRuntime } from "./hosted-zG7HJaE4.js";
2
- export { configureHostedWorkspaceRuntime as configureCloudflareWorkspaceRuntime, createCloudflareArtifactsWorkspaceStore };
1
+ export { t as configureCloudflareWorkspaceRuntime, a as createCloudflareArtifactsWorkspaceStore } from "./hosted-8BTKAtMX.js";
@@ -1,4 +1,4 @@
1
- //#region src/runtime/config.ts
1
+ // src/runtime/config.ts
2
2
  const workspaceRuntimeConfigKey = Symbol.for("vitehub.workspace.runtimeConfig");
3
3
  function workspaceRuntimeConfigGlobal() {
4
4
  const scope = globalThis;
@@ -11,5 +11,4 @@ function setWorkspaceRuntimeConfig(config) {
11
11
  function getWorkspaceRuntimeConfig() {
12
12
  return workspaceRuntimeConfigGlobal()[workspaceRuntimeConfigKey] ?? false;
13
13
  }
14
- //#endregion
15
14
  export { setWorkspaceRuntimeConfig as n, getWorkspaceRuntimeConfig as t };
@@ -1,10 +1,7 @@
1
- import { An as WorkspaceValidateMode, I as WorkspaceDefinition, Xt as WorkspaceSourceInput, j as WorkspaceCacheOptions, pt as WorkspaceMaterializeMode, qt as WorkspaceSource, rn as WorkspaceSourceRequestDescriptor, vn as WorkspaceSourceSyncPolicy } from "./types-1Z-tKK3g.js";
2
- //#region src/sources/request-metadata.d.ts
1
+ import { L as WorkspaceDefinition, M as WorkspaceCacheOptions, Pn as WorkspaceValidateMode, Sn as WorkspaceSourceSyncPolicy, Zt as WorkspaceSource, _t as WorkspaceMaterializeMode, en as WorkspaceSourceInput, sn as WorkspaceSourceRequestDescriptor } from "./types-Bel5IDmF.js";
3
2
  declare function getWorkspaceSourceRequestDescriptor(source: WorkspaceSource): WorkspaceSourceRequestDescriptor | undefined;
4
3
  declare function isWorkspaceSourceRequestOnly(source: WorkspaceSource): boolean;
5
4
  declare function workspaceSourceRequestDescriptorPath(sourceKey: string): string;
6
- //#endregion
7
- //#region src/sources/config.d.ts
8
5
  interface ResolvedWorkspaceSource {
9
6
  key: string;
10
7
  source: WorkspaceSource;
@@ -23,5 +20,4 @@ type WorkspaceSourceMetadata = Pick<ResolvedWorkspaceSource, "cache" | "key" | "
23
20
  declare function normalizeWorkspaceSourcesMetadata(sources: WorkspaceDefinition["sources"]): WorkspaceSourceMetadata[];
24
21
  declare function normalizeWorkspaceSourceMetadata(key: string, input: WorkspaceSourceInput): WorkspaceSourceMetadata;
25
22
  declare function workspaceSourceGrantPaths(key: string, input: WorkspaceSourceInput): string[];
26
- //#endregion
27
23
  export { getWorkspaceSourceRequestDescriptor as a, workspaceSourceGrantPaths as i, normalizeWorkspaceSourceMetadata as n, isWorkspaceSourceRequestOnly as o, normalizeWorkspaceSourcesMetadata as r, workspaceSourceRequestDescriptorPath as s, WorkspaceSourceMetadata as t };
@@ -1,9 +1,9 @@
1
- import { s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
2
- import { i as decodeFile, o as isWorkspaceBytes } from "./path--wrT_Azm.js";
3
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B5s9kNEA.js";
4
- import { t as isRecord } from "./object-Da1zyPCR.js";
5
- import { t as internalErrorDiagnostics } from "./error-diagnostics-CQ4BUqRe.js";
6
- import { t as abortable } from "./abort-BCwpdrN0.js";
1
+ import { s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
2
+ import { i as decodeFile, o as isWorkspaceBytes } from "./path-Bb9OIc_F.js";
3
+ import { t as abortable } from "./abort-CQGxJBqa.js";
4
+ import { t as internalErrorDiagnostics } from "./error-diagnostics-kKXseq8d.js";
5
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
6
+ import { t as isRecord } from "./object-CAK6UYR5.js";
7
7
  import { posix } from "node:path";
8
8
  import { createHash } from "node:crypto";
9
9
  import { sourceIgnores } from "@vite-hub/source";
@@ -272,8 +272,7 @@ function formatIssues(issues) {
272
272
  if (Array.isArray(issues)) return issues.map((issue) => primitiveRuntimeTag(issue) === "[object String]" ? String(issue) : JSON.stringify(issue)).join("; ");
273
273
  return primitiveRuntimeTag(issues) === "[object String]" ? String(issues) : JSON.stringify(issues);
274
274
  }
275
- //#endregion
276
- //#region src/sources/live.ts
275
+ // src/sources/live.ts
277
276
  const liveSourcePaths = /* @__PURE__ */ new WeakMap();
278
277
  function markLiveWorkspaceSource(source, paths) {
279
278
  liveSourcePaths.set(source, paths);
@@ -282,8 +281,7 @@ function markLiveWorkspaceSource(source, paths) {
282
281
  function getLiveWorkspaceSourcePaths(source) {
283
282
  return liveSourcePaths.get(source);
284
283
  }
285
- //#endregion
286
- //#region src/sources/request-json.ts
284
+ // src/sources/request-json.ts
287
285
  function requestJsonEqual(left, right) {
288
286
  return JSON.stringify(sortJson(left)) === JSON.stringify(sortJson(right));
289
287
  }
@@ -294,8 +292,7 @@ function sortJson(value) {
294
292
  if (prototype !== Object.prototype && prototype !== null) return value;
295
293
  return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([key, item]) => [key, sortJson(item)]));
296
294
  }
297
- //#endregion
298
- //#region src/sources/request-metadata.ts
295
+ // src/sources/request-metadata.ts
299
296
  const requestSourceDescriptors = /* @__PURE__ */ new WeakMap();
300
297
  const requestSourceExecutors = /* @__PURE__ */ new WeakMap();
301
298
  const requestOnlySources = /* @__PURE__ */ new WeakSet();
@@ -332,8 +329,7 @@ function workspaceSourceRequestDescriptorPath(sourceKey) {
332
329
  assertWorkspaceSourceRequestDescriptorKey(sourceKey);
333
330
  return `.vitehub/sources/${sourceKey}.json`;
334
331
  }
335
- //#endregion
336
- //#region src/sources/fetch.ts
332
+ // src/sources/fetch.ts
337
333
  function url(input) {
338
334
  if (typeof input === "function") return resolvableFetchSource(input);
339
335
  return createFetchSource(input);
@@ -649,8 +645,7 @@ function redactedUrl(url) {
649
645
  const parsed = url instanceof URL ? url : new URL(url);
650
646
  return `${parsed.origin}${parsed.pathname}`;
651
647
  }
652
- //#endregion
653
- //#region src/sources/github-ignore.ts
648
+ // src/sources/github-ignore.ts
654
649
  function resolveGitHubIgnore(ignore) {
655
650
  if (ignore === false) return;
656
651
  if (ignore === void 0) return [...sourceIgnores.defaults];
@@ -671,8 +666,7 @@ function runtimeString(value) {
671
666
  function invalidGitHubIgnore() {
672
667
  return workspaceError("[vitehub] GitHub Source ignore must be false, a string, or an array of strings.");
673
668
  }
674
- //#endregion
675
- //#region src/sources/preparation.ts
669
+ // src/sources/preparation.ts
676
670
  const revisionResolutionByContext = /* @__PURE__ */ new WeakMap();
677
671
  async function prepareWorkspaceSource(source, ctx, options = {}) {
678
672
  if (options.refreshRevision) {
@@ -690,8 +684,7 @@ async function prepareWorkspaceSource(source, ctx, options = {}) {
690
684
  await revisionResolution;
691
685
  await source.prepare?.(ctx);
692
686
  }
693
- //#endregion
694
- //#region src/sources/runtime-options.ts
687
+ // src/sources/runtime-options.ts
695
688
  function ownSourceOption(options, key) {
696
689
  return Object.hasOwn(options, key) ? options[key] : void 0;
697
690
  }
@@ -705,8 +698,7 @@ function withWorkspaceRuntimeOptions(source, options) {
705
698
  validate: ownSourceOption(options, "validate")
706
699
  };
707
700
  }
708
- //#endregion
709
- //#region src/sources/config.ts
701
+ // src/sources/config.ts
710
702
  function copyWorkspaceSourceMetadata(source, target) {
711
703
  const livePaths = getLiveWorkspaceSourcePaths(source);
712
704
  if (livePaths) markLiveWorkspaceSource(target, livePaths);
@@ -956,10 +948,10 @@ function inferredSourceFingerprintOptions(family, input) {
956
948
  async function loadInferredWorkspaceSource(family, input) {
957
949
  if (family === "fetch" && isRecord(input)) return createInferredFetchSource(input);
958
950
  if (family === "fetch") return createInferredFetchSource(input);
959
- if (family === "file") return (await import("./file-CqG9zqiF.js").then((n) => n.n)).file(input);
960
- if (family === "github") return (await import("./github-DKAlO0Vh.js").then((n) => n.n)).github(input);
961
- if (family === "glob") return (await import("./glob-BOqSKzSg.js").then((n) => n.n)).glob(input);
962
- return (await import("./mcp-resources-DntxtmDU.js").then((n) => n.n)).mcpResources(input);
951
+ if (family === "file") return (await import("./file-BrNAXQgY.js").then((n) => n.n)).file(input);
952
+ if (family === "github") return (await import("./github-k--_LCrX.js").then((n) => n.n)).github(input);
953
+ if (family === "glob") return (await import("./glob-BEutagp1.js").then((n) => n.n)).glob(input);
954
+ return (await import("./mcp-resources-DeJnbOaw.js").then((n) => n.n)).mcpResources(input);
963
955
  }
964
956
  function inferredSourceDefaults(family, input) {
965
957
  if (!isRecord(input)) return family === "file" ? { key: inferredFileSourceKey(input) } : {};
@@ -1072,5 +1064,4 @@ function hasSourceMethods(input) {
1072
1064
  function hasOwn(input, key) {
1073
1065
  return Object.prototype.hasOwnProperty.call(input, key);
1074
1066
  }
1075
- //#endregion
1076
1067
  export { isWorkspaceSourceRequestOnly as _, normalizeWorkspaceSources as a, markLiveWorkspaceSource as b, sourceMountIntersectsPath as c, withWorkspaceRuntimeOptions as d, prepareWorkspaceSource as f, getWorkspaceSourceRequestExecutor as g, getWorkspaceSourceRequestDescriptor as h, normalizeWorkspaceSourceMetadata as i, workspaceSourceGrantPaths as l, url as m, createSourceContext as n, normalizeWorkspaceSourcesMetadata as o, resolveGitHubIgnore as p, normalizeWorkspaceSource as r, sourceMountContainsPath as s, copyWorkspaceSourceMetadata as t, ownSourceOption as u, workspaceSourceRequestDescriptorPath as v, requestJsonEqual as y };
@@ -1,8 +1,7 @@
1
- //#region src/storage/discard.ts
1
+ // src/storage/discard.ts
2
2
  /**
3
3
  * Drops the writes that a Store keeps staged until `snapshot()`, so it loads the branch again on its next call. Only
4
4
  * the GitHub and Cloudflare Artifacts Stores stage writes. Other Stores write through and do not have it.
5
5
  */
6
6
  const workspaceStoreDiscard = Symbol.for("vitehub.workspace.storeDiscard");
7
- //#endregion
8
7
  export { workspaceStoreDiscard as t };
@@ -1,10 +1,16 @@
1
- import { L as WorkspaceDefinitionInput, v as ResolvedWorkspaceModuleOptions } from "./types-1Z-tKK3g.js";
1
+ import { R as WorkspaceDefinitionInput, v as ResolvedWorkspaceModuleOptions } from "./types-Bel5IDmF.js";
2
2
  import { Durability, DurabilityContext } from "@vite-hub/runtime/durability";
3
- //#region src/durability.d.ts
3
+ /** The Blob store and Database names of a Blob + Database Store. `undefined` when the app passed an object. */
4
+ interface BlobDatabaseSources {
5
+ blob: string | undefined;
6
+ database: string | undefined;
7
+ }
4
8
  /** What the build passes to `workspaceDurability()`. */
5
9
  export interface WorkspaceDurabilityInput {
6
10
  /** The app passes its own `WorkspaceStore` object. */
7
11
  custom?: true;
12
+ /** The app passes a Blob + Database Store. Each name is `undefined` when the app passed an object. */
13
+ blobDatabase?: BlobDatabaseSources;
8
14
  /** The build chose the store, so `BLOB_STORE_ID` or `BLOB_READ_WRITE_TOKEN` can switch it to Vercel Blob at boot. */
9
15
  inferred?: boolean;
10
16
  driver?: string;
@@ -12,11 +18,11 @@ export interface WorkspaceDurabilityInput {
12
18
  root?: string;
13
19
  }
14
20
  /** The durability of Workspace files, from the store driver. */
15
- export declare function workspaceDurability(input: WorkspaceDurabilityInput, { env }: DurabilityContext): Durability[];
21
+ export declare function workspaceDurability(input: WorkspaceDurabilityInput, context: DurabilityContext): Durability[];
16
22
  /** Read the Definitions of the eager generated registry, whose loaders return the module without a Promise. */
17
23
  export declare function workspaceRegistryDefinitions(registry: Record<string, () => {
18
24
  default?: WorkspaceDefinitionInput;
19
25
  }>): Record<string, WorkspaceDefinitionInput | undefined>;
20
26
  /** Read evaluated Definitions, including Agent Workspace options, with the runtime's store precedence. */
21
27
  export declare function workspaceDefinitionsDurability(definitions: Record<string, WorkspaceDefinitionInput | undefined>, config: false | ResolvedWorkspaceModuleOptions, context: DurabilityContext): Durability[];
22
- //#endregion
28
+ export {};
@@ -1,14 +1,55 @@
1
- import { c as resolveWorkspaceDefinitionStore, n as isWorkspaceStore } from "./provider-sm9uzkLg.js";
2
- import { s as workspaceRegistryLoadError, t as normalizeWorkspaceDefinition } from "./registry-DmVfUe4K.js";
3
- //#region src/durability.ts
1
+ import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-BbUg9vJB.js";
2
+ import { n as readBlobDatabaseSources } from "./blob-database-sources-CQPAyCz3.js";
3
+ import { c as resolveWorkspaceDefinitionStore, n as isWorkspaceStore } from "./provider-CN14ewvx.js";
4
+ // src/durability.ts
4
5
  const sharedDrivers = {
5
6
  "cloudflare": "Cloudflare Artifacts.",
6
7
  "github": "A GitHub repository.",
7
8
  "vercel": "Vercel Blob."
8
9
  };
9
10
  const fix = "Use a shared Workspace store, such as `workspace: { store: { driver: \"github\" } }` or Vercel Blob.";
11
+ const blobDatabaseFix = "Pass the names of a shared Blob store and a shared Database, such as `createBlobDatabaseWorkspaceStore({ blob: \"default\", database: \"history\", workspace: \"docs\" })`.";
12
+ const scopeOrder = [
13
+ "process",
14
+ "host",
15
+ "shared"
16
+ ];
17
+ function blobDatabaseDurability({ blob, database }, context) {
18
+ if (blob === void 0 || database === void 0) return {
19
+ primitive: "workspace",
20
+ store: "blob-database",
21
+ scope: "shared",
22
+ reason: "A Blob + Database Store that got objects, not names. ViteHub cannot see which Blob store and Database it uses, so check that every instance uses the same shared ones, or pass their names."
23
+ };
24
+ const parts = [{
25
+ label: `the ${blob} Blob store`,
26
+ report: context.find("blob", blob)
27
+ }, {
28
+ label: `the ${database} Database`,
29
+ report: context.find("database", database)
30
+ }];
31
+ const off = parts.find((part) => !part.report);
32
+ if (off) return {
33
+ primitive: "workspace",
34
+ store: "blob-database",
35
+ scope: "process",
36
+ reason: `The Blob + Database Store uses ${off.label}, which is off.`,
37
+ fix: blobDatabaseFix
38
+ };
39
+ const reports = parts.map((part) => part.report);
40
+ const worst = reports.reduce((left, right) => scopeOrder.indexOf(right.scope) < scopeOrder.indexOf(left.scope) ? right : left);
41
+ return {
42
+ primitive: "workspace",
43
+ store: `blob-database (${reports.map((report) => report.store).join(", ")})`,
44
+ scope: worst.scope,
45
+ reason: `File bytes in ${parts[0].label} and history in ${parts[1].label}. ${reports.map((report) => report.reason).join(" ")}`,
46
+ ...worst.scope === "shared" ? {} : { fix: worst.fix ?? blobDatabaseFix }
47
+ };
48
+ }
10
49
  /** The durability of Workspace files, from the store driver. */
11
- function workspaceDurability(input, { env }) {
50
+ function workspaceDurability(input, context) {
51
+ const { env } = context;
52
+ if (input.blobDatabase) return [blobDatabaseDurability(input.blobDatabase, context)];
12
53
  if (input.custom) return [{
13
54
  primitive: "workspace",
14
55
  store: "custom",
@@ -57,7 +98,8 @@ function workspaceDefinitionsDurability(definitions, config, context) {
57
98
  env: context.env,
58
99
  hosting: context.env.VITEHUB_HOST
59
100
  });
60
- return workspaceDurability(isWorkspaceStore(store) ? { custom: true } : {
101
+ const blobDatabase = readBlobDatabaseSources(store);
102
+ return workspaceDurability(blobDatabase ? { blobDatabase } : isWorkspaceStore(store) ? { custom: true } : {
61
103
  driver: store?.driver,
62
104
  root: store && "root" in store && typeof store.root === "string" ? store.root : config ? `${config.root}/${name}` : void 0
63
105
  }, context).map((entry) => ({
@@ -66,5 +108,4 @@ function workspaceDefinitionsDurability(definitions, config, context) {
66
108
  }));
67
109
  });
68
110
  }
69
- //#endregion
70
111
  export { workspaceDefinitionsDurability, workspaceDurability, workspaceRegistryDefinitions };
@@ -1,5 +1,5 @@
1
1
  import { defineDiagnostics } from "nostics";
2
- //#region src/error-diagnostics.ts
2
+ // src/error-diagnostics.ts
3
3
  const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
4
4
  /** A code whose call site passes the message as `why`, with the fix that the reader applies. */
5
5
  const withFix = (fix) => ({
@@ -28,7 +28,7 @@ const workspaceErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
28
28
  target: `Workspace "${workspace}" has no ref or revision "${id}". Run \`vitehub workspace refs ${workspace}\` to list refs.`,
29
29
  workspace: `Unknown Workspace: ${workspace}.`
30
30
  })[problem],
31
- fix: "Check the Workspace name, the ref or revision, and the path. `vitehub workspace refs <workspace>` lists the refs, and `vitehub workspace show <workspace> <ref>` lists the files. When a base revision is gone, pull again without it."
31
+ fix: "Check the Workspace name, the ref or revision, and the path. `vitehub workspace refs <workspace>` lists the refs, and `vitehub workspace get <workspace> <ref>` lists the files. When a base revision is gone, pull again without it."
32
32
  },
33
33
  WORKSPACE_CHECKOUT_CONFLICT: {
34
34
  why: ({ conflicted, workspace }) => `Workspace "${workspace}" has unresolved conflicts: ${conflicted}.`,
@@ -100,6 +100,14 @@ const workspaceErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
100
100
  why: ({ driver, renamed }) => renamed ? `The Workspace \`store.driver\` is ${driver}. ViteHub renamed this driver to "${renamed}", and it does not read ${driver}.` : `The Workspace \`store.driver\` ${driver} is not a Workspace Store driver.`,
101
101
  fix: ({ renamed }) => renamed ? `Set \`store: { driver: "${renamed}" }\`, or run \`npx @vite-hub/codemods driver-key\` to rename it in every config file.` : "Set `store.driver` to \"local\", \"memory\", \"github\", \"cloudflare\", or \"vercel\", or pass a Store object."
102
102
  },
103
+ WORKSPACE_DEFAULT_REF_DELETE: {
104
+ why: "`history.deleteRef()` cannot delete `main` or the ref that the Workspace working tree follows.",
105
+ fix: "Delete another ref, such as the ref of one run. To remove files from the working ref, commit without them. To remove the whole Workspace history, call `delete()` on the Blob + Database Store."
106
+ },
107
+ WORKSPACE_POSTGRES_HISTORY_SCHEMA_MISSING: {
108
+ why: "The Postgres Database for this Workspace is missing its history catalog table.",
109
+ fix: "Apply the migrations for `workspaceHistorySchema` from `vite-hub/workspace/blob-database/postgres`. For a ViteHub Database, add the schema to its Definition and run `vitehub database generate` and `vitehub database migrate`. With PGlite, stop the dev server before running `vitehub database migrate` and start it again afterward, because only one process can open the local PGlite folder at a time."
110
+ },
103
111
  WORKSPACE_REGISTRY_LOAD_FAILED: {
104
112
  why: ({ reason, workspace }) => `The module of Workspace "${workspace}" did not load: ${reason}`,
105
113
  fix: "Read `error.cause` for the first error. Make sure that the module of the Workspace loads without errors and exports its Definition: the default export of a file in `server/workspaces/`, or the export that the Vite plugin names in its Workspace contribution. Then restart the dev server or build again."
@@ -185,8 +193,7 @@ const workspaceErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
185
193
  WORKSPACE_R0074: withFix("The Workspace Store keeps no file revisions, so ViteHub cannot prove that the file at the path in the message is the one it started to remove. Check the file. If it must go, delete it in the Store itself, for example in its directory or bucket, because the Workspace rejects writes under a Source. Then run the Source operation again."),
186
194
  WORKSPACE_R0075: withFix("Remove `read` from the rule. Workspace rules limit writes only, so `read: false` would not hide the files. Keep files that a reader must not see out of the Workspace, for example in another Workspace or in an Env secret."),
187
195
  WORKSPACE_R0076: withFix("Remove the option from the rule. A Workspace rule accepts `commit`, `maxBytes`, `mediaType`, `validate`, and `write`."),
188
- WORKSPACE_R0077: withFix("Pass the Drizzle database of the history Database: `database: () => useDatabase(\"history\").db` with `import { useDatabase } from \"vite-hub/database\"`. A Database Definition from `defineDatabase()` is not a Drizzle database.")
196
+ WORKSPACE_R0077: withFix("Pass the name of the history Database, `database: \"history\"`, or its Drizzle database, `database: () => useDatabase(\"history\").db` with `import { useDatabase } from \"vite-hub/database\"`. The Database can be SQLite, libSQL, D1, or Postgres. A Database Definition from `defineDatabase()` is not a Drizzle database.")
189
197
  }
190
198
  });
191
- //#endregion
192
199
  export { workspaceErrorDiagnostics as t };
@@ -1,5 +1,5 @@
1
1
  import { defineDiagnostics } from "nostics";
2
- //#region ../internal/src/error-diagnostics.ts
2
+ // ../internal/src/error-diagnostics.ts
3
3
  const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
4
4
  const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
5
5
  docsBase: "https://vitehub.dev/docs/development/diagnostics",
@@ -25,7 +25,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
25
25
  why: ({ message }) => message === void 0 ? "" : String(message)
26
26
  },
27
27
  INTERNAL_R0022: {
28
- fix: "Send input that matches the schema of the operation. `vitehub <namespace> <command> --help` shows the fields.",
28
+ fix: "Send input that matches the schema of the operation. `vitehub <namespace> <command> --help` shows the fields, and the list_operations tool of the ViteHub MCP gives the input schema of each operation.",
29
29
  why: ({ message }) => message === void 0 ? "" : String(message)
30
30
  },
31
31
  INTERNAL_R0024: {
@@ -244,6 +244,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
244
244
  why: ({ owner }) => `[vitehub] ${owner} extends tuple requires [preset, options] with an options object.`,
245
245
  fix: "Set `extends` to a preset, or to a two-item tuple `[preset, { ...options }]` whose second item is a plain object."
246
246
  },
247
+ INTERNAL_RUNTIME_PACKAGE_VERSION_CONFLICT: {
248
+ why: ({ first, name, second }) => `[vitehub] One server function needs ${name} from two installations: ${first} and ${second}.`,
249
+ fix: "Install one version of the package that the message names, for example with `pnpm dedupe` or an `overrides` entry in `package.json`, then build again."
250
+ },
247
251
  INTERNAL_SECRET_PURPOSE_MISSING: {
248
252
  why: "[vitehub] A derived secret requires a purpose.",
249
253
  fix: "Pass a non-empty purpose to `deriveSecret()`, such as `deriveSecret(\"my-module:session\")`."
@@ -252,6 +256,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
252
256
  why: ({ minimum }) => `[vitehub] VITEHUB_SECRET must be at least ${minimum} characters. Generate one with \`openssl rand -base64 32\`.`,
253
257
  fix: "Set `VITEHUB_SECRET` to the output of `openssl rand -base64 32`, which has 44 characters."
254
258
  },
259
+ INTERNAL_SITE_TOKEN_TOO_LONG: {
260
+ why: ({ length, maximum }) => `The Site access token is ${length} characters, and an app accepts ${maximum}.`,
261
+ fix: "Open the app with a shorter path, or give the person and the project shorter names, so that the Site access token fits."
262
+ },
255
263
  INTERNAL_SQLITE_ARGUMENT_INVALID: {
256
264
  why: ({ value }) => value === "undefined" ? "undefined cannot be passed as argument to the database" : "Only finite numbers (not Infinity or NaN) can be passed as arguments",
257
265
  fix: "Pass query arguments as finite numbers, strings, booleans, bigints, dates, byte arrays, or null. Replace undefined with null, and check numbers with `Number.isFinite()` before the query."
@@ -266,5 +274,4 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
266
274
  }
267
275
  }
268
276
  });
269
- //#endregion
270
277
  export { internalErrorDiagnostics as t };
@@ -1,7 +1,4 @@
1
- import "./types-1Z-tKK3g.js";
2
1
  import { ViteHubError } from "@vite-hub/runtime";
3
- //#region src/core/errors.d.ts
4
2
  type WorkspaceErrorCode = "WORKSPACE_CONFLICT" | "WORKSPACE_FAILED" | "WORKSPACE_NOT_FOUND" | "WORKSPACE_PATH_INVALID";
5
3
  declare function isWorkspaceConflict(value: unknown): boolean;
6
- //#endregion
7
4
  export { isWorkspaceConflict as n, WorkspaceErrorCode as t };
@@ -1,11 +1,8 @@
1
- import { n as __exportAll } from "./rolldown-runtime-rQ84J-ij.js";
2
- import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-D1QENneP.js";
1
+ import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
2
+ import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-jo5QgE1w.js";
3
3
  import { file } from "@vite-hub/source";
4
- //#region src/sources/file.ts
5
- var file_exports = /* @__PURE__ */ __exportAll({
6
- file: () => file$1,
7
- withFileSourceOptions: () => withFileSourceOptions
8
- });
4
+ // src/sources/file.ts
5
+ var file_exports = /* @__PURE__ */ __exportAll({ file: () => file$1 });
9
6
  function file$1(input) {
10
7
  const options = typeof input === "string" ? { path: input } : input;
11
8
  return withFileSourceOptions(file(options), options);
@@ -18,5 +15,4 @@ function withFileSourceOptions(source, options) {
18
15
  ...probeKeys ? { probeKeys } : {}
19
16
  };
20
17
  }
21
- //#endregion
22
18
  export { file_exports as n, withFileSourceOptions as r, file$1 as t };
@@ -1,6 +1,5 @@
1
- import { s as workspaceError } from "./path-DrSIenjj.js";
2
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B5s9kNEA.js";
3
- //#region src/core/file-metadata.ts
1
+ import { s as workspaceError } from "./path-CuYE8-X6.js";
2
+ // src/core/file-metadata.ts
4
3
  function invalidMetadata(path) {
5
4
  return workspaceError(`[vitehub] Invalid Workspace metadata for ${path}. Metadata must contain only JSON-safe plain objects, dense arrays, strings, booleans, null, and finite numbers other than negative zero.`);
6
5
  }
@@ -58,32 +57,4 @@ function copyJsonFileMetadata(path, metadata, normalizeOptional = false) {
58
57
  if (source && typeof source.value !== "string") throw workspaceError(`[vitehub] Invalid Workspace metadata for ${path}. metadata.source must be a string when provided.`);
59
58
  return copy;
60
59
  }
61
- //#endregion
62
- //#region src/core/rule-keys.ts
63
- /** The rule fields that a more specific rule replaces only when it sets them. */
64
- const cascadingRuleKeys = [
65
- "commit",
66
- "maxBytes",
67
- "mediaType",
68
- "write"
69
- ];
70
- const workspaceRuleKeys = /* @__PURE__ */ new Set([...cascadingRuleKeys, "validate"]);
71
- /** Rejects rule keys that ViteHub does not enforce, such as `read`, so that a rule never looks like a protection it is not. */
72
- function assertWorkspaceRules(rules) {
73
- for (const [pattern, rule] of Object.entries(rules ?? {})) for (const key of Object.keys(rule ?? {})) {
74
- if (key === "read") throw workspaceErrorDiagnostics.WORKSPACE_R0075({ message: `[vitehub] Workspace rule "${pattern}" sets read. Workspace rules do not limit reads.` });
75
- if (!workspaceRuleKeys.has(key)) throw workspaceErrorDiagnostics.WORKSPACE_R0076({ message: `[vitehub] Workspace rule "${pattern}" does not support option "${key}".` });
76
- }
77
- }
78
- //#endregion
79
- //#region src/storage/target.ts
80
- const workspaceStoreTarget = Symbol.for("vitehub.workspace.storeTarget");
81
- function forwardWorkspaceStoreTarget(source, target) {
82
- const resolveTarget = source[workspaceStoreTarget];
83
- if (resolveTarget) target[workspaceStoreTarget] = resolveTarget.bind(source);
84
- }
85
- async function resolveWorkspaceStoreTarget(source) {
86
- return await source[workspaceStoreTarget]?.();
87
- }
88
- //#endregion
89
- export { cascadingRuleKeys as a, assertWorkspaceRules as i, resolveWorkspaceStoreTarget as n, copyJsonFileMetadata as o, workspaceStoreTarget as r, copyJsonWorkspaceMetadata as s, forwardWorkspaceStoreTarget as t };
60
+ export { copyJsonWorkspaceMetadata as n, copyJsonFileMetadata as t };
@@ -1,6 +1,6 @@
1
- import { l as normalizeWorkspacePath, o as isWorkspaceBytes, s as matchesAny } from "./path--wrT_Azm.js";
2
- import { f as prepareWorkspaceSource, n as createSourceContext } from "./config-D1QENneP.js";
3
- //#region src/loaders/files.ts
1
+ import { l as normalizeWorkspacePath, o as isWorkspaceBytes, s as matchesAny } from "./path-Bb9OIc_F.js";
2
+ import { f as prepareWorkspaceSource, n as createSourceContext } from "./config-jo5QgE1w.js";
3
+ // src/loaders/files.ts
4
4
  function shouldLoad(path, options) {
5
5
  if (options.include && !matchesAny(path, options.include)) return false;
6
6
  if (options.exclude && matchesAny(path, options.exclude)) return false;
@@ -58,5 +58,4 @@ function files(options = {}) {
58
58
  }
59
59
  };
60
60
  }
61
- //#endregion
62
61
  export { files as t };
package/dist/files.d.ts CHANGED
@@ -1,9 +1,14 @@
1
- import { $ as WorkspaceHistoryFileInput, $t as WorkspaceSourceMaterializationPathResult, A as WorkspaceAutoCommitPlan, An as WorkspaceValidateMode, At as WorkspaceRebaseOptions, B as WorkspaceEntry, Bt as WorkspaceSession, C as SourceContextWorkspaceFiles, Cn as WorkspaceStoreHistory, Ct as WorkspaceName, D as WorkspaceAssets, Dn as WorkspaceSyncOptions, Dt as WorkspacePlugin, E as WorkspaceAssetPath, En as WorkspaceStreamFile, Et as WorkspaceOptions, F as WorkspaceCustomSourceInput, Fn as WorkspaceWriteMode, Ft as WorkspaceRules, G as WorkspaceGitHubSourceInput, Gt as WorkspaceSessionWriteFileOptions, H as WorkspaceFetchSourceRequestOptions, Ht as WorkspaceSessionHostFileEntry, I as WorkspaceDefinition, In as WorkspaceWriteOperation, It as WorkspaceScopeName, J as WorkspaceHistoryChangesCommitOptions, Jt as WorkspaceSourceBindingInput, K as WorkspaceGlobSourceInput, Kt as WorkspaceSnapshot, L as WorkspaceDefinitionInput, Ln as WorkspaceWriteValidator, Lt as WorkspaceSearchHit, M as WorkspaceCapabilities, Mn as WorkspaceWriteErrorHook, Mt as WorkspaceRevision, N as WorkspaceContent, Nn as WorkspaceWriteHook, Nt as WorkspaceRevisionView, O as WorkspaceAssetsRegistry, On as WorkspaceSyncResultDetails, Ot as WorkspacePrepareSessionProgressEvent, P as WorkspaceContentStream, Pn as WorkspaceWriteInput, Pt as WorkspaceRule, Q as WorkspaceHistoryFile, Qt as WorkspaceSourceMaterializationCounts, R as WorkspaceDiff, Rn as WorkspaceWriteValidatorResult, Rt as WorkspaceSearchQuery, S as SourceContext, Sn as WorkspaceStore, St as WorkspaceMergeResolution, T as Workspace, Tn as WorkspaceStoreOptions, Tt as WorkspaceOpenPullRequestOptions, U as WorkspaceFile, Ut as WorkspaceSessionHostFiles, V as WorkspaceFetchSourceInput, Vt as WorkspaceSessionHost, W as WorkspaceFileSourceInput, Wt as WorkspaceSessionOptions, X as WorkspaceHistoryCommitOptions, Xt as WorkspaceSourceInput, Y as WorkspaceHistoryCommitBase, Yt as WorkspaceSourceDefinition, Z as WorkspaceHistoryExtensions, Zt as WorkspaceSourceItem, _ as ReadFileResult, _n as WorkspaceSourceSyncPathResult, _t as WorkspaceMcpResourcesSourceInput, a as GitHubWorkspaceOption, an as WorkspaceSourceRequestExecutionResult, at as WorkspaceHistoryRefOptions, b as RmOptions, bn as WorkspaceSourceSyncStatus, bt as WorkspaceMergeConflictContext, c as GlobOptions, cn as WorkspaceSourceResolutionContext, ct as WorkspaceInstructionBinding, d as LocalWorkspaceStoreOptions, dn as WorkspaceSourceResolutionInvocation, dt as WorkspaceLoader, en as WorkspaceSourceMaterializationStatus, et as WorkspaceHistoryFilesCommitOptions, f as Logger, fn as WorkspaceSourceResolutionResult, ft as WorkspaceLoaderSource, g as ReadFileOptions, gn as WorkspaceSourceSyncCounts, gt as WorkspaceMaterializeSourcesResult, h as MkdirOptions, hn as WorkspaceSourceSyncConfig, ht as WorkspaceMaterializeSourcesProgressEvent, i as ExecResult, in as WorkspaceSourceRequestExecutionInput, it as WorkspaceHistoryRef, j as WorkspaceCacheOptions, jn as WorkspaceWriteCommit, jt as WorkspaceRetainedHistory, k as WorkspaceAuthor, kn as WorkspaceSyncSnapshotOptions, kt as WorkspacePullRequest, l as ListOptions, ln as WorkspaceSourceResolutionContextMap, lt as WorkspaceInstructionBindingValue, m as MemoryWorkspaceStoreOptions, mn as WorkspaceSourceSelection, mt as WorkspaceMaterializeSourcesOptions, n as DiffOptions, nn as WorkspaceSourceMountOptions, nt as WorkspaceHistoryListResult, o as GitHubWorkspaceRefs, on as WorkspaceSourceRequestExecutor, ot as WorkspaceHookContext, p as MaybePromise, pn as WorkspaceSourceResolver, pt as WorkspaceMaterializeMode, q as WorkspaceHistoryChanges, qt as WorkspaceSource, r as ExecOptions, rn as WorkspaceSourceRequestDescriptor, rt as WorkspaceHistoryReader, s as GitHubWorkspaceStoreOptions, sn as WorkspaceSourceRequestMethod, st as WorkspaceHooks, t as CloudflareArtifactsWorkspaceStoreOptions, tn as WorkspaceSourceMount, tt as WorkspaceHistoryListOptions, u as LoaderContext, un as WorkspaceSourceResolutionContextValueReader, ut as WorkspaceLastChange, v as ResolvedWorkspaceModuleOptions, vn as WorkspaceSourceSyncPolicy, vt as WorkspaceMergeCommit, w as VercelBlobWorkspaceStoreOptions, wn as WorkspaceStoreHistoryCommitOptions, wt as WorkspaceNameMap, x as SnapshotOptions, xn as WorkspaceStat, xt as WorkspaceMergeOptions, y as ResolvedWorkspaceRule, yn as WorkspaceSourceSyncResult, yt as WorkspaceMergeConflict, z as WorkspaceDiffEntry, zn as WriteFileOptions, zt as WorkspaceSelectedScope } from "./types-1Z-tKK3g.js";
2
- import { C as resolveWorkspaceStoreTarget, S as WorkspaceStoreTarget, _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, o as ReadonlyWorkspaceFs, s as UseWorkspaceOptions, u as WorkspaceHistory, v as WritableWorkspaceFs, x as useWorkspaceFiles } from "./use-CjbF8EO9.js";
3
- import { n as isWorkspaceConflict } from "./path-uxLkzrZm.js";
4
- import { n as normalizeSafeWorkspacePath } from "./path-zHxQUbqa.js";
5
- import { t as registerWorkspacePlugin } from "./plugins-CsrXCA1Q.js";
6
- //#region src/providers/github/cache.d.ts
1
+ import { _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, o as ReadonlyWorkspaceFs, s as UseWorkspaceOptions, u as WorkspaceHistory, v as WritableWorkspaceFs, x as useWorkspaceFiles } from "./use-CpphIBof.js";
2
+ import { $ as WorkspaceHistoryDiffOptions, $t as WorkspaceSourceDefinition, A as WorkspaceAuthor, An as WorkspaceStreamFile, At as WorkspaceOptions, B as WorkspaceDiffEntry, Bn as WorkspaceWriteOperation, Bt as WorkspaceScopeName, C as SourceContextWorkspaceFiles, Cn as WorkspaceSourceSyncResult, Ct as WorkspaceMergeConflict, D as WorkspaceAssetPath, Dn as WorkspaceStoreHistory, Dt as WorkspaceName, E as Workspace, En as WorkspaceStore, Et as WorkspaceMergeResolution, F as WorkspaceContentStream, Fn as WorkspaceWriteCommit, Ft as WorkspaceRetainedHistory, G as WorkspaceFileSourceInput, Gt as WorkspaceSessionHost, H as WorkspaceFetchSourceInput, Hn as WorkspaceWriteValidatorResult, Ht as WorkspaceSearchQuery, I as WorkspaceCustomSourceInput, In as WorkspaceWriteErrorHook, It as WorkspaceRevision, J as WorkspaceHistoryChanges, Jt as WorkspaceSessionOptions, K as WorkspaceGitHubSourceInput, Kt as WorkspaceSessionHostFileEntry, L as WorkspaceDefinition, Ln as WorkspaceWriteHook, Lt as WorkspaceRevisionView, M as WorkspaceCacheOptions, Mn as WorkspaceSyncResultDetails, Mt as WorkspacePrepareSessionProgressEvent, N as WorkspaceCapabilities, Nn as WorkspaceSyncSnapshotOptions, Nt as WorkspacePullRequest, O as WorkspaceAssets, On as WorkspaceStoreHistoryCommitOptions, Ot as WorkspaceNameMap, P as WorkspaceContent, Pn as WorkspaceValidateMode, Pt as WorkspaceRebaseOptions, Q as WorkspaceHistoryDeleteRefOptions, Qt as WorkspaceSourceBindingInput, R as WorkspaceDefinitionInput, Rn as WorkspaceWriteInput, Rt as WorkspaceRule, S as SourceContext, Sn as WorkspaceSourceSyncPolicy, St as WorkspaceMergeCommit, T as VercelBlobWorkspaceStoreOptions, Tn as WorkspaceStat, Tt as WorkspaceMergeOptions, U as WorkspaceFetchSourceRequestOptions, Un as WriteFileOptions, Ut as WorkspaceSelectedScope, V as WorkspaceEntry, Vn as WorkspaceWriteValidator, Vt as WorkspaceSearchHit, W as WorkspaceFile, Wt as WorkspaceSession, X as WorkspaceHistoryCommitBase, Xt as WorkspaceSnapshot, Y as WorkspaceHistoryChangesCommitOptions, Yt as WorkspaceSessionWriteFileOptions, Z as WorkspaceHistoryCommitOptions, Zt as WorkspaceSource, _ as ReadFileResult, _n as WorkspaceSourceResolver, _t as WorkspaceMaterializeMode, a as GitHubWorkspaceOption, an as WorkspaceSourceMount, at as WorkspaceHistoryListResult, b as RmOptions, bn as WorkspaceSourceSyncCounts, bt as WorkspaceMaterializeSourcesResult, c as GlobOptions, cn as WorkspaceSourceRequestExecutionInput, ct as WorkspaceHistoryRefOptions, d as LocalWorkspaceStoreOptions, dn as WorkspaceSourceRequestMethod, dt as WorkspaceInstructionBinding, en as WorkspaceSourceInput, et as WorkspaceHistoryExtensions, f as Logger, fn as WorkspaceSourceResolutionContext, ft as WorkspaceInstructionBindingValue, g as ReadFileOptions, gn as WorkspaceSourceResolutionResult, gt as WorkspaceLookupName, h as MkdirOptions, hn as WorkspaceSourceResolutionInvocation, ht as WorkspaceLoaderSource, i as ExecResult, in as WorkspaceSourceMaterializationStatus, it as WorkspaceHistoryListOptions, j as WorkspaceAutoCommitPlan, jn as WorkspaceSyncOptions, jt as WorkspacePlugin, k as WorkspaceAssetsRegistry, kn as WorkspaceStoreOptions, kt as WorkspaceOpenPullRequestOptions, l as ListOptions, ln as WorkspaceSourceRequestExecutionResult, lt as WorkspaceHookContext, m as MemoryWorkspaceStoreOptions, mn as WorkspaceSourceResolutionContextValueReader, mt as WorkspaceLoader, n as DiffOptions, nn as WorkspaceSourceMaterializationCounts, nt as WorkspaceHistoryFileInput, o as GitHubWorkspaceRefs, on as WorkspaceSourceMountOptions, ot as WorkspaceHistoryReader, p as MaybePromise, pn as WorkspaceSourceResolutionContextMap, pt as WorkspaceLastChange, q as WorkspaceGlobSourceInput, qt as WorkspaceSessionHostFiles, r as ExecOptions, rn as WorkspaceSourceMaterializationPathResult, rt as WorkspaceHistoryFilesCommitOptions, s as GitHubWorkspaceStoreOptions, sn as WorkspaceSourceRequestDescriptor, st as WorkspaceHistoryRef, t as CloudflareArtifactsWorkspaceStoreOptions, tn as WorkspaceSourceItem, tt as WorkspaceHistoryFile, u as LoaderContext, un as WorkspaceSourceRequestExecutor, ut as WorkspaceHooks, v as ResolvedWorkspaceModuleOptions, vn as WorkspaceSourceSelection, vt as WorkspaceMaterializeSourcesOptions, w as ValidatedWorkspaceName, wn as WorkspaceSourceSyncStatus, wt as WorkspaceMergeConflictContext, x as SnapshotOptions, xn as WorkspaceSourceSyncPathResult, xt as WorkspaceMcpResourcesSourceInput, y as ResolvedWorkspaceRule, yn as WorkspaceSourceSyncConfig, yt as WorkspaceMaterializeSourcesProgressEvent, z as WorkspaceDiff, zn as WorkspaceWriteMode, zt as WorkspaceRules } from "./types-Bel5IDmF.js";
3
+ import { n as isWorkspaceConflict } from "./errors-CnFDXxeJ.js";
4
+ import { t as isWorkspaceName } from "./registry-s2Ob9PeX.js";
5
+ import { n as normalizeSafeWorkspacePath } from "./path-C0uZxDdW.js";
6
+ import { t as registerWorkspacePlugin } from "./plugins-CLc32jvL.js";
7
+ interface WorkspaceStoreTarget {
8
+ provider: string;
9
+ containsPath?(ancestor: string, path: string): Promise<boolean>;
10
+ }
11
+ export declare function resolveWorkspaceStoreTarget(source: unknown): Promise<WorkspaceStoreTarget | undefined>;
7
12
  /**
8
13
  * The GitHub answers that the GitHub Store keeps. An answer for a URL that names a commit or tree sha never
9
14
  * changes, so it goes to the shared KV store when the app has one: another server instance reads it there and sends no
@@ -34,5 +39,4 @@ interface GitHubReadStats {
34
39
  export declare function registerWorkspaceKV(store: WorkspaceKV | undefined): void;
35
40
  /** The reads of the GitHub Store in this server instance, for tests and inspection. */
36
41
  export declare function readGitHubReadStats(): GitHubReadStats;
37
- //#endregion
38
- export { type CloudflareArtifactsWorkspaceStoreOptions, type DiffOptions, type ExecOptions, type ExecResult, type GitHubReadStats, type GitHubWorkspaceOption, type GitHubWorkspaceRefs, type GitHubWorkspaceStoreOptions, type GlobOptions, type ListOptions, type LoaderContext, type LocalWorkspaceStoreOptions, type Logger, type MaybePromise, type MemoryWorkspaceStoreOptions, type MkdirOptions, type ReadFileOptions, type ReadFileResult, type ReadonlyWorkspaceFiles, type ReadonlyWorkspaceFs, type ResolvedWorkspaceModuleOptions, type ResolvedWorkspaceRule, type RmOptions, type SnapshotOptions, type SourceContext, type SourceContextWorkspaceFiles, type UseWorkspaceOptions, type VercelBlobWorkspaceStoreOptions, type Workspace, type WorkspaceAssetPath, type WorkspaceAssets, type WorkspaceAssetsRegistry, type WorkspaceAuthor, type WorkspaceAutoCommitPlan, type WorkspaceCacheOptions, type WorkspaceCapabilities, type WorkspaceContent, type WorkspaceContentStream, type WorkspaceCustomSourceInput, type WorkspaceDefinition, type WorkspaceDefinitionInput, type WorkspaceDiff, type WorkspaceDiffEntry, type WorkspaceEntry, type WorkspaceFetchSourceInput, type WorkspaceFetchSourceRequestOptions, type WorkspaceFile, type WorkspaceFileSourceInput, type WorkspaceGitHubSourceInput, type WorkspaceGlobSourceInput, type WorkspaceHistory, type WorkspaceHistoryChanges, type WorkspaceHistoryChangesCommitOptions, type WorkspaceHistoryCommitBase, type WorkspaceHistoryCommitOptions, type WorkspaceHistoryExtensions, type WorkspaceHistoryFile, type WorkspaceHistoryFileInput, type WorkspaceHistoryFilesCommitOptions, type WorkspaceHistoryListOptions, type WorkspaceHistoryListResult, type WorkspaceHistoryReader, type WorkspaceHistoryRef, type WorkspaceHistoryRefOptions, type WorkspaceHookContext, type WorkspaceHooks, type WorkspaceInstructionBinding, type WorkspaceInstructionBindingValue, type WorkspaceKV, type WorkspaceLastChange, type WorkspaceLoader, type WorkspaceLoaderSource, type WorkspaceMaterializeMode, type WorkspaceMaterializeSourcesOptions, type WorkspaceMaterializeSourcesProgressEvent, type WorkspaceMaterializeSourcesResult, type WorkspaceMcpResourcesSourceInput, type WorkspaceMergeCommit, type WorkspaceMergeConflict, type WorkspaceMergeConflictContext, type WorkspaceMergeOptions, type WorkspaceMergeResolution, type WorkspaceName, type WorkspaceNameMap, type WorkspaceOpenPullRequestOptions, type WorkspaceOptions, type WorkspacePlugin, type WorkspacePrepareSessionProgressEvent, type WorkspacePullRequest, type WorkspaceRebaseOptions, type WorkspaceRetainedHistory, type WorkspaceRevision, type WorkspaceRevisionView, type WorkspaceRule, type WorkspaceRules, type WorkspaceScopeName, type WorkspaceSearchHit, type WorkspaceSearchQuery, type WorkspaceSelectedScope, type WorkspaceSession, type WorkspaceSessionHost, type WorkspaceSessionHostFileEntry, type WorkspaceSessionHostFiles, type WorkspaceSessionOptions, type WorkspaceSessionWriteFileOptions, type WorkspaceSnapshot, type WorkspaceSource, type WorkspaceSourceBindingInput, type WorkspaceSourceDefinition, type WorkspaceSourceInput, type WorkspaceSourceItem, type WorkspaceSourceMaterializationCounts, type WorkspaceSourceMaterializationPathResult, type WorkspaceSourceMaterializationStatus, type WorkspaceSourceMount, type WorkspaceSourceMountOptions, type WorkspaceSourceRequestDescriptor, type WorkspaceSourceRequestExecutionInput, type WorkspaceSourceRequestExecutionResult, type WorkspaceSourceRequestExecutor, type WorkspaceSourceRequestMethod, type WorkspaceSourceResolutionContext, type WorkspaceSourceResolutionContextMap, type WorkspaceSourceResolutionContextValueReader, type WorkspaceSourceResolutionInvocation, type WorkspaceSourceResolutionResult, type WorkspaceSourceResolver, type WorkspaceSourceSelection, type WorkspaceSourceSyncConfig, type WorkspaceSourceSyncCounts, type WorkspaceSourceSyncPathResult, type WorkspaceSourceSyncPolicy, type WorkspaceSourceSyncResult, type WorkspaceSourceSyncStatus, type WorkspaceStat, type WorkspaceStore, type WorkspaceStoreHistory, type WorkspaceStoreHistoryCommitOptions, type WorkspaceStoreOptions, type WorkspaceStoreTarget, type WorkspaceStreamFile, type WorkspaceSyncOptions, type WorkspaceSyncResultDetails, type WorkspaceSyncSnapshotOptions, type WorkspaceValidateMode, type WorkspaceWriteCommit, type WorkspaceWriteErrorHook, type WorkspaceWriteHook, type WorkspaceWriteInput, type WorkspaceWriteMode, type WorkspaceWriteOperation, type WorkspaceWriteValidator, type WorkspaceWriteValidatorResult, type WritableWorkspaceFiles, type WritableWorkspaceFs, type WriteFileOptions, isWorkspaceConflict, normalizeSafeWorkspacePath, registerWorkspacePlugin, resolveWorkspaceStoreTarget, useWorkspaceFiles };
42
+ export { type CloudflareArtifactsWorkspaceStoreOptions, type DiffOptions, type ExecOptions, type ExecResult, type GitHubReadStats, type GitHubWorkspaceOption, type GitHubWorkspaceRefs, type GitHubWorkspaceStoreOptions, type GlobOptions, type ListOptions, type LoaderContext, type LocalWorkspaceStoreOptions, type Logger, type MaybePromise, type MemoryWorkspaceStoreOptions, type MkdirOptions, type ReadFileOptions, type ReadFileResult, type ReadonlyWorkspaceFiles, type ReadonlyWorkspaceFs, type ResolvedWorkspaceModuleOptions, type ResolvedWorkspaceRule, type RmOptions, type SnapshotOptions, type SourceContext, type SourceContextWorkspaceFiles, type UseWorkspaceOptions, type ValidatedWorkspaceName, type VercelBlobWorkspaceStoreOptions, type Workspace, type WorkspaceAssetPath, type WorkspaceAssets, type WorkspaceAssetsRegistry, type WorkspaceAuthor, type WorkspaceAutoCommitPlan, type WorkspaceCacheOptions, type WorkspaceCapabilities, type WorkspaceContent, type WorkspaceContentStream, type WorkspaceCustomSourceInput, type WorkspaceDefinition, type WorkspaceDefinitionInput, type WorkspaceDiff, type WorkspaceDiffEntry, type WorkspaceEntry, type WorkspaceFetchSourceInput, type WorkspaceFetchSourceRequestOptions, type WorkspaceFile, type WorkspaceFileSourceInput, type WorkspaceGitHubSourceInput, type WorkspaceGlobSourceInput, type WorkspaceHistory, type WorkspaceHistoryChanges, type WorkspaceHistoryChangesCommitOptions, type WorkspaceHistoryCommitBase, type WorkspaceHistoryCommitOptions, type WorkspaceHistoryDeleteRefOptions, type WorkspaceHistoryDiffOptions, type WorkspaceHistoryExtensions, type WorkspaceHistoryFile, type WorkspaceHistoryFileInput, type WorkspaceHistoryFilesCommitOptions, type WorkspaceHistoryListOptions, type WorkspaceHistoryListResult, type WorkspaceHistoryReader, type WorkspaceHistoryRef, type WorkspaceHistoryRefOptions, type WorkspaceHookContext, type WorkspaceHooks, type WorkspaceInstructionBinding, type WorkspaceInstructionBindingValue, type WorkspaceKV, type WorkspaceLastChange, type WorkspaceLoader, type WorkspaceLoaderSource, type WorkspaceLookupName, type WorkspaceMaterializeMode, type WorkspaceMaterializeSourcesOptions, type WorkspaceMaterializeSourcesProgressEvent, type WorkspaceMaterializeSourcesResult, type WorkspaceMcpResourcesSourceInput, type WorkspaceMergeCommit, type WorkspaceMergeConflict, type WorkspaceMergeConflictContext, type WorkspaceMergeOptions, type WorkspaceMergeResolution, type WorkspaceName, type WorkspaceNameMap, type WorkspaceOpenPullRequestOptions, type WorkspaceOptions, type WorkspacePlugin, type WorkspacePrepareSessionProgressEvent, type WorkspacePullRequest, type WorkspaceRebaseOptions, type WorkspaceRetainedHistory, type WorkspaceRevision, type WorkspaceRevisionView, type WorkspaceRule, type WorkspaceRules, type WorkspaceScopeName, type WorkspaceSearchHit, type WorkspaceSearchQuery, type WorkspaceSelectedScope, type WorkspaceSession, type WorkspaceSessionHost, type WorkspaceSessionHostFileEntry, type WorkspaceSessionHostFiles, type WorkspaceSessionOptions, type WorkspaceSessionWriteFileOptions, type WorkspaceSnapshot, type WorkspaceSource, type WorkspaceSourceBindingInput, type WorkspaceSourceDefinition, type WorkspaceSourceInput, type WorkspaceSourceItem, type WorkspaceSourceMaterializationCounts, type WorkspaceSourceMaterializationPathResult, type WorkspaceSourceMaterializationStatus, type WorkspaceSourceMount, type WorkspaceSourceMountOptions, type WorkspaceSourceRequestDescriptor, type WorkspaceSourceRequestExecutionInput, type WorkspaceSourceRequestExecutionResult, type WorkspaceSourceRequestExecutor, type WorkspaceSourceRequestMethod, type WorkspaceSourceResolutionContext, type WorkspaceSourceResolutionContextMap, type WorkspaceSourceResolutionContextValueReader, type WorkspaceSourceResolutionInvocation, type WorkspaceSourceResolutionResult, type WorkspaceSourceResolver, type WorkspaceSourceSelection, type WorkspaceSourceSyncConfig, type WorkspaceSourceSyncCounts, type WorkspaceSourceSyncPathResult, type WorkspaceSourceSyncPolicy, type WorkspaceSourceSyncResult, type WorkspaceSourceSyncStatus, type WorkspaceStat, type WorkspaceStore, type WorkspaceStoreHistory, type WorkspaceStoreHistoryCommitOptions, type WorkspaceStoreOptions, type WorkspaceStoreTarget, type WorkspaceStreamFile, type WorkspaceSyncOptions, type WorkspaceSyncResultDetails, type WorkspaceSyncSnapshotOptions, type WorkspaceValidateMode, type WorkspaceWriteCommit, type WorkspaceWriteErrorHook, type WorkspaceWriteHook, type WorkspaceWriteInput, type WorkspaceWriteMode, type WorkspaceWriteOperation, type WorkspaceWriteValidator, type WorkspaceWriteValidatorResult, type WritableWorkspaceFiles, type WritableWorkspaceFs, type WriteFileOptions, isWorkspaceConflict, isWorkspaceName, normalizeSafeWorkspacePath, registerWorkspacePlugin, useWorkspaceFiles };
package/dist/files.js CHANGED
@@ -1,6 +1,7 @@
1
- import { r as isWorkspaceConflict, t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
2
- import { n as resolveWorkspaceStoreTarget } from "./target-Dm9dHAVJ.js";
3
- import { _ as registerWorkspacePlugin } from "./utils-Dw-WULEZ.js";
4
- import { E as registerWorkspaceKV, w as readGitHubReadStats } from "./shared-ovXVSV3-.js";
5
- import { r as useWorkspaceFiles } from "./use-B0o5HoBl.js";
6
- export { isWorkspaceConflict, normalizeSafeWorkspacePath, readGitHubReadStats, registerWorkspaceKV, registerWorkspacePlugin, resolveWorkspaceStoreTarget, useWorkspaceFiles };
1
+ import { r as useWorkspaceFiles } from "./use-D0DyTMxM.js";
2
+ import { r as isWorkspaceConflict, t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
3
+ import { t as isWorkspaceName } from "./registry-BbUg9vJB.js";
4
+ import { r as registerWorkspacePlugin } from "./rules-BPDXypZV.js";
5
+ import { o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
6
+ import { E as registerWorkspaceKV, w as readGitHubReadStats } from "./shared-C20Wh1mp.js";
7
+ export { isWorkspaceConflict, isWorkspaceName, normalizeSafeWorkspacePath, readGitHubReadStats, registerWorkspaceKV, registerWorkspacePlugin, resolveWorkspaceStoreTarget, useWorkspaceFiles };