@vite-hub/queue 0.4.1 → 0.5.1

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 (49) hide show
  1. package/README.md +2 -2
  2. package/dist/{client-B53_G4ky.js → client-CwoCdKct.js} +9 -12
  3. package/dist/{cloudflare-GosJefIK.js → cloudflare-BMc35cBD.js} +2 -4
  4. package/dist/{cloudflare-client-CoISDpIx.js → cloudflare-client-xWteD-su.js} +7 -10
  5. package/dist/{cloudflare-resource-name-BIfBglC2.js → cloudflare-resource-name-Bv8Z7nDU.js} +3 -4
  6. package/dist/{config-B2eaXaT5.js → config-Bzp1xmdh.js} +4 -9
  7. package/dist/definition-CIiFfst2.js +26 -0
  8. package/dist/durability.d.ts +1 -3
  9. package/dist/durability.js +1 -2
  10. package/dist/{duration-tujyhAKt.js → duration-C5w_-Rf4.js} +14 -9
  11. package/dist/{error-diagnostics-mJXBjmQx.js → error-diagnostics-Dv6nKZQW.js} +9 -6
  12. package/dist/{error-diagnostics-CQ4BUqRe.js → error-diagnostics-kKXseq8d.js} +10 -3
  13. package/dist/{handler-response-B6lz9nCn.js → handler-response-CchTXVjm.js} +10 -7
  14. package/dist/index.d.ts +1 -9
  15. package/dist/index.js +5 -24
  16. package/dist/{inspect-PeuckaC3.js → inspect-CwdWUhPj.js} +1 -2
  17. package/dist/internal/runtime/cloudflare-client.d.ts +2 -4
  18. package/dist/internal/runtime/cloudflare-client.js +1 -2
  19. package/dist/internal/runtime/cloudflare-vite.d.ts +2 -9
  20. package/dist/internal/runtime/cloudflare-vite.js +13 -16
  21. package/dist/internal/runtime/local-client.d.ts +4 -6
  22. package/dist/internal/runtime/local-client.js +5 -6
  23. package/dist/internal/runtime/postgres-client.d.ts +6 -8
  24. package/dist/internal/runtime/postgres-client.js +18 -13
  25. package/dist/internal/runtime/state.d.ts +3 -5
  26. package/dist/internal/runtime/state.js +1 -2
  27. package/dist/internal/runtime/vercel-client.d.ts +2 -4
  28. package/dist/internal/runtime/vercel-client.js +5 -8
  29. package/dist/internal/runtime/worker-client.d.ts +3 -5
  30. package/dist/internal/runtime/worker-client.js +2 -3
  31. package/dist/{invariant-D8_xBqmZ.js → invariant-CmdvZ3vp.js} +1 -2
  32. package/dist/{local-CUaWoRUx.d.ts → local-B72WRWkS.d.ts} +1 -3
  33. package/dist/{local-Di0FrVUw.js → local-RX10a_Sq.js} +26 -21
  34. package/dist/{object-D8pRdprI.js → object-DRSmpe04.js} +1 -2
  35. package/dist/{operation-definition-nmRu_O3V.d.ts → operation-definition-CqZkx1Rm.d.ts} +8 -6
  36. package/dist/{operations-BVV-9Q0N.js → operations-CoEXxfUW.js} +7 -14
  37. package/dist/operations.d.ts +3 -7
  38. package/dist/operations.js +10 -16
  39. package/dist/runtime/hosted.d.ts +2 -4
  40. package/dist/runtime/hosted.js +4 -5
  41. package/dist/scan-module-BaqBao0J.js +309 -0
  42. package/dist/{state-DLqTqF6V.js → state-DqxeV11k.js} +5 -8
  43. package/dist/{types-Dsbb_Pvp.d.ts → types-BevEYrUV.d.ts} +1 -4
  44. package/dist/{types-CiuSIPR0.d.ts → types-BzPGPV9z.d.ts} +8 -4
  45. package/dist/{vercel-region-B95MAMXN.js → vercel-region-DEsR1YJQ.js} +2 -3
  46. package/dist/{vercel-C_4vqxcl.js → vercel-sUJOxFBB.js} +2 -3
  47. package/dist/vite.d.ts +8 -30
  48. package/dist/vite.js +148 -139
  49. package/package.json +10 -10
package/dist/vite.d.ts CHANGED
@@ -1,12 +1,9 @@
1
- import { N as QueueOptions, s as DiscoveredQueueDefinition } from "./types-CiuSIPR0.js";
2
- import { n as OperationContributionEntry } from "./operation-definition-nmRu_O3V.js";
1
+ import { N as QueueOptions, s as DiscoveredQueueDefinition } from "./types-BzPGPV9z.js";
2
+ import { n as OperationContributionEntry } from "./operation-definition-CqZkx1Rm.js";
3
3
  import "nostics";
