@vite-hub/workspace 0.0.4 → 0.3.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 +339 -115
- package/dist/abort-BCwpdrN0.js +32 -0
- package/dist/{asset-registry-8QI3ML3K.js → asset-registry-DfBV5kmw.js} +3 -2
- package/dist/blob-database.d.ts +474 -0
- package/dist/blob-database.js +608 -0
- package/dist/checkout.d.ts +128 -0
- package/dist/checkout.js +849 -0
- package/dist/cloudflare.d.ts +6 -7
- package/dist/cloudflare.js +1 -1
- package/dist/config-B-863EgC.js +15 -0
- package/dist/config-BAgL2dtB.js +1076 -0
- package/dist/{config-DE9xlaIw.d.ts → config-BQKcPawI.d.ts} +1 -2
- package/dist/discard-CNNtCozM.js +8 -0
- package/dist/durability.d.ts +22 -0
- package/dist/durability.js +70 -0
- package/dist/error-diagnostics-CtKjGtGb.js +188 -0
- package/dist/error-diagnostics-DSkCJC_L.js +266 -0
- package/dist/file-2pFYNtsU.js +22 -0
- package/dist/{files-Q6xZjDHA.js → files-BOo4SbwE.js} +3 -3
- package/dist/files.d.ts +38 -0
- package/dist/files.js +6 -0
- package/dist/{github-DHnjxQIX.js → github-CrYp4v8k.js} +44 -24
- package/dist/glob-B8YGvTrZ.js +21 -0
- package/dist/glob-Cjxms1t7.js +30 -0
- package/dist/{host-DJH8cuoU.js → host-BFBpXn0N.js} +144 -77
- package/dist/{hosted-RPeJOCFz.js → hosted-KcUR_jPv.js} +303 -97
- package/dist/hosted-vercel-blob-B3-wRdUm.js +410 -0
- package/dist/hosted-vercel-blob.d.ts +6 -7
- package/dist/hosted-vercel-blob.js +1 -1
- package/dist/hosted.d.ts +10 -9
- package/dist/hosted.js +2 -2
- package/dist/index.d.ts +26 -47
- package/dist/index.js +30 -100
- package/dist/internal/path.d.ts +2 -0
- package/dist/internal/path.js +2 -0
- package/dist/lifecycle-B-enk_4A.js +596 -0
- package/dist/lineage.d.ts +26 -0
- package/dist/lineage.js +76 -0
- package/dist/loader.d.ts +5 -6
- package/dist/loader.js +3 -2
- package/dist/mcp-resources-DF0F5rcL.js +39 -0
- package/dist/memory-BOexthyW.js +247 -0
- package/dist/metadata-target-CWz6KHKq.js +1589 -0
- package/dist/object-Da1zyPCR.js +11 -0
- package/dist/operation-definition-8gOe-ubD.d.ts +234 -0
- package/dist/operations-C6FpR8Rr.js +389 -0
- package/dist/operations-CE2drFih.js +1234 -0
- package/dist/operations.d.ts +90 -0
- package/dist/operations.js +3 -0
- package/dist/path--wrT_Azm.js +113 -0
- package/dist/path-AxMho1wo.d.ts +7 -0
- package/dist/path-DrSIenjj.js +59 -0
- package/dist/path-zHxQUbqa.d.ts +9 -0
- package/dist/plugins-C8C0auoW.d.ts +10 -0
- package/dist/provider-9s4Ufkm5.js +1479 -0
- package/dist/providers/github/store.d.ts +3 -5
- package/dist/providers/github/store.js +1 -1
- package/dist/registry-B3BBm4Ts.d.ts +19 -0
- package/dist/{registry-D3yzt8HQ.js → registry-CNphafBx.js} +60 -23
- package/dist/registry-CYNN623b.d.ts +9 -0
- package/dist/request-scope-Dw5n8bMC.js +83 -0
- package/dist/results-DgkZUmTL.js +8 -0
- package/dist/{chunk-2rV9d50f.js → rolldown-runtime-rQ84J-ij.js} +3 -4
- package/dist/runtime/assets.d.ts +3 -5
- package/dist/runtime/assets.js +7 -6
- package/dist/runtime/empty-assets-registry.d.ts +1 -2
- package/dist/runtime/empty-registry.d.ts +2 -2
- package/dist/runtime/registry.d.ts +2 -0
- package/dist/runtime/registry.js +23 -0
- package/dist/runtime/request.d.ts +4 -0
- package/dist/runtime/request.js +8 -0
- package/dist/runtime/state.d.ts +5 -4
- package/dist/runtime/state.js +8 -18
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +52 -17
- package/dist/runtime.js +324 -67
- package/dist/{search-BpiCF2Tw.js → search-C_RfoM2j.js} +10 -9
- package/dist/server-8tGltlGz.js +303 -0
- package/dist/server.d.ts +36 -39
- package/dist/server.js +2 -328
- package/dist/shared-B3_EUk89.js +848 -0
- package/dist/source-metadata.d.ts +10 -7
- package/dist/source-metadata.js +12 -12
- package/dist/state-BISnUf1s.d.ts +35 -0
- package/dist/{ai-BqCC8BpY.js → state-DbrW-njQ.js} +237 -114
- package/dist/store-ybhyD38Z.js +1873 -0
- package/dist/{sync-DnTQwt8r.js → sync-CCD_VYC8.js} +61 -41
- package/dist/target-jWhTdIuF.js +89 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/{types-CYuwjJ4V.d.ts → types-BbtwmBZ5.d.ts} +321 -35
- package/dist/use-C6lV3-wC.d.ts +321 -0
- package/dist/{use-BTNDR5Rd.js → use-CSpT5W87.js} +141 -107
- package/dist/utils-CgMZCHsX.js +616 -0
- package/dist/vite.d.ts +585 -2
- package/dist/vite.js +21369 -2
- package/dist/workspace-CYB2xZ1T.d.ts +7 -0
- package/dist/{workspace-Dq08Yn72.js → workspace-sPWn2Jxj.js} +441 -225
- package/package.json +97 -72
- package/dist/ai-CjxvGqM0.d.ts +0 -162
- package/dist/ai.d.ts +0 -3
- package/dist/ai.js +0 -2
- package/dist/collections/client.d.ts +0 -39
- package/dist/collections/client.js +0 -137
- package/dist/collections.d.ts +0 -59
- package/dist/collections.js +0 -159
- package/dist/config-Bc3c4Su1.js +0 -7904
- package/dist/config-CHLLWklZ.js +0 -36
- package/dist/file-Bc1X7pco.js +0 -23
- package/dist/glob-CEZKeZFC.js +0 -18
- package/dist/hosted-vercel-blob-d6C8ND5j.js +0 -23580
- package/dist/lifecycle-LrL3sA4n.js +0 -316
- package/dist/metadata-target-B0tOmVW7.js +0 -717
- package/dist/mountx.d.ts +0 -10
- package/dist/mountx.js +0 -143
- package/dist/nitro.d.ts +0 -2
- package/dist/nitro.js +0 -2
- package/dist/nuxt.d.ts +0 -26
- package/dist/nuxt.js +0 -42
- package/dist/path-Cp59koVz.js +0 -139
- package/dist/provider-B1yLjCJJ.js +0 -746
- package/dist/publish.d.ts +0 -35
- package/dist/publish.js +0 -112
- package/dist/registry-Uj6IVxes.d.ts +0 -11
- package/dist/request-execution-B-dSFlGB.js +0 -84
- package/dist/runtime-options-BsPSv5O7.js +0 -13
- package/dist/runtime-type-iEE6BjQJ.js +0 -34
- package/dist/shared-DTR1Hhma.js +0 -331
- package/dist/state-tYcRWEh2.d.ts +0 -26
- package/dist/store-Dt_Jyys3.js +0 -608
- package/dist/target-D4Bqb1eH.js +0 -11
- package/dist/token-CVzURBxC.js +0 -61
- package/dist/use-BiHzt0xA.d.ts +0 -103
- package/dist/vite-BptCrpv2.js +0 -4526
- package/dist/vite-CtA9guIM.d.ts +0 -66
- package/dist/workspace-Xddf4G1B.d.ts +0 -6
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { $ as WorkspaceHistoryFileInput, $t as WorkspaceSourceMaterializationStatus, A as WorkspaceAutoCommitPlan, An as WorkspaceWriteCommit, At as WorkspaceRetainedHistory, B as WorkspaceEntry, Bt as WorkspaceSessionHost, C as SourceContextWorkspaceFiles, Cn as WorkspaceStoreHistoryCommitOptions, Ct as WorkspaceNameMap, D as WorkspaceAssets, Dn as WorkspaceSyncResultDetails, Dt as WorkspacePrepareSessionProgressEvent, E as WorkspaceAssetPath, En as WorkspaceSyncOptions, Et as WorkspacePlugin, F as WorkspaceCustomSourceInput, Fn as WorkspaceWriteOperation, Ft as WorkspaceScopeName, G as WorkspaceGitHubSourceInput, Gt as WorkspaceSnapshot, H as WorkspaceFetchSourceRequestOptions, Ht as WorkspaceSessionHostFiles, I as WorkspaceDefinition, In as WorkspaceWriteValidator, It as WorkspaceSearchHit, J as WorkspaceHistoryChangesCommitOptions, Jt as WorkspaceSourceDefinition, K as WorkspaceGlobSourceInput, Kt as WorkspaceSource, L as WorkspaceDefinitionInput, Ln as WorkspaceWriteValidatorResult, Lt as WorkspaceSearchQuery, M as WorkspaceCapabilities, Mn as WorkspaceWriteHook, Mt as WorkspaceRevisionView, N as WorkspaceContent, Nn as WorkspaceWriteInput, Nt as WorkspaceRule, O as WorkspaceAssetsRegistry, On as WorkspaceSyncSnapshotOptions, Ot as WorkspacePullRequest, P as WorkspaceContentStream, Pn as WorkspaceWriteMode, Pt as WorkspaceRules, Q as WorkspaceHistoryFile, Qt as WorkspaceSourceMaterializationPathResult, R as WorkspaceDiff, Rn as WriteFileOptions, Rt as WorkspaceSelectedScope, S as SourceContext, Sn as WorkspaceStoreHistory, St as WorkspaceName, T as Workspace, Tn as WorkspaceStreamFile, Tt as WorkspaceOptions, U as WorkspaceFile, Ut as WorkspaceSessionOptions, V as WorkspaceFetchSourceInput, Vt as WorkspaceSessionHostFileEntry, W as WorkspaceFileSourceInput, Wt as WorkspaceSessionWriteFileOptions, X as WorkspaceHistoryCommitOptions, Xt as WorkspaceSourceItem, Y as WorkspaceHistoryCommitBase, Yt as WorkspaceSourceInput, Z as WorkspaceHistoryExtensions, Zt as WorkspaceSourceMaterializationCounts, _ as ReadFileResult, _n as WorkspaceSourceSyncPolicy, _t as WorkspaceMergeCommit, a as GitHubWorkspaceOption, an as WorkspaceSourceRequestExecutor, at as WorkspaceHistoryRefOptions, b as RmOptions, bn as WorkspaceStat, bt as WorkspaceMergeOptions, c as GlobOptions, cn as WorkspaceSourceResolutionContextMap, ct as WorkspaceInstructionBinding, d as LocalWorkspaceStoreOptions, dn as WorkspaceSourceResolutionResult, dt as WorkspaceLoaderSource, en as WorkspaceSourceMount, et as WorkspaceHistoryFilesCommitOptions, f as Logger, fn as WorkspaceSourceResolver, ft as WorkspaceMaterializeMode, g as ReadFileOptions, gn as WorkspaceSourceSyncPathResult, gt as WorkspaceMcpResourcesSourceInput, h as MkdirOptions, hn as WorkspaceSourceSyncCounts, ht as WorkspaceMaterializeSourcesResult, i as ExecResult, in as WorkspaceSourceRequestExecutionResult, it as WorkspaceHistoryRef, j as WorkspaceCacheOptions, jn as WorkspaceWriteErrorHook, jt as WorkspaceRevision, k as WorkspaceAuthor, kn as WorkspaceValidateMode, kt as WorkspaceRebaseOptions, l as ListOptions, ln as WorkspaceSourceResolutionContextValueReader, lt as WorkspaceInstructionBindingValue, m as MemoryWorkspaceStoreOptions, mn as WorkspaceSourceSyncConfig, mt as WorkspaceMaterializeSourcesProgressEvent, n as DiffOptions, nn as WorkspaceSourceRequestDescriptor, nt as WorkspaceHistoryListResult, o as GitHubWorkspaceRefs, on as WorkspaceSourceRequestMethod, ot as WorkspaceHookContext, p as MaybePromise, pn as WorkspaceSourceSelection, pt as WorkspaceMaterializeSourcesOptions, q as WorkspaceHistoryChanges, qt as WorkspaceSourceBindingInput, r as ExecOptions, rn as WorkspaceSourceRequestExecutionInput, rt as WorkspaceHistoryReader, s as GitHubWorkspaceStoreOptions, sn as WorkspaceSourceResolutionContext, st as WorkspaceHooks, t as CloudflareArtifactsWorkspaceStoreOptions, tn as WorkspaceSourceMountOptions, tt as WorkspaceHistoryListOptions, u as LoaderContext, un as WorkspaceSourceResolutionInvocation, ut as WorkspaceLoader, v as ResolvedWorkspaceModuleOptions, vn as WorkspaceSourceSyncResult, vt as WorkspaceMergeConflict, w as VercelBlobWorkspaceStoreOptions, wn as WorkspaceStoreOptions, wt as WorkspaceOpenPullRequestOptions, x as SnapshotOptions, xn as WorkspaceStore, xt as WorkspaceMergeResolution, y as ResolvedWorkspaceRule, yn as WorkspaceSourceSyncStatus, yt as WorkspaceMergeConflictContext, z as WorkspaceDiffEntry, zt as WorkspaceSession } from "./types-BbtwmBZ5.js";
|
|
2
|
+
import { C as resolveWorkspaceStoreTarget, S as WorkspaceStoreTarget, _ as WritableWorkspaceFiles, a as ReadonlyWorkspaceFiles, o as ReadonlyWorkspaceFs, s as UseWorkspaceOptions, u as WorkspaceHistory, v as WritableWorkspaceFs, x as useWorkspaceFiles } from "./use-C6lV3-wC.js";
|
|
3
|
+
import { n as isWorkspaceConflict } from "./path-AxMho1wo.js";
|
|
4
|
+
import { n as normalizeSafeWorkspacePath } from "./path-zHxQUbqa.js";
|
|
5
|
+
import { t as registerWorkspacePlugin } from "./plugins-C8C0auoW.js";
|
|
6
|
+
//#region src/providers/github/cache.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The GitHub answers that the GitHub Store keeps. An answer for a URL that names a commit or tree sha never
|
|
9
|
+
* changes, so it goes to the shared KV store when the app has one: another server instance reads it there and sends no
|
|
10
|
+
* request. Other answers stay in memory with their ETag. The next read of the same URL asks GitHub with
|
|
11
|
+
* `If-None-Match`, and a `304 Not Modified` does not count against the GitHub rate limit.
|
|
12
|
+
*/
|
|
13
|
+
/** The part of a ViteHub KV store that the GitHub Store uses, such as `kv` from `@vite-hub/kv`. */
|
|
14
|
+
interface WorkspaceKV {
|
|
15
|
+
get<T>(key: string): Promise<readonly [unknown, T | null | undefined]>;
|
|
16
|
+
set<T>(key: string, value: T, options?: {
|
|
17
|
+
ttl?: number;
|
|
18
|
+
}): Promise<readonly [unknown, unknown]>;
|
|
19
|
+
}
|
|
20
|
+
/** How the GitHub Store answered its reads in this server instance. */
|
|
21
|
+
interface GitHubReadStats {
|
|
22
|
+
/** Requests that reached GitHub, including the conditional ones. */
|
|
23
|
+
requests: number;
|
|
24
|
+
/** Conditional requests that GitHub answered with `304 Not Modified`. They do not count against the rate limit. */
|
|
25
|
+
notModified: number;
|
|
26
|
+
/** Answers that came from memory or from the shared KV store, with no request. */
|
|
27
|
+
memory: number;
|
|
28
|
+
kv: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Give the GitHub Store a shared KV store for the GitHub answers that never change. The Content build calls it with
|
|
32
|
+
* ViteHub KV when the app enables KV; without it, each server instance asks GitHub again after it starts.
|
|
33
|
+
*/
|
|
34
|
+
export declare function registerWorkspaceKV(store: WorkspaceKV | undefined): void;
|
|
35
|
+
/** The reads of the GitHub Store in this server instance, for tests and inspection. */
|
|
36
|
+
export declare function readGitHubReadStats(): GitHubReadStats;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { type CloudflareArtifactsWorkspaceStoreOptions, type DiffOptions, type ExecOptions, type ExecResult, type GitHubReadStats, type GitHubWorkspaceOption, type GitHubWorkspaceRefs, type GitHubWorkspaceStoreOptions, type GlobOptions, type ListOptions, type LoaderContext, type LocalWorkspaceStoreOptions, type Logger, type MaybePromise, type MemoryWorkspaceStoreOptions, type MkdirOptions, type ReadFileOptions, type ReadFileResult, type ReadonlyWorkspaceFiles, type ReadonlyWorkspaceFs, type ResolvedWorkspaceModuleOptions, type ResolvedWorkspaceRule, type RmOptions, type SnapshotOptions, type SourceContext, type SourceContextWorkspaceFiles, type UseWorkspaceOptions, type VercelBlobWorkspaceStoreOptions, type Workspace, type WorkspaceAssetPath, type WorkspaceAssets, type WorkspaceAssetsRegistry, type WorkspaceAuthor, type WorkspaceAutoCommitPlan, type WorkspaceCacheOptions, type WorkspaceCapabilities, type WorkspaceContent, type WorkspaceContentStream, type WorkspaceCustomSourceInput, type WorkspaceDefinition, type WorkspaceDefinitionInput, type WorkspaceDiff, type WorkspaceDiffEntry, type WorkspaceEntry, type WorkspaceFetchSourceInput, type WorkspaceFetchSourceRequestOptions, type WorkspaceFile, type WorkspaceFileSourceInput, type WorkspaceGitHubSourceInput, type WorkspaceGlobSourceInput, type WorkspaceHistory, type WorkspaceHistoryChanges, type WorkspaceHistoryChangesCommitOptions, type WorkspaceHistoryCommitBase, type WorkspaceHistoryCommitOptions, type WorkspaceHistoryExtensions, type WorkspaceHistoryFile, type WorkspaceHistoryFileInput, type WorkspaceHistoryFilesCommitOptions, type WorkspaceHistoryListOptions, type WorkspaceHistoryListResult, type WorkspaceHistoryReader, type WorkspaceHistoryRef, type WorkspaceHistoryRefOptions, type WorkspaceHookContext, type WorkspaceHooks, type WorkspaceInstructionBinding, type WorkspaceInstructionBindingValue, type WorkspaceKV, type WorkspaceLoader, type WorkspaceLoaderSource, type WorkspaceMaterializeMode, type WorkspaceMaterializeSourcesOptions, type WorkspaceMaterializeSourcesProgressEvent, type WorkspaceMaterializeSourcesResult, type WorkspaceMcpResourcesSourceInput, type WorkspaceMergeCommit, type WorkspaceMergeConflict, type WorkspaceMergeConflictContext, type WorkspaceMergeOptions, type WorkspaceMergeResolution, type WorkspaceName, type WorkspaceNameMap, type WorkspaceOpenPullRequestOptions, type WorkspaceOptions, type WorkspacePlugin, type WorkspacePrepareSessionProgressEvent, type WorkspacePullRequest, type WorkspaceRebaseOptions, type WorkspaceRetainedHistory, type WorkspaceRevision, type WorkspaceRevisionView, type WorkspaceRule, type WorkspaceRules, type WorkspaceScopeName, type WorkspaceSearchHit, type WorkspaceSearchQuery, type WorkspaceSelectedScope, type WorkspaceSession, type WorkspaceSessionHost, type WorkspaceSessionHostFileEntry, type WorkspaceSessionHostFiles, type WorkspaceSessionOptions, type WorkspaceSessionWriteFileOptions, type WorkspaceSnapshot, type WorkspaceSource, type WorkspaceSourceBindingInput, type WorkspaceSourceDefinition, type WorkspaceSourceInput, type WorkspaceSourceItem, type WorkspaceSourceMaterializationCounts, type WorkspaceSourceMaterializationPathResult, type WorkspaceSourceMaterializationStatus, type WorkspaceSourceMount, type WorkspaceSourceMountOptions, type WorkspaceSourceRequestDescriptor, type WorkspaceSourceRequestExecutionInput, type WorkspaceSourceRequestExecutionResult, type WorkspaceSourceRequestExecutor, type WorkspaceSourceRequestMethod, type WorkspaceSourceResolutionContext, type WorkspaceSourceResolutionContextMap, type WorkspaceSourceResolutionContextValueReader, type WorkspaceSourceResolutionInvocation, type WorkspaceSourceResolutionResult, type WorkspaceSourceResolver, type WorkspaceSourceSelection, type WorkspaceSourceSyncConfig, type WorkspaceSourceSyncCounts, type WorkspaceSourceSyncPathResult, type WorkspaceSourceSyncPolicy, type WorkspaceSourceSyncResult, type WorkspaceSourceSyncStatus, type WorkspaceStat, type WorkspaceStore, type WorkspaceStoreHistory, type WorkspaceStoreHistoryCommitOptions, type WorkspaceStoreOptions, type WorkspaceStoreTarget, type WorkspaceStreamFile, type WorkspaceSyncOptions, type WorkspaceSyncResultDetails, type WorkspaceSyncSnapshotOptions, type WorkspaceValidateMode, type WorkspaceWriteCommit, type WorkspaceWriteErrorHook, type WorkspaceWriteHook, type WorkspaceWriteInput, type WorkspaceWriteMode, type WorkspaceWriteOperation, type WorkspaceWriteValidator, type WorkspaceWriteValidatorResult, type WritableWorkspaceFiles, type WritableWorkspaceFs, type WriteFileOptions, isWorkspaceConflict, normalizeSafeWorkspacePath, registerWorkspacePlugin, resolveWorkspaceStoreTarget, useWorkspaceFiles };
|
package/dist/files.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { r as isWorkspaceConflict, t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
|
|
2
|
+
import { n as resolveWorkspaceStoreTarget } from "./target-jWhTdIuF.js";
|
|
3
|
+
import { g as registerWorkspacePlugin } from "./utils-CgMZCHsX.js";
|
|
4
|
+
import { C as registerWorkspaceKV, S as readGitHubReadStats } from "./shared-B3_EUk89.js";
|
|
5
|
+
import { r as useWorkspaceFiles } from "./use-CSpT5W87.js";
|
|
6
|
+
export { isWorkspaceConflict, normalizeSafeWorkspacePath, readGitHubReadStats, registerWorkspaceKV, registerWorkspacePlugin, resolveWorkspaceStoreTarget, useWorkspaceFiles };
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { n as __exportAll } from "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-rQ84J-ij.js";
|
|
2
|
+
import { s as matchesAny } from "./path--wrT_Azm.js";
|
|
3
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-CtKjGtGb.js";
|
|
4
|
+
import { D as forgeEnv, O as readForgeEnv, m as readGitHubEnvToken } from "./shared-B3_EUk89.js";
|
|
5
|
+
import { d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, p as resolveGitHubIgnore } from "./config-BAgL2dtB.js";
|
|
6
|
+
import { github } from "@vite-hub/source";
|
|
6
7
|
//#region src/env.ts
|
|
7
8
|
let viteLoadEnv;
|
|
8
9
|
const viteModuleId = "vite";
|
|
9
10
|
async function resolveWorkspaceEnv(rootDir, name) {
|
|
10
|
-
return (await
|
|
11
|
-
}
|
|
12
|
-
async function loadWorkspaceEnv(rootDir) {
|
|
13
|
-
return await loadViteEnv(rootDir);
|
|
11
|
+
return (await loadViteEnv(rootDir))?.[name];
|
|
14
12
|
}
|
|
15
13
|
async function loadViteEnv(rootDir) {
|
|
16
14
|
if (viteLoadEnv === null) return;
|
|
@@ -34,12 +32,6 @@ async function loadViteEnv(rootDir) {
|
|
|
34
32
|
//#endregion
|
|
35
33
|
//#region src/sources/github.ts
|
|
36
34
|
var github_exports = /* @__PURE__ */ __exportAll({ github: () => github$1 });
|
|
37
|
-
const githubTokenEnvNames = [
|
|
38
|
-
"WORKSPACE_GITHUB_TOKEN",
|
|
39
|
-
"VITEHUB_WORKSPACE_GITHUB_TOKEN",
|
|
40
|
-
"GITHUB_TOKEN",
|
|
41
|
-
"GH_TOKEN"
|
|
42
|
-
];
|
|
43
35
|
function github$1(input) {
|
|
44
36
|
if (typeof input === "function") return resolvableGitHubSource(input);
|
|
45
37
|
const options = input;
|
|
@@ -77,7 +69,12 @@ function github$1(input) {
|
|
|
77
69
|
return await (await getSourceForRoot(ctx.rootDir)).resolveRevision?.(ctx);
|
|
78
70
|
},
|
|
79
71
|
async prepare(ctx) {
|
|
80
|
-
|
|
72
|
+
const source = await getSourceForRoot(ctx.rootDir);
|
|
73
|
+
await prepareWorkspaceSource(source, ctx);
|
|
74
|
+
},
|
|
75
|
+
async checkAccess(ctx) {
|
|
76
|
+
if (!await resolveGitHubAuth(resolvedOptions.auth, ctx.rootDir)) return;
|
|
77
|
+
await (await getSourceForRoot(ctx.rootDir)).resolveRevision?.(ctx);
|
|
81
78
|
},
|
|
82
79
|
async getKeys(ctx) {
|
|
83
80
|
return await (await getSourceForRoot(ctx.rootDir)).getKeys(ctx);
|
|
@@ -91,6 +88,28 @@ function github$1(input) {
|
|
|
91
88
|
},
|
|
92
89
|
async getMeta(key, ctx) {
|
|
93
90
|
return await (await getSourceForRoot(ctx.rootDir)).getMeta?.(key, ctx);
|
|
91
|
+
},
|
|
92
|
+
subset(include) {
|
|
93
|
+
const { cache, ignore, include: sourceInclude, ref, repo, root } = options;
|
|
94
|
+
const subset = github$1({
|
|
95
|
+
auth: options.auth,
|
|
96
|
+
cache,
|
|
97
|
+
ignore,
|
|
98
|
+
include: [...include],
|
|
99
|
+
ref,
|
|
100
|
+
repo,
|
|
101
|
+
root
|
|
102
|
+
});
|
|
103
|
+
if (!sourceInclude) return subset;
|
|
104
|
+
const holds = (key) => matchesAny(key, typeof sourceInclude === "string" ? sourceInclude : [...sourceInclude]);
|
|
105
|
+
const getKeys = async (ctx) => (await subset.getKeys(ctx)).filter(holds);
|
|
106
|
+
return {
|
|
107
|
+
...subset,
|
|
108
|
+
getKeys,
|
|
109
|
+
async getItems(ctx) {
|
|
110
|
+
return await Promise.all((await getKeys(ctx)).map((key) => subset.getItem(key, ctx)));
|
|
111
|
+
}
|
|
112
|
+
};
|
|
94
113
|
}
|
|
95
114
|
}, resolvedOptions);
|
|
96
115
|
}
|
|
@@ -102,7 +121,7 @@ function resolvableGitHubSource(resolve) {
|
|
|
102
121
|
return [];
|
|
103
122
|
},
|
|
104
123
|
async getItem(key) {
|
|
105
|
-
throw
|
|
124
|
+
throw workspaceErrorDiagnostics.WORKSPACE_R0060({ message: `[vitehub] github() resolver did not resolve before reading ${JSON.stringify(key)}.` });
|
|
106
125
|
},
|
|
107
126
|
async getItems() {
|
|
108
127
|
return [];
|
|
@@ -116,7 +135,7 @@ function resolvableGitHubSource(resolve) {
|
|
|
116
135
|
function githubResolutionDefaults(options, ctx) {
|
|
117
136
|
const source = pullRequestSource(ctx.invocation.context.get("pullRequest"));
|
|
118
137
|
const repo = options.repo || source?.repo;
|
|
119
|
-
if (!repo) throw
|
|
138
|
+
if (!repo) throw workspaceErrorDiagnostics.WORKSPACE_R0061({ message: "[vitehub] github() resolver requires repo or typed pullRequest source context." });
|
|
120
139
|
return {
|
|
121
140
|
...options,
|
|
122
141
|
mount: options.mount ?? ctx.source.mountPath,
|
|
@@ -157,21 +176,22 @@ function pullRequestSource(value) {
|
|
|
157
176
|
}
|
|
158
177
|
function createGitHubAuthResolver(auth) {
|
|
159
178
|
if (auth === false) return false;
|
|
160
|
-
return () => {
|
|
161
|
-
return resolveExplicitGitHubAuth(auth) ||
|
|
179
|
+
return async () => {
|
|
180
|
+
return await resolveExplicitGitHubAuth(auth) || readGitHubEnvToken();
|
|
162
181
|
};
|
|
163
182
|
}
|
|
164
183
|
async function resolveGitHubAuth(auth, rootDir) {
|
|
165
184
|
if (auth === false) return false;
|
|
166
|
-
return resolveExplicitGitHubAuth(auth) ||
|
|
185
|
+
return await resolveExplicitGitHubAuth(auth) || readGitHubEnvToken() || await resolveGitHubEnvFileToken(rootDir) || await resolveGitHubCliToken();
|
|
167
186
|
}
|
|
168
|
-
function resolveExplicitGitHubAuth(auth) {
|
|
187
|
+
async function resolveExplicitGitHubAuth(auth) {
|
|
169
188
|
if (auth === false) return void 0;
|
|
170
|
-
if (typeof auth === "function") return auth();
|
|
189
|
+
if (typeof auth === "function") return await auth();
|
|
171
190
|
return typeof auth === "string" ? auth : void 0;
|
|
172
191
|
}
|
|
173
192
|
async function resolveGitHubEnvFileToken(rootDir) {
|
|
174
|
-
|
|
193
|
+
const env = Object.fromEntries(await Promise.all(forgeEnv.github.token.names.map(async (name) => [name, await resolveWorkspaceEnv(rootDir, name)])));
|
|
194
|
+
return readForgeEnv(forgeEnv.github.token, env);
|
|
175
195
|
}
|
|
176
196
|
async function resolveGitHubCliToken() {
|
|
177
197
|
try {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-rQ84J-ij.js";
|
|
2
|
+
import { d as withWorkspaceRuntimeOptions, u as ownSourceOption } from "./config-BAgL2dtB.js";
|
|
3
|
+
import { glob } from "@vite-hub/source";
|
|
4
|
+
//#region src/sources/glob.ts
|
|
5
|
+
var glob_exports = /* @__PURE__ */ __exportAll({ glob: () => glob$1 });
|
|
6
|
+
function glob$1(options) {
|
|
7
|
+
const source = glob({
|
|
8
|
+
...options,
|
|
9
|
+
keyCache: options.keyCache ?? !isLazySource(options)
|
|
10
|
+
});
|
|
11
|
+
return withWorkspaceRuntimeOptions(source, options);
|
|
12
|
+
}
|
|
13
|
+
function isLazySource(options) {
|
|
14
|
+
const materialize = ownSourceOption(options, "materialize");
|
|
15
|
+
if (materialize === "lazy" || materialize === "startup") return true;
|
|
16
|
+
const mount = ownSourceOption(options, "mount");
|
|
17
|
+
const mountMaterialize = typeof mount === "object" ? ownSourceOption(mount, "materialize") : void 0;
|
|
18
|
+
return mountMaterialize === "lazy" || mountMaterialize === "startup";
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { glob_exports as n, glob$1 as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
|
|
2
|
+
import { l as normalizeWorkspacePath } from "./path--wrT_Azm.js";
|
|
3
|
+
import { Minimatch } from "minimatch";
|
|
4
|
+
//#region src/core/glob.ts
|
|
5
|
+
function createWorkspaceGlobMatcher(pattern, options = {}) {
|
|
6
|
+
const requestedCwd = options.cwd === "." ? "" : options.cwd;
|
|
7
|
+
let cwd;
|
|
8
|
+
try {
|
|
9
|
+
cwd = normalizeSafeWorkspacePath(requestedCwd, { allowEmpty: true });
|
|
10
|
+
} catch (error) {
|
|
11
|
+
const reservedCwd = normalizeSafeWorkspacePath(requestedCwd, {
|
|
12
|
+
allowEmpty: true,
|
|
13
|
+
allowReserved: true
|
|
14
|
+
});
|
|
15
|
+
if (reservedCwd !== ".vitehub/sources") throw error;
|
|
16
|
+
cwd = reservedCwd;
|
|
17
|
+
}
|
|
18
|
+
const prefix = cwd ? `${cwd}/` : "";
|
|
19
|
+
const matchers = pattern ? (Array.isArray(pattern) ? pattern : [pattern]).map((value) => new Minimatch(normalizeWorkspacePath(value), { dot: true })) : void 0;
|
|
20
|
+
return {
|
|
21
|
+
cwd,
|
|
22
|
+
matches(path) {
|
|
23
|
+
if (!path.startsWith(prefix)) return false;
|
|
24
|
+
const relative = normalizeWorkspacePath(path.slice(prefix.length));
|
|
25
|
+
return !matchers || matchers.some((matcher) => matcher.match(relative));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { createWorkspaceGlobMatcher as t };
|