@cloudflare/vite-plugin 2.0.0-beta.v.1 → 2.0.0-beta.v.11

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/dist/index.d.mts CHANGED
@@ -1,9 +1,15 @@
1
1
  import * as vite from "vite";
2
- import { InputWorkerConfig, ParsedInputWorkerConfig, WorkerConfig } from "@cloudflare/config";
2
+ import { InputWorkerConfig, ParsedInputConfig, ParsedInputWorkerConfig, WorkerConfig } from "@cloudflare/config";
3
3
  import { CompatDate } from "@cloudflare/workers-utils";
4
4
 
5
5
  //#region src/plugin-config.d.ts
6
6
 
7
+ /** Parsed configuration with the entry Worker required by the Vite plugin. */
8
+ type CloudflareConfig = Omit<ParsedInputConfig, "worker"> & {
9
+ worker: ParsedInputWorkerConfig;
10
+ };
11
+ /** @deprecated Use `CloudflareConfig` instead. */
12
+ type ParsedInputConfigWithWorker = CloudflareConfig;
7
13
  type PersistState = boolean | {
8
14
  path: string;
9
15
  };
@@ -26,7 +32,6 @@ interface BaseWorkerOptions {
26
32
  */
27
33
  type DevOnly = boolean | (() => boolean);
28
34
  interface EntryWorkerOptions extends BaseWorkerOptions {
29
- config?: EntryWorkerConfigCustomizer;
30
35
  /**
31
36
  * Whether the entry Worker should be omitted from the production build.
32
37
  * Can be a boolean or a function that returns a boolean. The function is
@@ -64,11 +69,17 @@ interface Experimental {
64
69
  /** Experimental support for handling the _headers and _redirects files during Vite dev mode. */
65
70
  headersAndRedirectsDevModeSupport?: boolean;
66
71
  }
67
- type EntryWorkerConfigCustomizer = Partial<ParsedInputWorkerConfig> | ((config: ParsedInputWorkerConfig) => Partial<ParsedInputWorkerConfig> | void);
68
72
  type WorkerConfigProvider = InputWorkerConfig | ((options: {
69
73
  entryWorkerConfig: ParsedInputWorkerConfig;
70
74
  }) => InputWorkerConfig);
71
75
  interface PluginConfig extends EntryWorkerOptions {
76
+ /**
77
+ * Customize the loaded configuration before development or building.
78
+ * The loaded configuration always includes an entry Worker.
79
+ * Return a new configuration object including an entry Worker, copying any settings to preserve.
80
+ * Preview uses the configuration recorded in the build output.
81
+ */
82
+ config?: (loadedConfig: CloudflareConfig) => CloudflareConfig;
72
83
  auxiliaryWorkers?: AuxiliaryWorkerOptions[];
73
84
  /** Configuration for a dedicated prerender Worker. */
74
85
  prerenderWorker?: PrerenderWorkerOptions;
@@ -111,4 +122,4 @@ declare function getLocalWorkerdCompatibilityDate(_options?: {
111
122
  */
112
123
  declare function cloudflare(pluginConfig?: PluginConfig): vite.Plugin[];
113
124
  //#endregion
114
- export { type PluginConfig, type WorkerConfig, cloudflare, getLocalWorkerdCompatibilityDate };
125
+ export { type CloudflareConfig, type ParsedInputConfigWithWorker, type PluginConfig, type WorkerConfig, cloudflare, getLocalWorkerdCompatibilityDate };