rspack-plugin-cloudflare 0.4.2 → 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.
package/README.md CHANGED
@@ -15,7 +15,7 @@ Run Cloudflare Workers in workerd while developing with `rspack serve`, with hot
15
15
  npm install --save-dev rspack-plugin-cloudflare @rspack/core @rspack/cli @rspack/dev-server wrangler
16
16
  ```
17
17
 
18
- Requires Node.js 24.10 or later.
18
+ Requires Node.js 24.10 or later. `wrangler` is a peer dependency, so you pick its version: the plugin runs your Worker with the Miniflare and workerd that your wrangler ships, and newer compatibility dates arrive when you update wrangler.
19
19
 
20
20
  ## Usage
21
21
 
@@ -156,7 +156,7 @@ node --run test
156
156
 
157
157
  `node --run test` lints, type checks, builds and runs the test suite, which starts real `rspack serve` and `rspack build` runs against the fixtures in `test/fixtures`.
158
158
 
159
- Cloudflare's router and asset Workers and their `_headers` and `_redirects` parsers come from `@cloudflare/workers-shared`, which isn't published. The `workers-sdk` submodule is pinned to the commit of the wrangler release we depend on, and `node --run build` bundles that code into `dist`. The weekly Sync upstream workflow moves wrangler, Miniflare, the packages wrangler pins and the submodule to the latest wrangler release together, runs the tests and opens a pull request. To do the same locally, run `node scripts/sync-upstream.ts [version]`.
159
+ Cloudflare's router and asset Workers and their `_headers` and `_redirects` parsers come from `@cloudflare/workers-shared`, which isn't published. The `workers-sdk` submodule is pinned to the commit of the wrangler release we test against, and `node --run build` bundles that code into `dist`. The daily Sync upstream workflow moves that wrangler, the packages it pins and the submodule to the latest wrangler release together and opens a pull request, which merges and releases itself once CI passes. CI also tests the oldest wrangler the peer range allows. To do the same locally, run `node scripts/sync-upstream.ts [version]`.
160
160
 
161
161
  Releases are automated. Merging to `main` runs [semantic-release](https://github.com/semantic-release/semantic-release), which picks the version from the [conventional commit](https://www.conventionalcommits.org/) titles since the last release and publishes to npm through trusted publishing, with provenance. Pull requests are squash merged, so the pull request title is the commit that counts.
162
162
 
package/dist/index.js CHANGED
@@ -6,10 +6,9 @@ import { maybeStartOrUpdateRemoteProxySession, unstable_convertConfigBindingsToS
6
6
  import { createHash, randomUUID } from "node:crypto";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { getCloudflarePreset } from "@cloudflare/unenv-preset";
9
- import * as miniflare from "miniflare";
9
+ import { getNodeCompat, normalizeAndValidateConfig } from "@cloudflare/workers-utils";
10
10
  import { defineEnv } from "unenv";
11
11
  import { convertToWranglerConfig, loadAndParseConfig } from "@cloudflare/config";
12
- import { normalizeAndValidateConfig } from "@cloudflare/workers-utils";
13
12
  import { WebSocketServer } from "ws";
14
13
  import { cleanupContainers, createContainerDevPlan, generateContainerBuildId, prepareContainerImagesForDev, resolveDockerHost } from "@cloudflare/containers-shared";
15
14
  import { Readable } from "node:stream";
@@ -75,7 +74,7 @@ function createInjectSource(inject, polyfills) {
75
74
  */
76
75
  function getNodeJsCompat(worker) {
77
76
  const { compatibility_date: compatibilityDate, compatibility_flags: compatibilityFlags } = worker.config;
78
- if (!miniflare.getNodeCompat(compatibilityDate, compatibilityFlags).isNodejsCompatEnabled) return;
77
+ if (!getNodeCompat(compatibilityDate, compatibilityFlags).isNodejsCompatEnabled) return;
79
78
  const { env } = defineEnv({ presets: [getCloudflarePreset({
80
79
  compatibilityDate,
81
80
  compatibilityFlags
@@ -533,6 +532,7 @@ async function resolveAuxiliaryWorker(context, options, auxiliary, clientOutputP
533
532
  function getWorkerResolvers(context, options, clientOutputPath) {
534
533
  return [() => resolveWorker(context, options, clientOutputPath), ...(options.auxiliaryWorkers ?? []).map((auxiliary) => () => resolveAuxiliaryWorker(context, options, auxiliary, clientOutputPath))];
535
534
  }
535
+ const miniflare = createRequire(import.meta.resolve("wrangler"))("miniflare");
536
536
  // workers-sdk/packages/workers-shared/utils/configuration/constants.ts
537
537
  const PERMITTED_STATUS_CODES = /* @__PURE__ */ new Set([
538
538
  200,