@vite-hub/workspace 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/blob-database.js +2 -2
- package/dist/checkout.d.ts +0 -6
- package/dist/checkout.js +1 -30
- package/dist/{config--ZzAvhMp.js → config-B-S_Z4G0.js} +6 -15
- package/dist/durability.js +2 -2
- package/dist/{error-diagnostics-CHgE8TQM.js → error-diagnostics-Dn4sQcKL.js} +3 -4
- package/dist/{file-DQ5-TBTD.js → file-B3KxJyxb.js} +1 -1
- package/dist/{files-D1UkSjzX.js → files-DSOjTK36.js} +1 -1
- package/dist/files.d.ts +0 -6
- package/dist/files.js +4 -4
- package/dist/{github-BECfOMaw.js → github-DDUrrKt8.js} +3 -3
- package/dist/{glob-BIsxLusH.js → glob-BfZVRPCk.js} +1 -1
- package/dist/{host-BYBRcSnh.js → host-CcCDXyJI.js} +3 -3
- package/dist/hosted-vercel-blob.js +4 -4
- package/dist/hosted.js +5 -20
- package/dist/index.js +12 -12
- package/dist/internal/path.js +1 -1
- package/dist/internal/workspace.js +2 -2
- package/dist/{lifecycle-BK7WNfcP.js → lifecycle-CXiS7Dks.js} +4 -4
- package/dist/loader.js +1 -1
- package/dist/{mcp-resources-F4SJF4_P.js → mcp-resources-B2J0YCD2.js} +1 -1
- package/dist/{metadata-target-DPGF6L68.js → metadata-target-oc00D8g2.js} +2 -8
- package/dist/{object-CAK6UYR5.js → object-DNOrQSl5.js} +5 -1
- package/dist/{operations-DJ_7W0gs.js → operations-DWPC8nrk.js} +3 -11
- package/dist/operations.js +22 -16
- package/dist/{provider-fcI7kJ5k.js → provider-DBJeUNFI.js} +27 -28
- package/dist/providers/github/store.js +3 -35
- package/dist/{registry-CFeUQsja.js → registry-CqDWpDe9.js} +2 -2
- package/dist/{request-scope-jH4H0Sbm.js → request-scope-DZJbe-tP.js} +0 -2
- package/dist/{rule-keys-xMpiTLq1.js → rule-keys-DQYcSewo.js} +1 -1
- package/dist/{rules-DYQCKYdt.js → rules-sItt6TP-.js} +2 -10
- package/dist/runtime/request.js +1 -1
- package/dist/runtime/state.js +6 -6
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.js +13 -13
- package/dist/server.js +4 -4
- package/dist/{shared-PFnkYidS.js → shared-CaAKcBBr.js} +10 -14
- package/dist/source-metadata.js +3 -3
- package/dist/{sync-CUkCuP_g.js → sync-ztyvA0Va.js} +3 -3
- package/dist/test.js +1 -1
- package/dist/{use-BCMkT-kC.js → use-BskfWVjx.js} +6 -6
- package/dist/{use-tools-CcXs2hFA.js → use-tools-D_eorKu1.js} +3 -3
- package/dist/{utils-Bv1NBg8r.js → utils-BoFJcaT1.js} +2 -3
- package/dist/vite.js +155 -121
- package/dist/{workspace-D1m00MCM.js → workspace-Dbo5iYIc.js} +10 -10
- package/dist/{workspace-inspection-scanner-BlJ8bCAB.js → workspace-inspection-scanner-6QrvwVJG.js} +0 -5
- package/package.json +12 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as abortable } from "./abort-CQGxJBqa.js";
|
|
2
2
|
import { t as internalErrorDiagnostics } from "./error-diagnostics-CsiNo_oI.js";
|
|
3
3
|
import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
|
|
4
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-
|
|
4
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
|
|
5
5
|
import { l as normalizeWorkspacePath } from "./path-DYHw5KNk.js";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { gunzipSync } from "node:zlib";
|
|
@@ -22,6 +22,15 @@ const forgeEnv = {
|
|
|
22
22
|
names: ["VITEHUB_GITHUB_BASE_URL", "FORGES_GITHUB_BASE_URL"],
|
|
23
23
|
description: "GitHub API URL for GitHub Enterprise Server."
|
|
24
24
|
},
|
|
25
|
+
clientId: {
|
|
26
|
+
names: ["VITEHUB_GITHUB_CLIENT_ID", "FORGES_GITHUB_CLIENT_ID"],
|
|
27
|
+
description: "Client ID of the GitHub App that signs a person in to act as themselves."
|
|
28
|
+
},
|
|
29
|
+
clientSecret: {
|
|
30
|
+
names: ["VITEHUB_GITHUB_CLIENT_SECRET", "FORGES_GITHUB_CLIENT_SECRET"],
|
|
31
|
+
secret: true,
|
|
32
|
+
description: "Client secret of the GitHub App that trades a sign-in code for a user token."
|
|
33
|
+
},
|
|
25
34
|
installationId: {
|
|
26
35
|
names: ["VITEHUB_GITHUB_INSTALLATION_ID", "FORGES_GITHUB_INSTALLATION_ID"],
|
|
27
36
|
description: "GitHub App installation ID for the repositories of one owner."
|
|
@@ -159,10 +168,6 @@ function getActiveCloudflareEnv() {
|
|
|
159
168
|
const runtimeGlobal = globalThis;
|
|
160
169
|
const activeEnvStorage = runtimeGlobal[activeEnvStorageKey] ||= new AsyncLocalStorage();
|
|
161
170
|
const globalEnvProbe = Symbol("vitehub.cloudflare.global-env-probe");
|
|
162
|
-
/**
|
|
163
|
-
* Under the Nitro Cloudflare dev server, `cloudflare:workers` exports unenv's env proxy, which reads every key from
|
|
164
|
-
* `globalThis.__env__`. Storing that proxy in `__env__` makes it read itself, and the next read overflows the stack.
|
|
165
|
-
*/
|
|
166
171
|
function readsGlobalEnv(env) {
|
|
167
172
|
const scope = globalThis;
|
|
168
173
|
const owned = Object.hasOwn(scope, "__env__");
|
|
@@ -214,7 +219,6 @@ var BoundedMap = class extends Map {
|
|
|
214
219
|
}
|
|
215
220
|
};
|
|
216
221
|
// src/providers/github/cache.ts
|
|
217
|
-
/** How long a kept answer stays in KV, in seconds. A commit that nobody reads for a week leaves KV. */
|
|
218
222
|
const kvTTL = 604800;
|
|
219
223
|
const stats = {
|
|
220
224
|
requests: 0,
|
|
@@ -236,7 +240,6 @@ const keptHeaders = [
|
|
|
236
240
|
"etag",
|
|
237
241
|
"link"
|
|
238
242
|
];
|
|
239
|
-
/** The largest answer that goes to KV. Cloudflare KV takes up to 25 MiB a value. */
|
|
240
243
|
const maxStoredBytes = 16777216;
|
|
241
244
|
const sha = "[0-9a-f]{40}";
|
|
242
245
|
const immutablePaths = [
|
|
@@ -364,7 +367,6 @@ async function fetchGitHubRead(memory, input, init, send) {
|
|
|
364
367
|
}
|
|
365
368
|
return response;
|
|
366
369
|
}
|
|
367
|
-
/** Keep an immutable answer in memory, the least recently used out first. */
|
|
368
370
|
function remember(memory, id, stored) {
|
|
369
371
|
if (stored.body.length > maxMemoryBytes / 4 || memory.immutable.has(id)) return;
|
|
370
372
|
memory.immutable.set(id, stored);
|
|
@@ -396,7 +398,6 @@ function text(bytes) {
|
|
|
396
398
|
const end = bytes.indexOf(0);
|
|
397
399
|
return decoder.decode(end === -1 ? bytes : bytes.subarray(0, end));
|
|
398
400
|
}
|
|
399
|
-
/** The `path` record of a PAX header, which GitHub writes for paths longer than the ustar fields. */
|
|
400
401
|
function paxPath(content) {
|
|
401
402
|
let index = 0;
|
|
402
403
|
while (index < content.length) {
|
|
@@ -589,7 +590,6 @@ function resolveGitHubOption(value) {
|
|
|
589
590
|
function isMaskedGitHubTokenOption(value) {
|
|
590
591
|
return value === "********" || value === "<redacted>" || value === "[redacted]";
|
|
591
592
|
}
|
|
592
|
-
/** The first location value that is set, from the active Cloudflare bindings and then from `env`. */
|
|
593
593
|
function readLocationEnv(name, env) {
|
|
594
594
|
const binding = getActiveCloudflareBinding(name);
|
|
595
595
|
if (typeof binding === "string" && binding.trim()) return binding.trim();
|
|
@@ -703,7 +703,6 @@ const githubBlobReads = /* @__PURE__ */ new Map();
|
|
|
703
703
|
const githubBlobByteLimit = 33554432;
|
|
704
704
|
const githubBlobFileLimit = 4194304;
|
|
705
705
|
let githubBlobBytes = 0;
|
|
706
|
-
/** Keep the bytes of a blob, the oldest out first. Different request scopes can finish the same blob; it counts once. */
|
|
707
706
|
function rememberGitHubBlob(sha, bytes) {
|
|
708
707
|
if (bytes.byteLength > githubBlobFileLimit || githubBlobs.has(sha)) return;
|
|
709
708
|
for (const [oldestSha, oldest] of githubBlobs) {
|
|
@@ -736,7 +735,6 @@ async function readGitHubFile(repository, entry, ref, signal) {
|
|
|
736
735
|
}
|
|
737
736
|
return (await abortable(signal, "The GitHub read was aborted.", () => read)).slice();
|
|
738
737
|
}
|
|
739
|
-
/** The last archive that each repository connection read, by commit. */
|
|
740
738
|
const lastArchives = /* @__PURE__ */ new WeakMap();
|
|
741
739
|
/**
|
|
742
740
|
* The gzipped tarball of `ref`. The archive of a commit sha never changes, so the last one stays in memory and goes to
|
|
@@ -773,9 +771,7 @@ async function readGitHubArchive(repository, ref, signal) {
|
|
|
773
771
|
}
|
|
774
772
|
return (await abortable(signal, "The GitHub read was aborted.", () => read)).slice();
|
|
775
773
|
}
|
|
776
|
-
/** The largest archive that goes to KV, before base64. */
|
|
777
774
|
const maxArchiveKVBytes = 8388608;
|
|
778
|
-
/** Above this many blobs that are not in memory, one archive costs less than a request per blob. */
|
|
779
775
|
const archiveReadThreshold = 8;
|
|
780
776
|
/**
|
|
781
777
|
* Keep the bytes of many files of one commit in memory, so the next `readGitHubFile()` of each needs no request. Few
|
package/dist/source-metadata.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { m as readCurrentSourceSnapshot, o as resolveWorkspaceMetadataTarget } from "./metadata-target-
|
|
2
|
-
import { t as assertWorkspaceRules } from "./rule-keys-
|
|
3
|
-
import { i as normalizeWorkspaceSourceMetadata, l as workspaceSourceGrantPaths, o as normalizeWorkspaceSourcesMetadata } from "./config
|
|
1
|
+
import { m as readCurrentSourceSnapshot, o as resolveWorkspaceMetadataTarget } from "./metadata-target-oc00D8g2.js";
|
|
2
|
+
import { t as assertWorkspaceRules } from "./rule-keys-DQYcSewo.js";
|
|
3
|
+
import { i as normalizeWorkspaceSourceMetadata, l as workspaceSourceGrantPaths, o as normalizeWorkspaceSourcesMetadata } from "./config-B-S_Z4G0.js";
|
|
4
4
|
// src/source-metadata.ts
|
|
5
5
|
async function listMaterializedWorkspaceEntries(workspace) {
|
|
6
6
|
return await (await resolveWorkspaceMetadataTarget(workspace))?.list?.("", { recursive: true });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { o as workspaceError } from "./internal/path.js";
|
|
2
2
|
import { f as sha256, n as contentStreamToBytes } from "./path-DYHw5KNk.js";
|
|
3
|
-
import { a as normalizeWorkspaceSources, f as prepareWorkspaceSource, n as createSourceContext, s as sourceMountContainsPath } from "./config
|
|
4
|
-
import { C as withWorkspaceStoreMutation, E as normalizeSourceFileMetadata, S as sourceMountOwnsPath, T as normalizeMetadataValue, w as normalizeSourceItemPath, x as createWorkspaceSourceMountAuthority } from "./metadata-target-
|
|
5
|
-
import { d as sourceSyncPathClaims, f as workspaceSourceSyncStateEquals, l as readWorkspaceSourceSyncState, u as sourceSyncMetaKey } from "./workspace-
|
|
3
|
+
import { a as normalizeWorkspaceSources, f as prepareWorkspaceSource, n as createSourceContext, s as sourceMountContainsPath } from "./config-B-S_Z4G0.js";
|
|
4
|
+
import { C as withWorkspaceStoreMutation, E as normalizeSourceFileMetadata, S as sourceMountOwnsPath, T as normalizeMetadataValue, w as normalizeSourceItemPath, x as createWorkspaceSourceMountAuthority } from "./metadata-target-oc00D8g2.js";
|
|
5
|
+
import { d as sourceSyncPathClaims, f as workspaceSourceSyncStateEquals, l as readWorkspaceSourceSyncState, u as sourceSyncMetaKey } from "./workspace-Dbo5iYIc.js";
|
|
6
6
|
// src/sources/sync.ts
|
|
7
7
|
const sourceSyncLocks = /* @__PURE__ */ new Map();
|
|
8
8
|
const sourceSyncGrants = createWorkspaceSourceMountAuthority("Source Sync");
|
package/dist/test.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { r as registerWorkspace } from "./registry-
|
|
1
|
+
export { r as registerWorkspace } from "./registry-CqDWpDe9.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { n as useWorkspaceAssets } from "./asset-registry-DJyE42kr.js";
|
|
2
2
|
import { normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
|
|
3
|
-
import { f as normalizeHistoryRef, g as validateHistoryMessage, h as requireWorkspaceHistory, m as rejectHistoryHead, s as deleteWorkspaceHistoryRef, u as historyConflict } from "./utils-
|
|
4
|
-
import { _ as attachWorkspaceSourceRequestExecution, g as copyWorkspacePath, h as appendWorkspaceFile, i as assertPublicWorkspaceMetaKey, t as createWorkspace, y as getWorkspaceSourceRequestExecution } from "./workspace-
|
|
3
|
+
import { f as normalizeHistoryRef, g as validateHistoryMessage, h as requireWorkspaceHistory, m as rejectHistoryHead, s as deleteWorkspaceHistoryRef, u as historyConflict } from "./utils-BoFJcaT1.js";
|
|
4
|
+
import { _ as attachWorkspaceSourceRequestExecution, g as copyWorkspacePath, h as appendWorkspaceFile, i as assertPublicWorkspaceMetaKey, t as createWorkspace, y as getWorkspaceSourceRequestExecution } from "./workspace-Dbo5iYIc.js";
|
|
5
5
|
import { c as normalizeSafeWorkspacePattern, f as sha256 } from "./path-DYHw5KNk.js";
|
|
6
|
-
import { s as useRegisteredWorkspace } from "./registry-
|
|
6
|
+
import { s as useRegisteredWorkspace } from "./registry-CqDWpDe9.js";
|
|
7
7
|
import { a as provideWorkspaceStoreTarget, i as forwardWorkspaceStoreTarget, o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
|
|
8
8
|
import { o as requireWorkspaceReplacement, t as attachWorkspaceReplacement } from "./replacement-CVZVsflC.js";
|
|
9
|
-
import { c as workspaceInternalMetadataCapability, o as resolveWorkspaceMetadataTarget, r as forwardWorkspaceMetadataTarget, t as attachWorkspaceMetadataTarget } from "./metadata-target-
|
|
10
|
-
import { t as createHostedWorkspaceSession } from "./host-
|
|
11
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-
|
|
9
|
+
import { c as workspaceInternalMetadataCapability, o as resolveWorkspaceMetadataTarget, r as forwardWorkspaceMetadataTarget, t as attachWorkspaceMetadataTarget } from "./metadata-target-oc00D8g2.js";
|
|
10
|
+
import { t as createHostedWorkspaceSession } from "./host-CcCDXyJI.js";
|
|
11
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
|
|
12
12
|
import { getViteHubErrorShape } from "@vite-hub/runtime";
|
|
13
13
|
// src/core/use.ts
|
|
14
14
|
const workspaceDefinitionSyncStates = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
|
|
2
|
-
import { g as copyWorkspacePath, h as appendWorkspaceFile, y as getWorkspaceSourceRequestExecution } from "./workspace-
|
|
3
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-
|
|
4
|
-
import { n as createWorkspaceFileRuntime, t as createReadonlyFs } from "./use-
|
|
2
|
+
import { g as copyWorkspacePath, h as appendWorkspaceFile, y as getWorkspaceSourceRequestExecution } from "./workspace-Dbo5iYIc.js";
|
|
3
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
|
|
4
|
+
import { n as createWorkspaceFileRuntime, t as createReadonlyFs } from "./use-BskfWVjx.js";
|
|
5
5
|
import { executionBudgetCharged, executionBudgetOverride, markExecutionBudgetHandled } from "@vite-hub/runtime/internal/execution-budget";
|
|
6
6
|
// src/runtime/dependency-loaders.ts
|
|
7
7
|
const shellWorkspaceSpecifier = "@vite-hub/shell/workspace";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
|
|
2
2
|
import { n as copyJsonFileMetadata, r as copyJsonWorkspaceMetadata } from "./file-metadata-Dqpldj0h.js";
|
|
3
3
|
import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
|
|
4
4
|
import { f as sha256, o as isWorkspaceBytes, r as contentToBytes } from "./path-DYHw5KNk.js";
|
|
5
|
-
import { t as createWorkspaceWritePolicy } from "./rules-
|
|
5
|
+
import { t as createWorkspaceWritePolicy } from "./rules-sItt6TP-.js";
|
|
6
6
|
import { lookup } from "mrmime";
|
|
7
7
|
import { isRuntimeObject } from "@vite-hub/runtime/internal/runtime-type";
|
|
8
8
|
// src/core/history.ts
|
|
@@ -76,7 +76,6 @@ function createWorkspaceHistoryReader(history, complete) {
|
|
|
76
76
|
diff: async (options) => await diffWorkspaceRevisions(requireHistory(), options)
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
/** The files whose bytes or retained attributes changed from one revision to another. */
|
|
80
79
|
async function diffWorkspaceRevisions(history, options) {
|
|
81
80
|
const open = async (id) => {
|
|
82
81
|
const view = await history.open(id);
|