4
4
  import { Plugin, UserConfig } from "vite";
5
- //#region ../internal/src/deployment.d.ts
6
5
  /** The host that ViteHub builds for: the `host` option of `vitehub()` and the value of `VITEHUB_HOST`. */
7
6
  type ViteHubHost = "cloudflare" | "deno" | "netlify" | "node" | "vercel";
8
- //#endregion
9
- //#region ../internal/src/inspect.d.ts
10
7
  interface ViteHubDefinitionField {
11
8
  label: string;
12
9
  value: string;
@@ -56,14 +53,14 @@ interface ViteHubResourceSummary {
56
53
  owner: string;
57
54
  /** Absent when no id is known yet. */
58
55
  source?: ViteHubResourceIdSource;
56
+ /** The resource is in the Wrangler config of a standalone Provider Output Worker, not in Nitro's. */
57
+ standalone?: boolean;
59
58
  }
60
59
  interface ViteHubInspectionContributor {
61
60
  definitions?: readonly ViteHubDefinitionInspector[];
62
61
  providerOutput?: readonly ViteHubProviderOutputEntry[];
63
62
  resources?: () => readonly ViteHubResourceSummary[] | Promise<readonly ViteHubResourceSummary[]>;
64
63
  }
65
- //#endregion
66
- //#region ../internal/src/build/deployment-plan-output.d.ts
67
64
  /**
68
65
  * One set of host variables that the deployed app reads, as `deployment.json` lists it: a Server Env declaration, or
69
66
  * a variable that a primitive reads itself, such as `VITEHUB_SECRET` or `BLOB_READ_WRITE_TOKEN`.
@@ -93,8 +90,6 @@ interface DeploymentEnvContext {
93
90
  * Return names only, never values.
94
91
  */
95
92
  type DeploymentEnvContribution = (context: DeploymentEnvContext) => readonly DeploymentEnvEntry[];
96
- //#endregion
97
- //#region ../internal/src/durability.d.ts
98
93
  /**
99
94
  * One durability reporter that a primitive's Vite plugin contributes through `vitehub.durability`. The Node server
100
95
  * imports `export` from `module` at boot and calls it with `input` and the server environment. It returns the
@@ -117,11 +112,10 @@ interface DurabilityPluginMetadata {
117
112
  /** Called after Vite resolves the config. Return an empty list when the primitive is off. */
118
113
  durability?: () => readonly DurabilityContribution[];
119
114
  }
120
- //#endregion
121
- //#region ../internal/src/host-credentials.d.ts
122
115
  interface HostCliRunResult {
123
116
  exitCode: number | null;
124
117
  stdout: string;
118
+ stderr?: string;
125
119
  }
126
120
  /** Runs a host CLI with an argument array and no shell, and returns its stdout. */
