miniflare 0.0.0-e55f489db → 0.0.0-e5ae13ade

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/src/index.js CHANGED
@@ -254,17 +254,17 @@ var require_ignore = __commonJS({
254
254
  var throwError = (message, Ctor) => {
255
255
  throw new Ctor(message);
256
256
  };
257
- var checkPath = (path34, originalPath, doThrow) => {
258
- if (!isString(path34)) {
257
+ var checkPath = (path37, originalPath, doThrow) => {
258
+ if (!isString(path37)) {
259
259
  return doThrow(
260
260
  `path must be a string, but got \`${originalPath}\``,
261
261
  TypeError
262
262
  );
263
263
  }
264
- if (!path34) {
264
+ if (!path37) {
265
265
  return doThrow(`path must not be empty`, TypeError);
266
266
  }
267
- if (checkPath.isNotRelative(path34)) {
267
+ if (checkPath.isNotRelative(path37)) {
268
268
  const r = "`path.relative()`d";
269
269
  return doThrow(
270
270
  `path should be a ${r} string, but got "${originalPath}"`,
@@ -273,7 +273,7 @@ var require_ignore = __commonJS({
273
273
  }
274
274
  return true;
275
275
  };
276
- var isNotRelative = (path34) => REGEX_TEST_INVALID_PATH.test(path34);
276
+ var isNotRelative = (path37) => REGEX_TEST_INVALID_PATH.test(path37);
277
277
  checkPath.isNotRelative = isNotRelative;
278
278
  checkPath.convert = (p) => p;
279
279
  var Ignore = class {
@@ -332,7 +332,7 @@ var require_ignore = __commonJS({
332
332
  // setting `checkUnignored` to `false` could reduce additional
333
333
  // path matching.
334
334
  // @returns {TestResult} true if a file is ignored
335
- _testOne(path34, checkUnignored) {
335
+ _testOne(path37, checkUnignored) {
336
336
  let ignored2 = false;
337
337
  let unignored = false;
338
338
  this._rules.forEach((rule) => {
@@ -340,7 +340,7 @@ var require_ignore = __commonJS({
340
340
  if (unignored === negative && ignored2 !== unignored || negative && !ignored2 && !unignored && !checkUnignored) {
341
341
  return;
342
342
  }
343
- const matched = rule.regex.test(path34);
343
+ const matched = rule.regex.test(path37);
344
344
  if (matched) {
345
345
  ignored2 = !negative;
346
346
  unignored = negative;
@@ -353,24 +353,24 @@ var require_ignore = __commonJS({
353
353
  }
354
354
  // @returns {TestResult}
355
355
  _test(originalPath, cache, checkUnignored, slices) {
356
- const path34 = originalPath && checkPath.convert(originalPath);
356
+ const path37 = originalPath && checkPath.convert(originalPath);
357
357
  checkPath(
358
- path34,
358
+ path37,
359
359
  originalPath,
360
360
  this._allowRelativePaths ? RETURN_FALSE : throwError
361
361
  );
362
- return this._t(path34, cache, checkUnignored, slices);
362
+ return this._t(path37, cache, checkUnignored, slices);
363
363
  }
364
- _t(path34, cache, checkUnignored, slices) {
365
- if (path34 in cache) {
366
- return cache[path34];
364
+ _t(path37, cache, checkUnignored, slices) {
365
+ if (path37 in cache) {
366
+ return cache[path37];
367
367
  }
368
368
  if (!slices) {
369
- slices = path34.split(SLASH);
369
+ slices = path37.split(SLASH);
370
370
  }
371
371
  slices.pop();
372
372
  if (!slices.length) {
373
- return cache[path34] = this._testOne(path34, checkUnignored);
373
+ return cache[path37] = this._testOne(path37, checkUnignored);
374
374
  }
375
375
  const parent = this._t(
376
376
  slices.join(SLASH) + SLASH,
@@ -378,24 +378,24 @@ var require_ignore = __commonJS({
378
378
  checkUnignored,
379
379
  slices
380
380
  );
381
- return cache[path34] = parent.ignored ? parent : this._testOne(path34, checkUnignored);
381
+ return cache[path37] = parent.ignored ? parent : this._testOne(path37, checkUnignored);
382
382
  }
383
- ignores(path34) {
384
- return this._test(path34, this._ignoreCache, false).ignored;
383
+ ignores(path37) {
384
+ return this._test(path37, this._ignoreCache, false).ignored;
385
385
  }
386
386
  createFilter() {
387
- return (path34) => !this.ignores(path34);
387
+ return (path37) => !this.ignores(path37);
388
388
  }
389
389
  filter(paths) {
390
390
  return makeArray(paths).filter(this.createFilter());
391
391
  }
392
392
  // @returns {TestResult}
393
- test(path34) {
394
- return this._test(path34, this._testCache, true);
393
+ test(path37) {
394
+ return this._test(path37, this._testCache, true);
395
395
  }
396
396
  };
397
397
  var factory = (options) => new Ignore(options);
398
- var isPathValid = (path34) => checkPath(path34 && checkPath.convert(path34), path34, RETURN_FALSE);
398
+ var isPathValid = (path37) => checkPath(path37 && checkPath.convert(path37), path37, RETURN_FALSE);
399
399
  factory.isPathValid = isPathValid;
400
400
  factory.default = factory;
401
401
  module2.exports = factory;
@@ -406,7 +406,7 @@ var require_ignore = __commonJS({
406
406
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
407
407
  checkPath.convert = makePosix;
408
408
  const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
409
- checkPath.isNotRelative = (path34) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path34) || isNotRelative(path34);
409
+ checkPath.isNotRelative = (path37) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path37) || isNotRelative(path37);
410
410
  }
411
411
  }
412
412
  });
@@ -449,11 +449,11 @@ var require_Mime = __commonJS({
449
449
  }
450
450
  }
451
451
  };
452
- Mime.prototype.getType = function(path34) {
453
- path34 = String(path34);
454
- let last = path34.replace(/^.*[/\\]/, "").toLowerCase();
452
+ Mime.prototype.getType = function(path37) {
453
+ path37 = String(path37);
454
+ let last = path37.replace(/^.*[/\\]/, "").toLowerCase();
455
455
  let ext = last.replace(/^.*\./, "").toLowerCase();
456
- let hasPath = last.length < path34.length;
456
+ let hasPath = last.length < path37.length;
457
457
  let hasDot = ext.length < last.length - 1;
458
458
  return (hasDot || !hasPath) && this._types[ext] || null;
459
459
  };
@@ -493,12 +493,18 @@ var require_mime = __commonJS({
493
493
  // src/index.ts
494
494
  var src_exports = {};
495
495
  __export(src_exports, {
496
+ AIOptionsSchema: () => AIOptionsSchema,
497
+ AI_PLUGIN: () => AI_PLUGIN,
498
+ AI_PLUGIN_NAME: () => AI_PLUGIN_NAME,
496
499
  ANALYTICS_ENGINE_PLUGIN: () => ANALYTICS_ENGINE_PLUGIN,
497
500
  ANALYTICS_ENGINE_PLUGIN_NAME: () => ANALYTICS_ENGINE_PLUGIN_NAME,
498
501
  ASSETS_PLUGIN: () => ASSETS_PLUGIN,
499
502
  AnalyticsEngineSchemaOptionsSchema: () => AnalyticsEngineSchemaOptionsSchema,
500
503
  AnalyticsEngineSchemaSharedOptionsSchema: () => AnalyticsEngineSchemaSharedOptionsSchema,
501
504
  AssetsOptionsSchema: () => AssetsOptionsSchema,
505
+ BROWSER_RENDERING_PLUGIN: () => BROWSER_RENDERING_PLUGIN,
506
+ BROWSER_RENDERING_PLUGIN_NAME: () => BROWSER_RENDERING_PLUGIN_NAME,
507
+ BrowserRenderingOptionsSchema: () => BrowserRenderingOptionsSchema,
502
508
  CACHE_PLUGIN: () => CACHE_PLUGIN,
503
509
  CACHE_PLUGIN_NAME: () => CACHE_PLUGIN_NAME,
504
510
  CORE_PLUGIN: () => CORE_PLUGIN,
@@ -517,11 +523,14 @@ __export(src_exports, {
517
523
  D1_PLUGIN: () => D1_PLUGIN,
518
524
  D1_PLUGIN_NAME: () => D1_PLUGIN_NAME,
519
525
  DEFAULT_PERSIST_ROOT: () => DEFAULT_PERSIST_ROOT,
526
+ DISPATCH_NAMESPACE_PLUGIN: () => DISPATCH_NAMESPACE_PLUGIN,
527
+ DISPATCH_NAMESPACE_PLUGIN_NAME: () => DISPATCH_NAMESPACE_PLUGIN_NAME,
520
528
  DURABLE_OBJECTS_PLUGIN: () => DURABLE_OBJECTS_PLUGIN,
521
529
  DURABLE_OBJECTS_PLUGIN_NAME: () => DURABLE_OBJECTS_PLUGIN_NAME,
522
530
  DURABLE_OBJECTS_STORAGE_SERVICE_NAME: () => DURABLE_OBJECTS_STORAGE_SERVICE_NAME,
523
531
  DeferredPromise: () => DeferredPromise,
524
532
  DispatchFetchDispatcher: () => DispatchFetchDispatcher,
533
+ DispatchNamespaceOptionsSchema: () => DispatchNamespaceOptionsSchema,
525
534
  DurableObjectsOptionsSchema: () => DurableObjectsOptionsSchema,
526
535
  DurableObjectsSharedOptionsSchema: () => DurableObjectsSharedOptionsSchema,
527
536
  EMAIL_PLUGIN: () => EMAIL_PLUGIN,
@@ -537,12 +546,16 @@ __export(src_exports, {
537
546
  HttpOptions_Style: () => HttpOptions_Style,
538
547
  HyperdriveInputOptionsSchema: () => HyperdriveInputOptionsSchema,
539
548
  HyperdriveSchema: () => HyperdriveSchema,
549
+ IMAGES_PLUGIN: () => IMAGES_PLUGIN,
550
+ IMAGES_PLUGIN_NAME: () => IMAGES_PLUGIN_NAME,
551
+ ImagesOptionsSchema: () => ImagesOptionsSchema,
540
552
  JsonSchema: () => JsonSchema,
541
553
  KVHeaders: () => KVHeaders,
542
554
  KVLimits: () => KVLimits,
543
555
  KVOptionsSchema: () => KVOptionsSchema,
544
556
  KVParams: () => KVParams,
545
557
  KVSharedOptionsSchema: () => KVSharedOptionsSchema,
558
+ KV_NAMESPACE_OBJECT_CLASS_NAME: () => KV_NAMESPACE_OBJECT_CLASS_NAME,
546
559
  KV_PLUGIN: () => KV_PLUGIN,
547
560
  KV_PLUGIN_NAME: () => KV_PLUGIN_NAME,
548
561
  LiteralSchema: () => LiteralSchema,
@@ -594,7 +607,7 @@ __export(src_exports, {
594
607
  RatelimitConfigSchema: () => RatelimitConfigSchema,
595
608
  RatelimitOptionsSchema: () => RatelimitOptionsSchema,
596
609
  Request: () => Request,
597
- Response: () => Response,
610
+ Response: () => Response2,
598
611
  RouterError: () => RouterError,
599
612
  Runtime: () => Runtime,
600
613
  SECRET_STORE_PLUGIN: () => SECRET_STORE_PLUGIN,
@@ -612,6 +625,9 @@ __export(src_exports, {
612
625
  SourceOptionsSchema: () => SourceOptionsSchema,
613
626
  TlsOptions_Version: () => TlsOptions_Version,
614
627
  TypedEventTarget: () => TypedEventTarget,
628
+ VECTORIZE_PLUGIN: () => VECTORIZE_PLUGIN,
629
+ VECTORIZE_PLUGIN_NAME: () => VECTORIZE_PLUGIN_NAME,
630
+ VectorizeOptionsSchema: () => VectorizeOptionsSchema,
615
631
  WORKER_BINDING_SERVICE_LOOPBACK: () => WORKER_BINDING_SERVICE_LOOPBACK,
616
632
  WORKFLOWS_PLUGIN: () => WORKFLOWS_PLUGIN,
617
633
  WORKFLOWS_PLUGIN_NAME: () => WORKFLOWS_PLUGIN_NAME,
@@ -666,6 +682,7 @@ __export(src_exports, {
666
682
  maybeParseURL: () => maybeParseURL,
667
683
  mergeWorkerOptions: () => mergeWorkerOptions,
668
684
  migrateDatabase: () => migrateDatabase,
685
+ mixedModeClientWorker: () => mixedModeClientWorker,
669
686
  namespaceEntries: () => namespaceEntries,
670
687
  namespaceKeys: () => namespaceKeys,
671
688
  normaliseDurableObject: () => normaliseDurableObject,
@@ -693,14 +710,14 @@ __export(src_exports, {
693
710
  zAwaitable: () => zAwaitable
694
711
  });
695
712
  module.exports = __toCommonJS(src_exports);
696
- var import_assert12 = __toESM(require("assert"));
713
+ var import_assert13 = __toESM(require("assert"));
697
714
  var import_crypto3 = __toESM(require("crypto"));
698
- var import_fs28 = __toESM(require("fs"));
699
- var import_promises13 = require("fs/promises");
715
+ var import_fs31 = __toESM(require("fs"));
716
+ var import_promises14 = require("fs/promises");
700
717
  var import_http6 = __toESM(require("http"));
701
718
  var import_net = __toESM(require("net"));
702
719
  var import_os2 = __toESM(require("os"));
703
- var import_path32 = __toESM(require("path"));
720
+ var import_path35 = __toESM(require("path"));
704
721
  var import_web5 = require("stream/web");
705
722
  var import_util5 = __toESM(require("util"));
706
723
  var import_zlib = __toESM(require("zlib"));
@@ -784,7 +801,7 @@ function zod_worker_default() {
784
801
 
785
802
  // src/index.ts
786
803
  var import_ws5 = require("ws");
787
- var import_zod26 = require("zod");
804
+ var import_zod31 = require("zod");
788
805
 
789
806
  // src/cf.ts
790
807
  var import_assert = __toESM(require("assert"));
@@ -915,6 +932,7 @@ var CoreBindings = {
915
932
  SERVICE_USER_ROUTE_PREFIX: "MINIFLARE_USER_ROUTE_",
916
933
  SERVICE_USER_FALLBACK: "MINIFLARE_USER_FALLBACK",
917
934
  TEXT_CUSTOM_SERVICE: "MINIFLARE_CUSTOM_SERVICE",
935
+ IMAGES_SERVICE: "MINIFLARE_IMAGES_SERVICE",
918
936
  TEXT_UPSTREAM_URL: "MINIFLARE_UPSTREAM_URL",
919
937
  JSON_CF_BLOB: "CF_BLOB",
920
938
  JSON_ROUTES: "MINIFLARE_ROUTES",
@@ -1369,12 +1387,12 @@ function createHTTPRevivers(impl) {
1369
1387
  },
1370
1388
  Request(value) {
1371
1389
  (0, import_node_assert.default)(Array.isArray(value));
1372
- const [method, url24, headers, cf, body] = value;
1390
+ const [method, url27, headers, cf, body] = value;
1373
1391
  (0, import_node_assert.default)(typeof method === "string");
1374
- (0, import_node_assert.default)(typeof url24 === "string");
1392
+ (0, import_node_assert.default)(typeof url27 === "string");
1375
1393
  (0, import_node_assert.default)(headers instanceof impl.Headers);
1376
1394
  (0, import_node_assert.default)(body === null || impl.isReadableStream(body));
1377
- return new impl.Request(url24, {
1395
+ return new impl.Request(url27, {
1378
1396
  method,
1379
1397
  headers,
1380
1398
  cf,
@@ -1500,19 +1518,19 @@ function parseWithReadableStreams(impl, stringified, revivers2) {
1500
1518
  }
1501
1519
 
1502
1520
  // src/workers/core/routing.ts
1503
- function matchRoutes(routes, url24) {
1521
+ function matchRoutes(routes, url27) {
1504
1522
  for (const route of routes) {
1505
- if (route.protocol && route.protocol !== url24.protocol) continue;
1523
+ if (route.protocol && route.protocol !== url27.protocol) continue;
1506
1524
  if (route.allowHostnamePrefix) {
1507
- if (!url24.hostname.endsWith(route.hostname)) continue;
1525
+ if (!url27.hostname.endsWith(route.hostname)) continue;
1508
1526
  } else {
1509
- if (url24.hostname !== route.hostname) continue;
1527
+ if (url27.hostname !== route.hostname) continue;
1510
1528
  }
1511
- const path34 = url24.pathname + url24.search;
1529
+ const path37 = url27.pathname + url27.search;
1512
1530
  if (route.allowPathSuffix) {
1513
- if (!path34.startsWith(route.path)) continue;
1531
+ if (!path37.startsWith(route.path)) continue;
1514
1532
  } else {
1515
- if (path34 !== route.path) continue;
1533
+ if (path37 !== route.path) continue;
1516
1534
  }
1517
1535
  return route.target;
1518
1536
  }
@@ -1742,8 +1760,8 @@ function decodeSitesKey(key) {
1742
1760
  return key.startsWith(SITES_NO_CACHE_PREFIX) ? decodeURIComponent(key.substring(SITES_NO_CACHE_PREFIX.length)) : key;
1743
1761
  }
1744
1762
  function isSitesRequest(request) {
1745
- const url24 = new URL(request.url);
1746
- return url24.pathname.startsWith(`/${SITES_NO_CACHE_PREFIX}`);
1763
+ const url27 = new URL(request.url);
1764
+ return url27.pathname.startsWith(`/${SITES_NO_CACHE_PREFIX}`);
1747
1765
  }
1748
1766
  function serialiseRegExp(regExp) {
1749
1767
  const str = regExp.toString();
@@ -1879,7 +1897,7 @@ var Request = class _Request extends import_undici2.Request {
1879
1897
  // src/http/response.ts
1880
1898
  var import_undici3 = require("undici");
1881
1899
  var kWebSocket = Symbol("kWebSocket");
1882
- var Response = class _Response extends import_undici3.Response {
1900
+ var Response2 = class _Response extends import_undici3.Response {
1883
1901
  // We should be able to use a private `#webSocket` property here instead of a
1884
1902
  // symbol here, but `undici` calls `this.status` in its constructor, which
1885
1903
  // causes a "Cannot read private member from an object whose class did not
@@ -1894,8 +1912,8 @@ var Response = class _Response extends import_undici3.Response {
1894
1912
  Object.setPrototypeOf(response, _Response.prototype);
1895
1913
  return response;
1896
1914
  }
1897
- static redirect(url24, status) {
1898
- const response = import_undici3.Response.redirect(url24, status);
1915
+ static redirect(url27, status) {
1916
+ const response = import_undici3.Response.redirect(url27, status);
1899
1917
  Object.setPrototypeOf(response, _Response.prototype);
1900
1918
  return response;
1901
1919
  }
@@ -2380,14 +2398,14 @@ async function fetch4(input, init2) {
2380
2398
  const requestInit = init2;
2381
2399
  const request = new Request(input, requestInit);
2382
2400
  if (request.method === "GET" && request.headers.get("upgrade") === "websocket") {
2383
- const url24 = new URL(request.url);
2384
- if (url24.protocol !== "http:" && url24.protocol !== "https:") {
2401
+ const url27 = new URL(request.url);
2402
+ if (url27.protocol !== "http:" && url27.protocol !== "https:") {
2385
2403
  throw new TypeError(
2386
- `Fetch API cannot load: ${url24.toString()}.
2404
+ `Fetch API cannot load: ${url27.toString()}.
2387
2405
  Make sure you're using http(s):// URLs for WebSocket requests via fetch.`
2388
2406
  );
2389
2407
  }
2390
- url24.protocol = url24.protocol.replace("http", "ws");
2408
+ url27.protocol = url27.protocol.replace("http", "ws");
2391
2409
  const headers = {};
2392
2410
  let protocols;
2393
2411
  for (const [key, value] of request.headers.entries()) {
@@ -2399,10 +2417,10 @@ Make sure you're using http(s):// URLs for WebSocket requests via fetch.`
2399
2417
  }
2400
2418
  let rejectUnauthorized;
2401
2419
  if (requestInit.dispatcher instanceof DispatchFetchDispatcher) {
2402
- requestInit.dispatcher.addHeaders(headers, url24.pathname + url24.search);
2420
+ requestInit.dispatcher.addHeaders(headers, url27.pathname + url27.search);
2403
2421
  rejectUnauthorized = { rejectUnauthorized: false };
2404
2422
  }
2405
- const ws = new import_ws2.default(url24, protocols, {
2423
+ const ws = new import_ws2.default(url27, protocols, {
2406
2424
  followRedirects: request.redirect === "follow",
2407
2425
  headers,
2408
2426
  ...rejectUnauthorized
@@ -2412,7 +2430,7 @@ Make sure you're using http(s):// URLs for WebSocket requests via fetch.`
2412
2430
  const headers2 = headersFromIncomingRequest(req);
2413
2431
  const [worker, client] = Object.values(new WebSocketPair());
2414
2432
  const couplePromise = coupleWebSocket(ws, client);
2415
- const response2 = new Response(null, {
2433
+ const response2 = new Response2(null, {
2416
2434
  status: 101,
2417
2435
  webSocket: worker,
2418
2436
  headers: headers2
@@ -2421,7 +2439,7 @@ Make sure you're using http(s):// URLs for WebSocket requests via fetch.`
2421
2439
  });
2422
2440
  ws.once("unexpected-response", (_, req) => {
2423
2441
  const headers2 = headersFromIncomingRequest(req);
2424
- const response2 = new Response(req, {
2442
+ const response2 = new Response2(req, {
2425
2443
  status: req.statusCode,
2426
2444
  headers: headers2
2427
2445
  });
@@ -2432,7 +2450,7 @@ Make sure you're using http(s):// URLs for WebSocket requests via fetch.`
2432
2450
  const response = await undici.fetch(request, {
2433
2451
  dispatcher: requestInit?.dispatcher
2434
2452
  });
2435
- return new Response(response.body, response);
2453
+ return new Response2(response.body, response);
2436
2454
  }
2437
2455
  function addHeader(headers, key, value) {
2438
2456
  if (Array.isArray(headers)) headers.push(key, value);
@@ -2458,8 +2476,8 @@ var DispatchFetchDispatcher = class extends undici.Dispatcher {
2458
2476
  if (cfBlob !== void 0) this.cfBlobJson = JSON.stringify(cfBlob);
2459
2477
  }
2460
2478
  cfBlobJson;
2461
- addHeaders(headers, path34) {
2462
- const originalURL = this.userRuntimeOrigin + path34;
2479
+ addHeaders(headers, path37) {
2480
+ const originalURL = this.userRuntimeOrigin + path37;
2463
2481
  addHeader(headers, CoreHeaders.ORIGINAL_URL, originalURL);
2464
2482
  addHeader(headers, CoreHeaders.DISABLE_PRETTY_ERROR, "true");
2465
2483
  if (this.cfBlobJson !== void 0) {
@@ -2471,16 +2489,16 @@ var DispatchFetchDispatcher = class extends undici.Dispatcher {
2471
2489
  if (origin === this.userRuntimeOrigin) origin = this.actualRuntimeOrigin;
2472
2490
  if (origin === this.actualRuntimeOrigin) {
2473
2491
  options.origin = origin;
2474
- let path34 = options.path;
2492
+ let path37 = options.path;
2475
2493
  if (options.query !== void 0) {
2476
- const url24 = new URL(path34, "http://placeholder/");
2494
+ const url27 = new URL(path37, "http://placeholder/");
2477
2495
  for (const [key, value] of Object.entries(options.query)) {
2478
- url24.searchParams.append(key, value);
2496
+ url27.searchParams.append(key, value);
2479
2497
  }
2480
- path34 = url24.pathname + url24.search;
2498
+ path37 = url27.pathname + url27.search;
2481
2499
  }
2482
2500
  options.headers ??= {};
2483
- this.addHeaders(options.headers, path34);
2501
+ this.addHeaders(options.headers, path37);
2484
2502
  return this.runtimeDispatcher.dispatch(options, handler);
2485
2503
  } else {
2486
2504
  return this.globalDispatcher.dispatch(options, handler);
@@ -2590,19 +2608,8 @@ function getAccessibleHosts(ipv4Only = false) {
2590
2608
  // src/http/index.ts
2591
2609
  var import_undici4 = require("undici");
2592
2610
 
2593
- // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/analytics-engine/analytics-engine.worker.ts
2594
- var import_fs3 = __toESM(require("fs"));
2595
- var import_path6 = __toESM(require("path"));
2596
- var import_url3 = __toESM(require("url"));
2597
- var contents3;
2598
- function analytics_engine_worker_default() {
2599
- if (contents3 !== void 0) return contents3;
2600
- const filePath = import_path6.default.join(__dirname, "workers", "analytics-engine/analytics-engine.worker.js");
2601
- contents3 = import_fs3.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url3.default.pathToFileURL(filePath);
2602
- return contents3;
2603
- }
2604
-
2605
- // src/plugins/analytics-engine/index.ts
2611
+ // src/plugins/ai/index.ts
2612
+ var import_node_assert3 = __toESM(require("node:assert"));
2606
2613
  var import_zod5 = require("zod");
2607
2614
 
2608
2615
  // src/plugins/shared/index.ts
@@ -2613,6 +2620,18 @@ var import_path8 = __toESM(require("path"));
2613
2620
  var import_url6 = require("url");
2614
2621
  var import_zod4 = require("zod");
2615
2622
 
2623
+ // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/shared/mixed-mode-client.worker.ts
2624
+ var import_fs3 = __toESM(require("fs"));
2625
+ var import_path6 = __toESM(require("path"));
2626
+ var import_url3 = __toESM(require("url"));
2627
+ var contents3;
2628
+ function mixed_mode_client_worker_default() {
2629
+ if (contents3 !== void 0) return contents3;
2630
+ const filePath = import_path6.default.join(__dirname, "workers", "shared/mixed-mode-client.worker.js");
2631
+ contents3 = import_fs3.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url3.default.pathToFileURL(filePath);
2632
+ return contents3;
2633
+ }
2634
+
2616
2635
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/shared/object-entry.worker.ts
2617
2636
  var import_fs4 = __toESM(require("fs"));
2618
2637
  var import_path7 = __toESM(require("path"));
@@ -2675,6 +2694,27 @@ function objectEntryWorker(durableObjectNamespace, namespace) {
2675
2694
  ]
2676
2695
  };
2677
2696
  }
2697
+ function mixedModeClientWorker(mixedModeConnectionString, binding) {
2698
+ return {
2699
+ compatibilityDate: "2025-01-01",
2700
+ modules: [
2701
+ {
2702
+ name: "index.worker.js",
2703
+ esModule: mixed_mode_client_worker_default()
2704
+ }
2705
+ ],
2706
+ bindings: [
2707
+ {
2708
+ name: "mixedModeConnectionString",
2709
+ text: mixedModeConnectionString.href
2710
+ },
2711
+ {
2712
+ name: "binding",
2713
+ text: binding
2714
+ }
2715
+ ]
2716
+ };
2717
+ }
2678
2718
  var kUnsafeEphemeralUniqueKey = Symbol.for(
2679
2719
  "miniflare.kUnsafeEphemeralUniqueKey"
2680
2720
  );
@@ -2683,11 +2723,11 @@ var kUnsafeEphemeralUniqueKey = Symbol.for(
2683
2723
  var import_url5 = require("url");
2684
2724
  var RouterError = class extends MiniflareError {
2685
2725
  };
2686
- function routeSpecificity(url24) {
2687
- const hostParts = url24.host.split(".");
2726
+ function routeSpecificity(url27) {
2727
+ const hostParts = url27.host.split(".");
2688
2728
  let hostScore = hostParts.length;
2689
2729
  if (hostParts[0] === "*") hostScore -= 2;
2690
- const pathParts = url24.pathname.split("/");
2730
+ const pathParts = url27.pathname.split("/");
2691
2731
  let pathScore = pathParts.length;
2692
2732
  if (pathParts[pathParts.length - 1] === "*") pathScore -= 2;
2693
2733
  return hostScore * 26 + pathScore;
@@ -2699,30 +2739,30 @@ function parseRoutes(allRoutes) {
2699
2739
  const hasProtocol = /^[a-z0-9+\-.]+:\/\//i.test(route);
2700
2740
  let urlInput = route;
2701
2741
  if (!hasProtocol) urlInput = `https://${urlInput}`;
2702
- const url24 = new import_url5.URL(urlInput);
2703
- const specificity = routeSpecificity(url24);
2704
- const protocol = hasProtocol ? url24.protocol : void 0;
2705
- const internationalisedAllowHostnamePrefix = url24.hostname.startsWith("xn--*");
2706
- const allowHostnamePrefix = url24.hostname.startsWith("*") || internationalisedAllowHostnamePrefix;
2707
- const anyHostname = url24.hostname === "*";
2742
+ const url27 = new import_url5.URL(urlInput);
2743
+ const specificity = routeSpecificity(url27);
2744
+ const protocol = hasProtocol ? url27.protocol : void 0;
2745
+ const internationalisedAllowHostnamePrefix = url27.hostname.startsWith("xn--*");
2746
+ const allowHostnamePrefix = url27.hostname.startsWith("*") || internationalisedAllowHostnamePrefix;
2747
+ const anyHostname = url27.hostname === "*";
2708
2748
  if (allowHostnamePrefix && !anyHostname) {
2709
- let hostname = url24.hostname;
2749
+ let hostname = url27.hostname;
2710
2750
  if (internationalisedAllowHostnamePrefix) {
2711
2751
  hostname = (0, import_url5.domainToUnicode)(hostname);
2712
2752
  }
2713
- url24.hostname = hostname.substring(1);
2753
+ url27.hostname = hostname.substring(1);
2714
2754
  }
2715
- const allowPathSuffix = url24.pathname.endsWith("*");
2755
+ const allowPathSuffix = url27.pathname.endsWith("*");
2716
2756
  if (allowPathSuffix) {
2717
- url24.pathname = url24.pathname.substring(0, url24.pathname.length - 1);
2757
+ url27.pathname = url27.pathname.substring(0, url27.pathname.length - 1);
2718
2758
  }
2719
- if (url24.search) {
2759
+ if (url27.search) {
2720
2760
  throw new RouterError(
2721
2761
  "ERR_QUERY_STRING",
2722
2762
  `Route "${route}" for "${target}" contains a query string. This is not allowed.`
2723
2763
  );
2724
2764
  }
2725
- if (url24.toString().includes("*") && !anyHostname) {
2765
+ if (url27.toString().includes("*") && !anyHostname) {
2726
2766
  throw new RouterError(
2727
2767
  "ERR_INFIX_WILDCARD",
2728
2768
  `Route "${route}" for "${target}" contains an infix wildcard. This is not allowed.`
@@ -2734,8 +2774,8 @@ function parseRoutes(allRoutes) {
2734
2774
  specificity,
2735
2775
  protocol,
2736
2776
  allowHostnamePrefix,
2737
- hostname: anyHostname ? "" : url24.hostname,
2738
- path: url24.pathname,
2777
+ hostname: anyHostname ? "" : url27.hostname,
2778
+ path: url27.pathname,
2739
2779
  allowPathSuffix
2740
2780
  });
2741
2781
  }
@@ -2769,17 +2809,28 @@ function namespaceKeys(namespaces) {
2769
2809
  }
2770
2810
  function namespaceEntries(namespaces) {
2771
2811
  if (Array.isArray(namespaces)) {
2772
- return namespaces.map((bindingName) => [bindingName, bindingName]);
2812
+ return namespaces.map((bindingName) => [bindingName, { id: bindingName }]);
2773
2813
  } else if (namespaces !== void 0) {
2774
- return Object.entries(namespaces);
2814
+ return Object.entries(namespaces).map(([key, value]) => {
2815
+ if (typeof value === "string") {
2816
+ return [key, { id: value }];
2817
+ }
2818
+ return [
2819
+ key,
2820
+ {
2821
+ id: value.id,
2822
+ mixedModeConnectionString: value.mixedModeConnectionString
2823
+ }
2824
+ ];
2825
+ });
2775
2826
  } else {
2776
2827
  return [];
2777
2828
  }
2778
2829
  }
2779
- function maybeParseURL(url24) {
2780
- if (typeof url24 !== "string" || import_path8.default.isAbsolute(url24)) return;
2830
+ function maybeParseURL(url27) {
2831
+ if (typeof url27 !== "string" || import_path8.default.isAbsolute(url27)) return;
2781
2832
  try {
2782
- return new URL(url24);
2833
+ return new URL(url27);
2783
2834
  } catch {
2784
2835
  }
2785
2836
  }
@@ -2788,16 +2839,16 @@ function getPersistPath(pluginName, tmpPath, persist) {
2788
2839
  if (persist === void 0 || persist === false) {
2789
2840
  return memoryishPath;
2790
2841
  }
2791
- const url24 = maybeParseURL(persist);
2792
- if (url24 !== void 0) {
2793
- if (url24.protocol === "memory:") {
2842
+ const url27 = maybeParseURL(persist);
2843
+ if (url27 !== void 0) {
2844
+ if (url27.protocol === "memory:") {
2794
2845
  return memoryishPath;
2795
- } else if (url24.protocol === "file:") {
2796
- return (0, import_url6.fileURLToPath)(url24);
2846
+ } else if (url27.protocol === "file:") {
2847
+ return (0, import_url6.fileURLToPath)(url27);
2797
2848
  }
2798
2849
  throw new MiniflareCoreError(
2799
2850
  "ERR_PERSIST_UNSUPPORTED",
2800
- `Unsupported "${url24.protocol}" persistence protocol for storage: ${url24.href}`
2851
+ `Unsupported "${url27.protocol}" persistence protocol for storage: ${url27.href}`
2801
2852
  );
2802
2853
  }
2803
2854
  return persist === true ? import_path8.default.join(DEFAULT_PERSIST_ROOT, pluginName) : persist;
@@ -2838,16 +2889,87 @@ async function migrateDatabase(log, uniqueKey, persistPath, namespace) {
2838
2889
  }
2839
2890
  }
2840
2891
 
2892
+ // src/plugins/ai/index.ts
2893
+ var AISchema = import_zod5.z.object({
2894
+ binding: import_zod5.z.string(),
2895
+ mixedModeConnectionString: import_zod5.z.custom()
2896
+ });
2897
+ var AIOptionsSchema = import_zod5.z.object({
2898
+ ai: AISchema.optional()
2899
+ });
2900
+ var AI_PLUGIN_NAME = "ai";
2901
+ var AI_PLUGIN = {
2902
+ options: AIOptionsSchema,
2903
+ async getBindings(options) {
2904
+ if (!options.ai) {
2905
+ return [];
2906
+ }
2907
+ (0, import_node_assert3.default)(
2908
+ options.ai.mixedModeConnectionString,
2909
+ "Workers AI only supports Mixed Mode"
2910
+ );
2911
+ return [
2912
+ {
2913
+ name: options.ai.binding,
2914
+ wrapped: {
2915
+ moduleName: "cloudflare-internal:ai-api",
2916
+ innerBindings: [
2917
+ {
2918
+ name: "fetcher",
2919
+ service: { name: `${AI_PLUGIN_NAME}:${options.ai.binding}` }
2920
+ }
2921
+ ]
2922
+ }
2923
+ }
2924
+ ];
2925
+ },
2926
+ getNodeBindings(options) {
2927
+ if (!options.ai) {
2928
+ return {};
2929
+ }
2930
+ return {
2931
+ [options.ai.binding]: new ProxyNodeBinding()
2932
+ };
2933
+ },
2934
+ async getServices({ options }) {
2935
+ if (!options.ai) {
2936
+ return [];
2937
+ }
2938
+ return [
2939
+ {
2940
+ name: `${AI_PLUGIN_NAME}:${options.ai.binding}`,
2941
+ worker: mixedModeClientWorker(
2942
+ options.ai.mixedModeConnectionString,
2943
+ options.ai.binding
2944
+ )
2945
+ }
2946
+ ];
2947
+ }
2948
+ };
2949
+
2950
+ // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/analytics-engine/analytics-engine.worker.ts
2951
+ var import_fs6 = __toESM(require("fs"));
2952
+ var import_path9 = __toESM(require("path"));
2953
+ var import_url7 = __toESM(require("url"));
2954
+ var contents5;
2955
+ function analytics_engine_worker_default() {
2956
+ if (contents5 !== void 0) return contents5;
2957
+ const filePath = import_path9.default.join(__dirname, "workers", "analytics-engine/analytics-engine.worker.js");
2958
+ contents5 = import_fs6.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url7.default.pathToFileURL(filePath);
2959
+ return contents5;
2960
+ }
2961
+
2841
2962
  // src/plugins/analytics-engine/index.ts
2842
- var AnalyticsEngineSchema = import_zod5.z.record(
2843
- import_zod5.z.object({
2844
- dataset: import_zod5.z.string()
2963
+ var import_zod6 = require("zod");
2964
+ var AnalyticsEngineSchema = import_zod6.z.record(
2965
+ import_zod6.z.object({
2966
+ dataset: import_zod6.z.string()
2845
2967
  })
2846
2968
  );
2847
- var AnalyticsEngineSchemaOptionsSchema = import_zod5.z.object({
2969
+ var AnalyticsEngineSchemaOptionsSchema = import_zod6.z.object({
2848
2970
  analyticsEngineDatasets: AnalyticsEngineSchema.optional()
2849
2971
  });
2850
- var AnalyticsEngineSchemaSharedOptionsSchema = import_zod5.z.object({
2972
+ var AnalyticsEngineSchemaSharedOptionsSchema = import_zod6.z.object({
2851
2973
  analyticsEngineDatasetsPersist: PersistenceSchema
2852
2974
  });
2853
2975
  var ANALYTICS_ENGINE_PLUGIN_NAME = "analytics-engine";
@@ -2863,9 +2985,14 @@ var ANALYTICS_ENGINE_PLUGIN = {
2863
2985
  ).map(([name, config]) => {
2864
2986
  return {
2865
2987
  name,
2866
- service: {
2867
- name: `${ANALYTICS_ENGINE_PLUGIN_NAME}:${config.dataset}`,
2868
- entrypoint: "LocalAnalyticsEngineDataset"
2988
+ wrapped: {
2989
+ moduleName: `${ANALYTICS_ENGINE_PLUGIN_NAME}:local-simulator`,
2990
+ innerBindings: [
2991
+ {
2992
+ name: "dataset",
2993
+ json: JSON.stringify(config.dataset)
2994
+ }
2995
+ ]
2869
2996
  }
2870
2997
  };
2871
2998
  });
@@ -2882,34 +3009,26 @@ var ANALYTICS_ENGINE_PLUGIN = {
2882
3009
  ])
2883
3010
  );
2884
3011
  },
2885
- async getServices({ options }) {
3012
+ async getServices({ options, workerIndex }) {
2886
3013
  if (!options.analyticsEngineDatasets) {
2887
3014
  return [];
2888
3015
  }
2889
- return [
2890
- ...Object.entries(options.analyticsEngineDatasets).map(
2891
- ([_, config]) => {
2892
- return {
2893
- name: `${ANALYTICS_ENGINE_PLUGIN_NAME}:${config.dataset}`,
2894
- worker: {
2895
- compatibilityDate: "2025-01-01",
2896
- modules: [
2897
- {
2898
- name: "analytics-engine.worker.js",
2899
- esModule: analytics_engine_worker_default()
2900
- }
2901
- ],
2902
- bindings: [
2903
- {
2904
- name: "dataset",
2905
- json: JSON.stringify(config.dataset)
2906
- }
2907
- ]
2908
- }
2909
- };
2910
- }
2911
- )
2912
- ];
3016
+ const extensions = [];
3017
+ if (workerIndex === 0) {
3018
+ extensions.push({
3019
+ modules: [
3020
+ {
3021
+ name: `${ANALYTICS_ENGINE_PLUGIN_NAME}:local-simulator`,
3022
+ esModule: analytics_engine_worker_default(),
3023
+ internal: true
3024
+ }
3025
+ ]
3026
+ });
3027
+ }
3028
+ return {
3029
+ extensions,
3030
+ services: []
3031
+ };
2913
3032
  }
2914
3033
  };
2915
3034
 
@@ -2933,54 +3052,61 @@ var REDIRECTS_FILENAME = "_redirects";
2933
3052
  var HEADERS_FILENAME = "_headers";
2934
3053
 
2935
3054
  // ../workers-shared/utils/types.ts
2936
- var import_zod6 = require("zod");
2937
- var InternalConfigSchema = import_zod6.z.object({
2938
- account_id: import_zod6.z.number().optional(),
2939
- script_id: import_zod6.z.number().optional(),
2940
- debug: import_zod6.z.boolean().optional()
3055
+ var import_zod7 = require("zod");
3056
+ var InternalConfigSchema = import_zod7.z.object({
3057
+ account_id: import_zod7.z.number().optional(),
3058
+ script_id: import_zod7.z.number().optional(),
3059
+ debug: import_zod7.z.boolean().optional()
3060
+ });
3061
+ var StaticRoutingSchema = import_zod7.z.object({
3062
+ version: import_zod7.z.literal(1),
3063
+ include: import_zod7.z.array(import_zod7.z.string()),
3064
+ exclude: import_zod7.z.array(import_zod7.z.string()).optional()
2941
3065
  });
2942
- var RouterConfigSchema = import_zod6.z.object({
2943
- invoke_user_worker_ahead_of_assets: import_zod6.z.boolean().optional(),
2944
- has_user_worker: import_zod6.z.boolean().optional(),
3066
+ var RouterConfigSchema = import_zod7.z.object({
3067
+ invoke_user_worker_ahead_of_assets: import_zod7.z.boolean().optional(),
3068
+ static_routing: StaticRoutingSchema.optional(),
3069
+ has_user_worker: import_zod7.z.boolean().optional(),
2945
3070
  ...InternalConfigSchema.shape
2946
3071
  });
2947
- var MetadataStaticRedirectEntry = import_zod6.z.object({
2948
- status: import_zod6.z.number(),
2949
- to: import_zod6.z.string(),
2950
- lineNumber: import_zod6.z.number()
3072
+ var MetadataStaticRedirectEntry = import_zod7.z.object({
3073
+ status: import_zod7.z.number(),
3074
+ to: import_zod7.z.string(),
3075
+ lineNumber: import_zod7.z.number()
2951
3076
  });
2952
- var MetadataRedirectEntry = import_zod6.z.object({
2953
- status: import_zod6.z.number(),
2954
- to: import_zod6.z.string()
3077
+ var MetadataRedirectEntry = import_zod7.z.object({
3078
+ status: import_zod7.z.number(),
3079
+ to: import_zod7.z.string()
2955
3080
  });
2956
- var MetadataStaticRedirects = import_zod6.z.record(MetadataStaticRedirectEntry);
2957
- var MetadataRedirects = import_zod6.z.record(MetadataRedirectEntry);
2958
- var MetadataHeaderEntry = import_zod6.z.object({
2959
- set: import_zod6.z.record(import_zod6.z.string()).optional(),
2960
- unset: import_zod6.z.array(import_zod6.z.string()).optional()
3081
+ var MetadataStaticRedirects = import_zod7.z.record(MetadataStaticRedirectEntry);
3082
+ var MetadataRedirects = import_zod7.z.record(MetadataRedirectEntry);
3083
+ var MetadataHeaderEntry = import_zod7.z.object({
3084
+ set: import_zod7.z.record(import_zod7.z.string()).optional(),
3085
+ unset: import_zod7.z.array(import_zod7.z.string()).optional()
2961
3086
  });
2962
- var MetadataHeaders = import_zod6.z.record(MetadataHeaderEntry);
2963
- var RedirectsSchema = import_zod6.z.object({
2964
- version: import_zod6.z.literal(1),
3087
+ var MetadataHeaders = import_zod7.z.record(MetadataHeaderEntry);
3088
+ var RedirectsSchema = import_zod7.z.object({
3089
+ version: import_zod7.z.literal(1),
2965
3090
  staticRules: MetadataStaticRedirects,
2966
3091
  rules: MetadataRedirects
2967
3092
  }).optional();
2968
- var HeadersSchema = import_zod6.z.object({
2969
- version: import_zod6.z.literal(2),
3093
+ var HeadersSchema = import_zod7.z.object({
3094
+ version: import_zod7.z.literal(2),
2970
3095
  rules: MetadataHeaders
2971
3096
  }).optional();
2972
- var AssetConfigSchema = import_zod6.z.object({
2973
- compatibility_date: import_zod6.z.string().optional(),
2974
- compatibility_flags: import_zod6.z.array(import_zod6.z.string()).optional(),
2975
- html_handling: import_zod6.z.enum([
3097
+ var AssetConfigSchema = import_zod7.z.object({
3098
+ compatibility_date: import_zod7.z.string().optional(),
3099
+ compatibility_flags: import_zod7.z.array(import_zod7.z.string()).optional(),
3100
+ html_handling: import_zod7.z.enum([
2976
3101
  "auto-trailing-slash",
2977
3102
  "force-trailing-slash",
2978
3103
  "drop-trailing-slash",
2979
3104
  "none"
2980
3105
  ]).optional(),
2981
- not_found_handling: import_zod6.z.enum(["single-page-application", "404-page", "none"]).optional(),
3106
+ not_found_handling: import_zod7.z.enum(["single-page-application", "404-page", "none"]).optional(),
2982
3107
  redirects: RedirectsSchema,
2983
3108
  headers: HeadersSchema,
3109
+ has_static_routing: import_zod7.z.boolean().optional(),
2984
3110
  ...InternalConfigSchema.shape
2985
3111
  });
2986
3112
 
@@ -3175,12 +3301,12 @@ ${invalidHeaderRulesList}`
3175
3301
  }
3176
3302
 
3177
3303
  // ../workers-shared/utils/configuration/validateURL.ts
3178
- var extractPathname = (path34 = "/", includeSearch, includeHash) => {
3179
- if (!path34.startsWith("/")) {
3180
- path34 = `/${path34}`;
3304
+ var extractPathname = (path37 = "/", includeSearch, includeHash) => {
3305
+ if (!path37.startsWith("/")) {
3306
+ path37 = `/${path37}`;
3181
3307
  }
3182
- const url24 = new URL(`//${path34}`, "relative://");
3183
- return `${url24.pathname}${includeSearch ? url24.search : ""}${includeHash ? url24.hash : ""}`;
3308
+ const url27 = new URL(`//${path37}`, "relative://");
3309
+ return `${url27.pathname}${includeSearch ? url27.search : ""}${includeHash ? url27.hash : ""}`;
3184
3310
  };
3185
3311
  var URL_REGEX = /^https:\/\/+(?<host>[^/]+)\/?(?<path>.*)/;
3186
3312
  var HOST_WITH_PORT_REGEX = /.*:\d+$/;
@@ -3212,8 +3338,8 @@ var validateUrl = (token, onlyRelative = false, disallowPorts = false, includeSe
3212
3338
  if (!token.startsWith("/") && onlyRelative) {
3213
3339
  token = `/${token}`;
3214
3340
  }
3215
- const path34 = PATH_REGEX.exec(token);
3216
- if (path34) {
3341
+ const path37 = PATH_REGEX.exec(token);
3342
+ if (path37) {
3217
3343
  try {
3218
3344
  return [extractPathname(token, includeSearch, includeHash), void 0];
3219
3345
  } catch {
@@ -3274,7 +3400,7 @@ function parseHeaders(input, {
3274
3400
  });
3275
3401
  }
3276
3402
  }
3277
- const [path34, pathError] = validateUrl(line, false, true);
3403
+ const [path37, pathError] = validateUrl(line, false, true);
3278
3404
  if (pathError) {
3279
3405
  invalid.push({
3280
3406
  line,
@@ -3285,7 +3411,7 @@ function parseHeaders(input, {
3285
3411
  continue;
3286
3412
  }
3287
3413
  rule = {
3288
- path: path34,
3414
+ path: path37,
3289
3415
  line,
3290
3416
  headers: {},
3291
3417
  unsetHeaders: []
@@ -3582,77 +3708,89 @@ function prettyBytes(number, options) {
3582
3708
  }
3583
3709
 
3584
3710
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/assets/assets.worker.ts
3585
- var import_fs6 = __toESM(require("fs"));
3586
- var import_path9 = __toESM(require("path"));
3587
- var import_url7 = __toESM(require("url"));
3588
- var contents5;
3589
- function assets_worker_default() {
3590
- if (contents5 !== void 0) return contents5;
3591
- const filePath = import_path9.default.join(__dirname, "workers", "assets/assets.worker.js");
3592
- contents5 = import_fs6.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url7.default.pathToFileURL(filePath);
3593
- return contents5;
3594
- }
3595
-
3596
- // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/assets/assets-kv.worker.ts
3597
3711
  var import_fs7 = __toESM(require("fs"));
3598
3712
  var import_path10 = __toESM(require("path"));
3599
3713
  var import_url8 = __toESM(require("url"));
3600
3714
  var contents6;
3601
- function assets_kv_worker_default() {
3715
+ function assets_worker_default() {
3602
3716
  if (contents6 !== void 0) return contents6;
3603
- const filePath = import_path10.default.join(__dirname, "workers", "assets/assets-kv.worker.js");
3717
+ const filePath = import_path10.default.join(__dirname, "workers", "assets/assets.worker.js");
3604
3718
  contents6 = import_fs7.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url8.default.pathToFileURL(filePath);
3605
3719
  return contents6;
3606
3720
  }
3607
3721
 
3608
- // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/assets/router.worker.ts
3722
+ // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/assets/assets-kv.worker.ts
3609
3723
  var import_fs8 = __toESM(require("fs"));
3610
3724
  var import_path11 = __toESM(require("path"));
3611
3725
  var import_url9 = __toESM(require("url"));
3612
3726
  var contents7;
3613
- function router_worker_default() {
3727
+ function assets_kv_worker_default() {
3614
3728
  if (contents7 !== void 0) return contents7;
3615
- const filePath = import_path11.default.join(__dirname, "workers", "assets/router.worker.js");
3729
+ const filePath = import_path11.default.join(__dirname, "workers", "assets/assets-kv.worker.js");
3616
3730
  contents7 = import_fs8.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url9.default.pathToFileURL(filePath);
3617
3731
  return contents7;
3618
3732
  }
3619
3733
 
3620
- // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/assets/rpc-proxy.worker.ts
3734
+ // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/assets/router.worker.ts
3621
3735
  var import_fs9 = __toESM(require("fs"));
3622
3736
  var import_path12 = __toESM(require("path"));
3623
3737
  var import_url10 = __toESM(require("url"));
3624
3738
  var contents8;
3625
- function rpc_proxy_worker_default() {
3739
+ function router_worker_default() {
3626
3740
  if (contents8 !== void 0) return contents8;
3627
- const filePath = import_path12.default.join(__dirname, "workers", "assets/rpc-proxy.worker.js");
3741
+ const filePath = import_path12.default.join(__dirname, "workers", "assets/router.worker.js");
3628
3742
  contents8 = import_fs9.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url10.default.pathToFileURL(filePath);
3629
3743
  return contents8;
3630
3744
  }
3631
3745
 
3746
+ // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/assets/rpc-proxy.worker.ts
3747
+ var import_fs10 = __toESM(require("fs"));
3748
+ var import_path13 = __toESM(require("path"));
3749
+ var import_url11 = __toESM(require("url"));
3750
+ var contents9;
3751
+ function rpc_proxy_worker_default() {
3752
+ if (contents9 !== void 0) return contents9;
3753
+ const filePath = import_path13.default.join(__dirname, "workers", "assets/rpc-proxy.worker.js");
3754
+ contents9 = import_fs10.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url11.default.pathToFileURL(filePath);
3755
+ return contents9;
3756
+ }
3757
+
3632
3758
  // src/plugins/core/index.ts
3633
3759
  var import_assert9 = __toESM(require("assert"));
3634
- var import_fs16 = require("fs");
3760
+ var import_fs18 = require("fs");
3635
3761
  var import_promises6 = __toESM(require("fs/promises"));
3636
- var import_path19 = __toESM(require("path"));
3762
+ var import_path21 = __toESM(require("path"));
3637
3763
  var import_stream2 = require("stream");
3638
3764
  var import_tls = __toESM(require("tls"));
3639
3765
  var import_util3 = require("util");
3640
3766
  var import_undici7 = require("undici");
3641
3767
 
3642
3768
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/core/entry.worker.ts
3643
- var import_fs10 = __toESM(require("fs"));
3644
- var import_path13 = __toESM(require("path"));
3645
- var import_url11 = __toESM(require("url"));
3646
- var contents9;
3769
+ var import_fs11 = __toESM(require("fs"));
3770
+ var import_path14 = __toESM(require("path"));
3771
+ var import_url12 = __toESM(require("url"));
3772
+ var contents10;
3647
3773
  function entry_worker_default() {
3648
- if (contents9 !== void 0) return contents9;
3649
- const filePath = import_path13.default.join(__dirname, "workers", "core/entry.worker.js");
3650
- contents9 = import_fs10.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url11.default.pathToFileURL(filePath);
3651
- return contents9;
3774
+ if (contents10 !== void 0) return contents10;
3775
+ const filePath = import_path14.default.join(__dirname, "workers", "core/entry.worker.js");
3776
+ contents10 = import_fs11.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url12.default.pathToFileURL(filePath);
3777
+ return contents10;
3778
+ }
3779
+
3780
+ // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/core/strip-cf-connecting-ip.worker.ts
3781
+ var import_fs12 = __toESM(require("fs"));
3782
+ var import_path15 = __toESM(require("path"));
3783
+ var import_url13 = __toESM(require("url"));
3784
+ var contents11;
3785
+ function strip_cf_connecting_ip_worker_default() {
3786
+ if (contents11 !== void 0) return contents11;
3787
+ const filePath = import_path15.default.join(__dirname, "workers", "core/strip-cf-connecting-ip.worker.js");
3788
+ contents11 = import_fs12.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url13.default.pathToFileURL(filePath);
3789
+ return contents11;
3652
3790
  }
3653
3791
 
3654
3792
  // src/plugins/core/index.ts
3655
- var import_zod13 = require("zod");
3793
+ var import_zod14 = require("zod");
3656
3794
 
3657
3795
  // src/runtime/index.ts
3658
3796
  var import_assert4 = __toESM(require("assert"));
@@ -3661,7 +3799,7 @@ var import_events2 = require("events");
3661
3799
  var import_readline = __toESM(require("readline"));
3662
3800
  var import_stream = require("stream");
3663
3801
  var import_workerd2 = __toESM(require("workerd"));
3664
- var import_zod7 = require("zod");
3802
+ var import_zod8 = require("zod");
3665
3803
 
3666
3804
  // ../../node_modules/.pnpm/capnp-es@0.0.7_typescript@5.7.3/node_modules/capnp-es/dist/shared/capnp-es.DAoyiaGr.mjs
3667
3805
  var ListElementSize = /* @__PURE__ */ ((ListElementSize2) => {
@@ -10216,15 +10354,15 @@ function serializeConfig(config) {
10216
10354
  }
10217
10355
 
10218
10356
  // src/runtime/index.ts
10219
- var ControlMessageSchema = import_zod7.z.discriminatedUnion("event", [
10220
- import_zod7.z.object({
10221
- event: import_zod7.z.literal("listen"),
10222
- socket: import_zod7.z.string(),
10223
- port: import_zod7.z.number()
10357
+ var ControlMessageSchema = import_zod8.z.discriminatedUnion("event", [
10358
+ import_zod8.z.object({
10359
+ event: import_zod8.z.literal("listen"),
10360
+ socket: import_zod8.z.string(),
10361
+ port: import_zod8.z.number()
10224
10362
  }),
10225
- import_zod7.z.object({
10226
- event: import_zod7.z.literal("listen-inspector"),
10227
- port: import_zod7.z.number()
10363
+ import_zod8.z.object({
10364
+ event: import_zod8.z.literal("listen-inspector"),
10365
+ port: import_zod8.z.number()
10228
10366
  })
10229
10367
  ]);
10230
10368
  var kInspectorSocket = Symbol("kInspectorSocket");
@@ -10326,48 +10464,48 @@ var ASSETS_KV_SERVICE_NAME = `${ASSETS_PLUGIN_NAME}:kv`;
10326
10464
  var import_promises4 = __toESM(require("fs/promises"));
10327
10465
 
10328
10466
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/cache/cache.worker.ts
10329
- var import_fs11 = __toESM(require("fs"));
10330
- var import_path14 = __toESM(require("path"));
10331
- var import_url12 = __toESM(require("url"));
10332
- var contents10;
10467
+ var import_fs13 = __toESM(require("fs"));
10468
+ var import_path16 = __toESM(require("path"));
10469
+ var import_url14 = __toESM(require("url"));
10470
+ var contents12;
10333
10471
  function cache_worker_default() {
10334
- if (contents10 !== void 0) return contents10;
10335
- const filePath = import_path14.default.join(__dirname, "workers", "cache/cache.worker.js");
10336
- contents10 = import_fs11.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url12.default.pathToFileURL(filePath);
10337
- return contents10;
10472
+ if (contents12 !== void 0) return contents12;
10473
+ const filePath = import_path16.default.join(__dirname, "workers", "cache/cache.worker.js");
10474
+ contents12 = import_fs13.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url14.default.pathToFileURL(filePath);
10475
+ return contents12;
10338
10476
  }
10339
10477
 
10340
10478
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/cache/cache-entry.worker.ts
10341
- var import_fs12 = __toESM(require("fs"));
10342
- var import_path15 = __toESM(require("path"));
10343
- var import_url13 = __toESM(require("url"));
10344
- var contents11;
10479
+ var import_fs14 = __toESM(require("fs"));
10480
+ var import_path17 = __toESM(require("path"));
10481
+ var import_url15 = __toESM(require("url"));
10482
+ var contents13;
10345
10483
  function cache_entry_worker_default() {
10346
- if (contents11 !== void 0) return contents11;
10347
- const filePath = import_path15.default.join(__dirname, "workers", "cache/cache-entry.worker.js");
10348
- contents11 = import_fs12.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url13.default.pathToFileURL(filePath);
10349
- return contents11;
10484
+ if (contents13 !== void 0) return contents13;
10485
+ const filePath = import_path17.default.join(__dirname, "workers", "cache/cache-entry.worker.js");
10486
+ contents13 = import_fs14.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url15.default.pathToFileURL(filePath);
10487
+ return contents13;
10350
10488
  }
10351
10489
 
10352
10490
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/cache/cache-entry-noop.worker.ts
10353
- var import_fs13 = __toESM(require("fs"));
10354
- var import_path16 = __toESM(require("path"));
10355
- var import_url14 = __toESM(require("url"));
10356
- var contents12;
10491
+ var import_fs15 = __toESM(require("fs"));
10492
+ var import_path18 = __toESM(require("path"));
10493
+ var import_url16 = __toESM(require("url"));
10494
+ var contents14;
10357
10495
  function cache_entry_noop_worker_default() {
10358
- if (contents12 !== void 0) return contents12;
10359
- const filePath = import_path16.default.join(__dirname, "workers", "cache/cache-entry-noop.worker.js");
10360
- contents12 = import_fs13.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url14.default.pathToFileURL(filePath);
10361
- return contents12;
10496
+ if (contents14 !== void 0) return contents14;
10497
+ const filePath = import_path18.default.join(__dirname, "workers", "cache/cache-entry-noop.worker.js");
10498
+ contents14 = import_fs15.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url16.default.pathToFileURL(filePath);
10499
+ return contents14;
10362
10500
  }
10363
10501
 
10364
10502
  // src/plugins/cache/index.ts
10365
- var import_zod8 = require("zod");
10366
- var CacheOptionsSchema = import_zod8.z.object({
10367
- cache: import_zod8.z.boolean().optional(),
10368
- cacheWarnUsage: import_zod8.z.boolean().optional()
10503
+ var import_zod9 = require("zod");
10504
+ var CacheOptionsSchema = import_zod9.z.object({
10505
+ cache: import_zod9.z.boolean().optional(),
10506
+ cacheWarnUsage: import_zod9.z.boolean().optional()
10369
10507
  });
10370
- var CacheSharedOptionsSchema = import_zod8.z.object({
10508
+ var CacheSharedOptionsSchema = import_zod9.z.object({
10371
10509
  cachePersist: PersistenceSchema
10372
10510
  });
10373
10511
  var CACHE_PLUGIN_NAME = "cache";
@@ -10486,27 +10624,28 @@ var CACHE_PLUGIN = {
10486
10624
 
10487
10625
  // src/plugins/do/index.ts
10488
10626
  var import_promises5 = __toESM(require("fs/promises"));
10489
- var import_zod9 = require("zod");
10490
- var DurableObjectsOptionsSchema = import_zod9.z.object({
10491
- durableObjects: import_zod9.z.record(
10492
- import_zod9.z.union([
10493
- import_zod9.z.string(),
10494
- import_zod9.z.object({
10495
- className: import_zod9.z.string(),
10496
- scriptName: import_zod9.z.string().optional(),
10497
- useSQLite: import_zod9.z.boolean().optional(),
10627
+ var import_zod10 = require("zod");
10628
+ var DurableObjectsOptionsSchema = import_zod10.z.object({
10629
+ durableObjects: import_zod10.z.record(
10630
+ import_zod10.z.union([
10631
+ import_zod10.z.string(),
10632
+ import_zod10.z.object({
10633
+ className: import_zod10.z.string(),
10634
+ scriptName: import_zod10.z.string().optional(),
10635
+ useSQLite: import_zod10.z.boolean().optional(),
10498
10636
  // Allow `uniqueKey` to be customised. We use in Wrangler when setting
10499
10637
  // up stub Durable Objects that proxy requests to Durable Objects in
10500
10638
  // another `workerd` process, to ensure the IDs created by the stub
10501
10639
  // object can be used by the real object too.
10502
- unsafeUniqueKey: import_zod9.z.union([import_zod9.z.string(), import_zod9.z.literal(kUnsafeEphemeralUniqueKey)]).optional(),
10640
+ unsafeUniqueKey: import_zod10.z.union([import_zod10.z.string(), import_zod10.z.literal(kUnsafeEphemeralUniqueKey)]).optional(),
10503
10641
  // Prevents the Durable Object being evicted.
10504
- unsafePreventEviction: import_zod9.z.boolean().optional()
10642
+ unsafePreventEviction: import_zod10.z.boolean().optional(),
10643
+ mixedModeConnectionString: import_zod10.z.custom().optional()
10505
10644
  })
10506
10645
  ])
10507
10646
  ).optional()
10508
10647
  });
10509
- var DurableObjectsSharedOptionsSchema = import_zod9.z.object({
10648
+ var DurableObjectsSharedOptionsSchema = import_zod10.z.object({
10510
10649
  durableObjectsPersist: PersistenceSchema
10511
10650
  });
10512
10651
  function normaliseDurableObject(designator) {
@@ -10605,14 +10744,14 @@ function getCustomServiceName(workerIndex, kind, bindingName) {
10605
10744
 
10606
10745
  // src/plugins/core/modules.ts
10607
10746
  var import_assert5 = __toESM(require("assert"));
10608
- var import_fs14 = require("fs");
10747
+ var import_fs16 = require("fs");
10609
10748
  var import_module = require("module");
10610
- var import_path17 = __toESM(require("path"));
10611
- var import_url15 = require("url");
10749
+ var import_path19 = __toESM(require("path"));
10750
+ var import_url17 = require("url");
10612
10751
  var import_util = require("util");
10613
10752
  var import_acorn = require("acorn");
10614
10753
  var import_acorn_walk = require("acorn-walk");
10615
- var import_zod10 = require("zod");
10754
+ var import_zod11 = require("zod");
10616
10755
 
10617
10756
  // src/plugins/core/node-compat.ts
10618
10757
  function getNodeCompat(compatibilityDate = "2000-01-01", compatibilityFlags) {
@@ -10667,7 +10806,7 @@ function maybeGetStringScriptPathIndex(scriptPath) {
10667
10806
  const match = stringScriptRegexp.exec(scriptPath);
10668
10807
  return match === null ? void 0 : parseInt(match[1]);
10669
10808
  }
10670
- var ModuleRuleTypeSchema = import_zod10.z.enum([
10809
+ var ModuleRuleTypeSchema = import_zod11.z.enum([
10671
10810
  "ESModule",
10672
10811
  "CommonJS",
10673
10812
  "Text",
@@ -10676,45 +10815,45 @@ var ModuleRuleTypeSchema = import_zod10.z.enum([
10676
10815
  "PythonModule",
10677
10816
  "PythonRequirement"
10678
10817
  ]);
10679
- var ModuleRuleSchema = import_zod10.z.object({
10818
+ var ModuleRuleSchema = import_zod11.z.object({
10680
10819
  type: ModuleRuleTypeSchema,
10681
- include: import_zod10.z.string().array(),
10682
- fallthrough: import_zod10.z.boolean().optional()
10820
+ include: import_zod11.z.string().array(),
10821
+ fallthrough: import_zod11.z.boolean().optional()
10683
10822
  });
10684
- var ModuleDefinitionSchema = import_zod10.z.object({
10823
+ var ModuleDefinitionSchema = import_zod11.z.object({
10685
10824
  type: ModuleRuleTypeSchema,
10686
10825
  path: PathSchema,
10687
- contents: import_zod10.z.string().or(import_zod10.z.instanceof(Uint8Array)).optional()
10826
+ contents: import_zod11.z.string().or(import_zod11.z.instanceof(Uint8Array)).optional()
10688
10827
  });
10689
- var SourceOptionsSchema = import_zod10.z.union([
10690
- import_zod10.z.object({
10828
+ var SourceOptionsSchema = import_zod11.z.union([
10829
+ import_zod11.z.object({
10691
10830
  // Manually defined modules
10692
10831
  // (used by Wrangler which has its own module collection code)
10693
- modules: import_zod10.z.array(ModuleDefinitionSchema),
10832
+ modules: import_zod11.z.array(ModuleDefinitionSchema),
10694
10833
  // `modules` "name"s will be their paths relative to this value.
10695
10834
  // This ensures file paths in stack traces are correct.
10696
10835
  modulesRoot: PathSchema.optional()
10697
10836
  }),
10698
- import_zod10.z.object({
10699
- script: import_zod10.z.string(),
10837
+ import_zod11.z.object({
10838
+ script: import_zod11.z.string(),
10700
10839
  // Optional script path for resolving modules, and stack traces file names
10701
10840
  scriptPath: PathSchema.optional(),
10702
10841
  // Automatically collect modules by parsing `script` if `true`, or treat as
10703
10842
  // service-worker if `false`
10704
- modules: import_zod10.z.boolean().optional(),
10843
+ modules: import_zod11.z.boolean().optional(),
10705
10844
  // How to interpret automatically collected modules
10706
- modulesRules: import_zod10.z.array(ModuleRuleSchema).optional(),
10845
+ modulesRules: import_zod11.z.array(ModuleRuleSchema).optional(),
10707
10846
  // `modules` "name"s will be their paths relative to this value.
10708
10847
  // This ensures file paths in stack traces are correct.
10709
10848
  modulesRoot: PathSchema.optional()
10710
10849
  }),
10711
- import_zod10.z.object({
10850
+ import_zod11.z.object({
10712
10851
  scriptPath: PathSchema,
10713
10852
  // Automatically collect modules by parsing `scriptPath` if `true`, or treat
10714
10853
  // as service-worker if `false`
10715
- modules: import_zod10.z.boolean().optional(),
10854
+ modules: import_zod11.z.boolean().optional(),
10716
10855
  // How to interpret automatically collected modules
10717
- modulesRules: import_zod10.z.array(ModuleRuleSchema).optional(),
10856
+ modulesRules: import_zod11.z.array(ModuleRuleSchema).optional(),
10718
10857
  // `modules` "name"s will be their paths relative to this value.
10719
10858
  // This ensures file paths in stack traces are correct.
10720
10859
  modulesRoot: PathSchema.optional()
@@ -10738,14 +10877,14 @@ function compileModuleRules(rules) {
10738
10877
  return compiledRules;
10739
10878
  }
10740
10879
  function moduleName(modulesRoot, modulePath) {
10741
- const name = import_path17.default.relative(modulesRoot, modulePath);
10742
- return import_path17.default.sep === "\\" ? name.replaceAll("\\", "/") : name;
10880
+ const name = import_path19.default.relative(modulesRoot, modulePath);
10881
+ return import_path19.default.sep === "\\" ? name.replaceAll("\\", "/") : name;
10743
10882
  }
10744
10883
  function withSourceURL(script, scriptPath) {
10745
10884
  if (script.lastIndexOf("//# sourceURL=") !== -1) return script;
10746
10885
  let scriptURL = scriptPath;
10747
10886
  if (maybeGetStringScriptPathIndex(scriptPath) === void 0) {
10748
- scriptURL = (0, import_url15.pathToFileURL)(scriptPath);
10887
+ scriptURL = (0, import_url17.pathToFileURL)(scriptPath);
10749
10888
  }
10750
10889
  const sourceURL = `
10751
10890
  //# sourceURL=${scriptURL}
@@ -10753,7 +10892,7 @@ function withSourceURL(script, scriptPath) {
10753
10892
  return script + sourceURL;
10754
10893
  }
10755
10894
  function getResolveErrorPrefix(referencingPath) {
10756
- const relative2 = import_path17.default.relative("", referencingPath);
10895
+ const relative2 = import_path19.default.relative("", referencingPath);
10757
10896
  return `Unable to resolve "${relative2}" dependency`;
10758
10897
  }
10759
10898
  var ModuleLocator = class {
@@ -10866,7 +11005,7 @@ ${dim(modulesConfig)}`;
10866
11005
  `${prefix}: imports are unsupported in string \`script\` without defined \`scriptPath\``
10867
11006
  );
10868
11007
  }
10869
- const identifier = import_path17.default.resolve(import_path17.default.dirname(referencingPath), spec);
11008
+ const identifier = import_path19.default.resolve(import_path19.default.dirname(referencingPath), spec);
10870
11009
  const name = moduleName(this.modulesRoot, identifier);
10871
11010
  if (this.#visitedPaths.has(identifier)) return;
10872
11011
  this.#visitedPaths.add(identifier);
@@ -10883,7 +11022,7 @@ ${dim(modulesConfig)}`;
10883
11022
  ${suggestion}`
10884
11023
  );
10885
11024
  }
10886
- const data = (0, import_fs14.readFileSync)(identifier);
11025
+ const data = (0, import_fs16.readFileSync)(identifier);
10887
11026
  switch (rule.type) {
10888
11027
  case "ESModule":
10889
11028
  case "CommonJS":
@@ -10923,50 +11062,50 @@ function createJavaScriptModule(code, name, modulePath, type) {
10923
11062
  }
10924
11063
  var encoder = new import_util.TextEncoder();
10925
11064
  var decoder = new import_util.TextDecoder();
10926
- function contentsToString(contents24) {
10927
- return typeof contents24 === "string" ? contents24 : decoder.decode(contents24);
11065
+ function contentsToString(contents27) {
11066
+ return typeof contents27 === "string" ? contents27 : decoder.decode(contents27);
10928
11067
  }
10929
- function contentsToArray(contents24) {
10930
- return typeof contents24 === "string" ? encoder.encode(contents24) : contents24;
11068
+ function contentsToArray(contents27) {
11069
+ return typeof contents27 === "string" ? encoder.encode(contents27) : contents27;
10931
11070
  }
10932
11071
  function convertModuleDefinition(modulesRoot, def) {
10933
11072
  const name = moduleName(modulesRoot, def.path);
10934
- const contents24 = def.contents ?? (0, import_fs14.readFileSync)(def.path);
11073
+ const contents27 = def.contents ?? (0, import_fs16.readFileSync)(def.path);
10935
11074
  switch (def.type) {
10936
11075
  case "ESModule":
10937
11076
  case "CommonJS":
10938
11077
  return createJavaScriptModule(
10939
- contentsToString(contents24),
11078
+ contentsToString(contents27),
10940
11079
  name,
10941
- import_path17.default.resolve(modulesRoot, def.path),
11080
+ import_path19.default.resolve(modulesRoot, def.path),
10942
11081
  def.type
10943
11082
  );
10944
11083
  case "Text":
10945
- return { name, text: contentsToString(contents24) };
11084
+ return { name, text: contentsToString(contents27) };
10946
11085
  case "Data":
10947
- return { name, data: contentsToArray(contents24) };
11086
+ return { name, data: contentsToArray(contents27) };
10948
11087
  case "CompiledWasm":
10949
- return { name, wasm: contentsToArray(contents24) };
11088
+ return { name, wasm: contentsToArray(contents27) };
10950
11089
  case "PythonModule":
10951
- return { name, pythonModule: contentsToString(contents24) };
11090
+ return { name, pythonModule: contentsToString(contents27) };
10952
11091
  case "PythonRequirement":
10953
- return { name, pythonRequirement: contentsToString(contents24) };
11092
+ return { name, pythonRequirement: contentsToString(contents27) };
10954
11093
  default:
10955
11094
  const exhaustive = def.type;
10956
11095
  import_assert5.default.fail(`Unreachable: ${exhaustive} modules are unsupported`);
10957
11096
  }
10958
11097
  }
10959
11098
  function convertWorkerModule(mod) {
10960
- const path34 = mod.name;
10961
- (0, import_assert5.default)(path34 !== void 0);
11099
+ const path37 = mod.name;
11100
+ (0, import_assert5.default)(path37 !== void 0);
10962
11101
  const m = mod;
10963
- if ("esModule" in m) return { path: path34, type: "ESModule" };
10964
- else if ("commonJsModule" in m) return { path: path34, type: "CommonJS" };
10965
- else if ("text" in m) return { path: path34, type: "Text" };
10966
- else if ("data" in m) return { path: path34, type: "Data" };
10967
- else if ("wasm" in m) return { path: path34, type: "CompiledWasm" };
10968
- else if ("pythonModule" in m) return { path: path34, type: "PythonModule" };
10969
- else if ("pythonRequirement" in m) return { path: path34, type: "PythonRequirement" };
11102
+ if ("esModule" in m) return { path: path37, type: "ESModule" };
11103
+ else if ("commonJsModule" in m) return { path: path37, type: "CommonJS" };
11104
+ else if ("text" in m) return { path: path37, type: "Text" };
11105
+ else if ("data" in m) return { path: path37, type: "Data" };
11106
+ else if ("wasm" in m) return { path: path37, type: "CompiledWasm" };
11107
+ else if ("pythonModule" in m) return { path: path37, type: "PythonModule" };
11108
+ else if ("pythonRequirement" in m) return { path: path37, type: "PythonRequirement" };
10970
11109
  (0, import_assert5.default)(
10971
11110
  !("json" in m || "fallbackService" in m),
10972
11111
  "Unreachable: json or fallbackService modules aren't generated"
@@ -10992,10 +11131,10 @@ var import_web2 = require("stream/web");
10992
11131
  var import_worker_threads = require("worker_threads");
10993
11132
 
10994
11133
  // src/plugins/core/errors/index.ts
10995
- var import_fs15 = __toESM(require("fs"));
10996
- var import_path18 = __toESM(require("path"));
10997
- var import_url16 = require("url");
10998
- var import_zod11 = require("zod");
11134
+ var import_fs17 = __toESM(require("fs"));
11135
+ var import_path20 = __toESM(require("path"));
11136
+ var import_url18 = require("url");
11137
+ var import_zod12 = require("zod");
10999
11138
 
11000
11139
  // src/plugins/core/errors/sourcemap.ts
11001
11140
  var import_assert6 = __toESM(require("assert"));
@@ -11182,8 +11321,8 @@ function getSourceMapper() {
11182
11321
  // src/plugins/core/errors/index.ts
11183
11322
  function maybeGetDiskFile(filePath) {
11184
11323
  try {
11185
- const contents24 = import_fs15.default.readFileSync(filePath, "utf8");
11186
- return { path: filePath, contents: contents24 };
11324
+ const contents27 = import_fs17.default.readFileSync(filePath, "utf8");
11325
+ return { path: filePath, contents: contents27 };
11187
11326
  } catch (e) {
11188
11327
  if (e.code !== "ENOENT") throw e;
11189
11328
  }
@@ -11191,19 +11330,19 @@ function maybeGetDiskFile(filePath) {
11191
11330
  function maybeGetFile2(workerSrcOpts, fileSpecifier) {
11192
11331
  const maybeUrl = maybeParseURL(fileSpecifier);
11193
11332
  if (maybeUrl !== void 0 && maybeUrl.protocol === "file:") {
11194
- const filePath = (0, import_url16.fileURLToPath)(maybeUrl);
11333
+ const filePath = (0, import_url18.fileURLToPath)(maybeUrl);
11195
11334
  for (const srcOpts of workerSrcOpts) {
11196
11335
  if (Array.isArray(srcOpts.modules)) {
11197
11336
  const modulesRoot = srcOpts.modulesRoot ?? "";
11198
11337
  for (const module2 of srcOpts.modules) {
11199
- if (module2.contents !== void 0 && import_path18.default.resolve(modulesRoot, module2.path) === filePath) {
11200
- const contents24 = contentsToString(module2.contents);
11201
- return { path: filePath, contents: contents24 };
11338
+ if (module2.contents !== void 0 && import_path20.default.resolve(modulesRoot, module2.path) === filePath) {
11339
+ const contents27 = contentsToString(module2.contents);
11340
+ return { path: filePath, contents: contents27 };
11202
11341
  }
11203
11342
  }
11204
11343
  } else if ("script" in srcOpts && "scriptPath" in srcOpts && srcOpts.script !== void 0 && srcOpts.scriptPath !== void 0) {
11205
11344
  const modulesRoot = srcOpts.modules && srcOpts.modulesRoot || "";
11206
- if (import_path18.default.resolve(modulesRoot, srcOpts.scriptPath) === filePath) {
11345
+ if (import_path20.default.resolve(modulesRoot, srcOpts.scriptPath) === filePath) {
11207
11346
  return { path: filePath, contents: srcOpts.script };
11208
11347
  }
11209
11348
  }
@@ -11226,19 +11365,19 @@ function getSourceMappedStack(workerSrcOpts, error) {
11226
11365
  const matches = [...sourceFile.contents.matchAll(sourceMapRegexp)];
11227
11366
  if (matches.length === 0) return null;
11228
11367
  const sourceMapMatch = matches[matches.length - 1];
11229
- const root = import_path18.default.dirname(sourceFile.path);
11230
- const sourceMapPath = import_path18.default.resolve(root, sourceMapMatch[1]);
11368
+ const root = import_path20.default.dirname(sourceFile.path);
11369
+ const sourceMapPath = import_path20.default.resolve(root, sourceMapMatch[1]);
11231
11370
  const sourceMapFile = maybeGetDiskFile(sourceMapPath);
11232
11371
  if (sourceMapFile === void 0) return null;
11233
11372
  return { map: sourceMapFile.contents, url: sourceMapFile.path };
11234
11373
  }
11235
11374
  return getSourceMapper()(retrieveSourceMap, error);
11236
11375
  }
11237
- var JsonErrorSchema = import_zod11.z.lazy(
11238
- () => import_zod11.z.object({
11239
- message: import_zod11.z.string().optional(),
11240
- name: import_zod11.z.string().optional(),
11241
- stack: import_zod11.z.string().optional(),
11376
+ var JsonErrorSchema = import_zod12.z.lazy(
11377
+ () => import_zod12.z.object({
11378
+ message: import_zod12.z.string().optional(),
11379
+ name: import_zod12.z.string().optional(),
11380
+ stack: import_zod12.z.string().optional(),
11242
11381
  cause: JsonErrorSchema.optional()
11243
11382
  })
11244
11383
  );
@@ -11276,7 +11415,7 @@ async function handlePrettyErrorRequest(log, workerSrcOpts, request) {
11276
11415
  const userAgent = request.headers.get("User-Agent")?.toLowerCase() ?? "";
11277
11416
  const acceptsPrettyError = !userAgent.includes("curl/") && (accept.includes("text/html") || accept.includes("*/*") || accept.includes("text/*"));
11278
11417
  if (!acceptsPrettyError) {
11279
- return new Response(error.stack, { status: 500 });
11418
+ return new Response2(error.stack, { status: 500 });
11280
11419
  }
11281
11420
  const Youch = require("youch");
11282
11421
  const youch = new Youch(error.cause ?? error, {
@@ -11290,7 +11429,7 @@ async function handlePrettyErrorRequest(log, workerSrcOpts, request) {
11290
11429
  '<a href="https://discord.cloudflare.com" target="_blank" style="text-decoration:none">\u{1F4AC} Workers Discord</a>'
11291
11430
  ].join("");
11292
11431
  });
11293
- return new Response(await youch.toHTML(), {
11432
+ return new Response2(await youch.toHTML(), {
11294
11433
  status: 500,
11295
11434
  headers: { "Content-Type": "text/html;charset=utf-8" }
11296
11435
  });
@@ -11354,6 +11493,8 @@ port.addEventListener("message", async (event) => {
11354
11493
  Atomics.store(notifyHandle, /* index */ 0, /* value */ 1);
11355
11494
  Atomics.notify(notifyHandle, /* index */ 0);
11356
11495
  });
11496
+
11497
+ port.start();
11357
11498
  `
11358
11499
  );
11359
11500
  var SynchronousFetcher = class {
@@ -11377,7 +11518,7 @@ var SynchronousFetcher = class {
11377
11518
  transferList: [this.#channel.port2]
11378
11519
  });
11379
11520
  }
11380
- fetch(url24, init2) {
11521
+ fetch(url27, init2) {
11381
11522
  this.#ensureWorker();
11382
11523
  Atomics.store(
11383
11524
  this.#notifyHandle,
@@ -11390,7 +11531,7 @@ var SynchronousFetcher = class {
11390
11531
  this.#channel.port1.postMessage({
11391
11532
  id,
11392
11533
  method: init2.method,
11393
- url: url24.toString(),
11534
+ url: url27.toString(),
11394
11535
  headers: init2.headers,
11395
11536
  body: init2.body
11396
11537
  });
@@ -11436,7 +11577,7 @@ var NODE_PLATFORM_IMPL = {
11436
11577
  File: import_undici5.File,
11437
11578
  Headers: import_undici5.Headers,
11438
11579
  Request,
11439
- Response,
11580
+ Response: Response2,
11440
11581
  isReadableStream(value) {
11441
11582
  return value instanceof import_web3.ReadableStream;
11442
11583
  },
@@ -11510,8 +11651,8 @@ var ProxyClient = class {
11510
11651
  }
11511
11652
  };
11512
11653
  var ProxyClientBridge = class {
11513
- constructor(url24, dispatchFetch) {
11514
- this.url = url24;
11654
+ constructor(url27, dispatchFetch) {
11655
+ this.url = url27;
11515
11656
  this.dispatchFetch = dispatchFetch;
11516
11657
  this.#finalizationRegistry = new FinalizationRegistry(this.#finalizeProxy);
11517
11658
  }
@@ -11899,74 +12040,75 @@ var ProxyStubHandler = class extends Function {
11899
12040
  };
11900
12041
 
11901
12042
  // src/plugins/core/services.ts
11902
- var import_zod12 = require("zod");
12043
+ var import_zod13 = require("zod");
11903
12044
  var kCurrentWorker = Symbol.for("miniflare.kCurrentWorker");
11904
- var HttpOptionsHeaderSchema = import_zod12.z.object({
11905
- name: import_zod12.z.string(),
12045
+ var HttpOptionsHeaderSchema = import_zod13.z.object({
12046
+ name: import_zod13.z.string(),
11906
12047
  // name should be required
11907
- value: import_zod12.z.ostring()
12048
+ value: import_zod13.z.ostring()
11908
12049
  // If omitted, the header will be removed
11909
12050
  });
11910
- var HttpOptionsSchema = import_zod12.z.object({
11911
- style: import_zod12.z.nativeEnum(HttpOptions_Style).optional(),
11912
- forwardedProtoHeader: import_zod12.z.ostring(),
11913
- cfBlobHeader: import_zod12.z.ostring(),
12051
+ var HttpOptionsSchema = import_zod13.z.object({
12052
+ style: import_zod13.z.nativeEnum(HttpOptions_Style).optional(),
12053
+ forwardedProtoHeader: import_zod13.z.ostring(),
12054
+ cfBlobHeader: import_zod13.z.ostring(),
11914
12055
  injectRequestHeaders: HttpOptionsHeaderSchema.array().optional(),
11915
12056
  injectResponseHeaders: HttpOptionsHeaderSchema.array().optional()
11916
12057
  }).transform((options) => ({
11917
12058
  ...options,
11918
12059
  capnpConnectHost: HOST_CAPNP_CONNECT
11919
12060
  }));
11920
- var TlsOptionsKeypairSchema = import_zod12.z.object({
11921
- privateKey: import_zod12.z.ostring(),
11922
- certificateChain: import_zod12.z.ostring()
12061
+ var TlsOptionsKeypairSchema = import_zod13.z.object({
12062
+ privateKey: import_zod13.z.ostring(),
12063
+ certificateChain: import_zod13.z.ostring()
11923
12064
  });
11924
- var TlsOptionsSchema = import_zod12.z.object({
12065
+ var TlsOptionsSchema = import_zod13.z.object({
11925
12066
  keypair: TlsOptionsKeypairSchema.optional(),
11926
- requireClientCerts: import_zod12.z.oboolean(),
11927
- trustBrowserCas: import_zod12.z.oboolean(),
11928
- trustedCertificates: import_zod12.z.string().array().optional(),
11929
- minVersion: import_zod12.z.nativeEnum(TlsOptions_Version).optional(),
11930
- cipherList: import_zod12.z.ostring()
12067
+ requireClientCerts: import_zod13.z.oboolean(),
12068
+ trustBrowserCas: import_zod13.z.oboolean(),
12069
+ trustedCertificates: import_zod13.z.string().array().optional(),
12070
+ minVersion: import_zod13.z.nativeEnum(TlsOptions_Version).optional(),
12071
+ cipherList: import_zod13.z.ostring()
11931
12072
  });
11932
- var NetworkSchema = import_zod12.z.object({
11933
- allow: import_zod12.z.string().array().optional(),
11934
- deny: import_zod12.z.string().array().optional(),
12073
+ var NetworkSchema = import_zod13.z.object({
12074
+ allow: import_zod13.z.string().array().optional(),
12075
+ deny: import_zod13.z.string().array().optional(),
11935
12076
  tlsOptions: TlsOptionsSchema.optional()
11936
12077
  });
11937
- var ExternalServerSchema = import_zod12.z.intersection(
11938
- import_zod12.z.object({ address: import_zod12.z.string() }),
12078
+ var ExternalServerSchema = import_zod13.z.intersection(
12079
+ import_zod13.z.object({ address: import_zod13.z.string() }),
11939
12080
  // address should be required
11940
- import_zod12.z.union([
11941
- import_zod12.z.object({ http: import_zod12.z.optional(HttpOptionsSchema) }),
11942
- import_zod12.z.object({
11943
- https: import_zod12.z.optional(
11944
- import_zod12.z.object({
12081
+ import_zod13.z.union([
12082
+ import_zod13.z.object({ http: import_zod13.z.optional(HttpOptionsSchema) }),
12083
+ import_zod13.z.object({
12084
+ https: import_zod13.z.optional(
12085
+ import_zod13.z.object({
11945
12086
  options: HttpOptionsSchema.optional(),
11946
12087
  tlsOptions: TlsOptionsSchema.optional(),
11947
- certificateHost: import_zod12.z.ostring()
12088
+ certificateHost: import_zod13.z.ostring()
11948
12089
  })
11949
12090
  )
11950
12091
  })
11951
12092
  ])
11952
12093
  );
11953
- var DiskDirectorySchema = import_zod12.z.object({
11954
- path: import_zod12.z.string(),
12094
+ var DiskDirectorySchema = import_zod13.z.object({
12095
+ path: import_zod13.z.string(),
11955
12096
  // path should be required
11956
- writable: import_zod12.z.oboolean()
12097
+ writable: import_zod13.z.oboolean()
11957
12098
  });
11958
- var ServiceFetchSchema = import_zod12.z.custom((v) => typeof v === "function");
11959
- var ServiceDesignatorSchema = import_zod12.z.union([
11960
- import_zod12.z.string(),
11961
- import_zod12.z.literal(kCurrentWorker),
11962
- import_zod12.z.object({
11963
- name: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.literal(kCurrentWorker)]),
11964
- entrypoint: import_zod12.z.ostring(),
11965
- props: import_zod12.z.record(import_zod12.z.unknown()).optional()
12099
+ var ServiceFetchSchema = import_zod13.z.custom((v) => typeof v === "function");
12100
+ var ServiceDesignatorSchema = import_zod13.z.union([
12101
+ import_zod13.z.string(),
12102
+ import_zod13.z.literal(kCurrentWorker),
12103
+ import_zod13.z.object({
12104
+ name: import_zod13.z.union([import_zod13.z.string(), import_zod13.z.literal(kCurrentWorker)]),
12105
+ entrypoint: import_zod13.z.ostring(),
12106
+ props: import_zod13.z.record(import_zod13.z.unknown()).optional(),
12107
+ mixedModeConnectionString: import_zod13.z.custom().optional()
11966
12108
  }),
11967
- import_zod12.z.object({ network: NetworkSchema }),
11968
- import_zod12.z.object({ external: ExternalServerSchema }),
11969
- import_zod12.z.object({ disk: DiskDirectorySchema }),
12109
+ import_zod13.z.object({ network: NetworkSchema }),
12110
+ import_zod13.z.object({ external: ExternalServerSchema }),
12111
+ import_zod13.z.object({ disk: DiskDirectorySchema }),
11970
12112
  ServiceFetchSchema
11971
12113
  ]);
11972
12114
 
@@ -11974,7 +12116,7 @@ var ServiceDesignatorSchema = import_zod12.z.union([
11974
12116
  var trustedCertificates = process.platform === "win32" ? Array.from(import_tls.default.rootCertificates) : [];
11975
12117
  if (process.env.NODE_EXTRA_CA_CERTS !== void 0) {
11976
12118
  try {
11977
- const extra = (0, import_fs16.readFileSync)(process.env.NODE_EXTRA_CA_CERTS, "utf8");
12119
+ const extra = (0, import_fs18.readFileSync)(process.env.NODE_EXTRA_CA_CERTS, "utf8");
11978
12120
  const certs = extra.match(
11979
12121
  /-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/g
11980
12122
  );
@@ -11989,46 +12131,50 @@ var numericCompare = new Intl.Collator(void 0, { numeric: true }).compare;
11989
12131
  function createFetchMock() {
11990
12132
  return new import_undici7.MockAgent();
11991
12133
  }
11992
- var WrappedBindingSchema = import_zod13.z.object({
11993
- scriptName: import_zod13.z.string(),
11994
- entrypoint: import_zod13.z.string().optional(),
11995
- bindings: import_zod13.z.record(JsonSchema).optional()
12134
+ var WrappedBindingSchema = import_zod14.z.object({
12135
+ scriptName: import_zod14.z.string(),
12136
+ entrypoint: import_zod14.z.string().optional(),
12137
+ bindings: import_zod14.z.record(JsonSchema).optional()
11996
12138
  });
11997
- var UnusableStringSchema = import_zod13.z.string().transform(() => void 0);
11998
- var UnsafeDirectSocketSchema = import_zod13.z.object({
11999
- host: import_zod13.z.ostring(),
12000
- port: import_zod13.z.onumber(),
12001
- entrypoint: import_zod13.z.ostring(),
12002
- proxy: import_zod13.z.oboolean()
12139
+ var UnusableStringSchema = import_zod14.z.string().transform(() => void 0);
12140
+ var UnsafeDirectSocketSchema = import_zod14.z.object({
12141
+ host: import_zod14.z.ostring(),
12142
+ port: import_zod14.z.onumber(),
12143
+ entrypoint: import_zod14.z.ostring(),
12144
+ proxy: import_zod14.z.oboolean()
12003
12145
  });
12004
- var CoreOptionsSchemaInput = import_zod13.z.intersection(
12146
+ var CoreOptionsSchemaInput = import_zod14.z.intersection(
12005
12147
  SourceOptionsSchema,
12006
- import_zod13.z.object({
12007
- name: import_zod13.z.string().optional(),
12148
+ import_zod14.z.object({
12149
+ name: import_zod14.z.string().optional(),
12008
12150
  rootPath: UnusableStringSchema.optional(),
12009
- compatibilityDate: import_zod13.z.string().optional(),
12010
- compatibilityFlags: import_zod13.z.string().array().optional(),
12011
- unsafeInspectorProxy: import_zod13.z.boolean().optional(),
12012
- routes: import_zod13.z.string().array().optional(),
12013
- bindings: import_zod13.z.record(JsonSchema).optional(),
12014
- wasmBindings: import_zod13.z.record(import_zod13.z.union([PathSchema, import_zod13.z.instanceof(Uint8Array)])).optional(),
12015
- textBlobBindings: import_zod13.z.record(PathSchema).optional(),
12016
- dataBlobBindings: import_zod13.z.record(import_zod13.z.union([PathSchema, import_zod13.z.instanceof(Uint8Array)])).optional(),
12017
- serviceBindings: import_zod13.z.record(ServiceDesignatorSchema).optional(),
12018
- wrappedBindings: import_zod13.z.record(import_zod13.z.union([import_zod13.z.string(), WrappedBindingSchema])).optional(),
12151
+ compatibilityDate: import_zod14.z.string().optional(),
12152
+ compatibilityFlags: import_zod14.z.string().array().optional(),
12153
+ unsafeInspectorProxy: import_zod14.z.boolean().optional(),
12154
+ routes: import_zod14.z.string().array().optional(),
12155
+ bindings: import_zod14.z.record(JsonSchema).optional(),
12156
+ wasmBindings: import_zod14.z.record(import_zod14.z.union([PathSchema, import_zod14.z.instanceof(Uint8Array)])).optional(),
12157
+ textBlobBindings: import_zod14.z.record(PathSchema).optional(),
12158
+ dataBlobBindings: import_zod14.z.record(import_zod14.z.union([PathSchema, import_zod14.z.instanceof(Uint8Array)])).optional(),
12159
+ serviceBindings: import_zod14.z.record(ServiceDesignatorSchema).optional(),
12160
+ wrappedBindings: import_zod14.z.record(import_zod14.z.union([import_zod14.z.string(), WrappedBindingSchema])).optional(),
12019
12161
  outboundService: ServiceDesignatorSchema.optional(),
12020
- fetchMock: import_zod13.z.instanceof(import_undici7.MockAgent).optional(),
12162
+ fetchMock: import_zod14.z.instanceof(import_undici7.MockAgent).optional(),
12021
12163
  // TODO(soon): remove this in favour of per-object `unsafeUniqueKey: kEphemeralUniqueKey`
12022
- unsafeEphemeralDurableObjects: import_zod13.z.boolean().optional(),
12164
+ unsafeEphemeralDurableObjects: import_zod14.z.boolean().optional(),
12023
12165
  unsafeDirectSockets: UnsafeDirectSocketSchema.array().optional(),
12024
- unsafeEvalBinding: import_zod13.z.string().optional(),
12025
- unsafeUseModuleFallbackService: import_zod13.z.boolean().optional(),
12166
+ unsafeEvalBinding: import_zod14.z.string().optional(),
12167
+ unsafeUseModuleFallbackService: import_zod14.z.boolean().optional(),
12026
12168
  /** Used to set the vitest pool worker SELF binding to point to the Router Worker if there are assets.
12027
12169
  (If there are assets but we're not using vitest, the miniflare entry worker can point directly to
12028
12170
  Router Worker)
12029
12171
  */
12030
- hasAssetsAndIsVitest: import_zod13.z.boolean().optional(),
12031
- tails: import_zod13.z.array(ServiceDesignatorSchema).optional()
12172
+ hasAssetsAndIsVitest: import_zod14.z.boolean().optional(),
12173
+ tails: import_zod14.z.array(ServiceDesignatorSchema).optional(),
12174
+ // Strip the CF-Connecting-IP header from outbound fetches
12175
+ // There is an issue with the connect() API and the globalOutbound workerd setting that impacts TCP ingress
12176
+ // We should default it to true once https://github.com/cloudflare/workerd/pull/4145 is resolved
12177
+ stripCfConnectingIp: import_zod14.z.boolean().default(false)
12032
12178
  })
12033
12179
  );
12034
12180
  var CoreOptionsSchema = CoreOptionsSchemaInput.transform((value) => {
@@ -12045,34 +12191,34 @@ var CoreOptionsSchema = CoreOptionsSchemaInput.transform((value) => {
12045
12191
  }
12046
12192
  return value;
12047
12193
  });
12048
- var CoreSharedOptionsSchema = import_zod13.z.object({
12194
+ var CoreSharedOptionsSchema = import_zod14.z.object({
12049
12195
  rootPath: UnusableStringSchema.optional(),
12050
- host: import_zod13.z.string().optional(),
12051
- port: import_zod13.z.number().optional(),
12052
- https: import_zod13.z.boolean().optional(),
12053
- httpsKey: import_zod13.z.string().optional(),
12054
- httpsKeyPath: import_zod13.z.string().optional(),
12055
- httpsCert: import_zod13.z.string().optional(),
12056
- httpsCertPath: import_zod13.z.string().optional(),
12057
- inspectorPort: import_zod13.z.number().optional(),
12058
- verbose: import_zod13.z.boolean().optional(),
12059
- log: import_zod13.z.instanceof(Log).optional(),
12060
- handleRuntimeStdio: import_zod13.z.function(import_zod13.z.tuple([import_zod13.z.instanceof(import_stream2.Readable), import_zod13.z.instanceof(import_stream2.Readable)])).optional(),
12061
- upstream: import_zod13.z.string().optional(),
12196
+ host: import_zod14.z.string().optional(),
12197
+ port: import_zod14.z.number().optional(),
12198
+ https: import_zod14.z.boolean().optional(),
12199
+ httpsKey: import_zod14.z.string().optional(),
12200
+ httpsKeyPath: import_zod14.z.string().optional(),
12201
+ httpsCert: import_zod14.z.string().optional(),
12202
+ httpsCertPath: import_zod14.z.string().optional(),
12203
+ inspectorPort: import_zod14.z.number().optional(),
12204
+ verbose: import_zod14.z.boolean().optional(),
12205
+ log: import_zod14.z.instanceof(Log).optional(),
12206
+ handleRuntimeStdio: import_zod14.z.function(import_zod14.z.tuple([import_zod14.z.instanceof(import_stream2.Readable), import_zod14.z.instanceof(import_stream2.Readable)])).optional(),
12207
+ upstream: import_zod14.z.string().optional(),
12062
12208
  // TODO: add back validation of cf object
12063
- cf: import_zod13.z.union([import_zod13.z.boolean(), import_zod13.z.string(), import_zod13.z.record(import_zod13.z.any())]).optional(),
12064
- liveReload: import_zod13.z.boolean().optional(),
12209
+ cf: import_zod14.z.union([import_zod14.z.boolean(), import_zod14.z.string(), import_zod14.z.record(import_zod14.z.any())]).optional(),
12210
+ liveReload: import_zod14.z.boolean().optional(),
12065
12211
  // This is a shared secret between a proxy server and miniflare that can be
12066
12212
  // passed in a header to prove that the request came from the proxy and not
12067
12213
  // some malicious attacker.
12068
- unsafeProxySharedSecret: import_zod13.z.string().optional(),
12214
+ unsafeProxySharedSecret: import_zod14.z.string().optional(),
12069
12215
  unsafeModuleFallbackService: ServiceFetchSchema.optional(),
12070
12216
  // Keep blobs when deleting/overwriting keys, required for stacked storage
12071
- unsafeStickyBlobs: import_zod13.z.boolean().optional(),
12217
+ unsafeStickyBlobs: import_zod14.z.boolean().optional(),
12072
12218
  // Enable directly triggering user Worker handlers with paths like `/cdn-cgi/handler/scheduled`
12073
- unsafeTriggerHandlers: import_zod13.z.boolean().optional(),
12219
+ unsafeTriggerHandlers: import_zod14.z.boolean().optional(),
12074
12220
  // Enable logging requests
12075
- logRequests: import_zod13.z.boolean().default(true)
12221
+ logRequests: import_zod14.z.boolean().default(true)
12076
12222
  });
12077
12223
  var CORE_PLUGIN_NAME2 = "core";
12078
12224
  var LIVE_RELOAD_SCRIPT_TEMPLATE = (port) => `<script defer type="application/javascript">
@@ -12105,7 +12251,10 @@ function getCustomServiceDesignator(refererName, workerIndex, kind, name, servic
12105
12251
  if (typeof service === "function") {
12106
12252
  serviceName = getCustomServiceName(workerIndex, kind, name);
12107
12253
  } else if (typeof service === "object") {
12108
- if ("name" in service) {
12254
+ if ("mixedModeConnectionString" in service) {
12255
+ (0, import_assert9.default)("name" in service && typeof service.name === "string");
12256
+ serviceName = `${CORE_PLUGIN_NAME2}:mixed-mode-service:${workerIndex}:${name}`;
12257
+ } else if ("name" in service) {
12109
12258
  if (service.name === kCurrentWorker) {
12110
12259
  serviceName = getUserServiceName(refererName);
12111
12260
  } else {
@@ -12146,6 +12295,14 @@ function maybeGetCustomServiceService(workerIndex, kind, name, service) {
12146
12295
  name: getBuiltinServiceName(workerIndex, kind, name),
12147
12296
  ...service
12148
12297
  };
12298
+ } else if (typeof service === "object" && service.mixedModeConnectionString !== void 0) {
12299
+ (0, import_assert9.default)(
12300
+ service.mixedModeConnectionString && service.name && typeof service.name === "string"
12301
+ );
12302
+ return {
12303
+ name: `${CORE_PLUGIN_NAME2}:mixed-mode-service:${workerIndex}:${name}`,
12304
+ worker: mixedModeClientWorker(service.mixedModeConnectionString, name)
12305
+ };
12149
12306
  }
12150
12307
  }
12151
12308
  var FALLBACK_COMPATIBILITY_DATE = "2000-01-01";
@@ -12199,6 +12356,20 @@ function maybeWrappedModuleToWorkerName(name) {
12199
12356
  return name.substring(WRAPPED_MODULE_PREFIX.length);
12200
12357
  }
12201
12358
  }
12359
+ function getStripCfConnectingIpName(workerIndex) {
12360
+ return `strip-cf-connecting-ip:${workerIndex}`;
12361
+ }
12362
+ function getGlobalOutbound(workerIndex, options) {
12363
+ return options.outboundService === void 0 ? void 0 : getCustomServiceDesignator(
12364
+ /* referrer */
12365
+ options.name,
12366
+ workerIndex,
12367
+ "$" /* KNOWN */,
12368
+ CUSTOM_SERVICE_KNOWN_OUTBOUND,
12369
+ options.outboundService,
12370
+ options.hasAssetsAndIsVitest
12371
+ );
12372
+ }
12202
12373
  var CORE_PLUGIN = {
12203
12374
  options: CoreOptionsSchema,
12204
12375
  sharedOptions: CoreSharedOptionsSchema,
@@ -12217,7 +12388,7 @@ var CORE_PLUGIN = {
12217
12388
  if (options.textBlobBindings !== void 0) {
12218
12389
  bindings.push(
12219
12390
  ...Object.entries(options.textBlobBindings).map(
12220
- ([name, path34]) => import_promises6.default.readFile(path34, "utf8").then((text) => ({ name, text }))
12391
+ ([name, path37]) => import_promises6.default.readFile(path37, "utf8").then((text) => ({ name, text }))
12221
12392
  )
12222
12393
  );
12223
12394
  }
@@ -12290,7 +12461,7 @@ var CORE_PLUGIN = {
12290
12461
  if (options.textBlobBindings !== void 0) {
12291
12462
  bindingEntries3.push(
12292
12463
  ...Object.entries(options.textBlobBindings).map(
12293
- ([name, path34]) => import_promises6.default.readFile(path34, "utf8").then((text) => [name, text])
12464
+ ([name, path37]) => import_promises6.default.readFile(path37, "utf8").then((text) => [name, text])
12294
12465
  )
12295
12466
  );
12296
12467
  }
@@ -12338,16 +12509,16 @@ var CORE_PLUGIN = {
12338
12509
  );
12339
12510
  if ("modules" in workerScript) {
12340
12511
  const subDirs = new Set(
12341
- workerScript.modules.map(({ name: name2 }) => import_path19.default.posix.dirname(name2))
12512
+ workerScript.modules.map(({ name: name2 }) => import_path21.default.posix.dirname(name2))
12342
12513
  );
12343
12514
  subDirs.delete(".");
12344
12515
  for (const module2 of additionalModules) {
12345
12516
  workerScript.modules.push(module2);
12346
12517
  for (const subDir of subDirs) {
12347
- const relativePath = import_path19.default.posix.relative(subDir, module2.name);
12518
+ const relativePath = import_path21.default.posix.relative(subDir, module2.name);
12348
12519
  const relativePathString = JSON.stringify(relativePath);
12349
12520
  workerScript.modules.push({
12350
- name: import_path19.default.posix.join(subDir, module2.name),
12521
+ name: import_path21.default.posix.join(subDir, module2.name),
12351
12522
  // TODO(someday): if we ever have additional modules without
12352
12523
  // default exports, this may be a problem. For now, our only
12353
12524
  // additional module is `__STATIC_CONTENT_MANIFEST` so it's fine.
@@ -12456,15 +12627,7 @@ Ensure ${stringName} doesn't include unbundled \`import\`s.`
12456
12627
  }
12457
12628
  ),
12458
12629
  durableObjectStorage: classNamesEntries.length === 0 ? void 0 : options.unsafeEphemeralDurableObjects ? { inMemory: kVoid } : { localDisk: DURABLE_OBJECTS_STORAGE_SERVICE_NAME },
12459
- globalOutbound: options.outboundService === void 0 ? void 0 : getCustomServiceDesignator(
12460
- /* referrer */
12461
- options.name,
12462
- workerIndex,
12463
- "$" /* KNOWN */,
12464
- CUSTOM_SERVICE_KNOWN_OUTBOUND,
12465
- options.outboundService,
12466
- options.hasAssetsAndIsVitest
12467
- ),
12630
+ globalOutbound: options.stripCfConnectingIp ? { name: getStripCfConnectingIpName(workerIndex) } : getGlobalOutbound(workerIndex, options),
12468
12631
  cacheApiOutbound: { name: getCacheServiceName(workerIndex) },
12469
12632
  moduleFallback: options.unsafeUseModuleFallbackService && sharedOptions.unsafeModuleFallbackService !== void 0 ? `localhost:${loopbackPort}` : void 0,
12470
12633
  tails: options.tails === void 0 ? void 0 : options.tails.map((service) => {
@@ -12512,10 +12675,25 @@ Ensure ${stringName} doesn't include unbundled \`import\`s.`
12512
12675
  );
12513
12676
  if (maybeService !== void 0) services.push(maybeService);
12514
12677
  }
12515
- return { services, extensions };
12516
- }
12517
- };
12518
- function getGlobalServices({
12678
+ if (options.stripCfConnectingIp) {
12679
+ services.push({
12680
+ name: getStripCfConnectingIpName(workerIndex),
12681
+ worker: {
12682
+ modules: [
12683
+ {
12684
+ name: "index.js",
12685
+ esModule: strip_cf_connecting_ip_worker_default()
12686
+ }
12687
+ ],
12688
+ compatibilityDate: "2025-01-01",
12689
+ globalOutbound: getGlobalOutbound(workerIndex, options)
12690
+ }
12691
+ });
12692
+ }
12693
+ return { services, extensions };
12694
+ }
12695
+ };
12696
+ function getGlobalServices({
12519
12697
  sharedOptions,
12520
12698
  allWorkerRoutes,
12521
12699
  fallbackWorkerName,
@@ -12625,7 +12803,7 @@ function getGlobalServices({
12625
12803
  ];
12626
12804
  }
12627
12805
  function getWorkerScript(options, workerIndex, additionalModuleNames) {
12628
- const modulesRoot = import_path19.default.resolve(
12806
+ const modulesRoot = import_path21.default.resolve(
12629
12807
  ("modulesRoot" in options ? options.modulesRoot : void 0) ?? ""
12630
12808
  );
12631
12809
  if (Array.isArray(options.modules)) {
@@ -12639,7 +12817,7 @@ function getWorkerScript(options, workerIndex, additionalModuleNames) {
12639
12817
  if ("script" in options && options.script !== void 0) {
12640
12818
  code = options.script;
12641
12819
  } else if ("scriptPath" in options && options.scriptPath !== void 0) {
12642
- code = (0, import_fs16.readFileSync)(options.scriptPath, "utf8");
12820
+ code = (0, import_fs18.readFileSync)(options.scriptPath, "utf8");
12643
12821
  } else {
12644
12822
  import_assert9.default.fail("Unreachable: Workers must have code");
12645
12823
  }
@@ -12661,22 +12839,22 @@ function getWorkerScript(options, workerIndex, additionalModuleNames) {
12661
12839
  }
12662
12840
 
12663
12841
  // src/plugins/assets/schema.ts
12664
- var import_zod14 = require("zod");
12665
- var AssetsOptionsSchema = import_zod14.z.object({
12666
- assets: import_zod14.z.object({
12842
+ var import_zod15 = require("zod");
12843
+ var AssetsOptionsSchema = import_zod15.z.object({
12844
+ assets: import_zod15.z.object({
12667
12845
  // User Worker name or vitest runner - this is only ever set inside miniflare
12668
12846
  // The assets plugin needs access to the worker name to create the router worker - user worker binding
12669
- workerName: import_zod14.z.string().optional(),
12847
+ workerName: import_zod15.z.string().optional(),
12670
12848
  directory: PathSchema,
12671
- binding: import_zod14.z.string().optional(),
12849
+ binding: import_zod15.z.string().optional(),
12672
12850
  routerConfig: RouterConfigSchema.optional(),
12673
12851
  assetConfig: AssetConfigSchema.omit({
12674
12852
  compatibility_date: true,
12675
12853
  compatibility_flags: true
12676
12854
  }).optional()
12677
12855
  }).optional(),
12678
- compatibilityDate: import_zod14.z.string().optional(),
12679
- compatibilityFlags: import_zod14.z.string().array().optional()
12856
+ compatibilityDate: import_zod15.z.string().optional(),
12857
+ compatibilityFlags: import_zod15.z.string().array().optional()
12680
12858
  });
12681
12859
 
12682
12860
  // src/plugins/assets/index.ts
@@ -12984,9 +13162,9 @@ var encodeManifest = (manifest) => {
12984
13162
  var bytesToHex = (buffer) => {
12985
13163
  return [...new Uint8Array(buffer)].map((b) => b.toString(16).padStart(2, "0")).join("");
12986
13164
  };
12987
- var hashPath = async (path34) => {
13165
+ var hashPath = async (path37) => {
12988
13166
  const encoder3 = new TextEncoder();
12989
- const data = encoder3.encode(path34);
13167
+ const data = encoder3.encode(path37);
12990
13168
  const hashBuffer = await import_node_crypto.default.subtle.digest(
12991
13169
  "SHA-256",
12992
13170
  data.buffer
@@ -12994,27 +13172,91 @@ var hashPath = async (path34) => {
12994
13172
  return new Uint8Array(hashBuffer, 0, PATH_HASH_SIZE);
12995
13173
  };
12996
13174
 
13175
+ // src/plugins/browser-rendering/index.ts
13176
+ var import_node_assert4 = __toESM(require("node:assert"));
13177
+ var import_zod16 = require("zod");
13178
+ var BrowserRenderingSchema = import_zod16.z.object({
13179
+ binding: import_zod16.z.string(),
13180
+ mixedModeConnectionString: import_zod16.z.custom()
13181
+ });
13182
+ var BrowserRenderingOptionsSchema = import_zod16.z.object({
13183
+ browserRendering: BrowserRenderingSchema.optional()
13184
+ });
13185
+ var BROWSER_RENDERING_PLUGIN_NAME = "browser-rendering";
13186
+ var BROWSER_RENDERING_PLUGIN = {
13187
+ options: BrowserRenderingOptionsSchema,
13188
+ async getBindings(options) {
13189
+ if (!options.browserRendering) {
13190
+ return [];
13191
+ }
13192
+ (0, import_node_assert4.default)(
13193
+ options.browserRendering.mixedModeConnectionString,
13194
+ "Workers Browser Rendering only supports Mixed Mode"
13195
+ );
13196
+ return [
13197
+ {
13198
+ name: options.browserRendering.binding,
13199
+ service: {
13200
+ name: `${BROWSER_RENDERING_PLUGIN_NAME}:${options.browserRendering.binding}`
13201
+ }
13202
+ }
13203
+ ];
13204
+ },
13205
+ getNodeBindings(options) {
13206
+ if (!options.browserRendering) {
13207
+ return {};
13208
+ }
13209
+ return {
13210
+ [options.browserRendering.binding]: new ProxyNodeBinding()
13211
+ };
13212
+ },
13213
+ async getServices({ options }) {
13214
+ if (!options.browserRendering) {
13215
+ return [];
13216
+ }
13217
+ return [
13218
+ {
13219
+ name: `${BROWSER_RENDERING_PLUGIN_NAME}:${options.browserRendering.binding}`,
13220
+ worker: mixedModeClientWorker(
13221
+ options.browserRendering.mixedModeConnectionString,
13222
+ options.browserRendering.binding
13223
+ )
13224
+ }
13225
+ ];
13226
+ }
13227
+ };
13228
+
12997
13229
  // src/plugins/d1/index.ts
13230
+ var import_assert10 = __toESM(require("assert"));
12998
13231
  var import_promises8 = __toESM(require("fs/promises"));
12999
13232
 
13000
13233
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/d1/database.worker.ts
13001
- var import_fs17 = __toESM(require("fs"));
13002
- var import_path20 = __toESM(require("path"));
13003
- var import_url17 = __toESM(require("url"));
13004
- var contents13;
13234
+ var import_fs19 = __toESM(require("fs"));
13235
+ var import_path22 = __toESM(require("path"));
13236
+ var import_url19 = __toESM(require("url"));
13237
+ var contents15;
13005
13238
  function database_worker_default() {
13006
- if (contents13 !== void 0) return contents13;
13007
- const filePath = import_path20.default.join(__dirname, "workers", "d1/database.worker.js");
13008
- contents13 = import_fs17.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url17.default.pathToFileURL(filePath);
13009
- return contents13;
13239
+ if (contents15 !== void 0) return contents15;
13240
+ const filePath = import_path22.default.join(__dirname, "workers", "d1/database.worker.js");
13241
+ contents15 = import_fs19.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url19.default.pathToFileURL(filePath);
13242
+ return contents15;
13010
13243
  }
13011
13244
 
13012
13245
  // src/plugins/d1/index.ts
13013
- var import_zod15 = require("zod");
13014
- var D1OptionsSchema = import_zod15.z.object({
13015
- d1Databases: import_zod15.z.union([import_zod15.z.record(import_zod15.z.string()), import_zod15.z.string().array()]).optional()
13246
+ var import_zod17 = require("zod");
13247
+ var D1OptionsSchema = import_zod17.z.object({
13248
+ d1Databases: import_zod17.z.union([
13249
+ import_zod17.z.record(import_zod17.z.string()),
13250
+ import_zod17.z.record(
13251
+ import_zod17.z.object({
13252
+ id: import_zod17.z.string(),
13253
+ mixedModeConnectionString: import_zod17.z.custom().optional()
13254
+ })
13255
+ ),
13256
+ import_zod17.z.string().array()
13257
+ ]).optional()
13016
13258
  });
13017
- var D1SharedOptionsSchema = import_zod15.z.object({
13259
+ var D1SharedOptionsSchema = import_zod17.z.object({
13018
13260
  d1Persist: PersistenceSchema
13019
13261
  });
13020
13262
  var D1_PLUGIN_NAME = "d1";
@@ -13030,28 +13272,34 @@ var D1_PLUGIN = {
13030
13272
  sharedOptions: D1SharedOptionsSchema,
13031
13273
  getBindings(options) {
13032
13274
  const databases = namespaceEntries(options.d1Databases);
13033
- return databases.map(([name, id]) => {
13034
- const binding = name.startsWith("__D1_BETA__") ? (
13035
- // Used before Wrangler 3.3
13036
- {
13037
- service: { name: `${D1_DATABASE_SERVICE_PREFIX}:${id}` }
13038
- }
13039
- ) : (
13040
- // Used after Wrangler 3.3
13041
- {
13042
- wrapped: {
13043
- moduleName: "cloudflare-internal:d1-api",
13044
- innerBindings: [
13045
- {
13046
- name: "fetcher",
13047
- service: { name: `${D1_DATABASE_SERVICE_PREFIX}:${id}` }
13048
- }
13049
- ]
13275
+ return databases.map(
13276
+ ([name, { id, mixedModeConnectionString }]) => {
13277
+ (0, import_assert10.default)(
13278
+ !(name.startsWith("__D1_BETA__") && mixedModeConnectionString),
13279
+ "Mixed Mode cannot be used with Alpha D1 Databases"
13280
+ );
13281
+ const binding = name.startsWith("__D1_BETA__") ? (
13282
+ // Used before Wrangler 3.3
13283
+ {
13284
+ service: { name: `${D1_DATABASE_SERVICE_PREFIX}:${id}` }
13050
13285
  }
13051
- }
13052
- );
13053
- return { name, ...binding };
13054
- });
13286
+ ) : (
13287
+ // Used after Wrangler 3.3
13288
+ {
13289
+ wrapped: {
13290
+ moduleName: "cloudflare-internal:d1-api",
13291
+ innerBindings: [
13292
+ {
13293
+ name: "fetcher",
13294
+ service: { name: `${D1_DATABASE_SERVICE_PREFIX}:${id}` }
13295
+ }
13296
+ ]
13297
+ }
13298
+ }
13299
+ );
13300
+ return { name, ...binding };
13301
+ }
13302
+ );
13055
13303
  },
13056
13304
  getNodeBindings(options) {
13057
13305
  const databases = namespaceKeys(options.d1Databases);
@@ -13068,10 +13316,12 @@ var D1_PLUGIN = {
13068
13316
  }) {
13069
13317
  const persist = sharedOptions.d1Persist;
13070
13318
  const databases = namespaceEntries(options.d1Databases);
13071
- const services = databases.map(([_, id]) => ({
13072
- name: `${D1_DATABASE_SERVICE_PREFIX}:${id}`,
13073
- worker: objectEntryWorker(D1_DATABASE_OBJECT, id)
13074
- }));
13319
+ const services = databases.map(
13320
+ ([name, { id, mixedModeConnectionString }]) => ({
13321
+ name: `${D1_DATABASE_SERVICE_PREFIX}:${id}`,
13322
+ worker: mixedModeConnectionString ? mixedModeClientWorker(mixedModeConnectionString, name) : objectEntryWorker(D1_DATABASE_OBJECT, id)
13323
+ })
13324
+ );
13075
13325
  if (databases.length > 0) {
13076
13326
  const uniqueKey = `miniflare-${D1_DATABASE_OBJECT_CLASS_NAME}`;
13077
13327
  const persistPath = getPersistPath(D1_PLUGIN_NAME, tmpPath, persist);
@@ -13115,7 +13365,7 @@ var D1_PLUGIN = {
13115
13365
  };
13116
13366
  services.push(storageService, objectService);
13117
13367
  for (const database of databases) {
13118
- await migrateDatabase(log, uniqueKey, persistPath, database[1]);
13368
+ await migrateDatabase(log, uniqueKey, persistPath, database[1].id);
13119
13369
  }
13120
13370
  }
13121
13371
  return services;
@@ -13125,49 +13375,147 @@ var D1_PLUGIN = {
13125
13375
  }
13126
13376
  };
13127
13377
 
13378
+ // src/plugins/dispatch-namespace/index.ts
13379
+ var import_node_assert5 = __toESM(require("node:assert"));
13380
+
13381
+ // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/dispatch-namespace/dispatch-namespace.worker.ts
13382
+ var import_fs20 = __toESM(require("fs"));
13383
+ var import_path23 = __toESM(require("path"));
13384
+ var import_url20 = __toESM(require("url"));
13385
+ var contents16;
13386
+ function dispatch_namespace_worker_default() {
13387
+ if (contents16 !== void 0) return contents16;
13388
+ const filePath = import_path23.default.join(__dirname, "workers", "dispatch-namespace/dispatch-namespace.worker.js");
13389
+ contents16 = import_fs20.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url20.default.pathToFileURL(filePath);
13390
+ return contents16;
13391
+ }
13392
+
13393
+ // src/plugins/dispatch-namespace/index.ts
13394
+ var import_zod18 = require("zod");
13395
+ var DispatchNamespaceOptionsSchema = import_zod18.z.object({
13396
+ dispatchNamespaces: import_zod18.z.record(
13397
+ import_zod18.z.object({
13398
+ namespace: import_zod18.z.string(),
13399
+ mixedModeConnectionString: import_zod18.z.custom().optional()
13400
+ })
13401
+ ).optional()
13402
+ });
13403
+ var DISPATCH_NAMESPACE_PLUGIN_NAME = "dispatch-namespace";
13404
+ var DISPATCH_NAMESPACE_PLUGIN = {
13405
+ options: DispatchNamespaceOptionsSchema,
13406
+ async getBindings(options) {
13407
+ if (!options.dispatchNamespaces) {
13408
+ return [];
13409
+ }
13410
+ const bindings = Object.entries(
13411
+ options.dispatchNamespaces
13412
+ ).map(([name, config]) => {
13413
+ return {
13414
+ name,
13415
+ wrapped: {
13416
+ moduleName: `${DISPATCH_NAMESPACE_PLUGIN_NAME}:local-dispatch-namespace`,
13417
+ innerBindings: [
13418
+ {
13419
+ name: "fetcher",
13420
+ service: {
13421
+ name: `${DISPATCH_NAMESPACE_PLUGIN_NAME}:ns:${config.namespace}`
13422
+ }
13423
+ }
13424
+ ]
13425
+ }
13426
+ };
13427
+ });
13428
+ return bindings;
13429
+ },
13430
+ getNodeBindings(options) {
13431
+ if (!options.dispatchNamespaces) {
13432
+ return {};
13433
+ }
13434
+ return Object.fromEntries(
13435
+ Object.keys(options.dispatchNamespaces).map((name) => [
13436
+ name,
13437
+ new ProxyNodeBinding()
13438
+ ])
13439
+ );
13440
+ },
13441
+ async getServices({ options }) {
13442
+ if (!options.dispatchNamespaces) {
13443
+ return [];
13444
+ }
13445
+ return {
13446
+ services: Object.entries(options.dispatchNamespaces).map(
13447
+ ([name, config]) => {
13448
+ (0, import_node_assert5.default)(
13449
+ config.mixedModeConnectionString,
13450
+ "Dispatch Namespace bindings only support Mixed Mode"
13451
+ );
13452
+ return {
13453
+ name: `${DISPATCH_NAMESPACE_PLUGIN_NAME}:ns:${config.namespace}`,
13454
+ worker: mixedModeClientWorker(
13455
+ config.mixedModeConnectionString,
13456
+ name
13457
+ )
13458
+ };
13459
+ }
13460
+ ),
13461
+ extensions: [
13462
+ {
13463
+ modules: [
13464
+ {
13465
+ name: `${DISPATCH_NAMESPACE_PLUGIN_NAME}:local-dispatch-namespace`,
13466
+ esModule: dispatch_namespace_worker_default(),
13467
+ internal: true
13468
+ }
13469
+ ]
13470
+ }
13471
+ ]
13472
+ };
13473
+ }
13474
+ };
13475
+
13128
13476
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/email/email.worker.ts
13129
- var import_fs18 = __toESM(require("fs"));
13130
- var import_path21 = __toESM(require("path"));
13131
- var import_url18 = __toESM(require("url"));
13132
- var contents14;
13477
+ var import_fs21 = __toESM(require("fs"));
13478
+ var import_path24 = __toESM(require("path"));
13479
+ var import_url21 = __toESM(require("url"));
13480
+ var contents17;
13133
13481
  function email_worker_default() {
13134
- if (contents14 !== void 0) return contents14;
13135
- const filePath = import_path21.default.join(__dirname, "workers", "email/email.worker.js");
13136
- contents14 = import_fs18.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url18.default.pathToFileURL(filePath);
13137
- return contents14;
13482
+ if (contents17 !== void 0) return contents17;
13483
+ const filePath = import_path24.default.join(__dirname, "workers", "email/email.worker.js");
13484
+ contents17 = import_fs21.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url21.default.pathToFileURL(filePath);
13485
+ return contents17;
13138
13486
  }
13139
13487
 
13140
13488
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/email/send_email.worker.ts
13141
- var import_fs19 = __toESM(require("fs"));
13142
- var import_path22 = __toESM(require("path"));
13143
- var import_url19 = __toESM(require("url"));
13144
- var contents15;
13489
+ var import_fs22 = __toESM(require("fs"));
13490
+ var import_path25 = __toESM(require("path"));
13491
+ var import_url22 = __toESM(require("url"));
13492
+ var contents18;
13145
13493
  function send_email_worker_default() {
13146
- if (contents15 !== void 0) return contents15;
13147
- const filePath = import_path22.default.join(__dirname, "workers", "email/send_email.worker.js");
13148
- contents15 = import_fs19.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url19.default.pathToFileURL(filePath);
13149
- return contents15;
13494
+ if (contents18 !== void 0) return contents18;
13495
+ const filePath = import_path25.default.join(__dirname, "workers", "email/send_email.worker.js");
13496
+ contents18 = import_fs22.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url22.default.pathToFileURL(filePath);
13497
+ return contents18;
13150
13498
  }
13151
13499
 
13152
13500
  // src/plugins/email/index.ts
13153
- var import_zod16 = require("zod");
13154
- var EmailBindingOptionsSchema = import_zod16.z.object({
13155
- name: import_zod16.z.string()
13501
+ var import_zod19 = require("zod");
13502
+ var EmailBindingOptionsSchema = import_zod19.z.object({
13503
+ name: import_zod19.z.string()
13156
13504
  }).and(
13157
- import_zod16.z.union([
13158
- import_zod16.z.object({
13159
- destination_address: import_zod16.z.string().optional(),
13160
- allowed_destination_addresses: import_zod16.z.never().optional()
13505
+ import_zod19.z.union([
13506
+ import_zod19.z.object({
13507
+ destination_address: import_zod19.z.string().optional(),
13508
+ allowed_destination_addresses: import_zod19.z.never().optional()
13161
13509
  }),
13162
- import_zod16.z.object({
13163
- allowed_destination_addresses: import_zod16.z.array(import_zod16.z.string()).optional(),
13164
- destination_address: import_zod16.z.never().optional()
13510
+ import_zod19.z.object({
13511
+ allowed_destination_addresses: import_zod19.z.array(import_zod19.z.string()).optional(),
13512
+ destination_address: import_zod19.z.never().optional()
13165
13513
  })
13166
13514
  ])
13167
13515
  );
13168
- var EmailOptionsSchema = import_zod16.z.object({
13169
- email: import_zod16.z.object({
13170
- send_email: import_zod16.z.array(EmailBindingOptionsSchema).optional()
13516
+ var EmailOptionsSchema = import_zod19.z.object({
13517
+ email: import_zod19.z.object({
13518
+ send_email: import_zod19.z.array(EmailBindingOptionsSchema).optional()
13171
13519
  }).optional()
13172
13520
  });
13173
13521
  var EMAIL_PLUGIN_NAME = "email";
@@ -13236,70 +13584,70 @@ var EMAIL_PLUGIN = {
13236
13584
  };
13237
13585
 
13238
13586
  // src/plugins/hyperdrive/index.ts
13239
- var import_node_assert3 = __toESM(require("node:assert"));
13240
- var import_zod17 = require("zod");
13587
+ var import_node_assert6 = __toESM(require("node:assert"));
13588
+ var import_zod20 = require("zod");
13241
13589
  var HYPERDRIVE_PLUGIN_NAME = "hyperdrive";
13242
- function hasPostgresProtocol(url24) {
13243
- return url24.protocol === "postgresql:" || url24.protocol === "postgres:";
13590
+ function hasPostgresProtocol(url27) {
13591
+ return url27.protocol === "postgresql:" || url27.protocol === "postgres:";
13244
13592
  }
13245
- function hasMysqlProtocol(url24) {
13246
- return url24.protocol === "mysql:";
13593
+ function hasMysqlProtocol(url27) {
13594
+ return url27.protocol === "mysql:";
13247
13595
  }
13248
- function getPort(url24) {
13249
- if (url24.port !== "") return url24.port;
13250
- if (hasPostgresProtocol(url24)) return "5432";
13251
- if (hasMysqlProtocol(url24)) return "3306";
13252
- import_node_assert3.default.fail(`Expected known protocol, got ${url24.protocol}`);
13596
+ function getPort(url27) {
13597
+ if (url27.port !== "") return url27.port;
13598
+ if (hasPostgresProtocol(url27)) return "5432";
13599
+ if (hasMysqlProtocol(url27)) return "3306";
13600
+ import_node_assert6.default.fail(`Expected known protocol, got ${url27.protocol}`);
13253
13601
  }
13254
- var HyperdriveSchema = import_zod17.z.union([import_zod17.z.string().url(), import_zod17.z.instanceof(URL)]).transform((url24, ctx) => {
13255
- if (typeof url24 === "string") url24 = new URL(url24);
13256
- if (url24.protocol === "") {
13602
+ var HyperdriveSchema = import_zod20.z.union([import_zod20.z.string().url(), import_zod20.z.instanceof(URL)]).transform((url27, ctx) => {
13603
+ if (typeof url27 === "string") url27 = new URL(url27);
13604
+ if (url27.protocol === "") {
13257
13605
  ctx.addIssue({
13258
- code: import_zod17.z.ZodIssueCode.custom,
13606
+ code: import_zod20.z.ZodIssueCode.custom,
13259
13607
  message: "You must specify the database protocol - e.g. 'postgresql'/'mysql'."
13260
13608
  });
13261
- } else if (!hasPostgresProtocol(url24) && !hasMysqlProtocol(url24)) {
13609
+ } else if (!hasPostgresProtocol(url27) && !hasMysqlProtocol(url27)) {
13262
13610
  ctx.addIssue({
13263
- code: import_zod17.z.ZodIssueCode.custom,
13611
+ code: import_zod20.z.ZodIssueCode.custom,
13264
13612
  message: "Only PostgreSQL-compatible or MySQL-compatible databases are currently supported."
13265
13613
  });
13266
13614
  }
13267
- if (url24.host === "") {
13615
+ if (url27.host === "") {
13268
13616
  ctx.addIssue({
13269
- code: import_zod17.z.ZodIssueCode.custom,
13617
+ code: import_zod20.z.ZodIssueCode.custom,
13270
13618
  message: "You must provide a hostname or IP address in your connection string - e.g. 'user:password@database-hostname.example.com:5432/databasename"
13271
13619
  });
13272
13620
  }
13273
- if (url24.pathname === "") {
13621
+ if (url27.pathname === "") {
13274
13622
  ctx.addIssue({
13275
- code: import_zod17.z.ZodIssueCode.custom,
13623
+ code: import_zod20.z.ZodIssueCode.custom,
13276
13624
  message: "You must provide a database name as the path component - e.g. /postgres"
13277
13625
  });
13278
13626
  }
13279
- if (url24.username === "") {
13627
+ if (url27.username === "") {
13280
13628
  ctx.addIssue({
13281
- code: import_zod17.z.ZodIssueCode.custom,
13629
+ code: import_zod20.z.ZodIssueCode.custom,
13282
13630
  message: "You must provide a username - e.g. 'user:password@database.example.com:port/databasename'"
13283
13631
  });
13284
13632
  }
13285
- if (url24.password === "") {
13633
+ if (url27.password === "") {
13286
13634
  ctx.addIssue({
13287
- code: import_zod17.z.ZodIssueCode.custom,
13635
+ code: import_zod20.z.ZodIssueCode.custom,
13288
13636
  message: "You must provide a password - e.g. 'user:password@database.example.com:port/databasename' "
13289
13637
  });
13290
13638
  }
13291
- return url24;
13639
+ return url27;
13292
13640
  });
13293
- var HyperdriveInputOptionsSchema = import_zod17.z.object({
13294
- hyperdrives: import_zod17.z.record(import_zod17.z.string(), HyperdriveSchema).optional()
13641
+ var HyperdriveInputOptionsSchema = import_zod20.z.object({
13642
+ hyperdrives: import_zod20.z.record(import_zod20.z.string(), HyperdriveSchema).optional()
13295
13643
  });
13296
13644
  var HYPERDRIVE_PLUGIN = {
13297
13645
  options: HyperdriveInputOptionsSchema,
13298
13646
  getBindings(options) {
13299
13647
  return Object.entries(options.hyperdrives ?? {}).map(
13300
- ([name, url24]) => {
13301
- const database = url24.pathname.replace("/", "");
13302
- const scheme = url24.protocol.replace(":", "");
13648
+ ([name, url27]) => {
13649
+ const database = url27.pathname.replace("/", "");
13650
+ const scheme = url27.protocol.replace(":", "");
13303
13651
  return {
13304
13652
  name,
13305
13653
  hyperdrive: {
@@ -13307,8 +13655,8 @@ var HYPERDRIVE_PLUGIN = {
13307
13655
  name: `${HYPERDRIVE_PLUGIN_NAME}:${name}`
13308
13656
  },
13309
13657
  database: decodeURIComponent(database),
13310
- user: decodeURIComponent(url24.username),
13311
- password: decodeURIComponent(url24.password),
13658
+ user: decodeURIComponent(url27.username),
13659
+ password: decodeURIComponent(url27.password),
13312
13660
  scheme
13313
13661
  }
13314
13662
  };
@@ -13317,11 +13665,11 @@ var HYPERDRIVE_PLUGIN = {
13317
13665
  },
13318
13666
  getNodeBindings(options) {
13319
13667
  return Object.fromEntries(
13320
- Object.entries(options.hyperdrives ?? {}).map(([name, url24]) => {
13668
+ Object.entries(options.hyperdrives ?? {}).map(([name, url27]) => {
13321
13669
  const connectionOverrides = {
13322
- connectionString: `${url24}`,
13323
- port: Number.parseInt(url24.port),
13324
- host: url24.hostname
13670
+ connectionString: `${url27}`,
13671
+ port: Number.parseInt(url27.port),
13672
+ host: url27.hostname
13325
13673
  };
13326
13674
  const proxyNodeBinding = new ProxyNodeBinding({
13327
13675
  get(target, prop) {
@@ -13334,10 +13682,10 @@ var HYPERDRIVE_PLUGIN = {
13334
13682
  },
13335
13683
  async getServices({ options }) {
13336
13684
  return Object.entries(options.hyperdrives ?? {}).map(
13337
- ([name, url24]) => ({
13685
+ ([name, url27]) => ({
13338
13686
  name: `${HYPERDRIVE_PLUGIN_NAME}:${name}`,
13339
13687
  external: {
13340
- address: `${url24.hostname}:${getPort(url24)}`,
13688
+ address: `${url27.hostname}:${getPort(url27)}`,
13341
13689
  tcp: {}
13342
13690
  }
13343
13691
  })
@@ -13345,49 +13693,128 @@ var HYPERDRIVE_PLUGIN = {
13345
13693
  }
13346
13694
  };
13347
13695
 
13696
+ // src/plugins/images/index.ts
13697
+ var import_zod21 = require("zod");
13698
+ var IMAGES_LOCAL_FETCHER = (
13699
+ /* javascript */
13700
+ `
13701
+ export default {
13702
+ fetch(req, env) {
13703
+ const request = new Request(req);
13704
+ request.headers.set("${CoreHeaders.CUSTOM_SERVICE}", "${CoreBindings.IMAGES_SERVICE}");
13705
+ request.headers.set("${CoreHeaders.ORIGINAL_URL}", request.url);
13706
+ return env.${CoreBindings.SERVICE_LOOPBACK}.fetch(request)
13707
+ }
13708
+ }
13709
+ `
13710
+ );
13711
+ var ImagesSchema = import_zod21.z.object({
13712
+ binding: import_zod21.z.string(),
13713
+ mixedModeConnectionString: import_zod21.z.custom().optional()
13714
+ });
13715
+ var ImagesOptionsSchema = import_zod21.z.object({
13716
+ images: ImagesSchema.optional()
13717
+ });
13718
+ var IMAGES_PLUGIN_NAME = "images";
13719
+ var IMAGES_PLUGIN = {
13720
+ options: ImagesOptionsSchema,
13721
+ async getBindings(options) {
13722
+ if (!options.images) {
13723
+ return [];
13724
+ }
13725
+ return [
13726
+ {
13727
+ name: options.images.binding,
13728
+ wrapped: {
13729
+ moduleName: "cloudflare-internal:images-api",
13730
+ innerBindings: [
13731
+ {
13732
+ name: "fetcher",
13733
+ service: {
13734
+ name: `${IMAGES_PLUGIN_NAME}:${options.images.binding}`
13735
+ }
13736
+ }
13737
+ ]
13738
+ }
13739
+ }
13740
+ ];
13741
+ },
13742
+ getNodeBindings(options) {
13743
+ if (!options.images) {
13744
+ return {};
13745
+ }
13746
+ return {
13747
+ [options.images.binding]: new ProxyNodeBinding()
13748
+ };
13749
+ },
13750
+ async getServices({ options }) {
13751
+ if (!options.images) {
13752
+ return [];
13753
+ }
13754
+ return [
13755
+ {
13756
+ name: `${IMAGES_PLUGIN_NAME}:${options.images.binding}`,
13757
+ worker: options.images.mixedModeConnectionString ? mixedModeClientWorker(
13758
+ options.images.mixedModeConnectionString,
13759
+ options.images.binding
13760
+ ) : {
13761
+ modules: [
13762
+ {
13763
+ name: "index.worker.js",
13764
+ esModule: IMAGES_LOCAL_FETCHER
13765
+ }
13766
+ ],
13767
+ compatibilityDate: "2025-04-01",
13768
+ bindings: [WORKER_BINDING_SERVICE_LOOPBACK]
13769
+ }
13770
+ }
13771
+ ];
13772
+ }
13773
+ };
13774
+
13348
13775
  // src/plugins/kv/index.ts
13349
13776
  var import_promises10 = __toESM(require("fs/promises"));
13350
13777
 
13351
13778
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/kv/namespace.worker.ts
13352
- var import_fs20 = __toESM(require("fs"));
13353
- var import_path23 = __toESM(require("path"));
13354
- var import_url20 = __toESM(require("url"));
13355
- var contents16;
13779
+ var import_fs23 = __toESM(require("fs"));
13780
+ var import_path26 = __toESM(require("path"));
13781
+ var import_url23 = __toESM(require("url"));
13782
+ var contents19;
13356
13783
  function namespace_worker_default() {
13357
- if (contents16 !== void 0) return contents16;
13358
- const filePath = import_path23.default.join(__dirname, "workers", "kv/namespace.worker.js");
13359
- contents16 = import_fs20.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url20.default.pathToFileURL(filePath);
13360
- return contents16;
13784
+ if (contents19 !== void 0) return contents19;
13785
+ const filePath = import_path26.default.join(__dirname, "workers", "kv/namespace.worker.js");
13786
+ contents19 = import_fs23.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url23.default.pathToFileURL(filePath);
13787
+ return contents19;
13361
13788
  }
13362
13789
 
13363
13790
  // src/plugins/kv/index.ts
13364
- var import_zod18 = require("zod");
13791
+ var import_zod22 = require("zod");
13365
13792
 
13366
13793
  // src/plugins/kv/constants.ts
13367
13794
  var KV_PLUGIN_NAME = "kv";
13368
13795
 
13369
13796
  // src/plugins/kv/sites.ts
13370
- var import_assert10 = __toESM(require("assert"));
13797
+ var import_assert11 = __toESM(require("assert"));
13371
13798
  var import_promises9 = __toESM(require("fs/promises"));
13372
- var import_path25 = __toESM(require("path"));
13799
+ var import_path28 = __toESM(require("path"));
13373
13800
 
13374
13801
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/kv/sites.worker.ts
13375
- var import_fs21 = __toESM(require("fs"));
13376
- var import_path24 = __toESM(require("path"));
13377
- var import_url21 = __toESM(require("url"));
13378
- var contents17;
13802
+ var import_fs24 = __toESM(require("fs"));
13803
+ var import_path27 = __toESM(require("path"));
13804
+ var import_url24 = __toESM(require("url"));
13805
+ var contents20;
13379
13806
  function sites_worker_default() {
13380
- if (contents17 !== void 0) return contents17;
13381
- const filePath = import_path24.default.join(__dirname, "workers", "kv/sites.worker.js");
13382
- contents17 = import_fs21.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url21.default.pathToFileURL(filePath);
13383
- return contents17;
13807
+ if (contents20 !== void 0) return contents20;
13808
+ const filePath = import_path27.default.join(__dirname, "workers", "kv/sites.worker.js");
13809
+ contents20 = import_fs24.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url24.default.pathToFileURL(filePath);
13810
+ return contents20;
13384
13811
  }
13385
13812
 
13386
13813
  // src/plugins/kv/sites.ts
13387
13814
  async function* listKeysInDirectoryInner(rootPath2, currentPath) {
13388
13815
  const fileEntries = await import_promises9.default.readdir(currentPath, { withFileTypes: true });
13389
13816
  for (const fileEntry of fileEntries) {
13390
- const filePath = import_path25.default.posix.join(currentPath, fileEntry.name);
13817
+ const filePath = import_path28.default.posix.join(currentPath, fileEntry.name);
13391
13818
  if (fileEntry.isDirectory()) {
13392
13819
  yield* listKeysInDirectoryInner(rootPath2, filePath);
13393
13820
  } else {
@@ -13396,7 +13823,7 @@ async function* listKeysInDirectoryInner(rootPath2, currentPath) {
13396
13823
  }
13397
13824
  }
13398
13825
  function listKeysInDirectory(rootPath2) {
13399
- rootPath2 = import_path25.default.resolve(rootPath2);
13826
+ rootPath2 = import_path28.default.resolve(rootPath2);
13400
13827
  return listKeysInDirectoryInner(rootPath2, rootPath2);
13401
13828
  }
13402
13829
  var sitesRegExpsCache = /* @__PURE__ */ new WeakMap();
@@ -13433,7 +13860,7 @@ async function getSitesBindings(options) {
13433
13860
  }
13434
13861
  async function getSitesNodeBindings(options) {
13435
13862
  const siteRegExps = sitesRegExpsCache.get(options);
13436
- (0, import_assert10.default)(siteRegExps !== void 0);
13863
+ (0, import_assert11.default)(siteRegExps !== void 0);
13437
13864
  const __STATIC_CONTENT_MANIFEST = await buildStaticContentManifest(
13438
13865
  options.sitePath,
13439
13866
  siteRegExps
@@ -13445,9 +13872,9 @@ async function getSitesNodeBindings(options) {
13445
13872
  }
13446
13873
  function getSitesServices(options) {
13447
13874
  const siteRegExps = sitesRegExpsCache.get(options);
13448
- (0, import_assert10.default)(siteRegExps !== void 0);
13875
+ (0, import_assert11.default)(siteRegExps !== void 0);
13449
13876
  const serialisedSiteRegExps = serialiseSiteRegExps(siteRegExps);
13450
- const persist = import_path25.default.resolve(options.sitePath);
13877
+ const persist = import_path28.default.resolve(options.sitePath);
13451
13878
  const storageServiceName = `${SERVICE_NAMESPACE_SITE}:storage`;
13452
13879
  const storageService = {
13453
13880
  name: storageServiceName,
@@ -13480,14 +13907,23 @@ function getSitesServices(options) {
13480
13907
  }
13481
13908
 
13482
13909
  // src/plugins/kv/index.ts
13483
- var KVOptionsSchema = import_zod18.z.object({
13484
- kvNamespaces: import_zod18.z.union([import_zod18.z.record(import_zod18.z.string()), import_zod18.z.string().array()]).optional(),
13910
+ var KVOptionsSchema = import_zod22.z.object({
13911
+ kvNamespaces: import_zod22.z.union([
13912
+ import_zod22.z.record(import_zod22.z.string()),
13913
+ import_zod22.z.record(
13914
+ import_zod22.z.object({
13915
+ id: import_zod22.z.string(),
13916
+ mixedModeConnectionString: import_zod22.z.custom().optional()
13917
+ })
13918
+ ),
13919
+ import_zod22.z.string().array()
13920
+ ]).optional(),
13485
13921
  // Workers Sites
13486
13922
  sitePath: PathSchema.optional(),
13487
- siteInclude: import_zod18.z.string().array().optional(),
13488
- siteExclude: import_zod18.z.string().array().optional()
13923
+ siteInclude: import_zod22.z.string().array().optional(),
13924
+ siteExclude: import_zod22.z.string().array().optional()
13489
13925
  });
13490
- var KVSharedOptionsSchema = import_zod18.z.object({
13926
+ var KVSharedOptionsSchema = import_zod22.z.object({
13491
13927
  kvPersist: PersistenceSchema
13492
13928
  });
13493
13929
  var SERVICE_NAMESPACE_PREFIX = `${KV_PLUGIN_NAME}:ns`;
@@ -13505,7 +13941,7 @@ var KV_PLUGIN = {
13505
13941
  sharedOptions: KVSharedOptionsSchema,
13506
13942
  async getBindings(options) {
13507
13943
  const namespaces = namespaceEntries(options.kvNamespaces);
13508
- const bindings = namespaces.map(([name, id]) => ({
13944
+ const bindings = namespaces.map(([name, { id }]) => ({
13509
13945
  name,
13510
13946
  kvNamespace: { name: `${SERVICE_NAMESPACE_PREFIX}:${id}` }
13511
13947
  }));
@@ -13533,10 +13969,12 @@ var KV_PLUGIN = {
13533
13969
  }) {
13534
13970
  const persist = sharedOptions.kvPersist;
13535
13971
  const namespaces = namespaceEntries(options.kvNamespaces);
13536
- const services = namespaces.map(([_, id]) => ({
13537
- name: `${SERVICE_NAMESPACE_PREFIX}:${id}`,
13538
- worker: objectEntryWorker(KV_NAMESPACE_OBJECT, id)
13539
- }));
13972
+ const services = namespaces.map(
13973
+ ([name, { id, mixedModeConnectionString }]) => ({
13974
+ name: `${SERVICE_NAMESPACE_PREFIX}:${id}`,
13975
+ worker: mixedModeConnectionString ? mixedModeClientWorker(mixedModeConnectionString, name) : objectEntryWorker(KV_NAMESPACE_OBJECT, id)
13976
+ })
13977
+ );
13540
13978
  if (services.length > 0) {
13541
13979
  const uniqueKey = `miniflare-${KV_NAMESPACE_OBJECT_CLASS_NAME}`;
13542
13980
  const persistPath = getPersistPath(KV_PLUGIN_NAME, tmpPath, persist);
@@ -13577,7 +14015,7 @@ var KV_PLUGIN = {
13577
14015
  };
13578
14016
  services.push(storageService, objectService);
13579
14017
  for (const namespace of namespaces) {
13580
- await migrateDatabase(log, uniqueKey, persistPath, namespace[1]);
14018
+ await migrateDatabase(log, uniqueKey, persistPath, namespace[1].id);
13581
14019
  }
13582
14020
  }
13583
14021
  if (isWorkersSitesEnabled(options)) {
@@ -13591,21 +14029,21 @@ var KV_PLUGIN = {
13591
14029
  };
13592
14030
 
13593
14031
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/pipelines/pipeline.worker.ts
13594
- var import_fs22 = __toESM(require("fs"));
13595
- var import_path26 = __toESM(require("path"));
13596
- var import_url22 = __toESM(require("url"));
13597
- var contents18;
14032
+ var import_fs25 = __toESM(require("fs"));
14033
+ var import_path29 = __toESM(require("path"));
14034
+ var import_url25 = __toESM(require("url"));
14035
+ var contents21;
13598
14036
  function pipeline_worker_default() {
13599
- if (contents18 !== void 0) return contents18;
13600
- const filePath = import_path26.default.join(__dirname, "workers", "pipelines/pipeline.worker.js");
13601
- contents18 = import_fs22.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url22.default.pathToFileURL(filePath);
13602
- return contents18;
14037
+ if (contents21 !== void 0) return contents21;
14038
+ const filePath = import_path29.default.join(__dirname, "workers", "pipelines/pipeline.worker.js");
14039
+ contents21 = import_fs25.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url25.default.pathToFileURL(filePath);
14040
+ return contents21;
13603
14041
  }
13604
14042
 
13605
14043
  // src/plugins/pipelines/index.ts
13606
- var import_zod19 = require("zod");
13607
- var PipelineOptionsSchema = import_zod19.z.object({
13608
- pipelines: import_zod19.z.union([import_zod19.z.record(import_zod19.z.string()), import_zod19.z.string().array()]).optional()
14044
+ var import_zod23 = require("zod");
14045
+ var PipelineOptionsSchema = import_zod23.z.object({
14046
+ pipelines: import_zod23.z.union([import_zod23.z.record(import_zod23.z.string()), import_zod23.z.string().array()]).optional()
13609
14047
  });
13610
14048
  var PIPELINES_PLUGIN_NAME = "pipelines";
13611
14049
  var SERVICE_PIPELINE_PREFIX = `${PIPELINES_PLUGIN_NAME}:pipeline`;
@@ -13658,32 +14096,38 @@ function bindingEntries(namespaces) {
13658
14096
  }
13659
14097
 
13660
14098
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/queues/broker.worker.ts
13661
- var import_fs23 = __toESM(require("fs"));
13662
- var import_path27 = __toESM(require("path"));
13663
- var import_url23 = __toESM(require("url"));
13664
- var contents19;
14099
+ var import_fs26 = __toESM(require("fs"));
14100
+ var import_path30 = __toESM(require("path"));
14101
+ var import_url26 = __toESM(require("url"));
14102
+ var contents22;
13665
14103
  function broker_worker_default() {
13666
- if (contents19 !== void 0) return contents19;
13667
- const filePath = import_path27.default.join(__dirname, "workers", "queues/broker.worker.js");
13668
- contents19 = import_fs23.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url23.default.pathToFileURL(filePath);
13669
- return contents19;
14104
+ if (contents22 !== void 0) return contents22;
14105
+ const filePath = import_path30.default.join(__dirname, "workers", "queues/broker.worker.js");
14106
+ contents22 = import_fs26.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url26.default.pathToFileURL(filePath);
14107
+ return contents22;
13670
14108
  }
13671
14109
 
13672
14110
  // src/plugins/queues/index.ts
13673
- var import_zod20 = require("zod");
14111
+ var import_zod24 = require("zod");
13674
14112
 
13675
14113
  // src/plugins/queues/errors.ts
13676
14114
  var QueuesError = class extends MiniflareError {
13677
14115
  };
13678
14116
 
13679
14117
  // src/plugins/queues/index.ts
13680
- var QueuesOptionsSchema = import_zod20.z.object({
13681
- queueProducers: import_zod20.z.union([
13682
- import_zod20.z.record(QueueProducerOptionsSchema),
13683
- import_zod20.z.string().array(),
13684
- import_zod20.z.record(import_zod20.z.string())
14118
+ var QueuesOptionsSchema = import_zod24.z.object({
14119
+ queueProducers: import_zod24.z.union([
14120
+ import_zod24.z.record(
14121
+ QueueProducerOptionsSchema.merge(
14122
+ import_zod24.z.object({
14123
+ mixedModeConnectionString: import_zod24.z.custom().optional()
14124
+ })
14125
+ )
14126
+ ),
14127
+ import_zod24.z.string().array(),
14128
+ import_zod24.z.record(import_zod24.z.string())
13685
14129
  ]).optional(),
13686
- queueConsumers: import_zod20.z.union([import_zod20.z.record(QueueConsumerOptionsSchema), import_zod20.z.string().array()]).optional()
14130
+ queueConsumers: import_zod24.z.union([import_zod24.z.record(QueueConsumerOptionsSchema), import_zod24.z.string().array()]).optional()
13687
14131
  });
13688
14132
  var QUEUES_PLUGIN_NAME = "queues";
13689
14133
  var SERVICE_QUEUE_PREFIX = `${QUEUES_PLUGIN_NAME}:queue`;
@@ -13799,23 +14243,32 @@ function bindingKeys(namespaces) {
13799
14243
  var import_promises11 = __toESM(require("fs/promises"));
13800
14244
 
13801
14245
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/r2/bucket.worker.ts
13802
- var import_fs24 = __toESM(require("fs"));
13803
- var import_path28 = __toESM(require("path"));
13804
- var import_url24 = __toESM(require("url"));
13805
- var contents20;
14246
+ var import_fs27 = __toESM(require("fs"));
14247
+ var import_path31 = __toESM(require("path"));
14248
+ var import_url27 = __toESM(require("url"));
14249
+ var contents23;
13806
14250
  function bucket_worker_default() {
13807
- if (contents20 !== void 0) return contents20;
13808
- const filePath = import_path28.default.join(__dirname, "workers", "r2/bucket.worker.js");
13809
- contents20 = import_fs24.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url24.default.pathToFileURL(filePath);
13810
- return contents20;
14251
+ if (contents23 !== void 0) return contents23;
14252
+ const filePath = import_path31.default.join(__dirname, "workers", "r2/bucket.worker.js");
14253
+ contents23 = import_fs27.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url27.default.pathToFileURL(filePath);
14254
+ return contents23;
13811
14255
  }
13812
14256
 
13813
14257
  // src/plugins/r2/index.ts
13814
- var import_zod21 = require("zod");
13815
- var R2OptionsSchema = import_zod21.z.object({
13816
- r2Buckets: import_zod21.z.union([import_zod21.z.record(import_zod21.z.string()), import_zod21.z.string().array()]).optional()
14258
+ var import_zod25 = require("zod");
14259
+ var R2OptionsSchema = import_zod25.z.object({
14260
+ r2Buckets: import_zod25.z.union([
14261
+ import_zod25.z.record(import_zod25.z.string()),
14262
+ import_zod25.z.record(
14263
+ import_zod25.z.object({
14264
+ id: import_zod25.z.string(),
14265
+ mixedModeConnectionString: import_zod25.z.custom().optional()
14266
+ })
14267
+ ),
14268
+ import_zod25.z.string().array()
14269
+ ]).optional()
13817
14270
  });
13818
- var R2SharedOptionsSchema = import_zod21.z.object({
14271
+ var R2SharedOptionsSchema = import_zod25.z.object({
13819
14272
  r2Persist: PersistenceSchema
13820
14273
  });
13821
14274
  var R2_PLUGIN_NAME = "r2";
@@ -13831,7 +14284,7 @@ var R2_PLUGIN = {
13831
14284
  sharedOptions: R2SharedOptionsSchema,
13832
14285
  getBindings(options) {
13833
14286
  const buckets = namespaceEntries(options.r2Buckets);
13834
- return buckets.map(([name, id]) => ({
14287
+ return buckets.map(([name, { id }]) => ({
13835
14288
  name,
13836
14289
  r2Bucket: { name: `${R2_BUCKET_SERVICE_PREFIX}:${id}` }
13837
14290
  }));
@@ -13851,10 +14304,12 @@ var R2_PLUGIN = {
13851
14304
  }) {
13852
14305
  const persist = sharedOptions.r2Persist;
13853
14306
  const buckets = namespaceEntries(options.r2Buckets);
13854
- const services = buckets.map(([_, id]) => ({
13855
- name: `${R2_BUCKET_SERVICE_PREFIX}:${id}`,
13856
- worker: objectEntryWorker(R2_BUCKET_OBJECT, id)
13857
- }));
14307
+ const services = buckets.map(
14308
+ ([name, { id, mixedModeConnectionString }]) => ({
14309
+ name: `${R2_BUCKET_SERVICE_PREFIX}:${id}`,
14310
+ worker: mixedModeConnectionString ? mixedModeClientWorker(mixedModeConnectionString, name) : objectEntryWorker(R2_BUCKET_OBJECT, id)
14311
+ })
14312
+ );
13858
14313
  if (buckets.length > 0) {
13859
14314
  const uniqueKey = `miniflare-${R2_BUCKET_OBJECT_CLASS_NAME}`;
13860
14315
  const persistPath = getPersistPath(R2_PLUGIN_NAME, tmpPath, persist);
@@ -13898,7 +14353,7 @@ var R2_PLUGIN = {
13898
14353
  };
13899
14354
  services.push(storageService, objectService);
13900
14355
  for (const bucket of buckets) {
13901
- await migrateDatabase(log, uniqueKey, persistPath, bucket[1]);
14356
+ await migrateDatabase(log, uniqueKey, persistPath, bucket[1].id);
13902
14357
  }
13903
14358
  }
13904
14359
  return services;
@@ -13909,33 +14364,33 @@ var R2_PLUGIN = {
13909
14364
  };
13910
14365
 
13911
14366
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/ratelimit/ratelimit.worker.ts
13912
- var import_fs25 = __toESM(require("fs"));
13913
- var import_path29 = __toESM(require("path"));
13914
- var import_url25 = __toESM(require("url"));
13915
- var contents21;
14367
+ var import_fs28 = __toESM(require("fs"));
14368
+ var import_path32 = __toESM(require("path"));
14369
+ var import_url28 = __toESM(require("url"));
14370
+ var contents24;
13916
14371
  function ratelimit_worker_default() {
13917
- if (contents21 !== void 0) return contents21;
13918
- const filePath = import_path29.default.join(__dirname, "workers", "ratelimit/ratelimit.worker.js");
13919
- contents21 = import_fs25.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url25.default.pathToFileURL(filePath);
13920
- return contents21;
14372
+ if (contents24 !== void 0) return contents24;
14373
+ const filePath = import_path32.default.join(__dirname, "workers", "ratelimit/ratelimit.worker.js");
14374
+ contents24 = import_fs28.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url28.default.pathToFileURL(filePath);
14375
+ return contents24;
13921
14376
  }
13922
14377
 
13923
14378
  // src/plugins/ratelimit/index.ts
13924
- var import_zod22 = require("zod");
14379
+ var import_zod26 = require("zod");
13925
14380
  var PeriodType = /* @__PURE__ */ ((PeriodType2) => {
13926
14381
  PeriodType2[PeriodType2["TENSECONDS"] = 10] = "TENSECONDS";
13927
14382
  PeriodType2[PeriodType2["MINUTE"] = 60] = "MINUTE";
13928
14383
  return PeriodType2;
13929
14384
  })(PeriodType || {});
13930
- var RatelimitConfigSchema = import_zod22.z.object({
13931
- simple: import_zod22.z.object({
13932
- limit: import_zod22.z.number().gt(0),
14385
+ var RatelimitConfigSchema = import_zod26.z.object({
14386
+ simple: import_zod26.z.object({
14387
+ limit: import_zod26.z.number().gt(0),
13933
14388
  // may relax this to be any number in the future
13934
- period: import_zod22.z.nativeEnum(PeriodType).optional()
14389
+ period: import_zod26.z.nativeEnum(PeriodType).optional()
13935
14390
  })
13936
14391
  });
13937
- var RatelimitOptionsSchema = import_zod22.z.object({
13938
- ratelimits: import_zod22.z.record(RatelimitConfigSchema).optional()
14392
+ var RatelimitOptionsSchema = import_zod26.z.object({
14393
+ ratelimits: import_zod26.z.record(RatelimitConfigSchema).optional()
13939
14394
  });
13940
14395
  var RATELIMIT_PLUGIN_NAME = "ratelimit";
13941
14396
  var SERVICE_RATELIMIT_PREFIX = `${RATELIMIT_PLUGIN_NAME}`;
@@ -13999,48 +14454,36 @@ var RATELIMIT_PLUGIN = {
13999
14454
  }
14000
14455
  };
14001
14456
 
14457
+ // src/plugins/secret-store/index.ts
14458
+ var import_promises12 = __toESM(require("fs/promises"));
14459
+
14002
14460
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/secrets-store/secret.worker.ts
14003
- var import_fs26 = __toESM(require("fs"));
14004
- var import_path30 = __toESM(require("path"));
14005
- var import_url26 = __toESM(require("url"));
14006
- var contents22;
14461
+ var import_fs29 = __toESM(require("fs"));
14462
+ var import_path33 = __toESM(require("path"));
14463
+ var import_url29 = __toESM(require("url"));
14464
+ var contents25;
14007
14465
  function secret_worker_default() {
14008
- if (contents22 !== void 0) return contents22;
14009
- const filePath = import_path30.default.join(__dirname, "workers", "secrets-store/secret.worker.js");
14010
- contents22 = import_fs26.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url26.default.pathToFileURL(filePath);
14011
- return contents22;
14466
+ if (contents25 !== void 0) return contents25;
14467
+ const filePath = import_path33.default.join(__dirname, "workers", "secrets-store/secret.worker.js");
14468
+ contents25 = import_fs29.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url29.default.pathToFileURL(filePath);
14469
+ return contents25;
14012
14470
  }
14013
14471
 
14014
14472
  // src/plugins/secret-store/index.ts
14015
- var import_zod23 = require("zod");
14016
- var SecretsStoreSecretsSchema = import_zod23.z.record(
14017
- import_zod23.z.object({
14018
- store_id: import_zod23.z.string(),
14019
- secret_name: import_zod23.z.string()
14473
+ var import_zod27 = require("zod");
14474
+ var SecretsStoreSecretsSchema = import_zod27.z.record(
14475
+ import_zod27.z.object({
14476
+ store_id: import_zod27.z.string(),
14477
+ secret_name: import_zod27.z.string()
14020
14478
  })
14021
14479
  );
14022
- var SecretsStoreSecretsOptionsSchema = import_zod23.z.object({
14480
+ var SecretsStoreSecretsOptionsSchema = import_zod27.z.object({
14023
14481
  secretsStoreSecrets: SecretsStoreSecretsSchema.optional()
14024
14482
  });
14025
- var SecretsStoreSecretsSharedOptionsSchema = import_zod23.z.object({
14483
+ var SecretsStoreSecretsSharedOptionsSchema = import_zod27.z.object({
14026
14484
  secretsStorePersist: PersistenceSchema
14027
14485
  });
14028
14486
  var SECRET_STORE_PLUGIN_NAME = "secrets-store";
14029
- function getkvNamespacesOptions(secretsStoreSecrets) {
14030
- const storeIds = new Set(
14031
- Object.values(secretsStoreSecrets).map((store) => store.store_id)
14032
- );
14033
- const storeIdKvNamespaceEntries = Array.from(storeIds).map((storeId) => [
14034
- storeId,
14035
- `${SECRET_STORE_PLUGIN_NAME}:${storeId}`
14036
- ]);
14037
- return {
14038
- kvNamespaces: Object.fromEntries(storeIdKvNamespaceEntries)
14039
- };
14040
- }
14041
- function isKvBinding(binding) {
14042
- return "kvNamespace" in binding;
14043
- }
14044
14487
  var SECRET_STORE_PLUGIN = {
14045
14488
  options: SecretsStoreSecretsOptionsSchema,
14046
14489
  sharedOptions: SecretsStoreSecretsSharedOptionsSchema,
@@ -14072,91 +14515,194 @@ var SECRET_STORE_PLUGIN = {
14072
14515
  ])
14073
14516
  );
14074
14517
  },
14075
- async getServices({ options, sharedOptions, ...restOptions }) {
14076
- if (!options.secretsStoreSecrets) {
14518
+ async getServices({ options, sharedOptions, tmpPath, unsafeStickyBlobs }) {
14519
+ const configs = options.secretsStoreSecrets ? Object.values(options.secretsStoreSecrets) : [];
14520
+ if (configs.length === 0) {
14077
14521
  return [];
14078
14522
  }
14079
- const kvServices = await KV_PLUGIN.getServices({
14080
- options: getkvNamespacesOptions(options.secretsStoreSecrets),
14081
- sharedOptions: {
14082
- kvPersist: sharedOptions.secretsStorePersist
14083
- },
14084
- ...restOptions
14523
+ const persistPath = getPersistPath(
14524
+ SECRET_STORE_PLUGIN_NAME,
14525
+ tmpPath,
14526
+ sharedOptions.secretsStorePersist
14527
+ );
14528
+ await import_promises12.default.mkdir(persistPath, { recursive: true });
14529
+ const storageService = {
14530
+ name: `${SECRET_STORE_PLUGIN_NAME}:storage`,
14531
+ disk: { path: persistPath, writable: true }
14532
+ };
14533
+ const objectService = {
14534
+ name: `${SECRET_STORE_PLUGIN_NAME}:ns`,
14535
+ worker: {
14536
+ compatibilityDate: "2023-07-24",
14537
+ compatibilityFlags: ["nodejs_compat", "experimental"],
14538
+ modules: [
14539
+ {
14540
+ name: "namespace.worker.js",
14541
+ esModule: namespace_worker_default()
14542
+ }
14543
+ ],
14544
+ durableObjectNamespaces: [
14545
+ {
14546
+ className: KV_NAMESPACE_OBJECT_CLASS_NAME,
14547
+ uniqueKey: `miniflare-secrets-store-${KV_NAMESPACE_OBJECT_CLASS_NAME}`
14548
+ }
14549
+ ],
14550
+ // Store Durable Object SQL databases in persist path
14551
+ durableObjectStorage: { localDisk: storageService.name },
14552
+ // Bind blob disk directory service to object
14553
+ bindings: [
14554
+ {
14555
+ name: SharedBindings.MAYBE_SERVICE_BLOBS,
14556
+ service: { name: storageService.name }
14557
+ },
14558
+ {
14559
+ name: SharedBindings.MAYBE_SERVICE_LOOPBACK,
14560
+ service: { name: SERVICE_LOOPBACK }
14561
+ },
14562
+ ...getMiniflareObjectBindings(unsafeStickyBlobs)
14563
+ ]
14564
+ }
14565
+ };
14566
+ const services = configs.flatMap((config) => {
14567
+ const kvNamespaceService = {
14568
+ name: `${SECRET_STORE_PLUGIN_NAME}:ns:${config.store_id}`,
14569
+ worker: objectEntryWorker(
14570
+ {
14571
+ serviceName: objectService.name,
14572
+ className: KV_NAMESPACE_OBJECT_CLASS_NAME
14573
+ },
14574
+ config.store_id
14575
+ )
14576
+ };
14577
+ const secretStoreSecretService = {
14578
+ name: `${SECRET_STORE_PLUGIN_NAME}:${config.store_id}:${config.secret_name}`,
14579
+ worker: {
14580
+ compatibilityDate: "2025-01-01",
14581
+ modules: [
14582
+ {
14583
+ name: "secret.worker.js",
14584
+ esModule: secret_worker_default()
14585
+ }
14586
+ ],
14587
+ bindings: [
14588
+ {
14589
+ name: "store",
14590
+ kvNamespace: {
14591
+ name: kvNamespaceService.name
14592
+ }
14593
+ },
14594
+ {
14595
+ name: "secret_name",
14596
+ json: JSON.stringify(config.secret_name)
14597
+ }
14598
+ ]
14599
+ }
14600
+ };
14601
+ return [kvNamespaceService, secretStoreSecretService];
14085
14602
  });
14086
- const kvBindings = await KV_PLUGIN.getBindings(
14087
- getkvNamespacesOptions(options.secretsStoreSecrets),
14088
- restOptions.workerIndex
14603
+ return [...services, storageService, objectService];
14604
+ }
14605
+ };
14606
+
14607
+ // src/plugins/vectorize/index.ts
14608
+ var import_node_assert7 = __toESM(require("node:assert"));
14609
+ var import_zod28 = require("zod");
14610
+ var VectorizeSchema = import_zod28.z.object({
14611
+ index_name: import_zod28.z.string(),
14612
+ mixedModeConnectionString: import_zod28.z.custom()
14613
+ });
14614
+ var VectorizeOptionsSchema = import_zod28.z.object({
14615
+ vectorize: import_zod28.z.record(VectorizeSchema).optional()
14616
+ });
14617
+ var VECTORIZE_PLUGIN_NAME = "vectorize";
14618
+ var VECTORIZE_PLUGIN = {
14619
+ options: VectorizeOptionsSchema,
14620
+ async getBindings(options) {
14621
+ if (!options.vectorize) {
14622
+ return [];
14623
+ }
14624
+ return Object.entries(options.vectorize).map(
14625
+ ([name, { index_name, mixedModeConnectionString }]) => {
14626
+ (0, import_node_assert7.default)(mixedModeConnectionString, "Vectorize only supports Mixed Mode");
14627
+ return {
14628
+ name,
14629
+ wrapped: {
14630
+ moduleName: "cloudflare-internal:vectorize-api",
14631
+ innerBindings: [
14632
+ {
14633
+ name: "fetcher",
14634
+ service: { name: `${VECTORIZE_PLUGIN_NAME}:${name}` }
14635
+ },
14636
+ {
14637
+ name: "indexId",
14638
+ text: index_name
14639
+ },
14640
+ {
14641
+ name: "indexVersion",
14642
+ text: "v2"
14643
+ },
14644
+ {
14645
+ name: "useNdJson",
14646
+ json: true
14647
+ }
14648
+ ]
14649
+ }
14650
+ };
14651
+ }
14089
14652
  );
14090
- if (!kvBindings || !kvBindings.every(isKvBinding)) {
14091
- throw new Error(
14092
- "Expected KV plugin to return bindings with kvNamespace defined"
14093
- );
14653
+ },
14654
+ getNodeBindings(options) {
14655
+ if (!options.vectorize) {
14656
+ return {};
14094
14657
  }
14095
- if (!Array.isArray(kvServices)) {
14096
- throw new Error("Expected KV plugin to return an array of services");
14658
+ return Object.fromEntries(
14659
+ Object.keys(options.vectorize).map((name) => [
14660
+ name,
14661
+ new ProxyNodeBinding()
14662
+ ])
14663
+ );
14664
+ },
14665
+ async getServices({ options }) {
14666
+ if (!options.vectorize) {
14667
+ return [];
14097
14668
  }
14098
- return [
14099
- ...kvServices,
14100
- ...Object.entries(options.secretsStoreSecrets).map(
14101
- ([_, config]) => {
14102
- return {
14103
- name: `${SECRET_STORE_PLUGIN_NAME}:${config.store_id}:${config.secret_name}`,
14104
- worker: {
14105
- compatibilityDate: "2025-01-01",
14106
- modules: [
14107
- {
14108
- name: "secret.worker.js",
14109
- esModule: secret_worker_default()
14110
- }
14111
- ],
14112
- bindings: [
14113
- {
14114
- name: "store",
14115
- kvNamespace: kvBindings.find(
14116
- // Look up the corresponding KV namespace for the store id
14117
- (binding) => binding.name === config.store_id
14118
- )?.kvNamespace
14119
- },
14120
- {
14121
- name: "secret_name",
14122
- json: JSON.stringify(config.secret_name)
14123
- }
14124
- ]
14125
- }
14126
- };
14127
- }
14128
- )
14129
- ];
14669
+ return Object.entries(options.vectorize).map(
14670
+ ([name, { mixedModeConnectionString }]) => ({
14671
+ name: `${VECTORIZE_PLUGIN_NAME}:${name}`,
14672
+ worker: mixedModeClientWorker(mixedModeConnectionString, name)
14673
+ })
14674
+ );
14130
14675
  }
14131
14676
  };
14132
14677
 
14133
14678
  // src/plugins/workflows/index.ts
14134
- var import_promises12 = __toESM(require("fs/promises"));
14679
+ var import_promises13 = __toESM(require("fs/promises"));
14135
14680
 
14136
14681
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/workflows/binding.worker.ts
14137
- var import_fs27 = __toESM(require("fs"));
14138
- var import_path31 = __toESM(require("path"));
14139
- var import_url27 = __toESM(require("url"));
14140
- var contents23;
14682
+ var import_fs30 = __toESM(require("fs"));
14683
+ var import_path34 = __toESM(require("path"));
14684
+ var import_url30 = __toESM(require("url"));
14685
+ var contents26;
14141
14686
  function binding_worker_default() {
14142
- if (contents23 !== void 0) return contents23;
14143
- const filePath = import_path31.default.join(__dirname, "workers", "workflows/binding.worker.js");
14144
- contents23 = import_fs27.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url27.default.pathToFileURL(filePath);
14145
- return contents23;
14687
+ if (contents26 !== void 0) return contents26;
14688
+ const filePath = import_path34.default.join(__dirname, "workers", "workflows/binding.worker.js");
14689
+ contents26 = import_fs30.default.readFileSync(filePath, "utf8") + "//# sourceURL=" + import_url30.default.pathToFileURL(filePath);
14690
+ return contents26;
14146
14691
  }
14147
14692
 
14148
14693
  // src/plugins/workflows/index.ts
14149
- var import_zod24 = require("zod");
14150
- var WorkflowsOptionsSchema = import_zod24.z.object({
14151
- workflows: import_zod24.z.record(
14152
- import_zod24.z.object({
14153
- name: import_zod24.z.string(),
14154
- className: import_zod24.z.string(),
14155
- scriptName: import_zod24.z.string().optional()
14694
+ var import_zod29 = require("zod");
14695
+ var WorkflowsOptionsSchema = import_zod29.z.object({
14696
+ workflows: import_zod29.z.record(
14697
+ import_zod29.z.object({
14698
+ name: import_zod29.z.string(),
14699
+ className: import_zod29.z.string(),
14700
+ scriptName: import_zod29.z.string().optional(),
14701
+ mixedModeConnectionString: import_zod29.z.custom().optional()
14156
14702
  })
14157
14703
  ).optional()
14158
14704
  });
14159
- var WorkflowsSharedOptionsSchema = import_zod24.z.object({
14705
+ var WorkflowsSharedOptionsSchema = import_zod29.z.object({
14160
14706
  workflowsPersist: PersistenceSchema
14161
14707
  });
14162
14708
  var WORKFLOWS_PLUGIN_NAME = "workflows";
@@ -14189,7 +14735,7 @@ var WORKFLOWS_PLUGIN = {
14189
14735
  tmpPath,
14190
14736
  sharedOptions.workflowsPersist
14191
14737
  );
14192
- await import_promises12.default.mkdir(persistPath, { recursive: true });
14738
+ await import_promises13.default.mkdir(persistPath, { recursive: true });
14193
14739
  const storageServices = Object.entries(
14194
14740
  options.workflows ?? {}
14195
14741
  ).map(([_, workflow]) => ({
@@ -14264,7 +14810,12 @@ var PLUGINS = {
14264
14810
  [PIPELINES_PLUGIN_NAME]: PIPELINE_PLUGIN,
14265
14811
  [SECRET_STORE_PLUGIN_NAME]: SECRET_STORE_PLUGIN,
14266
14812
  [EMAIL_PLUGIN_NAME]: EMAIL_PLUGIN,
14267
- [ANALYTICS_ENGINE_PLUGIN_NAME]: ANALYTICS_ENGINE_PLUGIN
14813
+ [ANALYTICS_ENGINE_PLUGIN_NAME]: ANALYTICS_ENGINE_PLUGIN,
14814
+ [AI_PLUGIN_NAME]: AI_PLUGIN,
14815
+ [BROWSER_RENDERING_PLUGIN_NAME]: BROWSER_RENDERING_PLUGIN,
14816
+ [DISPATCH_NAMESPACE_PLUGIN_NAME]: DISPATCH_NAMESPACE_PLUGIN,
14817
+ [IMAGES_PLUGIN_NAME]: IMAGES_PLUGIN,
14818
+ [VECTORIZE_PLUGIN_NAME]: VECTORIZE_PLUGIN
14268
14819
  };
14269
14820
  var PLUGIN_ENTRIES = Object.entries(PLUGINS);
14270
14821
 
@@ -14389,10 +14940,10 @@ async function getPorts(options) {
14389
14940
  var import_ws4 = __toESM(require("ws"));
14390
14941
 
14391
14942
  // package.json
14392
- var version = "0.0.0-e55f489db";
14943
+ var version = "0.0.0-e5ae13ade";
14393
14944
 
14394
14945
  // src/plugins/core/inspector-proxy/inspector-proxy.ts
14395
- var import_node_assert4 = __toESM(require("node:assert"));
14946
+ var import_node_assert8 = __toESM(require("node:assert"));
14396
14947
  var import_ws3 = __toESM(require("ws"));
14397
14948
 
14398
14949
  // src/plugins/core/inspector-proxy/devtools.ts
@@ -14427,7 +14978,7 @@ var InspectorProxy = class {
14427
14978
  }
14428
14979
  this.#devtoolsWs = devtoolsWs;
14429
14980
  this.#devtoolsHaveFileSystemAccess = devtoolsHaveFileSystemAccess;
14430
- (0, import_node_assert4.default)(this.#devtoolsWs?.readyState === import_ws3.default.OPEN);
14981
+ (0, import_node_assert8.default)(this.#devtoolsWs?.readyState === import_ws3.default.OPEN);
14431
14982
  this.#devtoolsWs.on("error", console.error);
14432
14983
  this.#devtoolsWs.once("close", () => {
14433
14984
  if (this.#runtimeWs?.OPEN) {
@@ -14440,7 +14991,7 @@ var InspectorProxy = class {
14440
14991
  });
14441
14992
  this.#devtoolsWs.on("message", (data) => {
14442
14993
  const message = JSON.parse(data.toString());
14443
- (0, import_node_assert4.default)(this.#runtimeWs?.OPEN);
14994
+ (0, import_node_assert8.default)(this.#runtimeWs?.OPEN);
14444
14995
  this.#sendMessageToRuntime(message);
14445
14996
  });
14446
14997
  }
@@ -14450,7 +15001,7 @@ var InspectorProxy = class {
14450
15001
  }
14451
15002
  #runtimeKeepAliveInterval;
14452
15003
  #handleRuntimeWebSocketOpen() {
14453
- (0, import_node_assert4.default)(this.#runtimeWs?.OPEN);
15004
+ (0, import_node_assert8.default)(this.#runtimeWs?.OPEN);
14454
15005
  this.#runtimeWs.on("message", (data) => {
14455
15006
  const message = JSON.parse(data.toString());
14456
15007
  if (!this.#devtoolsWs) {
@@ -14474,9 +15025,9 @@ var InspectorProxy = class {
14474
15025
  #handleRuntimeScriptParsed(message) {
14475
15026
  if (!this.#devtoolsHaveFileSystemAccess && message.params.sourceMapURL !== void 0 && // Don't try to find a sourcemap for e.g. node-internal: scripts
14476
15027
  message.params.url.startsWith("file:")) {
14477
- const url24 = new URL(message.params.sourceMapURL, message.params.url);
14478
- if (url24.protocol === "file:") {
14479
- message.params.sourceMapURL = url24.href.replace(
15028
+ const url27 = new URL(message.params.sourceMapURL, message.params.url);
15029
+ if (url27.protocol === "file:") {
15030
+ message.params.sourceMapURL = url27.href.replace(
14480
15031
  "file:",
14481
15032
  "wrangler-file:"
14482
15033
  );
@@ -14485,7 +15036,7 @@ var InspectorProxy = class {
14485
15036
  return this.#sendMessageToDevtools(message);
14486
15037
  }
14487
15038
  #sendMessageToDevtools(message) {
14488
- (0, import_node_assert4.default)(this.#devtoolsWs);
15039
+ (0, import_node_assert8.default)(this.#devtoolsWs);
14489
15040
  if (!this.#devtoolsWs.OPEN) {
14490
15041
  this.#devtoolsWs.once(
14491
15042
  "open",
@@ -14496,7 +15047,7 @@ var InspectorProxy = class {
14496
15047
  this.#devtoolsWs.send(JSON.stringify(message));
14497
15048
  }
14498
15049
  #sendMessageToRuntime(message) {
14499
- (0, import_node_assert4.default)(this.#runtimeWs?.OPEN);
15050
+ (0, import_node_assert8.default)(this.#runtimeWs?.OPEN);
14500
15051
  this.#runtimeWs.send(JSON.stringify(message));
14501
15052
  }
14502
15053
  async dispose() {
@@ -14565,7 +15116,7 @@ var InspectorProxyController = class {
14565
15116
  return;
14566
15117
  }
14567
15118
  const proxy = this.#proxies.find(
14568
- ({ path: path34 }) => upgradeRequest.url === path34
15119
+ ({ path: path37 }) => upgradeRequest.url === path37
14569
15120
  );
14570
15121
  if (!proxy) {
14571
15122
  this.log.warn(
@@ -14618,8 +15169,8 @@ var InspectorProxyController = class {
14618
15169
  return hasFileSystemAccess;
14619
15170
  }
14620
15171
  #inspectorId = import_node_crypto2.default.randomUUID();
14621
- async #handleDevToolsJsonRequest(host, path34) {
14622
- if (path34 === "/json/version") {
15172
+ async #handleDevToolsJsonRequest(host, path37) {
15173
+ if (path37 === "/json/version") {
14623
15174
  return {
14624
15175
  Browser: `miniflare/v${version}`,
14625
15176
  // TODO: (someday): The DevTools protocol should match that of workerd.
@@ -14627,7 +15178,7 @@ var InspectorProxyController = class {
14627
15178
  "Protocol-Version": "1.3"
14628
15179
  };
14629
15180
  }
14630
- if (path34 === "/json" || path34 === "/json/list") {
15181
+ if (path37 === "/json" || path37 === "/json/list") {
14631
15182
  return this.#proxies.map(({ workerName }) => {
14632
15183
  const localHost = `${host}/${workerName}`;
14633
15184
  const devtoolsFrontendUrl = `https://devtools.devprod.cloudflare.dev/js_app?theme=systemPreferred&debugger=true&ws=${localHost}`;
@@ -14702,6 +15253,186 @@ var ALLOWED_ORIGIN_HOSTNAMES = [
14702
15253
  "localhost"
14703
15254
  ];
14704
15255
 
15256
+ // src/plugins/images/fetcher.ts
15257
+ var import_buffer2 = require("buffer");
15258
+ function validateTransforms(inputTransforms) {
15259
+ if (!Array.isArray(inputTransforms)) {
15260
+ return null;
15261
+ }
15262
+ for (const transform of inputTransforms) {
15263
+ for (const key of ["imageIndex", "rotate", "width", "height"]) {
15264
+ if (transform[key] !== void 0 && typeof transform[key] != "number") {
15265
+ return null;
15266
+ }
15267
+ }
15268
+ }
15269
+ return inputTransforms;
15270
+ }
15271
+ async function imagesLocalFetcher(request) {
15272
+ let sharp;
15273
+ try {
15274
+ const { default: importedSharp } = await import("sharp");
15275
+ sharp = importedSharp;
15276
+ } catch {
15277
+ return errorResponse(
15278
+ 503,
15279
+ 9523,
15280
+ "The Sharp library is not available, check your version of Node is compatible"
15281
+ );
15282
+ }
15283
+ const data = await request.formData();
15284
+ const body = data.get("image");
15285
+ if (!body || !(body instanceof import_buffer2.File)) {
15286
+ return errorResponse(
15287
+ 400,
15288
+ 9523,
15289
+ `ERROR: Internal Images binding error: expected image in request, got ${body}`
15290
+ );
15291
+ }
15292
+ const transformer = sharp(await body.arrayBuffer(), {});
15293
+ const url27 = new URL(request.url);
15294
+ if (url27.pathname == "/info") {
15295
+ return runInfo(transformer);
15296
+ } else {
15297
+ const badTransformsResponse = errorResponse(
15298
+ 400,
15299
+ 9523,
15300
+ "ERROR: Internal Images binding error: Expected JSON array of valid transforms in transforms field"
15301
+ );
15302
+ try {
15303
+ const transformsJson = data.get("transforms");
15304
+ if (typeof transformsJson !== "string") {
15305
+ return badTransformsResponse;
15306
+ }
15307
+ const transforms = validateTransforms(JSON.parse(transformsJson));
15308
+ if (transforms === null) {
15309
+ return badTransformsResponse;
15310
+ }
15311
+ const outputFormat = data.get("output_format");
15312
+ if (outputFormat != null && typeof outputFormat !== "string") {
15313
+ return errorResponse(
15314
+ 400,
15315
+ 9523,
15316
+ "ERROR: Internal Images binding error: Expected output format to be a string if provided"
15317
+ );
15318
+ }
15319
+ return runTransform(transformer, transforms, outputFormat);
15320
+ } catch (e) {
15321
+ return badTransformsResponse;
15322
+ }
15323
+ }
15324
+ }
15325
+ async function runInfo(transformer) {
15326
+ const metadata = await transformer.metadata();
15327
+ let mime = null;
15328
+ switch (metadata.format) {
15329
+ case "jpeg":
15330
+ mime = "image/jpeg";
15331
+ break;
15332
+ case "svg":
15333
+ mime = "image/svg+xml";
15334
+ break;
15335
+ case "png":
15336
+ mime = "image/png";
15337
+ break;
15338
+ case "webp":
15339
+ mime = "image/webp";
15340
+ break;
15341
+ case "gif":
15342
+ mime = "image/gif";
15343
+ break;
15344
+ case "avif":
15345
+ mime = "image/avif";
15346
+ break;
15347
+ default:
15348
+ return errorResponse(
15349
+ 415,
15350
+ 9520,
15351
+ `ERROR: Unsupported image type ${metadata.format}, expected one of: JPEG, SVG, PNG, WebP, GIF or AVIF`
15352
+ );
15353
+ }
15354
+ let resp;
15355
+ if (mime == "image/svg+xml") {
15356
+ resp = {
15357
+ format: mime
15358
+ };
15359
+ } else {
15360
+ if (!metadata.size || !metadata.width || !metadata.height) {
15361
+ return errorResponse(
15362
+ 500,
15363
+ 9523,
15364
+ "ERROR: Internal Images binding error: Expected size, width and height for bitmap input"
15365
+ );
15366
+ }
15367
+ resp = {
15368
+ format: mime,
15369
+ fileSize: metadata.size,
15370
+ width: metadata.width,
15371
+ height: metadata.height
15372
+ };
15373
+ }
15374
+ return Response.json(resp);
15375
+ }
15376
+ async function runTransform(transformer, transforms, outputFormat) {
15377
+ for (const transform of transforms) {
15378
+ if (transform.imageIndex !== void 0 && transform.imageIndex !== 0) {
15379
+ continue;
15380
+ }
15381
+ if (transform.rotate !== void 0) {
15382
+ transformer.rotate(transform.rotate);
15383
+ }
15384
+ if (transform.width !== void 0 || transform.height !== void 0) {
15385
+ transformer.resize(transform.width || null, transform.height || null, {
15386
+ fit: "contain"
15387
+ });
15388
+ }
15389
+ }
15390
+ switch (outputFormat) {
15391
+ case "image/avif":
15392
+ transformer.avif();
15393
+ break;
15394
+ case "image/gif":
15395
+ return errorResponse(
15396
+ 415,
15397
+ 9520,
15398
+ "ERROR: GIF output is not supported in local mode"
15399
+ );
15400
+ case "image/jpeg":
15401
+ transformer.jpeg();
15402
+ break;
15403
+ case "image/png":
15404
+ transformer.png();
15405
+ break;
15406
+ case "image/webp":
15407
+ transformer.webp();
15408
+ break;
15409
+ case "rgb":
15410
+ case "rgba":
15411
+ return errorResponse(
15412
+ 415,
15413
+ 9520,
15414
+ "ERROR: RGB/RGBA output is not supported in local mode"
15415
+ );
15416
+ default:
15417
+ outputFormat = "image/jpeg";
15418
+ break;
15419
+ }
15420
+ return new Response(transformer, {
15421
+ headers: {
15422
+ "content-type": outputFormat
15423
+ }
15424
+ });
15425
+ }
15426
+ function errorResponse(status, code, message) {
15427
+ return new Response(`ERROR ${code}: ${message}`, {
15428
+ status,
15429
+ headers: {
15430
+ "content-type": "text/plain",
15431
+ "cf-images-binding": `err=${code}`
15432
+ }
15433
+ });
15434
+ }
15435
+
14705
15436
  // src/shared/mime-types.ts
14706
15437
  var compressedByCloudflareFL = /* @__PURE__ */ new Set([
14707
15438
  // list copied from https://developers.cloudflare.com/speed/optimization/content/brotli/content-compression/#:~:text=If%20supported%20by%20visitors%E2%80%99%20web%20browsers%2C%20Cloudflare%20will%20return%20Gzip%20or%20Brotli%2Dencoded%20responses%20for%20the%20following%20content%20types%3A
@@ -14763,7 +15494,7 @@ function isCompressedByCloudflareFL(contentTypeHeader) {
14763
15494
  var ADMIN_API = "SecretsStoreSecret::admin_api";
14764
15495
 
14765
15496
  // src/zod-format.ts
14766
- var import_assert11 = __toESM(require("assert"));
15497
+ var import_assert12 = __toESM(require("assert"));
14767
15498
  var import_util4 = __toESM(require("util"));
14768
15499
  var kMessages = Symbol("kMessages");
14769
15500
  var kActual = Symbol("kActual");
@@ -14800,8 +15531,8 @@ function hasMultipleDistinctMessages(issues, atDepth) {
14800
15531
  }
14801
15532
  return false;
14802
15533
  }
14803
- function annotate(groupCounts, annotated, input, issue, path34, groupId) {
14804
- if (path34.length === 0) {
15534
+ function annotate(groupCounts, annotated, input, issue, path37, groupId) {
15535
+ if (path37.length === 0) {
14805
15536
  if (issue.code === "invalid_union") {
14806
15537
  const unionIssues = issue.unionErrors.flatMap(({ issues }) => issues);
14807
15538
  let newGroupId;
@@ -14838,7 +15569,7 @@ function annotate(groupCounts, annotated, input, issue, path34, groupId) {
14838
15569
  }
14839
15570
  if (groupId !== void 0) {
14840
15571
  const current = groupCounts.get(groupId);
14841
- (0, import_assert11.default)(current !== void 0);
15572
+ (0, import_assert12.default)(current !== void 0);
14842
15573
  groupCounts.set(groupId, current + 1);
14843
15574
  }
14844
15575
  return {
@@ -14847,8 +15578,8 @@ function annotate(groupCounts, annotated, input, issue, path34, groupId) {
14847
15578
  [kGroupId]: groupId
14848
15579
  };
14849
15580
  }
14850
- const [head, ...tail] = path34;
14851
- (0, import_assert11.default)(isRecord(input), "Expected object/array input for nested issue");
15581
+ const [head, ...tail] = path37;
15582
+ (0, import_assert12.default)(isRecord(input), "Expected object/array input for nested issue");
14852
15583
  if (annotated === void 0) {
14853
15584
  if (Array.isArray(input)) {
14854
15585
  annotated = new Array(input.length);
@@ -14857,7 +15588,7 @@ function annotate(groupCounts, annotated, input, issue, path34, groupId) {
14857
15588
  annotated = Object.fromEntries(entries);
14858
15589
  }
14859
15590
  }
14860
- (0, import_assert11.default)(isRecord(annotated), "Expected object/array for nested issue");
15591
+ (0, import_assert12.default)(isRecord(annotated), "Expected object/array for nested issue");
14861
15592
  annotated[head] = annotate(
14862
15593
  groupCounts,
14863
15594
  annotated[head],
@@ -14882,7 +15613,7 @@ function print(inspectOptions, groupCounts, annotated, indent = "", extras) {
14882
15613
  messageColour = groupColours[annotated[kGroupId] % groupColours.length];
14883
15614
  messagePrefix += annotated[kGroupId] + 1;
14884
15615
  const remaining = groupCounts.get(annotated[kGroupId]);
14885
- (0, import_assert11.default)(remaining !== void 0);
15616
+ (0, import_assert12.default)(remaining !== void 0);
14886
15617
  if (remaining > 1) groupOr = " *or*";
14887
15618
  groupCounts.set(annotated[kGroupId], remaining - 1);
14888
15619
  }
@@ -15026,7 +15757,7 @@ function maybeGetLocallyAccessibleHost(h) {
15026
15757
  }
15027
15758
  function getServerPort(server) {
15028
15759
  const address = server.address();
15029
- (0, import_assert12.default)(address !== null && typeof address === "object");
15760
+ (0, import_assert13.default)(address !== null && typeof address === "object");
15030
15761
  return address.port;
15031
15762
  }
15032
15763
  function hasMultipleWorkers(opts) {
@@ -15052,7 +15783,7 @@ function validateOptions(opts) {
15052
15783
  );
15053
15784
  const sharedRootPath = multipleWorkers ? getRootPath(sharedOpts) : "";
15054
15785
  const workerRootPaths = workerOpts.map(
15055
- (opts2) => import_path32.default.resolve(sharedRootPath, getRootPath(opts2))
15786
+ (opts2) => import_path35.default.resolve(sharedRootPath, getRootPath(opts2))
15056
15787
  );
15057
15788
  try {
15058
15789
  for (const [key, plugin] of PLUGIN_ENTRIES) {
@@ -15068,7 +15799,7 @@ function validateOptions(opts) {
15068
15799
  }
15069
15800
  }
15070
15801
  } catch (e) {
15071
- if (e instanceof import_zod26.z.ZodError) {
15802
+ if (e instanceof import_zod31.z.ZodError) {
15072
15803
  let formatted;
15073
15804
  try {
15074
15805
  formatted = formatZodError(e, opts);
@@ -15283,7 +16014,7 @@ function getWorkerRoutes(allWorkerOpts, wrappedBindingNames) {
15283
16014
  for (const workerOpts of allWorkerOpts) {
15284
16015
  const name = workerOpts.core.name ?? "";
15285
16016
  if (wrappedBindingNames.has(name)) continue;
15286
- (0, import_assert12.default)(!allRoutes.has(name));
16017
+ (0, import_assert13.default)(!allRoutes.has(name));
15287
16018
  allRoutes.set(name, workerOpts.core.routes ?? []);
15288
16019
  }
15289
16020
  return allRoutes;
@@ -15300,7 +16031,7 @@ function isNativeTargetBinding(binding) {
15300
16031
  return !("json" in binding || "wasmModule" in binding || "text" in binding || "data" in binding);
15301
16032
  }
15302
16033
  function buildProxyBinding(plugin, worker, binding) {
15303
- (0, import_assert12.default)(binding.name !== void 0);
16034
+ (0, import_assert13.default)(binding.name !== void 0);
15304
16035
  const name = getProxyBindingName(plugin, worker, binding.name);
15305
16036
  const proxyBinding = { ...binding, name };
15306
16037
  if ("durableObjectNamespace" in proxyBinding && proxyBinding.durableObjectNamespace !== void 0) {
@@ -15310,11 +16041,11 @@ function buildProxyBinding(plugin, worker, binding) {
15310
16041
  }
15311
16042
  function getInternalDurableObjectProxyBindings(plugin, service) {
15312
16043
  if (!("worker" in service)) return;
15313
- (0, import_assert12.default)(service.worker !== void 0);
16044
+ (0, import_assert13.default)(service.worker !== void 0);
15314
16045
  const serviceName = service.name;
15315
- (0, import_assert12.default)(serviceName !== void 0);
16046
+ (0, import_assert13.default)(serviceName !== void 0);
15316
16047
  return service.worker.durableObjectNamespaces?.map(({ className }) => {
15317
- (0, import_assert12.default)(className !== void 0);
16048
+ (0, import_assert13.default)(className !== void 0);
15318
16049
  return {
15319
16050
  name: getProxyBindingName(`${plugin}-internal`, serviceName, className),
15320
16051
  durableObjectNamespace: { serviceName, className }
@@ -15501,7 +16232,7 @@ var Miniflare2 = class _Miniflare {
15501
16232
  }
15502
16233
  }
15503
16234
  });
15504
- this.#tmpPath = import_path32.default.join(
16235
+ this.#tmpPath = import_path35.default.join(
15505
16236
  import_os2.default.tmpdir(),
15506
16237
  `miniflare-${import_crypto3.default.randomBytes(16).toString("hex")}`
15507
16238
  );
@@ -15509,7 +16240,7 @@ var Miniflare2 = class _Miniflare {
15509
16240
  this.#removeExitHook = (0, import_exit_hook.default)(() => {
15510
16241
  void this.#runtime?.dispose();
15511
16242
  try {
15512
- import_fs28.default.rmSync(this.#tmpPath, { force: true, recursive: true });
16243
+ import_fs31.default.rmSync(this.#tmpPath, { force: true, recursive: true });
15513
16244
  } catch (e) {
15514
16245
  this.#log.debug(`Unable to remove temporary directory: ${String(e)}`);
15515
16246
  }
@@ -15530,25 +16261,29 @@ var Miniflare2 = class _Miniflare {
15530
16261
  }
15531
16262
  }
15532
16263
  async #handleLoopbackCustomService(request, customService) {
15533
- const slashIndex = customService.indexOf("/");
15534
- const workerIndex = parseInt(customService.substring(0, slashIndex));
15535
- const serviceKind = customService[slashIndex + 1];
15536
- const serviceName = customService.substring(slashIndex + 2);
15537
16264
  let service;
15538
- if (serviceKind === "#" /* UNKNOWN */) {
15539
- service = this.#workerOpts[workerIndex]?.core.serviceBindings?.[serviceName];
15540
- } else if (serviceName === CUSTOM_SERVICE_KNOWN_OUTBOUND) {
15541
- service = this.#workerOpts[workerIndex]?.core.outboundService;
16265
+ if (customService === CoreBindings.IMAGES_SERVICE) {
16266
+ service = imagesLocalFetcher;
16267
+ } else {
16268
+ const slashIndex = customService.indexOf("/");
16269
+ const workerIndex = parseInt(customService.substring(0, slashIndex));
16270
+ const serviceKind = customService[slashIndex + 1];
16271
+ const serviceName = customService.substring(slashIndex + 2);
16272
+ if (serviceKind === "#" /* UNKNOWN */) {
16273
+ service = this.#workerOpts[workerIndex]?.core.serviceBindings?.[serviceName];
16274
+ } else if (serviceName === CUSTOM_SERVICE_KNOWN_OUTBOUND) {
16275
+ service = this.#workerOpts[workerIndex]?.core.outboundService;
16276
+ }
15542
16277
  }
15543
- (0, import_assert12.default)(typeof service === "function");
16278
+ (0, import_assert13.default)(typeof service === "function");
15544
16279
  try {
15545
16280
  let response = await service(request, this);
15546
- if (!(response instanceof Response)) {
15547
- response = new Response(response.body, response);
16281
+ if (!(response instanceof Response2)) {
16282
+ response = new Response2(response.body, response);
15548
16283
  }
15549
- return import_zod26.z.instanceof(Response).parse(response);
16284
+ return import_zod31.z.instanceof(Response2).parse(response);
15550
16285
  } catch (e) {
15551
- return new Response(e?.stack ?? e, { status: 500 });
16286
+ return new Response2(e?.stack ?? e, { status: 500 });
15552
16287
  }
15553
16288
  }
15554
16289
  get #workerSrcOpts() {
@@ -15566,14 +16301,14 @@ var Miniflare2 = class _Miniflare {
15566
16301
  }
15567
16302
  const cfBlob = headers.get(CoreHeaders.CF_BLOB);
15568
16303
  headers.delete(CoreHeaders.CF_BLOB);
15569
- (0, import_assert12.default)(!Array.isArray(cfBlob));
16304
+ (0, import_assert13.default)(!Array.isArray(cfBlob));
15570
16305
  const cf = cfBlob ? JSON.parse(cfBlob) : void 0;
15571
16306
  const originalUrl = headers.get(CoreHeaders.ORIGINAL_URL);
15572
- const url24 = new URL(originalUrl ?? req.url ?? "", "http://localhost");
16307
+ const url27 = new URL(originalUrl ?? req.url ?? "", "http://localhost");
15573
16308
  headers.delete(CoreHeaders.ORIGINAL_URL);
15574
16309
  const noBody = req.method === "GET" || req.method === "HEAD";
15575
16310
  const body = noBody ? void 0 : safeReadableStreamFrom(req);
15576
- const request = new Request(url24, {
16311
+ const request = new Request(url27, {
15577
16312
  method: req.method,
15578
16313
  headers,
15579
16314
  body,
@@ -15594,15 +16329,15 @@ var Miniflare2 = class _Miniflare {
15594
16329
  request,
15595
16330
  this
15596
16331
  );
15597
- } else if (url24.pathname === "/core/error") {
16332
+ } else if (url27.pathname === "/core/error") {
15598
16333
  response = await handlePrettyErrorRequest(
15599
16334
  this.#log,
15600
16335
  this.#workerSrcOpts,
15601
16336
  request
15602
16337
  );
15603
- } else if (url24.pathname === "/core/log") {
16338
+ } else if (url27.pathname === "/core/log") {
15604
16339
  const level = parseInt(request.headers.get(SharedHeaders.LOG_LEVEL));
15605
- (0, import_assert12.default)(
16340
+ (0, import_assert13.default)(
15606
16341
  0 /* NONE */ <= level && level <= 5 /* VERBOSE */,
15607
16342
  `Expected ${SharedHeaders.LOG_LEVEL} header to be log level, got ${level}`
15608
16343
  );
@@ -15610,18 +16345,18 @@ var Miniflare2 = class _Miniflare {
15610
16345
  let message = await request.text();
15611
16346
  if (!$.enabled) message = stripAnsi(message);
15612
16347
  this.#log.logWithLevel(logLevel, message);
15613
- response = new Response(null, { status: 204 });
15614
- } else if (url24.pathname === "/core/store-temp-file") {
15615
- const prefix = url24.searchParams.get("prefix");
16348
+ response = new Response2(null, { status: 204 });
16349
+ } else if (url27.pathname === "/core/store-temp-file") {
16350
+ const prefix = url27.searchParams.get("prefix");
15616
16351
  const folder = prefix ? `files/${prefix}` : "files";
15617
- await (0, import_promises13.mkdir)(import_path32.default.join(this.#tmpPath, folder), { recursive: true });
15618
- const filePath = import_path32.default.join(
16352
+ await (0, import_promises14.mkdir)(import_path35.default.join(this.#tmpPath, folder), { recursive: true });
16353
+ const filePath = import_path35.default.join(
15619
16354
  this.#tmpPath,
15620
16355
  folder,
15621
- `${import_crypto3.default.randomUUID()}.${url24.searchParams.get("extension") ?? "txt"}`
16356
+ `${import_crypto3.default.randomUUID()}.${url27.searchParams.get("extension") ?? "txt"}`
15622
16357
  );
15623
- await (0, import_promises13.writeFile)(filePath, await request.text());
15624
- response = new Response(filePath, { status: 200 });
16358
+ await (0, import_promises14.writeFile)(filePath, await request.text());
16359
+ response = new Response2(filePath, { status: 200 });
15625
16360
  }
15626
16361
  } catch (e) {
15627
16362
  this.#log.error(e);
@@ -15658,7 +16393,7 @@ var Miniflare2 = class _Miniflare {
15658
16393
  return;
15659
16394
  }
15660
16395
  const res = new import_http6.default.ServerResponse(req);
15661
- (0, import_assert12.default)(socket instanceof import_net.default.Socket);
16396
+ (0, import_assert13.default)(socket instanceof import_net.default.Socket);
15662
16397
  res.assignSocket(socket);
15663
16398
  if (!response || response.ok) {
15664
16399
  res.writeHead(500);
@@ -15698,7 +16433,7 @@ var Miniflare2 = class _Miniflare {
15698
16433
  }
15699
16434
  #stopLoopbackServer() {
15700
16435
  return new Promise((resolve2, reject) => {
15701
- (0, import_assert12.default)(this.#loopbackServer !== void 0);
16436
+ (0, import_assert13.default)(this.#loopbackServer !== void 0);
15702
16437
  this.#loopbackServer.stop((err) => err ? reject(err) : resolve2());
15703
16438
  });
15704
16439
  }
@@ -15772,7 +16507,7 @@ var Miniflare2 = class _Miniflare {
15772
16507
  if (pluginBindings !== void 0) {
15773
16508
  for (const binding of pluginBindings) {
15774
16509
  if (key === "kv" && binding.name === SiteBindings.JSON_SITE_MANIFEST && isModulesWorker) {
15775
- (0, import_assert12.default)("json" in binding && binding.json !== void 0);
16510
+ (0, import_assert13.default)("json" in binding && binding.json !== void 0);
15776
16511
  additionalModules.push({
15777
16512
  name: SiteBindings.JSON_SITE_MANIFEST,
15778
16513
  text: binding.json
@@ -15803,7 +16538,7 @@ var Miniflare2 = class _Miniflare {
15803
16538
  (worker) => worker.core.name === targetWorkerName && worker.assets.assets
15804
16539
  );
15805
16540
  if (maybeAssetTargetService && !binding.service?.entrypoint) {
15806
- (0, import_assert12.default)(binding.service?.name);
16541
+ (0, import_assert13.default)(binding.service?.name);
15807
16542
  binding.service.name = `${RPC_PROXY_SERVICE_NAME}:${targetWorkerName}`;
15808
16543
  }
15809
16544
  }
@@ -15909,7 +16644,7 @@ var Miniflare2 = class _Miniflare {
15909
16644
  proxyBindings
15910
16645
  });
15911
16646
  for (const service of globalServices) {
15912
- (0, import_assert12.default)(service.name !== void 0 && !services.has(service.name));
16647
+ (0, import_assert13.default)(service.name !== void 0 && !services.has(service.name));
15913
16648
  services.set(service.name, service);
15914
16649
  }
15915
16650
  for (const toPopulate of wrappedBindingsToPopulate) {
@@ -15933,14 +16668,14 @@ var Miniflare2 = class _Miniflare {
15933
16668
  }
15934
16669
  async #assembleAndUpdateConfig() {
15935
16670
  const initial = !this.#runtimeEntryURL;
15936
- (0, import_assert12.default)(this.#runtime !== void 0);
16671
+ (0, import_assert13.default)(this.#runtime !== void 0);
15937
16672
  const loopbackPort = await this.#getLoopbackPort();
15938
16673
  const config = await this.#assembleConfig(loopbackPort);
15939
16674
  const configBuffer = serializeConfig(config);
15940
- (0, import_assert12.default)(config.sockets !== void 0);
16675
+ (0, import_assert13.default)(config.sockets !== void 0);
15941
16676
  const requiredSockets = config.sockets.map(
15942
16677
  ({ name }) => {
15943
- (0, import_assert12.default)(name !== void 0);
16678
+ (0, import_assert13.default)(name !== void 0);
15944
16679
  return name;
15945
16680
  }
15946
16681
  );
@@ -16008,11 +16743,11 @@ var Miniflare2 = class _Miniflare {
16008
16743
  const secure = entrySocket !== void 0 && "https" in entrySocket;
16009
16744
  const previousEntryURL = this.#runtimeEntryURL;
16010
16745
  const entryPort = maybeSocketPorts.get(SOCKET_ENTRY);
16011
- (0, import_assert12.default)(entryPort !== void 0);
16746
+ (0, import_assert13.default)(entryPort !== void 0);
16012
16747
  const maybeAccessibleHost = maybeGetLocallyAccessibleHost(configuredHost);
16013
16748
  if (maybeAccessibleHost === void 0) {
16014
16749
  const localEntryPort = maybeSocketPorts.get(SOCKET_ENTRY_LOCAL);
16015
- (0, import_assert12.default)(localEntryPort !== void 0, "Expected local entry socket port");
16750
+ (0, import_assert13.default)(localEntryPort !== void 0, "Expected local entry socket port");
16016
16751
  this.#runtimeEntryURL = new URL(`http://127.0.0.1:${localEntryPort}`);
16017
16752
  } else {
16018
16753
  this.#runtimeEntryURL = new URL(
@@ -16062,7 +16797,7 @@ var Miniflare2 = class _Miniflare {
16062
16797
  if (disposing) return new URL("http://[100::]/");
16063
16798
  await this.#maybeInspectorProxyController?.ready;
16064
16799
  this.#checkDisposed();
16065
- (0, import_assert12.default)(this.#runtimeEntryURL !== void 0);
16800
+ (0, import_assert13.default)(this.#runtimeEntryURL !== void 0);
16066
16801
  return new URL(this.#runtimeEntryURL.toString());
16067
16802
  }
16068
16803
  get ready() {
@@ -16079,7 +16814,7 @@ var Miniflare2 = class _Miniflare {
16079
16814
  if (this.#maybeInspectorProxyController !== void 0) {
16080
16815
  return this.#maybeInspectorProxyController.getInspectorURL();
16081
16816
  }
16082
- (0, import_assert12.default)(this.#socketPorts !== void 0);
16817
+ (0, import_assert13.default)(this.#socketPorts !== void 0);
16083
16818
  const maybePort = this.#socketPorts.get(kInspectorSocket);
16084
16819
  if (maybePort === void 0) {
16085
16820
  throw new TypeError(
@@ -16094,7 +16829,7 @@ var Miniflare2 = class _Miniflare {
16094
16829
  const workerIndex = this.#findAndAssertWorkerIndex(workerName);
16095
16830
  const workerOpts = this.#workerOpts[workerIndex];
16096
16831
  const socketName = getDirectSocketName(workerIndex, entrypoint);
16097
- (0, import_assert12.default)(this.#socketPorts !== void 0);
16832
+ (0, import_assert13.default)(this.#socketPorts !== void 0);
16098
16833
  const maybePort = this.#socketPorts.get(socketName);
16099
16834
  if (maybePort === void 0) {
16100
16835
  const friendlyWorkerName = workerName === void 0 ? "entrypoint" : JSON.stringify(workerName);
@@ -16106,7 +16841,7 @@ var Miniflare2 = class _Miniflare {
16106
16841
  const directSocket = workerOpts.core.unsafeDirectSockets?.find(
16107
16842
  (socket) => (socket.entrypoint ?? "default") === entrypoint
16108
16843
  );
16109
- (0, import_assert12.default)(directSocket !== void 0);
16844
+ (0, import_assert13.default)(directSocket !== void 0);
16110
16845
  const host = directSocket.host ?? DEFAULT_HOST;
16111
16846
  const accessibleHost = maybeGetLocallyAccessibleHost(host) ?? getURLSafeHost(host);
16112
16847
  return new URL(`http://${accessibleHost}:${maybePort}`);
@@ -16136,14 +16871,14 @@ var Miniflare2 = class _Miniflare {
16136
16871
  dispatchFetch = async (input, init2) => {
16137
16872
  this.#checkDisposed();
16138
16873
  await this.ready;
16139
- (0, import_assert12.default)(this.#runtimeEntryURL !== void 0);
16140
- (0, import_assert12.default)(this.#runtimeDispatcher !== void 0);
16874
+ (0, import_assert13.default)(this.#runtimeEntryURL !== void 0);
16875
+ (0, import_assert13.default)(this.#runtimeDispatcher !== void 0);
16141
16876
  const forward = new Request(input, init2);
16142
- const url24 = new URL(forward.url);
16877
+ const url27 = new URL(forward.url);
16143
16878
  const actualRuntimeOrigin = this.#runtimeEntryURL.origin;
16144
- const userRuntimeOrigin = url24.origin;
16145
- url24.protocol = this.#runtimeEntryURL.protocol;
16146
- url24.host = this.#runtimeEntryURL.host;
16879
+ const userRuntimeOrigin = url27.origin;
16880
+ url27.protocol = this.#runtimeEntryURL.protocol;
16881
+ url27.host = this.#runtimeEntryURL.host;
16147
16882
  if (forward.body !== null && forward.headers.get("Content-Length") === "0") {
16148
16883
  forward.headers.delete("Content-Length");
16149
16884
  }
@@ -16157,7 +16892,7 @@ var Miniflare2 = class _Miniflare {
16157
16892
  );
16158
16893
  const forwardInit = forward;
16159
16894
  forwardInit.dispatcher = dispatcher;
16160
- const response = await fetch4(url24, forwardInit);
16895
+ const response = await fetch4(url27, forwardInit);
16161
16896
  const stack = response.headers.get(CoreHeaders.ERROR_STACK);
16162
16897
  if (response.status === 500 && stack !== null) {
16163
16898
  const caught = JsonErrorSchema.parse(await response.json());
@@ -16184,7 +16919,7 @@ var Miniflare2 = class _Miniflare {
16184
16919
  async _getProxyClient() {
16185
16920
  this.#checkDisposed();
16186
16921
  await this.ready;
16187
- (0, import_assert12.default)(this.#proxyClient !== void 0);
16922
+ (0, import_assert13.default)(this.#proxyClient !== void 0);
16188
16923
  return this.#proxyClient;
16189
16924
  }
16190
16925
  #findAndAssertWorkerIndex(workerName) {
@@ -16212,7 +16947,7 @@ var Miniflare2 = class _Miniflare {
16212
16947
  if (binding instanceof ProxyNodeBinding) {
16213
16948
  const proxyBindingName = getProxyBindingName(key, workerName, name);
16214
16949
  let proxy = proxyClient.env[proxyBindingName];
16215
- (0, import_assert12.default)(
16950
+ (0, import_assert13.default)(
16216
16951
  proxy !== void 0,
16217
16952
  `Expected ${proxyBindingName} to be bound`
16218
16953
  );
@@ -16317,7 +17052,7 @@ var Miniflare2 = class _Miniflare {
16317
17052
  await this.#proxyClient?.dispose();
16318
17053
  await this.#runtime?.dispose();
16319
17054
  await this.#stopLoopbackServer();
16320
- await import_fs28.default.promises.rm(this.#tmpPath, { force: true, recursive: true });
17055
+ await import_fs31.default.promises.rm(this.#tmpPath, { force: true, recursive: true });
16321
17056
  await this.#maybeInspectorProxyController?.dispose();
16322
17057
  maybeInstanceRegistry?.delete(this);
16323
17058
  }
@@ -16325,12 +17060,18 @@ var Miniflare2 = class _Miniflare {
16325
17060
  };
16326
17061
  // Annotate the CommonJS export names for ESM import in node:
16327
17062
  0 && (module.exports = {
17063
+ AIOptionsSchema,
17064
+ AI_PLUGIN,
17065
+ AI_PLUGIN_NAME,
16328
17066
  ANALYTICS_ENGINE_PLUGIN,
16329
17067
  ANALYTICS_ENGINE_PLUGIN_NAME,
16330
17068
  ASSETS_PLUGIN,
16331
17069
  AnalyticsEngineSchemaOptionsSchema,
16332
17070
  AnalyticsEngineSchemaSharedOptionsSchema,
16333
17071
  AssetsOptionsSchema,
17072
+ BROWSER_RENDERING_PLUGIN,
17073
+ BROWSER_RENDERING_PLUGIN_NAME,
17074
+ BrowserRenderingOptionsSchema,
16334
17075
  CACHE_PLUGIN,
16335
17076
  CACHE_PLUGIN_NAME,
16336
17077
  CORE_PLUGIN,
@@ -16349,11 +17090,14 @@ var Miniflare2 = class _Miniflare {
16349
17090
  D1_PLUGIN,
16350
17091
  D1_PLUGIN_NAME,
16351
17092
  DEFAULT_PERSIST_ROOT,
17093
+ DISPATCH_NAMESPACE_PLUGIN,
17094
+ DISPATCH_NAMESPACE_PLUGIN_NAME,
16352
17095
  DURABLE_OBJECTS_PLUGIN,
16353
17096
  DURABLE_OBJECTS_PLUGIN_NAME,
16354
17097
  DURABLE_OBJECTS_STORAGE_SERVICE_NAME,
16355
17098
  DeferredPromise,
16356
17099
  DispatchFetchDispatcher,
17100
+ DispatchNamespaceOptionsSchema,
16357
17101
  DurableObjectsOptionsSchema,
16358
17102
  DurableObjectsSharedOptionsSchema,
16359
17103
  EMAIL_PLUGIN,
@@ -16369,12 +17113,16 @@ var Miniflare2 = class _Miniflare {
16369
17113
  HttpOptions_Style,
16370
17114
  HyperdriveInputOptionsSchema,
16371
17115
  HyperdriveSchema,
17116
+ IMAGES_PLUGIN,
17117
+ IMAGES_PLUGIN_NAME,
17118
+ ImagesOptionsSchema,
16372
17119
  JsonSchema,
16373
17120
  KVHeaders,
16374
17121
  KVLimits,
16375
17122
  KVOptionsSchema,
16376
17123
  KVParams,
16377
17124
  KVSharedOptionsSchema,
17125
+ KV_NAMESPACE_OBJECT_CLASS_NAME,
16378
17126
  KV_PLUGIN,
16379
17127
  KV_PLUGIN_NAME,
16380
17128
  LiteralSchema,
@@ -16444,6 +17192,9 @@ var Miniflare2 = class _Miniflare {
16444
17192
  SourceOptionsSchema,
16445
17193
  TlsOptions_Version,
16446
17194
  TypedEventTarget,
17195
+ VECTORIZE_PLUGIN,
17196
+ VECTORIZE_PLUGIN_NAME,
17197
+ VectorizeOptionsSchema,
16447
17198
  WORKER_BINDING_SERVICE_LOOPBACK,
16448
17199
  WORKFLOWS_PLUGIN,
16449
17200
  WORKFLOWS_PLUGIN_NAME,
@@ -16498,6 +17249,7 @@ var Miniflare2 = class _Miniflare {
16498
17249
  maybeParseURL,
16499
17250
  mergeWorkerOptions,
16500
17251
  migrateDatabase,
17252
+ mixedModeClientWorker,
16501
17253
  namespaceEntries,
16502
17254
  namespaceKeys,
16503
17255
  normaliseDurableObject,