@vite-hub/workspace 0.7.0 → 0.8.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/{config--ZzAvhMp.js → config-Bze7OyvB.js} +5 -5
- package/dist/durability.js +2 -2
- package/dist/{file-DQ5-TBTD.js → file-DIBPXqbk.js} +1 -1
- package/dist/{files-D1UkSjzX.js → files-DAJyo7TU.js} +1 -1
- package/dist/files.js +3 -3
- package/dist/{github-BECfOMaw.js → github-DcrnEGNN.js} +2 -2
- package/dist/{glob-BIsxLusH.js → glob-YVshR7WP.js} +1 -1
- package/dist/{host-BYBRcSnh.js → host-BT7EnmZf.js} +1 -1
- package/dist/hosted-vercel-blob.js +2 -2
- package/dist/hosted.js +3 -3
- package/dist/index.js +9 -9
- package/dist/{lifecycle-BK7WNfcP.js → lifecycle-B0ucHUum.js} +4 -4
- package/dist/loader.js +1 -1
- package/dist/{mcp-resources-F4SJF4_P.js → mcp-resources-BDL0llKW.js} +1 -1
- package/dist/{metadata-target-DPGF6L68.js → metadata-target-mlHAv1p4.js} +1 -1
- package/dist/{object-CAK6UYR5.js → object-DNOrQSl5.js} +5 -1
- package/dist/{operations-DJ_7W0gs.js → operations-D3mZArDi.js} +1 -1
- package/dist/operations.js +22 -8
- package/dist/{provider-fcI7kJ5k.js → provider-DZY1cLP5.js} +26 -18
- package/dist/providers/github/store.js +1 -1
- package/dist/{registry-CFeUQsja.js → registry-OonxXCbd.js} +1 -1
- package/dist/runtime/state.js +6 -6
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.js +10 -10
- package/dist/server.js +2 -2
- package/dist/{shared-PFnkYidS.js → shared-DCAyMX8U.js} +9 -0
- package/dist/source-metadata.js +2 -2
- package/dist/{sync-CUkCuP_g.js → sync-DkpTCr9u.js} +3 -3
- package/dist/test.js +1 -1
- package/dist/{use-BCMkT-kC.js → use-hLouCwGz.js} +4 -4
- package/dist/{use-tools-CcXs2hFA.js → use-tools-NXEQt099.js} +2 -2
- package/dist/vite.js +153 -63
- package/dist/{workspace-D1m00MCM.js → workspace-Cz-5Ne1c.js} +6 -6
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ export default defineWorkspace({
|
|
|
79
79
|
```ts
|
|
80
80
|
// routes/docs.get.ts
|
|
81
81
|
import { useWorkspace } from "@vite-hub/workspace"
|
|
82
|
-
import { defineEventHandler } from "h3"
|
|
82
|
+
import { defineEventHandler } from "nitro/h3"
|
|
83
83
|
|
|
84
84
|
export default defineEventHandler(async () => {
|
|
85
85
|
const workspace = useWorkspace("docs", { mode: "write" })
|
|
@@ -3,7 +3,7 @@ import { i as decodeFile, o as isWorkspaceBytes } from "./path-DYHw5KNk.js";
|
|
|
3
3
|
import { t as abortable } from "./abort-CQGxJBqa.js";
|
|
4
4
|
import { t as internalErrorDiagnostics } from "./error-diagnostics-CsiNo_oI.js";
|
|
5
5
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
6
|
-
import {
|
|
6
|
+
import { n as isRecord } from "./object-DNOrQSl5.js";
|
|
7
7
|
import { posix } from "node:path";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
import { sourceIgnores } from "@vite-hub/source";
|
|
@@ -953,10 +953,10 @@ function inferredSourceFingerprintOptions(family, input) {
|
|
|
953
953
|
async function loadInferredWorkspaceSource(family, input) {
|
|
954
954
|
if (family === "fetch" && isRecord(input)) return createInferredFetchSource(input);
|
|
955
955
|
if (family === "fetch") return createInferredFetchSource(input);
|
|
956
|
-
if (family === "file") return (await import("./file-
|
|
957
|
-
if (family === "github") return (await import("./github-
|
|
958
|
-
if (family === "glob") return (await import("./glob-
|
|
959
|
-
return (await import("./mcp-resources-
|
|
956
|
+
if (family === "file") return (await import("./file-DIBPXqbk.js").then((n) => n.n)).file(input);
|
|
957
|
+
if (family === "github") return (await import("./github-DcrnEGNN.js").then((n) => n.n)).github(input);
|
|
958
|
+
if (family === "glob") return (await import("./glob-YVshR7WP.js").then((n) => n.n)).glob(input);
|
|
959
|
+
return (await import("./mcp-resources-BDL0llKW.js").then((n) => n.n)).mcpResources(input);
|
|
960
960
|
}
|
|
961
961
|
function inferredSourceDefaults(family, input) {
|
|
962
962
|
if (!isRecord(input)) return family === "file" ? { key: inferredFileSourceKey(input) } : {};
|
package/dist/durability.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-
|
|
1
|
+
import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-OonxXCbd.js";
|
|
2
2
|
import { n as readBlobDatabaseSources } from "./blob-database-sources-CQPAyCz3.js";
|
|
3
|
-
import { c as resolveWorkspaceDefinitionStore, n as isWorkspaceStore } from "./provider-
|
|
3
|
+
import { c as resolveWorkspaceDefinitionStore, n as isWorkspaceStore } from "./provider-DZY1cLP5.js";
|
|
4
4
|
// src/durability.ts
|
|
5
5
|
const sharedDrivers = {
|
|
6
6
|
"cloudflare": "Cloudflare Artifacts.",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
|
|
2
|
-
import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config
|
|
2
|
+
import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-Bze7OyvB.js";
|
|
3
3
|
import { file } from "@vite-hub/source";
|
|
4
4
|
// src/sources/file.ts
|
|
5
5
|
var file_exports = /* @__PURE__ */ __exportAll({ file: () => file$1 });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as normalizeWorkspacePath, o as isWorkspaceBytes, s as matchesAny } from "./path-DYHw5KNk.js";
|
|
2
|
-
import { f as prepareWorkspaceSource, n as createSourceContext } from "./config
|
|
2
|
+
import { f as prepareWorkspaceSource, n as createSourceContext } from "./config-Bze7OyvB.js";
|
|
3
3
|
// src/loaders/files.ts
|
|
4
4
|
function shouldLoad(path, options) {
|
|
5
5
|
if (options.include && !matchesAny(path, options.include)) return false;
|
package/dist/files.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as useWorkspaceFiles } from "./use-
|
|
1
|
+
import { r as useWorkspaceFiles } from "./use-hLouCwGz.js";
|
|
2
2
|
import { n as isWorkspaceConflict, normalizeSafeWorkspacePath } from "./internal/path.js";
|
|
3
|
-
import { t as isWorkspaceName } from "./registry-
|
|
3
|
+
import { t as isWorkspaceName } from "./registry-OonxXCbd.js";
|
|
4
4
|
import { r as registerWorkspacePlugin } from "./rules-DYQCKYdt.js";
|
|
5
5
|
import { o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
|
|
6
|
-
import { E as registerWorkspaceKV, w as readGitHubReadStats } from "./shared-
|
|
6
|
+
import { E as registerWorkspaceKV, w as readGitHubReadStats } from "./shared-DCAyMX8U.js";
|
|
7
7
|
export { isWorkspaceConflict, isWorkspaceName, normalizeSafeWorkspacePath, readGitHubReadStats, registerWorkspaceKV, registerWorkspacePlugin, resolveWorkspaceStoreTarget, useWorkspaceFiles };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
|
|
2
|
-
import { M as readForgeEnv, h as readGitHubEnvToken, j as forgeEnv } from "./shared-
|
|
2
|
+
import { M as readForgeEnv, h as readGitHubEnvToken, j as forgeEnv } from "./shared-DCAyMX8U.js";
|
|
3
3
|
import { s as matchesAny } from "./path-DYHw5KNk.js";
|
|
4
|
-
import { d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, p as resolveGitHubIgnore } from "./config
|
|
4
|
+
import { d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, p as resolveGitHubIgnore } from "./config-Bze7OyvB.js";
|
|
5
5
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
6
6
|
import { github } from "@vite-hub/source";
|
|
7
7
|
// src/env.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
|
|
2
|
-
import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config
|
|
2
|
+
import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-Bze7OyvB.js";
|
|
3
3
|
import * as source from "@vite-hub/source";
|
|
4
4
|
// src/sources/glob.ts
|
|
5
5
|
var glob_exports = /* @__PURE__ */ __exportAll({ glob: () => glob });
|
|
@@ -2,7 +2,7 @@ import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
|
|
|
2
2
|
import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
|
|
3
3
|
import { a as isExcludedWorkspacePath, f as sha256, i as decodeFile, l as normalizeWorkspacePath, r as contentToBytes, s as matchesAny } from "./path-DYHw5KNk.js";
|
|
4
4
|
import { n as createSnapshotFromEntries, r as diffSnapshots } from "./utils-Bv1NBg8r.js";
|
|
5
|
-
import { C as assertPathInSessionScope, D as scopedSearchQuery, E as isMissingWorkspacePathError, S as assertDiffInsideSessionPaths, T as filterSessionEntries, w as filterSessionDiff } from "./workspace-
|
|
5
|
+
import { C as assertPathInSessionScope, D as scopedSearchQuery, E as isMissingWorkspacePathError, S as assertDiffInsideSessionPaths, T as filterSessionEntries, w as filterSessionDiff } from "./workspace-Cz-5Ne1c.js";
|
|
6
6
|
import { r as resolveWorkspaceRevisionMaterializer } from "./vitehub-grants-Co713QTg.js";
|
|
7
7
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
8
8
|
import { normalizeExecutionAuthority } from "@vite-hub/runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as setWorkspaceHostedStoreLoader, l as ownedBlobPrefix, o as resolveRuntimeVercelBlobWorkspaceStore, s as resolveVercelBlobWorkspaceStore, u as getWorkspaceHostedStoreLoader } from "./provider-
|
|
1
|
+
import { d as setWorkspaceHostedStoreLoader, l as ownedBlobPrefix, o as resolveRuntimeVercelBlobWorkspaceStore, s as resolveVercelBlobWorkspaceStore, u as getWorkspaceHostedStoreLoader } from "./provider-DZY1cLP5.js";
|
|
2
2
|
import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
|
|
3
3
|
import { a as isExcludedWorkspacePath, c as normalizeSafeWorkspacePattern, f as sha256, l as normalizeWorkspacePath, r as contentToBytes } from "./path-DYHw5KNk.js";
|
|
4
4
|
import { t as createWorkspaceGlobMatcher } from "./glob-BIg9O4yY.js";
|
|
@@ -6,7 +6,7 @@ import { r as diffSnapshots, t as createCurrentSnapshotFromStore } from "./utils
|
|
|
6
6
|
import { a as provideWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
|
|
7
7
|
import { a as replacementRecoveryError, i as replaceStorePath } from "./replacement-CVZVsflC.js";
|
|
8
8
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
9
|
-
import {
|
|
9
|
+
import { n as isRecord } from "./object-DNOrQSl5.js";
|
|
10
10
|
import { n as setWorkspaceRuntimeConfig } from "./config-CsgNNVAI.js";
|
|
11
11
|
import { resolve } from "node:path";
|
|
12
12
|
// src/providers/vercel/blob-store.ts
|
package/dist/hosted.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as resolveGitHubWorkspaceStore, d as setWorkspaceHostedStoreLoader, i as resolveCloudflareArtifactsStore, u as getWorkspaceHostedStoreLoader } from "./provider-
|
|
1
|
+
import { a as resolveGitHubWorkspaceStore, d as setWorkspaceHostedStoreLoader, i as resolveCloudflareArtifactsStore, u as getWorkspaceHostedStoreLoader } from "./provider-DZY1cLP5.js";
|
|
2
2
|
import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError, t as assertWorkspaceDigest } from "./internal/path.js";
|
|
3
|
-
import { k as getActiveCloudflareBinding } from "./shared-
|
|
3
|
+
import { k as getActiveCloudflareBinding } from "./shared-DCAyMX8U.js";
|
|
4
4
|
import { n as copyJsonFileMetadata } from "./file-metadata-Dqpldj0h.js";
|
|
5
5
|
import { a as isExcludedWorkspacePath, c as normalizeSafeWorkspacePattern, f as sha256, l as normalizeWorkspacePath, r as contentToBytes } from "./path-DYHw5KNk.js";
|
|
6
6
|
import { t as createWorkspaceGlobMatcher } from "./glob-BIg9O4yY.js";
|
|
7
7
|
import { t as workspaceStoreDiscard } from "./discard-BkoLmmmN.js";
|
|
8
|
-
import {
|
|
8
|
+
import { n as isRecord } from "./object-DNOrQSl5.js";
|
|
9
9
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
10
10
|
import { i as replaceStorePath } from "./replacement-CVZVsflC.js";
|
|
11
11
|
import { n as createSnapshotFromEntries, r as diffSnapshots } from "./utils-Bv1NBg8r.js";
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
|
|
2
2
|
import { t as assertWorkspaceRules } from "./rule-keys-xMpiTLq1.js";
|
|
3
3
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
4
|
-
import { t as createWorkspace } from "./workspace-
|
|
4
|
+
import { t as createWorkspace } from "./workspace-Cz-5Ne1c.js";
|
|
5
5
|
import { n as isWorkspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
|
|
6
|
-
import { r as withFileSourceOptions, t as file } from "./file-
|
|
7
|
-
import { m as url } from "./config
|
|
8
|
-
import { t as github } from "./github-
|
|
9
|
-
import { t as glob } from "./glob-
|
|
10
|
-
import { t as mcpResources } from "./mcp-resources-
|
|
11
|
-
import { n as createWorkspaceTools, t as useWorkspace } from "./use-tools-
|
|
12
|
-
import { t as isWorkspaceName } from "./registry-
|
|
6
|
+
import { r as withFileSourceOptions, t as file } from "./file-DIBPXqbk.js";
|
|
7
|
+
import { m as url } from "./config-Bze7OyvB.js";
|
|
8
|
+
import { t as github } from "./github-DcrnEGNN.js";
|
|
9
|
+
import { t as glob } from "./glob-YVshR7WP.js";
|
|
10
|
+
import { t as mcpResources } from "./mcp-resources-BDL0llKW.js";
|
|
11
|
+
import { n as createWorkspaceTools, t as useWorkspace } from "./use-tools-NXEQt099.js";
|
|
12
|
+
import { t as isWorkspaceName } from "./registry-OonxXCbd.js";
|
|
13
13
|
import { r as registerWorkspacePlugin } from "./rules-DYQCKYdt.js";
|
|
14
|
-
import { r as useWorkspaceFiles } from "./use-
|
|
14
|
+
import { r as useWorkspaceFiles } from "./use-hLouCwGz.js";
|
|
15
15
|
import { lookup } from "mrmime";
|
|
16
16
|
import { markdown as markdown$1, sourceIgnores } from "@vite-hub/source";
|
|
17
17
|
// src/core/define.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
|
|
2
2
|
import { n as useWorkspaceAssets } from "./asset-registry-DJyE42kr.js";
|
|
3
|
-
import { t as files } from "./files-
|
|
3
|
+
import { t as files } from "./files-DAJyo7TU.js";
|
|
4
4
|
import { f as sha256, l as normalizeWorkspacePath, t as contentStreamChunks, u as readStoredFile } from "./path-DYHw5KNk.js";
|
|
5
5
|
import { o as workspaceError } from "./internal/path.js";
|
|
6
|
-
import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, n as createSourceContext } from "./config
|
|
7
|
-
import { A as removeWorkspaceOwnedFile, C as withWorkspaceStoreMutation, D as readWorkspaceFileOwner, M as registerWorkspaceStoreAlias, N as workspaceStoreIdentity, O as recordWorkspaceFileOwner, _ as reconcileRemovedStartupSources, d as invalidateSourceSnapshot, j as withWorkspaceFileCheckpoint, k as removeWorkspaceFileOwner, m as readCurrentSourceSnapshot, y as sourceSnapshotOwnsAnyPath } from "./metadata-target-
|
|
8
|
-
import { s as invalidateWorkspaceSourceMaterialization } from "./workspace-
|
|
6
|
+
import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, n as createSourceContext } from "./config-Bze7OyvB.js";
|
|
7
|
+
import { A as removeWorkspaceOwnedFile, C as withWorkspaceStoreMutation, D as readWorkspaceFileOwner, M as registerWorkspaceStoreAlias, N as workspaceStoreIdentity, O as recordWorkspaceFileOwner, _ as reconcileRemovedStartupSources, d as invalidateSourceSnapshot, j as withWorkspaceFileCheckpoint, k as removeWorkspaceFileOwner, m as readCurrentSourceSnapshot, y as sourceSnapshotOwnsAnyPath } from "./metadata-target-mlHAv1p4.js";
|
|
8
|
+
import { s as invalidateWorkspaceSourceMaterialization } from "./workspace-Cz-5Ne1c.js";
|
|
9
9
|
import { getViteHubErrorShape } from "@vite-hub/runtime";
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
// src/lifecycle.ts
|
package/dist/loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-DnNXxpGL.js";
|
|
2
2
|
import { normalizeSafeWorkspacePath } from "./internal/path.js";
|
|
3
|
-
import { b as markLiveWorkspaceSource, d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, u as ownSourceOption } from "./config
|
|
3
|
+
import { b as markLiveWorkspaceSource, d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, u as ownSourceOption } from "./config-Bze7OyvB.js";
|
|
4
4
|
import { mcpResources } from "@vite-hub/source/mcp";
|
|
5
5
|
// src/sources/mcp-resources.ts
|
|
6
6
|
var mcp_resources_exports = /* @__PURE__ */ __exportAll({ mcpResources: () => mcpResources$1 });
|
|
@@ -4,7 +4,7 @@ import { normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path
|
|
|
4
4
|
import { f as sha256, i as decodeFile, l as normalizeWorkspacePath, n as contentStreamToBytes, o as isWorkspaceBytes, t as contentStreamChunks } from "./path-DYHw5KNk.js";
|
|
5
5
|
import { i as forwardWorkspaceStoreTarget, o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
|
|
6
6
|
import { t as searchText } from "./search-CG6UNOtn.js";
|
|
7
|
-
import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, n as createSourceContext, s as sourceMountContainsPath } from "./config
|
|
7
|
+
import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, n as createSourceContext, s as sourceMountContainsPath } from "./config-Bze7OyvB.js";
|
|
8
8
|
import { posix } from "node:path";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
10
|
// src/storage/identity.ts
|
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
function isRecord(value) {
|
|
4
4
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
5
|
}
|
|
6
|
+
/** A non-null object. Arrays pass. Functions do not. */
|
|
7
|
+
function isObject(value) {
|
|
8
|
+
return typeof value === "object" && value !== null;
|
|
9
|
+
}
|
|
6
10
|
/** A non-null object or a function that is not an array. */
|
|
7
11
|
function isRecordOrFunction(value) {
|
|
8
12
|
return Object(value) === value && !Array.isArray(value);
|
|
9
13
|
}
|
|
10
|
-
export {
|
|
14
|
+
export { isRecord as n, isRecordOrFunction as r, isObject as t };
|
|
@@ -3,7 +3,7 @@ import { i as workspaceConflict } from "./internal/path.js";
|
|
|
3
3
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
4
4
|
import { d as normalizeHistoryPath } from "./utils-Bv1NBg8r.js";
|
|
5
5
|
import { r as contentToBytes } from "./path-DYHw5KNk.js";
|
|
6
|
-
import { r as useWorkspaceFiles } from "./use-
|
|
6
|
+
import { r as useWorkspaceFiles } from "./use-hLouCwGz.js";
|
|
7
7
|
import { readDerivedFrom, staleDerivedFiles } from "./lineage.js";
|
|
8
8
|
// src/runtime/operations.ts
|
|
9
9
|
const invalidRequestCodes = /* @__PURE__ */ new Set([
|
package/dist/operations.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { t as internalErrorDiagnostics } from "./error-diagnostics-CsiNo_oI.js";
|
|
2
|
-
import { n as
|
|
2
|
+
import { n as isRecord, r as isRecordOrFunction } from "./object-DNOrQSl5.js";
|
|
3
3
|
import { t as workspaceCommitRequestBytes } from "./results-z-HpV9EP.js";
|
|
4
|
+
import "node:module";
|
|
4
5
|
import { basename, dirname, join, parse, resolve } from "node:path";
|
|
5
6
|
import { mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
6
7
|
import "node:fs/promises";
|
|
@@ -521,14 +522,27 @@ function isMissingProjectMarker(error) {
|
|
|
521
522
|
const code = error.code;
|
|
522
523
|
return code === "ENOENT" || code === "ENOTDIR";
|
|
523
524
|
}
|
|
524
|
-
|
|
525
|
-
|
|
525
|
+
/**
|
|
526
|
+
* The generated-code folder of an owner, relative to the project root: `.vitehub` for the app, `.vitehub/cli` and
|
|
527
|
+
* `.vitehub/node-test` for the others. State that the processes share, such as the Email outbox or the Env secret,
|
|
528
|
+
* stays in `.vitehub`, and so do the declaration files that TypeScript reads, because their contents follow only the
|
|
529
|
+
* Definitions.
|
|
530
|
+
*/
|
|
531
|
+
function viteHubGeneratedCodeDir(owner = "app") {
|
|
532
|
+
return owner === "app" ? ".vitehub" : `.vitehub/${owner}`;
|
|
533
|
+
}
|
|
534
|
+
/** The absolute generated-code folder of an owner. See {@link viteHubGeneratedCodeDir}. */
|
|
535
|
+
function viteHubGeneratedCodeRoot(projectRoot, owner = "app") {
|
|
536
|
+
return resolve(projectRoot, viteHubGeneratedCodeDir(owner));
|
|
537
|
+
}
|
|
538
|
+
function viteHubEnvPublicModulePath(root, owner) {
|
|
539
|
+
return resolve(viteHubGeneratedCodeRoot(root, owner), "env", "public.mjs");
|
|
526
540
|
}
|
|
527
|
-
function viteHubEnvServerModulePath(root) {
|
|
528
|
-
return resolve(root,
|
|
541
|
+
function viteHubEnvServerModulePath(root, owner) {
|
|
542
|
+
return resolve(viteHubGeneratedCodeRoot(root, owner), "env", "server.mjs");
|
|
529
543
|
}
|
|
530
|
-
function viteHubEnvDescriptionModulePath(root) {
|
|
531
|
-
return resolve(root,
|
|
544
|
+
function viteHubEnvDescriptionModulePath(root, owner) {
|
|
545
|
+
return resolve(viteHubGeneratedCodeRoot(root, owner), "env", "description.mjs");
|
|
532
546
|
}
|
|
533
547
|
function createViteHubEnvImportAliases(root) {
|
|
534
548
|
return {
|
|
@@ -1104,7 +1118,7 @@ function table(rows) {
|
|
|
1104
1118
|
return rows.map((row) => row.map((cell, column) => column === row.length - 1 ? cell : cell.padEnd(widths[column])).join(" ")).join("\n");
|
|
1105
1119
|
}
|
|
1106
1120
|
// src/operations.ts
|
|
1107
|
-
const runtime = () => import("./operations-
|
|
1121
|
+
const runtime = () => import("./operations-D3mZArDi.js");
|
|
1108
1122
|
const name = v.pipe(v.string(), v.check((value) => value.trim() !== "", "Name a Workspace."));
|
|
1109
1123
|
const nonEmpty = (message) => v.pipe(v.string(), v.check((value) => value !== "", message));
|
|
1110
1124
|
function defineWorkspaceOperation(definition, kind = "read") {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as readForgeEnv, j as forgeEnv, t as assertNoGitHubRepositoryKey } from "./shared-
|
|
1
|
+
import { M as readForgeEnv, j as forgeEnv, t as assertNoGitHubRepositoryKey } from "./shared-DCAyMX8U.js";
|
|
2
2
|
import { a as workspaceConflictError, o as workspaceError, t as assertWorkspaceDigest } from "./internal/path.js";
|
|
3
3
|
import { createGitHubWorkspaceStore } from "./providers/github/store.js";
|
|
4
4
|
import { t as getWorkspaceRuntimeConfig } from "./config-CsgNNVAI.js";
|
|
@@ -1223,25 +1223,33 @@ var LocalWorkspaceStore = class {
|
|
|
1223
1223
|
groups.set(key, group);
|
|
1224
1224
|
}
|
|
1225
1225
|
const independent = this.#processLocks ? filtered.map((entry) => [entry]) : [...groups.values()];
|
|
1226
|
-
for (let index = 0; index < independent.length; index += 64)
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1226
|
+
for (let index = 0; index < independent.length; index += 64) {
|
|
1227
|
+
const batch = independent.slice(index, index + 64).map(async (group) => {
|
|
1228
|
+
if (this.#processLocks) {
|
|
1229
|
+
for (const entry of group) {
|
|
1230
|
+
const info = await this.#pathLock(this.root, entry.path, () => this.#stat(entry.path, includeDigest), true);
|
|
1231
|
+
if (info) entries.push(info);
|
|
1232
|
+
}
|
|
1233
|
+
return;
|
|
1231
1234
|
}
|
|
1232
|
-
|
|
1235
|
+
const heldReadPrefix = normalizedPrefix || group[0].path.split("/")[0];
|
|
1236
|
+
let offset = 0;
|
|
1237
|
+
while (offset < group.length) await withWorkspacePathLock(this.root, heldReadPrefix, async () => {
|
|
1238
|
+
const startedAt = Date.now();
|
|
1239
|
+
do {
|
|
1240
|
+
const entry = group[offset++];
|
|
1241
|
+
const info = await withWorkspacePathLock(this.root, entry.path, () => this.#stat(entry.path, includeDigest), true, heldReadPrefix);
|
|
1242
|
+
if (info) entries.push(info);
|
|
1243
|
+
} while (offset < group.length && Date.now() - startedAt < readBatchDurationMs);
|
|
1244
|
+
}, true);
|
|
1245
|
+
});
|
|
1246
|
+
try {
|
|
1247
|
+
await Promise.all(batch);
|
|
1248
|
+
} catch (error) {
|
|
1249
|
+
await Promise.allSettled(batch);
|
|
1250
|
+
throw error;
|
|
1233
1251
|
}
|
|
1234
|
-
|
|
1235
|
-
let offset = 0;
|
|
1236
|
-
while (offset < group.length) await withWorkspacePathLock(this.root, heldReadPrefix, async () => {
|
|
1237
|
-
const startedAt = Date.now();
|
|
1238
|
-
do {
|
|
1239
|
-
const entry = group[offset++];
|
|
1240
|
-
const info = await withWorkspacePathLock(this.root, entry.path, () => this.#stat(entry.path, includeDigest), true, heldReadPrefix);
|
|
1241
|
-
if (info) entries.push(info);
|
|
1242
|
-
} while (offset < group.length && Date.now() - startedAt < readBatchDurationMs);
|
|
1243
|
-
}, true);
|
|
1244
|
-
}));
|
|
1252
|
+
}
|
|
1245
1253
|
return entries.sort((a, b) => a.path.localeCompare(b.path));
|
|
1246
1254
|
}
|
|
1247
1255
|
async glob(pattern, options = {}) {
|
|
@@ -5,7 +5,7 @@ import { d as normalizeHistoryPath, f as normalizeHistoryRef, m as rejectHistory
|
|
|
5
5
|
import { t as workspaceStoreDiscard } from "../../discard-BkoLmmmN.js";
|
|
6
6
|
import { a as provideWorkspaceStoreTarget, n as provideWorkspaceRevisionMaterializer } from "../../vitehub-grants-Co713QTg.js";
|
|
7
7
|
import { i as replaceStorePath } from "../../replacement-CVZVsflC.js";
|
|
8
|
-
import { C as githubKVKey, D as writeWorkspaceKV, O as BoundedMap, S as resolveGitHubRootOption, T as readWorkspaceKV, _ as requireGitHubOption, a as gitFileMode, b as resolveGitHubRefsOption, c as githubRequestStatus, d as preloadGitHubFiles, f as readCurrentHead, g as readGitHubFile, i as gitBlobSha, l as joinGitPath, m as readGitHubBranchState, n as commitGitHubChanges, o as githubBranchMovedConflict, p as readGitHubArchive, r as connectGitHubRepository, s as githubRequest, t as assertNoGitHubRepositoryKey, u as loadForge, v as resolveGitHubBranchOption, x as resolveGitHubRepositoryOption, y as resolveGitHubCredential } from "../../shared-
|
|
8
|
+
import { C as githubKVKey, D as writeWorkspaceKV, O as BoundedMap, S as resolveGitHubRootOption, T as readWorkspaceKV, _ as requireGitHubOption, a as gitFileMode, b as resolveGitHubRefsOption, c as githubRequestStatus, d as preloadGitHubFiles, f as readCurrentHead, g as readGitHubFile, i as gitBlobSha, l as joinGitPath, m as readGitHubBranchState, n as commitGitHubChanges, o as githubBranchMovedConflict, p as readGitHubArchive, r as connectGitHubRepository, s as githubRequest, t as assertNoGitHubRepositoryKey, u as loadForge, v as resolveGitHubBranchOption, x as resolveGitHubRepositoryOption, y as resolveGitHubCredential } from "../../shared-DCAyMX8U.js";
|
|
9
9
|
import { t as workspaceErrorDiagnostics } from "../../error-diagnostics-CHgE8TQM.js";
|
|
10
10
|
import { ViteHubError } from "@vite-hub/runtime";
|
|
11
11
|
import { lookup } from "mrmime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as workspaceNotFoundError } from "./internal/path.js";
|
|
2
|
-
import { t as createWorkspace } from "./workspace-
|
|
2
|
+
import { t as createWorkspace } from "./workspace-Cz-5Ne1c.js";
|
|
3
3
|
import { setWorkspaceRuntimeRegistry, workspaceRuntimeRegistryState } from "./runtime/registry.js";
|
|
4
4
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
5
5
|
import { getViteHubErrorShape, isRuntimeDiagnostic } from "@vite-hub/runtime";
|
package/dist/runtime/state.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as setWorkspaceRegistry, i as resolveRegisteredWorkspaceDefinition, o as setWorkspaceRuntimeDefinitions, r as registerWorkspace } from "../registry-
|
|
1
|
+
import { a as setWorkspaceRegistry, i as resolveRegisteredWorkspaceDefinition, o as setWorkspaceRuntimeDefinitions, r as registerWorkspace } from "../registry-OonxXCbd.js";
|
|
2
2
|
import { t as setWorkspaceAssetsRegistry } from "../asset-registry-DJyE42kr.js";
|
|
3
|
-
import { n as invalidateCachedWorkspaceStore, r as resetWorkspaceStoreCache } from "../workspace-
|
|
4
|
-
import { A as setActiveCloudflareEnv } from "../shared-
|
|
5
|
-
import { t as useWorkspace } from "../use-tools-
|
|
6
|
-
import { r as useWorkspaceFiles } from "../use-
|
|
7
|
-
import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "../provider-
|
|
3
|
+
import { n as invalidateCachedWorkspaceStore, r as resetWorkspaceStoreCache } from "../workspace-Cz-5Ne1c.js";
|
|
4
|
+
import { A as setActiveCloudflareEnv } from "../shared-DCAyMX8U.js";
|
|
5
|
+
import { t as useWorkspace } from "../use-tools-NXEQt099.js";
|
|
6
|
+
import { r as useWorkspaceFiles } from "../use-hLouCwGz.js";
|
|
7
|
+
import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "../provider-DZY1cLP5.js";
|
|
8
8
|
import { n as setWorkspaceRuntimeConfig, t as getWorkspaceRuntimeConfig } from "../config-CsgNNVAI.js";
|
|
9
9
|
// src/runtime/state.ts
|
|
10
10
|
async function invalidateWorkspaceStore(name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as createWorkspace } from "../workspace-
|
|
1
|
+
export { t as createWorkspace } from "../workspace-Cz-5Ne1c.js";
|
package/dist/runtime.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { n as setWorkspaceRuntimeConfig, t as getWorkspaceRuntimeConfig } from "./config-CsgNNVAI.js";
|
|
2
|
-
import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "./provider-
|
|
3
|
-
import { i as setWorkspaceDependencyRuntimeLoaders, n as createWorkspaceTools, r as getWorkspaceDependencyRuntimeLoaders, t as useWorkspace } from "./use-tools-
|
|
2
|
+
import { d as setWorkspaceHostedStoreLoader, u as getWorkspaceHostedStoreLoader } from "./provider-DZY1cLP5.js";
|
|
3
|
+
import { i as setWorkspaceDependencyRuntimeLoaders, n as createWorkspaceTools, r as getWorkspaceDependencyRuntimeLoaders, t as useWorkspace } from "./use-tools-NXEQt099.js";
|
|
4
4
|
import { invalidateWorkspaceStore, setWorkspaceRuntimeAssetsRegistry, setWorkspaceRuntimeRegistry } from "./runtime/state.js";
|
|
5
|
-
import { _ as isWorkspaceSourceRequestOnly, a as normalizeWorkspaceSources, b as markLiveWorkspaceSource, f as prepareWorkspaceSource, h as getWorkspaceSourceRequestDescriptor, i as normalizeWorkspaceSourceMetadata, l as workspaceSourceGrantPaths, o as normalizeWorkspaceSourcesMetadata, r as normalizeWorkspaceSource, t as copyWorkspaceSourceMetadata, u as ownSourceOption, v as workspaceSourceRequestDescriptorPath } from "./config
|
|
5
|
+
import { _ as isWorkspaceSourceRequestOnly, a as normalizeWorkspaceSources, b as markLiveWorkspaceSource, f as prepareWorkspaceSource, h as getWorkspaceSourceRequestDescriptor, i as normalizeWorkspaceSourceMetadata, l as workspaceSourceGrantPaths, o as normalizeWorkspaceSourcesMetadata, r as normalizeWorkspaceSource, t as copyWorkspaceSourceMetadata, u as ownSourceOption, v as workspaceSourceRequestDescriptorPath } from "./config-Bze7OyvB.js";
|
|
6
6
|
import { o as workspaceError } from "./internal/path.js";
|
|
7
7
|
import { l as normalizeWorkspacePath, u as readStoredFile } from "./path-DYHw5KNk.js";
|
|
8
8
|
import { a as createWorkspaceHistoryReader, c as forwardWorkspaceHistoryFiles, i as createWorkspaceHistory, l as forwardWorkspaceHistoryMerge } from "./utils-Bv1NBg8r.js";
|
|
9
9
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
10
10
|
import { r as registerWorkspacePlugin, t as createWorkspaceWritePolicy } from "./rules-DYQCKYdt.js";
|
|
11
|
-
import { _ as attachWorkspaceSourceRequestExecution, a as isInternalWorkspaceMetaKey, b as workspaceSourceRequestMatches, c as isWorkspaceSourceSyncMetaKey, g as copyWorkspacePath, h as appendWorkspaceFile, m as appendCondition, o as createWorkspaceSourceView, p as resolveWorkspacePath, r as resetWorkspaceStoreCache, v as createWorkspaceSourceRequestExecution, x as createBasicWorkspaceSession, y as getWorkspaceSourceRequestExecution } from "./workspace-
|
|
11
|
+
import { _ as attachWorkspaceSourceRequestExecution, a as isInternalWorkspaceMetaKey, b as workspaceSourceRequestMatches, c as isWorkspaceSourceSyncMetaKey, g as copyWorkspacePath, h as appendWorkspaceFile, m as appendCondition, o as createWorkspaceSourceView, p as resolveWorkspacePath, r as resetWorkspaceStoreCache, v as createWorkspaceSourceRequestExecution, x as createBasicWorkspaceSession, y as getWorkspaceSourceRequestExecution } from "./workspace-Cz-5Ne1c.js";
|
|
12
12
|
import { t as createMemoryWorkspaceStore } from "./memory-BCZl_ZsJ.js";
|
|
13
|
-
import { M as registerWorkspaceStoreAlias, a as resolveWorkspaceMetadataMutationTarget, i as forwardWorkspaceMetadataView, n as createWorkspaceMetadataTarget, o as resolveWorkspaceMetadataTarget, r as forwardWorkspaceMetadataTarget, s as setWorkspaceMetadata, t as attachWorkspaceMetadataTarget } from "./metadata-target-
|
|
13
|
+
import { M as registerWorkspaceStoreAlias, a as resolveWorkspaceMetadataMutationTarget, i as forwardWorkspaceMetadataView, n as createWorkspaceMetadataTarget, o as resolveWorkspaceMetadataTarget, r as forwardWorkspaceMetadataTarget, s as setWorkspaceMetadata, t as attachWorkspaceMetadataTarget } from "./metadata-target-mlHAv1p4.js";
|
|
14
14
|
import { a as provideWorkspaceStoreTarget, i as forwardWorkspaceStoreTarget, o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
|
|
15
15
|
import { n as getWorkspaceReplacement, r as prepareWorkspaceReplacement, t as attachWorkspaceReplacement } from "./replacement-CVZVsflC.js";
|
|
16
|
-
import {
|
|
17
|
-
import { i as resolveRegisteredWorkspaceDefinition, o as setWorkspaceRuntimeDefinitions, r as registerWorkspace } from "./registry-
|
|
18
|
-
import { r as useWorkspaceFiles } from "./use-
|
|
16
|
+
import { n as isRecord } from "./object-DNOrQSl5.js";
|
|
17
|
+
import { i as resolveRegisteredWorkspaceDefinition, o as setWorkspaceRuntimeDefinitions, r as registerWorkspace } from "./registry-OonxXCbd.js";
|
|
18
|
+
import { r as useWorkspaceFiles } from "./use-hLouCwGz.js";
|
|
19
19
|
import { join, resolve } from "node:path";
|
|
20
20
|
import { randomUUID } from "node:crypto";
|
|
21
21
|
import { lstat, readdir, rename, rm } from "node:fs/promises";
|
|
@@ -288,7 +288,7 @@ function createWritableFacadeStore(workspace, sourceSync) {
|
|
|
288
288
|
async function startOverlayWorkspaceSession(_definition, workspace, options) {
|
|
289
289
|
const host = options?.host;
|
|
290
290
|
if (host) {
|
|
291
|
-
const { createHostedWorkspaceSession } = await import("./host-
|
|
291
|
+
const { createHostedWorkspaceSession } = await import("./host-BT7EnmZf.js").then((n) => n.n);
|
|
292
292
|
return await createHostedWorkspaceSession(workspace, {
|
|
293
293
|
...options,
|
|
294
294
|
host
|
|
@@ -554,7 +554,7 @@ async function createWorkspaceSourceResolutionFacade(workspace, definition, opti
|
|
|
554
554
|
},
|
|
555
555
|
stat: writeFs.stat,
|
|
556
556
|
sync: async (options) => {
|
|
557
|
-
const { syncWorkspaceSources } = await import("./sync-
|
|
557
|
+
const { syncWorkspaceSources } = await import("./sync-DkpTCr9u.js");
|
|
558
558
|
return await syncWorkspaceSources(resolvedDefinition, syncStore, options);
|
|
559
559
|
},
|
|
560
560
|
writeFile: writeFs.writeFile
|
package/dist/server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { s as matchesAny } from "./path-DYHw5KNk.js";
|
|
2
2
|
import { normalizeSafeWorkspacePath } from "./internal/path.js";
|
|
3
3
|
import { i as workspaceDefinitionPlugins, n as resolveWorkspaceAutoCommit } from "./rules-DYQCKYdt.js";
|
|
4
|
-
import { r as useWorkspaceFiles } from "./use-
|
|
5
|
-
import { r as withWorkspaceProgress } from "./host-
|
|
4
|
+
import { r as useWorkspaceFiles } from "./use-hLouCwGz.js";
|
|
5
|
+
import { r as withWorkspaceProgress } from "./host-BT7EnmZf.js";
|
|
6
6
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
7
7
|
import { getViteHubErrorShape } from "@vite-hub/runtime";
|
|
8
8
|
import { lookup } from "mrmime";
|
|
@@ -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."
|
package/dist/source-metadata.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { m as readCurrentSourceSnapshot, o as resolveWorkspaceMetadataTarget } from "./metadata-target-
|
|
1
|
+
import { m as readCurrentSourceSnapshot, o as resolveWorkspaceMetadataTarget } from "./metadata-target-mlHAv1p4.js";
|
|
2
2
|
import { t as assertWorkspaceRules } from "./rule-keys-xMpiTLq1.js";
|
|
3
|
-
import { i as normalizeWorkspaceSourceMetadata, l as workspaceSourceGrantPaths, o as normalizeWorkspaceSourcesMetadata } from "./config
|
|
3
|
+
import { i as normalizeWorkspaceSourceMetadata, l as workspaceSourceGrantPaths, o as normalizeWorkspaceSourcesMetadata } from "./config-Bze7OyvB.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-Bze7OyvB.js";
|
|
4
|
+
import { C as withWorkspaceStoreMutation, E as normalizeSourceFileMetadata, S as sourceMountOwnsPath, T as normalizeMetadataValue, w as normalizeSourceItemPath, x as createWorkspaceSourceMountAuthority } from "./metadata-target-mlHAv1p4.js";
|
|
5
|
+
import { d as sourceSyncPathClaims, f as workspaceSourceSyncStateEquals, l as readWorkspaceSourceSyncState, u as sourceSyncMetaKey } from "./workspace-Cz-5Ne1c.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-OonxXCbd.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { n as useWorkspaceAssets } from "./asset-registry-DJyE42kr.js";
|
|
2
2
|
import { normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
|
|
3
3
|
import { f as normalizeHistoryRef, g as validateHistoryMessage, h as requireWorkspaceHistory, m as rejectHistoryHead, s as deleteWorkspaceHistoryRef, u as historyConflict } from "./utils-Bv1NBg8r.js";
|
|
4
|
-
import { _ as attachWorkspaceSourceRequestExecution, g as copyWorkspacePath, h as appendWorkspaceFile, i as assertPublicWorkspaceMetaKey, t as createWorkspace, y as getWorkspaceSourceRequestExecution } from "./workspace-
|
|
4
|
+
import { _ as attachWorkspaceSourceRequestExecution, g as copyWorkspacePath, h as appendWorkspaceFile, i as assertPublicWorkspaceMetaKey, t as createWorkspace, y as getWorkspaceSourceRequestExecution } from "./workspace-Cz-5Ne1c.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-OonxXCbd.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-
|
|
9
|
+
import { c as workspaceInternalMetadataCapability, o as resolveWorkspaceMetadataTarget, r as forwardWorkspaceMetadataTarget, t as attachWorkspaceMetadataTarget } from "./metadata-target-mlHAv1p4.js";
|
|
10
|
+
import { t as createHostedWorkspaceSession } from "./host-BT7EnmZf.js";
|
|
11
11
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
12
12
|
import { getViteHubErrorShape } from "@vite-hub/runtime";
|
|
13
13
|
// src/core/use.ts
|
|
@@ -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-
|
|
2
|
+
import { g as copyWorkspacePath, h as appendWorkspaceFile, y as getWorkspaceSourceRequestExecution } from "./workspace-Cz-5Ne1c.js";
|
|
3
3
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
4
|
-
import { n as createWorkspaceFileRuntime, t as createReadonlyFs } from "./use-
|
|
4
|
+
import { n as createWorkspaceFileRuntime, t as createReadonlyFs } from "./use-hLouCwGz.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";
|
package/dist/vite.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { n as __exportAll$1, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-DnNXxpGL.js";
|
|
2
2
|
import { C as resolve$1, S as relative$1, _ as requireViteHubDevServerUrl, a as createNativePackageLoading, b as dirname$1, c as generatedViteHubWatchIgnoredAddition, d as publishViteHubDevServer, f as resolveViteHubProjectRoot, g as readViteHubDevTargetOption, h as fetchViteHubDevEndpoint, l as isProductionBuild, m as discoverViteHubDevServer, o as createNoExternalAddition, p as shouldSkipViteProviderBuild, r as VITEHUB_PROJECT_ROOT, s as createViteHubEnvImportAliases, t as callOperationFromCli, u as isServerEnvironment, v as redactInspectionText, workspaceOperations, x as isAbsolute$1, y as relativeDefinitionFile } from "./operations.js";
|
|
3
3
|
import { t as internalErrorDiagnostics } from "./error-diagnostics-CsiNo_oI.js";
|
|
4
|
-
import { n as isRecordOrFunction, t as
|
|
4
|
+
import { n as isRecord, r as isRecordOrFunction, t as isObject } from "./object-DNOrQSl5.js";
|
|
5
5
|
import { ensureWorkspaceDevToken, readWorkspaceDevToken, refreshWorkspaceDevToken, runWorkspaceDevCommand, t as isViteHubSecretEqual, validateWorkspaceDevToken, workspaceDevHeader, workspaceDevRoute, workspaceDevTokenHeader, workspaceDevTokenServerId } from "./server.js";
|
|
6
|
-
import { n as syncWorkspaceDefinition } from "./lifecycle-
|
|
7
|
-
import { a as normalizeWorkspaceSources, n as createSourceContext } from "./config
|
|
6
|
+
import { n as syncWorkspaceDefinition } from "./lifecycle-B0ucHUum.js";
|
|
7
|
+
import { a as normalizeWorkspaceSources, n as createSourceContext } from "./config-Bze7OyvB.js";
|
|
8
8
|
import { normalizeSafeWorkspacePath } from "./internal/path.js";
|
|
9
9
|
import { t as createMemoryWorkspaceStore } from "./memory-BCZl_ZsJ.js";
|
|
10
10
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
11
11
|
import { assertNoSymlinks, checkoutFailure, conflictMarkerPatterns, folderOf, formatWorkspaceStatus, ignoredName, localCheckoutStatus, pullWorkspaces, pushWorkspaces, resolveWorkspaceConflicts, workspaceLockFile, workspaceStatus } from "./checkout.js";
|
|
12
|
-
import { n as isWorkspaceStore, r as normalizeWorkspaceStoreOptions } from "./provider-
|
|
13
|
-
import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-
|
|
12
|
+
import { n as isWorkspaceStore, r as normalizeWorkspaceStoreOptions } from "./provider-DZY1cLP5.js";
|
|
13
|
+
import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-OonxXCbd.js";
|
|
14
14
|
import { installHostedWorkspaceRuntime } from "./hosted.js";
|
|
15
15
|
import { installHostedVercelBlobWorkspaceRuntime } from "./hosted-vercel-blob.js";
|
|
16
16
|
import { createRequire, isBuiltin } from "node:module";
|
|
@@ -36,7 +36,7 @@ const workspaceConfigKeys = /* @__PURE__ */ new Set([
|
|
|
36
36
|
]);
|
|
37
37
|
function normalizeWorkspaceOptions(options, input = {}) {
|
|
38
38
|
if (options === false) return false;
|
|
39
|
-
if (typeof options !== "undefined" && !isRecord
|
|
39
|
+
if (typeof options !== "undefined" && !isRecord(options)) throw workspaceErrorDiagnostics.WORKSPACE_C0001({ message: "`workspace` must be a plain object." });
|
|
40
40
|
const resolvedOptions = options || {};
|
|
41
41
|
const unsupported = Object.keys(resolvedOptions).filter((key) => !workspaceConfigKeys.has(key));
|
|
42
42
|
if (unsupported.length) throw workspaceErrorDiagnostics.WORKSPACE_C0002({ message: `[vitehub] workspace config does not support option${unsupported.length === 1 ? "" : "s"}: ${unsupported.join(", ")}.` });
|
|
@@ -390,9 +390,9 @@ function isFileResolution(resolved) {
|
|
|
390
390
|
}
|
|
391
391
|
function collectPackageExportCandidates(packageName, exportsValue, packageRelativePath) {
|
|
392
392
|
if (typeof exportsValue === "string") return normalizePathSeparators(exportsValue).replace(/^\.\//, "") === packageRelativePath ? [packageName] : [];
|
|
393
|
-
if (!Array.isArray(exportsValue) && !isRecord
|
|
393
|
+
if (!Array.isArray(exportsValue) && !isRecord(exportsValue)) return [];
|
|
394
394
|
const candidates = [];
|
|
395
|
-
const exportEntries = isRecord
|
|
395
|
+
const exportEntries = isRecord(exportsValue) && Object.keys(exportsValue).some((exportKey) => exportKey.startsWith(".")) ? Object.entries(exportsValue) : [[".", exportsValue]];
|
|
396
396
|
for (const [exportKey, target] of exportEntries) {
|
|
397
397
|
const targets = [target];
|
|
398
398
|
while (targets.length) {
|
|
@@ -409,7 +409,7 @@ function collectPackageExportCandidates(packageName, exportsValue, packageRelati
|
|
|
409
409
|
if (wildcard === void 0) continue;
|
|
410
410
|
candidates.push(`${packageName}${exportKey.slice(1).replace("*", wildcard)}`);
|
|
411
411
|
} else if (Array.isArray(value)) targets.push(...value);
|
|
412
|
-
else if (isRecord
|
|
412
|
+
else if (isRecord(value)) targets.push(...Object.values(value));
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
return candidates;
|
|
@@ -515,7 +515,7 @@ function createResolvedAliasPlugin(aliases, aliasResolveDir, workingDir, resolve
|
|
|
515
515
|
else if (resolutionScope) {
|
|
516
516
|
const packageRelativePath = normalizedSpecifier.slice(resolutionScope.length);
|
|
517
517
|
const parsedPackageJson = JSON.parse(await readFile(resolve(resolutionScope, "package.json"), "utf8"));
|
|
518
|
-
if (!isRecord
|
|
518
|
+
if (!isRecord(parsedPackageJson)) return;
|
|
519
519
|
const packageJson = parsedPackageJson;
|
|
520
520
|
if (packageJson.exports === void 0 && !alias.prefix) {
|
|
521
521
|
const resolvedCandidate = await resolveWithContext(alias.specifier);
|
|
@@ -1138,6 +1138,132 @@ async function copyRuntimePackageFiles(packageDir, targetDir) {
|
|
|
1138
1138
|
await unlessGone(() => copyFile(join(packageDir, path), target));
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
|
+
// ../internal/src/source-files.ts
|
|
1142
|
+
const ignoredDirs = /* @__PURE__ */ new Set([
|
|
1143
|
+
"node_modules",
|
|
1144
|
+
"dist",
|
|
1145
|
+
".output",
|
|
1146
|
+
".nuxt",
|
|
1147
|
+
".vercel",
|
|
1148
|
+
".git",
|
|
1149
|
+
".vitehub"
|
|
1150
|
+
]);
|
|
1151
|
+
const racyWindowNs = 2000000000n;
|
|
1152
|
+
const storeKey = Symbol.for("vite-hub.source-files.v1");
|
|
1153
|
+
function store() {
|
|
1154
|
+
const existing = Reflect.get(globalThis, storeKey);
|
|
1155
|
+
if (isStore(existing)) return existing;
|
|
1156
|
+
const created = {
|
|
1157
|
+
derived: /* @__PURE__ */ new Map(),
|
|
1158
|
+
texts: /* @__PURE__ */ new Map(),
|
|
1159
|
+
trees: /* @__PURE__ */ new Map()
|
|
1160
|
+
};
|
|
1161
|
+
Reflect.set(globalThis, storeKey, created);
|
|
1162
|
+
return created;
|
|
1163
|
+
}
|
|
1164
|
+
function isStore(value) {
|
|
1165
|
+
return typeof value === "object" && value !== null && "texts" in value && "trees" in value && "derived" in value;
|
|
1166
|
+
}
|
|
1167
|
+
function errorCode(error) {
|
|
1168
|
+
return typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
1169
|
+
}
|
|
1170
|
+
function statOrMissing(path) {
|
|
1171
|
+
try {
|
|
1172
|
+
return statSync(path, { bigint: true });
|
|
1173
|
+
} catch (error) {
|
|
1174
|
+
if (errorCode(error) === "ENOENT" || errorCode(error) === "ENOTDIR") return;
|
|
1175
|
+
throw error;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
function signature(stats) {
|
|
1179
|
+
return `${stats.ino}:${stats.size}:${stats.mtimeNs}:${stats.ctimeNs}`;
|
|
1180
|
+
}
|
|
1181
|
+
function isSettled(stats) {
|
|
1182
|
+
const changed = stats.mtimeNs > stats.ctimeNs ? stats.mtimeNs : stats.ctimeNs;
|
|
1183
|
+
return BigInt(Date.now()) * 1000000n - changed > racyWindowNs;
|
|
1184
|
+
}
|
|
1185
|
+
function readDirEntries(root) {
|
|
1186
|
+
try {
|
|
1187
|
+
return readdirSync(root, { withFileTypes: true });
|
|
1188
|
+
} catch (error) {
|
|
1189
|
+
if (errorCode(error) === "ENOENT") return [];
|
|
1190
|
+
throw error;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
function walkTree(root, directories, files, nested = false) {
|
|
1194
|
+
const before = statOrMissing(root);
|
|
1195
|
+
let trusted = before !== void 0 && isSettled(before);
|
|
1196
|
+
if (before) directories.set(root, signature(before));
|
|
1197
|
+
if (nested && existsSync(resolve$1(root, ".git"))) return trusted;
|
|
1198
|
+
for (const entry of readDirEntries(root)) {
|
|
1199
|
+
const path = resolve$1(root, entry.name);
|
|
1200
|
+
if (entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
1201
|
+
if (entry.name.startsWith(".") || ignoredDirs.has(entry.name)) continue;
|
|
1202
|
+
if (!walkTree(path, directories, files, true)) trusted = false;
|
|
1203
|
+
continue;
|
|
1204
|
+
}
|
|
1205
|
+
if (entry.isFile()) files.push({
|
|
1206
|
+
hidden: entry.name.startsWith("."),
|
|
1207
|
+
name: entry.name,
|
|
1208
|
+
path
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
return trusted;
|
|
1212
|
+
}
|
|
1213
|
+
function isCurrent(tree) {
|
|
1214
|
+
for (const [directory, stored] of tree.directories) {
|
|
1215
|
+
const stats = statOrMissing(directory);
|
|
1216
|
+
if (!stats || signature(stats) !== stored) return false;
|
|
1217
|
+
}
|
|
1218
|
+
return true;
|
|
1219
|
+
}
|
|
1220
|
+
function sourceTree(root) {
|
|
1221
|
+
const trees = store().trees;
|
|
1222
|
+
const cached = trees.get(root);
|
|
1223
|
+
if (cached && isCurrent(cached)) return cached;
|
|
1224
|
+
const directories = /* @__PURE__ */ new Map();
|
|
1225
|
+
const files = [];
|
|
1226
|
+
const trusted = walkTree(root, directories, files);
|
|
1227
|
+
files.sort((left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0);
|
|
1228
|
+
const tree = {
|
|
1229
|
+
directories,
|
|
1230
|
+
files
|
|
1231
|
+
};
|
|
1232
|
+
if (trusted) trees.set(root, tree);
|
|
1233
|
+
else trees.delete(root);
|
|
1234
|
+
return tree;
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* The files below `root` whose name matches `predicate`, sorted by path. The walk skips hidden folders, Git
|
|
1238
|
+
* repositories, and build output folders such as `node_modules`, `dist`, and `.vitehub`. Hidden files need
|
|
1239
|
+
* `includeHidden`. Symbolic links are skipped.
|
|
1240
|
+
*/
|
|
1241
|
+
function listSourceTreeFiles(root, predicate, options = {}) {
|
|
1242
|
+
const files = [];
|
|
1243
|
+
for (const file of sourceTree(resolve$1(root)).files) {
|
|
1244
|
+
if (file.hidden && !options.includeHidden) continue;
|
|
1245
|
+
if (predicate(file.name)) files.push(file.path);
|
|
1246
|
+
}
|
|
1247
|
+
return files;
|
|
1248
|
+
}
|
|
1249
|
+
/** The UTF-8 text of a source file. A file that did not change since the last read is not read again. */
|
|
1250
|
+
function readSourceText(file) {
|
|
1251
|
+
const path = resolve$1(file);
|
|
1252
|
+
const texts = store().texts;
|
|
1253
|
+
const stats = statOrMissing(path);
|
|
1254
|
+
if (!stats) return readFileSync(path, "utf8");
|
|
1255
|
+
const current = signature(stats);
|
|
1256
|
+
const cached = texts.get(path);
|
|
1257
|
+
if (cached?.trusted && cached.signature === current) return cached.text;
|
|
1258
|
+
const read = readFileSync(path, "utf8");
|
|
1259
|
+
const text = cached?.text === read ? cached.text : read;
|
|
1260
|
+
texts.set(path, {
|
|
1261
|
+
signature: current,
|
|
1262
|
+
text,
|
|
1263
|
+
trusted: isSettled(stats)
|
|
1264
|
+
});
|
|
1265
|
+
return text;
|
|
1266
|
+
}
|
|
1141
1267
|
// ../internal/src/build/provider-output-sources.ts
|
|
1142
1268
|
const keptFailedProviderOutputArtifactDirs = /* @__PURE__ */ new Set();
|
|
1143
1269
|
function failureText(failure) {
|
|
@@ -2735,15 +2861,6 @@ async function finalizeProviderDeploymentOutputs(catalog, options = {}) {
|
|
|
2735
2861
|
const sourceFilePattern = /\.(?:c|m)?[jt]sx?$/i;
|
|
2736
2862
|
const declarationFilePattern = /\.d\.(?:c|m)?[jt]sx?$/i;
|
|
2737
2863
|
const testFilePattern = /\.(?:test|spec)\.(?:c|m)?[jt]sx?$/i;
|
|
2738
|
-
const ignoredDirs = /* @__PURE__ */ new Set([
|
|
2739
|
-
"node_modules",
|
|
2740
|
-
"dist",
|
|
2741
|
-
".output",
|
|
2742
|
-
".nuxt",
|
|
2743
|
-
".vercel",
|
|
2744
|
-
".git",
|
|
2745
|
-
".vitehub"
|
|
2746
|
-
]);
|
|
2747
2864
|
function createDirectoryDefinitionSource(source, scanDirs, subdir, options = {}) {
|
|
2748
2865
|
return {
|
|
2749
2866
|
...options,
|
|
@@ -2763,32 +2880,8 @@ function createSuffixDefinitionSource(source, roots, pattern, normalizeName, opt
|
|
|
2763
2880
|
source
|
|
2764
2881
|
};
|
|
2765
2882
|
}
|
|
2766
|
-
function readDirEntries(root) {
|
|
2767
|
-
try {
|
|
2768
|
-
return readdirSync(root, { withFileTypes: true });
|
|
2769
|
-
} catch (error) {
|
|
2770
|
-
if (error.code === "ENOENT") return [];
|
|
2771
|
-
throw error;
|
|
2772
|
-
}
|
|
2773
|
-
}
|
|
2774
|
-
function isGitRepositoryDirectory(directory) {
|
|
2775
|
-
return existsSync(resolve$1(directory, ".git"));
|
|
2776
|
-
}
|
|
2777
2883
|
function listMatchingFiles(root, predicate, options = {}) {
|
|
2778
|
-
|
|
2779
|
-
for (const entry of readDirEntries(root)) {
|
|
2780
|
-
const absolute = resolve$1(root, entry.name);
|
|
2781
|
-
if (entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
2782
|
-
if (isGitRepositoryDirectory(absolute)) continue;
|
|
2783
|
-
if (entry.name.startsWith(".")) continue;
|
|
2784
|
-
if (ignoredDirs.has(entry.name)) continue;
|
|
2785
|
-
files.push(...listMatchingFiles(absolute, predicate, options));
|
|
2786
|
-
continue;
|
|
2787
|
-
}
|
|
2788
|
-
if (entry.name.startsWith(".") && !options.includeHidden) continue;
|
|
2789
|
-
if (entry.isFile() && predicate(entry.name)) files.push(absolute);
|
|
2790
|
-
}
|
|
2791
|
-
return files.sort();
|
|
2884
|
+
return listSourceTreeFiles(root, predicate, options);
|
|
2792
2885
|
}
|
|
2793
2886
|
/** A module that a Definitions folder can hold: JavaScript or TypeScript, and not a declaration, test, or spec file. */
|
|
2794
2887
|
function isDefinitionSourceFile(name) {
|
|
@@ -19207,7 +19300,7 @@ async function flattenPlugins(value, plugins, seen) {
|
|
|
19207
19300
|
for (const item of value) await flattenPlugins(item, plugins, seen);
|
|
19208
19301
|
return;
|
|
19209
19302
|
}
|
|
19210
|
-
if (!isRecord
|
|
19303
|
+
if (!isRecord(value) || seen.has(value)) return;
|
|
19211
19304
|
seen.add(value);
|
|
19212
19305
|
if (isThenable(value)) {
|
|
19213
19306
|
await flattenPlugins(await value, plugins, seen);
|
|
@@ -19239,7 +19332,7 @@ async function collectContributions(plugins, options) {
|
|
|
19239
19332
|
for (const plugin of candidates) {
|
|
19240
19333
|
if (!Object.hasOwn(plugin, "vitehub")) continue;
|
|
19241
19334
|
const metadata = Reflect.get(plugin, "vitehub");
|
|
19242
|
-
if (!isRecord
|
|
19335
|
+
if (!isRecord(metadata) || !Object.hasOwn(metadata, options.key)) continue;
|
|
19243
19336
|
const source = metadata[options.key];
|
|
19244
19337
|
const pluginName = Reflect.get(plugin, "name");
|
|
19245
19338
|
const contributor = isNonEmptyString(pluginName) ? pluginName : unnamedPlugin;
|
|
@@ -19267,12 +19360,12 @@ async function collectContributions(plugins, options) {
|
|
|
19267
19360
|
return [...collected.values()].map(({ contribution }) => contribution).sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
19268
19361
|
}
|
|
19269
19362
|
function readContribution(entry, plugin, options, fail) {
|
|
19270
|
-
if (!isRecord
|
|
19363
|
+
if (!isRecord(entry)) return fail("expected { name, definition: { module, export? }, reason? }.");
|
|
19271
19364
|
const { definition, name, reason } = entry;
|
|
19272
19365
|
if (!isNonEmptyString(name) || name.trim() !== name) return fail("`name` must be a non-empty string without surrounding whitespace.");
|
|
19273
19366
|
const nameProblem = options.checkName?.(name);
|
|
19274
19367
|
if (nameProblem) return fail(`${options.kind} ${JSON.stringify(name)}: ${nameProblem}`);
|
|
19275
|
-
if (!isRecord
|
|
19368
|
+
if (!isRecord(definition)) return fail(`${options.kind} ${JSON.stringify(name)} needs \`definition: { module, export? }\`.`);
|
|
19276
19369
|
if (!isNonEmptyString(definition.module)) return fail(`\`definition.module\` of ${options.kind} ${JSON.stringify(name)} must be a non-empty string.`);
|
|
19277
19370
|
let module;
|
|
19278
19371
|
try {
|
|
@@ -19341,10 +19434,10 @@ function stripComments(source) {
|
|
|
19341
19434
|
return source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1");
|
|
19342
19435
|
}
|
|
19343
19436
|
function isAgentConfig(file) {
|
|
19344
|
-
return /\bdefineAgent\s*\(/.test(stripComments(
|
|
19437
|
+
return /\bdefineAgent\s*\(/.test(stripComments(readSourceText(file)));
|
|
19345
19438
|
}
|
|
19346
19439
|
function isWorkspaceAgentDefinition(file) {
|
|
19347
|
-
return /\bdefineAgent\s*\(\s*\{[\s\S]*?\bworkspace\s*:/.test(stripComments(
|
|
19440
|
+
return /\bdefineAgent\s*\(\s*\{[\s\S]*?\bworkspace\s*:/.test(stripComments(readSourceText(file)));
|
|
19348
19441
|
}
|
|
19349
19442
|
function collectDirectoriesWithConfig(root) {
|
|
19350
19443
|
const directories = /* @__PURE__ */ new Set();
|
|
@@ -20539,7 +20632,7 @@ async function readWorkspaceDiscovery(parsed, context, fetchImpl) {
|
|
|
20539
20632
|
});
|
|
20540
20633
|
if (!server) return;
|
|
20541
20634
|
const { discovery, url } = server;
|
|
20542
|
-
if (!(Array.isArray(discovery.workspaces) ? discovery.workspaces.flatMap((workspace) => isRecord
|
|
20635
|
+
if (!(Array.isArray(discovery.workspaces) ? discovery.workspaces.flatMap((workspace) => isRecord(workspace) && typeof workspace.name === "string" ? [workspace.name] : []) : []).includes(parsed.workspace)) {
|
|
20543
20636
|
context.stderr.write(`Unknown Workspace Dev target: ${parsed.workspace}\n`);
|
|
20544
20637
|
return;
|
|
20545
20638
|
}
|
|
@@ -20828,10 +20921,10 @@ function vercelFunctionRuntimePackages() {
|
|
|
20828
20921
|
}];
|
|
20829
20922
|
}
|
|
20830
20923
|
function hasCloudflareArtifactBinding(value) {
|
|
20831
|
-
return
|
|
20924
|
+
return isObject(value) && typeof value.binding === "string";
|
|
20832
20925
|
}
|
|
20833
20926
|
function configuredCloudflareArtifacts(wranglerConfig) {
|
|
20834
|
-
if (!
|
|
20927
|
+
if (!isObject(wranglerConfig) || !Array.isArray(wranglerConfig.artifacts)) return [];
|
|
20835
20928
|
return wranglerConfig.artifacts.filter(hasCloudflareArtifactBinding);
|
|
20836
20929
|
}
|
|
20837
20930
|
function createCloudflareArtifactsWranglerConfig(configs) {
|
|
@@ -21034,11 +21127,8 @@ async function collectPluginWorkspaceContributions(plugins, roots, serverDirs) {
|
|
|
21034
21127
|
serverDirs
|
|
21035
21128
|
});
|
|
21036
21129
|
}
|
|
21037
|
-
function isRecord(value) {
|
|
21038
|
-
return typeof value === "object" && value !== null;
|
|
21039
|
-
}
|
|
21040
21130
|
function isWorkspaceRegistry(value) {
|
|
21041
|
-
return
|
|
21131
|
+
return isObject(value) && Object.values(value).every((item) => typeof item === "function");
|
|
21042
21132
|
}
|
|
21043
21133
|
function workspaceDefinitionLoaderAliases(aliases) {
|
|
21044
21134
|
if (!Array.isArray(aliases)) return aliases;
|
|
@@ -21155,7 +21245,7 @@ async function handleWorkspaceDevRequest(server, req, workspaces, tokenOptions,
|
|
|
21155
21245
|
} catch {
|
|
21156
21246
|
return new Response("Malformed Workspace Dev payload.", { status: 400 });
|
|
21157
21247
|
}
|
|
21158
|
-
const command =
|
|
21248
|
+
const command = isObject(body) && isObject(body.workspaceCommand) ? body.workspaceCommand : void 0;
|
|
21159
21249
|
if (!command || typeof command.workspace !== "string" || typeof command.command !== "string") return new Response("Missing Workspace Dev command.", { status: 400 });
|
|
21160
21250
|
if (!await validateWorkspaceDevToken(server.config.root, req.headers, tokenOptions)) return new Response("Forbidden Workspace Dev token.", { status: 403 });
|
|
21161
21251
|
const mod = await server.ssrLoadModule(WORKSPACE_REGISTRY_ID);
|
|
@@ -21178,7 +21268,7 @@ async function handleWorkspaceDevRequest(server, req, workspaces, tokenOptions,
|
|
|
21178
21268
|
...args ? { args } : {},
|
|
21179
21269
|
command: command.command,
|
|
21180
21270
|
host,
|
|
21181
|
-
...
|
|
21271
|
+
...isObject(definition) ? { definition: normalizeWorkspaceDefinition(command.workspace, definition) } : {},
|
|
21182
21272
|
...paths?.length ? { paths } : {},
|
|
21183
21273
|
...timeout ? { timeout } : {},
|
|
21184
21274
|
workspace: command.workspace
|
|
@@ -21192,7 +21282,7 @@ async function handleWorkspaceDevRequest(server, req, workspaces, tokenOptions,
|
|
|
21192
21282
|
}
|
|
21193
21283
|
function hasNitroPlugin(value) {
|
|
21194
21284
|
if (Array.isArray(value)) return value.some(hasNitroPlugin);
|
|
21195
|
-
return
|
|
21285
|
+
return isObject(value) && typeof value.name === "string" && value.name.startsWith("nitro:");
|
|
21196
21286
|
}
|
|
21197
21287
|
function hasNitroConfig(config) {
|
|
21198
21288
|
return "nitro" in config || hasNitroPlugin(config.plugins);
|
|
@@ -21204,7 +21294,7 @@ function shouldInstallNitroWorkspacePlugin(config, options, normalized, definiti
|
|
|
21204
21294
|
return isHostedWorkspaceStore(normalized.store) || hasExplicitWorkspaceRuntimeOptions(options) || hasNitroConfig(config) && definitions.length > 0;
|
|
21205
21295
|
}
|
|
21206
21296
|
function mergeNitroWorkspaceConfig(value, root, dev) {
|
|
21207
|
-
const kit = createNitroServerKit(
|
|
21297
|
+
const kit = createNitroServerKit(isObject(value) ? { ...value } : {});
|
|
21208
21298
|
const pluginFile = resolve(root, generatedNitroWorkspacePlugin);
|
|
21209
21299
|
kit.addPlugin(pluginFile, dev ? "start" : "end");
|
|
21210
21300
|
if (!dev) {
|
|
@@ -21249,7 +21339,7 @@ function configureCloudflareNitroRuntime(nitro) {
|
|
|
21249
21339
|
nitro.cloudflare ??= {};
|
|
21250
21340
|
nitro.cloudflare.wrangler ??= {};
|
|
21251
21341
|
nitro.cloudflare.nodeCompat = true;
|
|
21252
|
-
const rollupConfig =
|
|
21342
|
+
const rollupConfig = isObject(nitro.rollupConfig) ? { ...nitro.rollupConfig } : {};
|
|
21253
21343
|
nitro.rollupConfig = {
|
|
21254
21344
|
...rollupConfig,
|
|
21255
21345
|
external: mergeNitroExternal(rollupConfig.external, "cloudflare:workers")
|
|
@@ -21270,7 +21360,7 @@ function renderRuntimeValue(value, depth = 0) {
|
|
|
21270
21360
|
const closingIndent = " ".repeat(depth);
|
|
21271
21361
|
return `[\n${value.map((item) => `${indent}${renderRuntimeValue(item, depth + 1)}`).join(",\n")}\n${closingIndent}]`;
|
|
21272
21362
|
}
|
|
21273
|
-
if (
|
|
21363
|
+
if (isObject(value)) {
|
|
21274
21364
|
const entries = Object.entries(value).filter(([, entry]) => entry !== void 0);
|
|
21275
21365
|
if (!entries.length) return "{}";
|
|
21276
21366
|
const indent = " ".repeat(depth + 1);
|
|
@@ -2,7 +2,7 @@ import { l as workspaceSourceReadOnlyError, n as isWorkspaceConflict, normalizeS
|
|
|
2
2
|
import { a as isExcludedWorkspacePath, f as sha256, i as decodeFile, l as normalizeWorkspacePath, n as contentStreamToBytes, r as contentToBytes, s as matchesAny, u as readStoredFile } from "./path-DYHw5KNk.js";
|
|
3
3
|
import { t as searchText } from "./search-CG6UNOtn.js";
|
|
4
4
|
import { t as createMemoryWorkspaceStore } from "./memory-BCZl_ZsJ.js";
|
|
5
|
-
import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, g as getWorkspaceSourceRequestExecutor, n as createSourceContext, s as sourceMountContainsPath, v as workspaceSourceRequestDescriptorPath, y as requestJsonEqual } from "./config
|
|
5
|
+
import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, g as getWorkspaceSourceRequestExecutor, n as createSourceContext, s as sourceMountContainsPath, v as workspaceSourceRequestDescriptorPath, y as requestJsonEqual } from "./config-Bze7OyvB.js";
|
|
6
6
|
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
7
7
|
import { f as normalizeHistoryRef, i as createWorkspaceHistory, m as rejectHistoryHead, u as historyConflict } from "./utils-Bv1NBg8r.js";
|
|
8
8
|
import { t as assertPublicFileMetadata } from "./file-metadata-Dqpldj0h.js";
|
|
@@ -10,8 +10,8 @@ import { t as createWorkspaceGlobMatcher } from "./glob-BIg9O4yY.js";
|
|
|
10
10
|
import { t as createWorkspaceWritePolicy } from "./rules-DYQCKYdt.js";
|
|
11
11
|
import { i as forwardWorkspaceStoreTarget, o as resolveWorkspaceStoreTarget, t as forwardWorkspaceRevisionMaterializer } from "./vitehub-grants-Co713QTg.js";
|
|
12
12
|
import { i as replaceStorePath, n as getWorkspaceReplacement, o as requireWorkspaceReplacement, r as prepareWorkspaceReplacement, t as attachWorkspaceReplacement } from "./replacement-CVZVsflC.js";
|
|
13
|
-
import { C as withWorkspaceStoreMutation, D as readWorkspaceFileOwner, _ as reconcileRemovedStartupSources, b as statVirtualSourcePath, c as workspaceInternalMetadataCapability, f as materializeWorkspaceSources, g as readSourceSnapshotPaths, h as readResolvedSourceFile, l as hasCurrentSourceSnapshot, m as readCurrentSourceSnapshot, n as createWorkspaceMetadataTarget, p as materializesCompleteSource, t as attachWorkspaceMetadataTarget, u as hasFreshSourceSnapshot, v as searchMaterializedStore } from "./metadata-target-
|
|
14
|
-
import { t as createWorkspaceStoreFromProvider } from "./provider-
|
|
13
|
+
import { C as withWorkspaceStoreMutation, D as readWorkspaceFileOwner, _ as reconcileRemovedStartupSources, b as statVirtualSourcePath, c as workspaceInternalMetadataCapability, f as materializeWorkspaceSources, g as readSourceSnapshotPaths, h as readResolvedSourceFile, l as hasCurrentSourceSnapshot, m as readCurrentSourceSnapshot, n as createWorkspaceMetadataTarget, p as materializesCompleteSource, t as attachWorkspaceMetadataTarget, u as hasFreshSourceSnapshot, v as searchMaterializedStore } from "./metadata-target-mlHAv1p4.js";
|
|
14
|
+
import { t as createWorkspaceStoreFromProvider } from "./provider-DZY1cLP5.js";
|
|
15
15
|
import { n as trackStagedWrites } from "./request-scope-jH4H0Sbm.js";
|
|
16
16
|
import { noExecutionAuthority } from "@vite-hub/runtime";
|
|
17
17
|
import { posix } from "node:path";
|
|
@@ -1520,7 +1520,7 @@ function createWorkspace(definition, options = {}) {
|
|
|
1520
1520
|
};
|
|
1521
1521
|
},
|
|
1522
1522
|
async sync(options) {
|
|
1523
|
-
const { syncWorkspaceSources } = await import("./sync-
|
|
1523
|
+
const { syncWorkspaceSources } = await import("./sync-DkpTCr9u.js");
|
|
1524
1524
|
return await syncWorkspaceSources(definition, store, options);
|
|
1525
1525
|
},
|
|
1526
1526
|
async materializeSources(options) {
|
|
@@ -1575,7 +1575,7 @@ function createWorkspace(definition, options = {}) {
|
|
|
1575
1575
|
async startSession(options) {
|
|
1576
1576
|
const host = options?.host;
|
|
1577
1577
|
if (host) {
|
|
1578
|
-
const { createHostedWorkspaceSession } = await import("./host-
|
|
1578
|
+
const { createHostedWorkspaceSession } = await import("./host-BT7EnmZf.js").then((n) => n.n);
|
|
1579
1579
|
return await createHostedWorkspaceSession(workspace, {
|
|
1580
1580
|
...options,
|
|
1581
1581
|
host
|
|
@@ -1591,7 +1591,7 @@ function createWorkspace(definition, options = {}) {
|
|
|
1591
1591
|
const synchronizedWorkspace = workspace;
|
|
1592
1592
|
synchronizedWorkspace.__workspaceDefinitionSyncKey = definition;
|
|
1593
1593
|
synchronizedWorkspace.__syncWorkspaceDefinition = async (abortSignal) => {
|
|
1594
|
-
const { syncWorkspaceDefinition } = await import("./lifecycle-
|
|
1594
|
+
const { syncWorkspaceDefinition } = await import("./lifecycle-B0ucHUum.js").then((n) => n.t);
|
|
1595
1595
|
await syncWorkspaceDefinition(definition, store, abortSignal);
|
|
1596
1596
|
};
|
|
1597
1597
|
return attachWorkspaceSourceRequestExecution(workspace, createWorkspaceSourceRequestExecution(definition));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Agent-oriented filesystem state and Vite integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -150,8 +150,8 @@
|
|
|
150
150
|
"dependencies": {
|
|
151
151
|
"@valibot/to-json-schema": "^1.8.0",
|
|
152
152
|
"@vercel/nft": "^1.11.12",
|
|
153
|
-
"@vite-hub/runtime": "0.
|
|
154
|
-
"@vite-hub/source": "0.
|
|
153
|
+
"@vite-hub/runtime": "0.8.0",
|
|
154
|
+
"@vite-hub/source": "0.8.0",
|
|
155
155
|
"birpc": "^4.2.0",
|
|
156
156
|
"defu": "^6.1.7",
|
|
157
157
|
"exsolve": "^1.2.0",
|
|
@@ -162,18 +162,18 @@
|
|
|
162
162
|
"nostics": "1.4.0",
|
|
163
163
|
"valibot": "^1.5.0",
|
|
164
164
|
"yaml": "^2.9.1",
|
|
165
|
-
"@vite-hub/markdown-template": "0.
|
|
166
|
-
"@vite-hub/blob": "0.
|
|
167
|
-
"@vite-hub/database": "0.
|
|
168
|
-
"@vite-hub/sandbox": "0.
|
|
165
|
+
"@vite-hub/markdown-template": "0.8.0",
|
|
166
|
+
"@vite-hub/blob": "0.8.0",
|
|
167
|
+
"@vite-hub/database": "0.8.0",
|
|
168
|
+
"@vite-hub/sandbox": "0.8.0"
|
|
169
169
|
},
|
|
170
170
|
"devDependencies": {
|
|
171
171
|
"@types/node": "^24.19.2",
|
|
172
172
|
"@vercel/blob": "^2.9.0",
|
|
173
|
-
"@vite-hub/env": "0.
|
|
174
|
-
"@vite-hub/forge": "0.
|
|
173
|
+
"@vite-hub/env": "0.8.0",
|
|
174
|
+
"@vite-hub/forge": "0.8.0",
|
|
175
175
|
"@vite-hub/internal": "0.0.1",
|
|
176
|
-
"@vite-hub/shell": "0.
|
|
176
|
+
"@vite-hub/shell": "0.8.0",
|
|
177
177
|
"ai": "7.0.179",
|
|
178
178
|
"esbuild": "^0.28.2",
|
|
179
179
|
"publint": "^0.3.25",
|
|
@@ -186,11 +186,11 @@
|
|
|
186
186
|
"@libsql/client": "^0.18.0"
|
|
187
187
|
},
|
|
188
188
|
"peerDependencies": {
|
|
189
|
-
"@vite-hub/shell": "0.
|
|
189
|
+
"@vite-hub/shell": "0.8.0",
|
|
190
190
|
"ai": "^6.0.0 || ^7.0.0-0",
|
|
191
191
|
"vite": ">=8.0.0",
|
|
192
192
|
"drizzle-orm": "1.0.0-rc.5 || 1.0.0-rc.6 || ^1.0.0",
|
|
193
|
-
"@vite-hub/forge": "0.
|
|
193
|
+
"@vite-hub/forge": "0.8.0"
|
|
194
194
|
},
|
|
195
195
|
"peerDependenciesMeta": {
|
|
196
196
|
"@vite-hub/shell": {
|