127
121
  type HostCliRun = (command: string, args: readonly string[], options: {
@@ -129,8 +123,6 @@ type HostCliRun = (command: string, args: readonly string[], options: {
129
123
  env: NodeJS.ProcessEnv;
130
124
  signal?: AbortSignal;
131
125
  }) => Promise<HostCliRunResult>;
132
- //#endregion
133
- //#region ../internal/src/provision.d.ts
134
126
  type ProvisionProvider = "cloudflare" | "vercel";
135
127
  interface ProvisionLogger {
136
128
  log: (message: string) => void;
@@ -182,8 +174,6 @@ interface ProvisionStep {
182
174
  /** Describes the Provision State this step records. Runs without network access, also without credentials. */
183
175
  recordedState?: (context: Pick<ProvisionContext, "env">) => ProvisionStateCategory[];
184
176
  }
185
- //#endregion
186
- //#region ../internal/src/cli.d.ts
187
177
  interface ViteHubCliStreams {
188
178
  stderr: {
189
179
  write: (chunk: string | Uint8Array, encoding?: BufferEncoding | StdoutWriteCallback, callback?: StdoutWriteCallback) => unknown;
@@ -274,8 +264,6 @@ interface ViteHubCliContributor {
274
264
  publicUrl?: string;
275
265
  }
276
266
  type StdoutWriteCallback = (error?: Error | null) => void;
277
- //#endregion
278
- //#region ../internal/src/contributions.d.ts
279
267
  /** Module and export that hold a contributed Definition. */
280
268
  interface ContributionDefinition {
281
269
  /**
@@ -305,6 +293,8 @@ interface ContributionContext {
305
293
  projectRoot: string;
306
294
  /** Server directories that the host forwards, for example Nuxt's `serverDir` and the server directories of layers. */
307
295
  serverDirs?: readonly string[];
296
+ /** The flat list of Vite plugins, so a factory can read what sibling plugins declare. */
297
+ plugins?: readonly unknown[];
308
298
  }
309
299
  /**
310
300
  * Returns the contributions of a plugin. It runs once per discovery pass, so it must be idempotent and must not depend
@@ -328,8 +318,6 @@ interface CollectedContribution {
328
318
  /** Name of the contributing Vite plugin. */
329
319
  plugin: string;
330
320
  }
331
- //#endregion
332
- //#region src/contributions.d.ts
333
321
  /**
334
322
  * A Queue Definition that another package adds from its Vite plugin. The Queue plugin merges it with the discovered
335
323
  * files, so the registry, the generated types, Cloudflare bindings, Vercel consumers, inspection, and provisioning
@@ -351,12 +339,9 @@ type CollectedQueueContribution = CollectedContribution;
351
339
  * `QUEUE_DEFINITION_DUPLICATE`. Invalid entries fail with `QUEUE_CONTRIBUTION_INVALID`.
352
340
  */
353
341
  export declare function collectQueueContributions(plugins: readonly unknown[] | undefined, context: QueueContributionContext): Promise<CollectedQueueContribution[]>;
354
- //#endregion
355
- //#region src/discovery.d.ts
356
342
  /** Discovery source of Queue Definitions that Vite plugins contribute through `vitehub.queues`. */
357
343
  export declare const contributedQueueSource = "vite-plugin-contribution";
358
344
  interface QueueContributionOptions {
359
- /** Queue Definitions that Vite plugins contribute. See `collectQueueContributions()`. */
360
345
  contributions?: readonly CollectedQueueContribution[];
361
346
  }
362
347
  export declare function discoverQueueDefinitions(options: QueueContributionOptions & {
@@ -369,8 +354,6 @@ export declare function discoverQueueDefinitions(options: QueueContributionOptio
369
354
  mode: "server-queues";
370
355
  scanDirs: string[];
371
356
  }): DiscoveredQueueDefinition[];
372
- //#endregion
373
- //#region ../internal/src/console.d.ts
374
357
  type MaybePromise<T> = T | Promise<T>;
375
358
  /** Lists discovered Definitions in a sidebar and shows the selected Definition's fields. */
376
359
  interface ViteHubConsoleDefinitionCatalogView {
@@ -702,8 +685,6 @@ interface ViteHubConsoleDocumentSetup {
702
685
  */
703
686
  schedule?: ViteHubConsoleDocumentHint;
704
687
  }
705
- //#endregion
706
- //#region src/inspect.d.ts
707
688
  interface QueueInspectionOptions {
708
689
  /** Queue Definitions that Vite plugins contribute through `vitehub.queues`. */
709
690
  contributions?: readonly CollectedQueueContribution[];
@@ -712,11 +693,9 @@ interface QueueInspectionOptions {
712
693
  serverDirs?: string[];
713
694
  }
714
695
  /** Summarizes discovered Queue Definitions for the CLI and Console. */
715
- export declare function inspectQueueDefinitions(options: QueueInspectionOptions): ViteHubDefinitionSummary[];
696
+ export declare function inspectQueueDefinitions(options: QueueInspectionOptions, definitions?: readonly DiscoveredQueueDefinition[]): ViteHubDefinitionSummary[];
716
697
  /** Console section that lists discovered Queue Definitions. `vitehub inspect definitions` reads the same data. */
717
698
  export declare const queueConsoleSection: ViteHubConsoleSectionContribution<QueueInspectionOptions>;
718
- //#endregion
719
- //#region src/vite.d.ts
720
699
  interface QueueProvisionContributingPlugin {
721
700
  vitehub?: {
722
701
  cli?: () => Promise<ViteHubCliContributor>;
@@ -755,5 +734,4 @@ export interface QueueVitePluginInternalOptions {
755
734
  }
756
735
  export declare function createQueueNitroConfig(plugin: QueueVitePlugin, options: QueueNitroConfigOptions): Promise<Record<string, unknown>>;
757
736
  export declare function hubQueue(options?: QueueOptions, internalOptions?: QueueVitePluginInternalOptions): QueueVitePlugin;
758
- //#endregion
759
737
  export type { CollectedQueueContribution, QueueContributingPlugin, QueueContribution, QueueContributionContext, QueueContributionFactory, QueueInspectionOptions };