rsbuild-plugin-cloudflare 0.0.2 → 0.0.4

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
@@ -227,6 +227,10 @@ Other differences:
227
227
  Rsbuild uses an environment's settings over the top-level ones. Set them in
228
228
  `environments.<name>` instead. The top-level `output.sourceMap`, and the
229
229
  `output.minify` setting for CSS, do apply.
230
+ - Workers' CSS is compiled for Rsbuild's browserslist (the client's, unless
231
+ `output.overrideBrowserslist` is set for the Worker's environment), so that
232
+ it matches the client's stylesheets. The Vite plugin targets `es2024` unless
233
+ `build.cssTarget` is set.
230
234
  - Without `source.entry` or client environments, a client is built from
231
235
  Rsbuild's default entry (`src/index.*`) only when `index.html` exists at the
232
236
  project root, where Vite builds one whenever `index.html` exists. The default
package/dist/index.d.mts CHANGED
@@ -1,8 +1,12 @@
1
- import { InputWorkerConfig, ParsedInputWorkerConfig } from "@cloudflare/config";
1
+ import { InputWorkerConfig, ParsedInputConfig, ParsedInputWorkerConfig, WorkerConfig } from "@cloudflare/config";
2
2
  import { RsbuildPlugin } from "@rsbuild/core";
3
3
 
4
4
  //#region ../../workers-sdk/packages/vite-plugin-cloudflare/src/plugin-config.d.ts
5
5
 
6
+ /** Parsed configuration with the entry Worker required by the Vite plugin. */
7
+ type CloudflareConfig = Omit<ParsedInputConfig, "worker"> & {
8
+ worker: ParsedInputWorkerConfig;
9
+ };
6
10
  type PersistState = boolean | {
7
11
  path: string;
8
12
  };
@@ -25,7 +29,6 @@ interface BaseWorkerOptions {
25
29
  */
26
30
  type DevOnly = boolean | (() => boolean);
27
31
  interface EntryWorkerOptions extends BaseWorkerOptions {
28
- config?: EntryWorkerConfigCustomizer;
29
32
  /**
30
33
  * Whether the entry Worker should be omitted from the production build.
31
34
  * Can be a boolean or a function that returns a boolean. The function is
@@ -63,11 +66,17 @@ interface Experimental {
63
66
  /** Experimental support for handling the _headers and _redirects files during Vite dev mode. */
64
67
  headersAndRedirectsDevModeSupport?: boolean;
65
68
  }
66
- type EntryWorkerConfigCustomizer = Partial<ParsedInputWorkerConfig> | ((config: ParsedInputWorkerConfig) => Partial<ParsedInputWorkerConfig> | void);
67
69
  type WorkerConfigProvider = InputWorkerConfig | ((options: {
68
70
  entryWorkerConfig: ParsedInputWorkerConfig;
69
71
  }) => InputWorkerConfig);
70
72
  interface PluginConfig$1 extends EntryWorkerOptions {
73
+ /**
74
+ * Customize the loaded configuration before development or building.
75
+ * The loaded configuration always includes an entry Worker.
76
+ * Return a new configuration object including an entry Worker, copying any settings to preserve.
77
+ * Preview uses the configuration recorded in the build output.
78
+ */
79
+ config?: (loadedConfig: CloudflareConfig) => CloudflareConfig;
71
80
  auxiliaryWorkers?: AuxiliaryWorkerOptions[];
72
81
  /** Configuration for a dedicated prerender Worker. */
73
82
  prerenderWorker?: PrerenderWorkerOptions;
@@ -120,4 +129,4 @@ interface PluginConfig extends RsbuildWorkerOptions<Omit<PluginConfig$1, "tunnel
120
129
  */
121
130
  declare function cloudflare(options?: PluginConfig): RsbuildPlugin;
122
131
  //#endregion
123
- export { PluginConfig, cloudflare };
132
+ export { type CloudflareConfig, PluginConfig, type WorkerConfig, cloudflare };