{"version":3,"file":"index.mjs","names":["t","index","value","from","to","parseOptions","MAX_LENGTH","MAX_SAFE_INTEGER","MAX_SAFE_COMPONENT_LENGTH","MAX_SAFE_BUILD_LENGTH","debug","debug","re","src","t","MAX_LENGTH","compareIdentifiers","debug","re","parseOptions","SemVer","t","SemVer","compare","compare","eq","compare","neq","compare","gt","compare","gte","compare","lt","lte","cmp","Comparator","parseOptions","re","t","SemVer","Range","debug","Range","debug","z","#compatibilityDate","#compatibilityFlags","#optionsPath","#relativeProjectPath","#relativeWranglerConfigPath","#flagExists","#buildErrorMessageBase","#buildConfigPath","exportMap: ExportMap","fs","ids: string[]","debuglog: util.DebugLoggerFunction","log","__filename","__dirname","platformPath","require","parentPaths: string[]","cache","e: unknown","exports","exhaustive: never","result: Record<string, unknown>","errorRef: ZodErrorRef","log","name: string","formatted: string","options: PoolOptions","poolOptions:\n\t\t\t| WorkersPoolOptions\n\t\t\t| ((\n\t\t\t\t\tctx: WorkerPoolOptionsContext\n\t\t\t  ) => Promise<WorkersPoolOptions> | WorkersPoolOptions)","resolvedPoolOptions: WorkersPoolOptions","toSend: WorkerRequest","main: string | undefined","fs","devalue.stringify","devalue.parse","workerName: string | undefined","selfWorkerExports: string[]","workers: ProjectWorkers","worker: unknown","SHARED_MINIFLARE_OPTIONS: SharedOptions","getPort","inspectorPort: number | undefined"],"sources":["../../../workers-utils/dist/chunk-OZQVB3L3.mjs","../../../workers-utils/dist/chunk-DCOBXSFB.mjs","../../../workers-utils/dist/chunk-BLWXWFJK.mjs","../../../../node_modules/.pnpm/devalue@5.6.3/node_modules/devalue/src/utils.js","../../../../node_modules/.pnpm/devalue@5.6.3/node_modules/devalue/src/base64.js","../../../../node_modules/.pnpm/devalue@5.6.3/node_modules/devalue/src/constants.js","../../../../node_modules/.pnpm/devalue@5.6.3/node_modules/devalue/src/parse.js","../../../../node_modules/.pnpm/devalue@5.6.3/node_modules/devalue/src/stringify.js","../../../../node_modules/.pnpm/get-port@7.1.0/node_modules/get-port/index.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/lrucache.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/parse-options.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/constants.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/debug.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/re.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/internal/identifiers.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/classes/semver.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/compare.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/eq.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/neq.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/gt.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/gte.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/lt.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/lte.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/cmp.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/classes/comparator.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/classes/range.js","../../../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/functions/satisfies.js","../../src/pool/compatibility-flag-assertions.ts","../../src/pool/guess-exports.ts","../../src/pool/helpers.ts","../../src/pool/loopback.ts","../../src/shared/builtin-modules.ts","../../src/pool/module-fallback.ts","../../src/pool/config.ts","../../src/pool/pages.ts","../../src/pool/cloudflare-pool-worker.ts","../../src/pool/pool.ts","../../src/pool/plugin.ts","../../src/pool/d1.ts","../../src/pool/index.ts"],"sourcesContent":["// src/constants.ts\nvar INHERIT_SYMBOL = Symbol.for(\"inherit_binding\");\nvar SERVICE_TAG_PREFIX = \"cf:service=\";\nvar ENVIRONMENT_TAG_PREFIX = \"cf:environment=\";\nvar PATH_TO_DEPLOY_CONFIG = \".wrangler/deploy/config.json\";\nvar JSON_CONFIG_FORMATS = [\"json\", \"jsonc\"];\n\nexport { ENVIRONMENT_TAG_PREFIX, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, PATH_TO_DEPLOY_CONFIG, SERVICE_TAG_PREFIX };\n","var __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\nvar __require = /* @__PURE__ */ ((x) => typeof require !== \"undefined\" ? require : typeof Proxy !== \"undefined\" ? new Proxy(x, {\n  get: (a, b) => (typeof require !== \"undefined\" ? require : a)[b]\n}) : x)(function(x) {\n  if (typeof require !== \"undefined\") return require.apply(this, arguments);\n  throw Error('Dynamic require of \"' + x + '\" is not supported');\n});\nvar __commonJS = (cb, mod) => function __require2() {\n  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __export = (target, all) => {\n  for (var name in all)\n    __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n  if (from && typeof from === \"object\" || typeof from === \"function\") {\n    for (let key of __getOwnPropNames(from))\n      if (!__hasOwnProp.call(to, key) && key !== except)\n        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n  }\n  return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n  // If the importer is in node compatibility mode or this is not an ESM\n  // file that has been converted to a CommonJS file using a Babel-\n  // compatible transform (i.e. \"__esModule\" has not been set), then set\n  // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n  isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n  mod\n));\n\nexport { __commonJS, __export, __name, __reExport, __require, __toESM };\n","import { ENVIRONMENT_TAG_PREFIX, SERVICE_TAG_PREFIX } from './chunk-OZQVB3L3.mjs';\nimport { __name } from './chunk-DCOBXSFB.mjs';\nimport assert from 'node:assert';\n\nfunction isCompatDate(str) {\n  return /^\\d{4}-\\d{2}-\\d{2}$/.test(str);\n}\n__name(isCompatDate, \"isCompatDate\");\nfunction formatCompatibilityDate(date) {\n  const compatDate = date.toISOString().slice(0, 10);\n  assert(isCompatDate(compatDate));\n  return compatDate;\n}\n__name(formatCompatibilityDate, \"formatCompatibilityDate\");\nfunction getTodaysCompatDate() {\n  return formatCompatibilityDate(/* @__PURE__ */ new Date());\n}\n__name(getTodaysCompatDate, \"getTodaysCompatDate\");\n\n// src/assert-never.ts\nfunction assertNever(_value) {\n}\n__name(assertNever, \"assertNever\");\n\n// src/map-worker-metadata-bindings.ts\nfunction mapWorkerMetadataBindings(bindings) {\n  return bindings.filter((binding) => binding.type !== \"secret_text\").reduce((configObj, binding) => {\n    switch (binding.type) {\n      case \"plain_text\":\n        {\n          configObj.vars = {\n            ...configObj.vars ?? {},\n            [binding.name]: binding.text\n          };\n        }\n        break;\n      case \"json\":\n        {\n          configObj.vars = {\n            ...configObj.vars ?? {},\n            name: binding.name,\n            json: binding.json\n          };\n        }\n        break;\n      case \"kv_namespace\":\n        {\n          configObj.kv_namespaces = [\n            ...configObj.kv_namespaces ?? [],\n            { id: binding.namespace_id, binding: binding.name }\n          ];\n        }\n        break;\n      case \"durable_object_namespace\":\n        {\n          configObj.durable_objects = {\n            bindings: [\n              ...configObj.durable_objects?.bindings ?? [],\n              {\n                name: binding.name,\n                class_name: binding.class_name,\n                script_name: binding.script_name,\n                environment: binding.environment\n              }\n            ]\n          };\n        }\n        break;\n      case \"d1\":\n        {\n          configObj.d1_databases = [\n            ...configObj.d1_databases ?? [],\n            {\n              binding: binding.name,\n              database_id: binding.id\n            }\n          ];\n        }\n        break;\n      case \"browser\":\n        {\n          configObj.browser = {\n            binding: binding.name\n          };\n        }\n        break;\n      case \"ai\":\n        {\n          configObj.ai = {\n            binding: binding.name\n          };\n        }\n        break;\n      case \"images\":\n        {\n          configObj.images = {\n            binding: binding.name\n          };\n        }\n        break;\n      case \"stream\":\n        {\n          configObj.stream = {\n            binding: binding.name\n          };\n        }\n        break;\n      case \"media\":\n        {\n          configObj.media = {\n            binding: binding.name\n          };\n        }\n        break;\n      case \"r2_bucket\":\n        {\n          configObj.r2_buckets = [\n            ...configObj.r2_buckets ?? [],\n            {\n              binding: binding.name,\n              bucket_name: binding.bucket_name,\n              jurisdiction: binding.jurisdiction\n            }\n          ];\n        }\n        break;\n      case \"secrets_store_secret\":\n        {\n          configObj.secrets_store_secrets = [\n            ...configObj.secrets_store_secrets ?? [],\n            {\n              binding: binding.name,\n              store_id: binding.store_id,\n              secret_name: binding.secret_name\n            }\n          ];\n        }\n        break;\n      case \"artifacts\":\n        {\n          configObj.artifacts = [\n            ...configObj.artifacts ?? [],\n            {\n              binding: binding.name,\n              namespace: binding.namespace\n            }\n          ];\n        }\n        break;\n      case \"unsafe_hello_world\": {\n        configObj.unsafe_hello_world = [\n          ...configObj.unsafe_hello_world ?? [],\n          {\n            binding: binding.name,\n            enable_timer: binding.enable_timer\n          }\n        ];\n        break;\n      }\n      case \"flagship\": {\n        configObj.flagship = [\n          ...configObj.flagship ?? [],\n          {\n            binding: binding.name,\n            app_id: binding.app_id\n          }\n        ];\n        break;\n      }\n      case \"service\":\n        {\n          configObj.services = [\n            ...configObj.services ?? [],\n            {\n              binding: binding.name,\n              service: binding.service,\n              environment: binding.environment,\n              entrypoint: binding.entrypoint\n            }\n          ];\n        }\n        break;\n      case \"analytics_engine\":\n        {\n          configObj.analytics_engine_datasets = [\n            ...configObj.analytics_engine_datasets ?? [],\n            { binding: binding.name, dataset: binding.dataset }\n          ];\n        }\n        break;\n      case \"dispatch_namespace\":\n        {\n          configObj.dispatch_namespaces = [\n            ...configObj.dispatch_namespaces ?? [],\n            {\n              binding: binding.name,\n              namespace: binding.namespace,\n              ...binding.outbound && {\n                outbound: {\n                  service: binding.outbound.worker.service,\n                  environment: binding.outbound.worker.environment,\n                  parameters: binding.outbound.params?.map((p) => p.name) ?? []\n                }\n              }\n            }\n          ];\n        }\n        break;\n      case \"logfwdr\":\n        {\n          configObj.logfwdr = {\n            bindings: [\n              ...configObj.logfwdr?.bindings ?? [],\n              { name: binding.name, destination: binding.destination }\n            ]\n          };\n        }\n        break;\n      case \"wasm_module\":\n        {\n          configObj.wasm_modules = {\n            ...configObj.wasm_modules ?? {},\n            [binding.name]: binding.part\n          };\n        }\n        break;\n      case \"text_blob\":\n        {\n          configObj.text_blobs = {\n            ...configObj.text_blobs ?? {},\n            [binding.name]: binding.part\n          };\n        }\n        break;\n      case \"data_blob\":\n        {\n          configObj.data_blobs = {\n            ...configObj.data_blobs ?? {},\n            [binding.name]: binding.part\n          };\n        }\n        break;\n      case \"secret_text\":\n        break;\n      case \"version_metadata\": {\n        {\n          configObj.version_metadata = {\n            binding: binding.name\n          };\n        }\n        break;\n      }\n      case \"send_email\": {\n        configObj.send_email = [\n          ...configObj.send_email ?? [],\n          {\n            name: binding.name,\n            destination_address: binding.destination_address,\n            allowed_destination_addresses: binding.allowed_destination_addresses,\n            allowed_sender_addresses: binding.allowed_sender_addresses\n          }\n        ];\n        break;\n      }\n      case \"queue\":\n        configObj.queues ??= { producers: [] };\n        configObj.queues.producers = [\n          ...configObj.queues.producers ?? [],\n          {\n            binding: binding.name,\n            queue: binding.queue_name,\n            delivery_delay: binding.delivery_delay\n          }\n        ];\n        break;\n      case \"vectorize\":\n        configObj.vectorize = [\n          ...configObj.vectorize ?? [],\n          {\n            binding: binding.name,\n            index_name: binding.index_name\n          }\n        ];\n        break;\n      case \"ai_search_namespace\":\n        configObj.ai_search_namespaces = [\n          ...configObj.ai_search_namespaces ?? [],\n          {\n            binding: binding.name,\n            namespace: binding.namespace\n          }\n        ];\n        break;\n      case \"ai_search\":\n        configObj.ai_search = [\n          ...configObj.ai_search ?? [],\n          {\n            binding: binding.name,\n            instance_name: binding.instance_name\n          }\n        ];\n        break;\n      case \"hyperdrive\":\n        configObj.hyperdrive = [\n          ...configObj.hyperdrive ?? [],\n          {\n            binding: binding.name,\n            id: binding.id\n          }\n        ];\n        break;\n      case \"mtls_certificate\":\n        configObj.mtls_certificates = [\n          ...configObj.mtls_certificates ?? [],\n          {\n            binding: binding.name,\n            certificate_id: binding.certificate_id\n          }\n        ];\n        break;\n      case \"pipelines\":\n        configObj.pipelines = [\n          ...configObj.pipelines ?? [],\n          {\n            binding: binding.name,\n            pipeline: binding.pipeline\n          }\n        ];\n        break;\n      case \"assets\":\n        configObj.assets = {\n          binding: binding.name\n          // Note: we currently don't get all the assets information from the\n          //      API, so here we are only able to set the name of the binding\n          //      hopefully in the future we can properly fully support the binding\n        };\n        break;\n      case \"inherit\":\n        configObj.unsafe = {\n          bindings: [...configObj.unsafe?.bindings ?? [], binding],\n          metadata: configObj.unsafe?.metadata ?? void 0\n        };\n        break;\n      case \"workflow\":\n        {\n          configObj.workflows = [\n            ...configObj.workflows ?? [],\n            {\n              binding: binding.name,\n              name: binding.workflow_name,\n              class_name: binding.class_name,\n              script_name: binding.script_name\n            }\n          ];\n        }\n        break;\n      case \"worker_loader\":\n        {\n          configObj.worker_loaders = [\n            ...configObj.worker_loaders ?? [],\n            {\n              binding: binding.name\n            }\n          ];\n        }\n        break;\n      case \"ratelimit\":\n        {\n          configObj.ratelimits = [\n            ...configObj.ratelimits ?? [],\n            {\n              name: binding.name,\n              namespace_id: binding.namespace_id,\n              simple: {\n                limit: binding.simple.limit,\n                period: binding.simple.period\n              }\n            }\n          ];\n        }\n        break;\n      case \"vpc_service\":\n        {\n          configObj.vpc_services = [\n            ...configObj.vpc_services ?? [],\n            {\n              binding: binding.name,\n              service_id: binding.service_id\n            }\n          ];\n        }\n        break;\n      case \"vpc_network\":\n        {\n          if (binding.tunnel_id !== void 0) {\n            configObj.vpc_networks = [\n              ...configObj.vpc_networks ?? [],\n              { binding: binding.name, tunnel_id: binding.tunnel_id }\n            ];\n          } else if (binding.network_id !== void 0) {\n            configObj.vpc_networks = [\n              ...configObj.vpc_networks ?? [],\n              { binding: binding.name, network_id: binding.network_id }\n            ];\n          }\n        }\n        break;\n      default: {\n        configObj.unsafe = {\n          bindings: [...configObj.unsafe?.bindings ?? [], binding],\n          metadata: configObj.unsafe?.metadata ?? void 0\n        };\n      }\n    }\n    return configObj;\n  }, {});\n}\n__name(mapWorkerMetadataBindings, \"mapWorkerMetadataBindings\");\n\n// src/construct-wrangler-config.ts\nfunction convertWorkerToWranglerConfig(config) {\n  const mappedBindings = mapWorkerMetadataBindings(config.bindings);\n  const durableObjectClassNames = config.bindings.filter(\n    (binding) => binding.type === \"durable_object_namespace\" && binding.script_name === config.name\n  ).map(\n    (durableObject) => durableObject.class_name\n  );\n  const allRoutes = [\n    ...config.routes.map((r) => ({\n      pattern: r.pattern,\n      zone_name: r.zone_name\n    })),\n    ...config.domains.map((c) => ({\n      pattern: c.hostname,\n      zone_name: c.zone_name,\n      custom_domain: true,\n      enabled: c.enabled,\n      previews_enabled: c.previews_enabled\n    }))\n  ];\n  return {\n    name: config.name,\n    main: config.entrypoint,\n    workers_dev: config.subdomain.enabled,\n    preview_urls: config.subdomain.previews_enabled,\n    compatibility_date: config.compatibility_date ?? getTodaysCompatDate(),\n    compatibility_flags: config.compatibility_flags,\n    ...allRoutes.length ? { routes: allRoutes } : {},\n    placement: config.placement?.mode === \"smart\" ? { mode: \"smart\" } : void 0,\n    limits: config.limits,\n    ...durableObjectClassNames.length && config.migration_tag ? {\n      migrations: [\n        {\n          tag: config.migration_tag,\n          new_classes: durableObjectClassNames\n        }\n      ]\n    } : {},\n    ...config.schedules.length ? {\n      triggers: {\n        crons: config.schedules.map((scheduled) => scheduled.cron)\n      }\n    } : {},\n    tail_consumers: config.tail_consumers ?? void 0,\n    observability: config.observability,\n    ...mappedBindings\n  };\n}\n__name(convertWorkerToWranglerConfig, \"convertWorkerToWranglerConfig\");\nfunction constructWranglerConfig(workerOrWorkers) {\n  let workers;\n  if (Array.isArray(workerOrWorkers)) {\n    workers = workerOrWorkers;\n  } else {\n    workers = [workerOrWorkers];\n  }\n  const topLevelEnv = workers.find(\n    (w) => !w.tags?.some((t) => t.startsWith(ENVIRONMENT_TAG_PREFIX))\n  );\n  const workerName = topLevelEnv?.name ?? workers[0].name;\n  const entrypoint = topLevelEnv?.entrypoint ?? workers[0].entrypoint;\n  let combinedConfig;\n  if (topLevelEnv) {\n    combinedConfig = convertWorkerToWranglerConfig(topLevelEnv);\n  } else {\n    combinedConfig = {\n      name: workerName,\n      main: entrypoint\n    };\n  }\n  for (const env of workers) {\n    const serviceTag = env.tags?.find(\n      (t) => t === `${SERVICE_TAG_PREFIX}${workerName}`\n    );\n    const envTag = env.tags?.find((t) => t.startsWith(ENVIRONMENT_TAG_PREFIX));\n    if (serviceTag !== `${SERVICE_TAG_PREFIX}${workerName}` || envTag === void 0) {\n      continue;\n    }\n    const [_, envName] = envTag.split(\"=\");\n    combinedConfig.env ??= {};\n    combinedConfig.env[envName] = convertWorkerToWranglerConfig(env);\n  }\n  return combinedConfig;\n}\n__name(constructWranglerConfig, \"constructWranglerConfig\");\n\nexport { assertNever, constructWranglerConfig, getTodaysCompatDate, isCompatDate, mapWorkerMetadataBindings };\n","/** @type {Record<string, string>} */\nexport const escaped = {\n\t'<': '\\\\u003C',\n\t'\\\\': '\\\\\\\\',\n\t'\\b': '\\\\b',\n\t'\\f': '\\\\f',\n\t'\\n': '\\\\n',\n\t'\\r': '\\\\r',\n\t'\\t': '\\\\t',\n\t'\\u2028': '\\\\u2028',\n\t'\\u2029': '\\\\u2029'\n};\n\nexport class DevalueError extends Error {\n\t/**\n\t * @param {string} message\n\t * @param {string[]} keys\n\t * @param {any} [value] - The value that failed to be serialized\n\t * @param {any} [root] - The root value being serialized\n\t */\n\tconstructor(message, keys, value, root) {\n\t\tsuper(message);\n\t\tthis.name = 'DevalueError';\n\t\tthis.path = keys.join('');\n\t\tthis.value = value;\n\t\tthis.root = root;\n\t}\n}\n\n/** @param {any} thing */\nexport function is_primitive(thing) {\n\treturn Object(thing) !== thing;\n}\n\nconst object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(\n\tObject.prototype\n)\n\t.sort()\n\t.join('\\0');\n\n/** @param {any} thing */\nexport function is_plain_object(thing) {\n\tconst proto = Object.getPrototypeOf(thing);\n\n\treturn (\n\t\tproto === Object.prototype ||\n\t\tproto === null ||\n\t\tObject.getPrototypeOf(proto) === null ||\n\t\tObject.getOwnPropertyNames(proto).sort().join('\\0') === object_proto_names\n\t);\n}\n\n/** @param {any} thing */\nexport function get_type(thing) {\n\treturn Object.prototype.toString.call(thing).slice(8, -1);\n}\n\n/** @param {string} char */\nfunction get_escaped_char(char) {\n\tswitch (char) {\n\t\tcase '\"':\n\t\t\treturn '\\\\\"';\n\t\tcase '<':\n\t\t\treturn '\\\\u003C';\n\t\tcase '\\\\':\n\t\t\treturn '\\\\\\\\';\n\t\tcase '\\n':\n\t\t\treturn '\\\\n';\n\t\tcase '\\r':\n\t\t\treturn '\\\\r';\n\t\tcase '\\t':\n\t\t\treturn '\\\\t';\n\t\tcase '\\b':\n\t\t\treturn '\\\\b';\n\t\tcase '\\f':\n\t\t\treturn '\\\\f';\n\t\tcase '\\u2028':\n\t\t\treturn '\\\\u2028';\n\t\tcase '\\u2029':\n\t\t\treturn '\\\\u2029';\n\t\tdefault:\n\t\t\treturn char < ' '\n\t\t\t\t? `\\\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`\n\t\t\t\t: '';\n\t}\n}\n\n/** @param {string} str */\nexport function stringify_string(str) {\n\tlet result = '';\n\tlet last_pos = 0;\n\tconst len = str.length;\n\n\tfor (let i = 0; i < len; i += 1) {\n\t\tconst char = str[i];\n\t\tconst replacement = get_escaped_char(char);\n\t\tif (replacement) {\n\t\t\tresult += str.slice(last_pos, i) + replacement;\n\t\t\tlast_pos = i + 1;\n\t\t}\n\t}\n\n\treturn `\"${last_pos === 0 ? str : result + str.slice(last_pos)}\"`;\n}\n\n/** @param {Record<string | symbol, any>} object */\nexport function enumerable_symbols(object) {\n\treturn Object.getOwnPropertySymbols(object).filter(\n\t\t(symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable\n\t);\n}\n\nconst is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;\n\n/** @param {string} key */\nexport function stringify_key(key) {\n\treturn is_identifier.test(key) ? '.' + key : '[' + JSON.stringify(key) + ']';\n}\n\n/** @param {string} s */\nfunction is_valid_array_index(s) {\n\tif (s.length === 0) return false;\n\tif (s.length > 1 && s.charCodeAt(0) === 48) return false; // leading zero\n\tfor (let i = 0; i < s.length; i++) {\n\t\tconst c = s.charCodeAt(i);\n\t\tif (c < 48 || c > 57) return false;\n\t}\n\t// by this point we know it's a string of digits, but it has to be within the range of valid array indices\n\tconst n = +s;\n\tif (n >= 2 ** 32 - 1) return false;\n\tif (n < 0) return false;\n\treturn true;\n}\n\n/**\n * Finds the populated indices of an array.\n * @param {unknown[]} array\n */\nexport function valid_array_indices(array) {\n\tconst keys = Object.keys(array);\n\tfor (var i = keys.length - 1; i >= 0; i--) {\n\t\tif (is_valid_array_index(keys[i])) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tkeys.length = i + 1;\n\treturn keys;\n}\n","/**\n * Base64 Encodes an arraybuffer\n * @param {ArrayBuffer} arraybuffer\n * @returns {string}\n */\nexport function encode64(arraybuffer) {\n  const dv = new DataView(arraybuffer);\n  let binaryString = \"\";\n\n  for (let i = 0; i < arraybuffer.byteLength; i++) {\n    binaryString += String.fromCharCode(dv.getUint8(i));\n  }\n\n  return binaryToAscii(binaryString);\n}\n\n/**\n * Decodes a base64 string into an arraybuffer\n * @param {string} string\n * @returns {ArrayBuffer}\n */\nexport function decode64(string) {\n  const binaryString = asciiToBinary(string);\n  const arraybuffer = new ArrayBuffer(binaryString.length);\n  const dv = new DataView(arraybuffer);\n\n  for (let i = 0; i < arraybuffer.byteLength; i++) {\n    dv.setUint8(i, binaryString.charCodeAt(i));\n  }\n\n  return arraybuffer;\n}\n\nconst KEY_STRING =\n  \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n/**\n * Substitute for atob since it's deprecated in node.\n * Does not do any input validation.\n *\n * @see https://github.com/jsdom/abab/blob/master/lib/atob.js\n *\n * @param {string} data\n * @returns {string}\n */\nfunction asciiToBinary(data) {\n  if (data.length % 4 === 0) {\n    data = data.replace(/==?$/, \"\");\n  }\n\n  let output = \"\";\n  let buffer = 0;\n  let accumulatedBits = 0;\n\n  for (let i = 0; i < data.length; i++) {\n    buffer <<= 6;\n    buffer |= KEY_STRING.indexOf(data[i]);\n    accumulatedBits += 6;\n    if (accumulatedBits === 24) {\n      output += String.fromCharCode((buffer & 0xff0000) >> 16);\n      output += String.fromCharCode((buffer & 0xff00) >> 8);\n      output += String.fromCharCode(buffer & 0xff);\n      buffer = accumulatedBits = 0;\n    }\n  }\n  if (accumulatedBits === 12) {\n    buffer >>= 4;\n    output += String.fromCharCode(buffer);\n  } else if (accumulatedBits === 18) {\n    buffer >>= 2;\n    output += String.fromCharCode((buffer & 0xff00) >> 8);\n    output += String.fromCharCode(buffer & 0xff);\n  }\n  return output;\n}\n\n/**\n * Substitute for btoa since it's deprecated in node.\n * Does not do any input validation.\n *\n * @see https://github.com/jsdom/abab/blob/master/lib/btoa.js\n *\n * @param {string} str\n * @returns {string}\n */\nfunction binaryToAscii(str) {\n  let out = \"\";\n  for (let i = 0; i < str.length; i += 3) {\n    /** @type {[number, number, number, number]} */\n    const groupsOfSix = [undefined, undefined, undefined, undefined];\n    groupsOfSix[0] = str.charCodeAt(i) >> 2;\n    groupsOfSix[1] = (str.charCodeAt(i) & 0x03) << 4;\n    if (str.length > i + 1) {\n      groupsOfSix[1] |= str.charCodeAt(i + 1) >> 4;\n      groupsOfSix[2] = (str.charCodeAt(i + 1) & 0x0f) << 2;\n    }\n    if (str.length > i + 2) {\n      groupsOfSix[2] |= str.charCodeAt(i + 2) >> 6;\n      groupsOfSix[3] = str.charCodeAt(i + 2) & 0x3f;\n    }\n    for (let j = 0; j < groupsOfSix.length; j++) {\n      if (typeof groupsOfSix[j] === \"undefined\") {\n        out += \"=\";\n      } else {\n        out += KEY_STRING[groupsOfSix[j]];\n      }\n    }\n  }\n  return out;\n}\n","export const UNDEFINED = -1;\nexport const HOLE = -2;\nexport const NAN = -3;\nexport const POSITIVE_INFINITY = -4;\nexport const NEGATIVE_INFINITY = -5;\nexport const NEGATIVE_ZERO = -6;\nexport const SPARSE = -7;\n","import { decode64 } from './base64.js';\nimport {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tSPARSE,\n\tUNDEFINED\n} from './constants.js';\n\n/**\n * Revive a value serialized with `devalue.stringify`\n * @param {string} serialized\n * @param {Record<string, (value: any) => any>} [revivers]\n */\nexport function parse(serialized, revivers) {\n\treturn unflatten(JSON.parse(serialized), revivers);\n}\n\n/**\n * Revive a value flattened with `devalue.stringify`\n * @param {number | any[]} parsed\n * @param {Record<string, (value: any) => any>} [revivers]\n */\nexport function unflatten(parsed, revivers) {\n\tif (typeof parsed === 'number') return hydrate(parsed, true);\n\n\tif (!Array.isArray(parsed) || parsed.length === 0) {\n\t\tthrow new Error('Invalid input');\n\t}\n\n\tconst values = /** @type {any[]} */ (parsed);\n\n\tconst hydrated = Array(values.length);\n\n\t/**\n\t * A set of values currently being hydrated with custom revivers,\n\t * used to detect invalid cyclical dependencies\n\t * @type {Set<number> | null}\n\t */\n\tlet hydrating = null;\n\n\t/**\n\t * @param {number} index\n\t * @returns {any}\n\t */\n\tfunction hydrate(index, standalone = false) {\n\t\tif (index === UNDEFINED) return undefined;\n\t\tif (index === NAN) return NaN;\n\t\tif (index === POSITIVE_INFINITY) return Infinity;\n\t\tif (index === NEGATIVE_INFINITY) return -Infinity;\n\t\tif (index === NEGATIVE_ZERO) return -0;\n\n\t\tif (standalone || typeof index !== 'number') {\n\t\t\tthrow new Error(`Invalid input`);\n\t\t}\n\n\t\tif (index in hydrated) return hydrated[index];\n\n\t\tconst value = values[index];\n\n\t\tif (!value || typeof value !== 'object') {\n\t\t\thydrated[index] = value;\n\t\t} else if (Array.isArray(value)) {\n\t\t\tif (typeof value[0] === 'string') {\n\t\t\t\tconst type = value[0];\n\n\t\t\t\tconst reviver =\n\t\t\t\t\trevivers && Object.hasOwn(revivers, type)\n\t\t\t\t\t\t? revivers[type]\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\tif (reviver) {\n\t\t\t\t\tlet i = value[1];\n\t\t\t\t\tif (typeof i !== 'number') {\n\t\t\t\t\t\t// if it's not a number, it was serialized by a builtin reviver\n\t\t\t\t\t\t// so we need to munge it into the format expected by a custom reviver\n\t\t\t\t\t\ti = values.push(value[1]) - 1;\n\t\t\t\t\t}\n\n\t\t\t\t\thydrating ??= new Set();\n\n\t\t\t\t\tif (hydrating.has(i)) {\n\t\t\t\t\t\tthrow new Error('Invalid circular reference');\n\t\t\t\t\t}\n\n\t\t\t\t\thydrating.add(i);\n\t\t\t\t\thydrated[index] = reviver(hydrate(i));\n\t\t\t\t\thydrating.delete(i);\n\n\t\t\t\t\treturn hydrated[index];\n\t\t\t\t}\n\n\t\t\t\tswitch (type) {\n\t\t\t\t\tcase 'Date':\n\t\t\t\t\t\thydrated[index] = new Date(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Set':\n\t\t\t\t\t\tconst set = new Set();\n\t\t\t\t\t\thydrated[index] = set;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 1) {\n\t\t\t\t\t\t\tset.add(hydrate(value[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Map':\n\t\t\t\t\t\tconst map = new Map();\n\t\t\t\t\t\thydrated[index] = map;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 2) {\n\t\t\t\t\t\t\tmap.set(hydrate(value[i]), hydrate(value[i + 1]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'RegExp':\n\t\t\t\t\t\thydrated[index] = new RegExp(value[1], value[2]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Object':\n\t\t\t\t\t\thydrated[index] = Object(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'BigInt':\n\t\t\t\t\t\thydrated[index] = BigInt(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'null':\n\t\t\t\t\t\tconst obj = Object.create(null);\n\t\t\t\t\t\thydrated[index] = obj;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 2) {\n\t\t\t\t\t\t\tobj[value[i]] = hydrate(value[i + 1]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Int8Array':\n\t\t\t\t\tcase 'Uint8Array':\n\t\t\t\t\tcase 'Uint8ClampedArray':\n\t\t\t\t\tcase 'Int16Array':\n\t\t\t\t\tcase 'Uint16Array':\n\t\t\t\t\tcase 'Int32Array':\n\t\t\t\t\tcase 'Uint32Array':\n\t\t\t\t\tcase 'Float32Array':\n\t\t\t\t\tcase 'Float64Array':\n\t\t\t\t\tcase 'BigInt64Array':\n\t\t\t\t\tcase 'BigUint64Array': {\n\t\t\t\t\t\tif (values[value[1]][0] !== 'ArrayBuffer') {\n\t\t\t\t\t\t\t// without this, if we receive malformed input we could\n\t\t\t\t\t\t\t// end up trying to hydrate in a circle or allocate\n\t\t\t\t\t\t\t// huge amounts of memory when we call `new TypedArrayConstructor(buffer)`\n\t\t\t\t\t\t\tthrow new Error('Invalid data');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst TypedArrayConstructor = globalThis[type];\n\t\t\t\t\t\tconst buffer = hydrate(value[1]);\n\t\t\t\t\t\tconst typedArray = new TypedArrayConstructor(buffer);\n\n\t\t\t\t\t\thydrated[index] =\n\t\t\t\t\t\t\tvalue[2] !== undefined\n\t\t\t\t\t\t\t\t? typedArray.subarray(value[2], value[3])\n\t\t\t\t\t\t\t\t: typedArray;\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'ArrayBuffer': {\n\t\t\t\t\t\tconst base64 = value[1];\n\t\t\t\t\t\tif (typeof base64 !== 'string') {\n\t\t\t\t\t\t\tthrow new Error('Invalid ArrayBuffer encoding');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst arraybuffer = decode64(base64);\n\t\t\t\t\t\thydrated[index] = arraybuffer;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'Temporal.Duration':\n\t\t\t\t\tcase 'Temporal.Instant':\n\t\t\t\t\tcase 'Temporal.PlainDate':\n\t\t\t\t\tcase 'Temporal.PlainTime':\n\t\t\t\t\tcase 'Temporal.PlainDateTime':\n\t\t\t\t\tcase 'Temporal.PlainMonthDay':\n\t\t\t\t\tcase 'Temporal.PlainYearMonth':\n\t\t\t\t\tcase 'Temporal.ZonedDateTime': {\n\t\t\t\t\t\tconst temporalName = type.slice(9);\n\t\t\t\t\t\t// @ts-expect-error TS doesn't know about Temporal yet\n\t\t\t\t\t\thydrated[index] = Temporal[temporalName].from(value[1]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'URL': {\n\t\t\t\t\t\tconst url = new URL(value[1]);\n\t\t\t\t\t\thydrated[index] = url;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'URLSearchParams': {\n\t\t\t\t\t\tconst url = new URLSearchParams(value[1]);\n\t\t\t\t\t\thydrated[index] = url;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error(`Unknown type ${type}`);\n\t\t\t\t}\n\t\t\t} else if (value[0] === SPARSE) {\n\t\t\t\t// Sparse array encoding: [SPARSE, length, idx, val, idx, val, ...]\n\t\t\t\tconst len = value[1];\n\n\t\t\t\tconst array = new Array(len);\n\t\t\t\thydrated[index] = array;\n\n\t\t\t\tfor (let i = 2; i < value.length; i += 2) {\n\t\t\t\t\tconst idx = value[i];\n\t\t\t\t\tarray[idx] = hydrate(value[i + 1]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst array = new Array(value.length);\n\t\t\t\thydrated[index] = array;\n\n\t\t\t\tfor (let i = 0; i < value.length; i += 1) {\n\t\t\t\t\tconst n = value[i];\n\t\t\t\t\tif (n === HOLE) continue;\n\n\t\t\t\t\tarray[i] = hydrate(n);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t/** @type {Record<string, any>} */\n\t\t\tconst object = {};\n\t\t\thydrated[index] = object;\n\n\t\t\tfor (const key of Object.keys(value)) {\n\t\t\t\tif (key === '__proto__') {\n\t\t\t\t\tthrow new Error('Cannot parse an object with a `__proto__` property');\n\t\t\t\t}\n\n\t\t\t\tconst n = value[key];\n\t\t\t\tobject[key] = hydrate(n);\n\t\t\t}\n\t\t}\n\n\t\treturn hydrated[index];\n\t}\n\n\treturn hydrate(0);\n}\n","import {\n\tDevalueError,\n\tenumerable_symbols,\n\tget_type,\n\tis_plain_object,\n\tis_primitive,\n\tstringify_key,\n\tstringify_string,\n\tvalid_array_indices\n} from './utils.js';\nimport {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tSPARSE,\n\tUNDEFINED\n} from './constants.js';\nimport { encode64 } from './base64.js';\n\n/**\n * Turn a value into a JSON string that can be parsed with `devalue.parse`\n * @param {any} value\n * @param {Record<string, (value: any) => any>} [reducers]\n */\nexport function stringify(value, reducers) {\n\t/** @type {any[]} */\n\tconst stringified = [];\n\n\t/** @type {Map<any, number>} */\n\tconst indexes = new Map();\n\n\t/** @type {Array<{ key: string, fn: (value: any) => any }>} */\n\tconst custom = [];\n\tif (reducers) {\n\t\tfor (const key of Object.getOwnPropertyNames(reducers)) {\n\t\t\tcustom.push({ key, fn: reducers[key] });\n\t\t}\n\t}\n\n\t/** @type {string[]} */\n\tconst keys = [];\n\n\tlet p = 0;\n\n\t/** @param {any} thing */\n\tfunction flatten(thing) {\n\t\tif (thing === undefined) return UNDEFINED;\n\t\tif (Number.isNaN(thing)) return NAN;\n\t\tif (thing === Infinity) return POSITIVE_INFINITY;\n\t\tif (thing === -Infinity) return NEGATIVE_INFINITY;\n\t\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;\n\n\t\tif (indexes.has(thing)) return indexes.get(thing);\n\n\t\tconst index = p++;\n\t\tindexes.set(thing, index);\n\n\t\tfor (const { key, fn } of custom) {\n\t\t\tconst value = fn(thing);\n\t\t\tif (value) {\n\t\t\t\tstringified[index] = `[\"${key}\",${flatten(value)}]`;\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\n\t\tif (typeof thing === 'function') {\n\t\t\tthrow new DevalueError(`Cannot stringify a function`, keys, thing, value);\n\t\t}\n\n\t\tlet str = '';\n\n\t\tif (is_primitive(thing)) {\n\t\t\tstr = stringify_primitive(thing);\n\t\t} else {\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\t\tstr = `[\"Object\",${stringify_primitive(thing)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'BigInt':\n\t\t\t\t\tstr = `[\"BigInt\",${thing}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Date':\n\t\t\t\t\tconst valid = !isNaN(thing.getDate());\n\t\t\t\t\tstr = `[\"Date\",\"${valid ? thing.toISOString() : ''}\"]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'URL':\n\t\t\t\t\tstr = `[\"URL\",${stringify_string(thing.toString())}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'URLSearchParams':\n\t\t\t\t\tstr = `[\"URLSearchParams\",${stringify_string(thing.toString())}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\tconst { source, flags } = thing;\n\t\t\t\t\tstr = flags\n\t\t\t\t\t\t? `[\"RegExp\",${stringify_string(source)},\"${flags}\"]`\n\t\t\t\t\t\t: `[\"RegExp\",${stringify_string(source)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Array': {\n\t\t\t\t\t// For dense arrays (no holes), we iterate normally.\n\t\t\t\t\t// When we encounter the first hole, we call Object.keys\n\t\t\t\t\t// to determine the sparseness, then decide between:\n\t\t\t\t\t//   - HOLE encoding: [-2, val, -2, ...] (default)\n\t\t\t\t\t//   - Sparse encoding: [-7, length, idx, val, ...] (for very sparse arrays)\n\t\t\t\t\t// Only the sparse path avoids iterating every slot, which\n\t\t\t\t\t// is what protects against the DoS of e.g. `arr[1000000] = 1`.\n\t\t\t\t\tlet mostly_dense = false;\n\n\t\t\t\t\tstr = '[';\n\n\t\t\t\t\tfor (let i = 0; i < thing.length; i += 1) {\n\t\t\t\t\t\tif (i > 0) str += ',';\n\n\t\t\t\t\t\tif (Object.hasOwn(thing, i)) {\n\t\t\t\t\t\t\tkeys.push(`[${i}]`);\n\t\t\t\t\t\t\tstr += flatten(thing[i]);\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t} else if (mostly_dense) {\n\t\t\t\t\t\t\t// Use dense encoding. The heuristic guarantees the\n\t\t\t\t\t\t\t// array is only mildly sparse, so iterating over every\n\t\t\t\t\t\t\t// slot is fine.\n\t\t\t\t\t\t\tstr += HOLE;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Decide between HOLE encoding and sparse encoding.\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// HOLE encoding: each hole is serialized as the HOLE\n\t\t\t\t\t\t\t// sentinel (-2). For example, [, \"a\", ,] becomes\n\t\t\t\t\t\t\t// [-2, 0, -2]. Each hole costs 3 chars (\"-2\" + comma).\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// Sparse encoding: lists only populated indices.\n\t\t\t\t\t\t\t// For example, [, \"a\", ,] becomes [-7, 3, 1, 0] — the\n\t\t\t\t\t\t\t// -7 sentinel, the array length (3), then index-value\n\t\t\t\t\t\t\t// pairs. This avoids paying per-hole, but each element\n\t\t\t\t\t\t\t// costs extra chars to write its index.\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// The values are the same size either way, so the\n\t\t\t\t\t\t\t// choice comes down to structural overhead:\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t//   HOLE overhead:\n\t\t\t\t\t\t\t//     3 chars per hole (\"-2\" + comma)\n\t\t\t\t\t\t\t//     = (L - P) * 3\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t//   Sparse overhead:\n\t\t\t\t\t\t\t//     \"-7,\"          — 3 chars (sparse sentinel + comma)\n\t\t\t\t\t\t\t//     + length + \",\" — (d + 1) chars (array length + comma)\n\t\t\t\t\t\t\t//     + per element: index + \",\" — (d + 1) chars\n\t\t\t\t\t\t\t//     = (4 + d) + P * (d + 1)\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// where L is the array length, P is the number of\n\t\t\t\t\t\t\t// populated elements, and d is the number of digits\n\t\t\t\t\t\t\t// in L (an upper bound on the digits in any index).\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// Sparse encoding is cheaper when:\n\t\t\t\t\t\t\t//   (4 + d) + P * (d + 1) < (L - P) * 3\n\t\t\t\t\t\t\tconst populated_keys = valid_array_indices(/** @type {any[]} */ (thing));\n\t\t\t\t\t\t\tconst population = populated_keys.length;\n\t\t\t\t\t\t\tconst d = String(thing.length).length;\n\n\t\t\t\t\t\t\tconst hole_cost = (thing.length - population) * 3;\n\t\t\t\t\t\t\tconst sparse_cost = 4 + d + population * (d + 1);\n\n\t\t\t\t\t\t\tif (hole_cost > sparse_cost) {\n\t\t\t\t\t\t\t\tstr = '[' + SPARSE + ',' + thing.length;\n\t\t\t\t\t\t\t\tfor (let j = 0; j < populated_keys.length; j++) {\n\t\t\t\t\t\t\t\t\tconst key = populated_keys[j];\n\t\t\t\t\t\t\t\t\tkeys.push(`[${key}]`);\n\t\t\t\t\t\t\t\t\tstr += ',' + key + ',' + flatten(thing[key]);\n\t\t\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmostly_dense = true;\n\t\t\t\t\t\t\t\tstr += HOLE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tstr = '[\"Set\"';\n\n\t\t\t\t\tfor (const value of thing) {\n\t\t\t\t\t\tstr += `,${flatten(value)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tstr = '[\"Map\"';\n\n\t\t\t\t\tfor (const [key, value] of thing) {\n\t\t\t\t\t\tkeys.push(\n\t\t\t\t\t\t\t`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstr += `,${flatten(key)},${flatten(value)}`;\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Int8Array':\n\t\t\t\tcase 'Uint8Array':\n\t\t\t\tcase 'Uint8ClampedArray':\n\t\t\t\tcase 'Int16Array':\n\t\t\t\tcase 'Uint16Array':\n\t\t\t\tcase 'Int32Array':\n\t\t\t\tcase 'Uint32Array':\n\t\t\t\tcase 'Float32Array':\n\t\t\t\tcase 'Float64Array':\n\t\t\t\tcase 'BigInt64Array':\n\t\t\t\tcase 'BigUint64Array': {\n\t\t\t\t\t/** @type {import(\"./types.js\").TypedArray} */\n\t\t\t\t\tconst typedArray = thing;\n\t\t\t\t\tstr = '[\"' + type + '\",' + flatten(typedArray.buffer);\n\n\t\t\t\t\tconst a = thing.byteOffset;\n\t\t\t\t\tconst b = a + thing.byteLength;\n\n\t\t\t\t\t// handle subarrays\n\t\t\t\t\tif (a > 0 || b !== typedArray.buffer.byteLength) {\n\t\t\t\t\t\tconst m = +/(\\d+)/.exec(type)[1] / 8;\n\t\t\t\t\t\tstr += `,${a / m},${b / m}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'ArrayBuffer': {\n\t\t\t\t\t/** @type {ArrayBuffer} */\n\t\t\t\t\tconst arraybuffer = thing;\n\t\t\t\t\tconst base64 = encode64(arraybuffer);\n\n\t\t\t\t\tstr = `[\"ArrayBuffer\",\"${base64}\"]`;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'Temporal.Duration':\n\t\t\t\tcase 'Temporal.Instant':\n\t\t\t\tcase 'Temporal.PlainDate':\n\t\t\t\tcase 'Temporal.PlainTime':\n\t\t\t\tcase 'Temporal.PlainDateTime':\n\t\t\t\tcase 'Temporal.PlainMonthDay':\n\t\t\t\tcase 'Temporal.PlainYearMonth':\n\t\t\t\tcase 'Temporal.ZonedDateTime':\n\t\t\t\t\tstr = `[\"${type}\",${stringify_string(thing.toString())}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (!is_plain_object(thing)) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify arbitrary non-POJOs`,\n\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (enumerable_symbols(thing).length > 0) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify POJOs with symbolic keys`,\n\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getPrototypeOf(thing) === null) {\n\t\t\t\t\t\tstr = '[\"null\"';\n\t\t\t\t\t\tfor (const key of Object.keys(thing)) {\n\t\t\t\t\t\t\tif (key === '__proto__') {\n\t\t\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t\t\t`Cannot stringify objects with __proto__ keys`,\n\t\t\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tkeys.push(stringify_key(key));\n\t\t\t\t\t\t\tstr += `,${stringify_string(key)},${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += ']';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstr = '{';\n\t\t\t\t\t\tlet started = false;\n\t\t\t\t\t\tfor (const key of Object.keys(thing)) {\n\t\t\t\t\t\t\tif (key === '__proto__') {\n\t\t\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t\t\t`Cannot stringify objects with __proto__ keys`,\n\t\t\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (started) str += ',';\n\t\t\t\t\t\t\tstarted = true;\n\t\t\t\t\t\t\tkeys.push(stringify_key(key));\n\t\t\t\t\t\t\tstr += `${stringify_string(key)}:${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += '}';\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstringified[index] = str;\n\t\treturn index;\n\t}\n\n\tconst index = flatten(value);\n\n\t// special case — value is represented as a negative index\n\tif (index < 0) return `${index}`;\n\n\treturn `[${stringified.join(',')}]`;\n}\n\n/**\n * @param {any} thing\n * @returns {string}\n */\nfunction stringify_primitive(thing) {\n\tconst type = typeof thing;\n\tif (type === 'string') return stringify_string(thing);\n\tif (thing instanceof String) return stringify_string(thing.toString());\n\tif (thing === void 0) return UNDEFINED.toString();\n\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();\n\tif (type === 'bigint') return `[\"BigInt\",\"${thing}\"]`;\n\treturn String(thing);\n}\n","import net from 'node:net';\nimport os from 'node:os';\n\nclass Locked extends Error {\n\tconstructor(port) {\n\t\tsuper(`${port} is locked`);\n\t}\n}\n\nconst lockedPorts = {\n\told: new Set(),\n\tyoung: new Set(),\n};\n\n// On this interval, the old locked ports are discarded,\n// the young locked ports are moved to old locked ports,\n// and a new young set for locked ports are created.\nconst releaseOldLockedPortsIntervalMs = 1000 * 15;\n\nconst minPort = 1024;\nconst maxPort = 65_535;\n\n// Lazily create timeout on first use\nlet timeout;\n\nconst getLocalHosts = () => {\n\tconst interfaces = os.networkInterfaces();\n\n\t// Add undefined value for createServer function to use default host,\n\t// and default IPv4 host in case createServer defaults to IPv6.\n\tconst results = new Set([undefined, '0.0.0.0']);\n\n\tfor (const _interface of Object.values(interfaces)) {\n\t\tfor (const config of _interface) {\n\t\t\tresults.add(config.address);\n\t\t}\n\t}\n\n\treturn results;\n};\n\nconst checkAvailablePort = options =>\n\tnew Promise((resolve, reject) => {\n\t\tconst server = net.createServer();\n\t\tserver.unref();\n\t\tserver.on('error', reject);\n\n\t\tserver.listen(options, () => {\n\t\t\tconst {port} = server.address();\n\t\t\tserver.close(() => {\n\t\t\t\tresolve(port);\n\t\t\t});\n\t\t});\n\t});\n\nconst getAvailablePort = async (options, hosts) => {\n\tif (options.host || options.port === 0) {\n\t\treturn checkAvailablePort(options);\n\t}\n\n\tfor (const host of hosts) {\n\t\ttry {\n\t\t\tawait checkAvailablePort({port: options.port, host}); // eslint-disable-line no-await-in-loop\n\t\t} catch (error) {\n\t\t\tif (!['EADDRNOTAVAIL', 'EINVAL'].includes(error.code)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn options.port;\n};\n\nconst portCheckSequence = function * (ports) {\n\tif (ports) {\n\t\tyield * ports;\n\t}\n\n\tyield 0; // Fall back to 0 if anything else failed\n};\n\nexport default async function getPorts(options) {\n\tlet ports;\n\tlet exclude = new Set();\n\n\tif (options) {\n\t\tif (options.port) {\n\t\t\tports = typeof options.port === 'number' ? [options.port] : options.port;\n\t\t}\n\n\t\tif (options.exclude) {\n\t\t\tconst excludeIterable = options.exclude;\n\n\t\t\tif (typeof excludeIterable[Symbol.iterator] !== 'function') {\n\t\t\t\tthrow new TypeError('The `exclude` option must be an iterable.');\n\t\t\t}\n\n\t\t\tfor (const element of excludeIterable) {\n\t\t\t\tif (typeof element !== 'number') {\n\t\t\t\t\tthrow new TypeError('Each item in the `exclude` option must be a number corresponding to the port you want excluded.');\n\t\t\t\t}\n\n\t\t\t\tif (!Number.isSafeInteger(element)) {\n\t\t\t\t\tthrow new TypeError(`Number ${element} in the exclude option is not a safe integer and can't be used`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\texclude = new Set(excludeIterable);\n\t\t}\n\t}\n\n\tif (timeout === undefined) {\n\t\ttimeout = setTimeout(() => {\n\t\t\ttimeout = undefined;\n\n\t\t\tlockedPorts.old = lockedPorts.young;\n\t\t\tlockedPorts.young = new Set();\n\t\t}, releaseOldLockedPortsIntervalMs);\n\n\t\t// Does not exist in some environments (Electron, Jest jsdom env, browser, etc).\n\t\tif (timeout.unref) {\n\t\t\ttimeout.unref();\n\t\t}\n\t}\n\n\tconst hosts = getLocalHosts();\n\n\tfor (const port of portCheckSequence(ports)) {\n\t\ttry {\n\t\t\tif (exclude.has(port)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet availablePort = await getAvailablePort({...options, port}, hosts); // eslint-disable-line no-await-in-loop\n\t\t\twhile (lockedPorts.old.has(availablePort) || lockedPorts.young.has(availablePort)) {\n\t\t\t\tif (port !== 0) {\n\t\t\t\t\tthrow new Locked(port);\n\t\t\t\t}\n\n\t\t\t\tavailablePort = await getAvailablePort({...options, port}, hosts); // eslint-disable-line no-await-in-loop\n\t\t\t}\n\n\t\t\tlockedPorts.young.add(availablePort);\n\n\t\t\treturn availablePort;\n\t\t} catch (error) {\n\t\t\tif (!['EADDRINUSE', 'EACCES'].includes(error.code) && !(error instanceof Locked)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow new Error('No available ports found');\n}\n\nexport function portNumbers(from, to) {\n\tif (!Number.isInteger(from) || !Number.isInteger(to)) {\n\t\tthrow new TypeError('`from` and `to` must be integer numbers');\n\t}\n\n\tif (from < minPort || from > maxPort) {\n\t\tthrow new RangeError(`'from' must be between ${minPort} and ${maxPort}`);\n\t}\n\n\tif (to < minPort || to > maxPort) {\n\t\tthrow new RangeError(`'to' must be between ${minPort} and ${maxPort}`);\n\t}\n\n\tif (from > to) {\n\t\tthrow new RangeError('`to` must be greater than or equal to `from`');\n\t}\n\n\tconst generator = function * (from, to) {\n\t\tfor (let port = from; port <= to; port++) {\n\t\t\tyield port;\n\t\t}\n\t};\n\n\treturn generator(from, to);\n}\n\nexport function clearLockedPorts() {\n\tlockedPorts.old.clear();\n\tlockedPorts.young.clear();\n}\n","class LRUCache {\n  constructor () {\n    this.max = 1000\n    this.map = new Map()\n  }\n\n  get (key) {\n    const value = this.map.get(key)\n    if (value === undefined) {\n      return undefined\n    } else {\n      // Remove the key from the map and add it to the end\n      this.map.delete(key)\n      this.map.set(key, value)\n      return value\n    }\n  }\n\n  delete (key) {\n    return this.map.delete(key)\n  }\n\n  set (key, value) {\n    const deleted = this.delete(key)\n\n    if (!deleted && value !== undefined) {\n      // If cache is full, delete the least recently used item\n      if (this.map.size >= this.max) {\n        const firstKey = this.map.keys().next().value\n        this.delete(firstKey)\n      }\n\n      this.map.set(key, value)\n    }\n\n    return this\n  }\n}\n\nmodule.exports = LRUCache\n","// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n  if (!options) {\n    return emptyOpts\n  }\n\n  if (typeof options !== 'object') {\n    return looseOption\n  }\n\n  return options\n}\nmodule.exports = parseOptions\n","// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n  'major',\n  'premajor',\n  'minor',\n  'preminor',\n  'patch',\n  'prepatch',\n  'prerelease',\n]\n\nmodule.exports = {\n  MAX_LENGTH,\n  MAX_SAFE_COMPONENT_LENGTH,\n  MAX_SAFE_BUILD_LENGTH,\n  MAX_SAFE_INTEGER,\n  RELEASE_TYPES,\n  SEMVER_SPEC_VERSION,\n  FLAG_INCLUDE_PRERELEASE: 0b001,\n  FLAG_LOOSE: 0b010,\n}\n","const debug = (\n  typeof process === 'object' &&\n  process.env &&\n  process.env.NODE_DEBUG &&\n  /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n  : () => {}\n\nmodule.exports = debug\n","const {\n  MAX_SAFE_COMPONENT_LENGTH,\n  MAX_SAFE_BUILD_LENGTH,\n  MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n  ['\\\\s', 1],\n  ['\\\\d', MAX_LENGTH],\n  [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n  for (const [token, max] of safeRegexReplacements) {\n    value = value\n      .split(`${token}*`).join(`${token}{0,${max}}`)\n      .split(`${token}+`).join(`${token}{1,${max}}`)\n  }\n  return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n  const safe = makeSafeRegex(value)\n  const index = R++\n  debug(name, index, value)\n  t[name] = index\n  src[index] = value\n  safeSrc[index] = safe\n  re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n  safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n                   `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n                   `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n                        `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n                        `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]\n}|${src[t.NONNUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]\n}|${src[t.NONNUMERICIDENTIFIER]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups.  The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n  src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n  src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n                   `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n                   `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n                   `(?:${src[t.PRERELEASE]})?${\n                     src[t.BUILD]}?` +\n                   `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n                        `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n                        `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n                        `(?:${src[t.PRERELEASELOOSE]})?${\n                          src[t.BUILD]}?` +\n                        `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n              '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n              `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n              `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n              `(?:${src[t.PRERELEASE]})?` +\n              `(?:${src[t.BUILD]})?` +\n              `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n                   `\\\\s+-\\\\s+` +\n                   `(${src[t.XRANGEPLAIN]})` +\n                   `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n                        `\\\\s+-\\\\s+` +\n                        `(${src[t.XRANGEPLAINLOOSE]})` +\n                        `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","const numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n  const anum = numeric.test(a)\n  const bnum = numeric.test(b)\n\n  if (anum && bnum) {\n    a = +a\n    b = +b\n  }\n\n  return a === b ? 0\n    : (anum && !bnum) ? -1\n    : (bnum && !anum) ? 1\n    : a < b ? -1\n    : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n  compareIdentifiers,\n  rcompareIdentifiers,\n}\n","const debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, safeSrc: src, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\nclass SemVer {\n  constructor (version, options) {\n    options = parseOptions(options)\n\n    if (version instanceof SemVer) {\n      if (version.loose === !!options.loose &&\n        version.includePrerelease === !!options.includePrerelease) {\n        return version\n      } else {\n        version = version.version\n      }\n    } else if (typeof version !== 'string') {\n      throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n    }\n\n    if (version.length > MAX_LENGTH) {\n      throw new TypeError(\n        `version is longer than ${MAX_LENGTH} characters`\n      )\n    }\n\n    debug('SemVer', version, options)\n    this.options = options\n    this.loose = !!options.loose\n    // this isn't actually relevant for versions, but keep it so that we\n    // don't run into trouble passing this.options around.\n    this.includePrerelease = !!options.includePrerelease\n\n    const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n    if (!m) {\n      throw new TypeError(`Invalid Version: ${version}`)\n    }\n\n    this.raw = version\n\n    // these are actually numbers\n    this.major = +m[1]\n    this.minor = +m[2]\n    this.patch = +m[3]\n\n    if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n      throw new TypeError('Invalid major version')\n    }\n\n    if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n      throw new TypeError('Invalid minor version')\n    }\n\n    if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n      throw new TypeError('Invalid patch version')\n    }\n\n    // numberify any prerelease numeric ids\n    if (!m[4]) {\n      this.prerelease = []\n    } else {\n      this.prerelease = m[4].split('.').map((id) => {\n        if (/^[0-9]+$/.test(id)) {\n          const num = +id\n          if (num >= 0 && num < MAX_SAFE_INTEGER) {\n            return num\n          }\n        }\n        return id\n      })\n    }\n\n    this.build = m[5] ? m[5].split('.') : []\n    this.format()\n  }\n\n  format () {\n    this.version = `${this.major}.${this.minor}.${this.patch}`\n    if (this.prerelease.length) {\n      this.version += `-${this.prerelease.join('.')}`\n    }\n    return this.version\n  }\n\n  toString () {\n    return this.version\n  }\n\n  compare (other) {\n    debug('SemVer.compare', this.version, this.options, other)\n    if (!(other instanceof SemVer)) {\n      if (typeof other === 'string' && other === this.version) {\n        return 0\n      }\n      other = new SemVer(other, this.options)\n    }\n\n    if (other.version === this.version) {\n      return 0\n    }\n\n    return this.compareMain(other) || this.comparePre(other)\n  }\n\n  compareMain (other) {\n    if (!(other instanceof SemVer)) {\n      other = new SemVer(other, this.options)\n    }\n\n    return (\n      compareIdentifiers(this.major, other.major) ||\n      compareIdentifiers(this.minor, other.minor) ||\n      compareIdentifiers(this.patch, other.patch)\n    )\n  }\n\n  comparePre (other) {\n    if (!(other instanceof SemVer)) {\n      other = new SemVer(other, this.options)\n    }\n\n    // NOT having a prerelease is > having one\n    if (this.prerelease.length && !other.prerelease.length) {\n      return -1\n    } else if (!this.prerelease.length && other.prerelease.length) {\n      return 1\n    } else if (!this.prerelease.length && !other.prerelease.length) {\n      return 0\n    }\n\n    let i = 0\n    do {\n      const a = this.prerelease[i]\n      const b = other.prerelease[i]\n      debug('prerelease compare', i, a, b)\n      if (a === undefined && b === undefined) {\n        return 0\n      } else if (b === undefined) {\n        return 1\n      } else if (a === undefined) {\n        return -1\n      } else if (a === b) {\n        continue\n      } else {\n        return compareIdentifiers(a, b)\n      }\n    } while (++i)\n  }\n\n  compareBuild (other) {\n    if (!(other instanceof SemVer)) {\n      other = new SemVer(other, this.options)\n    }\n\n    let i = 0\n    do {\n      const a = this.build[i]\n      const b = other.build[i]\n      debug('build compare', i, a, b)\n      if (a === undefined && b === undefined) {\n        return 0\n      } else if (b === undefined) {\n        return 1\n      } else if (a === undefined) {\n        return -1\n      } else if (a === b) {\n        continue\n      } else {\n        return compareIdentifiers(a, b)\n      }\n    } while (++i)\n  }\n\n  // preminor will bump the version up to the next minor release, and immediately\n  // down to pre-release. premajor and prepatch work the same way.\n  inc (release, identifier, identifierBase) {\n    if (release.startsWith('pre')) {\n      if (!identifier && identifierBase === false) {\n        throw new Error('invalid increment argument: identifier is empty')\n      }\n      // Avoid an invalid semver results\n      if (identifier) {\n        const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`)\n        const match = `-${identifier}`.match(r)\n        if (!match || match[1] !== identifier) {\n          throw new Error(`invalid identifier: ${identifier}`)\n        }\n      }\n    }\n\n    switch (release) {\n      case 'premajor':\n        this.prerelease.length = 0\n        this.patch = 0\n        this.minor = 0\n        this.major++\n        this.inc('pre', identifier, identifierBase)\n        break\n      case 'preminor':\n        this.prerelease.length = 0\n        this.patch = 0\n        this.minor++\n        this.inc('pre', identifier, identifierBase)\n        break\n      case 'prepatch':\n        // If this is already a prerelease, it will bump to the next version\n        // drop any prereleases that might already exist, since they are not\n        // relevant at this point.\n        this.prerelease.length = 0\n        this.inc('patch', identifier, identifierBase)\n        this.inc('pre', identifier, identifierBase)\n        break\n      // If the input is a non-prerelease version, this acts the same as\n      // prepatch.\n      case 'prerelease':\n        if (this.prerelease.length === 0) {\n          this.inc('patch', identifier, identifierBase)\n        }\n        this.inc('pre', identifier, identifierBase)\n        break\n      case 'release':\n        if (this.prerelease.length === 0) {\n          throw new Error(`version ${this.raw} is not a prerelease`)\n        }\n        this.prerelease.length = 0\n        break\n\n      case 'major':\n        // If this is a pre-major version, bump up to the same major version.\n        // Otherwise increment major.\n        // 1.0.0-5 bumps to 1.0.0\n        // 1.1.0 bumps to 2.0.0\n        if (\n          this.minor !== 0 ||\n          this.patch !== 0 ||\n          this.prerelease.length === 0\n        ) {\n          this.major++\n        }\n        this.minor = 0\n        this.patch = 0\n        this.prerelease = []\n        break\n      case 'minor':\n        // If this is a pre-minor version, bump up to the same minor version.\n        // Otherwise increment minor.\n        // 1.2.0-5 bumps to 1.2.0\n        // 1.2.1 bumps to 1.3.0\n        if (this.patch !== 0 || this.prerelease.length === 0) {\n          this.minor++\n        }\n        this.patch = 0\n        this.prerelease = []\n        break\n      case 'patch':\n        // If this is not a pre-release version, it will increment the patch.\n        // If it is a pre-release it will bump up to the same patch version.\n        // 1.2.0-5 patches to 1.2.0\n        // 1.2.0 patches to 1.2.1\n        if (this.prerelease.length === 0) {\n          this.patch++\n        }\n        this.prerelease = []\n        break\n      // This probably shouldn't be used publicly.\n      // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n      case 'pre': {\n        const base = Number(identifierBase) ? 1 : 0\n\n        if (this.prerelease.length === 0) {\n          this.prerelease = [base]\n        } else {\n          let i = this.prerelease.length\n          while (--i >= 0) {\n            if (typeof this.prerelease[i] === 'number') {\n              this.prerelease[i]++\n              i = -2\n            }\n          }\n          if (i === -1) {\n            // didn't increment anything\n            if (identifier === this.prerelease.join('.') && identifierBase === false) {\n              throw new Error('invalid increment argument: identifier already exists')\n            }\n            this.prerelease.push(base)\n          }\n        }\n        if (identifier) {\n          // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n          // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n          let prerelease = [identifier, base]\n          if (identifierBase === false) {\n            prerelease = [identifier]\n          }\n          if (compareIdentifiers(this.prerelease[0], identifier) === 0) {\n            if (isNaN(this.prerelease[1])) {\n              this.prerelease = prerelease\n            }\n          } else {\n            this.prerelease = prerelease\n          }\n        }\n        break\n      }\n      default:\n        throw new Error(`invalid increment argument: ${release}`)\n    }\n    this.raw = this.format()\n    if (this.build.length) {\n      this.raw += `+${this.build.join('.')}`\n    }\n    return this\n  }\n}\n\nmodule.exports = SemVer\n","const SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n  new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","const compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","const compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","const compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","const compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","const compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","const compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","const eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n  switch (op) {\n    case '===':\n      if (typeof a === 'object') {\n        a = a.version\n      }\n      if (typeof b === 'object') {\n        b = b.version\n      }\n      return a === b\n\n    case '!==':\n      if (typeof a === 'object') {\n        a = a.version\n      }\n      if (typeof b === 'object') {\n        b = b.version\n      }\n      return a !== b\n\n    case '':\n    case '=':\n    case '==':\n      return eq(a, b, loose)\n\n    case '!=':\n      return neq(a, b, loose)\n\n    case '>':\n      return gt(a, b, loose)\n\n    case '>=':\n      return gte(a, b, loose)\n\n    case '<':\n      return lt(a, b, loose)\n\n    case '<=':\n      return lte(a, b, loose)\n\n    default:\n      throw new TypeError(`Invalid operator: ${op}`)\n  }\n}\nmodule.exports = cmp\n","const ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n  static get ANY () {\n    return ANY\n  }\n\n  constructor (comp, options) {\n    options = parseOptions(options)\n\n    if (comp instanceof Comparator) {\n      if (comp.loose === !!options.loose) {\n        return comp\n      } else {\n        comp = comp.value\n      }\n    }\n\n    comp = comp.trim().split(/\\s+/).join(' ')\n    debug('comparator', comp, options)\n    this.options = options\n    this.loose = !!options.loose\n    this.parse(comp)\n\n    if (this.semver === ANY) {\n      this.value = ''\n    } else {\n      this.value = this.operator + this.semver.version\n    }\n\n    debug('comp', this)\n  }\n\n  parse (comp) {\n    const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n    const m = comp.match(r)\n\n    if (!m) {\n      throw new TypeError(`Invalid comparator: ${comp}`)\n    }\n\n    this.operator = m[1] !== undefined ? m[1] : ''\n    if (this.operator === '=') {\n      this.operator = ''\n    }\n\n    // if it literally is just '>' or '' then allow anything.\n    if (!m[2]) {\n      this.semver = ANY\n    } else {\n      this.semver = new SemVer(m[2], this.options.loose)\n    }\n  }\n\n  toString () {\n    return this.value\n  }\n\n  test (version) {\n    debug('Comparator.test', version, this.options.loose)\n\n    if (this.semver === ANY || version === ANY) {\n      return true\n    }\n\n    if (typeof version === 'string') {\n      try {\n        version = new SemVer(version, this.options)\n      } catch (er) {\n        return false\n      }\n    }\n\n    return cmp(version, this.operator, this.semver, this.options)\n  }\n\n  intersects (comp, options) {\n    if (!(comp instanceof Comparator)) {\n      throw new TypeError('a Comparator is required')\n    }\n\n    if (this.operator === '') {\n      if (this.value === '') {\n        return true\n      }\n      return new Range(comp.value, options).test(this.value)\n    } else if (comp.operator === '') {\n      if (comp.value === '') {\n        return true\n      }\n      return new Range(this.value, options).test(comp.semver)\n    }\n\n    options = parseOptions(options)\n\n    // Special cases where nothing can possibly be lower\n    if (options.includePrerelease &&\n      (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n      return false\n    }\n    if (!options.includePrerelease &&\n      (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n      return false\n    }\n\n    // Same direction increasing (> or >=)\n    if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n      return true\n    }\n    // Same direction decreasing (< or <=)\n    if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n      return true\n    }\n    // same SemVer and both sides are inclusive (<= or >=)\n    if (\n      (this.semver.version === comp.semver.version) &&\n      this.operator.includes('=') && comp.operator.includes('=')) {\n      return true\n    }\n    // opposite directions less than\n    if (cmp(this.semver, '<', comp.semver, options) &&\n      this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n      return true\n    }\n    // opposite directions greater than\n    if (cmp(this.semver, '>', comp.semver, options) &&\n      this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n      return true\n    }\n    return false\n  }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","const SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n  constructor (range, options) {\n    options = parseOptions(options)\n\n    if (range instanceof Range) {\n      if (\n        range.loose === !!options.loose &&\n        range.includePrerelease === !!options.includePrerelease\n      ) {\n        return range\n      } else {\n        return new Range(range.raw, options)\n      }\n    }\n\n    if (range instanceof Comparator) {\n      // just put it in the set and return\n      this.raw = range.value\n      this.set = [[range]]\n      this.formatted = undefined\n      return this\n    }\n\n    this.options = options\n    this.loose = !!options.loose\n    this.includePrerelease = !!options.includePrerelease\n\n    // First reduce all whitespace as much as possible so we do not have to rely\n    // on potentially slow regexes like \\s*. This is then stored and used for\n    // future error messages as well.\n    this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n    // First, split on ||\n    this.set = this.raw\n      .split('||')\n      // map the range to a 2d array of comparators\n      .map(r => this.parseRange(r.trim()))\n      // throw out any comparator lists that are empty\n      // this generally means that it was not a valid range, which is allowed\n      // in loose mode, but will still throw if the WHOLE range is invalid.\n      .filter(c => c.length)\n\n    if (!this.set.length) {\n      throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n    }\n\n    // if we have any that are not the null set, throw out null sets.\n    if (this.set.length > 1) {\n      // keep the first one, in case they're all null sets\n      const first = this.set[0]\n      this.set = this.set.filter(c => !isNullSet(c[0]))\n      if (this.set.length === 0) {\n        this.set = [first]\n      } else if (this.set.length > 1) {\n        // if we have any that are *, then the range is just *\n        for (const c of this.set) {\n          if (c.length === 1 && isAny(c[0])) {\n            this.set = [c]\n            break\n          }\n        }\n      }\n    }\n\n    this.formatted = undefined\n  }\n\n  get range () {\n    if (this.formatted === undefined) {\n      this.formatted = ''\n      for (let i = 0; i < this.set.length; i++) {\n        if (i > 0) {\n          this.formatted += '||'\n        }\n        const comps = this.set[i]\n        for (let k = 0; k < comps.length; k++) {\n          if (k > 0) {\n            this.formatted += ' '\n          }\n          this.formatted += comps[k].toString().trim()\n        }\n      }\n    }\n    return this.formatted\n  }\n\n  format () {\n    return this.range\n  }\n\n  toString () {\n    return this.range\n  }\n\n  parseRange (range) {\n    // memoize range parsing for performance.\n    // this is a very hot path, and fully deterministic.\n    const memoOpts =\n      (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n      (this.options.loose && FLAG_LOOSE)\n    const memoKey = memoOpts + ':' + range\n    const cached = cache.get(memoKey)\n    if (cached) {\n      return cached\n    }\n\n    const loose = this.options.loose\n    // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n    const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n    range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n    debug('hyphen replace', range)\n\n    // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n    range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n    debug('comparator trim', range)\n\n    // `~ 1.2.3` => `~1.2.3`\n    range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n    debug('tilde trim', range)\n\n    // `^ 1.2.3` => `^1.2.3`\n    range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n    debug('caret trim', range)\n\n    // At this point, the range is completely trimmed and\n    // ready to be split into comparators.\n\n    let rangeList = range\n      .split(' ')\n      .map(comp => parseComparator(comp, this.options))\n      .join(' ')\n      .split(/\\s+/)\n      // >=0.0.0 is equivalent to *\n      .map(comp => replaceGTE0(comp, this.options))\n\n    if (loose) {\n      // in loose mode, throw out any that are not valid comparators\n      rangeList = rangeList.filter(comp => {\n        debug('loose invalid filter', comp, this.options)\n        return !!comp.match(re[t.COMPARATORLOOSE])\n      })\n    }\n    debug('range list', rangeList)\n\n    // if any comparators are the null set, then replace with JUST null set\n    // if more than one comparator, remove any * comparators\n    // also, don't include the same comparator more than once\n    const rangeMap = new Map()\n    const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n    for (const comp of comparators) {\n      if (isNullSet(comp)) {\n        return [comp]\n      }\n      rangeMap.set(comp.value, comp)\n    }\n    if (rangeMap.size > 1 && rangeMap.has('')) {\n      rangeMap.delete('')\n    }\n\n    const result = [...rangeMap.values()]\n    cache.set(memoKey, result)\n    return result\n  }\n\n  intersects (range, options) {\n    if (!(range instanceof Range)) {\n      throw new TypeError('a Range is required')\n    }\n\n    return this.set.some((thisComparators) => {\n      return (\n        isSatisfiable(thisComparators, options) &&\n        range.set.some((rangeComparators) => {\n          return (\n            isSatisfiable(rangeComparators, options) &&\n            thisComparators.every((thisComparator) => {\n              return rangeComparators.every((rangeComparator) => {\n                return thisComparator.intersects(rangeComparator, options)\n              })\n            })\n          )\n        })\n      )\n    })\n  }\n\n  // if ANY of the sets match ALL of its comparators, then pass\n  test (version) {\n    if (!version) {\n      return false\n    }\n\n    if (typeof version === 'string') {\n      try {\n        version = new SemVer(version, this.options)\n      } catch (er) {\n        return false\n      }\n    }\n\n    for (let i = 0; i < this.set.length; i++) {\n      if (testSet(this.set[i], version, this.options)) {\n        return true\n      }\n    }\n    return false\n  }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n  safeRe: re,\n  t,\n  comparatorTrimReplace,\n  tildeTrimReplace,\n  caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n  let result = true\n  const remainingComparators = comparators.slice()\n  let testComparator = remainingComparators.pop()\n\n  while (result && remainingComparators.length) {\n    result = remainingComparators.every((otherComparator) => {\n      return testComparator.intersects(otherComparator, options)\n    })\n\n    testComparator = remainingComparators.pop()\n  }\n\n  return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n  debug('comp', comp, options)\n  comp = replaceCarets(comp, options)\n  debug('caret', comp)\n  comp = replaceTildes(comp, options)\n  debug('tildes', comp)\n  comp = replaceXRanges(comp, options)\n  debug('xrange', comp)\n  comp = replaceStars(comp, options)\n  debug('stars', comp)\n  return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n  return comp\n    .trim()\n    .split(/\\s+/)\n    .map((c) => replaceTilde(c, options))\n    .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n  return comp.replace(r, (_, M, m, p, pr) => {\n    debug('tilde', comp, _, M, m, p, pr)\n    let ret\n\n    if (isX(M)) {\n      ret = ''\n    } else if (isX(m)) {\n      ret = `>=${M}.0.0 <${+M + 1}.0.0-0`\n    } else if (isX(p)) {\n      // ~1.2 == >=1.2.0 <1.3.0-0\n      ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`\n    } else if (pr) {\n      debug('replaceTilde pr', pr)\n      ret = `>=${M}.${m}.${p}-${pr\n      } <${M}.${+m + 1}.0-0`\n    } else {\n      // ~1.2.3 == >=1.2.3 <1.3.0-0\n      ret = `>=${M}.${m}.${p\n      } <${M}.${+m + 1}.0-0`\n    }\n\n    debug('tilde return', ret)\n    return ret\n  })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n  return comp\n    .trim()\n    .split(/\\s+/)\n    .map((c) => replaceCaret(c, options))\n    .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n  debug('caret', comp, options)\n  const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n  const z = options.includePrerelease ? '-0' : ''\n  return comp.replace(r, (_, M, m, p, pr) => {\n    debug('caret', comp, _, M, m, p, pr)\n    let ret\n\n    if (isX(M)) {\n      ret = ''\n    } else if (isX(m)) {\n      ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n    } else if (isX(p)) {\n      if (M === '0') {\n        ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n      } else {\n        ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n      }\n    } else if (pr) {\n      debug('replaceCaret pr', pr)\n      if (M === '0') {\n        if (m === '0') {\n          ret = `>=${M}.${m}.${p}-${pr\n          } <${M}.${m}.${+p + 1}-0`\n        } else {\n          ret = `>=${M}.${m}.${p}-${pr\n          } <${M}.${+m + 1}.0-0`\n        }\n      } else {\n        ret = `>=${M}.${m}.${p}-${pr\n        } <${+M + 1}.0.0-0`\n      }\n    } else {\n      debug('no pr')\n      if (M === '0') {\n        if (m === '0') {\n          ret = `>=${M}.${m}.${p\n          }${z} <${M}.${m}.${+p + 1}-0`\n        } else {\n          ret = `>=${M}.${m}.${p\n          }${z} <${M}.${+m + 1}.0-0`\n        }\n      } else {\n        ret = `>=${M}.${m}.${p\n        } <${+M + 1}.0.0-0`\n      }\n    }\n\n    debug('caret return', ret)\n    return ret\n  })\n}\n\nconst replaceXRanges = (comp, options) => {\n  debug('replaceXRanges', comp, options)\n  return comp\n    .split(/\\s+/)\n    .map((c) => replaceXRange(c, options))\n    .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n  comp = comp.trim()\n  const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n  return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n    debug('xRange', comp, ret, gtlt, M, m, p, pr)\n    const xM = isX(M)\n    const xm = xM || isX(m)\n    const xp = xm || isX(p)\n    const anyX = xp\n\n    if (gtlt === '=' && anyX) {\n      gtlt = ''\n    }\n\n    // if we're including prereleases in the match, then we need\n    // to fix this to -0, the lowest possible prerelease value\n    pr = options.includePrerelease ? '-0' : ''\n\n    if (xM) {\n      if (gtlt === '>' || gtlt === '<') {\n        // nothing is allowed\n        ret = '<0.0.0-0'\n      } else {\n        // nothing is forbidden\n        ret = '*'\n      }\n    } else if (gtlt && anyX) {\n      // we know patch is an x, because we have any x at all.\n      // replace X with 0\n      if (xm) {\n        m = 0\n      }\n      p = 0\n\n      if (gtlt === '>') {\n        // >1 => >=2.0.0\n        // >1.2 => >=1.3.0\n        gtlt = '>='\n        if (xm) {\n          M = +M + 1\n          m = 0\n          p = 0\n        } else {\n          m = +m + 1\n          p = 0\n        }\n      } else if (gtlt === '<=') {\n        // <=0.7.x is actually <0.8.0, since any 0.7.x should\n        // pass.  Similarly, <=7.x is actually <8.0.0, etc.\n        gtlt = '<'\n        if (xm) {\n          M = +M + 1\n        } else {\n          m = +m + 1\n        }\n      }\n\n      if (gtlt === '<') {\n        pr = '-0'\n      }\n\n      ret = `${gtlt + M}.${m}.${p}${pr}`\n    } else if (xm) {\n      ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n    } else if (xp) {\n      ret = `>=${M}.${m}.0${pr\n      } <${M}.${+m + 1}.0-0`\n    }\n\n    debug('xRange return', ret)\n\n    return ret\n  })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n  debug('replaceStars', comp, options)\n  // Looseness is ignored here.  star is always as loose as it gets!\n  return comp\n    .trim()\n    .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n  debug('replaceGTE0', comp, options)\n  return comp\n    .trim()\n    .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n  from, fM, fm, fp, fpr, fb,\n  to, tM, tm, tp, tpr) => {\n  if (isX(fM)) {\n    from = ''\n  } else if (isX(fm)) {\n    from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n  } else if (isX(fp)) {\n    from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n  } else if (fpr) {\n    from = `>=${from}`\n  } else {\n    from = `>=${from}${incPr ? '-0' : ''}`\n  }\n\n  if (isX(tM)) {\n    to = ''\n  } else if (isX(tm)) {\n    to = `<${+tM + 1}.0.0-0`\n  } else if (isX(tp)) {\n    to = `<${tM}.${+tm + 1}.0-0`\n  } else if (tpr) {\n    to = `<=${tM}.${tm}.${tp}-${tpr}`\n  } else if (incPr) {\n    to = `<${tM}.${tm}.${+tp + 1}-0`\n  } else {\n    to = `<=${to}`\n  }\n\n  return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n  for (let i = 0; i < set.length; i++) {\n    if (!set[i].test(version)) {\n      return false\n    }\n  }\n\n  if (version.prerelease.length && !options.includePrerelease) {\n    // Find the set of versions that are allowed to have prereleases\n    // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n    // That should allow `1.2.3-pr.2` to pass.\n    // However, `1.2.4-alpha.notready` should NOT be allowed,\n    // even though it's within the range set by the comparators.\n    for (let i = 0; i < set.length; i++) {\n      debug(set[i].semver)\n      if (set[i].semver === Comparator.ANY) {\n        continue\n      }\n\n      if (set[i].semver.prerelease.length > 0) {\n        const allowed = set[i].semver\n        if (allowed.major === version.major &&\n            allowed.minor === version.minor &&\n            allowed.patch === version.patch) {\n          return true\n        }\n      }\n    }\n\n    // Version has a -pre, but it's not one of the ones we like.\n    return false\n  }\n\n  return true\n}\n","const Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n  try {\n    range = new Range(range, options)\n  } catch (er) {\n    return false\n  }\n  return range.test(version)\n}\nmodule.exports = satisfies\n","/**\n * The `CompatibilityFlagAssertions` class provides methods to validate compatibility flags and dates\n * within a project's configuration. It ensures that specific flags are either present\n * or absent and that compatibility dates meet the required criteria.\n */\nexport class CompatibilityFlagAssertions {\n\t#compatibilityDate?: string;\n\t#compatibilityFlags: string[];\n\t#optionsPath: string;\n\t#relativeProjectPath: string;\n\t#relativeWranglerConfigPath?: string;\n\n\tconstructor(options: CommonOptions) {\n\t\tthis.#compatibilityDate = options.compatibilityDate;\n\t\tthis.#compatibilityFlags = options.compatibilityFlags;\n\t\tthis.#optionsPath = options.optionsPath;\n\t\tthis.#relativeProjectPath = options.relativeProjectPath;\n\t\tthis.#relativeWranglerConfigPath = options.relativeWranglerConfigPath;\n\t}\n\n\t/**\n\t * Checks if a specific flag is present in the compatibilityFlags array.\n\t */\n\t#flagExists(flag: string): boolean {\n\t\treturn this.#compatibilityFlags.includes(flag);\n\t}\n\n\t/**\n\t * Constructs the base of the error message.\n\t *\n\t * @example\n\t * In project /path/to/project\n\t *\n\t * @example\n\t * In project /path/to/project's configuration file wrangler.toml\n\t */\n\t#buildErrorMessageBase(): string {\n\t\tlet message = `In project ${this.#relativeProjectPath}`;\n\t\tif (this.#relativeWranglerConfigPath) {\n\t\t\tmessage += `'s configuration file ${this.#relativeWranglerConfigPath}`;\n\t\t}\n\t\treturn message;\n\t}\n\n\t/**\n\t * Constructs the configuration path part of the error message.\n\t */\n\t#buildConfigPath(setting: string): string {\n\t\tif (this.#relativeWranglerConfigPath) {\n\t\t\treturn `\\`${setting}\\``;\n\t\t}\n\n\t\tconst camelCaseSetting = setting.replace(/_(\\w)/g, (_, letter) =>\n\t\t\tletter.toUpperCase()\n\t\t);\n\n\t\treturn `\\`${this.#optionsPath}.${camelCaseSetting}\\``;\n\t}\n\n\tisEnabled(\n\t\tenableFlag: string,\n\t\tdisableFlag: string,\n\t\tdefaultOnDate?: string\n\t): boolean {\n\t\tif (this.#flagExists(disableFlag)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\tthis.#flagExists(enableFlag) ||\n\t\t\tisDateSufficient(this.#compatibilityDate, defaultOnDate)\n\t\t);\n\t}\n\n\t/**\n\t * Ensures that a specific enable flag is present or that the compatibility date meets the required date.\n\t */\n\tassertIsEnabled({\n\t\tenableFlag,\n\t\tdisableFlag,\n\t\tdefaultOnDate,\n\t}: {\n\t\tenableFlag: string;\n\t\tdisableFlag: string;\n\t\tdefaultOnDate?: string;\n\t}): AssertionResult {\n\t\t// If it's disabled by this flag, we can return early.\n\t\tif (this.#flagExists(disableFlag)) {\n\t\t\tconst errorMessage = `${this.#buildErrorMessageBase()}, ${this.#buildConfigPath(\n\t\t\t\t\"compatibility_flags\"\n\t\t\t)} must not contain \"${disableFlag}\".\\nThis flag is incompatible with \\`@cloudflare/vitest-pool-workers\\`.`;\n\t\t\treturn { isValid: false, errorMessage };\n\t\t}\n\n\t\tconst enableFlagPresent = this.#flagExists(enableFlag);\n\t\tconst dateSufficient = isDateSufficient(\n\t\t\tthis.#compatibilityDate,\n\t\t\tdefaultOnDate\n\t\t);\n\n\t\tif (!enableFlagPresent && !dateSufficient) {\n\t\t\tlet errorMessage = `${this.#buildErrorMessageBase()}, ${this.#buildConfigPath(\n\t\t\t\t\"compatibility_flags\"\n\t\t\t)} must contain \"${enableFlag}\"`;\n\n\t\t\tif (defaultOnDate) {\n\t\t\t\terrorMessage += `, or ${this.#buildConfigPath(\n\t\t\t\t\t\"compatibility_date\"\n\t\t\t\t)} must be >= \"${defaultOnDate}\".`;\n\t\t\t}\n\n\t\t\terrorMessage += `\\nThis flag is required to use \\`@cloudflare/vitest-pool-workers\\`.`;\n\n\t\t\treturn { isValid: false, errorMessage };\n\t\t}\n\n\t\treturn { isValid: true };\n\t}\n\n\t/**\n\t * Ensures that a any one of a given set of flags is present in the compatibility_flags array.\n\t */\n\tassertAtLeastOneFlagExists(flags: string[]): AssertionResult {\n\t\tif (flags.length === 0 || flags.some((flag) => this.#flagExists(flag))) {\n\t\t\treturn { isValid: true };\n\t\t}\n\n\t\tconst errorMessage = `${this.#buildErrorMessageBase()}, ${this.#buildConfigPath(\n\t\t\t\"compatibility_flags\"\n\t\t)} must contain one of ${flags.map((flag) => `\"${flag}\"`).join(\"/\")}.\\nEither one of these flags is required to use \\`@cloudflare/vitest-pool-workers\\`.`;\n\n\t\treturn { isValid: false, errorMessage };\n\t}\n}\n\n/**\n * Common options used across all assertion methods.\n */\ninterface CommonOptions {\n\tcompatibilityDate?: string;\n\tcompatibilityFlags: string[];\n\toptionsPath: string;\n\trelativeProjectPath: string;\n\trelativeWranglerConfigPath?: string;\n}\n\n/**\n * Result of an assertion method.\n */\ninterface AssertionResult {\n\tisValid: boolean;\n\terrorMessage?: string;\n}\n\n/**\n * Parses a date string into a Date object.\n */\nfunction parseDate(dateStr: string): Date {\n\tconst date = new Date(dateStr);\n\tif (isNaN(date.getTime())) {\n\t\tthrow new Error(`Invalid date format: \"${dateStr}\"`);\n\t}\n\treturn date;\n}\n\n/**\n * Checks if the compatibility date meets or exceeds the required date.\n */\nfunction isDateSufficient(\n\tcompatibilityDate?: string,\n\tdefaultOnDate?: string\n): boolean {\n\tif (!compatibilityDate || !defaultOnDate) {\n\t\treturn false;\n\t}\n\tconst compDate = parseDate(compatibilityDate);\n\tconst reqDate = parseDate(defaultOnDate);\n\treturn compDate >= reqDate;\n}\n","import path from \"node:path\";\nimport { build } from \"esbuild\";\n\nexport type ExportMap = Map<\n\tstring,\n\t\"WorkerEntrypoint\" | \"DurableObject\" | \"WorkflowEntrypoint\" | null\n>;\n\n/**\n * Guesses the exports of the main Worker.\n *\n * We do this by running a lightweight esbuild of the main script, and looking at the meta-file generated by esbuild.\n *\n * - This doesn't support Python Workers, but then neither does Vitest.\n * - Workers that need to be built with Vite plugins (e.g. containing wildcard re-exported virtual imports)\n *   may not work with esbuild and so we won't be able to find the exports. But in these cases, the user can\n *   always manually specify the exports in the Wrangler config via Service bindings, Workflows, or Durable Object migrations.\n *\n * @param entryFile The entry file of the Worker.\n * @param additionalExports Additional exports to include in the export map.\n *\n * @returns A map of export names to their types (WorkerEntrypoint, DurableObject, WorkflowEntrypoint), or null if unknown.\n */\nexport async function guessWorkerExports(\n\tentryFile: string | undefined,\n\tadditionalExports: {\n\t\t[exportName: string]:\n\t\t\t| \"WorkerEntrypoint\"\n\t\t\t| \"DurableObject\"\n\t\t\t| \"WorkflowEntrypoint\";\n\t} = {}\n): Promise<ExportMap> {\n\tconst exportMap: ExportMap = new Map(Object.entries(additionalExports));\n\tif (entryFile === undefined) {\n\t\treturn exportMap;\n\t}\n\n\tif (path.extname(entryFile) == \".py\") {\n\t\t// We don't support Python Workers here.\n\t\treturn exportMap;\n\t}\n\n\tconst result = await build({\n\t\ttarget: \"es2024\",\n\t\tloader: { \".js\": \"jsx\", \".mjs\": \"jsx\", \".cjs\": \"jsx\" },\n\t\tentryPoints: [path.resolve(entryFile)],\n\t\tmetafile: true,\n\t\tbundle: false,\n\t\twrite: false,\n\t\tlogLevel: \"silent\",\n\t});\n\n\tconst entryPoints = Object.values(result.metafile.outputs).filter(\n\t\t(output) => output.entryPoint !== undefined\n\t);\n\tif (entryPoints.length === 0) {\n\t\tthrow new Error(\n\t\t\t`Cannot find entry-point \"${entryFile}\" in generated bundle.`\n\t\t);\n\t}\n\tif (entryPoints.length > 1) {\n\t\tthrow new Error(\n\t\t\t\"More than one entry-point found for generated bundle.\\n\" +\n\t\t\t\tentryPoints.map((output) => ` - ${output.entryPoint}`).join(\"\\n\")\n\t\t);\n\t}\n\n\tfor (const exportName of entryPoints[0].exports) {\n\t\t// For now we have no way to guess the type..\n\t\tif (!exportMap.has(exportName)) {\n\t\t\texportMap.set(exportName, null);\n\t\t}\n\t}\n\n\treturn exportMap;\n}\n","import path from \"node:path\";\nimport type { TestProject } from \"vitest/node\";\n\n// User worker names must not start with this\nexport const WORKER_NAME_PREFIX = \"vitest-pool-workers-\";\n\nexport function isFileNotFoundError(e: unknown): boolean {\n\treturn (\n\t\ttypeof e === \"object\" && e !== null && \"code\" in e && e.code === \"ENOENT\"\n\t);\n}\n\nexport function getProjectPath(project: TestProject): string {\n\treturn project.config.root;\n}\n\nexport function getRelativeProjectPath(project: TestProject): string {\n\tconst projectPath = getProjectPath(project);\n\treturn path.relative(\"\", projectPath);\n}\n\nexport function getRelativeProjectConfigPath(project: TestProject): string {\n\treturn project.config.config\n\t\t? path.relative(\"\", project.config.config)\n\t\t: getRelativeProjectPath(project);\n}\n","import assert from \"node:assert\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { Response } from \"miniflare\";\nimport { isFileNotFoundError } from \"./helpers\";\nimport type { Awaitable, Miniflare, Request } from \"miniflare\";\n\n// Based on https://github.com/vitest-dev/vitest/blob/v4.0.18/packages/snapshot/src/env/node.ts\nasync function handleSnapshotRequest(\n\trequest: Request,\n\turl: URL\n): Promise<Response> {\n\tconst filePath = url.searchParams.get(\"path\");\n\tif (filePath === null) {\n\t\treturn new Response(null, { status: 400 });\n\t}\n\n\tif (request.method === \"POST\" /* prepareDirectory */) {\n\t\tawait fs.mkdir(filePath, { recursive: true });\n\t\treturn new Response(null, { status: 204 });\n\t}\n\n\tif (request.method === \"PUT\" /* saveSnapshotFile */) {\n\t\tconst snapshot = await request.arrayBuffer();\n\t\tawait fs.mkdir(path.dirname(filePath), { recursive: true });\n\t\tawait fs.writeFile(filePath, new Uint8Array(snapshot));\n\t\treturn new Response(null, { status: 204 });\n\t}\n\n\tif (request.method === \"GET\" /* readSnapshotFile */) {\n\t\ttry {\n\t\t\treturn new Response(await fs.readFile(filePath));\n\t\t} catch (e) {\n\t\t\tif (!isFileNotFoundError(e)) {\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t\treturn new Response(null, { status: 404 });\n\t\t}\n\t}\n\n\tif (request.method === \"DELETE\" /* removeSnapshotFile */) {\n\t\ttry {\n\t\t\tawait fs.unlink(filePath);\n\t\t} catch (e) {\n\t\t\tif (!isFileNotFoundError(e)) {\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\t\treturn new Response(null, { status: 204 });\n\t}\n\n\treturn new Response(null, { status: 405 });\n}\n\nexport async function listDurableObjectIds(\n\trequest: Request,\n\tmf: Miniflare,\n\turl: URL\n): Promise<Response> {\n\tif (request.method !== \"GET\") {\n\t\treturn new Response(null, { status: 405 });\n\t}\n\tconst persistPaths = mf.unsafeGetPersistPaths();\n\tconst durableObjectPersistPath = persistPaths.get(\"do\");\n\tassert(\n\t\tdurableObjectPersistPath !== undefined,\n\t\t\"Expected Durable Object persist path\"\n\t);\n\n\tconst uniqueKey = url.searchParams.get(\"unique_key\");\n\tif (uniqueKey === null) {\n\t\treturn new Response(null, { status: 400 });\n\t}\n\tconst namespacePath = path.join(durableObjectPersistPath, uniqueKey);\n\n\tconst ids: string[] = [];\n\ttry {\n\t\tconst names = await fs.readdir(namespacePath);\n\t\tfor (const name of names) {\n\t\t\t// Exclude metadata.sqlite, added by newer workerd versions for\n\t\t\t// per-namespace metadata. Only include files whose stem is a\n\t\t\t// valid 64-hex-digit Durable Object ID.\n\t\t\tif (name.endsWith(\".sqlite\") && name !== \"metadata.sqlite\") {\n\t\t\t\tids.push(name.substring(0, name.length - 7 /* \".sqlite\".length */));\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tif (!isFileNotFoundError(e)) {\n\t\t\tthrow e;\n\t\t}\n\t}\n\treturn Response.json(ids);\n}\n\nexport function handleLoopbackRequest(\n\trequest: Request,\n\tmf: Miniflare\n): Awaitable<Response> {\n\tconst url = new URL(request.url);\n\tif (url.pathname === \"/snapshot\") {\n\t\treturn handleSnapshotRequest(request, url);\n\t}\n\tif (url.pathname === \"/durable-objects\") {\n\t\treturn listDurableObjectIds(request, mf, url);\n\t}\n\treturn new Response(null, { status: 404 });\n}\n","// Node.js built-in modules provided by `workerd`\nexport const workerdBuiltinModules = new Set([\n\t...VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES,\n\t\"__STATIC_CONTENT_MANIFEST\",\n]);\n","import assert from \"node:assert\";\nimport fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport platformPath from \"node:path\";\nimport posixPath from \"node:path/posix\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport util from \"node:util\";\nimport * as cjsModuleLexer from \"cjs-module-lexer\";\nimport { ModuleRuleTypeSchema, Response } from \"miniflare\";\nimport { workerdBuiltinModules } from \"../shared/builtin-modules\";\nimport { isFileNotFoundError } from \"./helpers\";\nimport type { ModuleRuleType, Request, Worker_Module } from \"miniflare\";\nimport type { Vite } from \"vitest/node\";\n\nlet debuglog: util.DebugLoggerFunction = util.debuglog(\n\t\"vitest-pool-workers:module-fallback\",\n\t(log) => (debuglog = log)\n);\n\nconst isWindows = process.platform === \"win32\";\n\n// Ensures `filePath` uses forward-slashes. Note this doesn't prepend a\n// forward-slash in front of Windows paths, so they can still be passed to Node\n// `fs` functions.\nexport function ensurePosixLikePath(filePath: string) {\n\treturn isWindows ? filePath.replaceAll(\"\\\\\", \"/\") : filePath;\n}\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = platformPath.dirname(__filename);\nconst require = createRequire(__filename);\n\nconst distPath = ensurePosixLikePath(platformPath.resolve(__dirname, \"..\"));\nconst libPath = posixPath.join(distPath, \"worker\", \"lib\");\nconst emptyLibPath = posixPath.join(libPath, \"cloudflare/empty-internal.cjs\");\n\n// File path suffix to disable CJS to ESM-with-named-exports shimming\nconst disableCjsEsmShimSuffix = \"?mf_vitest_no_cjs_esm_shim\";\nfunction trimSuffix(suffix: string, value: string) {\n\tassert(value.endsWith(suffix));\n\treturn value.substring(0, value.length - suffix.length);\n}\n\n/**\n * When pre-bundling is enabled, Vite will add a hash to the end of the file path\n * e.g. `/node_modules/.vite/deps/my-dep.js?v=f3sf2ebd`\n *\n * @see https://vite.dev/guide/features.html#npm-dependency-resolving-and-pre-bundling\n * @see https://github.com/cloudflare/workers-sdk/pull/5673\n */\nconst versionHashRegExp = /\\?v=[0-9a-f]+$/;\n\nfunction trimViteVersionHash(filePath: string) {\n\treturn filePath.replace(versionHashRegExp, \"\");\n}\n\n// RegExp for path suffix to force loading module as specific type.\n// (e.g. `/path/to/module.wasm?mf_vitest_force=CompiledWasm`)\n// This suffix will be added by the pool when fetching a module that matches a\n// module rule. In this case, the module will be marked as external with this\n// suffix, causing the fallback service to return a module with the correct\n// type. Note we can't easily implement rules with a Vite plugin, as they:\n// - Depend on `miniflare`/`wrangler` configuration, and we can't modify the\n//   Vite config in the pool\n// - Would require use of an `UnsafeEval` binding to build `WebAssembly.Module`s\nconst forceModuleTypeRegexp = new RegExp(\n\t`\\\\?mf_vitest_force=(${ModuleRuleTypeSchema.options.join(\"|\")})$`\n);\n\nfunction isFile(filePath: string): boolean {\n\treturn fs.statSync(filePath, { throwIfNoEntry: false })?.isFile() ?? false;\n}\n\nfunction isDirectory(filePath: string): boolean {\n\treturn (\n\t\tfs.statSync(filePath, { throwIfNoEntry: false })?.isDirectory() ?? false\n\t);\n}\n\nfunction getParentPaths(filePath: string): string[] {\n\tconst parentPaths: string[] = [];\n\n\twhile (true) {\n\t\tconst parentPath = posixPath.dirname(filePath);\n\t\tif (parentPath === filePath) {\n\t\t\treturn parentPaths;\n\t\t}\n\t\tparentPaths.push(parentPath);\n\t\tfilePath = parentPath;\n\t}\n}\n\nconst dirPathTypeModuleCache = new Map<string, boolean>();\nfunction isWithinTypeModuleContext(filePath: string): boolean {\n\tconst parentPaths = getParentPaths(filePath);\n\n\tfor (const parentPath of parentPaths) {\n\t\tconst cache = dirPathTypeModuleCache.get(parentPath);\n\t\tif (cache !== undefined) {\n\t\t\treturn cache;\n\t\t}\n\t}\n\n\tfor (const parentPath of parentPaths) {\n\t\ttry {\n\t\t\tconst pkgPath = posixPath.join(parentPath, \"package.json\");\n\t\t\tconst pkgJson = fs.readFileSync(pkgPath, \"utf8\");\n\t\t\tconst pkg = JSON.parse(pkgJson);\n\t\t\tconst maybeModulePath = pkg.module\n\t\t\t\t? posixPath.join(parentPath, pkg.module)\n\t\t\t\t: \"\";\n\t\t\tconst cache = pkg.type === \"module\" || maybeModulePath === filePath;\n\t\t\tdirPathTypeModuleCache.set(parentPath, cache);\n\t\t\treturn cache;\n\t\t} catch (e: unknown) {\n\t\t\tif (!isFileNotFoundError(e)) {\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n}\n\nawait cjsModuleLexer.init();\n/**\n * Gets \"named\" exports from a CommonJS module. Normally, CommonJS modules can\n * only be default-imported, but Node performs additional static analysis to\n * allow named-imports too (https://nodejs.org/api/esm.html#interoperability-with-commonjs).\n * This function returns the named-exports we should add to our ESM-CJS shim,\n * using the same package as Node.\n */\nasync function getCjsNamedExports(\n\tvite: Vite.ViteDevServer,\n\tfilePath: string,\n\tcontents: string,\n\tseen = new Set()\n): Promise<Set<string>> {\n\tconst { exports, reexports } = cjsModuleLexer.parse(contents);\n\tconst result = new Set(exports);\n\tfor (const reexport of reexports) {\n\t\tconst resolved = await viteResolve(\n\t\t\tvite,\n\t\t\treexport,\n\t\t\tfilePath,\n\t\t\t/* isRequire */ true\n\t\t);\n\t\tif (seen.has(resolved)) {\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\tconst resolvedContents = fs.readFileSync(resolved, \"utf8\");\n\t\t\tseen.add(resolved);\n\t\t\tconst resolvedNames = await getCjsNamedExports(\n\t\t\t\tvite,\n\t\t\t\tresolved,\n\t\t\t\tresolvedContents,\n\t\t\t\tseen\n\t\t\t);\n\t\t\tfor (const name of resolvedNames) {\n\t\t\t\tresult.add(name);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!isFileNotFoundError(e)) {\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\t}\n\tresult.delete(\"default\");\n\tresult.delete(\"__esModule\");\n\treturn result;\n}\n\nfunction withSourceUrl(contents: string, url: string | URL): string {\n\t// If we've already got a `//# sourceURL` comment, return `script` as is\n\t// (searching from the end as that's where we'd expect it)\n\tif (contents.lastIndexOf(\"//# sourceURL=\") !== -1) {\n\t\treturn contents;\n\t}\n\t// Make sure `//# sourceURL` comment is on its own line\n\tconst sourceURL = `\\n//# sourceURL=${url.toString()}\\n`;\n\treturn contents + sourceURL;\n}\n\nfunction withImportMetaUrl(contents: string, url: string | URL): string {\n\t// TODO(soon): this isn't perfect, ideally need `workerd` support\n\treturn contents.replaceAll(\"import.meta.url\", JSON.stringify(url.toString()));\n}\n\n// Extensions that Node's `require()` probes automatically but `workerd` won't.\n// ESM `import` requires explicit extensions; Vite's resolver handles those.\nconst requireExtensions = [\".js\", \".mjs\", \".cjs\", \".json\"];\nfunction maybeGetTargetFilePath(\n\ttarget: string,\n\tisRequire: boolean\n): string | undefined {\n\t// Can't use `fs.existsSync()` here as `target` could be a directory\n\t// (e.g. `node:fs` and `node:fs/promises`)\n\tif (isFile(target)) {\n\t\treturn target;\n\t}\n\tif (isRequire) {\n\t\tfor (const extension of requireExtensions) {\n\t\t\tconst targetWithExtension = target + extension;\n\t\t\tif (fs.existsSync(targetWithExtension)) {\n\t\t\t\treturn targetWithExtension;\n\t\t\t}\n\t\t}\n\t}\n\tif (target.endsWith(disableCjsEsmShimSuffix)) {\n\t\treturn target;\n\t}\n\tif (isDirectory(target)) {\n\t\treturn maybeGetTargetFilePath(target + \"/index\", isRequire);\n\t}\n}\n\n/**\n * `target` is the path to the \"file\" `workerd` is trying to load,\n * `referrer` is the path to the file that imported/required the `target`,\n * `referrerDir` is the dirname of `referrer`\n *\n * For example, if the `referrer` is \"/a/b/c/index.mjs\":\n *\n * | Import Statement            | `target`           | Return             |\n * |-----------------------------|--------------------|--------------------|\n * | import \"./dep.mjs\"          | /a/b/c/dep.mjs     | dep.mjs            |\n * | import \"../dep.mjs\"         | /a/b/dep.mjs       | ../dep.mjs         |\n * | import \"pkg\"                | /a/b/c/pkg         | pkg                |\n * | import \"@org/pkg\"           | /a/b/c/@org/pkg    | @org/pkg           |\n * | import \"node:assert\"        | node:assert        | node:assert        |\n * | import \"cloudflare:sockets\" | cloudflare:sockets | cloudflare:sockets |\n * | import \"workerd:rtti\"       | workerd:rtti       | workerd:rtti       |\n * | import \"random:pkg\"         | /a/b/c/random:pkg  | random:pkg         |\n *\n * Note that we return `dep.mjs` for `import \"./dep.mjs\"`. This would fail\n * ES module resolution, so must be handled by `maybeGetTargetFilePath()`.\n */\nfunction getApproximateSpecifier(target: string, referrerDir: string): string {\n\tif (/^(node|cloudflare|workerd):/.test(target)) {\n\t\treturn target;\n\t}\n\treturn posixPath.relative(referrerDir, target);\n}\n\nasync function viteResolve(\n\tvite: Vite.ViteDevServer,\n\tspecifier: string,\n\treferrer: string,\n\tisRequire: boolean\n): Promise<string> {\n\tconst resolved = await vite.pluginContainer.resolveId(specifier, referrer, {\n\t\tssr: true,\n\t\t// https://github.com/vitejs/vite/blob/v5.1.4/packages/vite/src/node/plugins/resolve.ts#L178-L179\n\t\tcustom: { \"node-resolve\": { isRequire } },\n\t});\n\tif (resolved === null) {\n\t\t// Vite's resolution algorithm doesn't apply Node resolution to specifiers\n\t\t// starting with a dot. Unfortunately, the `@prisma/client` package includes\n\t\t// `require(\".prisma/client/wasm\")` which needs to resolve to something in\n\t\t// `node_modules/.prisma/client`. Since Prisma officially supports Workers,\n\t\t// it's quite likely users will want to use it with the Vitest pool. To fix\n\t\t// this, we fall back to Node's resolution algorithm in this case.\n\t\tif (isRequire && specifier[0] === \".\") {\n\t\t\treturn require.resolve(specifier, { paths: [referrer] });\n\t\t}\n\t\tthrow new Error(\"Not found\");\n\t}\n\t// Handle case where `package.json` `browser` field stubs out built-in with an\n\t// empty module (e.g. `{ \"browser\": { \"fs\": false } }`).\n\tif (resolved.id === \"__vite-browser-external\") {\n\t\treturn emptyLibPath;\n\t}\n\tif (resolved.external) {\n\t\t// Handle case where `node:*` built-in resolved from import map\n\t\t// (e.g. https://github.com/sindresorhus/p-limit/blob/f53bdb5f464ae112b2859e834fdebedc0745199b/package.json#L20)\n\t\tlet { id } = resolved;\n\t\tif (workerdBuiltinModules.has(id)) {\n\t\t\treturn `/${id}`;\n\t\t}\n\t\tif (id.startsWith(\"node:\")) {\n\t\t\tthrow new Error(\"Not found\");\n\t\t}\n\n\t\tid = `node:${id}`;\n\t\tif (workerdBuiltinModules.has(id)) {\n\t\t\treturn `/${id}`;\n\t\t}\n\n\t\t// If we get this far, we have something that:\n\t\t//  - looks like a built-in node module but wasn't imported with a `node:` prefix\n\t\t//  - and isn't provided by workerd natively\n\t\t// In that case, _try_ and load the identifier with a `node:` prefix.\n\t\t// This will potentially load one of the Node.js polyfills provided by `vitest-pool-workers`\n\t\t// Note: User imports should never get here! This is only meant to cater for Vitest internals\n\t\t//       (Specifically, the \"tinyrainbow\" module imports `node:tty` as `tty`)\n\t\treturn id;\n\t}\n\n\treturn trimViteVersionHash(resolved.id);\n}\n\ntype ResolveMethod = \"import\" | \"require\";\nasync function resolve(\n\tvite: Vite.ViteDevServer,\n\tmethod: ResolveMethod,\n\ttarget: string,\n\tspecifier: string,\n\treferrer: string\n): Promise<string /* filePath */> {\n\tconst referrerDir = posixPath.dirname(referrer);\n\n\tconst isRequire = method === \"require\";\n\tlet filePath = maybeGetTargetFilePath(target, isRequire);\n\tif (filePath !== undefined) {\n\t\treturn filePath;\n\t}\n\n\t// `workerd` will always try to resolve modules relative to the referencing\n\t// dir first. Built-in `node:*`/`cloudflare:*` imports only exist at the root.\n\t// We need to ensure we only load a single copy of these modules, therefore,\n\t// we return a redirect to the root here. Note `workerd` will automatically\n\t// look in the root if we return 404 from the fallback service when\n\t// *import*ing `node:*`/`cloudflare:*` modules, but not when *require()*ing\n\t// them. For the sake of consistency (and a nice return type on this function)\n\t// we return a redirect for `import`s too.\n\tif (referrerDir !== \"/\" && workerdBuiltinModules.has(specifier)) {\n\t\treturn `/${specifier}`;\n\t}\n\n\tconst specifierLibPath = posixPath.join(\n\t\tlibPath,\n\t\tspecifier.replaceAll(\":\", \"/\")\n\t);\n\t// Always probe extensions for pool-internal lib modules\n\tfilePath = maybeGetTargetFilePath(specifierLibPath, /* isRequire */ true);\n\tif (filePath !== undefined) {\n\t\treturn filePath;\n\t}\n\n\treturn viteResolve(vite, specifier, referrer, method === \"require\");\n}\n\nfunction buildRedirectResponse(filePath: string) {\n\t// `workerd` expects an absolute POSIX-style path (starting with a slash) for\n\t// redirects. `filePath` is a platform absolute path with forward slashes.\n\t// On Windows, this won't start with a `/`, so we add one to produce paths\n\t// like `/C:/a/b/c`.\n\tif (isWindows && filePath[0] !== \"/\") {\n\t\tfilePath = `/${filePath}`;\n\t}\n\treturn new Response(null, { status: 301, headers: { Location: filePath } });\n}\n\n// `Omit<Worker_Module, \"name\">` gives type `{}` which isn't very helpful, so\n// we have to do something like this instead.\ntype DistributeWorkerModuleForContents<T> = T extends unknown\n\t? { [P in Exclude<keyof T, \"name\">]: NonNullable<T[P]> }\n\t: never;\ntype ModuleContents = DistributeWorkerModuleForContents<Worker_Module>;\n\n// Refer to docs on `forceModuleTypeRegexp` for more details\nfunction maybeGetForceTypeModuleContents(\n\tfilePath: string\n): ModuleContents | undefined {\n\tconst match = forceModuleTypeRegexp.exec(filePath);\n\tif (match === null) {\n\t\treturn;\n\t}\n\n\tfilePath = trimSuffix(match[0], filePath);\n\tconst type = match[1] as ModuleRuleType;\n\tconst contents = fs.readFileSync(filePath);\n\tswitch (type) {\n\t\tcase \"ESModule\":\n\t\t\treturn { esModule: contents.toString() };\n\t\tcase \"CommonJS\":\n\t\t\treturn { commonJsModule: contents.toString() };\n\t\tcase \"Text\":\n\t\t\treturn { text: contents.toString() };\n\t\tcase \"Data\":\n\t\t\treturn { data: contents };\n\t\tcase \"CompiledWasm\":\n\t\t\treturn { wasm: contents };\n\t\tcase \"PythonModule\":\n\t\t\treturn { pythonModule: contents.toString() };\n\t\tcase \"PythonRequirement\":\n\t\t\treturn { pythonRequirement: contents.toString() };\n\t\tdefault: {\n\t\t\t// `type` should've been validated against `ModuleRuleType`\n\t\t\tconst exhaustive: never = type;\n\t\t\tassert.fail(`Unreachable: ${exhaustive} modules are unsupported`);\n\t\t}\n\t}\n}\nfunction buildModuleResponse(target: string, contents: ModuleContents) {\n\tlet name = target;\n\tif (!isWindows) {\n\t\tname = posixPath.relative(\"/\", target);\n\t}\n\tassert(name[0] !== \"/\");\n\tconst result: Record<string, unknown> = { name };\n\tfor (const key in contents) {\n\t\tconst value = (contents as Record<string, unknown>)[key];\n\t\t// Cap'n Proto expects byte arrays for `:Data` typed fields from JSON\n\t\tresult[key] = value instanceof Uint8Array ? Array.from(value) : value;\n\t}\n\treturn Response.json(result);\n}\n\nasync function load(\n\tvite: Vite.ViteDevServer,\n\tlogBase: string,\n\tmethod: ResolveMethod,\n\ttarget: string,\n\tspecifier: string,\n\tfilePath: string\n): Promise<Response> {\n\tif (target !== filePath) {\n\t\t// We might `import` and `require` the same CommonJS package. In this case,\n\t\t// we want to respond with an ES module shim for the `import`, and the\n\t\t// module as is otherwise. If we're `require()`ing a package, make sure we\n\t\t// redirect to the module disabling the ES module shim.\n\t\tif (method === \"require\" && !specifier.startsWith(\"node:\")) {\n\t\t\tfilePath += disableCjsEsmShimSuffix;\n\t\t}\n\t\tdebuglog(logBase, \"redirect:\", filePath);\n\t\treturn buildRedirectResponse(filePath);\n\t}\n\n\t// If this is a WebAssembly module, force load it as one. This ensures we\n\t// support `.wasm` files inside `node_modules` (e.g. Prisma's client).\n\t// It seems unlikely a package would want to do anything else with a `.wasm`\n\t// file. Note if a module rule was applied to `.wasm` files, this path will\n\t// have a `?mf_vitest_force` suffix already, so this line won't do anything.\n\tif (filePath.endsWith(\".wasm\")) {\n\t\tfilePath += `?mf_vitest_force=CompiledWasm`;\n\t}\n\n\t// If we're importing with a forced module type, load the file as that type\n\tconst maybeContents = maybeGetForceTypeModuleContents(filePath);\n\tif (maybeContents !== undefined) {\n\t\tdebuglog(logBase, \"forced:\", filePath);\n\t\treturn buildModuleResponse(target, maybeContents);\n\t}\n\n\t// If we're importing from a shim module, don't shim again\n\tconst disableCjsEsmShim = filePath.endsWith(disableCjsEsmShimSuffix);\n\tif (disableCjsEsmShim) {\n\t\tfilePath = trimSuffix(disableCjsEsmShimSuffix, filePath);\n\t}\n\n\tconst isEsm =\n\t\tfilePath.endsWith(\".mjs\") ||\n\t\t(filePath.endsWith(\".js\") && isWithinTypeModuleContext(filePath));\n\n\t// JSON modules: CommonJS `require(\"./data.json\")` is common in many widely\n\t// used packages (e.g. mime-types). If we return raw JSON as a `commonJsModule`,\n\t// `workerd` will try to parse it as JavaScript and fail with\n\t// `SyntaxError: Unexpected token ':'`.\n\tif (filePath.endsWith(\".json\")) {\n\t\tconst json = fs.readFileSync(filePath, \"utf8\");\n\t\tdebuglog(logBase, \"json:\", filePath);\n\t\treturn buildModuleResponse(target, { json });\n\t}\n\n\tlet contents = fs.readFileSync(filePath, \"utf8\");\n\tconst targetUrl = pathToFileURL(target);\n\tcontents = withSourceUrl(contents, targetUrl);\n\n\tif (isEsm) {\n\t\t// Respond with ES module\n\t\tcontents = withImportMetaUrl(contents, targetUrl);\n\t\tdebuglog(logBase, \"esm:\", filePath);\n\t\treturn buildModuleResponse(target, { esModule: contents });\n\t}\n\n\t// Respond with CommonJS module\n\n\t// If we're `import`ing a CommonJS module, or we're `require`ing a `node:*`\n\t// module from a CommonJS, return an ES module shim. Note\n\t// CommonJS can `require` ES modules, using the default export.\n\tconst insertCjsEsmShim = method === \"import\" || specifier.startsWith(\"node:\");\n\tif (insertCjsEsmShim && !disableCjsEsmShim) {\n\t\tconst fileName = posixPath.basename(filePath);\n\t\tconst disableShimSpecifier = `./${fileName}${disableCjsEsmShimSuffix}`;\n\t\tconst quotedDisableShimSpecifier = JSON.stringify(disableShimSpecifier);\n\t\tlet esModule = `import mod from ${quotedDisableShimSpecifier}; export default mod;`;\n\t\tfor (const name of await getCjsNamedExports(vite, filePath, contents)) {\n\t\t\tesModule += ` export const ${name} = mod.${name};`;\n\t\t}\n\t\tdebuglog(logBase, \"cjs-esm-shim:\", filePath);\n\t\treturn buildModuleResponse(target, { esModule });\n\t}\n\n\t// Otherwise, if we're `require`ing a non-`node:*` module, just return a\n\t// CommonJS\n\tdebuglog(logBase, \"cjs:\", filePath);\n\treturn buildModuleResponse(target, { commonJsModule: contents });\n}\n\nexport async function handleModuleFallbackRequest(\n\tvite: Vite.ViteDevServer,\n\trequest: Request\n): Promise<Response> {\n\tconst method = request.headers.get(\"X-Resolve-Method\");\n\tassert(method === \"import\" || method === \"require\");\n\tconst url = new URL(request.url);\n\tlet target = url.searchParams.get(\"specifier\");\n\tlet referrer = url.searchParams.get(\"referrer\");\n\tassert(target !== null, \"Expected specifier search param\");\n\tassert(referrer !== null, \"Expected referrer search param\");\n\tconst referrerDir = posixPath.dirname(referrer);\n\tlet specifier = getApproximateSpecifier(target, referrerDir);\n\n\t// Convert specifiers like `file:/a/index.mjs` to `/a/index.mjs`. `workerd`\n\t// currently passes `import(\"file:///a/index.mjs\")` through like this.\n\t// TODO(soon): remove this code once the new modules refactor lands\n\tif (specifier.startsWith(\"file:\")) {\n\t\tspecifier = fileURLToPath(specifier);\n\t}\n\n\tif (isWindows) {\n\t\t// Convert paths like `/C:/a/index.mjs` to `C:/a/index.mjs` so they can be\n\t\t// passed to Node `fs` functions.\n\t\tif (target[0] === \"/\") {\n\t\t\ttarget = target.substring(1);\n\t\t}\n\t\tif (referrer[0] === \"/\") {\n\t\t\treferrer = referrer.substring(1);\n\t\t}\n\t}\n\n\tconst quotedTarget = JSON.stringify(target);\n\tconst logBase = `${method}(${quotedTarget}) relative to ${referrer}:`;\n\n\ttry {\n\t\tconst filePath = await resolve(vite, method, target, specifier, referrer);\n\n\t\treturn await load(vite, logBase, method, target, specifier, filePath);\n\t} catch (e) {\n\t\tdebuglog(logBase, \"error:\", e);\n\t\tconsole.error(\n\t\t\t`[vitest-pool-workers] Failed to ${method} ${JSON.stringify(target)} from ${JSON.stringify(referrer)}.`,\n\t\t\t\"To resolve this, try bundling the relevant dependency with Vite.\",\n\t\t\t\"For more details, refer to https://developers.cloudflare.com/workers/testing/vitest-integration/known-issues/#module-resolution\"\n\t\t);\n\t}\n\n\treturn new Response(null, { status: 404 });\n}\n","import path from \"node:path\";\nimport {\n\tformatZodError,\n\tgetRootPath,\n\tLog,\n\tLogLevel,\n\tmergeWorkerOptions,\n\tparseWithRootPath,\n\tPLUGINS,\n} from \"miniflare\";\nimport { z } from \"zod\";\nimport {\n\tgetProjectPath,\n\tgetRelativeProjectConfigPath,\n\tgetRelativeProjectPath,\n} from \"./helpers\";\nimport type { ModuleRule, WorkerOptions } from \"miniflare\";\nimport type { TestProject } from \"vitest/node\";\nimport type { Binding, RemoteProxySession } from \"wrangler\";\nimport type { ParseParams, ZodError } from \"zod\";\n\nexport interface WorkersConfigPluginAPI {\n\tsetMain(newMain?: string): void;\n}\n\nconst PLUGIN_VALUES = Object.values(PLUGINS);\n\nconst WorkersPoolOptionsSchema = z.object({\n\t/**\n\t * Entrypoint to Worker run in the same isolate/context as tests. This is\n\t * required to use `import { exports } from \"cloudflare:workers\"`, or Durable\n\t * Objects without an explicit `scriptName`. Note this goes through Vite\n\t * transforms and can be a TypeScript file. Note also\n\t * `import module from \"<path-to-main>\"` inside tests gives exactly the same\n\t * `module` instance as is used internally for the `SELF` and Durable Object\n\t * bindings.\n\t */\n\tmain: z.ostring(),\n\t/**\n\t * Enables remote bindings to access remote resources configured\n\t * with `remote: true` in the wrangler configuration file.\n\t */\n\tremoteBindings: z.boolean().default(true),\n\t/**\n\t * Additional exports.\n\t * A map of module exports to be made available on the `ctx.exports`\n\t * that cannot be automatically inferred by analyzing the Worker source code.\n\t *\n\t * This is useful for exports that are re-exported implicitly, for example\n\t * through wildcard (`export * from \"...\"`) re-exports from virtual modules.\n\t */\n\tadditionalExports: z\n\t\t.record(\n\t\t\tz.string(),\n\t\t\tz.union([\n\t\t\t\tz.literal(\"WorkerEntrypoint\"),\n\t\t\t\tz.literal(\"DurableObject\"),\n\t\t\t\tz.literal(\"WorkflowEntrypoint\"),\n\t\t\t])\n\t\t)\n\t\t.default({}),\n\tminiflare: z\n\t\t.object({\n\t\t\tworkers: z.array(z.object({}).passthrough()).optional(),\n\t\t})\n\t\t.passthrough()\n\t\t.optional(),\n\twrangler: z\n\t\t.object({ configPath: z.ostring(), environment: z.ostring() })\n\t\t.optional(),\n});\n\nexport type SourcelessWorkerOptions = Omit<\n\tWorkerOptions,\n\t\"script\" | \"scriptPath\" | \"modules\" | \"modulesRoot\"\n> & {\n\t// `modulesRules` is not included in all members of the `SourceOptions` type\n\t// from which `WorkerOptions` is derived. Therefore, we manually include it.\n\tmodulesRules?: ModuleRule[];\n};\n\nexport type WorkersPoolOptions = z.input<typeof WorkersPoolOptionsSchema> & {\n\tminiflare?: SourcelessWorkerOptions & {\n\t\tworkers?: WorkerOptions[];\n\t};\n};\n\nexport type WorkersPoolOptionsWithDefines = WorkersPoolOptions & {\n\tdefines?: Record<string, string>;\n};\n\ntype PathParseParams = Pick<ParseParams, \"path\">;\n\nfunction isZodErrorLike(value: unknown): value is ZodError {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"issues\" in value &&\n\t\tArray.isArray(value.issues)\n\t);\n}\n\ntype ZodErrorRef = { value?: ZodError };\nfunction coalesceZodErrors(ref: ZodErrorRef, thrown: unknown) {\n\tif (!isZodErrorLike(thrown)) {\n\t\tthrow thrown;\n\t}\n\tif (ref.value === undefined) {\n\t\tref.value = thrown;\n\t} else {\n\t\tref.value.issues.push(...thrown.issues);\n\t}\n}\n\nfunction parseWorkerOptions(\n\trootPath: string,\n\tvalue: Record<string, unknown>,\n\twithoutScript: boolean,\n\topts: PathParseParams\n): WorkerOptions {\n\t// If this worker shouldn't have a configurable script, remove all script data\n\t// and replace it with an empty `script` that will pass validation\n\tif (withoutScript) {\n\t\tvalue[\"script\"] = \"\";\n\t\tdelete value[\"scriptPath\"];\n\t\tdelete value[\"modules\"];\n\t\tdelete value[\"modulesRoot\"];\n\t}\n\n\tconst result = {} as WorkerOptions;\n\tconst errorRef: ZodErrorRef = {};\n\tfor (const plugin of PLUGIN_VALUES) {\n\t\ttry {\n\t\t\t// This `parse()` may throw a different `ZodError` than what we `import`\n\t\t\tconst parsed = parseWithRootPath(rootPath, plugin.options, value, opts);\n\t\t\tObject.assign(result, parsed);\n\t\t} catch (e) {\n\t\t\tcoalesceZodErrors(errorRef, e);\n\t\t}\n\t}\n\tif (errorRef.value !== undefined) {\n\t\tthrow errorRef.value;\n\t}\n\n\t// Remove the placeholder script added if any\n\tif (withoutScript) {\n\t\tdelete value[\"script\"];\n\t}\n\treturn result;\n}\n\nconst log = new Log(LogLevel.WARN, { prefix: \"vpw\" });\n\nfunction filterTails(\n\ttails: WorkerOptions[\"tails\"],\n\tuserWorkers?: { name?: string }[]\n) {\n\t// Only connect the tail consumers that represent Workers that are defined in the Vitest config. Warn that a tail will be omitted otherwise\n\t// This _differs from service bindings_ because tail consumers are \"optional\" in a sense, and shouldn't affect the runtime behaviour of a Worker\n\treturn tails?.filter((tailService) => {\n\t\tlet name: string;\n\t\tif (typeof tailService === \"string\") {\n\t\t\tname = tailService;\n\t\t} else if (\n\t\t\ttypeof tailService === \"object\" &&\n\t\t\t\"name\" in tailService &&\n\t\t\ttypeof tailService.name === \"string\"\n\t\t) {\n\t\t\tname = tailService.name;\n\t\t} else {\n\t\t\t// Don't interfere with network-based tail connections (e.g. via the dev registry), or kCurrentWorker\n\t\t\treturn true;\n\t\t}\n\t\tconst found = userWorkers?.some((w) => w.name === name);\n\n\t\tif (!found) {\n\t\t\tlog.warn(\n\t\t\t\t`Tail consumer \"${name}\" was not found in your config. Make sure you add it if you'd like to simulate receiving tail events locally.`\n\t\t\t);\n\t\t}\n\n\t\treturn found;\n\t});\n}\n\n/** Map that maps worker configPaths to their existing remote proxy session data (if any) */\nexport const remoteProxySessionsDataMap = new Map<\n\tstring,\n\t{\n\t\tsession: RemoteProxySession;\n\t\tremoteBindings: Record<string, Binding>;\n\t} | null\n>();\n\nasync function parseCustomPoolOptions(\n\trootPath: string,\n\tvalue: unknown\n): Promise<WorkersPoolOptionsWithDefines> {\n\t// Try to parse pool specific options\n\tconst options = WorkersPoolOptionsSchema.parse(\n\t\tvalue\n\t) as WorkersPoolOptionsWithDefines;\n\toptions.miniflare ??= {};\n\n\t// Try to parse runner worker options, coalescing all errors\n\tconst errorRef: ZodErrorRef = {};\n\tconst workers = options.miniflare?.workers;\n\tconst rootPathOption = getRootPath(options.miniflare);\n\trootPath = path.resolve(rootPath, rootPathOption);\n\ttry {\n\t\toptions.miniflare = parseWorkerOptions(\n\t\t\trootPath,\n\t\t\toptions.miniflare,\n\t\t\t/* withoutScript */ true, // (script provided by runner)\n\t\t\t{ path: [\"miniflare\"] }\n\t\t);\n\t} catch (e) {\n\t\tcoalesceZodErrors(errorRef, e);\n\t}\n\n\toptions.miniflare.workers = [];\n\t// Try to parse auxiliary worker options\n\tif (workers !== undefined) {\n\t\toptions.miniflare.workers = workers.map((worker, i) => {\n\t\t\ttry {\n\t\t\t\tconst workerRootPathOption = getRootPath(worker);\n\t\t\t\tconst workerRootPath = path.resolve(rootPath, workerRootPathOption);\n\t\t\t\treturn parseWorkerOptions(\n\t\t\t\t\tworkerRootPath,\n\t\t\t\t\tworker,\n\t\t\t\t\t/* withoutScript */ false,\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: [\"miniflare\", \"workers\", i],\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} catch (e) {\n\t\t\t\tcoalesceZodErrors(errorRef, e);\n\t\t\t\treturn { script: \"\" }; // (ignored as we'll be throwing)\n\t\t\t}\n\t\t});\n\t}\n\n\tif (errorRef.value !== undefined) {\n\t\tthrow errorRef.value;\n\t}\n\n\t// Try to parse Wrangler config if any\n\tif (options.wrangler?.configPath !== undefined) {\n\t\tconst configPath = path.resolve(rootPath, options.wrangler.configPath);\n\t\t// Make sure future accesses to `configPath` see a fully-resolved path\n\t\t// (e.g. for getting accurate relative paths in error messages)\n\t\toptions.wrangler.configPath = configPath;\n\n\t\t// Lazily import `wrangler` if and when we need it\n\t\tconst wrangler = await import(\"wrangler\");\n\n\t\tconst preExistingRemoteProxySessionData = options.wrangler?.configPath\n\t\t\t? remoteProxySessionsDataMap.get(options.wrangler.configPath)\n\t\t\t: undefined;\n\n\t\tconst remoteProxySessionData = options.remoteBindings\n\t\t\t? await wrangler.maybeStartOrUpdateRemoteProxySession(\n\t\t\t\t\t{\n\t\t\t\t\t\tpath: options.wrangler.configPath,\n\t\t\t\t\t\tenvironment: options.wrangler.environment,\n\t\t\t\t\t},\n\t\t\t\t\tpreExistingRemoteProxySessionData ?? null\n\t\t\t\t)\n\t\t\t: null;\n\n\t\tif (options.wrangler?.configPath && remoteProxySessionData) {\n\t\t\tremoteProxySessionsDataMap.set(\n\t\t\t\toptions.wrangler.configPath,\n\t\t\t\tremoteProxySessionData\n\t\t\t);\n\t\t}\n\n\t\tconst { workerOptions, externalWorkers, define, main } =\n\t\t\twrangler.unstable_getMiniflareWorkerOptions(\n\t\t\t\tconfigPath,\n\t\t\t\toptions.wrangler.environment,\n\t\t\t\t{\n\t\t\t\t\toverrides: {\n\t\t\t\t\t\tassets: options.miniflare.assets,\n\t\t\t\t\t\t// doesn't work with containers yet so let's just disable it\n\t\t\t\t\t\tenableContainers: false,\n\t\t\t\t\t},\n\t\t\t\t\tremoteProxyConnectionString:\n\t\t\t\t\t\tremoteProxySessionData?.session?.remoteProxyConnectionString,\n\t\t\t\t}\n\t\t\t);\n\n\t\t// If `main` wasn't explicitly configured, fall back to Wrangler config's\n\t\toptions.main ??= main;\n\n\t\toptions.miniflare.workers = [\n\t\t\t...options.miniflare.workers,\n\t\t\t...externalWorkers,\n\t\t];\n\n\t\t// Merge generated Miniflare options from Wrangler with specified overrides\n\t\toptions.miniflare = mergeWorkerOptions(\n\t\t\tworkerOptions,\n\t\t\toptions.miniflare as SourcelessWorkerOptions\n\t\t);\n\n\t\toptions.miniflare = {\n\t\t\t...options.miniflare,\n\t\t\ttails: filterTails(workerOptions.tails, options.miniflare.workers),\n\t\t};\n\n\t\t// Record any Wrangler `define`s\n\t\toptions.defines = define;\n\t}\n\n\t// Some assets plumbing that should be hidden from the end user\n\tif (options.miniflare?.assets) {\n\t\t// (Used to set the SELF binding to point to the router worker instead)\n\t\toptions.miniflare.hasAssetsAndIsVitest = true;\n\t\toptions.miniflare.assets.routerConfig ??= {};\n\t\toptions.miniflare.assets.routerConfig.has_user_worker = Boolean(\n\t\t\toptions.main\n\t\t);\n\t}\n\n\treturn options;\n}\n\nexport async function parseProjectOptions(\n\tproject: TestProject,\n\tpoolOptions: unknown\n): Promise<WorkersPoolOptionsWithDefines> {\n\t// Make sure the user hasn't specified a custom environment. This was how\n\t// users enabled Miniflare 2's Vitest environment, so it's likely users will\n\t// hit this case.\n\tconst environment = project.config.environment;\n\tif (environment !== undefined && environment !== \"node\") {\n\t\tconst quotedEnvironment = JSON.stringify(environment);\n\n\t\tlet migrationGuide = \".\";\n\t\tif (environment === \"miniflare\") {\n\t\t\tmigrationGuide =\n\t\t\t\t\", and refer to the migration guide if upgrading from `vitest-environment-miniflare`:\\nhttps://developers.cloudflare.com/workers/testing/vitest-integration/get-started/migrate-from-miniflare-2/\";\n\t\t}\n\n\t\tconst relativePath = getRelativeProjectPath(project);\n\t\tconst message = [\n\t\t\t`Unexpected custom \\`environment\\` ${quotedEnvironment} in project ${relativePath}.`,\n\t\t\t\"The Workers pool always runs your tests inside of an environment providing Workers runtime APIs.\",\n\t\t\t`Please remove the \\`environment\\` configuration${migrationGuide}`,\n\t\t].join(\"\\n\");\n\t\tthrow new TypeError(message);\n\t}\n\n\tconst projectPath = getProjectPath(project);\n\n\ttry {\n\t\treturn await parseCustomPoolOptions(projectPath, poolOptions);\n\t} catch (e) {\n\t\tif (!isZodErrorLike(e)) {\n\t\t\tthrow e;\n\t\t}\n\t\tlet formatted: string;\n\t\ttry {\n\t\t\tformatted = formatZodError(e, poolOptions);\n\t\t} catch {\n\t\t\tthrow e;\n\t\t}\n\t\tconst relativePath = getRelativeProjectConfigPath(project);\n\t\tthrow new TypeError(\n\t\t\t`Unexpected options in project ${relativePath}:\\n${formatted}`\n\t\t);\n\t}\n}\n","import type { Request, Response } from \"miniflare\";\nimport type { Unstable_ASSETSBindingsOptions } from \"wrangler\";\n\n// Track all AbortControllers created by buildPagesASSETSBinding so they can\n// be cleaned up when the last pool worker stops. This is necessary because\n// vitest evaluates all project configs at startup (to discover the workspace),\n// even for projects that won't run — so the watchers are created before any\n// pool worker exists, and the creating project's pool worker may never start.\nconst registeredControllers = new Set<AbortController>();\n\n// Reference count of active pool workers. Watchers are only closed when the\n// last worker stops, so that early-finishing workers don't kill watchers that\n// later workers (or other projects in the workspace) still need.\nlet activeWorkers = 0;\n\nexport function poolWorkerStarted(): void {\n\tactiveWorkers++;\n}\n\nexport function poolWorkerStopped(): void {\n\tactiveWorkers--;\n\tif (activeWorkers <= 0) {\n\t\tactiveWorkers = 0;\n\t\tfor (const ac of registeredControllers) {\n\t\t\tac.abort();\n\t\t}\n\t\tregisteredControllers.clear();\n\t}\n}\n\nexport async function buildPagesASSETSBinding(\n\tassetsPath: string\n): Promise<(request: Request) => Promise<Response>> {\n\t// noinspection SuspiciousTypeOfGuard\n\tif (typeof assetsPath !== \"string\") {\n\t\tthrow new TypeError(\n\t\t\t\"Failed to execute 'buildPagesASSETSBinding': parameter 1 is not of type 'string'.\"\n\t\t);\n\t}\n\n\tconst { unstable_generateASSETSBinding } = await import(\"wrangler\"); // (lazy)\n\n\t// Create the AbortController after the import succeeds so we don't leak\n\t// a registered controller if the import throws.\n\tconst ac = new AbortController();\n\tregisteredControllers.add(ac);\n\n\tconst log = {\n\t\t...console,\n\t\tdebugWithSanitization: console.debug,\n\t\tloggerLevel: \"info\",\n\t\tcolumns: process.stdout.columns,\n\t} as unknown as Unstable_ASSETSBindingsOptions[\"log\"];\n\treturn unstable_generateASSETSBinding({\n\t\tlog,\n\t\tdirectory: assetsPath,\n\t\tsignal: ac.signal,\n\t});\n}\n","import assert from \"node:assert\";\nimport path from \"node:path\";\nimport { compileModuleRules, testRegExps } from \"miniflare\";\nimport { type ProvidedContext } from \"vitest\";\nimport { workerdBuiltinModules } from \"../shared/builtin-modules\";\nimport { parseProjectOptions, remoteProxySessionsDataMap } from \"./config\";\nimport { poolWorkerStarted, poolWorkerStopped } from \"./pages\";\nimport { type WorkerPoolOptionsContext } from \"./plugin\";\nimport {\n\tassertCompatibleVitestVersion,\n\tconnectToMiniflareSocket,\n\tgetDurableObjectDesignators,\n\tgetProjectMiniflare,\n\tgetRunnerName,\n\tmaybeGetResolvedMainPath,\n\tstructuredSerializableParse,\n\tstructuredSerializableStringify,\n} from \".\";\nimport type {\n\tWorkersConfigPluginAPI,\n\tWorkersPoolOptions,\n\tWorkersPoolOptionsWithDefines,\n} from \"./config\";\nimport type {\n\tMiniflare,\n\tMessageEvent as MiniflareMessageEvent,\n\tWebSocket,\n} from \"miniflare\";\nimport type {\n\tPoolOptions,\n\tPoolWorker,\n\tWorkerRequest,\n\tWorkerResponse,\n} from \"vitest/node\";\n\nexport class CloudflarePoolWorker implements PoolWorker {\n\tname = \"cloudflare-pool\";\n\tprivate mf: Miniflare | undefined;\n\tprivate socket: WebSocket | undefined;\n\tprivate parsedPoolOptions: WorkersPoolOptionsWithDefines | undefined;\n\tprivate main: string | undefined;\n\t// Store wrapped listeners so off() can remove them correctly.\n\t// Vitest registers at most one listener per event type.\n\tprivate messageListener?: (event: MiniflareMessageEvent) => void;\n\tprivate errorListener?: (event: Event) => void;\n\tprivate closeListener?: () => void;\n\n\tconstructor(\n\t\tprivate options: PoolOptions,\n\t\tprivate poolOptions:\n\t\t\t| WorkersPoolOptions\n\t\t\t| ((\n\t\t\t\t\tctx: WorkerPoolOptionsContext\n\t\t\t  ) => Promise<WorkersPoolOptions> | WorkersPoolOptions)\n\t) {\n\t\tassertCompatibleVitestVersion(options.project.vitest);\n\t}\n\n\tasync start(): Promise<void> {\n\t\tpoolWorkerStarted();\n\n\t\tlet resolvedPoolOptions: WorkersPoolOptions;\n\t\tif (typeof this.poolOptions === \"function\") {\n\t\t\t// https://github.com/vitest-dev/vitest/blob/v4.0.18/packages/vitest/src/integrations/inject.ts\n\t\t\tconst inject = <K extends keyof ProvidedContext>(\n\t\t\t\tkey: K\n\t\t\t): ProvidedContext[K] => {\n\t\t\t\treturn this.options.project.getProvidedContext()[key];\n\t\t\t};\n\t\t\tresolvedPoolOptions = await this.poolOptions({ inject });\n\t\t} else {\n\t\t\tresolvedPoolOptions = this.poolOptions;\n\t\t}\n\n\t\tthis.parsedPoolOptions = await parseProjectOptions(\n\t\t\tthis.options.project,\n\t\t\tresolvedPoolOptions\n\t\t);\n\t\tthis.main = maybeGetResolvedMainPath(\n\t\t\tthis.options.project,\n\t\t\tthis.parsedPoolOptions\n\t\t);\n\n\t\t// Find the vitest-pool-workers plugin and give it the path to the main file.\n\t\t// This allows that plugin to inject a virtual dependency on main so that vitest\n\t\t// will automatically re-run tests when that gets updated, avoiding the user having\n\t\t// to manually add such an import in their tests.\n\t\tconst configPlugin = this.options.project.vite.config.plugins.find(\n\t\t\t({ name }) => name === \"@cloudflare/vitest-pool-workers\"\n\t\t);\n\t\tif (configPlugin !== undefined) {\n\t\t\tconst api = configPlugin.api as WorkersConfigPluginAPI;\n\t\t\tapi.setMain(this.main);\n\t\t}\n\n\t\tthis.mf = await getProjectMiniflare(\n\t\t\tthis.options.project.vitest,\n\t\t\tthis.options.project,\n\t\t\tthis.parsedPoolOptions,\n\t\t\tthis.main\n\t\t);\n\n\t\tthis.socket = await connectToMiniflareSocket(\n\t\t\tthis.mf,\n\t\t\tgetRunnerName(this.options.project)\n\t\t);\n\t}\n\n\tasync stop(): Promise<void> {\n\t\tthis.socket?.close();\n\t\tthis.socket = undefined;\n\t\tawait this.mf?.dispose();\n\t\tthis.mf = undefined;\n\n\t\tif (this.parsedPoolOptions?.wrangler?.configPath) {\n\t\t\tawait remoteProxySessionsDataMap\n\t\t\t\t.get(this.parsedPoolOptions?.wrangler?.configPath)\n\t\t\t\t?.session?.dispose?.();\n\t\t}\n\n\t\t// Decrement the active worker count. When the last worker stops, this\n\t\t// closes file watchers created by buildPagesASSETSBinding() during config\n\t\t// evaluation — they're registered globally because vitest evaluates all\n\t\t// project configs at startup, even for projects that won't run.\n\t\tpoolWorkerStopped();\n\t}\n\n\tsend(message: WorkerRequest): void {\n\t\t// Vitest will always call `start()` before calling `send()`\n\t\tassert(this.socket, \"Message sent to Worker before initialisation\");\n\t\tassert(\n\t\t\tthis.parsedPoolOptions,\n\t\t\t\"Message sent to Worker before initialisation\"\n\t\t);\n\n\t\t// Avoid mutating Vitest's message objects — shallow-copy the parts we modify\n\t\tlet toSend: WorkerRequest = message;\n\t\tif (message.type === \"start\") {\n\t\t\t// Users can write `vitest --inspect` to start an inspector connection for their tests\n\t\t\t// We intercept that option and use it to enable inspection of the Workers running in workerd\n\t\t\t// We need to stop it passing through into Vitest's in-Worker code, or Vitest will try and import\n\t\t\t// and run `inspector.open()` from `node:inspector`\n\t\t\ttoSend = {\n\t\t\t\t...message,\n\t\t\t\tcontext: {\n\t\t\t\t\t...message.context,\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\t...message.context.config,\n\t\t\t\t\t\tinspector: {\n\t\t\t\t\t\t\t...message.context.config.inspector,\n\t\t\t\t\t\t\tenabled: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t} else if (message.type === \"run\") {\n\t\t\t// For some reason providing this using the Vitest `project.provide` API\n\t\t\t// doesn't work in Vitest Projects, and so we just provide the context directly\n\t\t\ttoSend = {\n\t\t\t\t...message,\n\t\t\t\tcontext: {\n\t\t\t\t\t...message.context,\n\t\t\t\t\tprovidedContext: {\n\t\t\t\t\t\t...message.context.providedContext,\n\t\t\t\t\t\tcloudflarePoolOptions: JSON.stringify({\n\t\t\t\t\t\t\t// Include resolved `main` if defined\n\t\t\t\t\t\t\tmain: this.main,\n\t\t\t\t\t\t\t// Include designators of all Durable Object namespaces bound in the\n\t\t\t\t\t\t\t// runner worker. We'll use this to list IDs in a namespace. We'll\n\t\t\t\t\t\t\t// also use this to check Durable Object test runner helpers are\n\t\t\t\t\t\t\t// only used with classes defined in the current worker, as these\n\t\t\t\t\t\t\t// helpers rely on wrapping the object.\n\t\t\t\t\t\t\tdurableObjectBindingDesignators: [\n\t\t\t\t\t\t\t\t...getDurableObjectDesignators(\n\t\t\t\t\t\t\t\t\tthis.parsedPoolOptions\n\t\t\t\t\t\t\t\t).entries(),\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tselfName: getRunnerName(this.options.project),\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tthis.socket.send(structuredSerializableStringify(toSend));\n\t}\n\n\ton(\n\t\tevent: string,\n\t\tcallback:\n\t\t\t| ((maybeError: unknown) => void)\n\t\t\t| (() => void)\n\t\t\t| ((response: WorkerResponse) => void)\n\t): void {\n\t\t// Vitest will always call `start()` before calling `on()`\n\t\tassert(this.socket, \"Message received from Worker before initialisation\");\n\t\tassert(\n\t\t\tthis.parsedPoolOptions,\n\t\t\t\"Message received from Worker before initialisation\"\n\t\t);\n\n\t\tconst rules = this.parsedPoolOptions.miniflare?.modulesRules;\n\t\tconst compiledRules = compileModuleRules(rules ?? []);\n\n\t\tif (event === \"message\") {\n\t\t\tconst messageWrapper = (m: { data: string | ArrayBuffer }) => {\n\t\t\t\tconst d = structuredSerializableParse(\n\t\t\t\t\tm.data as string\n\t\t\t\t) as WorkerResponse;\n\n\t\t\t\t// This is a birpc serialised message before it's been parsed, which is why the properties are so unintelligible\n\t\t\t\t// We're looking for a `fetch()` RPC call: https://github.com/vitest-dev/vitest/blob/v4.0.18/packages/vitest/src/types/rpc.ts#L8\n\t\t\t\tif (\n\t\t\t\t\td &&\n\t\t\t\t\ttypeof d === \"object\" &&\n\t\t\t\t\t\"m\" in d &&\n\t\t\t\t\t\"a\" in d &&\n\t\t\t\t\t\"i\" in d &&\n\t\t\t\t\tArray.isArray(d.a) &&\n\t\t\t\t\td.m === \"fetch\"\n\t\t\t\t) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.socket,\n\t\t\t\t\t\t\"Message received from Worker before initialisation\"\n\t\t\t\t\t);\n\t\t\t\t\tconst specifier = d.a[0];\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t// `cloudflare:test` imports are handled by the `@cloudflare/vitest-pool-workers` plugin, and so should be ignored here\n\t\t\t\t\t\tspecifier !== \"cloudflare:test\" &&\n\t\t\t\t\t\t(/^(cloudflare|workerd):/.test(specifier) ||\n\t\t\t\t\t\t\tworkerdBuiltinModules.has(specifier))\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn this.socket.send(\n\t\t\t\t\t\t\t// Tell Vitest to treat this module as \"external\" and load it using a workerd module import\n\t\t\t\t\t\t\tstructuredSerializableStringify({\n\t\t\t\t\t\t\t\tt: \"s\",\n\t\t\t\t\t\t\t\ti: d.i,\n\t\t\t\t\t\t\t\tr: { externalize: specifier },\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst maybeRule = compiledRules.find((rule) =>\n\t\t\t\t\t\ttestRegExps(rule.include, specifier)\n\t\t\t\t\t);\n\t\t\t\t\tconst isWasmModuleSpecifier =\n\t\t\t\t\t\tmaybeRule?.type === \"CompiledWasm\" &&\n\t\t\t\t\t\tspecifier.endsWith(\".wasm?module\");\n\t\t\t\t\t// Skip most query params (e.g. `?raw`), letting Vite handle them.\n\t\t\t\t\t// `.wasm?module` is an alias for a compiled WebAssembly module, so\n\t\t\t\t\t// we still need to externalize it through the fallback service.\n\t\t\t\t\tif (\n\t\t\t\t\t\tmaybeRule !== undefined &&\n\t\t\t\t\t\t(!specifier.includes(\"?\") || isWasmModuleSpecifier)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Vite uses `/@fs/` for absolute dependency paths outside the\n\t\t\t\t\t\t// project root. Convert those back to real filesystem paths.\n\t\t\t\t\t\tlet externalize = specifier.startsWith(\"/@fs/\")\n\t\t\t\t\t\t\t? specifier.substring(\"/@fs\".length)\n\t\t\t\t\t\t\t: path.join(this.options.project.config.root, specifier);\n\n\t\t\t\t\t\tif (isWasmModuleSpecifier) {\n\t\t\t\t\t\t\texternalize = externalize.slice(0, -\"?module\".length);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn this.socket.send(\n\t\t\t\t\t\t\tstructuredSerializableStringify({\n\t\t\t\t\t\t\t\tt: \"s\",\n\t\t\t\t\t\t\t\ti: d.i,\n\t\t\t\t\t\t\t\tr: {\n\t\t\t\t\t\t\t\t\texternalize: `${externalize}?mf_vitest_force=${maybeRule.type}`,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t(callback as (response: WorkerResponse) => void)(d);\n\t\t\t};\n\t\t\tthis.messageListener = messageWrapper as (\n\t\t\t\tevent: MiniflareMessageEvent\n\t\t\t) => void;\n\t\t\tthis.socket.addEventListener(\"message\", this.messageListener);\n\t\t} else if (event === \"error\") {\n\t\t\tthis.errorListener = (e: Event) => {\n\t\t\t\t(callback as (maybeError: unknown) => void)(\"error\" in e ? e.error : e);\n\t\t\t};\n\t\t\tthis.socket.addEventListener(\"error\", this.errorListener);\n\t\t} else if (event === \"exit\") {\n\t\t\tthis.closeListener = callback as () => void;\n\t\t\tthis.socket.addEventListener(\"close\", this.closeListener);\n\t\t}\n\t}\n\n\toff(event: string, _callback: (_arg: unknown) => void): void {\n\t\tif (event === \"message\" && this.messageListener) {\n\t\t\tthis.socket?.removeEventListener(\"message\", this.messageListener);\n\t\t\tthis.messageListener = undefined;\n\t\t} else if (event === \"error\" && this.errorListener) {\n\t\t\tthis.socket?.removeEventListener(\"error\", this.errorListener);\n\t\t\tthis.errorListener = undefined;\n\t\t} else if (event === \"exit\" && this.closeListener) {\n\t\t\tthis.socket?.removeEventListener(\"close\", this.closeListener);\n\t\t\tthis.closeListener = undefined;\n\t\t}\n\t}\n\n\t// Vitest does not have a corresponding `serialize()` option, so we can't actually use this for serialisation\n\t// Instead, we serialize/deserialize in the `send()` and `on()` methods.\n\tdeserialize(data: unknown) {\n\t\treturn data;\n\t}\n}\n","import { CloudflarePoolWorker } from \"./cloudflare-pool-worker\";\nimport type { WorkersPoolOptions } from \"./config\";\nimport type { WorkerPoolOptionsContext } from \"./plugin\";\nimport type { PoolRunnerInitializer } from \"vitest/node\";\n\nexport function cloudflarePool(\n\tpoolOptions:\n\t\t| WorkersPoolOptions\n\t\t| ((\n\t\t\t\tctx: WorkerPoolOptionsContext\n\t\t  ) => Promise<WorkersPoolOptions> | WorkersPoolOptions)\n): PoolRunnerInitializer {\n\treturn {\n\t\tname: \"cloudflare-pool\",\n\t\tcreatePoolWorker: (options) =>\n\t\t\tnew CloudflarePoolWorker(options, poolOptions),\n\t};\n}\n","import crypto from \"node:crypto\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { cloudflarePool } from \"./pool\";\nimport type { WorkersPoolOptions } from \"./config\";\nimport type { inject } from \"vitest\";\nimport type { Vite, VitestPluginContext } from \"vitest/node\";\n\nconst cloudflareTestPath = path.resolve(\n\timport.meta.dirname,\n\t\"../worker/lib/cloudflare/test.mjs\"\n);\n\nexport interface WorkerPoolOptionsContext {\n\t// For accessing values from `globalSetup()` (e.g. ports servers started on)\n\t// in Miniflare options (e.g. bindings, upstream, hyperdrives, ...)\n\tinject: typeof inject;\n}\n\nfunction ensureArrayIncludes<T>(array: T[], items: T[]) {\n\tfor (const item of items) {\n\t\tif (!array.includes(item)) {\n\t\t\tarray.push(item);\n\t\t}\n\t}\n}\n\nfunction ensureArrayExcludes<T>(array: T[], items: T[]) {\n\tfor (let i = 0; i < array.length; i++) {\n\t\tif (items.includes(array[i])) {\n\t\t\tarray.splice(i, 1);\n\t\t\ti--;\n\t\t}\n\t}\n}\n\nconst requiredConditions = [\"workerd\", \"worker\", \"module\", \"browser\"];\nconst requiredMainFields = [\"browser\", \"module\", \"jsnext:main\", \"jsnext\"];\n\nexport function cloudflareTest(\n\toptions:\n\t\t| WorkersPoolOptions\n\t\t| ((\n\t\t\t\tctx: WorkerPoolOptionsContext\n\t\t  ) => Promise<WorkersPoolOptions> | WorkersPoolOptions)\n): Vite.Plugin {\n\t// Use a unique ID for each `cloudflare:test` module so updates in one `main`\n\t// don't trigger re-runs in all other projects, just the one that changed.\n\tconst uuid = crypto.randomUUID();\n\tlet main: string | undefined;\n\treturn {\n\t\tname: \"@cloudflare/vitest-pool-workers\",\n\t\tapi: {\n\t\t\tsetMain(newMain: string) {\n\t\t\t\tmain = newMain;\n\t\t\t},\n\t\t},\n\t\tconfigureVitest(context: VitestPluginContext) {\n\t\t\tcontext.project.config.poolRunner = cloudflarePool(options);\n\t\t\tcontext.project.config.pool = \"cloudflare-pool\";\n\t\t\tcontext.project.config.snapshotEnvironment = \"cloudflare:snapshot\";\n\t\t},\n\t\t// Run after `vitest:project` plugin:\n\t\t// https://github.com/vitest-dev/vitest/blob/v4.0.18/packages/vitest/src/node/plugins/workspace.ts#L122\n\t\tconfig(config) {\n\t\t\tconfig.resolve ??= {};\n\t\t\tconfig.resolve.conditions ??= [];\n\t\t\tconfig.resolve.mainFields ??= [];\n\t\t\tconfig.ssr ??= {};\n\n\t\t\tconfig.test ??= {};\n\t\t\tconfig.test.server ??= {};\n\t\t\tconfig.test.server.deps ??= {};\n\n\t\t\t// V8 coverage requires `node:inspector` to collect coverage data from\n\t\t\t// V8's profiler. workerd provides `node:inspector` as a non-functional\n\t\t\t// stub, so V8 coverage silently fails or crashes. Istanbul works because\n\t\t\t// it instruments source code at build time without needing V8 access.\n\t\t\t// See: https://github.com/cloudflare/workers-sdk/issues/5266\n\t\t\tconst coverage = config.test.coverage;\n\t\t\tif (coverage && coverage.enabled) {\n\t\t\t\tconst provider = \"provider\" in coverage ? coverage.provider : undefined;\n\t\t\t\tif (provider === \"v8\" || provider === undefined) {\n\t\t\t\t\tconst lines = [\n\t\t\t\t\t\t'Coverage provider \"v8\" is not supported by `@cloudflare/vitest-pool-workers`.',\n\t\t\t\t\t\t\"V8 native coverage requires `node:inspector` which is not functional in the Workers runtime.\",\n\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\"Use Istanbul instead — it works by instrumenting source code and runs on any JavaScript runtime:\",\n\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\"  1. Install: npm i -D @vitest/coverage-istanbul\",\n\t\t\t\t\t\t'  2. Set `test.coverage.provider` to \"istanbul\" in your Vitest config',\n\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\"See https://vitest.dev/guide/coverage#istanbul-provider for more details.\",\n\t\t\t\t\t];\n\t\t\t\t\tthrow new Error(lines.join(\"\\n\"));\n\t\t\t\t}\n\t\t\t}\n\t\t\t// See https://vitest.dev/config/server.html#inline\n\t\t\t// Without this Vitest delegates to native import() for external deps in node_modules\n\t\t\tconfig.test.server.deps.inline = true;\n\n\t\t\t// Remove \"node\" condition added by the `vitest:project` plugin. We're\n\t\t\t// running tests inside `workerd`, not Node.js, so \"node\" isn't needed.\n\t\t\tensureArrayExcludes(config.resolve.conditions, [\"node\"]);\n\n\t\t\t// Use the same resolve conditions as `wrangler`, minus \"import\" as this\n\t\t\t// breaks Vite's `require()` resolve\n\t\t\tensureArrayIncludes(config.resolve.conditions, requiredConditions);\n\n\t\t\t// Vitest sets this to an empty array if unset, so restore Vite defaults:\n\t\t\t// https://github.com/vitest-dev/vitest/blob/v4.0.18/packages/vitest/src/node/plugins/utils.ts#L121\n\t\t\tensureArrayIncludes(config.resolve.mainFields, requiredMainFields);\n\n\t\t\t// Apply `package.json` `browser` field remapping in SSR mode:\n\t\t\t// https://github.com/vitejs/vite/blob/v5.1.4/packages/vite/src/node/plugins/resolve.ts#L175\n\t\t\tconfig.ssr.target = \"webworker\";\n\t\t},\n\t\tresolveId(id) {\n\t\t\tif (id === \"cloudflare:test\") {\n\t\t\t\treturn `\\0cloudflare:test-${uuid}`;\n\t\t\t}\n\t\t},\n\t\tasync load(id) {\n\t\t\tif (id === `\\0cloudflare:test-${uuid}`) {\n\t\t\t\tlet contents = await fs.readFile(cloudflareTestPath, \"utf8\");\n\n\t\t\t\tif (main !== undefined) {\n\t\t\t\t\t// Inject a side-effect only import of the main entry-point into the test so that Vitest\n\t\t\t\t\t// knows to re-run tests when the Worker is modified.\n\t\t\t\t\tcontents += `import ${JSON.stringify(main)};`;\n\t\t\t\t}\n\t\t\t\treturn contents;\n\t\t\t}\n\t\t\tif (id.endsWith(\"msw/lib/node/index.mjs\")) {\n\t\t\t\t// HACK: This is a temporary solution while MSW works on some changes to better support the Workers\n\t\t\t\t// environment. In the meantime, this replaces the `msw/node` entrypoint with the `msw/native`\n\t\t\t\t// entrypoint (which is designed for React Native and does work in Workers). Users can't use\n\t\t\t\t// `msw/native` themselves directly as the export conditions are not compatible with the Vitest Pool\n\t\t\t\t// export conditions.\n\t\t\t\t//\n\t\t\t\t// This is tracked by https://github.com/mswjs/msw/issues/2637\n\t\t\t\treturn `export * from \"../native/index.mjs\"`;\n\t\t\t}\n\t\t},\n\t};\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { D1Migration } from \"../shared/d1\";\n\n/**\n * Reads all migrations in `migrationsPath`, ordered by migration number.\n * Each migration will have its contents split into an array of SQL queries.\n */\nexport async function readD1Migrations(\n\tmigrationsPath: string\n): Promise<D1Migration[]> {\n\t// noinspection SuspiciousTypeOfGuard\n\tif (typeof migrationsPath !== \"string\") {\n\t\tthrow new TypeError(\n\t\t\t\"Failed to execute 'readD1Migrations': parameter 1 is not of type 'string'.\"\n\t\t);\n\t}\n\n\tconst { unstable_splitSqlQuery } = await import(\"wrangler\"); // (lazy)\n\tconst names = fs\n\t\t.readdirSync(migrationsPath)\n\t\t.filter((name) => name.endsWith(\".sql\"));\n\tnames.sort((a, b) => {\n\t\tconst aNumber = parseInt(a.split(\"_\")[0]);\n\t\tconst bNumber = parseInt(b.split(\"_\")[0]);\n\t\treturn aNumber - bNumber;\n\t});\n\treturn names.map((name) => {\n\t\tconst migrationPath = path.join(migrationsPath, name);\n\t\tconst migration = fs.readFileSync(migrationPath, \"utf8\");\n\t\tconst queries = unstable_splitSqlQuery(migration);\n\t\treturn { name, queries };\n\t});\n}\n\nexport type { D1Migration };\n","import assert from \"node:assert\";\nimport crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport util from \"node:util\";\nimport { getTodaysCompatDate } from \"@cloudflare/workers-utils\";\nimport * as devalue from \"devalue\";\nimport getPort, { portNumbers } from \"get-port\";\nimport {\n\tgetNodeCompat,\n\tkCurrentWorker,\n\tkUnsafeEphemeralUniqueKey,\n\tLog,\n\tLogLevel,\n\tmaybeApply,\n\tMiniflare,\n\tstructuredSerializableReducers,\n\tstructuredSerializableRevivers,\n} from \"miniflare\";\nimport semverSatisfies from \"semver/functions/satisfies.js\";\nimport { experimental_readRawConfig } from \"wrangler\";\nimport { CompatibilityFlagAssertions } from \"./compatibility-flag-assertions\";\nimport { guessWorkerExports } from \"./guess-exports\";\nimport {\n\tgetProjectPath,\n\tgetRelativeProjectPath,\n\tisFileNotFoundError,\n\tWORKER_NAME_PREFIX,\n} from \"./helpers\";\nimport { handleLoopbackRequest } from \"./loopback\";\nimport { handleModuleFallbackRequest } from \"./module-fallback\";\nimport type {\n\tSourcelessWorkerOptions,\n\tWorkersPoolOptions,\n\tWorkersPoolOptionsWithDefines,\n} from \"./config\";\nimport type {\n\tMiniflareOptions,\n\tSharedOptions,\n\tWorkerOptions,\n\tWorkerdStructuredLog,\n} from \"miniflare\";\nimport type { TestProject, Vitest } from \"vitest/node\";\n\nexport function structuredSerializableStringify(value: unknown): string {\n\t// Vitest v2+ sends a sourcemap to its runner, which we can't serialise currently.\n\t// Stripping it doesn't seem to cause any problems, and error stack traces etc.\n\t// still seem to work.\n\t// TODO: Figure out how to serialise SourceMap instances\n\tif (\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t\"r\" in value &&\n\t\tvalue.r &&\n\t\ttypeof value.r === \"object\" &&\n\t\t\"map\" in value.r &&\n\t\tvalue.r.map\n\t) {\n\t\t// Shallow-copy to avoid mutating the caller's object\n\t\tvalue = { ...value, r: { ...value.r, map: undefined } };\n\t}\n\treturn devalue.stringify(value, structuredSerializableReducers);\n}\n\nexport function structuredSerializableParse(value: string): unknown {\n\treturn devalue.parse(value, structuredSerializableRevivers);\n}\n\n// Log for pool info/warnings/errors (user-actionable messages only)\nconst log = new Log(LogLevel.INFO, { prefix: \"vpw\" });\n// Debug log gated behind NODE_DEBUG=vitest-pool-workers\nconst debug = util.debuglog(\"vitest-pool-workers\");\n// Log for Miniflare instances, used for user code warnings/errors\nconst mfLog = new Log(LogLevel.WARN);\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\nconst DIST_PATH = path.resolve(__dirname, \"..\");\nconst POOL_WORKER_PATH = path.join(DIST_PATH, \"worker/index.mjs\");\n\nconst symbolizerWarning =\n\t\"warning: Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set.\";\nconst ignoreMessages = [\n\tsymbolizerWarning,\n\t// Not user actionable\n\t// TODO(someday): this is normal operation and really shouldn't error\n\t\"disconnected: operation canceled\",\n\t\"disconnected: worker_do_not_log; Request failed due to internal error\",\n\t\"disconnected: WebSocket was aborted\",\n\t\"disconnected: WebSocket peer disconnected\",\n\t\"CODE_MOVED for unknown code block\",\n\t\"broken.outputGateBroken; jsg.Error: Instance dispose\",\n];\nfunction handleStructuredLogs({ level, message }: WorkerdStructuredLog): void {\n\tif (ignoreMessages.some((ignore) => message.includes(ignore))) {\n\t\treturn;\n\t}\n\n\tswitch (level) {\n\t\tcase \"error\":\n\t\tcase \"warn\":\n\t\t\tprocess.stderr.write(`${message}\\n`);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tprocess.stdout.write(`${message}\\n`);\n\t\t\tbreak;\n\t}\n}\n\nexport function getRunnerName(project: TestProject, testFile?: string) {\n\tconst name = `${WORKER_NAME_PREFIX}runner-${project.name.replace(\n\t\t/[^a-z0-9-]/gi,\n\t\t\"_\"\n\t)}`;\n\tif (testFile === undefined) {\n\t\treturn name;\n\t}\n\tconst testFileHash = crypto.createHash(\"sha1\").update(testFile).digest(\"hex\");\n\ttestFile = testFile.replace(/[^a-z0-9-]/gi, \"_\");\n\treturn `${name}-${testFileHash}-${testFile}`;\n}\n\nfunction isDurableObjectDesignatorToSelf(\n\tvalue: unknown\n): value is string | { className: string } {\n\t// Either this is a simple `string` designator to the current worker...\n\tif (typeof value === \"string\") {\n\t\treturn true;\n\t}\n\t// ...or it's an object designator without a `scriptName`. We're assuming the\n\t// user isn't able to guess the current worker name, so if a `scriptName` is\n\t// set, the designator is definitely for another worker.\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"className\" in value &&\n\t\ttypeof value.className === \"string\" &&\n\t\t(!(\"scriptName\" in value) || value.scriptName === undefined)\n\t);\n}\n\nfunction isWorkflowDesignatorToSelf(\n\tvalue: unknown,\n\tcurrentScriptName: string | undefined\n): value is { className: string } {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"className\" in value &&\n\t\ttypeof value.className === \"string\" &&\n\t\t(!(\"scriptName\" in value) ||\n\t\t\tvalue.scriptName === undefined ||\n\t\t\tvalue.scriptName === currentScriptName)\n\t);\n}\n\ninterface DurableObjectDesignator {\n\tclassName: string;\n\tscriptName?: string;\n\tunsafeUniqueKey?: string;\n}\n/**\n * Returns a map of Durable Objects bindings' bound names to the designators of\n * the objects they point to.\n */\nexport function getDurableObjectDesignators(\n\toptions: WorkersPoolOptions\n): Map<string /* bound name */, DurableObjectDesignator> {\n\tconst result = new Map<string, DurableObjectDesignator>();\n\tconst durableObjects = options.miniflare?.durableObjects ?? {};\n\tfor (const [key, designator] of Object.entries(durableObjects)) {\n\t\tif (typeof designator === \"string\") {\n\t\t\tresult.set(key, { className: designator });\n\t\t} else if (typeof designator.unsafeUniqueKey !== \"symbol\") {\n\t\t\tresult.set(key, {\n\t\t\t\tclassName: designator.className,\n\t\t\t\tscriptName: designator.scriptName,\n\t\t\t\tunsafeUniqueKey: designator.unsafeUniqueKey,\n\t\t\t});\n\t\t}\n\t}\n\n\tfor (const unboundDurableObject of options.miniflare\n\t\t?.additionalUnboundDurableObjects ?? []) {\n\t\tif (typeof unboundDurableObject.unsafeUniqueKey !== \"symbol\") {\n\t\t\tresult.set(unboundDurableObject.className, {\n\t\t\t\tclassName: unboundDurableObject.className,\n\t\t\t\tscriptName: unboundDurableObject.scriptName,\n\t\t\t\tunsafeUniqueKey: unboundDurableObject.unsafeUniqueKey,\n\t\t\t});\n\t\t}\n\t}\n\treturn result;\n}\n\n/**\n * Gets a set of Durable Object class names for the SELF Worker.\n *\n * This is calculated from the Durable Object bindings that point to SELF as well as the\n * unbound Durable Objects that only have migrations defined.\n */\nfunction getDurableObjectClasses(worker: SourcelessWorkerOptions): Set<string> {\n\t// TODO(someday): may need to extend this to take into account other workers\n\t//  if doing multi-worker tests across workspace projects\n\t// TODO(someday): may want to validate class names are valid identifiers?\n\tconst result = new Set<string>();\n\n\t// Get all the Durable Object class names from bindings to the SELF Worker.\n\tfor (const designator of Object.values(worker.durableObjects ?? {})) {\n\t\tif (isDurableObjectDesignatorToSelf(designator)) {\n\t\t\tresult.add(\n\t\t\t\ttypeof designator === \"string\" ? designator : designator.className\n\t\t\t);\n\t\t}\n\t}\n\n\t// And all the Durable Object class names that may not have bindings but have migrations.\n\tfor (const designator of worker.additionalUnboundDurableObjects ?? []) {\n\t\tresult.add(designator.className);\n\t}\n\n\treturn result;\n}\n\nfunction getWranglerWorkerName(\n\trelativeWranglerConfigPath?: string\n): string | undefined {\n\tif (!relativeWranglerConfigPath) {\n\t\treturn undefined;\n\t}\n\tconst wranglerConfigObject = experimental_readRawConfig({\n\t\tconfig: relativeWranglerConfigPath,\n\t});\n\treturn wranglerConfigObject.rawConfig.name;\n}\n\n/**\n * Gets a set of class names for Workflows defined in the SELF Worker.\n */\nfunction getWorkflowClasses(\n\tworker: SourcelessWorkerOptions,\n\trelativeWranglerConfigPath: string | undefined\n): Set<string> {\n\t// TODO(someday): may need to extend this to take into account other workers\n\t//  if doing multi-worker tests across workspace projects\n\t// TODO(someday): may want to validate class names are valid identifiers?\n\tconst result = new Set<string>();\n\tif (worker.workflows === undefined) {\n\t\treturn result;\n\t}\n\tfor (const key of Object.keys(worker.workflows)) {\n\t\tconst designator = worker.workflows[key];\n\n\t\tlet workerName: string | undefined;\n\t\t// If the designator's scriptName matches its own Worker name,\n\t\t// use that as the worker name, otherwise use the vitest worker's name\n\t\tconst wranglerWorkerName = getWranglerWorkerName(\n\t\t\trelativeWranglerConfigPath\n\t\t);\n\t\tif (wranglerWorkerName && designator.scriptName === wranglerWorkerName) {\n\t\t\tworkerName = wranglerWorkerName;\n\t\t} else {\n\t\t\tworkerName = worker.name;\n\t\t}\n\n\t\t// `designator` hasn't been validated at this point\n\t\tif (isWorkflowDesignatorToSelf(designator, workerName)) {\n\t\t\tresult.add(designator.className);\n\t\t\t// Shallow clone to avoid mutating config\n\t\t\tworker.workflows[key] = { ...designator };\n\t\t}\n\t}\n\treturn result;\n}\n\ntype ProjectWorkers = [\n\trunnerWorker: WorkerOptions,\n\t...auxiliaryWorkers: WorkerOptions[],\n];\n\nconst SELF_SERVICE_BINDING = \"__VITEST_POOL_WORKERS_SELF_SERVICE\";\nconst LOOPBACK_SERVICE_BINDING = \"__VITEST_POOL_WORKERS_LOOPBACK_SERVICE\";\nconst RUNNER_OBJECT_BINDING = \"__VITEST_POOL_WORKERS_RUNNER_OBJECT\";\n\nasync function buildProjectWorkerOptions(\n\tproject: TestProject,\n\tcustomOptions: WorkersPoolOptionsWithDefines,\n\tmain: string | undefined\n): Promise<ProjectWorkers> {\n\tconst relativeWranglerConfigPath = maybeApply(\n\t\t(v) => path.relative(\"\", v),\n\t\tcustomOptions.wrangler?.configPath\n\t);\n\tconst runnerWorker = customOptions.miniflare ?? {};\n\n\t// `unstable_getMiniflareWorkerOptions` returns service bindings whose `name`\n\t// is the literal `config.name` for self-references (e.g. `{ name: \"my-worker\" }`\n\t// when the wrangler config has `name: \"my-worker\"`). We rename the runner\n\t// worker below, so rewrite those self-references to `kCurrentWorker` first.\n\t// That symbol resolves at request time relative to the referer worker, so it\n\t// survives the rename.\n\tconst wranglerWorkerName = getWranglerWorkerName(relativeWranglerConfigPath);\n\tif (wranglerWorkerName && runnerWorker.serviceBindings) {\n\t\tfor (const [key, sb] of Object.entries(runnerWorker.serviceBindings)) {\n\t\t\tif (\n\t\t\t\ttypeof sb === \"object\" &&\n\t\t\t\tsb !== null &&\n\t\t\t\t\"name\" in sb &&\n\t\t\t\tsb.name === wranglerWorkerName\n\t\t\t) {\n\t\t\t\trunnerWorker.serviceBindings[key] = { ...sb, name: kCurrentWorker };\n\t\t\t}\n\t\t}\n\t}\n\n\trunnerWorker.name = getRunnerName(project);\n\n\t// Make sure the worker has the `nodejs_compat` and `export_commonjs_default`\n\t// compatibility flags enabled. Vitest makes heavy use of Node APIs, and many\n\t// of the libraries it depends on expect `require()` to return\n\t// `module.exports` directly, rather than `{ default: module.exports }`.\n\trunnerWorker.compatibilityFlags ??= [];\n\n\t// By default, workerd tracks which request context a promise was created in\n\t// and rejects promises that resolve in a different request context. This is a\n\t// safety feature for production Workers to prevent data leaking between\n\t// requests. However, vitest-pool-workers runs all test files within the same\n\t// Durable Object, so promise resolution regularly crosses request boundaries\n\t// (e.g. a setup promise created for one test file resolving during another).\n\t// Without this flag, those promises get rejected and tests break.\n\trunnerWorker.compatibilityFlags.push(\n\t\t\"no_handle_cross_request_promise_resolution\"\n\t);\n\n\tif (runnerWorker.compatibilityDate === undefined) {\n\t\t// No compatibility date was provided, so use today's date\n\t\trunnerWorker.compatibilityDate = getTodaysCompatDate();\n\t\tdebug(\n\t\t\t\"No compatibility date was provided for project %s, defaulting to today's date %s.\",\n\t\t\tgetRelativeProjectPath(project),\n\t\t\trunnerWorker.compatibilityDate\n\t\t);\n\t}\n\n\tconst flagAssertions = new CompatibilityFlagAssertions({\n\t\tcompatibilityDate: runnerWorker.compatibilityDate,\n\t\tcompatibilityFlags: runnerWorker.compatibilityFlags,\n\t\toptionsPath: `miniflare`,\n\t\trelativeProjectPath: getRelativeProjectPath(project),\n\t\trelativeWranglerConfigPath,\n\t});\n\n\tconst assertions = [\n\t\t() =>\n\t\t\tflagAssertions.assertIsEnabled({\n\t\t\t\tenableFlag: \"export_commonjs_default\",\n\t\t\t\tdisableFlag: \"export_commonjs_namespace\",\n\t\t\t\tdefaultOnDate: \"2022-10-31\",\n\t\t\t}),\n\t];\n\n\tfor (const assertion of assertions) {\n\t\tconst result = assertion();\n\t\tif (!result.isValid) {\n\t\t\tthrow new Error(result.errorMessage);\n\t\t}\n\t}\n\n\tconst { hasNoNodejsCompatV2Flag, mode } = getNodeCompat(\n\t\trunnerWorker.compatibilityDate,\n\t\trunnerWorker.compatibilityFlags\n\t);\n\n\t// Force nodejs_compat_v2 flag, even if it is disabled by the user, since we require this native stuff for Vitest to work properly\n\tif (mode !== \"v2\") {\n\t\tif (hasNoNodejsCompatV2Flag) {\n\t\t\trunnerWorker.compatibilityFlags.splice(\n\t\t\t\trunnerWorker.compatibilityFlags.indexOf(\"no_nodejs_compat_v2\"),\n\t\t\t\t1\n\t\t\t);\n\t\t}\n\t\trunnerWorker.compatibilityFlags.push(\"nodejs_compat_v2\");\n\t}\n\n\t// Required for `workerd:unsafe` module. We don't require this flag to be set\n\t// as it's experimental, so couldn't be deployed by users.\n\tif (!runnerWorker.compatibilityFlags.includes(\"unsafe_module\")) {\n\t\trunnerWorker.compatibilityFlags.push(\"unsafe_module\");\n\t}\n\n\t// The following nodejs compat flags enable features required for Vitest to work properly\n\tensureFeature(runnerWorker.compatibilityFlags, \"nodejs_tty_module\");\n\tensureFeature(runnerWorker.compatibilityFlags, \"nodejs_fs_module\");\n\tensureFeature(runnerWorker.compatibilityFlags, \"nodejs_http_modules\");\n\tensureFeature(runnerWorker.compatibilityFlags, \"nodejs_perf_hooks_module\");\n\tensureFeature(runnerWorker.compatibilityFlags, \"nodejs_v8_module\");\n\tensureFeature(runnerWorker.compatibilityFlags, \"nodejs_process_v2\");\n\n\t// Make sure we define an unsafe eval binding and enable the fallback service\n\trunnerWorker.unsafeEvalBinding = \"__VITEST_POOL_WORKERS_UNSAFE_EVAL\";\n\trunnerWorker.unsafeUseModuleFallbackService = true;\n\n\t// Make sure we define our self/loopback service bindings for helpers\n\trunnerWorker.serviceBindings ??= {};\n\trunnerWorker.serviceBindings[SELF_SERVICE_BINDING] = kCurrentWorker;\n\trunnerWorker.serviceBindings[LOOPBACK_SERVICE_BINDING] =\n\t\thandleLoopbackRequest;\n\n\t// Build wrappers for entrypoints and Durable Objects defined in this worker\n\trunnerWorker.durableObjects ??= {};\n\tconst durableObjectClassNames = getDurableObjectClasses(runnerWorker);\n\n\tconst workflowClassNames = getWorkflowClasses(\n\t\trunnerWorker,\n\t\trelativeWranglerConfigPath\n\t);\n\n\tconst selfWorkerExports: string[] = [];\n\tif (\n\t\tflagAssertions.isEnabled(\n\t\t\t\"enable_ctx_exports\",\n\t\t\t\"disable_ctx_exports\",\n\t\t\t\"2025-11-17\"\n\t\t)\n\t) {\n\t\ttry {\n\t\t\tconst guessedExports = await guessWorkerExports(\n\t\t\t\tmain,\n\t\t\t\tcustomOptions.additionalExports\n\t\t\t);\n\t\t\tfor (const [exportName, exportType] of guessedExports) {\n\t\t\t\tswitch (exportType) {\n\t\t\t\t\tcase \"DurableObject\":\n\t\t\t\t\t\tdurableObjectClassNames.add(exportName);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"WorkflowEntrypoint\":\n\t\t\t\t\t\tworkflowClassNames.add(exportName);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"WorkerEntrypoint\":\n\t\t\t\t\tcase null:\n\t\t\t\t\t\tselfWorkerExports.push(exportName);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconst message = `Failed to statically analyze the exports of the main Worker entry-point \"${customOptions.main}\"\\nMore details: ${e}`;\n\t\t\tfor (const line of message.split(\"\\n\")) {\n\t\t\t\tlog.warn(line);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst workerEntrypointExports = selfWorkerExports.filter(\n\t\t(name) =>\n\t\t\tname !== \"default\" &&\n\t\t\tname !== \"__esModule\" &&\n\t\t\t!durableObjectClassNames.has(name) &&\n\t\t\t!workflowClassNames.has(name)\n\t);\n\n\tconst wrappers = [\n\t\t'import { createWorkerEntrypointWrapper, createDurableObjectWrapper, createWorkflowEntrypointWrapper } from \"cloudflare:test-internal\";',\n\t];\n\n\tfor (const entrypointName of workerEntrypointExports.sort()) {\n\t\tconst quotedEntrypointName = JSON.stringify(entrypointName);\n\t\tconst wrapper = `export const ${entrypointName} = createWorkerEntrypointWrapper(${quotedEntrypointName});`;\n\t\twrappers.push(wrapper);\n\t}\n\tfor (const className of Array.from(durableObjectClassNames).sort()) {\n\t\tconst quotedClassName = JSON.stringify(className);\n\t\tconst wrapper = `export const ${className} = createDurableObjectWrapper(${quotedClassName});`;\n\t\twrappers.push(wrapper);\n\t}\n\n\tfor (const className of Array.from(workflowClassNames).sort()) {\n\t\tconst quotedClassName = JSON.stringify(className);\n\t\tconst wrapper = `export const ${className} = createWorkflowEntrypointWrapper(${quotedClassName});`;\n\t\twrappers.push(wrapper);\n\t}\n\n\t// Make sure we define the `__VITEST_POOL_WORKERS_RUNNER_DURABLE_OBJECT__` Durable Object,\n\t// which is the singleton host for running tests. It's ephemeral (in-memory)\n\t// because the runner doesn't need persistent state, and all disk-backed DOs\n\t// hit a workerd bug on Windows where SQLite paths use Unix-style forward\n\t// slashes (cloudflare/workerd#6110).\n\trunnerWorker.durableObjects[RUNNER_OBJECT_BINDING] = {\n\t\tclassName: \"__VITEST_POOL_WORKERS_RUNNER_DURABLE_OBJECT__\",\n\t\tunsafePreventEviction: true,\n\t\tunsafeUniqueKey: kUnsafeEphemeralUniqueKey,\n\t};\n\n\t// Vite has its own define mechanism, but we can't control it from custom\n\t// pools. Our defines come from `wrangler.toml` files which are only parsed\n\t// with the rest of the pool configuration. Instead, we implement our own\n\t// define script similar to Vite's. When defines change, Miniflare will be\n\t// restarted as the input options will be different.\n\tconst defines = `export default {\n\t\t${Object.entries(customOptions.defines ?? {})\n\t\t\t.map(([key, value]) => `${JSON.stringify(key)}: ${value}`)\n\t\t\t.join(\",\\n\")}\n\t};\n\t`;\n\n\t// Make sure we define the runner script, including object wrappers & defines\n\tif (\"script\" in runnerWorker) {\n\t\tdelete runnerWorker.script;\n\t}\n\tif (\"scriptPath\" in runnerWorker) {\n\t\tdelete runnerWorker.scriptPath;\n\t}\n\n\t// We want module names to be their absolute path without the leading\tslash\n\t// (i.e. the modules root should be the root directory). On Windows, we'd\n\t// like paths to include the drive letter (i.e. `/C:/a/b/c/index.mjs`).\n\t// Internally, Miniflare uses `path.relative(modulesRoot, path)` to compute\n\t// module names. Setting `modulesRoot` to a drive letter and prepending this\n\t// to paths ensures correct names. This requires us to specify `contents`\n\t// with module definitions though, as the new paths don't exist.\n\t// TODO: add source URL comments to injected modules for better stack traces\n\tconst modulesRoot = process.platform === \"win32\" ? \"Z:\\\\\" : \"/\";\n\trunnerWorker.modulesRoot = modulesRoot;\n\n\trunnerWorker.modules = [\n\t\t{\n\t\t\ttype: \"ESModule\",\n\t\t\tpath: path.join(modulesRoot, \"index.mjs\"),\n\t\t\tcontents: fs.readFileSync(POOL_WORKER_PATH),\n\t\t},\n\t\t{\n\t\t\ttype: \"ESModule\",\n\t\t\tpath: path.join(modulesRoot, \"__VITEST_POOL_WORKERS_USER_OBJECT\"),\n\t\t\tcontents: wrappers.join(\"\\n\"),\n\t\t},\n\t\t{\n\t\t\ttype: \"ESModule\",\n\t\t\tpath: path.join(modulesRoot, \"__VITEST_POOL_WORKERS_DEFINES\"),\n\t\t\tcontents: defines,\n\t\t},\n\t\t// The native workerd provided nodejs modules don't always support everything Vitest needs.\n\t\t// As a short-term fix, inject polyfills into the worker bundle that override the native modules.\n\t\t{\n\t\t\ttype: \"ESModule\",\n\t\t\tpath: path.join(modulesRoot, \"node:console\"),\n\t\t\tcontents: fs.readFileSync(\n\t\t\t\tpath.join(DIST_PATH, `worker/node/console.mjs`)\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: \"ESModule\",\n\t\t\tpath: path.join(modulesRoot, \"node:vm\"),\n\t\t\tcontents: fs.readFileSync(path.join(DIST_PATH, `worker/node/vm.mjs`)),\n\t\t},\n\t];\n\n\t// Build array of workers contributed by the workspace\n\tconst workers: ProjectWorkers = [runnerWorker as WorkerOptions];\n\tif (runnerWorker.workers !== undefined) {\n\t\t// Try to add workers defined by the user\n\t\tfor (let i = 0; i < runnerWorker.workers.length; i++) {\n\t\t\tconst worker: unknown = runnerWorker.workers[i];\n\t\t\t// Make sure the worker has a non-empty name...\n\t\t\tif (\n\t\t\t\ttypeof worker !== \"object\" ||\n\t\t\t\tworker === null ||\n\t\t\t\t!(\"name\" in worker) ||\n\t\t\t\ttypeof worker.name !== \"string\" ||\n\t\t\t\tworker.name === \"\"\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`In project ${getRelativeProjectPath(\n\t\t\t\t\t\tproject\n\t\t\t\t\t)}, \\`miniflare.workers[${i}].name\\` must be non-empty`\n\t\t\t\t);\n\t\t\t}\n\t\t\t// ...that doesn't start with our reserved prefix\n\t\t\tif (worker.name.startsWith(WORKER_NAME_PREFIX)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`In project ${getRelativeProjectPath(\n\t\t\t\t\t\tproject\n\t\t\t\t\t)}, \\`miniflare.workers[${i}].name\\` must not start with \"${WORKER_NAME_PREFIX}\", got ${\n\t\t\t\t\t\tworker.name\n\t\t\t\t\t}`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Miniflare will validate these options\n\t\t\tworkers.push(worker as WorkerOptions);\n\t\t}\n\t\tdelete runnerWorker.workers;\n\t}\n\n\treturn workers;\n}\n\nconst SHARED_MINIFLARE_OPTIONS: SharedOptions = {\n\tlog: mfLog,\n\tverbose: true,\n\thandleStructuredLogs,\n\tunsafeStickyBlobs: true,\n} satisfies Partial<MiniflareOptions>;\n\nconst DEFAULT_INSPECTOR_PORT = 9229;\n\nfunction getFirstAvailablePort(start: number): Promise<number> {\n\treturn getPort({ port: portNumbers(start, 65535) });\n}\n\ntype ModuleFallbackService = NonNullable<\n\tMiniflareOptions[\"unsafeModuleFallbackService\"]\n>;\n// Reuse the same bound module fallback service when constructing Miniflare\n// options, so deep equality checks succeed\nconst moduleFallbackServices = new WeakMap<Vitest, ModuleFallbackService>();\nfunction getModuleFallbackService(ctx: Vitest): ModuleFallbackService {\n\tlet service = moduleFallbackServices.get(ctx);\n\tif (service !== undefined) {\n\t\treturn service;\n\t}\n\tservice = handleModuleFallbackRequest.bind(undefined, ctx.vite);\n\tmoduleFallbackServices.set(ctx, service);\n\treturn service;\n}\n\n/**\n * Builds options for the Miniflare instance running tests for the given Vitest\n * project.\n */\nasync function buildProjectMiniflareOptions(\n\tctx: Vitest,\n\tproject: TestProject,\n\tcustomOptions: WorkersPoolOptions,\n\tmain: string | undefined\n): Promise<MiniflareOptions> {\n\tconst moduleFallbackService = getModuleFallbackService(ctx);\n\tconst [runnerWorker, ...auxiliaryWorkers] = await buildProjectWorkerOptions(\n\t\tproject,\n\t\tcustomOptions,\n\t\tmain\n\t);\n\n\tassert(runnerWorker.name !== undefined);\n\tassert(runnerWorker.name.startsWith(WORKER_NAME_PREFIX));\n\n\tlet inspectorPort: number | undefined;\n\tif (ctx.config.inspector.enabled) {\n\t\tconst userSpecifiedPort = ctx.config.inspector.port;\n\t\tif (userSpecifiedPort !== undefined) {\n\t\t\tconst availablePort = await getFirstAvailablePort(userSpecifiedPort);\n\t\t\tif (availablePort !== userSpecifiedPort) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Inspector port ${userSpecifiedPort} is not available. ` +\n\t\t\t\t\t\t`Either free up the port or remove the inspector port configuration to use an automatically assigned port.`\n\t\t\t\t);\n\t\t\t}\n\t\t\tinspectorPort = userSpecifiedPort;\n\t\t} else {\n\t\t\tinspectorPort = await getFirstAvailablePort(DEFAULT_INSPECTOR_PORT);\n\t\t\tif (inspectorPort !== DEFAULT_INSPECTOR_PORT) {\n\t\t\t\tlog.warn(\n\t\t\t\t\t`Default inspector port ${DEFAULT_INSPECTOR_PORT} not available, using ${inspectorPort} instead.`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\t...SHARED_MINIFLARE_OPTIONS,\n\t\tinspectorPort,\n\t\tunsafeModuleFallbackService: moduleFallbackService,\n\t\tworkers: [runnerWorker, ...auxiliaryWorkers],\n\t};\n}\nexport async function getProjectMiniflare(\n\tctx: Vitest,\n\tproject: TestProject,\n\tpoolOptions: WorkersPoolOptionsWithDefines,\n\tmain: string | undefined\n): Promise<Miniflare> {\n\tconst mfOptions = await buildProjectMiniflareOptions(\n\t\tctx,\n\t\tproject,\n\t\tpoolOptions,\n\t\tmain\n\t);\n\tdebug(\"Starting runtime for %s...\", getRelativeProjectPath(project));\n\tif (mfOptions.inspectorPort !== undefined) {\n\t\tlog.info(\n\t\t\t`Starting inspector on port ${mfOptions.inspectorPort} for ${getRelativeProjectPath(project)}`\n\t\t);\n\t}\n\tconst mf = new Miniflare(mfOptions);\n\tawait mf.ready;\n\treturn mf;\n}\n\nexport function maybeGetResolvedMainPath(\n\tproject: TestProject,\n\toptions: WorkersPoolOptionsWithDefines\n): string | undefined {\n\tconst projectPath = getProjectPath(project);\n\tconst main = options.main;\n\tif (main === undefined) {\n\t\treturn;\n\t}\n\tif (typeof projectPath === \"string\") {\n\t\treturn path.resolve(projectPath, main);\n\t} else {\n\t\treturn path.resolve(main);\n\t}\n}\n\nexport async function connectToMiniflareSocket(\n\tmf: Miniflare,\n\tworkerName: string\n) {\n\tconst ns = await mf.getDurableObjectNamespace(\n\t\tRUNNER_OBJECT_BINDING,\n\t\tworkerName\n\t);\n\n\t// @ts-expect-error `ColoLocalActorNamespace`s are not included in types\n\tconst stub = ns.get(\"singleton\");\n\n\tconst res = await stub.fetch(\"http://placeholder\", {\n\t\theaders: {\n\t\t\tUpgrade: \"websocket\",\n\t\t\t\"MF-Vitest-Worker-Data\": structuredSerializableStringify({\n\t\t\t\tcwd: process.cwd(),\n\t\t\t}),\n\t\t},\n\t});\n\n\tconst webSocket = res.webSocket;\n\tif (webSocket === null) {\n\t\tconst body = await res.text().catch(() => \"\");\n\t\tthrow new Error(\n\t\t\t`Failed to establish WebSocket to runner (status ${res.status}): ${body}`\n\t\t);\n\t}\n\n\twebSocket.accept();\n\n\treturn webSocket;\n}\n\ninterface PackageJson {\n\tname?: string;\n\tversion?: string;\n\tpeerDependencies?: Record<string, string | undefined>;\n\tbundledVersions?: Record<string, string | undefined>;\n}\nfunction getPackageJson(dirPath: string): PackageJson | undefined {\n\twhile (true) {\n\t\tconst pkgJsonPath = path.join(dirPath, \"package.json\");\n\t\ttry {\n\t\t\tconst contents = fs.readFileSync(pkgJsonPath, \"utf8\");\n\t\t\treturn JSON.parse(contents);\n\t\t} catch (e) {\n\t\t\tif (!isFileNotFoundError(e)) {\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\t\tconst nextDirPath = path.dirname(dirPath);\n\t\t// `path.dirname()` of the root directory is the root directory\n\t\tif (nextDirPath === dirPath) {\n\t\t\treturn;\n\t\t}\n\t\tdirPath = nextDirPath;\n\t}\n}\n\n/**\n * Extract the upstream vitest version from an alternative distribution's\n * package.json. Distributions like `@voidzero-dev/vite-plus-test` declare\n * the bundled vitest version in `bundledVersions.vitest`.\n */\nfunction getUpstreamVitestVersion(pkgJson: PackageJson): string | undefined {\n\treturn pkgJson.bundledVersions?.vitest;\n}\n\nexport function assertCompatibleVitestVersion(ctx: Vitest) {\n\t// Some package managers don't enforce `peerDependencies` requirements,\n\t// so add a runtime sanity check to ensure things don't break in strange ways.\n\tconst poolPkgJson = getPackageJson(__dirname);\n\tconst vitestPkgJson = getPackageJson(ctx.distPath);\n\tassert(\n\t\tpoolPkgJson !== undefined,\n\t\t\"Expected to find `package.json` for `@cloudflare/vitest-pool-workers`\"\n\t);\n\tassert(\n\t\tvitestPkgJson !== undefined,\n\t\t\"Expected to find `package.json` for `vitest`\"\n\t);\n\n\tconst expectedVitestVersion = poolPkgJson.peerDependencies?.vitest;\n\tassert(\n\t\texpectedVitestVersion !== undefined,\n\t\t\"Expected to find `@cloudflare/vitest-pool-workers`'s `vitest` version constraint\"\n\t);\n\n\tconst actualVitestVersion =\n\t\tvitestPkgJson.name === \"vitest\"\n\t\t\t? vitestPkgJson.version\n\t\t\t: (getUpstreamVitestVersion(vitestPkgJson) ?? vitestPkgJson.version);\n\tassert(\n\t\tactualVitestVersion !== undefined,\n\t\t\"Expected to find `vitest`'s version\"\n\t);\n\n\t// Hard error on Vitest v3, which definitely won't work\n\tif (semverSatisfies(actualVitestVersion, \"3.x\")) {\n\t\tconst message = `You're running \\`vitest@${actualVitestVersion}\\`, but this version of \\`@cloudflare/vitest-pool-workers\\` only supports \\`vitest ${expectedVitestVersion}\\`.`;\n\t\tthrow new Error(message);\n\t}\n\n\tif (!semverSatisfies(actualVitestVersion, expectedVitestVersion)) {\n\t\tconst message = [\n\t\t\t`You're running \\`vitest@${actualVitestVersion}\\`, but this version of \\`@cloudflare/vitest-pool-workers\\` only officially supports \\`vitest ${expectedVitestVersion}\\`.`,\n\t\t\t\"`@cloudflare/vitest-pool-workers` currently depends on internal Vitest APIs that are not protected by semantic-versioning guarantees.\",\n\t\t\t`Your tests may work without issue, but we can not guarantee compatibility outside of the above version range.`,\n\t\t].join(\"\\n\");\n\t\tlog.warn(message);\n\t}\n}\n\n/**\n * Ensures that the specified compatibility feature is enabled for Vitest to work.\n * @param compatibilityFlags The list of current compatibility flags.\n * @param feature The name of the feature to enable.\n */\nfunction ensureFeature(compatibilityFlags: string[], feature: string) {\n\tconst flagToEnable = `enable_${feature}`;\n\tconst flagToDisable = `disable_${feature}`;\n\tif (!compatibilityFlags.includes(flagToEnable)) {\n\t\tdebug(\n\t\t\t\"Adding `%s` compatibility flag during tests as this feature is needed to support the Vitest runner.\",\n\t\t\tflagToEnable\n\t\t);\n\t\tcompatibilityFlags.push(flagToEnable);\n\t}\n\tif (compatibilityFlags.includes(flagToDisable)) {\n\t\tlog.warn(\n\t\t\t`Removing \\`${flagToDisable}\\` compatibility flag during tests as that feature is needed to support the Vitest runner.`\n\t\t);\n\t\tcompatibilityFlags.splice(compatibilityFlags.indexOf(flagToDisable), 1);\n\t}\n}\n\nexport { cloudflarePool } from \"./pool\";\nexport { cloudflareTest } from \"./plugin\";\nexport * from \"./d1\";\nexport * from \"./pages\";\n"],"x_google_ignoreList":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAI,iBAAiB,OAAO,IAAI,kBAAkB;AAClD,IAA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