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.
Files changed (175) hide show
  1. package/README.md +95 -3
  2. package/dist/_internal/agent/cloudflare/state.d.ts +1 -0
  3. package/dist/_internal/agent/cloudflare/state.js +2 -0
  4. package/dist/_internal/agent/cloudflare.d.ts +1 -0
  5. package/dist/_internal/agent/cloudflare.js +2 -0
  6. package/dist/_internal/agent/runtime/workflow.d.ts +1 -0
  7. package/dist/_internal/agent/runtime/workflow.js +2 -0
  8. package/dist/_internal/agent/server/internal.d.ts +1 -0
  9. package/dist/_internal/agent/server/internal.js +2 -0
  10. package/dist/_internal/agent/server/workspace.d.ts +1 -0
  11. package/dist/_internal/agent/server/workspace.js +2 -0
  12. package/dist/_internal/agent/server.d.ts +1 -0
  13. package/dist/_internal/agent/server.js +2 -0
  14. package/dist/_internal/agent/state/sqlite.d.ts +1 -0
  15. package/dist/_internal/agent/state/sqlite.js +2 -0
  16. package/dist/_internal/agent.d.ts +1 -0
  17. package/dist/_internal/agent.js +2 -0
  18. package/dist/_internal/blob/runtime/state.d.ts +1 -0
  19. package/dist/_internal/blob/runtime/state.js +2 -0
  20. package/dist/_internal/blob.d.ts +1 -0
  21. package/dist/_internal/blob.js +2 -0
  22. package/dist/_internal/kv/runtime/disabled-upstash.d.ts +4 -0
  23. package/dist/_internal/kv/runtime/disabled-upstash.js +6 -0
  24. package/dist/_internal/kv.d.ts +1 -0
  25. package/dist/_internal/kv.js +2 -0
  26. package/dist/_internal/markdown-template.d.ts +2 -0
  27. package/dist/_internal/markdown-template.js +2 -0
  28. package/dist/_internal/rate-limit/runtime.d.ts +1 -0
  29. package/dist/_internal/rate-limit/runtime.js +2 -0
  30. package/dist/_internal/sandbox/runtime/state.d.ts +1 -0
  31. package/dist/_internal/sandbox/runtime/state.js +2 -0
  32. package/dist/_internal/schedule/runtime/driver.d.ts +1 -0
  33. package/dist/_internal/schedule/runtime/driver.js +2 -0
  34. package/dist/_internal/schedule/runtime/process.d.ts +1 -0
  35. package/dist/_internal/schedule/runtime/process.js +2 -0
  36. package/dist/_internal/schedule/runtime/static.d.ts +1 -0
  37. package/dist/_internal/schedule/runtime/static.js +2 -0
  38. package/dist/_internal/schedule/runtime.d.ts +1 -0
  39. package/dist/_internal/schedule/runtime.js +2 -0
  40. package/dist/_internal/schedule.d.ts +1 -0
  41. package/dist/_internal/schedule.js +2 -0
  42. package/dist/_internal/workflow/runtime/execute.d.ts +1 -0
  43. package/dist/_internal/workflow/runtime/execute.js +2 -0
  44. package/dist/_internal/workflow/runtime/state.d.ts +1 -0
  45. package/dist/_internal/workflow/runtime/state.js +2 -0
  46. package/dist/_internal/workflow.d.ts +1 -0
  47. package/dist/_internal/workflow.js +2 -0
  48. package/dist/_internal/workspace/internal/runtime/hosted-vercel-blob.d.ts +1 -0
  49. package/dist/_internal/workspace/internal/runtime/hosted-vercel-blob.js +2 -0
  50. package/dist/_internal/workspace/internal/runtime/hosted.d.ts +1 -0
  51. package/dist/_internal/workspace/internal/runtime/hosted.js +2 -0
  52. package/dist/_internal/workspace/internal/runtime/state.d.ts +1 -0
  53. package/dist/_internal/workspace/internal/runtime/state.js +2 -0
  54. package/dist/_internal/workspace/runtime.d.ts +1 -0
  55. package/dist/_internal/workspace/runtime.js +2 -0
  56. package/dist/_internal/workspace.d.ts +1 -0
  57. package/dist/_internal/workspace.js +2 -0
  58. package/dist/agent/capabilities.d.ts +1 -0
  59. package/dist/agent/capabilities.js +2 -0
  60. package/dist/agent/channels.d.ts +1 -0
  61. package/dist/agent/channels.js +2 -0
  62. package/dist/agent/cloudflare.d.ts +1 -0
  63. package/dist/agent/cloudflare.js +2 -0
  64. package/dist/agent/eval.d.ts +1 -0
  65. package/dist/agent/eval.js +2 -0
  66. package/dist/agent/harness/local-sandbox.d.ts +1 -0
  67. package/dist/agent/harness/local-sandbox.js +2 -0
  68. package/dist/agent/server.d.ts +1 -0
  69. package/dist/agent/server.js +2 -0
  70. package/dist/agent/state/sqlite.d.ts +1 -0
  71. package/dist/agent/state/sqlite.js +2 -0
  72. package/dist/agent.d.ts +1 -0
  73. package/dist/agent.js +2 -0
  74. package/dist/auth/agent.d.ts +1 -0
  75. package/dist/auth/agent.js +2 -0
  76. package/dist/auth/server.d.ts +3 -0
  77. package/dist/auth/server.js +3 -0
  78. package/dist/auth.d.ts +1 -0
  79. package/dist/auth.js +2 -0
  80. package/dist/bin.d.ts +1 -0
  81. package/dist/bin.js +12 -0
  82. package/dist/blob/content-type.d.ts +1 -0
  83. package/dist/blob/content-type.js +2 -0
  84. package/dist/blob.d.ts +1 -0
  85. package/dist/blob.js +2 -0
  86. package/dist/box.d.ts +1 -0
  87. package/dist/box.js +2 -0
  88. package/dist/browser/controllers/cdp.d.ts +1 -0
  89. package/dist/browser/controllers/cdp.js +2 -0
  90. package/dist/browser/controllers/playwright.d.ts +1 -0
  91. package/dist/browser/controllers/playwright.js +2 -0
  92. package/dist/browser/providers/cloudflare.d.ts +1 -0
  93. package/dist/browser/providers/cloudflare.js +2 -0
  94. package/dist/browser/providers/local.d.ts +1 -0
  95. package/dist/browser/providers/local.js +2 -0
  96. package/dist/browser.d.ts +1 -0
  97. package/dist/browser.js +2 -0
  98. package/dist/database/drizzle.d.ts +1 -0
  99. package/dist/database/drizzle.js +2 -0
  100. package/dist/database.d.ts +1 -0
  101. package/dist/database.js +2 -0
  102. package/dist/email/drivers/smtp.d.ts +1 -0
  103. package/dist/email/drivers/smtp.js +2 -0
  104. package/dist/email/markdown.d.ts +1 -0
  105. package/dist/email/markdown.js +2 -0
  106. package/dist/email/server.d.ts +1 -0
  107. package/dist/email/server.js +2 -0
  108. package/dist/email.d.ts +1 -0
  109. package/dist/email.js +2 -0
  110. package/dist/env/presets.d.ts +1 -0
  111. package/dist/env/presets.js +2 -0
  112. package/dist/env/schema.d.ts +1 -0
  113. package/dist/env/schema.js +2 -0
  114. package/dist/env/secret.d.ts +1 -0
  115. package/dist/env/secret.js +2 -0
  116. package/dist/env/server.d.ts +1 -0
  117. package/dist/env/server.js +2 -0
  118. package/dist/env.d.ts +1 -0
  119. package/dist/env.js +2 -0
  120. package/dist/index.d.ts +45 -0
  121. package/dist/index.js +2 -0
  122. package/dist/kv.d.ts +1 -0
  123. package/dist/kv.js +2 -0
  124. package/dist/markdown-template.d.ts +1 -0
  125. package/dist/markdown-template.js +2 -0
  126. package/dist/nuxt.d.ts +18 -0
  127. package/dist/nuxt.js +83 -0
  128. package/dist/queue.d.ts +1 -0
  129. package/dist/queue.js +2 -0
  130. package/dist/rate-limit.d.ts +1 -0
  131. package/dist/rate-limit.js +2 -0
  132. package/dist/runtime.d.ts +1 -0
  133. package/dist/runtime.js +2 -0
  134. package/dist/sandbox.d.ts +1 -0
  135. package/dist/sandbox.js +2 -0
  136. package/dist/schedule/runtime/driver.d.ts +1 -0
  137. package/dist/schedule/runtime/driver.js +2 -0
  138. package/dist/schedule/runtime/process.d.ts +1 -0
  139. package/dist/schedule/runtime/process.js +2 -0
  140. package/dist/schedule/runtime.d.ts +1 -0
  141. package/dist/schedule/runtime.js +2 -0
  142. package/dist/schedule.d.ts +1 -0
  143. package/dist/schedule.js +2 -0
  144. package/dist/shell/providers/cloudflare.d.ts +1 -0
  145. package/dist/shell/providers/cloudflare.js +2 -0
  146. package/dist/shell/providers/just-bash.d.ts +1 -0
  147. package/dist/shell/providers/just-bash.js +2 -0
  148. package/dist/shell/workspace.d.ts +1 -0
  149. package/dist/shell/workspace.js +2 -0
  150. package/dist/shell.d.ts +1 -0
  151. package/dist/shell.js +2 -0
  152. package/dist/source.d.ts +1 -0
  153. package/dist/source.js +2 -0
  154. package/dist/src-o6zB-soj.js +1135 -0
  155. package/dist/workflow.d.ts +1 -0
  156. package/dist/workflow.js +2 -0
  157. package/dist/workspace/cloudflare.d.ts +1 -0
  158. package/dist/workspace/cloudflare.js +2 -0
  159. package/dist/workspace/collections/client.d.ts +1 -0
  160. package/dist/workspace/collections/client.js +2 -0
  161. package/dist/workspace/collections.d.ts +1 -0
  162. package/dist/workspace/collections.js +2 -0
  163. package/dist/workspace/loader.d.ts +1 -0
  164. package/dist/workspace/loader.js +2 -0
  165. package/dist/workspace/publish.d.ts +1 -0
  166. package/dist/workspace/publish.js +2 -0
  167. package/dist/workspace/runtime.d.ts +1 -0
  168. package/dist/workspace/runtime.js +2 -0
  169. package/dist/workspace/server.d.ts +1 -0
  170. package/dist/workspace/server.js +2 -0
  171. package/dist/workspace.d.ts +1 -0
  172. package/dist/workspace.js +2 -0
  173. package/package.json +181 -15
  174. package/tsconfig.json +3 -0
  175. package/bin/vite-hub.js +0 -15
@@ -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
@@ -0,0 +1,2 @@
1
+ import { t as vitehub } from "./src-o6zB-soj.js";
2
+ export { vitehub };
package/dist/kv.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/kv";
package/dist/kv.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/kv";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/markdown-template";
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/markdown-template";
2
+ export {};
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 };
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/queue";
package/dist/queue.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/queue";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/rate-limit";
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/rate-limit";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/runtime";
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/runtime";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/sandbox";
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/sandbox";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/schedule/runtime/driver";
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/schedule/runtime/driver";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/schedule/runtime/process";
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/schedule/runtime/process";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/schedule/runtime";
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/schedule/runtime";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/schedule";
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/schedule";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/shell/providers/cloudflare";
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/shell/providers/cloudflare";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/shell/providers/just-bash";
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/shell/providers/just-bash";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/shell/workspace";
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/shell/workspace";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/shell";
package/dist/shell.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/shell";
2
+ export {};
@@ -0,0 +1 @@
1
+ export * from "@vite-hub/source";
package/dist/source.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "@vite-hub/source";
2
+ export {};