@cloudflare/vite-plugin 2.0.0-beta.v.10 → 2.0.0-beta.v.12

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 CHANGED
@@ -18,40 +18,6 @@ export default defineConfig({
18
18
 
19
19
  Full documentation can be found [here](https://developers.cloudflare.com/workers/vite-plugin/).
20
20
 
21
- ## Programmatic configuration
22
-
23
- The `config` option accepts a customizer with the signature
24
- `(loadedConfig: ParsedInputConfigWithWorker) => ParsedInputConfigWithWorker`. It receives the parsed
25
- `cloudflare.config.ts` configuration, or a default Worker configuration when no
26
- file exists, and can customize account settings, Containers, and the entry Worker.
27
- The loaded and returned configurations must include a Worker, even for assets-only projects.
28
-
29
- Return a new configuration object, spreading any existing fields you want to
30
- preserve. Nested objects and arrays are replaced rather than merged:
31
-
32
- ```ts
33
- import { cloudflare } from "@cloudflare/vite-plugin";
34
-
35
- cloudflare({
36
- config(loadedConfig) {
37
- return {
38
- ...loadedConfig,
39
- worker: {
40
- ...loadedConfig.worker,
41
- env: {
42
- ...loadedConfig.worker.env,
43
- FRAMEWORK_NAME: { type: "text", value: "my-framework" },
44
- },
45
- },
46
- };
47
- },
48
- });
49
- ```
50
-
51
- The customized configuration is recorded in the build output. Preview and
52
- deployment from that output use the recorded configuration. Generated types
53
- continue to describe `cloudflare.config.ts`.
54
-
55
21
  ## Features
56
22
 
57
23
  - Uses the Vite [Environment API](https://vite.dev/guide/api-environment) to integrate Vite with the Workers runtime
package/dist/index.d.mts CHANGED
@@ -5,9 +5,11 @@ import { CompatDate } from "@cloudflare/workers-utils";
5
5
  //#region src/plugin-config.d.ts
6
6
 
7
7
  /** Parsed configuration with the entry Worker required by the Vite plugin. */
8
- type ParsedInputConfigWithWorker = Omit<ParsedInputConfig, "worker"> & {
8
+ type CloudflareConfig = Omit<ParsedInputConfig, "worker"> & {
9
9
  worker: ParsedInputWorkerConfig;
10
10
  };
11
+ /** @deprecated Use `CloudflareConfig` instead. */
12
+ type ParsedInputConfigWithWorker = CloudflareConfig;
11
13
  type PersistState = boolean | {
12
14
  path: string;
13
15
  };
@@ -77,7 +79,7 @@ interface PluginConfig extends EntryWorkerOptions {
77
79
  * Return a new configuration object including an entry Worker, copying any settings to preserve.
78
80
  * Preview uses the configuration recorded in the build output.
79
81
  */
80
- config?: (loadedConfig: ParsedInputConfigWithWorker) => ParsedInputConfigWithWorker;
82
+ config?: (loadedConfig: CloudflareConfig) => CloudflareConfig;
81
83
  auxiliaryWorkers?: AuxiliaryWorkerOptions[];
82
84
  /** Configuration for a dedicated prerender Worker. */
83
85
  prerenderWorker?: PrerenderWorkerOptions;
@@ -120,4 +122,4 @@ declare function getLocalWorkerdCompatibilityDate(_options?: {
120
122
  */
121
123
  declare function cloudflare(pluginConfig?: PluginConfig): vite.Plugin[];
122
124
  //#endregion
123
- export { type ParsedInputConfigWithWorker, type PluginConfig, type WorkerConfig, cloudflare, getLocalWorkerdCompatibilityDate };
125
+ export { type CloudflareConfig, type ParsedInputConfigWithWorker, type PluginConfig, type WorkerConfig, cloudflare, getLocalWorkerdCompatibilityDate };