rspack-plugin-cloudflare 0.5.6 → 0.5.7

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.js CHANGED
@@ -2,38 +2,21 @@ import { createRequire, isBuiltin } from "node:module";
2
2
  import fs, { existsSync, readFileSync } from "node:fs";
3
3
  import fs$1 from "node:fs/promises";
4
4
  import path, { relative } from "node:path";
5
+ import { DEFAULT_MODULE_RULES, PATH_TO_DEPLOY_CONFIG, convertConfigToBindings, getNodeCompat, normalizeAndValidateConfig, printBindings } from "@cloudflare/workers-utils";
5
6
  import { maybeStartOrUpdateRemoteProxySession, unstable_getMiniflareWorkerOptions, unstable_getVarsForDev, unstable_readConfig, unstable_resolveNamedTunnel } from "wrangler";
6
7
  import { createHash, randomUUID } from "node:crypto";
7
8
  import { fileURLToPath } from "node:url";
8
9
  import { getCloudflarePreset } from "@cloudflare/unenv-preset";
9
- import { convertConfigToBindings, getNodeCompat, normalizeAndValidateConfig, printBindings } from "@cloudflare/workers-utils";
10
10
  import { defineEnv } from "unenv";
11
11
  import { convertToWranglerConfig, loadAndParseConfig } from "@cloudflare/config";
12
12
  import { WebSocketServer } from "ws";
13
13
  import { createContainerDevPlan, generateContainerBuildId, prepareContainerImagesForDev, resolveDockerHost } from "@cloudflare/containers-shared";
14
+ import { getDockerPath } from "@cloudflare/workers-utils/docker-path";
14
15
  import { Readable } from "node:stream";
15
16
  import net from "node:net";
16
17
  import { spawn } from "node:child_process";
17
18
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
18
19
  // src/module-rules.ts
19
- const DEFAULT_RULES = [
20
- {
21
- type: "Text",
22
- globs: [
23
- "**/*.txt",
24
- "**/*.html",
25
- "**/*.sql"
26
- ]
27
- },
28
- {
29
- type: "Data",
30
- globs: ["**/*.bin"]
31
- },
32
- {
33
- type: "CompiledWasm",
34
- globs: ["**/*.wasm", "**/*.wasm?module"]
35
- }
36
- ];
37
20
  const MODULE_TYPES = [
38
21
  "CompiledWasm",
39
22
  "Data",
@@ -45,7 +28,7 @@ function isModuleType(type) {
45
28
  /** Maps file extensions to the non-JS module type wrangler would give them, with config rules taking precedence. */
46
29
  function getModuleTypes(worker) {
47
30
  const types = /* @__PURE__ */ new Map();
48
- for (const rule of [...worker.config.rules, ...DEFAULT_RULES]) {
31
+ for (const rule of [...worker.config.rules, ...DEFAULT_MODULE_RULES]) {
49
32
  if (!isModuleType(rule.type)) continue;
50
33
  for (const glob of rule.globs) {
51
34
  const extension = path.extname(glob.replace(/\?.*$/, ""));
@@ -406,7 +389,7 @@ async function buildWorkers(options) {
406
389
  if (!entry) return;
407
390
  const configPaths = [];
408
391
  for (const worker of workers) configPaths.push(await buildWorker(compiler, worker, pluginOptions));
409
- const deployConfigPath = path.join(entry.rootDir, ".wrangler", "deploy", "config.json");
392
+ const deployConfigPath = path.join(entry.rootDir, PATH_TO_DEPLOY_CONFIG);
410
393
  const relativeToDeploy = (filePath) => path.relative(path.dirname(deployConfigPath), filePath).replaceAll("\\", "/");
411
394
  const [entryConfigPath, ...auxiliaryConfigPaths] = configPaths;
412
395
  await fs$1.mkdir(path.dirname(deployConfigPath), { recursive: true });
@@ -2623,10 +2606,6 @@ function getAssetWorkers(options) {
2623
2606
  }];
2624
2607
  }
2625
2608
  // src/containers.ts
2626
- /** `WRANGLER_DOCKER_BIN`, like wrangler, so both find the same Docker. */
2627
- function getDockerPath() {
2628
- return process.env.WRANGLER_DOCKER_BIN || "docker";
2629
- }
2630
2609
  /** The images a Worker's Containers need, tagged to match the Durable Object options wrangler generates with the same build id. */
2631
2610
  function getContainerOptions(config, containerBuildId) {
2632
2611
  return createContainerDevPlan({