@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,12 +1,13 @@
1
- import { s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
2
- import { n as resolveWorkspaceStoreTarget, o as copyJsonFileMetadata, t as forwardWorkspaceStoreTarget } from "./target-Dm9dHAVJ.js";
3
- import { f as sha256, i as decodeFile, l as normalizeWorkspacePath, n as contentStreamToBytes, o as isWorkspaceBytes, t as contentStreamChunks } from "./path--wrT_Azm.js";
4
- import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B5s9kNEA.js";
5
- import { t as searchText } from "./search-C_RfoM2j.js";
6
- import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, n as createSourceContext, s as sourceMountContainsPath } from "./config-D1QENneP.js";
1
+ import { s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-CuYE8-X6.js";
2
+ import { t as copyJsonFileMetadata } from "./file-metadata-Bpsvjw_X.js";
3
+ import { d as sha256, i as decodeFile, l as normalizeWorkspacePath, n as contentStreamToBytes, o as isWorkspaceBytes, t as contentStreamChunks } from "./path-Bb9OIc_F.js";
4
+ import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
5
+ import { i as forwardWorkspaceStoreTarget, o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
6
+ import { t as searchText } from "./search-C_nVorq7.js";
7
+ import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, n as createSourceContext, s as sourceMountContainsPath } from "./config-jo5QgE1w.js";
7
8
  import { posix } from "node:path";
8
9
  import { createHash } from "node:crypto";
9
- //#region src/storage/identity.ts
10
+ // src/storage/identity.ts
10
11
  const aliases = /* @__PURE__ */ new WeakMap();
11
12
  const stableIdentities = /* @__PURE__ */ new WeakSet();
12
13
  function workspaceStoreIdentity(store) {
@@ -29,8 +30,7 @@ function registerWorkspaceStoreAlias(alias, store) {
29
30
  stableIdentities.add(storeIdentity);
30
31
  }
31
32
  }
32
- //#endregion
33
- //#region src/sources/file-ownership.ts
33
+ // src/sources/file-ownership.ts
34
34
  const activeCheckpoints = /* @__PURE__ */ new WeakMap();
35
35
  const checkpointMetaKey = (path) => `workspace-file-checkpoint:${encodeURIComponent(normalizeWorkspacePath(path))}`;
36
36
  const volatileOwners = /* @__PURE__ */ new WeakMap();
@@ -143,6 +143,30 @@ async function removeWorkspaceOwnedFile(store, path) {
143
143
  await store.rm(path, { force: true });
144
144
  await removeWorkspaceFileOwner(store, path);
145
145
  }
146
+ async function writeWorkspaceOwnedFiles(store, files) {
147
+ const keys = files.map(({ file }) => fileOwnerMetaKey(file.path));
148
+ const written = /* @__PURE__ */ new Set();
149
+ try {
150
+ await store.writeFiles(files.map(({ file }) => file), Object.fromEntries(files.map(({ owner }, index) => [keys[index], owner])), (path) => {
151
+ written.add(path);
152
+ });
153
+ const owners = volatileOwners.get(workspaceStoreIdentity(store));
154
+ for (const key of keys) owners?.delete(key);
155
+ } catch (error) {
156
+ const failures = [];
157
+ for (const { file } of files) {
158
+ if (!written.has(file.path)) continue;
159
+ try {
160
+ await store.rm(file.path, { force: true });
161
+ await removeWorkspaceFileOwner(store, file.path);
162
+ } catch (rollbackError) {
163
+ failures.push(rollbackError);
164
+ }
165
+ }
166
+ if (failures.length) throw new AggregateError([error, ...failures], "Workspace batch write and rollback failed.");
167
+ throw error;
168
+ }
169
+ }
146
170
  async function withWorkspaceFileCheckpoint(store, path, write, checkpoint, rollbackCheckpoint) {
147
171
  const previous = (await store.stat(path))?.type === "file" ? await store.readFile(path) : void 0;
148
172
  const owner = await readWorkspaceFileOwner(store, path);
@@ -180,8 +204,7 @@ async function withWorkspaceFileCheckpoint(store, path, write, checkpoint, rollb
180
204
  endWorkspaceFileCheckpoint(store, path);
181
205
  }
182
206
  }
183
- //#endregion
184
- //#region src/sources/file-metadata.ts
207
+ // src/sources/file-metadata.ts
185
208
  function normalizeMetadataValue(value) {
186
209
  if (Array.isArray(value)) return value.map(normalizeMetadataValue);
187
210
  if (!value || Object.getPrototypeOf(value) !== Object.prototype) return value;
@@ -190,8 +213,7 @@ function normalizeMetadataValue(value) {
190
213
  function normalizeSourceFileMetadata(metadata) {
191
214
  return copyJsonFileMetadata("Source", metadata, true);
192
215
  }
193
- //#endregion
194
- //#region src/sources/source-items.ts
216
+ // src/sources/source-items.ts
195
217
  function normalizeWorkspaceSourceItemPath(source, rawSourcePath, options = {}) {
196
218
  const sourcePath = normalizeSafeWorkspacePath(rawSourcePath, {
197
219
  allowEmpty: false,
@@ -210,8 +232,7 @@ function normalizeWorkspaceSourceItemPath(source, rawSourcePath, options = {}) {
210
232
  function normalizeSourceItemPath(source, item, options = {}) {
211
233
  return normalizeWorkspaceSourceItemPath(source, item.path || item.key, options);
212
234
  }
213
- //#endregion
214
- //#region src/storage/mutation.ts
235
+ // src/storage/mutation.ts
215
236
  const workspaceStoreMutations = /* @__PURE__ */ new WeakMap();
216
237
  async function withWorkspaceStoreMutation(store, operation) {
217
238
  const identity = workspaceStoreIdentity(store);
@@ -224,8 +245,7 @@ async function withWorkspaceStoreMutation(store, operation) {
224
245
  if (workspaceStoreMutations.get(identity) === settled) workspaceStoreMutations.delete(identity);
225
246
  }
226
247
  }
227
- //#endregion
228
- //#region src/sources/mount-grants.ts
248
+ // src/sources/mount-grants.ts
229
249
  /**
230
250
  * Proof that one Source owner may change Workspace files inside one Source mount.
231
251
  * Only the authority of the owner creates a grant. A grant is request-scoped. Do not persist it.
@@ -295,6 +315,10 @@ function createWorkspaceSourceMountAuthority(owner) {
295
315
  };
296
316
  if (store.writeFileConditional) scoped.writeFileConditional = async (path, file, ifDigest) => await store.writeFileConditional(assertInMount(path), file, ifDigest);
297
317
  if (store.writeFileStream) scoped.writeFileStream = async (path, file) => await store.writeFileStream(assertInMount(path), file);
318
+ if (store.writeFiles) scoped.writeFiles = async (files, meta, onWrite) => await store.writeFiles(files.map((file) => ({
319
+ ...file,
320
+ path: assertInMount(file.path)
321
+ })), meta, onWrite);
298
322
  if (store.removeEmptyDirectory) scoped.removeEmptyDirectory = async (path) => await store.removeEmptyDirectory(assertInMount(path, true));
299
323
  if (store.getMeta) scoped.getMeta = async (key) => await store.getMeta(key);
300
324
  if (store.setMeta) scoped.setMeta = async (key, value) => await store.setMeta(key, value);
@@ -304,8 +328,7 @@ function createWorkspaceSourceMountAuthority(owner) {
304
328
  }
305
329
  };
306
330
  }
307
- //#endregion
308
- //#region src/sources/materialization.ts
331
+ // src/sources/materialization.ts
309
332
  const startupSourcesMetaKey = (workspace) => `workspace:${workspace}:startup-sources`;
310
333
  const startupWorkspacesMetaKey = "workspace:startup-source-workspaces";
311
334
  const volatileSnapshots = /* @__PURE__ */ new WeakMap();
@@ -362,14 +385,20 @@ async function invalidateSourceSnapshot(store, workspace, sourceKey) {
362
385
  status: "updating"
363
386
  });
364
387
  }
365
- async function hasCurrentSourceSnapshot(store, workspace, source, verifyOwnership = false, activeSources = [], path) {
388
+ function scopedSnapshotPaths(items, scope) {
389
+ const all = items || {};
390
+ if (scope === void 0) return Object.keys(all);
391
+ if (typeof scope === "string") return Object.hasOwn(all, scope) ? [scope] : [];
392
+ const prefix = scope.directory ? `${scope.directory}/` : "";
393
+ return Object.keys(all).filter((path) => path.startsWith(prefix));
394
+ }
395
+ async function hasCurrentSourceSnapshot(store, workspace, source, verifyOwnership = false, activeSources = [], scope) {
366
396
  const configHash = await sourceConfigHash(source, store);
367
397
  const meta = await readSourceSnapshotMetadata(store, workspace, source.key, source);
368
398
  if (meta?.status !== "ready" || meta.configHash !== configHash) return false;
369
399
  if (verifyOwnership === "workspace") {
370
400
  if (Object.keys(meta.items || {}).length === 0 && meta.ownsMount !== false && meta.mountPath && (await store.stat(meta.mountPath))?.type !== "directory") return false;
371
- const paths = path === void 0 ? Object.keys(meta.items || {}) : Object.hasOwn(meta.items || {}, path) ? [path] : [];
372
- for (const path of paths) {
401
+ for (const path of scopedSnapshotPaths(meta.items, scope)) {
373
402
  const file = await store.readFile(path);
374
403
  if (!file) return false;
375
404
  const inlineOwner = file.metadata?.workspaceSourceOwner;
@@ -380,13 +409,12 @@ async function hasCurrentSourceSnapshot(store, workspace, source, verifyOwnershi
380
409
  }
381
410
  return true;
382
411
  }
383
- return !verifyOwnership || await snapshotHasCurrentOwners(store, workspace, source, meta, activeSources, path);
412
+ return !verifyOwnership || await snapshotHasCurrentOwners(store, workspace, source, meta, activeSources, scope);
384
413
  }
385
- async function snapshotHasCurrentOwners(store, workspace, source, meta, activeSources = [], path) {
414
+ async function snapshotHasCurrentOwners(store, workspace, source, meta, activeSources = [], scope) {
386
415
  if (Object.keys(meta.items || {}).length === 0 && meta.mountPath && (await store.stat(meta.mountPath))?.type !== "directory") return false;
387
- const listed = path === void 0 && source.mountPath ? new Map((await store.list(source.mountPath, { recursive: true })).map((entry) => [entry.path, entry])) : void 0;
388
- const paths = path === void 0 ? Object.keys(meta.items || {}) : Object.hasOwn(meta.items || {}, path) ? [path] : [];
389
- for (const path of paths) {
416
+ const listed = typeof scope !== "string" && source.mountPath ? new Map((await store.list(source.mountPath, { recursive: true })).map((entry) => [entry.path, entry])) : void 0;
417
+ for (const path of scopedSnapshotPaths(meta.items, scope)) {
390
418
  const stat = listed?.get(path) ?? await store.stat(path);
391
419
  if (await materializedFileHasCurrentOwner(store, workspace, source.key, path, stat)) continue;
392
420
  const owner = await readWorkspaceFileOwner(store, path);
@@ -868,13 +896,6 @@ function isMaterializedStartupSource(value) {
868
896
  const source = value;
869
897
  return readStringMeta(source, "key") !== void 0 && readStringMeta(source, "mountPath") !== void 0;
870
898
  }
871
- async function* iterateSourceItems(source, ctx) {
872
- if (source.source.getItems) {
873
- yield* await source.source.getItems(ctx);
874
- return;
875
- }
876
- for (const key of await source.source.getKeys(ctx)) yield await source.source.getItem(key, ctx);
877
- }
878
899
  function createMaterializationEntry(source, item, upstreamMeta) {
879
900
  const { path, sourcePath } = normalizeSourceItemPath(source, item, { operation: "source materialization" });
880
901
  return {
@@ -903,9 +924,14 @@ async function* iterateMaterializationEntries(source, ctx, store, snapshot, conf
903
924
  return;
904
925
  }
905
926
  if (source.source.getItems) {
906
- for await (const item of iterateSourceItems(source, ctx)) {
927
+ const items = await source.source.getItems(ctx);
928
+ const batchable = !source.source.getMeta || items.every((item) => item.metadata != null);
929
+ for (const item of items) {
907
930
  const entry = createMaterializationEntry(source, item, item.metadata ?? await source.source.getMeta?.(item.key, ctx));
908
- if (materializationPathMatches(entry.path, options)) yield entry;
931
+ if (materializationPathMatches(entry.path, options)) yield {
932
+ ...entry,
933
+ batchable
934
+ };
909
935
  }
910
936
  return;
911
937
  }
@@ -1092,36 +1118,20 @@ async function materializeWorkspaceSourcesInternal(definition, store, options, c
1092
1118
  revision = ctx.revision;
1093
1119
  const directorySet = new Set(source.mountPath ? [source.mountPath] : []);
1094
1120
  const nextPaths = /* @__PURE__ */ new Set();
1095
- for await (const entry of iterateMaterializationEntries(source, ctx, store, existing, configHash, options, workspace)) {
1096
- throwIfAborted(options.abortSignal);
1121
+ const reportUpdate = async (force = false) => {
1122
+ if (!force && !shouldReportMaterializationUpdate(lastProgressAt, sourceFiles)) return;
1123
+ await reportMaterializationProgress(options, source, {
1124
+ bytes: sourceBytes,
1125
+ cacheStatus,
1126
+ counts: { ...counts },
1127
+ files: sourceFiles,
1128
+ revision,
1129
+ status: "updating"
1130
+ });
1131
+ lastProgressAt = Date.now();
1132
+ };
1133
+ const writeOne = async (entry, item) => {
1097
1134
  const path = entry.path;
1098
- nextPaths.add(path);
1099
- const parts = path.split("/");
1100
- for (let index = 1; index < parts.length; index++) directorySet.add(parts.slice(0, index).join("/"));
1101
- if (entry.reused) {
1102
- itemMetadata[path] = entry.metadata;
1103
- sourceFiles++;
1104
- const reusedFile = entry.reused.size === void 0 ? await store.readFile(path) : void 0;
1105
- sourceBytes += entry.reused.size ?? (reusedFile ? contentSize(reusedFile.content) : 0);
1106
- counts.unchanged++;
1107
- paths.push({
1108
- path,
1109
- status: "unchanged"
1110
- });
1111
- if (shouldReportMaterializationUpdate(lastProgressAt, sourceFiles)) {
1112
- await reportMaterializationProgress(options, source, {
1113
- bytes: sourceBytes,
1114
- cacheStatus,
1115
- counts: { ...counts },
1116
- files: sourceFiles,
1117
- revision,
1118
- status: "updating"
1119
- });
1120
- lastProgressAt = Date.now();
1121
- }
1122
- continue;
1123
- }
1124
- const item = entry.item;
1125
1135
  const metadata = normalizeSourceFileMetadata(item.metadata || {});
1126
1136
  const previousStat = await store.stat(path);
1127
1137
  const previous = entry.contentStream && store.writeFileStream ? void 0 : await store.readFile(path);
@@ -1179,18 +1189,147 @@ async function materializeWorkspaceSourcesInternal(definition, store, options, c
1179
1189
  path,
1180
1190
  status
1181
1191
  });
1182
- if (shouldReportMaterializationUpdate(lastProgressAt, sourceFiles)) {
1183
- await reportMaterializationProgress(options, source, {
1184
- bytes: sourceBytes,
1185
- cacheStatus,
1186
- counts: { ...counts },
1187
- files: sourceFiles,
1188
- revision,
1189
- status: "updating"
1192
+ await reportUpdate();
1193
+ };
1194
+ const batchWrites = source.materialize === "startup" && Boolean(sourceStore.writeFiles && store.getMeta && store.setMeta);
1195
+ let pending = [];
1196
+ let pendingBytes = 0;
1197
+ const pendingPaths = /* @__PURE__ */ new Set();
1198
+ const pendingDirectories = /* @__PURE__ */ new Set();
1199
+ const overlapsPending = (path) => pendingPaths.has(path) || pendingDirectories.has(path) || parentDirectoryPaths(path).some((directory) => pendingPaths.has(directory));
1200
+ const flush = async () => {
1201
+ if (!pending.length) return;
1202
+ const batch = pending;
1203
+ pending = [];
1204
+ pendingBytes = 0;
1205
+ pendingPaths.clear();
1206
+ pendingDirectories.clear();
1207
+ const replaced = [];
1208
+ const written = await control.mutate(() => withWorkspaceStoreMutation(store, async () => {
1209
+ const existingPaths = new Map((await store.list(source.mountPath, { recursive: true })).map((entry) => [entry.path, entry.type]));
1210
+ const verifiedPaths = /* @__PURE__ */ new Map();
1211
+ const pathType = async (path) => {
1212
+ const listed = existingPaths.get(path);
1213
+ if (listed) return listed;
1214
+ if (!verifiedPaths.has(path)) verifiedPaths.set(path, (await store.stat(path))?.type);
1215
+ return verifiedPaths.get(path);
1216
+ };
1217
+ const missingDirectories = /* @__PURE__ */ new Set();
1218
+ const fresh = [];
1219
+ for (const { entry, item } of batch) {
1220
+ const ancestors = parentDirectoryPaths(entry.path);
1221
+ let blocked = false;
1222
+ const absent = [];
1223
+ for (const directory of ancestors) {
1224
+ const type = await pathType(directory);
1225
+ if (type === "file") {
1226
+ blocked = true;
1227
+ break;
1228
+ }
1229
+ if (!type && directory !== source.mountPath && sourceOwnsDirectory(source, directory)) absent.push(directory);
1230
+ }
1231
+ if (blocked || await pathType(entry.path)) {
1232
+ replaced.push({
1233
+ entry,
1234
+ item
1235
+ });
1236
+ continue;
1237
+ }
1238
+ for (const directory of absent) missingDirectories.add(directory);
1239
+ const fileMetadata = normalizeSourceFileMetadata({
1240
+ ...normalizeSourceFileMetadata(item.metadata || {}),
1241
+ ...entry.metadata,
1242
+ source: source.key,
1243
+ workspaceSourceOwner: workspace
1244
+ });
1245
+ fresh.push({
1246
+ entry,
1247
+ item,
1248
+ fileMetadata,
1249
+ digest: await sha256(entry.content),
1250
+ size: contentSize(entry.content)
1251
+ });
1252
+ }
1253
+ throwIfAborted(options.abortSignal);
1254
+ if (fresh.length) await writeWorkspaceOwnedFiles(sourceStore, fresh.map(({ entry, item, fileMetadata, digest }) => ({
1255
+ file: {
1256
+ path: entry.path,
1257
+ content: entry.content,
1258
+ mediaType: item.mediaType,
1259
+ metadata: fileMetadata
1260
+ },
1261
+ owner: {
1262
+ workspace,
1263
+ source: source.key,
1264
+ digest
1265
+ }
1266
+ })));
1267
+ for (const directory of missingDirectories) ownedDirectories.add(directory);
1268
+ return fresh;
1269
+ }));
1270
+ const previousFileCount = sourceFiles;
1271
+ for (const { entry, item, fileMetadata, digest, size } of written) {
1272
+ const path = entry.path;
1273
+ const previousBytes = Object.hasOwn(itemMetadata, path) ? itemMetadata[path]?.materializedBytes ?? 0 : 0;
1274
+ itemMetadata[path] = {
1275
+ ...entry.metadata,
1276
+ materializedAttributes: true,
1277
+ materializedContentDigest: digest,
1278
+ materializedBytes: size,
1279
+ materializedMediaType: item.mediaType,
1280
+ materializedMetadata: observableFileMetadata(fileMetadata)
1281
+ };
1282
+ sourceFiles++;
1283
+ sourceBytes += size;
1284
+ persistedBytesDelta += size - previousBytes;
1285
+ counts.added++;
1286
+ paths.push({
1287
+ path,
1288
+ status: "added"
1289
+ });
1290
+ }
1291
+ if (written.length) await reportUpdate(previousFileCount === 0 || Math.floor(previousFileCount / 25) < Math.floor(sourceFiles / 25));
1292
+ for (const { entry, item } of replaced) await writeOne(entry, item);
1293
+ };
1294
+ for await (const entry of iterateMaterializationEntries(source, ctx, store, existing, configHash, options, workspace)) {
1295
+ throwIfAborted(options.abortSignal);
1296
+ const path = entry.path;
1297
+ nextPaths.add(path);
1298
+ const parts = path.split("/");
1299
+ for (let index = 1; index < parts.length; index++) directorySet.add(parts.slice(0, index).join("/"));
1300
+ if (entry.reused) {
1301
+ itemMetadata[path] = entry.metadata;
1302
+ sourceFiles++;
1303
+ const reusedFile = entry.reused.size === void 0 ? await store.readFile(path) : void 0;
1304
+ sourceBytes += entry.reused.size ?? (reusedFile ? contentSize(reusedFile.content) : 0);
1305
+ counts.unchanged++;
1306
+ paths.push({
1307
+ path,
1308
+ status: "unchanged"
1190
1309
  });
1191
- lastProgressAt = Date.now();
1310
+ await reportUpdate();
1311
+ continue;
1312
+ }
1313
+ const item = entry.item;
1314
+ if (overlapsPending(path)) await flush();
1315
+ if (batchWrites && entry.batchable && entry.content !== void 0 && !entry.contentStream) {
1316
+ pending.push({
1317
+ entry: {
1318
+ ...entry,
1319
+ content: entry.content
1320
+ },
1321
+ item
1322
+ });
1323
+ pendingPaths.add(path);
1324
+ for (const directory of parentDirectoryPaths(path)) pendingDirectories.add(directory);
1325
+ pendingBytes += contentSize(entry.content);
1326
+ if (pending.length >= 512 || pendingBytes >= 33554432) await flush();
1327
+ continue;
1192
1328
  }
1329
+ await flush();
1330
+ await writeOne(entry, item);
1193
1331
  }
1332
+ await flush();
1194
1333
  throwIfAborted(options.abortSignal);
1195
1334
  const removedDirectories = await removeStaleMaterializedSourceFiles(store, grant, workspace, source, configuredSources, nextPaths, options, control, existing, ownedDirectories, async (path, owned) => {
1196
1335
  const previouslyOwned = ownedDirectories.has(path);
@@ -1498,8 +1637,7 @@ function readStringMeta(meta, key) {
1498
1637
  function readDigest(meta) {
1499
1638
  return readStringMeta(meta, "digest") || readStringMeta(meta, "sha");
1500
1639
  }
1501
- //#endregion
1502
- //#region src/storage/metadata-target.ts
1640
+ // src/storage/metadata-target.ts
1503
1641
  /** Internal capability used only by Source Sync through wrapped writable facades. */
1504
1642
  const workspaceInternalMetadataCapability = Symbol("vitehub.workspace.internalMetadata");
1505
1643
  const metadataTargetResolvers = /* @__PURE__ */ new WeakMap();
@@ -1585,5 +1723,4 @@ function metadataTargetResolver(source) {
1585
1723
  function resolveWorkspaceMetadataMutationTarget(target) {
1586
1724
  return privateMetadataTargets.get(target) ?? target;
1587
1725
  }
1588
- //#endregion
1589
1726
  export { removeWorkspaceOwnedFile as A, withWorkspaceStoreMutation as C, readWorkspaceFileOwner as D, normalizeSourceFileMetadata as E, registerWorkspaceStoreAlias as M, workspaceStoreIdentity as N, recordWorkspaceFileOwner as O, sourceMountOwnsPath as S, normalizeMetadataValue as T, reconcileRemovedStartupSources as _, resolveWorkspaceMetadataMutationTarget as a, statVirtualSourcePath as b, workspaceInternalMetadataCapability as c, invalidateSourceSnapshot as d, materializeWorkspaceSources as f, readSourceSnapshotPaths as g, readResolvedSourceFile as h, forwardWorkspaceMetadataView as i, withWorkspaceFileCheckpoint as j, removeWorkspaceFileOwner as k, hasCurrentSourceSnapshot as l, readCurrentSourceSnapshot as m, createWorkspaceMetadataTarget as n, resolveWorkspaceMetadataTarget as o, materializesCompleteSource as p, forwardWorkspaceMetadataTarget as r, setWorkspaceMetadata as s, attachWorkspaceMetadataTarget as t, hasFreshSourceSnapshot as u, searchMaterializedStore as v, normalizeSourceItemPath as w, createWorkspaceSourceMountAuthority as x, sourceSnapshotOwnsAnyPath as y };
@@ -1,4 +1,4 @@
1
- //#region ../internal/src/object.ts
1
+ // ../internal/src/object.ts
2
2
  /** A non-null object that is not an array. Functions do not pass. */
3
3
  function isRecord(value) {
4
4
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -7,5 +7,4 @@ function isRecord(value) {
7
7
  function isRecordOrFunction(value) {
8
8
  return Object(value) === value && !Array.isArray(value);
9
9
  }
10
- //#endregion
11
10
  export { isRecordOrFunction as n, isRecord as t };
@@ -1,4 +1,3 @@
1
- //#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
2
1
  /** The Standard Typed interface. This is a base type extended by other specs. */
3
2
  interface StandardTypedV1<Input = unknown, Output = Input> {
4
3
  /** The Standard properties. */
@@ -74,8 +73,6 @@ declare namespace StandardSchemaV1 {
74
73
  /** Infers the output type of a Standard. */
75
74
  type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
76
75
  }
77
- //#endregion
78
- //#region ../internal/src/operation-definition.d.ts
79
76
  /** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
80
77
  type OperationKind = "read" | "write" | "destructive";
81
78
  /** The signed-in user of a call. */
@@ -104,6 +101,11 @@ interface OperationAccess {
104
101
  */
105
102
  readonly sections: "all" | readonly string[];
106
103
  readonly user?: OperationUser;
104
+ /**
105
+ * Who signed the call: `"console"` when the ViteHub Console signed it for a person, whose `user` is then a Console
106
+ * account and not an app user, or `"cli"` for a key. Not set for other calls.
107
+ */
108
+ readonly via?: "console" | "cli";
107
109
  }
108
110
  interface OperationContext {
109
111
  /** The checked Console access of the call. */
@@ -166,7 +168,8 @@ interface OperationDefinition<Input, Output> {
166
168
  /** Standard Schema (valibot in this repo). Its Standard JSON Schema builds CLI flags and the MCP input schema. */
167
169
  input: StandardSchemaV1<unknown, Input>;
168
170
  output?: StandardSchemaV1<unknown, Output>;
169
- cli?: {
171
+ /** `false`: no `vitehub` command. The Console and MCP still call the operation. */
172
+ cli?: false | {
170
173
  /** Defaults: namespace = section, command = verb. */
171
174
  namespace?: string;
172
175
  /** A space groups commands: `jobs list` and `jobs show` run as `vitehub <namespace> jobs list` and `jobs show`. */
@@ -207,7 +210,7 @@ interface OperationDefinition<Input, Output> {
207
210
  /** An operation of any input and output, as a registry holds it. */
208
211
  interface AnyOperation extends Omit<OperationDefinition<unknown, unknown>, "cli" | "input" | "mcp" | "output" | "readOnlyWhen" | "run" | "scope" | "section"> {
209
212
  readOnlyWhen?: (input: never) => boolean;
210
- cli?: {
213
+ cli?: false | {
211
214
  namespace?: string;
212
215
  command?: string;
213
216
  default?: boolean;
@@ -235,5 +238,4 @@ interface OperationContributionEntry {
235
238
  /** `false`: the app already has these operations at runtime. Only tools such as the CLI and `vitehub inspect` read the entry. */
236
239
  runtime?: false;
237
240
  }
238
- //#endregion
239
241
  export { OperationContributionEntry as n, AnyOperation as t };
@@ -1,6 +1,6 @@
1
- import { t as workspaceCommitRequestBytes } from "./results-DgkZUmTL.js";
2
- import { n as isRecordOrFunction, t as isRecord } from "./object-Da1zyPCR.js";
3
- import { t as internalErrorDiagnostics } from "./error-diagnostics-CQ4BUqRe.js";
1
+ import { t as workspaceCommitRequestBytes } from "./results-z-HpV9EP.js";
2
+ import { n as isRecordOrFunction, t as isRecord } from "./object-CAK6UYR5.js";
3
+ import { t as internalErrorDiagnostics } from "./error-diagnostics-kKXseq8d.js";
4
4
  import { basename, dirname, join, parse, resolve } from "node:path";
5
5
  import { mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
6
6
  import "node:fs/promises";
@@ -9,7 +9,7 @@ import { tmpdir } from "node:os";
9
9
  import { fileURLToPath, pathToFileURL } from "node:url";
10
10
  import { createBirpc } from "birpc";
11
11
  import { toJsonSchema } from "@valibot/to-json-schema";
12
- //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
12
+ // ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
13
13
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
14
14
  function normalizeWindowsPath(input = "") {
15
15
  if (!input) return input;
@@ -106,8 +106,7 @@ const dirname$1 = function(p) {
106
106
  if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
107
107
  return segments.join("/") || (isAbsolute$1(p) ? "/" : ".");
108
108
  };
109
- //#endregion
110
- //#region ../internal/src/inspect.ts
109
+ // ../internal/src/inspect.ts
111
110
  function relativeDefinitionFile(projectRoot, file) {
112
111
  return relative$1(projectRoot, file).replaceAll("\\", "/");
113
112
  }
@@ -371,8 +370,7 @@ function requireViteHubDevServerUrl(roots, env, command) {
371
370
  if (!url) throw internalErrorDiagnostics.INTERNAL_DEV_SERVER_NOT_FOUND({ command });
372
371
  return url;
373
372
  }
374
- //#endregion
375
- //#region ../internal/src/build/vite.ts
373
+ // ../internal/src/build/vite.ts
376
374
  const generatedViteHubFilesPattern = "**/.vitehub/**";
377
375
  const projectRootDirectoryMarkers = [
378
376
  ["server", "agents"],
@@ -408,14 +406,17 @@ function isServerEnvironment(name, config) {
408
406
  * Use one app's effective Nitro runner for both environment configuration and generated imports.
409
407
  * `configureEnvironment` reads the runner after Nitro's `build:before` hooks and saves the decision for `load`.
410
408
  */
411
- function createNativePackageLoading() {
409
+ function createNativePackageLoading(ssrPackageEntries = []) {
412
410
  let nitro;
413
411
  let native = false;
412
+ let nativeSsr = false;
413
+ const ssrDistDirs = ssrPackageEntries.map((entry) => dirname(fileURLToPath(entry)).replace(/\\/g, "/") + "/");
414
414
  return {
415
415
  nitro: { setup(instance) {
416
416
  nitro = instance;
417
417
  } },
418
- configureEnvironment(name, env) {
418
+ configureEnvironment(name, env, options) {
419
+ if (name === "ssr") nativeSsr = env.command === "serve" && !env.isSsrTargetWebworker && !options?.resolve?.conditions?.some((condition) => condition === "worker" || condition === "workerd" || condition === "browser" || condition === "edge-light" || condition === "deno");
419
420
  if (name !== "nitro") return false;
420
421
  const runner = nitro?.options.devServer?.runner || process.env.NITRO_DEV_RUNNER || "node-worker";
421
422
  native = env.command === "serve" && (runner === "node-worker" || runner === "node-process");
@@ -423,6 +424,11 @@ function createNativePackageLoading() {
423
424
  },
424
425
  load(id, environmentName) {
425
426
  if (environmentName === "nitro" && native) return loadNativePackageModule(id);
427
+ if (environmentName === "ssr" && nativeSsr && ssrDistDirs.length) {
428
+ const file = id.startsWith("file:") ? fileURLToPath(id) : id;
429
+ const path = file.replace(/\\/g, "/");
430
+ if (/^vitehub-grants(?:-[\w-]+)?\.js$/.test(basename(path)) && ssrDistDirs.some((dir) => dirname(path) + "/" === dir)) return reexportNativeModule(file);
431
+ }
426
432
  }
427
433
  };
428
434
  }
@@ -436,6 +442,9 @@ const nativePackageDistFile = /\/node_modules\/@vite-hub\/(?:agent|connections|r
436
442
  function loadNativePackageModule(id) {
437
443
  const file = id.startsWith("file:") ? fileURLToPath(id) : id;
438
444
  if (!nativePackageDistFile.test(file.replace(/\\/g, "/"))) return;
445
+ return reexportNativeModule(file);
446
+ }
447
+ function reexportNativeModule(file) {
439
448
  const url = JSON.stringify(pathToFileURL(realpathSync(file)).href);
440
449
  const hasDefault = /\bexport default\b|\bas default\b/.test(readFileSync(file, "utf8"));
441
450
  const native = JSON.stringify(`data:text/javascript,${encodeURIComponent(`export * from ${url}${hasDefault ? `\nexport { default } from ${url}` : ""}`)}`);
@@ -483,7 +492,7 @@ function hasProjectRootDirectoryMarker(root) {
483
492
  for (const marker of projectRootDirectoryMarkers) try {
484
493
  if (statSync(resolve(root, ...marker)).isDirectory()) return true;
485
494
  } catch (error) {
486
- if (error.code !== "ENOENT") throw error;
495
+ if (!isMissingProjectMarker(error)) throw error;
487
496
  }
488
497
  return false;
489
498
  }
@@ -497,11 +506,15 @@ function hasProjectRootFileMarker(root, markers) {
497
506
  try {
498
507
  if (statSync(resolve(root, ...path)).isFile()) return true;
499
508
  } catch (error) {
500
- if (error.code !== "ENOENT") throw error;
509
+ if (!isMissingProjectMarker(error)) throw error;
501
510
  }
502
511
  }
503
512
  return false;
504
513
  }
514
+ function isMissingProjectMarker(error) {
515
+ const code = error.code;
516
+ return code === "ENOENT" || code === "ENOTDIR";
517
+ }
505
518
  function viteHubEnvPublicModulePath(root) {
506
519
  return resolve(root, ".vitehub", "env", "public.mjs");
507
520
  }
@@ -551,8 +564,7 @@ function publishViteHubDevServer(server) {
551
564
  else http.once("listening", write);
552
565
  http.once("close", remove);
553
566
  }
554
- //#endregion
555
- //#region ../internal/src/operation-rpc.ts
567
+ // ../internal/src/operation-rpc.ts
556
568
  /** Path of the operation RPC under the app. Dev servers and deployed apps serve it the same way, one birpc call per POST. */
557
569
  const operationRpcPath = "/_vitehub/rpc";
558
570
  function text(value) {
@@ -637,8 +649,7 @@ async function callOperationRpc(name, input, send) {
637
649
  };
638
650
  }
639
651
  }
640
- //#endregion
641
- //#region ../internal/src/console-signature.ts
652
+ // ../internal/src/console-signature.ts
642
653
  /**
643
654
  * Signed requests to the Console endpoint of an app, `POST /_vitehub/rpc`. Each caller, such as one Console link or one
644
655
  * CI job, has an Ed25519 key pair. The app keeps only the public keys, in `VITEHUB_CONSOLE_KEY_<NAME>`, so a copy of
@@ -767,8 +778,7 @@ function readConsoleSigningKey(env) {
767
778
  privateKey
768
779
  };
769
780
  }
770
- //#endregion
771
- //#region ../internal/src/standard-schema.ts
781
+ // ../internal/src/standard-schema.ts
772
782
  function readOwn(value, key) {
773
783
  if (value === null || Object(value) !== value) return;
774
784
  try {
@@ -797,8 +807,7 @@ function standardJsonSchema(schema, direction, target = "draft-2020-12", library
797
807
  return;
798
808
  }
799
809
  }
800
- //#endregion
801
- //#region ../internal/src/valibot.ts
810
+ // ../internal/src/valibot.ts
802
811
  const valibotTargets = /* @__PURE__ */ new Set([
803
812
  "draft-07",
804
813
  "draft-2020-12",
@@ -839,8 +848,7 @@ function withValibotJsonSchema(schema, options = {}) {
839
848
  }
840
849
  };
841
850
  }
842
- //#endregion
843
- //#region ../internal/src/operation-definition.ts
851
+ // ../internal/src/operation-definition.ts
844
852
  const nameFormat = /^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$/;
845
853
  const kinds = /* @__PURE__ */ new Set([
846
854
  "read",
@@ -900,8 +908,7 @@ function isSectionId(section) {
900
908
  function operationInputJsonSchema(operation) {
901
909
  return standardJsonSchema(operation.input, "input") ?? { type: "object" };
902
910
  }
903
- //#endregion
904
- //#region ../internal/src/operations.ts
911
+ // ../internal/src/operations.ts
905
912
  /** Header that proves the caller is not a browser page. A foreign page cannot send it without a CORS preflight. */
906
913
  const operationRpcHeader = "x-vitehub-console";
907
914
  /** Response header of the local dev RPC. Its value is {@link projectRootHash} of the project that the server runs. */
@@ -1073,9 +1080,8 @@ function table(rows) {
1073
1080
  const widths = rows[0].map((_, column) => Math.max(...rows.map((row) => row[column].length)));
1074
1081
  return rows.map((row) => row.map((cell, column) => column === row.length - 1 ? cell : cell.padEnd(widths[column])).join(" ")).join("\n");
1075
1082
  }
1076
- //#endregion
1077
- //#region src/operations.ts
1078
- const runtime = () => import("./operations-D8uCpzhM.js");
1083
+ // src/operations.ts
1084
+ const runtime = () => import("./operations-DfbqHWAe.js");
1079
1085
  const name = v.pipe(v.string(), v.check((value) => value.trim() !== "", "Name a Workspace."));
1080
1086
  const nonEmpty = (message) => v.pipe(v.string(), v.check((value) => value !== "", message));
1081
1087
  function defineWorkspaceOperation(definition, kind = "read") {
@@ -1194,7 +1200,7 @@ const refs = defineWorkspaceOperation({
1194
1200
  });
1195
1201
  const show = defineWorkspaceOperation({
1196
1202
  cli: {
1197
- command: "show",
1203
+ command: "get",
1198
1204
  format: formatShow,
1199
1205
  namespace: "workspace",
1200
1206
  positional: [
@@ -1296,5 +1302,4 @@ const workspaceOperations = [
1296
1302
  run: async (input) => await (await runtime()).runWorkspaceStale(input)
1297
1303
  })
1298
1304
  ];
1299
- //#endregion
1300
1305
  export { resolve$1 as S, redactInspectionText as _, createNoExternalAddition as a, isAbsolute$1 as b, isProductionBuild as c, resolveViteHubProjectRoot as d, shouldSkipViteProviderBuild as f, requireViteHubDevServerUrl as g, readViteHubDevTargetOption as h, createNativePackageLoading as i, isServerEnvironment as l, fetchViteHubDevEndpoint as m, callOperationFromCli as n, createViteHubEnvImportAliases as o, discoverViteHubDevServer as p, VITEHUB_SERVER_DIRS as r, generatedViteHubWatchIgnoredAddition as s, workspaceOperations as t, publishViteHubDevServer as u, relativeDefinitionFile as v, relative$1 as x, dirname$1 as y };