@vite-hub/workspace 0.6.1 → 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 +6 -6
- package/dist/{asset-registry-0CdRAjIV.js → asset-registry-DJyE42kr.js} +1 -1
- package/dist/blob-database.d.ts +1 -1
- package/dist/blob-database.js +6 -6
- package/dist/checkout.js +2 -2
- package/dist/cloudflare.d.ts +1 -1
- package/dist/cloudflare.js +1 -1
- package/dist/{config-jo5QgE1w.js → config-Bze7OyvB.js} +15 -10
- package/dist/{config-DeA287c0.d.ts → config-DF6sqKXB.d.ts} +1 -1
- package/dist/durability.d.ts +1 -1
- package/dist/durability.js +2 -2
- package/dist/{error-diagnostics-B4me-ouV.js → error-diagnostics-CHgE8TQM.js} +16 -0
- package/dist/{error-diagnostics-kKXseq8d.js → error-diagnostics-CsiNo_oI.js} +3 -3
- package/dist/{file-BrNAXQgY.js → file-DIBPXqbk.js} +1 -1
- package/dist/{file-metadata-Bpsvjw_X.js → file-metadata-Dqpldj0h.js} +7 -2
- package/dist/{files--z2dLC5z.js → files-DAJyo7TU.js} +2 -2
- package/dist/files.d.ts +5 -5
- package/dist/files.js +5 -5
- package/dist/{github-k--_LCrX.js → github-DcrnEGNN.js} +4 -4
- package/dist/{glob-BreFjNAV.js → glob-BIg9O4yY.js} +2 -2
- package/dist/{glob-BEutagp1.js → glob-YVshR7WP.js} +1 -1
- package/dist/{host-C8yZizfk.js → host-BT7EnmZf.js} +7 -7
- package/dist/hosted-vercel-blob.d.ts +1 -1
- package/dist/hosted-vercel-blob.js +464 -1
- package/dist/hosted.d.ts +1 -1
- package/dist/hosted.js +917 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.js +13 -13
- package/dist/internal/path.js +108 -1
- package/dist/internal/workspace.d.ts +2 -3
- package/dist/internal/workspace.js +2 -2
- package/dist/{lifecycle-IReZfi0b.js → lifecycle-B0ucHUum.js} +8 -8
- package/dist/loader.d.ts +1 -1
- package/dist/loader.js +2 -2
- package/dist/{mcp-resources-DeJnbOaw.js → mcp-resources-BDL0llKW.js} +2 -2
- package/dist/{memory-BlSRrBH1.js → memory-BCZl_ZsJ.js} +26 -4
- package/dist/{metadata-target-CaGLY4ay.js → metadata-target-mlHAv1p4.js} +59 -24
- package/dist/{object-CAK6UYR5.js → object-DNOrQSl5.js} +5 -1
- package/dist/{operation-definition-CqZkx1Rm.d.ts → operations-BALFFdKj.d.ts} +1 -0
- package/dist/{operations-BIaK_uYG.js → operations-D3mZArDi.js} +8 -7
- package/dist/operations.d.ts +2 -2
- package/dist/operations.js +1341 -2
- package/dist/{path-Bb9OIc_F.js → path-DYHw5KNk.js} +11 -3
- package/dist/plugins-BYxsPDBH.d.ts +12 -0
- package/dist/{provider-CN14ewvx.js → provider-DZY1cLP5.js} +281 -87
- package/dist/providers/github/store.d.ts +1 -1
- package/dist/providers/github/store.js +1994 -1
- package/dist/{registry-BbUg9vJB.js → registry-OonxXCbd.js} +3 -3
- package/dist/{registry-B0g19sdy.d.ts → registry-h1-cT-cE.d.ts} +1 -1
- package/dist/{registry-s2Ob9PeX.d.ts → registry-hnARUKNF.d.ts} +2 -2
- package/dist/replacement-CVZVsflC.js +76 -0
- package/dist/{request-scope-CXCI_wCb.js → request-scope-jH4H0Sbm.js} +3 -1
- package/dist/{rule-keys-BLEbi1h5.js → rule-keys-xMpiTLq1.js} +1 -1
- package/dist/{rules-BPDXypZV.js → rules-DYQCKYdt.js} +4 -4
- package/dist/runtime/assets.d.ts +1 -1
- package/dist/runtime/assets.js +4 -4
- package/dist/runtime/empty-assets-registry.d.ts +1 -1
- package/dist/runtime/empty-registry.d.ts +2 -2
- package/dist/runtime/registry.d.ts +1 -1
- package/dist/runtime/request.js +1 -1
- package/dist/runtime/state.d.ts +17 -6
- package/dist/runtime/state.js +7 -7
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +8 -8
- package/dist/runtime.js +39 -24
- package/dist/{search-C_nVorq7.js → search-CG6UNOtn.js} +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +301 -1
- package/dist/{shared-C20Wh1mp.js → shared-DCAyMX8U.js} +68 -21
- package/dist/source-metadata.d.ts +2 -2
- package/dist/source-metadata.js +3 -3
- package/dist/{sync-BBfR4g5y.js → sync-DkpTCr9u.js} +5 -5
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/{types-Bel5IDmF.d.ts → types-BnSUug2v.d.ts} +13 -1
- package/dist/{use-CpphIBof.d.ts → use-CJ5rdIrW.d.ts} +1 -1
- package/dist/{use-D0DyTMxM.js → use-hLouCwGz.js} +15 -51
- package/dist/{use-tools-CAK10LTc.d.ts → use-tools-DFVqZwgc.d.ts} +2 -2
- package/dist/{use-tools-CHduR5k6.js → use-tools-NXEQt099.js} +4 -4
- package/dist/{utils-DXP9xfXo.js → utils-Bv1NBg8r.js} +5 -5
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +517 -121
- package/dist/{workspace-BOuxrZrP.d.ts → workspace-B6QreLJd.d.ts} +1 -1
- package/dist/{workspace-CLuPkyZR.js → workspace-Cz-5Ne1c.js} +340 -104
- package/dist/workspace-inspection-scanner-BlJ8bCAB.js +140 -0
- package/package.json +12 -12
- package/dist/errors-CnFDXxeJ.d.ts +0 -4
- package/dist/hosted-8BTKAtMX.js +0 -883
- package/dist/hosted-vercel-blob-B6kygYqn.js +0 -408
- package/dist/operations-DS1C4uXd.js +0 -1308
- package/dist/path-CuYE8-X6.js +0 -57
- package/dist/plugins-CLc32jvL.d.ts +0 -8
- package/dist/server-aa1a4rkV.js +0 -301
- package/dist/state-BdDfBtOR.d.ts +0 -17
- package/dist/store-cx3OqNTi.js +0 -1971
|
@@ -1,54 +1,15 @@
|
|
|
1
|
-
import { n as useWorkspaceAssets } from "./asset-registry-
|
|
2
|
-
import {
|
|
3
|
-
import { f as normalizeHistoryRef, g as validateHistoryMessage, h as requireWorkspaceHistory, m as rejectHistoryHead, s as deleteWorkspaceHistoryRef, u as historyConflict } from "./utils-
|
|
1
|
+
import { n as useWorkspaceAssets } from "./asset-registry-DJyE42kr.js";
|
|
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-Bv1NBg8r.js";
|
|
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
|
+
import { c as normalizeSafeWorkspacePattern, f as sha256 } from "./path-DYHw5KNk.js";
|
|
6
|
+
import { s as useRegisteredWorkspace } from "./registry-OonxXCbd.js";
|
|
4
7
|
import { a as provideWorkspaceStoreTarget, i as forwardWorkspaceStoreTarget, o as resolveWorkspaceStoreTarget } from "./vitehub-grants-Co713QTg.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { t as createHostedWorkspaceSession } from "./host-C8yZizfk.js";
|
|
10
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-B4me-ouV.js";
|
|
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-mlHAv1p4.js";
|
|
10
|
+
import { t as createHostedWorkspaceSession } from "./host-BT7EnmZf.js";
|
|
11
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
11
12
|
import { getViteHubErrorShape } from "@vite-hub/runtime";
|
|
12
|
-
import { posix } from "node:path";
|
|
13
|
-
// src/fs-ops.ts
|
|
14
|
-
async function ensureMissingOrReplaceable(workspace, path, overwrite = false) {
|
|
15
|
-
if (!await workspace.exists(path)) return;
|
|
16
|
-
if (!overwrite) throw workspaceError(`[vitehub] Workspace path already exists: ${path}.`);
|
|
17
|
-
await workspace.rm(path, {
|
|
18
|
-
recursive: true,
|
|
19
|
-
force: true
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
async function copyWorkspacePath(workspace, from, to, overwrite = false) {
|
|
23
|
-
if (from === to) throw workspaceError("[vitehub] Source and destination must be different.");
|
|
24
|
-
const source = await workspace.stat(from);
|
|
25
|
-
if (source.type === "directory" && to.startsWith(`${from}/`)) throw workspaceError("[vitehub] Destination cannot be nested inside the source directory.");
|
|
26
|
-
if (from.startsWith(`${to}/`)) throw workspaceError("[vitehub] Destination cannot contain the source.");
|
|
27
|
-
if (overwrite && await (await resolveWorkspaceStoreTarget(workspace))?.containsPath?.(to, from)) throw workspaceError("[vitehub] Destination cannot contain the source.");
|
|
28
|
-
await ensureMissingOrReplaceable(workspace, to, overwrite);
|
|
29
|
-
if (source.type === "file") {
|
|
30
|
-
const content = await workspace.readFile(from, { encoding: "binary" });
|
|
31
|
-
await workspace.writeFile(to, content, { mediaType: source.mediaType });
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const entries = await workspace.list(from, { recursive: true });
|
|
35
|
-
await workspace.mkdir(to, { recursive: true });
|
|
36
|
-
const directories = entries.filter((entry) => entry.type === "directory").sort((left, right) => left.path.length - right.path.length);
|
|
37
|
-
for (const entry of directories) await workspace.mkdir(posix.join(to, posix.relative(from, entry.path)), { recursive: true });
|
|
38
|
-
await Promise.all(entries.filter((entry) => entry.type === "file").map(async (entry) => {
|
|
39
|
-
const content = await workspace.readFile(entry.path, { encoding: "binary" });
|
|
40
|
-
await workspace.writeFile(posix.join(to, posix.relative(from, entry.path)), content, { mediaType: entry.mediaType });
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
async function appendWorkspaceFile(workspace, path, content) {
|
|
44
|
-
let current = "";
|
|
45
|
-
try {
|
|
46
|
-
current = String(await workspace.readFile(path));
|
|
47
|
-
} catch (error) {
|
|
48
|
-
if (!isWorkspaceError(error)) throw error;
|
|
49
|
-
}
|
|
50
|
-
await workspace.writeFile(path, `${current}${content}`);
|
|
51
|
-
}
|
|
52
13
|
// src/core/use.ts
|
|
53
14
|
const workspaceDefinitionSyncStates = /* @__PURE__ */ new WeakMap();
|
|
54
15
|
async function workspaceDefinitionSyncState(workspace) {
|
|
@@ -263,6 +224,7 @@ function createLazyWorkspace(name, definition, options = {}) {
|
|
|
263
224
|
return await (await resolveSyncedWorkspace()).startSession(options);
|
|
264
225
|
}
|
|
265
226
|
};
|
|
227
|
+
attachWorkspaceReplacement(workspace, async (replacement, check) => await requireWorkspaceReplacement(await resolveSyncedWorkspace())(replacement, check));
|
|
266
228
|
provideWorkspaceStoreTarget(workspace, async () => await resolveWorkspaceStoreTarget(await resolveWorkspace()));
|
|
267
229
|
attachWorkspaceMetadataTarget(workspace, async () => await resolveWorkspaceMetadataTarget(await resolveWorkspace()));
|
|
268
230
|
return attachWorkspaceSourceRequestExecution(workspace, { async executeSourceRequest(input) {
|
|
@@ -273,7 +235,7 @@ function createLazyWorkspace(name, definition, options = {}) {
|
|
|
273
235
|
} });
|
|
274
236
|
}
|
|
275
237
|
function createWritableFs(name, workspace) {
|
|
276
|
-
|
|
238
|
+
const fs = attachWorkspaceSourceRequestExecution({
|
|
277
239
|
readFile: async (path, options) => await workspace.readFile(normalizePath(path), options),
|
|
278
240
|
writeFile: async (path, content, options) => await workspace.writeFile(normalizePath(path), content, options),
|
|
279
241
|
appendFile: async (path, content) => await appendWorkspaceFile(workspace, normalizePath(path), content),
|
|
@@ -298,6 +260,8 @@ function createWritableFs(name, workspace) {
|
|
|
298
260
|
},
|
|
299
261
|
copyPath: async (from, to, options) => await copyWorkspacePath(workspace, normalizePath(from), normalizePath(to), options?.overwrite)
|
|
300
262
|
}, getWorkspaceSourceRequestExecution(workspace));
|
|
263
|
+
attachWorkspaceReplacement(fs, requireWorkspaceReplacement(workspace));
|
|
264
|
+
return fs;
|
|
301
265
|
}
|
|
302
266
|
function useOptionalWorkspaceAssets(name) {
|
|
303
267
|
try {
|
|
@@ -479,4 +443,4 @@ function createWorkspaceFileRuntime(name, options) {
|
|
|
479
443
|
function useWorkspaceFiles(name, options) {
|
|
480
444
|
return createWorkspaceFileRuntime(name, options).facade;
|
|
481
445
|
}
|
|
482
|
-
export {
|
|
446
|
+
export { createWorkspaceFileRuntime as n, useWorkspaceFiles as r, createReadonlyFs as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as WritableWorkspaceFacade, i as ReadonlyWorkspaceFacade, s as UseWorkspaceOptions } from "./use-
|
|
2
|
-
import { gt as WorkspaceLookupName } from "./types-
|
|
1
|
+
import { h as WritableWorkspaceFacade, i as ReadonlyWorkspaceFacade, s as UseWorkspaceOptions } from "./use-CJ5rdIrW.js";
|
|
2
|
+
import { gt as WorkspaceLookupName } from "./types-BnSUug2v.js";
|
|
3
3
|
declare function useWorkspace<Name extends WorkspaceLookupName>(name: Name): ReadonlyWorkspaceFacade<Name>;
|
|
4
4
|
declare function useWorkspace<Name extends WorkspaceLookupName>(name: Name, options: UseWorkspaceOptions & {
|
|
5
5
|
mode?: "read";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
1
|
+
import { normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
|
|
2
|
+
import { g as copyWorkspacePath, h as appendWorkspaceFile, y as getWorkspaceSourceRequestExecution } from "./workspace-Cz-5Ne1c.js";
|
|
3
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
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";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as createWorkspaceWritePolicy } from "./rules-
|
|
1
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CHgE8TQM.js";
|
|
2
|
+
import { n as copyJsonFileMetadata, r as copyJsonWorkspaceMetadata } from "./file-metadata-Dqpldj0h.js";
|
|
3
|
+
import { i as workspaceConflict, normalizeSafeWorkspacePath, o as workspaceError } from "./internal/path.js";
|
|
4
|
+
import { f as sha256, o as isWorkspaceBytes, r as contentToBytes } from "./path-DYHw5KNk.js";
|
|
5
|
+
import { t as createWorkspaceWritePolicy } from "./rules-DYQCKYdt.js";
|
|
6
6
|
import { lookup } from "mrmime";
|
|
7
7
|
import { isRuntimeObject } from "@vite-hub/runtime/internal/runtime-type";
|
|
8
8
|
// src/core/history.ts
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { At as WorkspaceOptions } from "./types-
|
|
2
|
-
import { n as OperationContributionEntry } from "./
|
|
1
|
+
import { At as WorkspaceOptions } from "./types-BnSUug2v.js";
|
|
2
|
+
import { n as OperationContributionEntry } from "./operations-BALFFdKj.js";
|
|
3
3
|
import { EnvironmentOptions, Plugin } from "vite";
|
|
4
4
|
type NitroPackageLoadingOptions = {
|
|
5
5
|
devServer?: {
|