wrangler 3.78.9 → 3.78.11

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.
@@ -141483,17 +141483,17 @@ async function generateASSETSBinding(options29) {
141483
141483
  try {
141484
141484
  const url4 = new URL(miniflareRequest.url);
141485
141485
  url4.host = `localhost:${options29.proxyPort}`;
141486
- const proxyRequest = new import_miniflare7.Request(url4, miniflareRequest);
141486
+ const proxyRequest = new import_miniflare8.Request(url4, miniflareRequest);
141487
141487
  if (proxyRequest.headers.get("Upgrade") === "websocket") {
141488
141488
  proxyRequest.headers.delete("Sec-WebSocket-Accept");
141489
141489
  proxyRequest.headers.delete("Sec-WebSocket-Key");
141490
141490
  }
141491
- return await (0, import_miniflare7.fetch)(proxyRequest, {
141491
+ return await (0, import_miniflare8.fetch)(proxyRequest, {
141492
141492
  dispatcher: new ProxyDispatcher(miniflareRequest.headers.get("Host"))
141493
141493
  });
141494
141494
  } catch (thrown) {
141495
141495
  options29.log.error(new Error(`Could not proxy request: ${thrown}`));
141496
- return new import_miniflare7.Response(`[wrangler] Could not proxy request: ${thrown}`, {
141496
+ return new import_miniflare8.Response(`[wrangler] Could not proxy request: ${thrown}`, {
141497
141497
  status: 502
141498
141498
  });
141499
141499
  }
@@ -141502,7 +141502,7 @@ async function generateASSETSBinding(options29) {
141502
141502
  return await assetsFetch(miniflareRequest);
141503
141503
  } catch (thrown) {
141504
141504
  options29.log.error(new Error(`Could not serve static asset: ${thrown}`));
141505
- return new import_miniflare7.Response(
141505
+ return new import_miniflare8.Response(
141506
141506
  `[wrangler] Could not serve static asset: ${thrown}`,
141507
141507
  { status: 502 }
141508
141508
  );
@@ -141614,11 +141614,11 @@ async function generateAssetsFetch(directory, log2) {
141614
141614
  });
141615
141615
  }, "generateResponse");
141616
141616
  return async (input, init3) => {
141617
- const request3 = new import_miniflare7.Request(input, init3);
141617
+ const request3 = new import_miniflare8.Request(input, init3);
141618
141618
  return await generateResponse(request3);
141619
141619
  };
141620
141620
  }
141621
- var import_node_assert15, import_node_fs19, import_node_path35, import_chokidar2, import_mime3, import_miniflare7, import_undici9, ProxyDispatcher, invalidAssetsFetch;
141621
+ var import_node_assert15, import_node_fs19, import_node_path35, import_chokidar2, import_mime3, import_miniflare8, import_undici9, ProxyDispatcher, invalidAssetsFetch;
141622
141622
  var init_assets = __esm({
141623
141623
  "src/miniflare-cli/assets.ts"() {
141624
141624
  init_import_meta_url();
@@ -141630,7 +141630,7 @@ var init_assets = __esm({
141630
141630
  init_parseRedirects();
141631
141631
  import_chokidar2 = require("chokidar");
141632
141632
  import_mime3 = __toESM(require_mime());
141633
- import_miniflare7 = require("miniflare");
141633
+ import_miniflare8 = require("miniflare");
141634
141634
  import_undici9 = __toESM(require_undici());
141635
141635
  init_hash();
141636
141636
  __name(generateASSETSBinding, "generateASSETSBinding");
@@ -149426,9 +149426,9 @@ var require_dist7 = __commonJS({
149426
149426
  }
149427
149427
  });
149428
149428
 
149429
- // ../../node_modules/.pnpm/workerd@1.20240909.0/node_modules/workerd/lib/main.js
149429
+ // ../../node_modules/.pnpm/workerd@1.20240925.0/node_modules/workerd/lib/main.js
149430
149430
  var require_main5 = __commonJS({
149431
- "../../node_modules/.pnpm/workerd@1.20240909.0/node_modules/workerd/lib/main.js"(exports2, module3) {
149431
+ "../../node_modules/.pnpm/workerd@1.20240925.0/node_modules/workerd/lib/main.js"(exports2, module3) {
149432
149432
  init_import_meta_url();
149433
149433
  var __create2 = Object.create;
149434
149434
  var __defProp2 = Object.defineProperty;
@@ -149567,7 +149567,7 @@ by workerd to install the correct binary executable for your current platform.`)
149567
149567
  "node_modules",
149568
149568
  ".cache",
149569
149569
  "workerd",
149570
- `pnpapi-${pkg.replace("/", "-")}-${"1.20240909.0"}-${import_path20.default.basename(subpath)}`
149570
+ `pnpapi-${pkg.replace("/", "-")}-${"1.20240925.0"}-${import_path20.default.basename(subpath)}`
149571
149571
  );
149572
149572
  if (!import_fs16.default.existsSync(binTargetPath)) {
149573
149573
  import_fs16.default.mkdirSync(import_path20.default.dirname(binTargetPath), { recursive: true });
@@ -149581,8 +149581,8 @@ by workerd to install the correct binary executable for your current platform.`)
149581
149581
  __name(generateBinPath, "generateBinPath");
149582
149582
  var { binPath } = generateBinPath();
149583
149583
  var node_path_default = binPath;
149584
- var compatibilityDate = "2024-09-09";
149585
- var version4 = "1.20240909.0";
149584
+ var compatibilityDate = "2024-09-25";
149585
+ var version4 = "1.20240925.0";
149586
149586
  }
149587
149587
  });
149588
149588
 
@@ -158104,7 +158104,7 @@ var import_undici3 = __toESM(require_undici());
158104
158104
 
158105
158105
  // package.json
158106
158106
  var name = "wrangler";
158107
- var version = "3.78.9";
158107
+ var version = "3.78.11";
158108
158108
 
158109
158109
  // src/user/index.ts
158110
158110
  init_import_meta_url();
@@ -164157,17 +164157,26 @@ var import_node_module = require("node:module");
164157
164157
  var nodeBuiltinResolveErrorText = new RegExp(
164158
164158
  '^Could not resolve "(' + import_node_module.builtinModules.join("|") + "|" + import_node_module.builtinModules.map((module3) => "node:" + module3).join("|") + ')"$'
164159
164159
  );
164160
- function rewriteNodeCompatBuildFailure(errors, forPages = false) {
164160
+ function rewriteNodeCompatBuildFailure(errors, compatMode = null) {
164161
164161
  for (const error2 of errors) {
164162
164162
  const match = nodeBuiltinResolveErrorText.exec(error2.text);
164163
164163
  if (match !== null) {
164164
- const issue = `The package "${match[1]}" wasn't found on the file system but is built into node.`;
164165
- const instructionForUser = `${forPages ? 'Add the "nodejs_compat" compatibility flag to your Pages project' : 'Add "node_compat = true" to your wrangler.toml file'} and make sure to prefix the module name with "node:" to enable Node.js compatibility.`;
164164
+ let text = `The package "${match[1]}" wasn't found on the file system but is built into node.
164165
+ `;
164166
+ if (compatMode === null || compatMode === "als") {
164167
+ text += `- Add the "nodejs_compat" compatibility flag to your project.
164168
+ `;
164169
+ } else if (compatMode === "legacy") {
164170
+ text += `- Try removing the legacy "node_compat" setting and add the "nodejs_compat" compatibility flag in your project
164171
+ `;
164172
+ } else if (compatMode === "v1" && !match[1].startsWith("node:")) {
164173
+ text += `- Make sure to prefix the module name with "node:" or update your compatibility_date to 2024-09-23 or later.
164174
+ `;
164175
+ }
164166
164176
  error2.notes = [
164167
164177
  {
164168
164178
  location: null,
164169
- text: `${issue}
164170
- ${instructionForUser}`
164179
+ text
164171
164180
  }
164172
164181
  ];
164173
164182
  }
@@ -165247,7 +165256,6 @@ async function bundleWorker(entry, destination, {
165247
165256
  sourcemap,
165248
165257
  plugins,
165249
165258
  isOutfile,
165250
- forPages,
165251
165259
  local,
165252
165260
  projectRoot,
165253
165261
  defineNavigatorUserAgent,
@@ -165456,8 +165464,8 @@ async function bundleWorker(entry, destination, {
165456
165464
  }, "stop");
165457
165465
  }
165458
165466
  } catch (e3) {
165459
- if (nodejsCompatMode !== "legacy" && isBuildFailure(e3)) {
165460
- rewriteNodeCompatBuildFailure(e3.errors, forPages);
165467
+ if (isBuildFailure(e3)) {
165468
+ rewriteNodeCompatBuildFailure(e3.errors, nodejsCompatMode);
165461
165469
  }
165462
165470
  throw e3;
165463
165471
  }
@@ -166005,7 +166013,7 @@ function logBuildOutput(nodejsCompatMode, onStart, updateBundle) {
166005
166013
  build5.onEnd(async ({ errors, warnings }) => {
166006
166014
  if (errors.length > 0) {
166007
166015
  if (nodejsCompatMode !== "legacy") {
166008
- rewriteNodeCompatBuildFailure(errors);
166016
+ rewriteNodeCompatBuildFailure(errors, nodejsCompatMode);
166009
166017
  }
166010
166018
  logBuildFailure(errors, warnings);
166011
166019
  return;
@@ -166026,31 +166034,20 @@ __name(logBuildOutput, "logBuildOutput");
166026
166034
 
166027
166035
  // src/deployment-bundle/node-compat.ts
166028
166036
  init_import_meta_url();
166029
- function getNodeCompatMode(compatibilityFlags, {
166030
- validateConfig = true,
166031
- nodeCompat = void 0,
166037
+ var import_miniflare2 = require("miniflare");
166038
+ function validateNodeCompatMode(compatibilityDateStr = "2000-01-01", compatibilityFlags, {
166039
+ nodeCompat: legacy = false,
166032
166040
  noBundle = void 0
166033
166041
  }) {
166034
166042
  const {
166043
+ mode,
166035
166044
  hasNodejsAlsFlag,
166036
166045
  hasNodejsCompatFlag,
166037
166046
  hasNodejsCompatV2Flag,
166038
166047
  hasExperimentalNodejsCompatV2Flag
166039
- } = parseNodeCompatibilityFlags(compatibilityFlags);
166040
- const legacy = nodeCompat === true;
166041
- let mode = null;
166042
- if (hasNodejsCompatV2Flag) {
166043
- mode = "v2";
166044
- } else if (hasNodejsCompatFlag) {
166045
- mode = "v1";
166046
- } else if (hasNodejsAlsFlag) {
166047
- mode = "als";
166048
- } else if (legacy) {
166049
- mode = "legacy";
166050
- }
166051
- if (validateConfig !== true) {
166052
- return mode;
166053
- }
166048
+ } = (0, import_miniflare2.getNodeCompat)(compatibilityDateStr, compatibilityFlags, {
166049
+ nodeCompat: legacy
166050
+ });
166054
166051
  if (hasExperimentalNodejsCompatV2Flag) {
166055
166052
  throw new UserError(
166056
166053
  "The `experimental:` prefix on `nodejs_compat_v2` is no longer valid. Please remove it and try again."
@@ -166084,18 +166081,7 @@ function getNodeCompatMode(compatibilityFlags, {
166084
166081
  }
166085
166082
  return mode;
166086
166083
  }
166087
- __name(getNodeCompatMode, "getNodeCompatMode");
166088
- function parseNodeCompatibilityFlags(compatibilityFlags) {
166089
- return {
166090
- hasNodejsAlsFlag: compatibilityFlags.includes("nodejs_als"),
166091
- hasNodejsCompatFlag: compatibilityFlags.includes("nodejs_compat"),
166092
- hasNodejsCompatV2Flag: compatibilityFlags.includes("nodejs_compat_v2"),
166093
- hasExperimentalNodejsCompatV2Flag: compatibilityFlags.includes(
166094
- "experimental:nodejs_compat_v2"
166095
- )
166096
- };
166097
- }
166098
- __name(parseNodeCompatibilityFlags, "parseNodeCompatibilityFlags");
166084
+ __name(validateNodeCompatMode, "validateNodeCompatMode");
166099
166085
 
166100
166086
  // src/durable.ts
166101
166087
  init_import_meta_url();
@@ -166704,7 +166690,7 @@ __name(e2, "e");
166704
166690
  init_import_meta_url();
166705
166691
  var import_node_buffer2 = require("node:buffer");
166706
166692
  var import_node_url7 = require("node:url");
166707
- var import_miniflare5 = require("miniflare");
166693
+ var import_miniflare6 = require("miniflare");
166708
166694
  var import_undici6 = __toESM(require_undici());
166709
166695
 
166710
166696
  // src/dev/get-local-persistence-path.ts
@@ -166785,11 +166771,11 @@ var init = WebAssembly.compile((E = "AGFzbQEAAAABKghgAX8Bf2AEf39/fwBgAAF/YAAAYAF
166785
166771
  var E;
166786
166772
 
166787
166773
  // src/dev/miniflare.ts
166788
- var import_miniflare4 = require("miniflare");
166774
+ var import_miniflare5 = require("miniflare");
166789
166775
 
166790
166776
  // src/ai/fetcher.ts
166791
166777
  init_import_meta_url();
166792
- var import_miniflare2 = require("miniflare");
166778
+ var import_miniflare3 = require("miniflare");
166793
166779
  var EXTERNAL_AI_WORKER_NAME = "__WRANGLER_EXTERNAL_AI_WORKER";
166794
166780
  var EXTERNAL_AI_WORKER_SCRIPT = `
166795
166781
  import { Ai } from 'cloudflare-internal:ai-api'
@@ -166808,10 +166794,10 @@ async function AIFetcher(request3) {
166808
166794
  body: request3.body,
166809
166795
  duplex: "half"
166810
166796
  });
166811
- const respHeaders = new import_miniflare2.Headers(res.headers);
166797
+ const respHeaders = new import_miniflare3.Headers(res.headers);
166812
166798
  respHeaders.delete("Host");
166813
166799
  respHeaders.delete("Content-Length");
166814
- return new import_miniflare2.Response(res.body, { status: res.status, headers: respHeaders });
166800
+ return new import_miniflare3.Response(res.body, { status: res.status, headers: respHeaders });
166815
166801
  }
166816
166802
  __name(AIFetcher, "AIFetcher");
166817
166803
 
@@ -166845,7 +166831,7 @@ init_import_meta_url();
166845
166831
  var import_node_assert9 = __toESM(require("node:assert"));
166846
166832
  var import_node_fs11 = __toESM(require("node:fs"));
166847
166833
  var import_node_url6 = __toESM(require("node:url"));
166848
- var import_miniflare3 = require("miniflare");
166834
+ var import_miniflare4 = require("miniflare");
166849
166835
  function maybeGetFile(filePath) {
166850
166836
  try {
166851
166837
  return import_node_fs11.default.readFileSync(filePath, "utf8");
@@ -166893,7 +166879,7 @@ function getSourceMappingPrepareStackTrace(retrieveSourceMap) {
166893
166879
  if (sourceMappingPrepareStackTrace !== void 0) {
166894
166880
  return sourceMappingPrepareStackTrace;
166895
166881
  }
166896
- const support = (0, import_miniflare3.getFreshSourceMapSupport)();
166882
+ const support = (0, import_miniflare4.getFreshSourceMapSupport)();
166897
166883
  const originalPrepareStackTrace = Error.prepareStackTrace;
166898
166884
  support.install({
166899
166885
  environment: "node",
@@ -167297,7 +167283,7 @@ export default {
167297
167283
  }
167298
167284
  }
167299
167285
  `;
167300
- var WranglerLog = class extends import_miniflare4.Log {
167286
+ var WranglerLog = class extends import_miniflare5.Log {
167301
167287
  #warnedCompatibilityDateFallback = false;
167302
167288
  log(message) {
167303
167289
  if (message.includes(EXTERNAL_SERVICE_WORKER_NAME)) {
@@ -167342,13 +167328,13 @@ function castLogLevel(level) {
167342
167328
  if (key === "LOG") {
167343
167329
  key = "INFO";
167344
167330
  }
167345
- return import_miniflare4.LogLevel[key];
167331
+ return import_miniflare5.LogLevel[key];
167346
167332
  }
167347
167333
  __name(castLogLevel, "castLogLevel");
167348
167334
  function buildLog() {
167349
167335
  let level = castLogLevel(logger.loggerLevel);
167350
- if (level <= import_miniflare4.LogLevel.DEBUG) {
167351
- level = Math.min(level, import_miniflare4.LogLevel.WARN);
167336
+ if (level <= import_miniflare5.LogLevel.DEBUG) {
167337
+ level = Math.min(level, import_miniflare5.LogLevel.WARN);
167352
167338
  }
167353
167339
  return new WranglerLog(level, { prefix: "wrangler-UserWorker" });
167354
167340
  }
@@ -167476,7 +167462,7 @@ function buildMiniflareBindingOptions(config) {
167476
167462
  };
167477
167463
  } else {
167478
167464
  let address;
167479
- let style = import_miniflare4.HttpOptions_Style.PROXY;
167465
+ let style = import_miniflare5.HttpOptions_Style.PROXY;
167480
167466
  if (service.entrypoint !== void 0) {
167481
167467
  if (target.entrypointAddresses === void 0) {
167482
167468
  throw new UserError(
@@ -167499,7 +167485,7 @@ function buildMiniflareBindingOptions(config) {
167499
167485
  );
167500
167486
  }
167501
167487
  address = `${target.host}:${target.port}`;
167502
- style = import_miniflare4.HttpOptions_Style.HOST;
167488
+ style = import_miniflare5.HttpOptions_Style.HOST;
167503
167489
  } else {
167504
167490
  address = `${defaultEntrypointAddress.host}:${defaultEntrypointAddress.port}`;
167505
167491
  }
@@ -167509,7 +167495,7 @@ function buildMiniflareBindingOptions(config) {
167509
167495
  address,
167510
167496
  http: {
167511
167497
  style,
167512
- cfBlobHeader: import_miniflare4.CoreHeaders.CF_BLOB
167498
+ cfBlobHeader: import_miniflare5.CoreHeaders.CF_BLOB
167513
167499
  }
167514
167500
  }
167515
167501
  };
@@ -167857,7 +167843,7 @@ var ErrorEvent = class extends Event {
167857
167843
  }
167858
167844
  };
167859
167845
  __name(ErrorEvent, "ErrorEvent");
167860
- var MiniflareServer = class extends import_miniflare4.TypedEventTarget {
167846
+ var MiniflareServer = class extends import_miniflare5.TypedEventTarget {
167861
167847
  #log = buildLog();
167862
167848
  #mf;
167863
167849
  // This is given as a shared secret to the Proxy and User workers
@@ -167867,7 +167853,7 @@ var MiniflareServer = class extends import_miniflare4.TypedEventTarget {
167867
167853
  // `buildMiniflareOptions()` is asynchronous, meaning if multiple bundle
167868
167854
  // updates were submitted, the second may apply before the first. Therefore,
167869
167855
  // wrap updates in a mutex, so they're always applied in invocation order.
167870
- #mutex = new import_miniflare4.Mutex();
167856
+ #mutex = new import_miniflare5.Mutex();
167871
167857
  async #onBundleUpdate(config, opts) {
167872
167858
  if (opts?.signal?.aborted) {
167873
167859
  return;
@@ -167882,7 +167868,7 @@ var MiniflareServer = class extends import_miniflare4.TypedEventTarget {
167882
167868
  return;
167883
167869
  }
167884
167870
  if (this.#mf === void 0) {
167885
- this.#mf = new import_miniflare4.Miniflare(options29);
167871
+ this.#mf = new import_miniflare5.Miniflare(options29);
167886
167872
  } else {
167887
167873
  await this.#mf.setOptions(options29);
167888
167874
  }
@@ -168167,7 +168153,7 @@ __name(getKVNamespaceId, "getKVNamespaceId");
168167
168153
  async function usingLocalNamespace(persistTo, configPath, namespaceId, closure) {
168168
168154
  const persist = getLocalPersistencePath(persistTo, configPath);
168169
168155
  const persistOptions = buildPersistOptions(persist);
168170
- const mf = new import_miniflare5.Miniflare({
168156
+ const mf = new import_miniflare6.Miniflare({
168171
168157
  script: 'addEventListener("fetch", (e) => e.respondWith(new Response(null, { status: 404 })))',
168172
168158
  ...persistOptions,
168173
168159
  kvNamespaces: { NAMESPACE: namespaceId }
@@ -171483,11 +171469,16 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
171483
171469
  const jsxFragment = props.jsxFragment || config.jsx_fragment;
171484
171470
  const keepVars = props.keepVars || config.keep_vars;
171485
171471
  const minify = props.minify ?? config.minify;
171472
+ const compatibilityDate = props.compatibilityDate ?? config.compatibility_date;
171486
171473
  const compatibilityFlags = props.compatibilityFlags ?? config.compatibility_flags;
171487
- const nodejsCompatMode = getNodeCompatMode(compatibilityFlags, {
171488
- nodeCompat: props.nodeCompat ?? config.node_compat,
171489
- noBundle: props.noBundle ?? config.no_bundle
171490
- });
171474
+ const nodejsCompatMode = validateNodeCompatMode(
171475
+ compatibilityDate,
171476
+ compatibilityFlags,
171477
+ {
171478
+ nodeCompat: props.nodeCompat ?? config.node_compat,
171479
+ noBundle: props.noBundle ?? config.no_bundle
171480
+ }
171481
+ );
171491
171482
  if (props.noBundle && minify) {
171492
171483
  logger.warn(
171493
171484
  "`--minify` and `--no-bundle` can't be used together. If you want to minify your Worker and disable Wrangler's bundling, please minify as part of your own bundling process."
@@ -174242,7 +174233,7 @@ var import_node_http3 = require("node:http");
174242
174233
  var import_node_http22 = require("node:http2");
174243
174234
  var import_node_https = __toESM(require("node:https"));
174244
174235
  var import_http_terminator2 = __toESM(require_src5());
174245
- var import_miniflare10 = require("miniflare");
174236
+ var import_miniflare11 = require("miniflare");
174246
174237
  var import_react2 = __toESM(require_react());
174247
174238
  var import_serve_static = __toESM(require_serve_static());
174248
174239
 
@@ -174250,7 +174241,7 @@ var import_serve_static = __toESM(require_serve_static());
174250
174241
  init_import_meta_url();
174251
174242
  var fs11 = __toESM(require("node:fs"));
174252
174243
  var path34 = __toESM(require("node:path"));
174253
- var import_miniflare9 = require("miniflare");
174244
+ var import_miniflare10 = require("miniflare");
174254
174245
  var CERT_EXPIRY_DAYS = 30;
174255
174246
  var ONE_DAY_IN_MS = 864e5;
174256
174247
  var getHttpsKeyPathFromEnv = getEnvironmentVariableFactory({
@@ -174350,7 +174341,7 @@ function generateCertificate() {
174350
174341
  name: "subjectAltName",
174351
174342
  altNames: [
174352
174343
  { type: 2, value: "localhost" },
174353
- ...(0, import_miniflare9.getAccessibleHosts)(false).map((ip2) => ({ type: 7, ip: ip2 }))
174344
+ ...(0, import_miniflare10.getAccessibleHosts)(false).map((ip2) => ({ type: 7, ip: ip2 }))
174354
174345
  ]
174355
174346
  }
174356
174347
  ]
@@ -174461,7 +174452,7 @@ async function startPreviewServer({
174461
174452
  logger.log(`\u2B23 Listening at ${localProtocol}://${ip2}:${usedPort}`);
174462
174453
  const accessibleHosts = [];
174463
174454
  if (ip2 === "::" || ip2 === "*" || ip2 === "0.0.0.0") {
174464
- accessibleHosts.push(...(0, import_miniflare10.getAccessibleHosts)(true));
174455
+ accessibleHosts.push(...(0, import_miniflare11.getAccessibleHosts)(true));
174465
174456
  if (ip2 !== "0.0.0.0") {
174466
174457
  accessibleHosts.push("localhost");
174467
174458
  accessibleHosts.push("[::1]");
@@ -176278,7 +176269,7 @@ init_import_meta_url();
176278
176269
  // src/cli-hotkeys.ts
176279
176270
  init_import_meta_url();
176280
176271
  var import_readline2 = __toESM(require("readline"));
176281
- var import_miniflare11 = require("miniflare");
176272
+ var import_miniflare12 = require("miniflare");
176282
176273
 
176283
176274
  // src/utils/onKeyPress.ts
176284
176275
  init_import_meta_url();
@@ -176368,16 +176359,16 @@ function cli_hotkeys_default(options29) {
176368
176359
  __name(printInstructions, "printInstructions");
176369
176360
  Logger.registerBeforeLogHook(clearPreviousInstructions);
176370
176361
  Logger.registerAfterLogHook(printInstructions);
176371
- import_miniflare11.Log.unstable_registerBeforeLogHook(clearPreviousInstructions);
176372
- import_miniflare11.Log.unstable_registerAfterLogHook(printInstructions);
176362
+ import_miniflare12.Log.unstable_registerBeforeLogHook(clearPreviousInstructions);
176363
+ import_miniflare12.Log.unstable_registerAfterLogHook(printInstructions);
176373
176364
  printInstructions();
176374
176365
  return () => {
176375
176366
  unregisterKeyPress();
176376
176367
  clearPreviousInstructions();
176377
176368
  Logger.registerBeforeLogHook(void 0);
176378
176369
  Logger.registerAfterLogHook(void 0);
176379
- import_miniflare11.Log.unstable_registerBeforeLogHook(void 0);
176380
- import_miniflare11.Log.unstable_registerAfterLogHook(void 0);
176370
+ import_miniflare12.Log.unstable_registerBeforeLogHook(void 0);
176371
+ import_miniflare12.Log.unstable_registerAfterLogHook(void 0);
176381
176372
  };
176382
176373
  }
176383
176374
  __name(cli_hotkeys_default, "default");
@@ -187103,7 +187094,7 @@ var import_node_path38 = __toESM(require("node:path"));
187103
187094
  var import_ink7 = __toESM(require_build2());
187104
187095
  var import_ink_table3 = __toESM(require_dist4());
187105
187096
  var import_md5_file = __toESM(require_md5_file());
187106
- var import_miniflare13 = require("miniflare");
187097
+ var import_miniflare14 = require("miniflare");
187107
187098
  var import_undici14 = __toESM(require_undici());
187108
187099
 
187109
187100
  // src/d1/splitter.ts
@@ -187436,7 +187427,7 @@ async function executeLocally({
187436
187427
  logger.log(
187437
187428
  "\u{1F300} To execute on your remote database, add a --remote flag to your wrangler command."
187438
187429
  );
187439
- const mf = new import_miniflare13.Miniflare({
187430
+ const mf = new import_miniflare14.Miniflare({
187440
187431
  modules: true,
187441
187432
  script: "",
187442
187433
  d1Persist,
@@ -187693,7 +187684,7 @@ __name(checkForSQLiteBinary, "checkForSQLiteBinary");
187693
187684
  init_import_meta_url();
187694
187685
  var import_promises15 = __toESM(require("node:fs/promises"));
187695
187686
  var import_node_path39 = __toESM(require("node:path"));
187696
- var import_miniflare14 = require("miniflare");
187687
+ var import_miniflare15 = require("miniflare");
187697
187688
  var import_undici15 = __toESM(require_undici());
187698
187689
  function Options7(yargs) {
187699
187690
  return Name(yargs).option("local", {
@@ -187765,7 +187756,7 @@ async function exportLocal(config, name2, output, tables, noSchema, noData) {
187765
187756
  logger.log(
187766
187757
  "\u{1F300} To export your remote database, add a --remote flag to your wrangler command."
187767
187758
  );
187768
- const mf = new import_miniflare14.Miniflare({
187759
+ const mf = new import_miniflare15.Miniflare({
187769
187760
  modules: true,
187770
187761
  script: "export default {}",
187771
187762
  d1Persist,
@@ -192967,7 +192958,6 @@ function buildWorkerFromFunctions({
192967
192958
  serveLegacyAssetsFromWorker: false,
192968
192959
  checkFetch: local,
192969
192960
  targetConsumer: local ? "dev" : "deploy",
192970
- forPages: true,
192971
192961
  local,
192972
192962
  projectRoot: getPagesProjectRoot(),
192973
192963
  defineNavigatorUserAgent
@@ -193039,7 +193029,6 @@ function buildRawWorker({
193039
193029
  serveLegacyAssetsFromWorker: false,
193040
193030
  checkFetch: local,
193041
193031
  targetConsumer: local ? "dev" : "deploy",
193042
- forPages: true,
193043
193032
  local,
193044
193033
  projectRoot: getPagesProjectRoot(),
193045
193034
  defineNavigatorUserAgent
@@ -193324,7 +193313,6 @@ function buildPluginFromFunctions({
193324
193313
  // TODO: mock AE datasets in Pages functions for dev
193325
193314
  mockAnalyticsEngineDatasets: [],
193326
193315
  targetConsumer: local ? "dev" : "deploy",
193327
- forPages: true,
193328
193316
  local,
193329
193317
  projectRoot: getPagesProjectRoot(),
193330
193318
  defineNavigatorUserAgent
@@ -194184,10 +194172,14 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
194184
194172
  args.outfile = (0, import_node_path53.resolve)(args.outfile);
194185
194173
  }
194186
194174
  const { nodeCompat: node_compat, ...argsExceptNodeCompat } = args;
194187
- const nodejsCompatMode = getNodeCompatMode(args.compatibilityFlags ?? [], {
194188
- nodeCompat: node_compat,
194189
- noBundle: config?.no_bundle
194190
- });
194175
+ const nodejsCompatMode = validateNodeCompatMode(
194176
+ args.compatibilityDate ?? config?.compatibility_date,
194177
+ args.compatibilityFlags ?? config?.compatibility_flags ?? [],
194178
+ {
194179
+ nodeCompat: node_compat,
194180
+ noBundle: config?.no_bundle
194181
+ }
194182
+ );
194191
194183
  const defineNavigatorUserAgent = isNavigatorDefined(
194192
194184
  args.compatibilityDate,
194193
194185
  args.compatibilityFlags
@@ -194387,7 +194379,8 @@ async function deploy2({
194387
194379
  throw err;
194388
194380
  }
194389
194381
  }
194390
- const nodejsCompatMode = getNodeCompatMode(
194382
+ const nodejsCompatMode = validateNodeCompatMode(
194383
+ config?.compatibility_date ?? deploymentConfig.compatibility_date,
194391
194384
  config?.compatibility_flags ?? deploymentConfig.compatibility_flags ?? [],
194392
194385
  {
194393
194386
  nodeCompat: false,
@@ -196137,7 +196130,8 @@ The Worker script should be named \`_worker.js\` and located in the build output
196137
196130
  const functionsDirectory = "./functions";
196138
196131
  let usingFunctions = !usingWorkerScript && (0, import_node_fs32.existsSync)(functionsDirectory);
196139
196132
  let scriptPath3 = "";
196140
- const nodejsCompatMode = getNodeCompatMode(
196133
+ const nodejsCompatMode = validateNodeCompatMode(
196134
+ args.compatibilityDate ?? config.compatibility_date,
196141
196135
  args.compatibilityFlags ?? config.compatibility_flags ?? [],
196142
196136
  {
196143
196137
  nodeCompat: args.nodeCompat,
@@ -196724,12 +196718,12 @@ init_import_meta_url();
196724
196718
  var import_fs10 = require("fs");
196725
196719
  var import_promises24 = require("node:fs/promises");
196726
196720
  var import_toml6 = __toESM(require_toml());
196727
- var import_miniflare15 = require("miniflare");
196721
+ var import_miniflare16 = require("miniflare");
196728
196722
  async function toEnvironment(deploymentConfig, accountId) {
196729
196723
  const configObj = {};
196730
196724
  configObj.compatibility_date = deploymentConfig.compatibility_date ?? (/* @__PURE__ */ new Date()).toISOString().substring(0, 10);
196731
196725
  if (deploymentConfig.always_use_latest_compatibility_date) {
196732
- configObj.compatibility_date = import_miniflare15.supportedCompatibilityDate;
196726
+ configObj.compatibility_date = import_miniflare16.supportedCompatibilityDate;
196733
196727
  }
196734
196728
  if (deploymentConfig.compatibility_flags?.length) {
196735
196729
  configObj.compatibility_flags = deploymentConfig.compatibility_flags;
@@ -198888,7 +198882,7 @@ var MAX_UPLOAD_SIZE = 300 * 1024 * 1024;
198888
198882
 
198889
198883
  // src/r2/helpers.ts
198890
198884
  init_import_meta_url();
198891
- var import_miniflare16 = require("miniflare");
198885
+ var import_miniflare17 = require("miniflare");
198892
198886
  async function listR2Buckets(accountId, jurisdiction) {
198893
198887
  const headers = {};
198894
198888
  if (jurisdiction !== void 0) {
@@ -199015,7 +199009,7 @@ __name(deleteR2Object, "deleteR2Object");
199015
199009
  async function usingLocalBucket(persistTo, configPath, bucketName, closure) {
199016
199010
  const persist = getLocalPersistencePath(persistTo, configPath);
199017
199011
  const persistOptions = buildPersistOptions(persist);
199018
- const mf = new import_miniflare16.Miniflare({
199012
+ const mf = new import_miniflare17.Miniflare({
199019
199013
  modules: true,
199020
199014
  // TODO(soon): import `reduceError()` from `miniflare:shared`
199021
199015
  script: `
@@ -209867,12 +209861,13 @@ __name(triggersDeployHandler, "triggersDeployHandler");
209867
209861
  init_import_meta_url();
209868
209862
  var fs25 = __toESM(require("node:fs"));
209869
209863
  var import_node_path60 = require("node:path");
209864
+ var import_miniflare20 = require("miniflare");
209870
209865
 
209871
209866
  // src/type-generation/runtime/index.ts
209872
209867
  init_import_meta_url();
209873
209868
  var import_fs14 = require("fs");
209874
209869
  var import_promises26 = require("fs/promises");
209875
- var import_miniflare18 = require("miniflare");
209870
+ var import_miniflare19 = require("miniflare");
209876
209871
  var import_workerd = __toESM(require_main5());
209877
209872
  var DEFAULT_OUTFILE_RELATIVE_PATH = "./.wrangler/types/runtime.d.ts";
209878
209873
  async function generateRuntimeTypes({
@@ -209914,7 +209909,7 @@ async function generate({
209914
209909
  compatibilityFlags = []
209915
209910
  }) {
209916
209911
  const worker = (0, import_fs14.readFileSync)(require.resolve("workerd/worker.mjs")).toString();
209917
- const mf = new import_miniflare18.Miniflare({
209912
+ const mf = new import_miniflare19.Miniflare({
209918
209913
  compatibilityDate: "2024-01-01",
209919
209914
  compatibilityFlags: ["nodejs_compat", "rtti_api"],
209920
209915
  modules: true,
@@ -210042,10 +210037,13 @@ async function typesHandler(args) {
210042
210037
  });
210043
210038
  const tsconfigPath = config.tsconfig ?? (0, import_node_path60.join)((0, import_node_path60.dirname)(configPath), "tsconfig.json");
210044
210039
  const tsconfigTypes = readTsconfigTypes(tsconfigPath);
210045
- const mode = getNodeCompatMode(config.compatibility_flags, {
210046
- validateConfig: false,
210047
- nodeCompat: config.node_compat
210048
- });
210040
+ const { mode } = (0, import_miniflare20.getNodeCompat)(
210041
+ config.compatibility_date,
210042
+ config.compatibility_flags,
210043
+ {
210044
+ nodeCompat: config.node_compat
210045
+ }
210046
+ );
210049
210047
  logRuntimeTypesMessage(outFile, tsconfigTypes, mode !== null);
210050
210048
  }
210051
210049
  const secrets = getVarsForDev(
@@ -212073,7 +212071,8 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
212073
212071
  const jsxFactory = props.jsxFactory || config.jsx_factory;
212074
212072
  const jsxFragment = props.jsxFragment || config.jsx_fragment;
212075
212073
  const minify = props.minify ?? config.minify;
212076
- const nodejsCompatMode = getNodeCompatMode(
212074
+ const nodejsCompatMode = validateNodeCompatMode(
212075
+ props.compatibilityDate ?? config.compatibility_date,
212077
212076
  props.compatibilityFlags ?? config.compatibility_flags,
212078
212077
  {
212079
212078
  nodeCompat: props.nodeCompat ?? config.node_compat,
@@ -214417,7 +214416,8 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
214417
214416
  additionalModules: args.additionalModules,
214418
214417
  moduleRoot: args.moduleRoot,
214419
214418
  moduleRules: args.rules,
214420
- nodejsCompatMode: (parsedConfig) => getNodeCompatMode(
214419
+ nodejsCompatMode: (parsedConfig) => validateNodeCompatMode(
214420
+ args.compatibilityDate ?? parsedConfig.compatibility_date,
214421
214421
  args.compatibilityFlags ?? parsedConfig.compatibility_flags ?? [],
214422
214422
  {
214423
214423
  nodeCompat: args.nodeCompat ?? parsedConfig.node_compat,
@@ -214548,6 +214548,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
214548
214548
  config,
214549
214549
  "dev"
214550
214550
  );
214551
+ await getHostAndRoutes(args, config);
214551
214552
  assetsOptions = processAssetsArg(args, config);
214552
214553
  if (assetsOptions && !args.assets) {
214553
214554
  await assetsWatcher?.close();
@@ -214583,7 +214584,8 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
214583
214584
  processEntrypoint,
214584
214585
  additionalModules
214585
214586
  } = devServerSettings;
214586
- const nodejsCompatMode = getNodeCompatMode(
214587
+ const nodejsCompatMode = validateNodeCompatMode(
214588
+ args.compatibilityDate ?? config.compatibility_date,
214587
214589
  args.compatibilityFlags ?? config.compatibility_flags ?? [],
214588
214590
  {
214589
214591
  nodeCompat: args.nodeCompat ?? config.node_compat,
@@ -214722,7 +214724,8 @@ async function startApiDev(args) {
214722
214724
  processEntrypoint,
214723
214725
  additionalModules
214724
214726
  } = await validateDevServerSettings(args, config);
214725
- const nodejsCompatMode = getNodeCompatMode(
214727
+ const nodejsCompatMode = validateNodeCompatMode(
214728
+ args.compatibilityDate ?? config.compatibility_date,
214726
214729
  args.compatibilityFlags ?? config.compatibility_flags,
214727
214730
  {
214728
214731
  nodeCompat: args.nodeCompat ?? config.node_compat,
@@ -215952,7 +215955,7 @@ __name(ConfigController, "ConfigController");
215952
215955
  init_import_meta_url();
215953
215956
  var import_node_crypto10 = require("node:crypto");
215954
215957
  var import_promises27 = require("node:fs/promises");
215955
- var import_miniflare19 = require("miniflare");
215958
+ var import_miniflare21 = require("miniflare");
215956
215959
  async function getBinaryFileContents2(file) {
215957
215960
  if ("contents" in file) {
215958
215961
  if (file.contents instanceof Buffer) {
@@ -216064,7 +216067,7 @@ var LocalRuntimeController = class extends RuntimeController {
216064
216067
  // `buildMiniflareOptions()` is asynchronous, meaning if multiple bundle
216065
216068
  // updates were submitted, the second may apply before the first. Therefore,
216066
216069
  // wrap updates in a mutex, so they're always applied in invocation order.
216067
- #mutex = new import_miniflare19.Mutex();
216070
+ #mutex = new import_miniflare21.Mutex();
216068
216071
  #mf;
216069
216072
  onBundleStart(_3) {
216070
216073
  }
@@ -216078,7 +216081,7 @@ var LocalRuntimeController = class extends RuntimeController {
216078
216081
  options29.liveReload = false;
216079
216082
  if (this.#mf === void 0) {
216080
216083
  logger.log(source_default.dim("\u2394 Starting local server..."));
216081
- this.#mf = new import_miniflare19.Miniflare(options29);
216084
+ this.#mf = new import_miniflare21.Miniflare(options29);
216082
216085
  } else {
216083
216086
  logger.log(source_default.dim("\u2394 Reloading local server..."));
216084
216087
  await this.#mf.setOptions(options29);
@@ -216180,7 +216183,7 @@ var import_node_assert26 = __toESM(require("node:assert"));
216180
216183
  var import_node_crypto11 = require("node:crypto");
216181
216184
  var import_node_events5 = __toESM(require("node:events"));
216182
216185
  var import_node_path68 = __toESM(require("node:path"));
216183
- var import_miniflare20 = require("miniflare");
216186
+ var import_miniflare22 = require("miniflare");
216184
216187
 
216185
216188
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts
216186
216189
  init_import_meta_url();
@@ -216235,7 +216238,7 @@ var ProxyController = class extends Controller {
216235
216238
  PROXY_CONTROLLER: async (req) => {
216236
216239
  const message = await req.json();
216237
216240
  this.onProxyWorkerMessage(message);
216238
- return new import_miniflare20.Response(null, { status: 204 });
216241
+ return new import_miniflare22.Response(null, { status: 204 });
216239
216242
  }
216240
216243
  },
216241
216244
  bindings: {
@@ -216296,7 +216299,7 @@ var ProxyController = class extends Controller {
216296
216299
  proxyWorkerOptions
216297
216300
  );
216298
216301
  const willInstantiateMiniflareInstance = !this.proxyWorker || proxyWorkerOptionsChanged;
216299
- this.proxyWorker ??= new import_miniflare20.Miniflare(proxyWorkerOptions);
216302
+ this.proxyWorker ??= new import_miniflare22.Miniflare(proxyWorkerOptions);
216300
216303
  this.proxyWorkerOptions = proxyWorkerOptions;
216301
216304
  if (proxyWorkerOptionsChanged) {
216302
216305
  logger.debug("ProxyWorker miniflare options changed, reinstantiating...");
@@ -216369,7 +216372,7 @@ var ProxyController = class extends Controller {
216369
216372
  this.inspectorProxyWorkerWebSocket?.resolve(webSocket);
216370
216373
  return webSocket;
216371
216374
  }
216372
- runtimeMessageMutex = new import_miniflare20.Mutex();
216375
+ runtimeMessageMutex = new import_miniflare22.Mutex();
216373
216376
  async sendMessageToProxyWorker(message, retries = 3) {
216374
216377
  if (this._torndown) {
216375
216378
  return;
@@ -216524,15 +216527,15 @@ var ProxyController = class extends Controller {
216524
216527
  );
216525
216528
  }
216526
216529
  if (maybeContents === void 0) {
216527
- return new import_miniflare20.Response(null, { status: 404 });
216530
+ return new import_miniflare22.Response(null, { status: 404 });
216528
216531
  }
216529
- return new import_miniflare20.Response(maybeContents);
216532
+ return new import_miniflare22.Response(maybeContents);
216530
216533
  }
216531
216534
  default:
216532
216535
  assertNever(message);
216533
- return new import_miniflare20.Response(null, { status: 404 });
216536
+ return new import_miniflare22.Response(null, { status: 404 });
216534
216537
  }
216535
- return new import_miniflare20.Response(null, { status: 204 });
216538
+ return new import_miniflare22.Response(null, { status: 204 });
216536
216539
  }
216537
216540
  _torndown = false;
216538
216541
  async teardown() {
@@ -216585,7 +216588,7 @@ var ProxyController = class extends Controller {
216585
216588
  __name(ProxyController, "ProxyController");
216586
216589
  var ProxyControllerLogger = class extends WranglerLog {
216587
216590
  log(message) {
216588
- if (message.includes("/cdn-cgi/") && this.level < import_miniflare20.LogLevel.DEBUG) {
216591
+ if (message.includes("/cdn-cgi/") && this.level < import_miniflare22.LogLevel.DEBUG) {
216589
216592
  return;
216590
216593
  }
216591
216594
  super.log(message);
@@ -216606,7 +216609,7 @@ __name(didMiniflareOptionsChange, "didMiniflareOptionsChange");
216606
216609
 
216607
216610
  // src/api/startDevWorker/RemoteRuntimeController.ts
216608
216611
  init_import_meta_url();
216609
- var import_miniflare22 = require("miniflare");
216612
+ var import_miniflare24 = require("miniflare");
216610
216613
 
216611
216614
  // src/api/startDevWorker/NotImplementedError.ts
216612
216615
  init_import_meta_url();
@@ -216632,7 +216635,7 @@ __name(notImplemented, "notImplemented");
216632
216635
  var RemoteRuntimeController = class extends RuntimeController {
216633
216636
  #abortController = new AbortController();
216634
216637
  #currentBundleId = 0;
216635
- #mutex = new import_miniflare22.Mutex();
216638
+ #mutex = new import_miniflare24.Mutex();
216636
216639
  #session;
216637
216640
  async #previewSession(props) {
216638
216641
  try {
@@ -217013,7 +217016,7 @@ init_import_meta_url();
217013
217016
 
217014
217017
  // src/api/integrations/platform/index.ts
217015
217018
  init_import_meta_url();
217016
- var import_miniflare24 = require("miniflare");
217019
+ var import_miniflare26 = require("miniflare");
217017
217020
 
217018
217021
  // src/api/integrations/platform/caches.ts
217019
217022
  init_import_meta_url();
@@ -217074,7 +217077,7 @@ __name(ExecutionContext, "ExecutionContext");
217074
217077
 
217075
217078
  // src/api/integrations/platform/services.ts
217076
217079
  init_import_meta_url();
217077
- var import_miniflare23 = require("miniflare");
217080
+ var import_miniflare25 = require("miniflare");
217078
217081
  var import_undici28 = __toESM(require_undici());
217079
217082
  async function getServiceBindings(services = []) {
217080
217083
  if (services.length === 0) {
@@ -217126,9 +217129,9 @@ function getServiceBindingProxyFetch({
217126
217129
  try {
217127
217130
  const resp = await (0, import_undici28.fetch)(newUrl, request3);
217128
217131
  const respBody = await resp.arrayBuffer();
217129
- return new import_miniflare23.Response(respBody, resp);
217132
+ return new import_miniflare25.Response(respBody, resp);
217130
217133
  } catch {
217131
- return new import_miniflare23.Response(
217134
+ return new import_miniflare25.Response(
217132
217135
  `Error: Unable to fetch from external service (${serviceName} bound with ${bindingName} binding), please make sure that the service is still running with \`wrangler dev\``,
217133
217136
  { status: 500 }
217134
217137
  );
@@ -217160,7 +217163,7 @@ async function getPlatformProxy(options29 = {}) {
217160
217163
  },
217161
217164
  () => getMiniflareOptionsFromConfig(rawConfig, env7, options29)
217162
217165
  );
217163
- const mf = new import_miniflare24.Miniflare({
217166
+ const mf = new import_miniflare26.Miniflare({
217164
217167
  script: "",
217165
217168
  modules: true,
217166
217169
  ...miniflareOptions
@@ -217268,7 +217271,7 @@ function unstable_getMiniflareWorkerOptions(configPath, env7) {
217268
217271
  if (bindings.services !== void 0) {
217269
217272
  bindingOptions.serviceBindings = Object.fromEntries(
217270
217273
  bindings.services.map((binding) => {
217271
- const name2 = binding.service === config.name ? import_miniflare24.kCurrentWorker : binding.service;
217274
+ const name2 = binding.service === config.name ? import_miniflare26.kCurrentWorker : binding.service;
217272
217275
  return [binding.binding, { name: name2, entrypoint: binding.entrypoint }];
217273
217276
  })
217274
217277
  );