@vite-hub/workspace 0.0.3 → 0.1.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/LICENSE +201 -0
- package/README.md +236 -58
- package/dist/{ai-nmHdzjCM.d.ts → ai-BW2ZhizI.d.ts} +22 -7
- package/dist/{ai-Ce3PtWFW.js → ai-BZyLwULx.js} +147 -66
- package/dist/ai.d.ts +2 -2
- package/dist/ai.js +1 -1
- package/dist/{asset-registry-CaG9b7tf.js → asset-registry-DfBV5kmw.js} +3 -2
- package/dist/association-Cm0dUTDU-CDDhJnIh-Cv3bWnVb.js +19 -0
- package/dist/blob-database.d.ts +521 -0
- package/dist/blob-database.js +601 -0
- package/dist/cloudflare.d.ts +5 -6
- package/dist/cloudflare.js +1 -1
- package/dist/config-B7dmzDX3.js +1112 -0
- package/dist/{config-3I1BnsdO.d.ts → config-DLKdaFWN.d.ts} +1 -2
- package/dist/error-diagnostics-A_8Kp-48.js +116 -0
- package/dist/error-diagnostics-DY5GP47p.js +96 -0
- package/dist/events-7EBoeIPd-A2RUkJi5-BxrICQ17.js +354 -0
- package/dist/events-CRaLy7U3-3PNNp5WZ-Gv9nd0cH.js +214 -0
- package/dist/events-CeChclTf-CX-gD8oy-4aL2j6V-.js +527 -0
- package/dist/feed-DsC7Vws1-M_de2nSK-tKc0Pwo8.js +248 -0
- package/dist/feed-Dyf730Ys-D0HgBba6-BUnCa5gS.js +179 -0
- package/dist/file-C0_aPWSS.js +26 -0
- package/dist/file-metadata-CxDy-E2H.js +58 -0
- package/dist/{files-QRV55OCx.js → files-C7Px8uaC.js} +21 -10
- package/dist/forgejo-BN8ItCfl-Bbn4vhDd.js +2278 -0
- package/dist/{github-CfA5vpJ5.js → github-CPxHtFB7.js} +36 -34
- package/dist/github-DtncTfmv-Du2S8lGF.js +4159 -0
- package/dist/gitlab-BoDm8-BC-xzZsW9eW.js +2530 -0
- package/dist/glob--XcLlcml.js +22 -0
- package/dist/glob--kNYDbfU.js +30 -0
- package/dist/graphql-DG5aJBT3-DceyFYdM-C4saqX37.js +489 -0
- package/dist/host-CFnrTXTK.js +1086 -0
- package/dist/{hosted-C1-tTTTf.js → hosted-acMA5XyL.js} +216 -43
- package/dist/hosted-vercel-blob-DKntsHaf.js +12603 -0
- package/dist/hosted-vercel-blob.d.ts +5 -6
- package/dist/hosted-vercel-blob.js +1 -1
- package/dist/hosted.d.ts +6 -7
- package/dist/hosted.js +1 -1
- package/dist/index.d.ts +76 -64
- package/dist/index.js +162 -457
- package/dist/inspect-BoObD2cJ.js +167 -0
- package/dist/internal/path.d.ts +2 -0
- package/dist/internal/path.js +2 -0
- package/dist/lifecycle-BwZ7c9hb.js +596 -0
- package/dist/loader.d.ts +5 -6
- package/dist/loader.js +3 -2
- package/dist/mcp-resources-BREFCmtn.js +39 -0
- package/dist/memory-BbwOqDXl.js +248 -0
- package/dist/metadata-target-DZEZQGHA.js +1588 -0
- package/dist/mountx.d.ts +4 -6
- package/dist/mountx.js +10 -8
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +1 -1
- package/dist/nuxt.d.ts +13 -12
- package/dist/nuxt.js +10 -8
- package/dist/operations-BcpWr41m.js +159 -0
- package/dist/operations-CGqY1XeG.js +965 -0
- package/dist/operations-DnOwKsJT.d.ts +136 -0
- package/dist/operations.d.ts +53 -0
- package/dist/operations.js +2 -0
- package/dist/{path-CNI6wKIU.js → path-CNAwN7pw.js} +34 -35
- package/dist/path-DrSIenjj.js +59 -0
- package/dist/path-zHxQUbqa.d.ts +9 -0
- package/dist/plugins-DqQ8b4T5.d.ts +10 -0
- package/dist/provider-kXjfli9u.js +1457 -0
- package/dist/providers/github/store.d.ts +3 -5
- package/dist/providers/github/store.js +1 -1
- package/dist/registry-Bp-8UUfG.js +129 -0
- package/dist/{registry-BIQVCBWI.d.ts → registry-Cg1TJVVZ.d.ts} +3 -4
- package/dist/{request-execution-u9mgUXKX.js → request-execution-Dk9rY-Yh.js} +24 -20
- package/dist/rolldown-runtime-B4iAMlE-.js +35 -0
- package/dist/runtime/assets.d.ts +3 -5
- package/dist/runtime/assets.js +9 -6
- package/dist/runtime/empty-assets-registry.d.ts +1 -2
- package/dist/runtime/empty-registry.d.ts +1 -2
- package/dist/runtime/state.d.ts +4 -4
- package/dist/runtime/state.js +10 -7
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +84 -15
- package/dist/runtime.js +561 -108
- package/dist/{search-C4REyHj9.js → search-CrTmXj5h.js} +10 -9
- package/dist/server-BNQ-Nbjj.js +290 -0
- package/dist/server.d.ts +22 -34
- package/dist/server.js +2 -355
- package/dist/shared-DalXdP0i.js +2158 -0
- package/dist/source-metadata.d.ts +7 -1
- package/dist/source-metadata.js +34 -2
- package/dist/{state-TTqa3x3Y.d.ts → state-B8zbLi5t.d.ts} +14 -13
- package/dist/store-CXgmu-uw.js +1729 -0
- package/dist/{sync-DiuDmSGk.js → sync-CN6ec-5M.js} +62 -41
- package/dist/templates-Bn8a-pd2-D9DhJEVD-CBfXNRzz.js +125 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/token-CO62GglH.js +61 -0
- package/dist/{types-60Yn149G.d.ts → types-DeK9GIxy.d.ts} +348 -49
- package/dist/{use-CsV3oIxH.js → use-BQj7nSz6.js} +200 -45
- package/dist/{use-CUFSnFCS.d.ts → use-DhwhbAVV.d.ts} +34 -12
- package/dist/utils-Blrh4N2n.js +545 -0
- package/dist/vite-BEvgU2GY.js +20909 -0
- package/dist/vite-CcZmMQ7S.d.ts +476 -0
- package/dist/vite.d.ts +2 -50
- package/dist/vite.js +2 -2
- package/dist/webhooks-DgHwxxYz-D1V2LOr1-azofFOiP.js +1565 -0
- package/dist/workspace-6pxkOuxr.js +1286 -0
- package/dist/workspace-BWJQBK1u.d.ts +7 -0
- package/package.json +90 -59
- package/dist/chunk-8H4AJuhK.js +0 -14
- 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-CDoyls2X.js +0 -30
- package/dist/config-CZLO0m9h.js +0 -7811
- package/dist/file-CHfsZpso.js +0 -23
- package/dist/glob-D0vD_wRY.js +0 -17
- package/dist/host-CAnbugpI.js +0 -370
- package/dist/hosted-vercel-blob-CWBILDVo.js +0 -257
- package/dist/lifecycle-BYoa9hVb.js +0 -176
- package/dist/provider-C3_elpEh.js +0 -599
- package/dist/publish.d.ts +0 -35
- package/dist/publish.js +0 -112
- package/dist/registry-CqyDTW9Y.js +0 -74
- package/dist/runtime-options-BsPSv5O7.js +0 -13
- package/dist/shared-jfogBrd5.js +0 -273
- package/dist/store-Bs1SLh55.js +0 -414
- package/dist/vite-tbfDxtlu.js +0 -2191
- package/dist/workspace-66SKyiec.d.ts +0 -6
- package/dist/workspace-C4k92Ow8.js +0 -1460
|
@@ -1,40 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
+
import { d as withWorkspaceRuntimeOptions, f as prepareWorkspaceSource, p as resolveGitHubIgnore } from "./config-B7dmzDX3.js";
|
|
3
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-DY5GP47p.js";
|
|
4
|
+
import { C as forgeEnv, f as readGitHubEnvToken, w as readForgeEnv } from "./shared-DalXdP0i.js";
|
|
5
|
+
import { github } from "@vite-hub/source/github";
|
|
5
6
|
//#region src/env.ts
|
|
6
7
|
let viteLoadEnv;
|
|
8
|
+
const viteModuleId = "vite";
|
|
7
9
|
async function resolveWorkspaceEnv(rootDir, name) {
|
|
8
|
-
return (await
|
|
9
|
-
}
|
|
10
|
-
async function loadWorkspaceEnv(rootDir) {
|
|
11
|
-
return await loadViteEnv(rootDir);
|
|
10
|
+
return (await loadViteEnv(rootDir))?.[name];
|
|
12
11
|
}
|
|
13
12
|
async function loadViteEnv(rootDir) {
|
|
14
13
|
if (viteLoadEnv === null) return;
|
|
15
14
|
if (!viteLoadEnv) try {
|
|
16
|
-
|
|
15
|
+
const candidate = (await import(
|
|
17
16
|
/* @vite-ignore */
|
|
18
|
-
|
|
17
|
+
viteModuleId
|
|
19
18
|
)).loadEnv;
|
|
19
|
+
if (typeof candidate !== "function") {
|
|
20
|
+
viteLoadEnv = null;
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
viteLoadEnv = candidate;
|
|
20
24
|
} catch {
|
|
21
25
|
viteLoadEnv = null;
|
|
22
26
|
return;
|
|
23
27
|
}
|
|
24
|
-
|
|
28
|
+
const loadEnv = viteLoadEnv;
|
|
29
|
+
return loadEnv ? loadEnv("", rootDir, "") : void 0;
|
|
25
30
|
}
|
|
26
31
|
//#endregion
|
|
27
32
|
//#region src/sources/github.ts
|
|
28
33
|
var github_exports = /* @__PURE__ */ __exportAll({ github: () => github$1 });
|
|
29
|
-
const githubTokenEnvNames = [
|
|
30
|
-
"WORKSPACE_GITHUB_TOKEN",
|
|
31
|
-
"VITEHUB_WORKSPACE_GITHUB_TOKEN",
|
|
32
|
-
"GITHUB_TOKEN",
|
|
33
|
-
"GH_TOKEN"
|
|
34
|
-
];
|
|
35
34
|
function github$1(input) {
|
|
36
35
|
if (typeof input === "function") return resolvableGitHubSource(input);
|
|
37
|
-
const
|
|
36
|
+
const options = input;
|
|
37
|
+
const resolvedOptions = {
|
|
38
|
+
...options,
|
|
39
|
+
ignore: resolveGitHubIgnore(options.ignore)
|
|
40
|
+
};
|
|
38
41
|
const baseSource = github({
|
|
39
42
|
...resolvedOptions,
|
|
40
43
|
auth: createGitHubAuthResolver(resolvedOptions.auth)
|
|
@@ -55,14 +58,18 @@ function github$1(input) {
|
|
|
55
58
|
return withWorkspaceRuntimeOptions({
|
|
56
59
|
...baseSource,
|
|
57
60
|
fingerprint: {
|
|
58
|
-
|
|
61
|
+
ignore: resolvedOptions.ignore,
|
|
59
62
|
include: resolvedOptions.include,
|
|
60
63
|
ref: resolvedOptions.ref,
|
|
61
64
|
repo: resolvedOptions.repo,
|
|
62
65
|
root: resolvedOptions.root
|
|
63
66
|
},
|
|
67
|
+
async resolveRevision(ctx) {
|
|
68
|
+
return await (await getSourceForRoot(ctx.rootDir)).resolveRevision?.(ctx);
|
|
69
|
+
},
|
|
64
70
|
async prepare(ctx) {
|
|
65
|
-
|
|
71
|
+
const source = await getSourceForRoot(ctx.rootDir);
|
|
72
|
+
await prepareWorkspaceSource(source, ctx);
|
|
66
73
|
},
|
|
67
74
|
async getKeys(ctx) {
|
|
68
75
|
return await (await getSourceForRoot(ctx.rootDir)).getKeys(ctx);
|
|
@@ -76,9 +83,6 @@ function github$1(input) {
|
|
|
76
83
|
},
|
|
77
84
|
async getMeta(key, ctx) {
|
|
78
85
|
return await (await getSourceForRoot(ctx.rootDir)).getMeta?.(key, ctx);
|
|
79
|
-
},
|
|
80
|
-
async search(query, ctx) {
|
|
81
|
-
return await (await getSourceForRoot(ctx.rootDir)).search?.(query, ctx) ?? [];
|
|
82
86
|
}
|
|
83
87
|
}, resolvedOptions);
|
|
84
88
|
}
|
|
@@ -90,14 +94,11 @@ function resolvableGitHubSource(resolve) {
|
|
|
90
94
|
return [];
|
|
91
95
|
},
|
|
92
96
|
async getItem(key) {
|
|
93
|
-
throw
|
|
97
|
+
throw workspaceErrorDiagnostics.WORKSPACE_R0060({ message: `[vitehub] github() resolver did not resolve before reading ${JSON.stringify(key)}.` });
|
|
94
98
|
},
|
|
95
99
|
async getItems() {
|
|
96
100
|
return [];
|
|
97
101
|
},
|
|
98
|
-
async search() {
|
|
99
|
-
return [];
|
|
100
|
-
},
|
|
101
102
|
async resolve(ctx) {
|
|
102
103
|
const options = await resolve(ctx);
|
|
103
104
|
return options ? github$1(githubResolutionDefaults(options, ctx)) : false;
|
|
@@ -107,7 +108,7 @@ function resolvableGitHubSource(resolve) {
|
|
|
107
108
|
function githubResolutionDefaults(options, ctx) {
|
|
108
109
|
const source = pullRequestSource(ctx.invocation.context.get("pullRequest"));
|
|
109
110
|
const repo = options.repo || source?.repo;
|
|
110
|
-
if (!repo) throw
|
|
111
|
+
if (!repo) throw workspaceErrorDiagnostics.WORKSPACE_R0061({ message: "[vitehub] github() resolver requires repo or typed pullRequest source context." });
|
|
111
112
|
return {
|
|
112
113
|
...options,
|
|
113
114
|
mount: options.mount ?? ctx.source.mountPath,
|
|
@@ -148,21 +149,22 @@ function pullRequestSource(value) {
|
|
|
148
149
|
}
|
|
149
150
|
function createGitHubAuthResolver(auth) {
|
|
150
151
|
if (auth === false) return false;
|
|
151
|
-
return () => {
|
|
152
|
-
return resolveExplicitGitHubAuth(auth) ||
|
|
152
|
+
return async () => {
|
|
153
|
+
return await resolveExplicitGitHubAuth(auth) || readGitHubEnvToken();
|
|
153
154
|
};
|
|
154
155
|
}
|
|
155
156
|
async function resolveGitHubAuth(auth, rootDir) {
|
|
156
157
|
if (auth === false) return false;
|
|
157
|
-
return resolveExplicitGitHubAuth(auth) ||
|
|
158
|
+
return await resolveExplicitGitHubAuth(auth) || readGitHubEnvToken() || await resolveGitHubEnvFileToken(rootDir) || await resolveGitHubCliToken();
|
|
158
159
|
}
|
|
159
|
-
function resolveExplicitGitHubAuth(auth) {
|
|
160
|
+
async function resolveExplicitGitHubAuth(auth) {
|
|
160
161
|
if (auth === false) return void 0;
|
|
161
|
-
if (typeof auth === "function") return auth();
|
|
162
|
+
if (typeof auth === "function") return await auth();
|
|
162
163
|
return typeof auth === "string" ? auth : void 0;
|
|
163
164
|
}
|
|
164
165
|
async function resolveGitHubEnvFileToken(rootDir) {
|
|
165
|
-
|
|
166
|
+
const env = Object.fromEntries(await Promise.all(forgeEnv.github.token.names.map(async (name) => [name, await resolveWorkspaceEnv(rootDir, name)])));
|
|
167
|
+
return readForgeEnv(forgeEnv.github.token, env);
|
|
166
168
|
}
|
|
167
169
|
async function resolveGitHubCliToken() {
|
|
168
170
|
try {
|