@cloudflare/vite-plugin 1.15.2 → 1.16.0

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,43 @@
1
1
  import * as vite from "vite";
2
2
  import { Miniflare, Request, Response } from "miniflare";
3
- import "wrangler";
3
+ import { Unstable_Config } from "wrangler";
4
4
 
5
- //#region src/plugin-config.d.ts
5
+ //#region src/workers-configs.d.ts
6
6
 
7
+ type WorkerConfig = Omit<Unstable_Config, keyof NonApplicableConfig>;
8
+ type NonApplicableWorkerConfigsInfo = typeof nonApplicableWorkerConfigs;
9
+ type NonApplicableConfig = NonApplicableConfigReplacedByVite | NonApplicableConfigNotRelevant;
10
+ type NonApplicableConfigReplacedByVite = keyof NonApplicableWorkerConfigsInfo["replacedByVite"];
11
+ type NonApplicableConfigNotRelevant = NonApplicableWorkerConfigsInfo["notRelevant"][number];
12
+ /**
13
+ * Set of worker config options that are not applicable when using Vite
14
+ */
15
+ declare const nonApplicableWorkerConfigs: {
16
+ /**
17
+ * Object containing configs that have a vite replacement, the object's field contain details about the config's replacement
18
+ */
19
+ readonly replacedByVite: {
20
+ readonly alias: {
21
+ readonly viteReplacement: "resolve.alias";
22
+ readonly viteDocs: "https://vite.dev/config/shared-options.html#resolve-alias";
23
+ };
24
+ readonly define: {
25
+ readonly viteReplacement: "define";
26
+ readonly viteDocs: "https://vite.dev/config/shared-options.html#define";
27
+ };
28
+ readonly minify: {
29
+ readonly viteReplacement: "build.minify";
30
+ readonly viteDocs: "https://vite.dev/config/build-options.html#build-minify";
31
+ };
32
+ };
33
+ /**
34
+ * All the configs that are not relevant when using Vite (meaning that in the context of a Vite
35
+ * application they lose their purpose/meaning)
36
+ */
37
+ readonly notRelevant: readonly ["base_dir", "build", "find_additional_modules", "no_bundle", "preserve_file_names", "rules", "site", "tsconfig"];
38
+ };
39
+ //#endregion
40
+ //#region src/plugin-config.d.ts
7
41
  type PersistState = boolean | {
8
42
  path: string;
9
43
  };
@@ -15,19 +49,26 @@ interface BaseWorkerConfig {
15
49
  interface EntryWorkerConfig extends BaseWorkerConfig {
16
50
  configPath?: string;
17
51
  }
18
- interface AuxiliaryWorkerConfig extends BaseWorkerConfig {
52
+ interface AuxiliaryWorkerFileConfig extends BaseWorkerConfig {
19
53
  configPath: string;
20
54
  }
55
+ interface AuxiliaryWorkerInlineConfig extends BaseWorkerConfig {
56
+ configPath?: string;
57
+ config: WorkerConfigCustomizer;
58
+ }
59
+ type AuxiliaryWorkerConfig = AuxiliaryWorkerFileConfig | AuxiliaryWorkerInlineConfig;
21
60
  interface Experimental {
22
61
  /** Experimental support for handling the _headers and _redirects files during Vite dev mode. */
23
62
  headersAndRedirectsDevModeSupport?: boolean;
24
63
  }
64
+ type WorkerConfigCustomizer = Partial<WorkerConfig> | ((config: WorkerConfig) => Partial<WorkerConfig> | void);
25
65
  interface PluginConfig extends EntryWorkerConfig {
26
66
  auxiliaryWorkers?: AuxiliaryWorkerConfig[];
27
67
  persistState?: PersistState;
28
68
  inspectorPort?: number | false;
29
69
  remoteBindings?: boolean;
30
70
  experimental?: Experimental;
71
+ config?: WorkerConfigCustomizer;
31
72
  }
32
73
  //#endregion
33
74
  //#region src/index.d.ts
@@ -40,5 +81,5 @@ interface PluginConfig extends EntryWorkerConfig {
40
81
  */
41
82
  declare function cloudflare(pluginConfig?: PluginConfig): vite.Plugin[];
42
83
  //#endregion
43
- export { type PluginConfig, cloudflare };
84
+ export { type PluginConfig, type WorkerConfig, cloudflare };
44
85
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/plugin-config.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAsBU,KAFE,YAAA,GAEc,OAAA,GAAA;EAIhB,IAAA,EAAA,MAAA;AAA0C,CAAA;AAII,UAR9C,gBAAA,CAYY;EAKL,eAAa,CAAA,EAAA;IACV,IAAA,CAAA,E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