vite-hub 0.0.1 → 0.0.3
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 +95 -3
- package/dist/_internal/agent/cloudflare/state.d.ts +1 -0
- package/dist/_internal/agent/cloudflare/state.js +2 -0
- package/dist/_internal/agent/cloudflare.d.ts +1 -0
- package/dist/_internal/agent/cloudflare.js +2 -0
- package/dist/_internal/agent/runtime/workflow.d.ts +1 -0
- package/dist/_internal/agent/runtime/workflow.js +2 -0
- package/dist/_internal/agent/server/internal.d.ts +1 -0
- package/dist/_internal/agent/server/internal.js +2 -0
- package/dist/_internal/agent/server/workspace.d.ts +1 -0
- package/dist/_internal/agent/server/workspace.js +2 -0
- package/dist/_internal/agent/server.d.ts +1 -0
- package/dist/_internal/agent/server.js +2 -0
- package/dist/_internal/agent/state/sqlite.d.ts +1 -0
- package/dist/_internal/agent/state/sqlite.js +2 -0
- package/dist/_internal/agent.d.ts +1 -0
- package/dist/_internal/agent.js +2 -0
- package/dist/_internal/blob/runtime/state.d.ts +1 -0
- package/dist/_internal/blob/runtime/state.js +2 -0
- package/dist/_internal/blob.d.ts +1 -0
- package/dist/_internal/blob.js +2 -0
- package/dist/_internal/kv/runtime/disabled-upstash.d.ts +4 -0
- package/dist/_internal/kv/runtime/disabled-upstash.js +6 -0
- package/dist/_internal/kv.d.ts +1 -0
- package/dist/_internal/kv.js +2 -0
- package/dist/_internal/markdown-template.d.ts +2 -0
- package/dist/_internal/markdown-template.js +2 -0
- package/dist/_internal/rate-limit/runtime.d.ts +1 -0
- package/dist/_internal/rate-limit/runtime.js +2 -0
- package/dist/_internal/sandbox/runtime/state.d.ts +1 -0
- package/dist/_internal/sandbox/runtime/state.js +2 -0
- package/dist/_internal/schedule/runtime/driver.d.ts +1 -0
- package/dist/_internal/schedule/runtime/driver.js +2 -0
- package/dist/_internal/schedule/runtime/process.d.ts +1 -0
- package/dist/_internal/schedule/runtime/process.js +2 -0
- package/dist/_internal/schedule/runtime/static.d.ts +1 -0
- package/dist/_internal/schedule/runtime/static.js +2 -0
- package/dist/_internal/schedule/runtime.d.ts +1 -0
- package/dist/_internal/schedule/runtime.js +2 -0
- package/dist/_internal/schedule.d.ts +1 -0
- package/dist/_internal/schedule.js +2 -0
- package/dist/_internal/workflow/runtime/execute.d.ts +1 -0
- package/dist/_internal/workflow/runtime/execute.js +2 -0
- package/dist/_internal/workflow/runtime/state.d.ts +1 -0
- package/dist/_internal/workflow/runtime/state.js +2 -0
- package/dist/_internal/workflow.d.ts +1 -0
- package/dist/_internal/workflow.js +2 -0
- package/dist/_internal/workspace/internal/runtime/hosted-vercel-blob.d.ts +1 -0
- package/dist/_internal/workspace/internal/runtime/hosted-vercel-blob.js +2 -0
- package/dist/_internal/workspace/internal/runtime/hosted.d.ts +1 -0
- package/dist/_internal/workspace/internal/runtime/hosted.js +2 -0
- package/dist/_internal/workspace/internal/runtime/state.d.ts +1 -0
- package/dist/_internal/workspace/internal/runtime/state.js +2 -0
- package/dist/_internal/workspace/runtime.d.ts +1 -0
- package/dist/_internal/workspace/runtime.js +2 -0
- package/dist/_internal/workspace.d.ts +1 -0
- package/dist/_internal/workspace.js +2 -0
- package/dist/agent/capabilities.d.ts +1 -0
- package/dist/agent/capabilities.js +2 -0
- package/dist/agent/channels.d.ts +1 -0
- package/dist/agent/channels.js +2 -0
- package/dist/agent/cloudflare.d.ts +1 -0
- package/dist/agent/cloudflare.js +2 -0
- package/dist/agent/eval.d.ts +1 -0
- package/dist/agent/eval.js +2 -0
- package/dist/agent/harness/local-sandbox.d.ts +1 -0
- package/dist/agent/harness/local-sandbox.js +2 -0
- package/dist/agent/server.d.ts +1 -0
- package/dist/agent/server.js +2 -0
- package/dist/agent/state/sqlite.d.ts +1 -0
- package/dist/agent/state/sqlite.js +2 -0
- package/dist/agent.d.ts +1 -0
- package/dist/agent.js +2 -0
- package/dist/auth/agent.d.ts +1 -0
- package/dist/auth/agent.js +2 -0
- package/dist/auth/server.d.ts +3 -0
- package/dist/auth/server.js +3 -0
- package/dist/auth.d.ts +1 -0
- package/dist/auth.js +2 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +12 -0
- package/dist/blob/content-type.d.ts +1 -0
- package/dist/blob/content-type.js +2 -0
- package/dist/blob.d.ts +1 -0
- package/dist/blob.js +2 -0
- package/dist/box.d.ts +1 -0
- package/dist/box.js +2 -0
- package/dist/browser/controllers/cdp.d.ts +1 -0
- package/dist/browser/controllers/cdp.js +2 -0
- package/dist/browser/controllers/playwright.d.ts +1 -0
- package/dist/browser/controllers/playwright.js +2 -0
- package/dist/browser/providers/cloudflare.d.ts +1 -0
- package/dist/browser/providers/cloudflare.js +2 -0
- package/dist/browser/providers/local.d.ts +1 -0
- package/dist/browser/providers/local.js +2 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +2 -0
- package/dist/database/drizzle.d.ts +1 -0
- package/dist/database/drizzle.js +2 -0
- package/dist/database.d.ts +1 -0
- package/dist/database.js +2 -0
- package/dist/email/drivers/smtp.d.ts +1 -0
- package/dist/email/drivers/smtp.js +2 -0
- package/dist/email/markdown.d.ts +1 -0
- package/dist/email/markdown.js +2 -0
- package/dist/email/server.d.ts +1 -0
- package/dist/email/server.js +2 -0
- package/dist/email.d.ts +1 -0
- package/dist/email.js +2 -0
- package/dist/env/presets.d.ts +1 -0
- package/dist/env/presets.js +2 -0
- package/dist/env/schema.d.ts +1 -0
- package/dist/env/schema.js +2 -0
- package/dist/env/secret.d.ts +1 -0
- package/dist/env/secret.js +2 -0
- package/dist/env/server.d.ts +1 -0
- package/dist/env/server.js +2 -0
- package/dist/env.d.ts +1 -0
- package/dist/env.js +2 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +2 -0
- package/dist/kv.d.ts +1 -0
- package/dist/kv.js +2 -0
- package/dist/markdown-template.d.ts +1 -0
- package/dist/markdown-template.js +2 -0
- package/dist/nuxt.d.ts +18 -0
- package/dist/nuxt.js +83 -0
- package/dist/queue.d.ts +1 -0
- package/dist/queue.js +2 -0
- package/dist/rate-limit.d.ts +1 -0
- package/dist/rate-limit.js +2 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +2 -0
- package/dist/sandbox.d.ts +1 -0
- package/dist/sandbox.js +2 -0
- package/dist/schedule/runtime/driver.d.ts +1 -0
- package/dist/schedule/runtime/driver.js +2 -0
- package/dist/schedule/runtime/process.d.ts +1 -0
- package/dist/schedule/runtime/process.js +2 -0
- package/dist/schedule/runtime.d.ts +1 -0
- package/dist/schedule/runtime.js +2 -0
- package/dist/schedule.d.ts +1 -0
- package/dist/schedule.js +2 -0
- package/dist/shell/providers/cloudflare.d.ts +1 -0
- package/dist/shell/providers/cloudflare.js +2 -0
- package/dist/shell/providers/just-bash.d.ts +1 -0
- package/dist/shell/providers/just-bash.js +2 -0
- package/dist/shell/workspace.d.ts +1 -0
- package/dist/shell/workspace.js +2 -0
- package/dist/shell.d.ts +1 -0
- package/dist/shell.js +2 -0
- package/dist/source.d.ts +1 -0
- package/dist/source.js +2 -0
- package/dist/src-o6zB-soj.js +1135 -0
- package/dist/workflow.d.ts +1 -0
- package/dist/workflow.js +2 -0
- package/dist/workspace/cloudflare.d.ts +1 -0
- package/dist/workspace/cloudflare.js +2 -0
- package/dist/workspace/collections/client.d.ts +1 -0
- package/dist/workspace/collections/client.js +2 -0
- package/dist/workspace/collections.d.ts +1 -0
- package/dist/workspace/collections.js +2 -0
- package/dist/workspace/loader.d.ts +1 -0
- package/dist/workspace/loader.js +2 -0
- package/dist/workspace/publish.d.ts +1 -0
- package/dist/workspace/publish.js +2 -0
- package/dist/workspace/runtime.d.ts +1 -0
- package/dist/workspace/runtime.js +2 -0
- package/dist/workspace/server.d.ts +1 -0
- package/dist/workspace/server.js +2 -0
- package/dist/workspace.d.ts +1 -0
- package/dist/workspace.js +2 -0
- package/package.json +181 -15
- package/tsconfig.json +3 -0
- package/bin/vite-hub.js +0 -15
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import "@vite-hub/env/vite";
|
|
2
|
+
import { AgentModuleOptions } from "@vite-hub/agent";
|
|
3
|
+
import { BlobModuleOptions } from "@vite-hub/blob";
|
|
4
|
+
import { KVModuleOptions } from "@vite-hub/kv";
|
|
5
|
+
import { WorkflowModuleOptions } from "@vite-hub/workflow";
|
|
6
|
+
import { WorkspaceModuleOptions } from "@vite-hub/workspace";
|
|
7
|
+
import { AuthModuleOptions } from "@vite-hub/auth";
|
|
8
|
+
import { DBModulePublicOptions } from "@vite-hub/database";
|
|
9
|
+
import { EnvIntegrationOptions } from "@vite-hub/env";
|
|
10
|
+
import { BrowserModuleOptions } from "@vite-hub/browser/vite";
|
|
11
|
+
import { EmailVitePluginOptions } from "@vite-hub/email/vite";
|
|
12
|
+
import { ScheduleVitePluginOptions } from "@vite-hub/schedule/vite";
|
|
13
|
+
import { PluginOption } from "vite";
|
|
14
|
+
|
|
15
|
+
//#region src/index.d.ts
|
|
16
|
+
interface ViteHubOptions {
|
|
17
|
+
preset: DeploymentPreset;
|
|
18
|
+
name?: string;
|
|
19
|
+
agent?: boolean | AgentModuleOptions;
|
|
20
|
+
auth?: true | AuthModuleOptions;
|
|
21
|
+
blob?: boolean | BlobModuleOptions;
|
|
22
|
+
browser?: boolean | BrowserModuleOptions;
|
|
23
|
+
database?: boolean | DBModulePublicOptions;
|
|
24
|
+
email?: boolean | EmailVitePluginOptions;
|
|
25
|
+
env?: false | EnvIntegrationOptions;
|
|
26
|
+
kv?: boolean | KVModuleOptions;
|
|
27
|
+
queue?: boolean;
|
|
28
|
+
rateLimit?: boolean;
|
|
29
|
+
sandbox?: boolean;
|
|
30
|
+
schedule?: boolean | ScheduleVitePluginOptions;
|
|
31
|
+
workflow?: boolean | WorkflowModuleOptions;
|
|
32
|
+
workspace?: boolean | WorkspaceModuleOptions;
|
|
33
|
+
}
|
|
34
|
+
type DeploymentPreset = "cloudflare" | "deno" | "netlify" | "node" | "vercel";
|
|
35
|
+
interface ViteHubConfig {
|
|
36
|
+
preset?: DeploymentPreset;
|
|
37
|
+
}
|
|
38
|
+
declare function vitehub(options: ViteHubOptions): PluginOption[];
|
|
39
|
+
declare module "vite" {
|
|
40
|
+
interface UserConfig {
|
|
41
|
+
vitehub?: ViteHubConfig;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { DeploymentPreset, ViteHubConfig, ViteHubOptions, vitehub };
|
package/dist/index.js
ADDED
package/dist/kv.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/kv";
|
package/dist/kv.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/markdown-template";
|
package/dist/nuxt.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { vitehub } from "./index.js";
|
|
2
|
+
import { UserConfig } from "vite";
|
|
3
|
+
|
|
4
|
+
//#region src/nuxt.d.ts
|
|
5
|
+
type NuxtLike = {
|
|
6
|
+
hook?: (name: "nitro:config", callback: (config: Record<string, unknown>) => Promise<void>) => void;
|
|
7
|
+
options: {
|
|
8
|
+
alias?: Record<string, string>;
|
|
9
|
+
dev?: boolean;
|
|
10
|
+
rootDir?: string;
|
|
11
|
+
serverDir?: string;
|
|
12
|
+
srcDir?: string;
|
|
13
|
+
vite?: UserConfig;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
declare function viteHubNuxtModule(options: Parameters<typeof vitehub>[0], nuxt?: NuxtLike): Promise<void>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { viteHubNuxtModule as default };
|
package/dist/nuxt.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { n as VITEHUB_NITRO_CONFIG_CONTEXT, r as VITEHUB_SERVER_DIRS, t as vitehub } from "./src-o6zB-soj.js";
|
|
2
|
+
import { hubDb } from "@vite-hub/database/nuxt";
|
|
3
|
+
import { mergeConfig } from "vite";
|
|
4
|
+
//#region src/nuxt.ts
|
|
5
|
+
function flattenPlugins(options) {
|
|
6
|
+
const plugins = [];
|
|
7
|
+
for (const option of options) if (Array.isArray(option)) plugins.push(...flattenPlugins(option));
|
|
8
|
+
else if (option && typeof option === "object" && "name" in option) plugins.push(option);
|
|
9
|
+
return plugins;
|
|
10
|
+
}
|
|
11
|
+
function configHandler(plugin) {
|
|
12
|
+
if (typeof plugin.config === "function") return plugin.config;
|
|
13
|
+
return plugin.config?.handler;
|
|
14
|
+
}
|
|
15
|
+
function queueNitroConfigHandler(plugin) {
|
|
16
|
+
return plugin.vitehub?.queue?.createNitroConfig;
|
|
17
|
+
}
|
|
18
|
+
function withoutDeploymentOutput(options) {
|
|
19
|
+
return options.flatMap((option) => {
|
|
20
|
+
if (Array.isArray(option)) return [withoutDeploymentOutput(option)];
|
|
21
|
+
if (option && typeof option === "object" && "name" in option && option.name === "vite-hub/deployment-output") return [];
|
|
22
|
+
return [option];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async function applyNitroConfig(plugins, nitroConfig, nuxt) {
|
|
26
|
+
const environment = {
|
|
27
|
+
command: nuxt.options.dev ? "serve" : "build",
|
|
28
|
+
isPreview: false,
|
|
29
|
+
isSsrBuild: true,
|
|
30
|
+
mode: nuxt.options.dev ? "development" : "production"
|
|
31
|
+
};
|
|
32
|
+
const serverDirs = nuxt.options.serverDir ? [nuxt.options.serverDir] : void 0;
|
|
33
|
+
let config = mergeConfig({
|
|
34
|
+
resolve: { alias: nuxt.options.alias },
|
|
35
|
+
root: nuxt.options.srcDir || nuxt.options.rootDir || process.cwd()
|
|
36
|
+
}, nuxt.options.vite ?? {});
|
|
37
|
+
config[VITEHUB_NITRO_CONFIG_CONTEXT] = true;
|
|
38
|
+
if (serverDirs) config[VITEHUB_SERVER_DIRS] = serverDirs;
|
|
39
|
+
config.build ??= {};
|
|
40
|
+
config.nitro = nitroConfig;
|
|
41
|
+
config.server ??= {};
|
|
42
|
+
for (const plugin of plugins) {
|
|
43
|
+
const handler = configHandler(plugin);
|
|
44
|
+
if (handler) {
|
|
45
|
+
const result = await handler.call({}, config, environment);
|
|
46
|
+
if (result) {
|
|
47
|
+
const { nitro, ...viteConfig } = result;
|
|
48
|
+
config = mergeConfig(config, viteConfig);
|
|
49
|
+
if (nitro) config.nitro = nitro;
|
|
50
|
+
config[VITEHUB_NITRO_CONFIG_CONTEXT] = true;
|
|
51
|
+
if (serverDirs) config[VITEHUB_SERVER_DIRS] = serverDirs;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const createQueueNitroConfig = queueNitroConfigHandler(plugin);
|
|
55
|
+
if (createQueueNitroConfig) {
|
|
56
|
+
const projectRoot = nuxt.options.rootDir || process.cwd();
|
|
57
|
+
config.nitro = await createQueueNitroConfig({
|
|
58
|
+
nitro: config.nitro || {},
|
|
59
|
+
projectRoot,
|
|
60
|
+
root: nuxt.options.srcDir || projectRoot,
|
|
61
|
+
serverDirs: nuxt.options.serverDir ? [nuxt.options.serverDir] : void 0
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (config.nitro) Object.assign(nitroConfig, config.nitro);
|
|
66
|
+
}
|
|
67
|
+
async function viteHubNuxtModule(options, nuxt) {
|
|
68
|
+
if (!nuxt) return;
|
|
69
|
+
const plugins = flattenPlugins(vitehub(options)).filter((plugin) => plugin.name !== "vite-hub/deployment-output");
|
|
70
|
+
const existing = withoutDeploymentOutput(Array.isArray(nuxt.options.vite?.plugins) ? nuxt.options.vite.plugins : []);
|
|
71
|
+
const existingNames = new Set(flattenPlugins(existing).map((plugin) => plugin.name).filter(Boolean));
|
|
72
|
+
const existingPluginsByName = new Map(flattenPlugins(existing).filter((plugin) => plugin.name).map((plugin) => [plugin.name, plugin]));
|
|
73
|
+
const installedPlugins = [...plugins.map((plugin) => existingPluginsByName.get(plugin.name) || plugin), ...flattenPlugins(existing).filter((plugin) => (plugin.name.startsWith("@vite-hub/") || plugin.name.startsWith("vite-hub/")) && !plugins.some((candidate) => candidate.name === plugin.name))];
|
|
74
|
+
nuxt.options.vite ??= {};
|
|
75
|
+
const viteConfig = nuxt.options.vite;
|
|
76
|
+
viteConfig[VITEHUB_NITRO_CONFIG_CONTEXT] = true;
|
|
77
|
+
if (nuxt.options.serverDir) viteConfig[VITEHUB_SERVER_DIRS] = [nuxt.options.serverDir];
|
|
78
|
+
nuxt.options.vite.plugins = [...plugins.filter((plugin) => !existingNames.has(plugin.name)), ...existing];
|
|
79
|
+
nuxt.hook?.("nitro:config", (config) => applyNitroConfig(installedPlugins, config, nuxt));
|
|
80
|
+
if (options.database) await hubDb(options.database === true ? {} : options.database)(void 0, nuxt);
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { viteHubNuxtModule as default };
|
package/dist/queue.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/queue";
|
package/dist/queue.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/rate-limit";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/runtime";
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/sandbox";
|
package/dist/sandbox.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/schedule/runtime/driver";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/schedule/runtime/process";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/schedule/runtime";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/schedule";
|
package/dist/schedule.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/shell/providers/cloudflare";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/shell/providers/just-bash";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/shell/workspace";
|
package/dist/shell.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/shell";
|
package/dist/shell.js
ADDED
package/dist/source.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@vite-hub/source";
|
package/dist/source.js
ADDED