@nightintelligence/cloudflare-workers-utils 0.35.0-patch2 → 0.35.0-patch4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/browser.mjs +2 -2
  2. package/dist/{chunk-NXPJWJ2B.mjs → chunk-47QFQIPP.mjs} +7 -7
  3. package/dist/{chunk-NXPJWJ2B.mjs.map → chunk-47QFQIPP.mjs.map} +1 -1
  4. package/dist/{chunk-OPAKTV2K.mjs → chunk-555CCIJE.mjs} +4 -4
  5. package/dist/{chunk-OPAKTV2K.mjs.map → chunk-555CCIJE.mjs.map} +1 -1
  6. package/dist/chunk-CGILA3WO.mjs +12 -0
  7. package/dist/{chunk-6LYDFTTF.mjs.map → chunk-CGILA3WO.mjs.map} +1 -1
  8. package/dist/{chunk-3D4BXUZX.mjs → chunk-FEHWZI5W.mjs} +3 -3
  9. package/dist/{chunk-3D4BXUZX.mjs.map → chunk-FEHWZI5W.mjs.map} +1 -1
  10. package/dist/{chunk-CPLEE7LH.mjs → chunk-KAEJMITB.mjs} +3 -3
  11. package/dist/{chunk-CPLEE7LH.mjs.map → chunk-KAEJMITB.mjs.map} +1 -1
  12. package/dist/{chunk-VKFVZ67V.mjs → chunk-T6I7NOR4.mjs} +3 -3
  13. package/dist/{chunk-VKFVZ67V.mjs.map → chunk-T6I7NOR4.mjs.map} +1 -1
  14. package/dist/{chunk-W7DIL5J2.mjs → chunk-VTOON473.mjs} +4 -34
  15. package/dist/chunk-VTOON473.mjs.map +1 -0
  16. package/dist/chunk-W4SU7D4X.mjs +575 -0
  17. package/dist/chunk-W4SU7D4X.mjs.map +1 -0
  18. package/dist/{chunk-IGC3TZGH.mjs → chunk-YTEYGQOX.mjs} +4 -4
  19. package/dist/{chunk-IGC3TZGH.mjs.map → chunk-YTEYGQOX.mjs.map} +1 -1
  20. package/dist/{chunk-ZQ2EZEOC.mjs → chunk-Z7Q743IF.mjs} +3 -3
  21. package/dist/{chunk-ZQ2EZEOC.mjs.map → chunk-Z7Q743IF.mjs.map} +1 -1
  22. package/dist/{chunk-ZLUHKBEC.mjs → chunk-ZZBYXY7A.mjs} +3 -3
  23. package/dist/{chunk-ZLUHKBEC.mjs.map → chunk-ZZBYXY7A.mjs.map} +1 -1
  24. package/dist/compatibility-date.mjs +2 -2
  25. package/dist/compliance.mjs +6 -7
  26. package/dist/docker-path.mjs +3 -3
  27. package/dist/errors.mjs +2 -2
  28. package/dist/fs-helpers.mjs +2 -2
  29. package/dist/global-wrangler-config-path.mjs +3 -3
  30. package/dist/index.mjs +402 -17128
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/local-env.mjs +3 -78
  33. package/dist/local-env.mjs.map +1 -1
  34. package/dist/metafile-esm.json +1 -1
  35. package/dist/prometheus-metrics.mjs +2 -2
  36. package/dist/test-helpers/index.mjs +4 -5
  37. package/dist/test-helpers/index.mjs.map +1 -1
  38. package/dist/zod-format.mjs +2 -2
  39. package/package.json +1 -1
  40. package/dist/chunk-4RE36JUD.mjs +0 -3160
  41. package/dist/chunk-4RE36JUD.mjs.map +0 -1
  42. package/dist/chunk-6LYDFTTF.mjs +0 -40
  43. package/dist/chunk-G5FCNCLK.mjs +0 -47
  44. package/dist/chunk-G5FCNCLK.mjs.map +0 -1
  45. package/dist/chunk-W7DIL5J2.mjs.map +0 -1
  46. package/dist/open-OYMIZX6T.mjs +0 -609
  47. package/dist/open-OYMIZX6T.mjs.map +0 -1
package/dist/browser.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { constructWranglerConfig } from './chunk-ZQ2EZEOC.mjs';
2
- import './chunk-6LYDFTTF.mjs';
1
+ export { constructWranglerConfig } from './chunk-Z7Q743IF.mjs';
2
+ import './chunk-CGILA3WO.mjs';
3
3
  //# sourceMappingURL=browser.mjs.map
4
4
  //# sourceMappingURL=browser.mjs.map
@@ -1,9 +1,9 @@
1
- import { dedent } from './chunk-G5FCNCLK.mjs';
2
- import { getEnvironmentVariableFactory, getBooleanEnvironmentVariableFactory } from './chunk-OPAKTV2K.mjs';
3
- import { UserError } from './chunk-CPLEE7LH.mjs';
4
- import { getGlobalConfigPath } from './chunk-IGC3TZGH.mjs';
5
- import { __name } from './chunk-6LYDFTTF.mjs';
1
+ import { getEnvironmentVariableFactory, getBooleanEnvironmentVariableFactory } from './chunk-555CCIJE.mjs';
2
+ import { UserError } from './chunk-KAEJMITB.mjs';
3
+ import { getGlobalConfigPath } from './chunk-YTEYGQOX.mjs';
4
+ import { __name } from './chunk-CGILA3WO.mjs';
6
5
  import path from 'node:path';
6
+ import { dedent } from 'ts-dedent';
7
7
 
8
8
  var getC3CommandFromEnv = getEnvironmentVariableFactory({
9
9
  variableName: "WRANGLER_C3_COMMAND",
@@ -176,5 +176,5 @@ var getCloudflaredPathFromEnv = getEnvironmentVariableFactory({
176
176
  });
177
177
 
178
178
  export { COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getLocalExplorerEnabledFromEnv, getLocalObservabilityEnabledFromEnv, getNoSkillsUpdatePromptsFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, isDoNotTrackEnabled };
179
- //# sourceMappingURL=chunk-NXPJWJ2B.mjs.map
180
- //# sourceMappingURL=chunk-NXPJWJ2B.mjs.map
179
+ //# sourceMappingURL=chunk-47QFQIPP.mjs.map
180
+ //# sourceMappingURL=chunk-47QFQIPP.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/environment-variables/misc-variables.ts"],"names":[],"mappings":";;;;;;;AAkCO,IAAM,sBAAsB,6BAAA,CAA8B;AAAA,EAChE,YAAA,EAAc,qBAAA;AAAA,EACd,YAAA,+BAAoB,mBAAA,EAAN,cAAA;AACf,CAAC;AAED,IAAM,uBAAuB,6BAAA,CAA8B;AAAA,EAC1D,YAAA,EAAc;AACf,CAAC,CAAA;AAGM,SAAS,mBAAA,GAA+B;AAC9C,EAAA,MAAM,KAAA,GAAQ,oBAAA,EAAqB,EAAG,WAAA,EAAY;AAClD,EAAA,OAAO,KAAA,KAAU,OAAO,KAAA,KAAU,MAAA;AACnC;AAHgB,MAAA,CAAA,mBAAA,EAAA,qBAAA,CAAA;AAKhB,IAAM,wCACL,oCAAA,CAAqC;AAAA,EACpC,YAAA,EAAc;AACf,CAAC,CAAA;AAMK,SAAS,6BAAA,GAAqD;AACpE,EAAA,IAAI,qBAAoB,EAAG;AAC1B,IAAA,OAAO,KAAA;AAAA,EACR;AAEA,EAAA,OAAO,qCAAA,EAAsC;AAC9C;AANgB,MAAA,CAAA,6BAAA,EAAA,+BAAA,CAAA;AAcT,IAAM,kCACZ,oCAAA,CAAqC;AAAA,EACpC,YAAA,EAAc;AACf,CAAC;AAQK,IAAM,qCACZ,oCAAA,CAAqC;AAAA,EACpC,YAAA,EAAc,6BAAA;AAAA,EACd,YAAA,EAAc;AACf,CAAC;AAKK,IAAM,kCAAA,GAAqC,6BAAA;AAAA,EACjD;AAAA,IACC,YAAA,EAAc,0BAAA;AAAA,IACd,YAAA,+BAAoB,YAAA,EAAN,cAAA,CAAA;AAAA,IACd,OAAA,EAAS,CAAC,YAAA,EAAc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AAC;AAQM,IAAM,4BAA4B,6BAAA,CAA8B;AAAA,EACtE,YAAA,EAAc;AACf,CAAC","file":"chunk-NXPJWJ2B.mjs","sourcesContent":["import path from \"node:path\";\nimport { dedent } from \"ts-dedent\";\nimport { UserError } from \"../errors\";\nimport { getGlobalConfigPath } from \"../global-wrangler-config-path\";\nimport {\n\tgetBooleanEnvironmentVariableFactory,\n\tgetEnvironmentVariableFactory,\n} from \"./factory\";\nimport type { Config } from \"../config\";\n\n/**\n * `WRANGLER_C3_COMMAND` can override the command used by `wrangler init` when delegating to C3.\n *\n * By default this will use `create cloudflare`.\n *\n * To run against the beta release of C3 use:\n *\n * ```sh\n * # Tell Wrangler to use the beta version of create-cloudflare\n * WRANGLER_C3_COMMAND=\"create cloudflare@beta\" npx wrangler init\n * ```\n *\n * To test the integration between wrangler and C3 locally, use:\n *\n * ```sh\n * # Ensure both Wrangler and C3 are built\n * npm run build\n * # Tell Wrangler to use the local version of create-cloudflare\n * WRANGLER_C3_COMMAND=\"exec ./packages/create-cloudflare\" npx wrangler init temp\n * ```\n *\n * Note that you cannot use `WRANGLER_C3_COMMAND=\"create cloudflare@2\"` if you are\n * running Wrangler from inside the monorepo as the bin paths get messed up.\n */\nexport const getC3CommandFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_C3_COMMAND\",\n\tdefaultValue: () => \"create cloudflare\",\n});\n\nconst getDoNotTrackFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"DO_NOT_TRACK\",\n});\n\n/** Whether `DO_NOT_TRACK` is set to a supported telemetry opt-out value. */\nexport function isDoNotTrackEnabled(): boolean {\n\tconst value = getDoNotTrackFromEnv()?.toLowerCase();\n\treturn value === \"1\" || value === \"true\";\n}\n\nconst getWranglerSendMetricsVariableFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_SEND_METRICS\",\n\t});\n\n/**\n * `WRANGLER_SEND_METRICS` controls whether we attempt to send metrics information to Sparrow.\n * `DO_NOT_TRACK` takes precedence when it is set to an opt-out value.\n */\nexport function getWranglerSendMetricsFromEnv(): boolean | undefined {\n\tif (isDoNotTrackEnabled()) {\n\t\treturn false;\n\t}\n\n\treturn getWranglerSendMetricsVariableFromEnv();\n}\n\n/**\n * `WRANGLER_NO_SKILLS_UPDATE_PROMPTS` suppresses the prompt that offers to\n * update Cloudflare agent skills when they are out of date.\n *\n * Set to `\"true\"` to never be prompted for skills updates.\n */\nexport const getNoSkillsUpdatePromptsFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_NO_SKILLS_UPDATE_PROMPTS\",\n\t});\n\n/**\n * `WRANGLER_SEND_ERROR_REPORTS` controls whether we attempt to send error reports to Sentry.\n *\n * Defaults to `false` to avoid noisy false-positive reports. Users can opt in\n * by setting `WRANGLER_SEND_ERROR_REPORTS=true`.\n */\nexport const getWranglerSendErrorReportsFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_SEND_ERROR_REPORTS\",\n\t\tdefaultValue: false,\n\t});\n\n/**\n * Set `WRANGLER_API_ENVIRONMENT` environment variable to \"staging\" to tell Wrangler to hit the staging APIs rather than production.\n */\nexport const getCloudflareApiEnvironmentFromEnv = getEnvironmentVariableFactory(\n\t{\n\t\tvariableName: \"WRANGLER_API_ENVIRONMENT\",\n\t\tdefaultValue: () => \"production\" as const,\n\t\tchoices: [\"production\", \"staging\"] as const,\n\t}\n);\n\n/**\n * The compliance region to use for the API requests.\n */\nexport type ComplianceConfig = Partial<Pick<Config, \"compliance_region\">>;\n\n/** Used for commands that explicitly do not support compliance regions other than \"public\" */\nexport const COMPLIANCE_REGION_CONFIG_PUBLIC: ComplianceConfig = {\n\tcompliance_region: \"public\",\n};\n\n/**\n * Used for commands where there is no configuration available and\n * we rely upon the CLOUDFLARE_COMPLIANCE_REGION environment variable\n * to determine the compliance region.\n */\nexport const COMPLIANCE_REGION_CONFIG_UNKNOWN: ComplianceConfig = {\n\tcompliance_region: undefined,\n};\n\nconst getCloudflareComplianceRegionFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_COMPLIANCE_REGION\",\n\tchoices: [\"public\", \"fedramp_high\"] as const,\n});\n\n/**\n * Set `CLOUDFLARE_COMPLIANCE_REGION` environment variable to \"fedramp_high\"\n * or set the `compliance_region` property in the Wrangler configuration\n * to tell Wrangler to run in FedRAMP High compliance region mode, rather than \"public\" mode.\n */\nexport const getCloudflareComplianceRegion = (\n\tcomplianceConfig: ComplianceConfig\n) => {\n\tconst complianceRegionFromEnv = getCloudflareComplianceRegionFromEnv();\n\tif (\n\t\tcomplianceRegionFromEnv !== undefined &&\n\t\tcomplianceConfig?.compliance_region !== undefined &&\n\t\tcomplianceRegionFromEnv !== complianceConfig.compliance_region\n\t) {\n\t\tthrow new UserError(\n\t\t\tdedent`\n\t\t\tThe compliance region has been set to different values in two places:\n\t\t\t - \\`CLOUDFLARE_COMPLIANCE_REGION\\` environment variable: \\`${complianceRegionFromEnv}\\`\n\t\t\t - \\`compliance_region\\` configuration property: \\`${complianceConfig.compliance_region}\\`\n\t\t\t`,\n\t\t\t{ telemetryMessage: false }\n\t\t);\n\t}\n\treturn (\n\t\tcomplianceRegionFromEnv || complianceConfig?.compliance_region || \"public\"\n\t);\n};\n\nconst getCloudflareApiBaseUrlFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_API_BASE_URL\",\n\tdeprecatedName: \"CF_API_BASE_URL\",\n});\n\n/**\n * `CLOUDFLARE_API_BASE_URL` specifies the URL to the Cloudflare API.\n *\n * If this environment variable is not set, it will default to a URL computed from the\n * Cloudflare compliance region and the API environment.\n */\nexport const getCloudflareApiBaseUrl = (complianceConfig: ComplianceConfig) =>\n\tgetCloudflareApiBaseUrlFromEnv() ??\n\t`https://api${getComplianceRegionSubdomain(complianceConfig)}${getStagingSubdomain()}.cloudflare.com/client/v4`;\n\n/**\n * Compute the subdomain for the compliance region.\n */\nexport function getComplianceRegionSubdomain(\n\tcomplianceConfig: ComplianceConfig\n): string {\n\treturn getCloudflareComplianceRegion(complianceConfig) === \"fedramp_high\"\n\t\t? \".fed\"\n\t\t: \"\";\n}\n\n/**\n * Compute the subdomain for the staging environment.\n */\nfunction getStagingSubdomain(): string {\n\treturn getCloudflareApiEnvironmentFromEnv() === \"staging\" ? \".staging\" : \"\";\n}\n\n/**\n * `WRANGLER_LOG_SANITIZE` specifies whether we sanitize debug logs.\n *\n * By default we do, since debug logs could be added to GitHub issues and shouldn't include sensitive information.\n */\nexport const getSanitizeLogs = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_LOG_SANITIZE\",\n\tdefaultValue: true,\n});\n\n/**\n * `WRANGLER_OUTPUT_FILE_DIRECTORY` specifies a directory where we should write a file containing output data in ND-JSON format.\n *\n * If this is set a random file will be created in this directory, and certain Wrangler commands will write entries to this file.\n * This is overridden by the `WRANGLER_OUTPUT_FILE_PATH` environment variable.\n */\nexport const getOutputFileDirectoryFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_OUTPUT_FILE_DIRECTORY\",\n});\n\n/**\n * `WRANGLER_OUTPUT_FILE_PATH` specifies a path to a file where we should write output data in ND-JSON format.\n *\n * If this is set certain Wrangler commands will write entries to this file.\n * This overrides the `WRANGLER_OUTPUT_FILE_DIRECTORY` environment variable.\n */\nexport const getOutputFilePathFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_OUTPUT_FILE_PATH\",\n});\n\n/**\n * `WRANGLER_CI_MATCH_TAG` specifies a Worker tag\n *\n * If this is set, Wrangler will ensure the Worker being targeted has this tag\n */\nexport const getCIMatchTag = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_MATCH_TAG\",\n});\n\n/**\n * `WRANGLER_CI_OVERRIDE_NAME` specifies a Worker name\n *\n * If this is set, Wrangler will override the Worker name with this one\n */\nexport const getCIOverrideName = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_OVERRIDE_NAME\",\n});\n\n/**\n * `WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST` specifies whether --network=host should be set\n *\n * If this is set to true, Wrangler will use the --network=host flag when calling out to docker to build container images\n */\nexport const getCIOverrideNetworkModeHost = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST\",\n});\n\n/**\n * `WRANGLER_CI_GENERATE_PREVIEW_ALIAS` specifies whether to generate a preview alias during version upload\n *\n * If this is set to true, Wrangler will attempt to autogenerate the preview alias by using the branch\n * name. If the branch name is too long and an alias cannot be created, a warning will be printed to the console.\n */\nexport const getCIGeneratePreviewAlias = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_GENERATE_PREVIEW_ALIAS\",\n\tdefaultValue: () => \"false\" as const,\n\tchoices: [\"true\", \"false\"] as const,\n});\n\n/**\n * `WORKERS_CI_BRANCH` is the branch name exposed by Workers CI\n *\n */\nexport const getWorkersCIBranchName = getEnvironmentVariableFactory({\n\tvariableName: \"WORKERS_CI_BRANCH\",\n});\n\n/**\n * `WRANGLER_BUILD_CONDITIONS` specifies the \"build conditions\" to use when importing packages at build time.\n *\n * See https://nodejs.org/api/packages.html#conditional-exports\n * and https://esbuild.github.io/api/#how-conditions-work.\n *\n * If this is set, Wrangler will configure esbuild to use this list of conditions.\n * The format is a string of comma separated conditions.\n */\nexport const getBuildConditionsFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_BUILD_CONDITIONS\",\n});\n\n/**\n * `WRANGLER_BUILD_PLATFORM` specifies the \"build platform\" to use when importing packages at build time.\n *\n * See https://esbuild.github.io/api/#platform\n * and https://esbuild.github.io/api/#how-conditions-work.\n *\n * If this is set, Wrangler will configure esbuild to use this platform.\n */\nexport const getBuildPlatformFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_BUILD_PLATFORM\",\n});\n\n/**\n * `WRANGLER_REGISTRY_PATH` specifies the file based dev registry folder\n */\nexport const getRegistryPath = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_REGISTRY_PATH\",\n\tdefaultValue() {\n\t\treturn path.join(getGlobalConfigPath(), \"registry\");\n\t},\n});\n\n/**\n * `WRANGLER_D1_EXTRA_LOCATION_CHOICES` is an internal variable to let D1 team target their testing environments.\n *\n * External accounts cannot access testing environments, so should not set this variable.\n */\nexport const getD1ExtraLocationChoices: () => string | undefined =\n\tgetEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_D1_EXTRA_LOCATION_CHOICES\",\n\t});\n\n/**\n * `WRANGLER_DOCKER_BIN` specifies the path to a docker binary.\n *\n * By default it's `docker`.\n */\nexport { getDockerPath } from \"../docker-path\";\n\nexport const getSubdomainMixedStateCheckDisabled =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_DISABLE_SUBDOMAIN_MIXED_STATE_CHECK\",\n\t\tdefaultValue: false,\n\t});\n\n/**\n/**\n * `CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV` specifies whether to load vars for local dev from `.env` files.\n */\nexport const getCloudflareLoadDevVarsFromDotEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV\",\n\t\tdefaultValue: true,\n\t});\n\n/**\n * `CLOUDFLARE_INCLUDE_PROCESS_ENV` specifies whether to include the `process.env` in vars loaded from `.env` for local development.\n */\nexport const getCloudflareIncludeProcessEnvFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"CLOUDFLARE_INCLUDE_PROCESS_ENV\",\n\t\tdefaultValue: false,\n\t});\n\nexport const getTraceHeader = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_TRACE_ID\",\n});\n\nexport const getDisableConfigWatching = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_DISABLE_CONFIG_WATCHING\",\n\tdefaultValue: false,\n});\n\n/**\n * Hide the Wrangler version banner and command status (deprecated/experimental) warnings\n */\nexport const getWranglerHideBanner = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_HIDE_BANNER\",\n\tdefaultValue: false,\n});\n\n/**\n * `CLOUDFLARE_ENV` specifies the currently selected Wrangler/Cloudflare environment.\n */\nexport const getCloudflareEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_ENV\",\n});\n\n/**\n * `OPEN_NEXT_DEPLOY` is an environment variables that indicates that the current process is being\n * run by the open-next deploy command\n */\nexport const getOpenNextDeployFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"OPEN_NEXT_DEPLOY\",\n});\n\n/**\n * `X_LOCAL_EXPLORER` enables the local explorer UI at /cdn-cgi/local/explorer.\n */\nexport const getLocalExplorerEnabledFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"X_LOCAL_EXPLORER\",\n\t\tdefaultValue: true,\n\t});\n\n/**\n * `X_LOCAL_OBSERVABILITY` turns on local-dev observability capture. Both\n * `wrangler dev` and the Vite plugin read it and pass it through as the one\n * `unsafeObservability` Miniflare option, which makes core attach the trace\n * collector to each user worker.\n *\n * Defaults to `true` so the Local Explorer's Observability tab captures traces\n * and logs out of the box. Set `X_LOCAL_OBSERVABILITY=false` to opt out — for\n * example if the extra per-worker services (collector + streaming tail) cause\n * trouble in a multi-process dev-registry setup.\n */\nexport const getLocalObservabilityEnabledFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"X_LOCAL_OBSERVABILITY\",\n\t\tdefaultValue: true,\n\t});\n\n/**\n * `X_BROWSER_HEADFUL` opens the browser in headful (visible) mode when using the\n * Browser Run API in local development.\n *\n * Set to \"true\" to enable:\n *\n * ```sh\n * X_BROWSER_HEADFUL=true vite dev\n * ```\n *\n * Note: when using `@cloudflare/playwright`, two Chrome windows may appear — the initial blank\n * page and the one created by `browser.newPage()`. This is expected due to how Playwright handles\n * browser contexts via CDP.\n */\nexport const getBrowserRenderingHeadfulFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"X_BROWSER_HEADFUL\",\n\t\tdefaultValue: false,\n\t});\n\n/**\n * `CLOUDFLARE_CF_FETCH_ENABLED` controls whether Miniflare fetches the `cf.json` file\n * containing request.cf properties from workers.cloudflare.com.\n *\n * - If set to \"false\", disables fetching and uses fallback data (no files created)\n * - If set to \"true\" or not set, uses the default behavior (fetches and caches cf.json)\n *\n * This is particularly useful for non-JavaScript projects that don't want\n * a node_modules directory created automatically.\n *\n * Example:\n * ```sh\n * # Disable cf fetching entirely\n * CLOUDFLARE_CF_FETCH_ENABLED=false npx wrangler dev\n * ```\n */\nexport const getCfFetchEnabledFromEnv = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_CF_FETCH_ENABLED\",\n\tdefaultValue: true,\n});\n\n/**\n * `CLOUDFLARE_CF_FETCH_PATH` specifies a custom path for caching the cf.json file.\n *\n * - If set, uses the specified path instead of the default node_modules/.mf/cf.json\n * - If not set, uses the default location (node_modules/.mf/cf.json)\n *\n * Example:\n * ```sh\n * # Use a custom cache location\n * CLOUDFLARE_CF_FETCH_PATH=/tmp/cf-cache.json npx wrangler dev\n * ```\n */\nexport const getCfFetchPathFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_CF_FETCH_PATH\",\n});\n\n/**\n * `WRANGLER_CACHE_DIR` specifies a custom directory for Wrangler's cache files.\n * This overrides the default `node_modules/.cache/wrangler` location.\n * Useful for Yarn PnP or projects without node_modules.\n */\nexport const getWranglerCacheDirFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CACHE_DIR\",\n});\n\n/**\n * `CLOUDFLARED_PATH` specifies a custom path to a cloudflared binary.\n *\n * If set, Wrangler will use this cloudflared binary instead of downloading one.\n * The path must point to an existing executable file.\n */\nexport const getCloudflaredPathFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARED_PATH\",\n});\n"]}
1
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,IAAM,wCACZ,oCAAA,CAAqC;AAAA,EACpC,YAAA,EAAc,gCAAA;AAAA,EACd,YAAA,EAAc;AACf,CAAC;AAEK,IAAM,iBAAiB,6BAAA,CAA8B;AAAA,EAC3D,YAAA,EAAc;AACf,CAAC;AAEM,IAAM,2BAA2B,oCAAA,CAAqC;AAAA,EAC5E,YAAA,EAAc,qCAAA;AAAA,EACd,YAAA,EAAc;AACf,CAAC;AAKM,IAAM,wBAAwB,oCAAA,CAAqC;AAAA,EACzE,YAAA,EAAc,sBAAA;AAAA,EACd,YAAA,EAAc;AACf,CAAC;AAKM,IAAM,mBAAmB,6BAAA,CAA8B;AAAA,EAC7D,YAAA,EAAc;AACf,CAAC;AAMM,IAAM,2BAA2B,6BAAA,CAA8B;AAAA,EACrE,YAAA,EAAc;AACf,CAAC;AAKM,IAAM,iCACZ,oCAAA,CAAqC;AAAA,EACpC,YAAA,EAAc,kBAAA;AAAA,EACd,YAAA,EAAc;AACf,CAAC;AAaK,IAAM,sCACZ,oCAAA,CAAqC;AAAA,EACpC,YAAA,EAAc,uBAAA;AAAA,EACd,YAAA,EAAc;AACf,CAAC;AAgBK,IAAM,oCACZ,oCAAA,CAAqC;AAAA,EACpC,YAAA,EAAc,mBAAA;AAAA,EACd,YAAA,EAAc;AACf,CAAC;AAkBK,IAAM,2BAA2B,oCAAA,CAAqC;AAAA,EAC5E,YAAA,EAAc,6BAAA;AAAA,EACd,YAAA,EAAc;AACf,CAAC;AAcM,IAAM,wBAAwB,6BAAA,CAA8B;AAAA,EAClE,YAAA,EAAc;AACf,CAAC;AAOM,IAAM,6BAA6B,6BAAA,CAA8B;AAAA,EACvE,YAAA,EAAc;AACf,CAAC;AAQM,IAAM,4BAA4B,6BAAA,CAA8B;AAAA,EACtE,YAAA,EAAc;AACf,CAAC","file":"chunk-47QFQIPP.mjs","sourcesContent":["import path from \"node:path\";\nimport { dedent } from \"ts-dedent\";\nimport { UserError } from \"../errors\";\nimport { getGlobalConfigPath } from \"../global-wrangler-config-path\";\nimport {\n\tgetBooleanEnvironmentVariableFactory,\n\tgetEnvironmentVariableFactory,\n} from \"./factory\";\nimport type { Config } from \"../config\";\n\n/**\n * `WRANGLER_C3_COMMAND` can override the command used by `wrangler init` when delegating to C3.\n *\n * By default this will use `create cloudflare`.\n *\n * To run against the beta release of C3 use:\n *\n * ```sh\n * # Tell Wrangler to use the beta version of create-cloudflare\n * WRANGLER_C3_COMMAND=\"create cloudflare@beta\" npx wrangler init\n * ```\n *\n * To test the integration between wrangler and C3 locally, use:\n *\n * ```sh\n * # Ensure both Wrangler and C3 are built\n * npm run build\n * # Tell Wrangler to use the local version of create-cloudflare\n * WRANGLER_C3_COMMAND=\"exec ./packages/create-cloudflare\" npx wrangler init temp\n * ```\n *\n * Note that you cannot use `WRANGLER_C3_COMMAND=\"create cloudflare@2\"` if you are\n * running Wrangler from inside the monorepo as the bin paths get messed up.\n */\nexport const getC3CommandFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_C3_COMMAND\",\n\tdefaultValue: () => \"create cloudflare\",\n});\n\nconst getDoNotTrackFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"DO_NOT_TRACK\",\n});\n\n/** Whether `DO_NOT_TRACK` is set to a supported telemetry opt-out value. */\nexport function isDoNotTrackEnabled(): boolean {\n\tconst value = getDoNotTrackFromEnv()?.toLowerCase();\n\treturn value === \"1\" || value === \"true\";\n}\n\nconst getWranglerSendMetricsVariableFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_SEND_METRICS\",\n\t});\n\n/**\n * `WRANGLER_SEND_METRICS` controls whether we attempt to send metrics information to Sparrow.\n * `DO_NOT_TRACK` takes precedence when it is set to an opt-out value.\n */\nexport function getWranglerSendMetricsFromEnv(): boolean | undefined {\n\tif (isDoNotTrackEnabled()) {\n\t\treturn false;\n\t}\n\n\treturn getWranglerSendMetricsVariableFromEnv();\n}\n\n/**\n * `WRANGLER_NO_SKILLS_UPDATE_PROMPTS` suppresses the prompt that offers to\n * update Cloudflare agent skills when they are out of date.\n *\n * Set to `\"true\"` to never be prompted for skills updates.\n */\nexport const getNoSkillsUpdatePromptsFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_NO_SKILLS_UPDATE_PROMPTS\",\n\t});\n\n/**\n * `WRANGLER_SEND_ERROR_REPORTS` controls whether we attempt to send error reports to Sentry.\n *\n * Defaults to `false` to avoid noisy false-positive reports. Users can opt in\n * by setting `WRANGLER_SEND_ERROR_REPORTS=true`.\n */\nexport const getWranglerSendErrorReportsFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_SEND_ERROR_REPORTS\",\n\t\tdefaultValue: false,\n\t});\n\n/**\n * Set `WRANGLER_API_ENVIRONMENT` environment variable to \"staging\" to tell Wrangler to hit the staging APIs rather than production.\n */\nexport const getCloudflareApiEnvironmentFromEnv = getEnvironmentVariableFactory(\n\t{\n\t\tvariableName: \"WRANGLER_API_ENVIRONMENT\",\n\t\tdefaultValue: () => \"production\" as const,\n\t\tchoices: [\"production\", \"staging\"] as const,\n\t}\n);\n\n/**\n * The compliance region to use for the API requests.\n */\nexport type ComplianceConfig = Partial<Pick<Config, \"compliance_region\">>;\n\n/** Used for commands that explicitly do not support compliance regions other than \"public\" */\nexport const COMPLIANCE_REGION_CONFIG_PUBLIC: ComplianceConfig = {\n\tcompliance_region: \"public\",\n};\n\n/**\n * Used for commands where there is no configuration available and\n * we rely upon the CLOUDFLARE_COMPLIANCE_REGION environment variable\n * to determine the compliance region.\n */\nexport const COMPLIANCE_REGION_CONFIG_UNKNOWN: ComplianceConfig = {\n\tcompliance_region: undefined,\n};\n\nconst getCloudflareComplianceRegionFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_COMPLIANCE_REGION\",\n\tchoices: [\"public\", \"fedramp_high\"] as const,\n});\n\n/**\n * Set `CLOUDFLARE_COMPLIANCE_REGION` environment variable to \"fedramp_high\"\n * or set the `compliance_region` property in the Wrangler configuration\n * to tell Wrangler to run in FedRAMP High compliance region mode, rather than \"public\" mode.\n */\nexport const getCloudflareComplianceRegion = (\n\tcomplianceConfig: ComplianceConfig\n) => {\n\tconst complianceRegionFromEnv = getCloudflareComplianceRegionFromEnv();\n\tif (\n\t\tcomplianceRegionFromEnv !== undefined &&\n\t\tcomplianceConfig?.compliance_region !== undefined &&\n\t\tcomplianceRegionFromEnv !== complianceConfig.compliance_region\n\t) {\n\t\tthrow new UserError(\n\t\t\tdedent`\n\t\t\tThe compliance region has been set to different values in two places:\n\t\t\t - \\`CLOUDFLARE_COMPLIANCE_REGION\\` environment variable: \\`${complianceRegionFromEnv}\\`\n\t\t\t - \\`compliance_region\\` configuration property: \\`${complianceConfig.compliance_region}\\`\n\t\t\t`,\n\t\t\t{ telemetryMessage: false }\n\t\t);\n\t}\n\treturn (\n\t\tcomplianceRegionFromEnv || complianceConfig?.compliance_region || \"public\"\n\t);\n};\n\nconst getCloudflareApiBaseUrlFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_API_BASE_URL\",\n\tdeprecatedName: \"CF_API_BASE_URL\",\n});\n\n/**\n * `CLOUDFLARE_API_BASE_URL` specifies the URL to the Cloudflare API.\n *\n * If this environment variable is not set, it will default to a URL computed from the\n * Cloudflare compliance region and the API environment.\n */\nexport const getCloudflareApiBaseUrl = (complianceConfig: ComplianceConfig) =>\n\tgetCloudflareApiBaseUrlFromEnv() ??\n\t`https://api${getComplianceRegionSubdomain(complianceConfig)}${getStagingSubdomain()}.cloudflare.com/client/v4`;\n\n/**\n * Compute the subdomain for the compliance region.\n */\nexport function getComplianceRegionSubdomain(\n\tcomplianceConfig: ComplianceConfig\n): string {\n\treturn getCloudflareComplianceRegion(complianceConfig) === \"fedramp_high\"\n\t\t? \".fed\"\n\t\t: \"\";\n}\n\n/**\n * Compute the subdomain for the staging environment.\n */\nfunction getStagingSubdomain(): string {\n\treturn getCloudflareApiEnvironmentFromEnv() === \"staging\" ? \".staging\" : \"\";\n}\n\n/**\n * `WRANGLER_LOG_SANITIZE` specifies whether we sanitize debug logs.\n *\n * By default we do, since debug logs could be added to GitHub issues and shouldn't include sensitive information.\n */\nexport const getSanitizeLogs = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_LOG_SANITIZE\",\n\tdefaultValue: true,\n});\n\n/**\n * `WRANGLER_OUTPUT_FILE_DIRECTORY` specifies a directory where we should write a file containing output data in ND-JSON format.\n *\n * If this is set a random file will be created in this directory, and certain Wrangler commands will write entries to this file.\n * This is overridden by the `WRANGLER_OUTPUT_FILE_PATH` environment variable.\n */\nexport const getOutputFileDirectoryFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_OUTPUT_FILE_DIRECTORY\",\n});\n\n/**\n * `WRANGLER_OUTPUT_FILE_PATH` specifies a path to a file where we should write output data in ND-JSON format.\n *\n * If this is set certain Wrangler commands will write entries to this file.\n * This overrides the `WRANGLER_OUTPUT_FILE_DIRECTORY` environment variable.\n */\nexport const getOutputFilePathFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_OUTPUT_FILE_PATH\",\n});\n\n/**\n * `WRANGLER_CI_MATCH_TAG` specifies a Worker tag\n *\n * If this is set, Wrangler will ensure the Worker being targeted has this tag\n */\nexport const getCIMatchTag = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_MATCH_TAG\",\n});\n\n/**\n * `WRANGLER_CI_OVERRIDE_NAME` specifies a Worker name\n *\n * If this is set, Wrangler will override the Worker name with this one\n */\nexport const getCIOverrideName = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_OVERRIDE_NAME\",\n});\n\n/**\n * `WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST` specifies whether --network=host should be set\n *\n * If this is set to true, Wrangler will use the --network=host flag when calling out to docker to build container images\n */\nexport const getCIOverrideNetworkModeHost = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST\",\n});\n\n/**\n * `WRANGLER_CI_GENERATE_PREVIEW_ALIAS` specifies whether to generate a preview alias during version upload\n *\n * If this is set to true, Wrangler will attempt to autogenerate the preview alias by using the branch\n * name. If the branch name is too long and an alias cannot be created, a warning will be printed to the console.\n */\nexport const getCIGeneratePreviewAlias = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_GENERATE_PREVIEW_ALIAS\",\n\tdefaultValue: () => \"false\" as const,\n\tchoices: [\"true\", \"false\"] as const,\n});\n\n/**\n * `WORKERS_CI_BRANCH` is the branch name exposed by Workers CI\n *\n */\nexport const getWorkersCIBranchName = getEnvironmentVariableFactory({\n\tvariableName: \"WORKERS_CI_BRANCH\",\n});\n\n/**\n * `WRANGLER_BUILD_CONDITIONS` specifies the \"build conditions\" to use when importing packages at build time.\n *\n * See https://nodejs.org/api/packages.html#conditional-exports\n * and https://esbuild.github.io/api/#how-conditions-work.\n *\n * If this is set, Wrangler will configure esbuild to use this list of conditions.\n * The format is a string of comma separated conditions.\n */\nexport const getBuildConditionsFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_BUILD_CONDITIONS\",\n});\n\n/**\n * `WRANGLER_BUILD_PLATFORM` specifies the \"build platform\" to use when importing packages at build time.\n *\n * See https://esbuild.github.io/api/#platform\n * and https://esbuild.github.io/api/#how-conditions-work.\n *\n * If this is set, Wrangler will configure esbuild to use this platform.\n */\nexport const getBuildPlatformFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_BUILD_PLATFORM\",\n});\n\n/**\n * `WRANGLER_REGISTRY_PATH` specifies the file based dev registry folder\n */\nexport const getRegistryPath = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_REGISTRY_PATH\",\n\tdefaultValue() {\n\t\treturn path.join(getGlobalConfigPath(), \"registry\");\n\t},\n});\n\n/**\n * `WRANGLER_D1_EXTRA_LOCATION_CHOICES` is an internal variable to let D1 team target their testing environments.\n *\n * External accounts cannot access testing environments, so should not set this variable.\n */\nexport const getD1ExtraLocationChoices: () => string | undefined =\n\tgetEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_D1_EXTRA_LOCATION_CHOICES\",\n\t});\n\n/**\n * `WRANGLER_DOCKER_BIN` specifies the path to a docker binary.\n *\n * By default it's `docker`.\n */\nexport { getDockerPath } from \"../docker-path\";\n\nexport const getSubdomainMixedStateCheckDisabled =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_DISABLE_SUBDOMAIN_MIXED_STATE_CHECK\",\n\t\tdefaultValue: false,\n\t});\n\n/**\n/**\n * `CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV` specifies whether to load vars for local dev from `.env` files.\n */\nexport const getCloudflareLoadDevVarsFromDotEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV\",\n\t\tdefaultValue: true,\n\t});\n\n/**\n * `CLOUDFLARE_INCLUDE_PROCESS_ENV` specifies whether to include the `process.env` in vars loaded from `.env` for local development.\n */\nexport const getCloudflareIncludeProcessEnvFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"CLOUDFLARE_INCLUDE_PROCESS_ENV\",\n\t\tdefaultValue: false,\n\t});\n\nexport const getTraceHeader = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_TRACE_ID\",\n});\n\nexport const getDisableConfigWatching = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_DISABLE_CONFIG_WATCHING\",\n\tdefaultValue: false,\n});\n\n/**\n * Hide the Wrangler version banner and command status (deprecated/experimental) warnings\n */\nexport const getWranglerHideBanner = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_HIDE_BANNER\",\n\tdefaultValue: false,\n});\n\n/**\n * `CLOUDFLARE_ENV` specifies the currently selected Wrangler/Cloudflare environment.\n */\nexport const getCloudflareEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_ENV\",\n});\n\n/**\n * `OPEN_NEXT_DEPLOY` is an environment variables that indicates that the current process is being\n * run by the open-next deploy command\n */\nexport const getOpenNextDeployFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"OPEN_NEXT_DEPLOY\",\n});\n\n/**\n * `X_LOCAL_EXPLORER` enables the local explorer UI at /cdn-cgi/local/explorer.\n */\nexport const getLocalExplorerEnabledFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"X_LOCAL_EXPLORER\",\n\t\tdefaultValue: true,\n\t});\n\n/**\n * `X_LOCAL_OBSERVABILITY` turns on local-dev observability capture. Both\n * `wrangler dev` and the Vite plugin read it and pass it through as the one\n * `unsafeObservability` Miniflare option, which makes core attach the trace\n * collector to each user worker.\n *\n * Defaults to `true` so the Local Explorer's Observability tab captures traces\n * and logs out of the box. Set `X_LOCAL_OBSERVABILITY=false` to opt out — for\n * example if the extra per-worker services (collector + streaming tail) cause\n * trouble in a multi-process dev-registry setup.\n */\nexport const getLocalObservabilityEnabledFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"X_LOCAL_OBSERVABILITY\",\n\t\tdefaultValue: true,\n\t});\n\n/**\n * `X_BROWSER_HEADFUL` opens the browser in headful (visible) mode when using the\n * Browser Run API in local development.\n *\n * Set to \"true\" to enable:\n *\n * ```sh\n * X_BROWSER_HEADFUL=true vite dev\n * ```\n *\n * Note: when using `@cloudflare/playwright`, two Chrome windows may appear — the initial blank\n * page and the one created by `browser.newPage()`. This is expected due to how Playwright handles\n * browser contexts via CDP.\n */\nexport const getBrowserRenderingHeadfulFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"X_BROWSER_HEADFUL\",\n\t\tdefaultValue: false,\n\t});\n\n/**\n * `CLOUDFLARE_CF_FETCH_ENABLED` controls whether Miniflare fetches the `cf.json` file\n * containing request.cf properties from workers.cloudflare.com.\n *\n * - If set to \"false\", disables fetching and uses fallback data (no files created)\n * - If set to \"true\" or not set, uses the default behavior (fetches and caches cf.json)\n *\n * This is particularly useful for non-JavaScript projects that don't want\n * a node_modules directory created automatically.\n *\n * Example:\n * ```sh\n * # Disable cf fetching entirely\n * CLOUDFLARE_CF_FETCH_ENABLED=false npx wrangler dev\n * ```\n */\nexport const getCfFetchEnabledFromEnv = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_CF_FETCH_ENABLED\",\n\tdefaultValue: true,\n});\n\n/**\n * `CLOUDFLARE_CF_FETCH_PATH` specifies a custom path for caching the cf.json file.\n *\n * - If set, uses the specified path instead of the default node_modules/.mf/cf.json\n * - If not set, uses the default location (node_modules/.mf/cf.json)\n *\n * Example:\n * ```sh\n * # Use a custom cache location\n * CLOUDFLARE_CF_FETCH_PATH=/tmp/cf-cache.json npx wrangler dev\n * ```\n */\nexport const getCfFetchPathFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_CF_FETCH_PATH\",\n});\n\n/**\n * `WRANGLER_CACHE_DIR` specifies a custom directory for Wrangler's cache files.\n * This overrides the default `node_modules/.cache/wrangler` location.\n * Useful for Yarn PnP or projects without node_modules.\n */\nexport const getWranglerCacheDirFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CACHE_DIR\",\n});\n\n/**\n * `CLOUDFLARED_PATH` specifies a custom path to a cloudflared binary.\n *\n * If set, Wrangler will use this cloudflared binary instead of downloading one.\n * The path must point to an existing executable file.\n */\nexport const getCloudflaredPathFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARED_PATH\",\n});\n"]}
@@ -1,5 +1,5 @@
1
- import { UserError } from './chunk-CPLEE7LH.mjs';
2
- import { __name } from './chunk-6LYDFTTF.mjs';
1
+ import { UserError } from './chunk-KAEJMITB.mjs';
2
+ import { __name } from './chunk-CGILA3WO.mjs';
3
3
 
4
4
  // src/environment-variables/factory.ts
5
5
  function getBooleanEnvironmentVariableFactory(options) {
@@ -71,5 +71,5 @@ var getDockerPath = getEnvironmentVariableFactory({
71
71
  });
72
72
 
73
73
  export { getBooleanEnvironmentVariableFactory, getDockerPath, getEnvironmentVariableFactory };
74
- //# sourceMappingURL=chunk-OPAKTV2K.mjs.map
75
- //# sourceMappingURL=chunk-OPAKTV2K.mjs.map
74
+ //# sourceMappingURL=chunk-555CCIJE.mjs.map
75
+ //# sourceMappingURL=chunk-555CCIJE.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/environment-variables/factory.ts","../src/docker-path.ts"],"names":[],"mappings":";;;;AAwLO,SAAS,qCAAqC,OAAA,EAGvB;AAC7B,EAAA,OAAO,MAAM;AACZ,IAAA,IACC,EAAE,OAAA,CAAQ,YAAA,IAAgB,OAAA,CAAQ,GAAA,CAAA,IAClC,QAAQ,GAAA,CAAI,OAAA,CAAQ,YAAY,CAAA,KAAM,MAAA,EACrC;AACD,MAAA,OAAO,OAAO,OAAA,CAAQ,YAAA,KAAiB,aACpC,OAAA,CAAQ,YAAA,KACR,OAAA,CAAQ,YAAA;AAAA,IACZ;AAEA,IAAA,QAAQ,QAAQ,GAAA,CAAI,OAAA,CAAQ,YAAY,CAAA,EAAG,aAAY;AAAG,MACzD,KAAK,MAAA;AACJ,QAAA,OAAO,IAAA;AAAA,MACR,KAAK,OAAA;AACJ,QAAA,OAAO,KAAA;AAAA,MACR;AACC,QAAA,MAAM,IAAI,SAAA;AAAA,UACT,CAAA,SAAA,EAAY,OAAA,CAAQ,YAAY,CAAA,kCAAA,EAAqC,IAAA,CAAK,SAAA;AAAA,YACzE,OAAA,CAAQ,GAAA,CAAI,OAAA,CAAQ,YAAY;AAAA,WAChC,CAAA,CAAA;AAAA,UACD,EAAE,kBAAkB,KAAA;AAAM,SAC3B;AAAA;AACF,EACD,CAAA;AACD;AA5BgB,MAAA,CAAA,oCAAA,EAAA,sCAAA,CAAA;AA4DT,SAAS,6BAAA,CAEd;AAAA,EACD,YAA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,EACD;AACD;AAVS,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA;;;AC5RF,IAAM,gBAAgB,6BAAA,CAA8B;AAAA,EAC1D,YAAA,EAAc,qBAAA;AAAA,EACd,YAAA,GAAe;AACd,IAAA,OAAO,QAAA;AAAA,EACR;AACD,CAAC","file":"chunk-OPAKTV2K.mjs","sourcesContent":["import { UserError } from \"../errors\";\n\n/**\n * Environment variables supported by Wrangler for configuration and authentication.\n * Each variable is documented with its individual JSDoc comment below.\n */\ntype VariableNames =\n\t// ## Authentication & API Configuration\n\n\t/** Overrides the account ID for API requests. Can also be set in Wrangler config via `account_id` field. */\n\t| \"CLOUDFLARE_ACCOUNT_ID\"\n\t/** API token for authentication. Preferred over API key + email. */\n\t| \"CLOUDFLARE_API_TOKEN\"\n\t/** Legacy API key for authentication. Requires CLOUDFLARE_EMAIL. It is preferred to use `CLOUDFLARE_API_TOKEN`. */\n\t| \"CLOUDFLARE_API_KEY\"\n\t/** Email address for API key authentication. Used with `CLOUDFLARE_API_KEY`. It is preferred to use `CLOUDFLARE_API_TOKEN`. */\n\t| \"CLOUDFLARE_EMAIL\"\n\t/** Custom API base URL. Defaults to https://api.cloudflare.com/client/v4 */\n\t| \"CLOUDFLARE_API_BASE_URL\"\n\t/** Set to \"fedramp_high\" for FedRAMP High compliance region. This will update the API/AUTH URLs used to make requests to Cloudflare. */\n\t| \"CLOUDFLARE_COMPLIANCE_REGION\"\n\t/** API token for R2 SQL service. */\n\t| \"WRANGLER_R2_SQL_AUTH_TOKEN\"\n\n\t// ## Development & Local Testing\n\n\t/** Controls whether to fetch the cf.json file. Set to \"false\" or \"0\" to disable fetching and use fallback data. Defaults to \"true\". */\n\t| \"CLOUDFLARE_CF_FETCH_ENABLED\"\n\t/** Custom path for caching the cf.json file. Overrides the default node_modules/.mf/cf.json location. */\n\t| \"CLOUDFLARE_CF_FETCH_PATH\"\n\t/** Local database connection strings for Hyperdrive development. The * should be replaced with the Hyperdrive binding name in the Worker. */\n\t| `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_${string}`\n\t/** Suppress Hyperdrive-related warnings during development. */\n\t| \"NO_HYPERDRIVE_WARNING\"\n\t/** Path to HTTPS private key file for running the local development server in HTTPS mode. Without this Wrangler will generate keys automatically. */\n\t| \"WRANGLER_HTTPS_KEY_PATH\"\n\t/** Path to HTTPS certificate file for running the local development server in HTTPS mode. Without this Wrangler will generate keys automatically. */\n\t| \"WRANGLER_HTTPS_CERT_PATH\"\n\t/** Load development variables from .env files (default: true). */\n\t| \"CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV\"\n\t/** Include process.env in development variables (default: false). */\n\t| \"CLOUDFLARE_INCLUDE_PROCESS_ENV\"\n\t/** Include a trace header in all API requests that Wrangler makes (for internal use only) */\n\t| \"WRANGLER_TRACE_ID\"\n\t/** Disable the check for mixed state of subdomain flags (`workers_dev`, `preview_urls`, etc.) (default: false). */\n\t| \"WRANGLER_DISABLE_SUBDOMAIN_MIXED_STATE_CHECK\"\n\n\t// ## Logging & Output\n\n\t/** Set log level: \"debug\", \"info\", \"log\", \"warn\", \"error\". */\n\t| \"WRANGLER_LOG\"\n\t/** Directory for debug log files. */\n\t| \"WRANGLER_LOG_PATH\"\n\t/** Sanitize sensitive data in debug logs (default: true). */\n\t| \"WRANGLER_LOG_SANITIZE\"\n\t/** Directory for ND-JSON output files. */\n\t| \"WRANGLER_OUTPUT_FILE_DIRECTORY\"\n\t/** Hide the Wrangler version banner */\n\t| \"WRANGLER_HIDE_BANNER\"\n\n\t// ## Build & Deployment Configuration\n\n\t/** Specific path for ND-JSON output file. */\n\t| \"WRANGLER_OUTPUT_FILE_PATH\"\n\t/** Comma-separated list of build conditions for esbuild. */\n\t| \"WRANGLER_BUILD_CONDITIONS\"\n\t/** Build platform for esbuild (e.g., \"node\", \"browser\"). */\n\t| \"WRANGLER_BUILD_PLATFORM\"\n\t/** Path to file-based dev registry folder. */\n\t| \"WRANGLER_REGISTRY_PATH\"\n\t/** Additional D1 location choices (internal use). */\n\t| \"WRANGLER_D1_EXTRA_LOCATION_CHOICES\"\n\t/** The Workers environment to target (equivalent to the `--env` CLI param) */\n\t| \"CLOUDFLARE_ENV\"\n\n\t// ## Directory Configuration\n\n\t/** Custom directory for Wrangler's cache files (overrides `node_modules/.cache/wrangler`). */\n\t| \"WRANGLER_CACHE_DIR\"\n\t/** Custom path to cloudflared binary (overrides automatic binary management). */\n\t| \"CLOUDFLARED_PATH\"\n\n\t// ## Advanced Configuration\n\n\t/** Set to \"staging\" to use staging APIs instead of production. */\n\t| \"WRANGLER_API_ENVIRONMENT\"\n\t/** Custom auth domain (usually auto-configured). */\n\t| \"WRANGLER_AUTH_DOMAIN\"\n\t/** Custom auth URL (usually auto-configured). */\n\t| \"WRANGLER_AUTH_URL\"\n\t/** Custom OAuth client ID (usually auto-configured). */\n\t| \"WRANGLER_CLIENT_ID\"\n\t/** Custom OAuth client ID for the `cf` CLI's OAuth app (usually auto-configured). */\n\t| \"CLOUDFLARE_CLIENT_ID\"\n\t/** Custom token URL (usually auto-configured). */\n\t| \"WRANGLER_TOKEN_URL\"\n\t/** Custom token revocation URL (usually auto-configured). */\n\t| \"WRANGLER_REVOKE_URL\"\n\t/** Direct authorization token for API requests. */\n\t| \"WRANGLER_CF_AUTHORIZATION_TOKEN\"\n\n\t// ## Cloudflare Access Service Token (for CI/non-interactive environments)\n\n\t/** Cloudflare Access Service Token Client ID. Used to authenticate with Access-protected domains in non-interactive environments (e.g. CI). */\n\t| \"CLOUDFLARE_ACCESS_CLIENT_ID\"\n\t/** Cloudflare Access Service Token Client Secret. Used with CLOUDFLARE_ACCESS_CLIENT_ID. */\n\t| \"CLOUDFLARE_ACCESS_CLIENT_SECRET\"\n\t/**\n\t * Store OAuth credentials in the OS keychain instead of a plaintext TOML\n\t * file. Overrides the persistent `keyring_enabled` preference written by\n\t * `wrangler login --use-keyring`.\n\t */\n\t| \"CLOUDFLARE_AUTH_USE_KEYRING\"\n\n\t// ## Experimental Feature Flags\n\n\t/** Enable the local explorer UI at /cdn-cgi/local/explorer (experimental, default: false). */\n\t| \"X_LOCAL_EXPLORER\"\n\t/** Enable local-dev observability capture (experimental, default: false). */\n\t| \"X_LOCAL_OBSERVABILITY\"\n\t/** Open the browser in headful (visible) mode when using the Browser Run API in local dev (default: false). */\n\t| \"X_BROWSER_HEADFUL\"\n\n\t// ## CI-specific Variables (Internal Use)\n\n\t/** Override command used by `wrangler init` (default: \"create cloudflare\"). */\n\t| \"WRANGLER_C3_COMMAND\"\n\t/** Enable/disable telemetry data collection. */\n\t| \"WRANGLER_SEND_METRICS\"\n\t/** Enable/disable error reporting to Sentry. */\n\t| \"WRANGLER_SEND_ERROR_REPORTS\"\n\t/** Suppress the prompt that offers to update Cloudflare agent skills. */\n\t| \"WRANGLER_NO_SKILLS_UPDATE_PROMPTS\"\n\t/** CI branch name (internal use). */\n\t| \"WORKERS_CI_BRANCH\"\n\t/** CI tag matching configuration (internal use). */\n\t| \"WRANGLER_CI_MATCH_TAG\"\n\t/** CI override name configuration (internal use). */\n\t| \"WRANGLER_CI_OVERRIDE_NAME\"\n\t/** CI network mode host override (internal use). */\n\t| \"WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST\"\n\t/** CI preview alias generation (internal use). */\n\t| \"WRANGLER_CI_GENERATE_PREVIEW_ALIAS\"\n\t/** Disable config watching in ConfigController. */\n\t| \"WRANGLER_CI_DISABLE_CONFIG_WATCHING\"\n\n\t/** Disable telemetry when set to an opt-out value. */\n\t| \"DO_NOT_TRACK\"\n\n\t// ## Docker Configuration\n\n\t/** Path to docker binary (default: \"docker\"). */\n\t| \"WRANGLER_DOCKER_BIN\"\n\t/** Docker host configuration (handled separately from environment variable factory). */\n\t| \"WRANGLER_DOCKER_HOST\"\n\t/** Docker host configuration (handled separately from environment variable factory). */\n\t| \"DOCKER_HOST\"\n\n\t/** Environment variable used to signal that the current process is being run by the open-next deploy command. */\n\t| \"OPEN_NEXT_DEPLOY\";\n\ntype DeprecatedNames =\n\t| \"CF_ACCOUNT_ID\"\n\t| \"CF_API_TOKEN\"\n\t| \"CF_API_KEY\"\n\t| \"CF_EMAIL\"\n\t| \"CF_API_BASE_URL\";\n\ntype ElementType<A> = A extends readonly (infer T)[] ? T : never;\n\n/**\n * Create a function used to access a boolean environment variable. It may return undefined if the variable is not set.\n *\n * This is not memoized to allow us to change the value at runtime, such as in testing.\n *\n * The environment variable must be either \"true\" or \"false\" (after lowercasing), otherwise it will throw an error.\n */\nexport function getBooleanEnvironmentVariableFactory(options: {\n\tvariableName: VariableNames;\n}): () => boolean | undefined;\nexport function getBooleanEnvironmentVariableFactory(options: {\n\tvariableName: VariableNames;\n\tdefaultValue: boolean | (() => boolean);\n}): () => boolean;\nexport function getBooleanEnvironmentVariableFactory(options: {\n\tvariableName: VariableNames;\n\tdefaultValue?: boolean | (() => boolean);\n}): () => boolean | undefined {\n\treturn () => {\n\t\tif (\n\t\t\t!(options.variableName in process.env) ||\n\t\t\tprocess.env[options.variableName] === undefined\n\t\t) {\n\t\t\treturn typeof options.defaultValue === \"function\"\n\t\t\t\t? options.defaultValue()\n\t\t\t\t: options.defaultValue;\n\t\t}\n\n\t\tswitch (process.env[options.variableName]?.toLowerCase()) {\n\t\t\tcase \"true\":\n\t\t\t\treturn true;\n\t\t\tcase \"false\":\n\t\t\t\treturn false;\n\t\t\tdefault:\n\t\t\t\tthrow new UserError(\n\t\t\t\t\t`Expected ${options.variableName} to be \"true\" or \"false\", but got ${JSON.stringify(\n\t\t\t\t\t\tprocess.env[options.variableName]\n\t\t\t\t\t)}`,\n\t\t\t\t\t{ telemetryMessage: false }\n\t\t\t\t);\n\t\t}\n\t};\n}\n\n/**\n * Create a function used to access an environment variable. It may return undefined if the variable is not set.\n *\n * This is not memoized to allow us to change the value at runtime, such as in testing.\n * A warning is shown if the client is using a deprecated version - but only once.\n * If a list of choices is provided, then the environment variable must be one of those given.\n */\nexport function getEnvironmentVariableFactory<\n\tChoices extends readonly string[],\n>(options: {\n\tvariableName: VariableNames;\n\tdeprecatedName?: DeprecatedNames;\n\tchoices?: Choices;\n}): () => ElementType<Choices> | undefined;\n/**\n * Create a function used to access an environment variable, with a default value if the variable is not set.\n *\n * This is not memoized to allow us to change the value at runtime, such as in testing.\n * A warning is shown if the client is using a deprecated version - but only once.\n * If a list of choices is provided, then the environment variable must be one of those given.\n */\nexport function getEnvironmentVariableFactory<\n\tChoices extends readonly string[],\n>(options: {\n\tvariableName: VariableNames;\n\tdeprecatedName?: DeprecatedNames;\n\tdefaultValue: () => ElementType<Choices>;\n\treadonly choices?: Choices;\n}): () => ElementType<Choices>;\n\nexport function getEnvironmentVariableFactory<\n\tChoices extends readonly string[],\n>({\n\tvariableName,\n\tdeprecatedName,\n\tchoices,\n\tdefaultValue,\n}: {\n\tvariableName: VariableNames;\n\tdeprecatedName?: DeprecatedNames;\n\tdefaultValue?: () => ElementType<Choices>;\n\treadonly choices?: Choices;\n}): () => ElementType<Choices> | undefined {\n\tlet hasWarned = false;\n\treturn () => {\n\t\tif (variableName in process.env) {\n\t\t\treturn getProcessEnv(variableName, choices);\n\t\t}\n\t\tif (deprecatedName && deprecatedName in process.env) {\n\t\t\tif (!hasWarned) {\n\t\t\t\thasWarned = true;\n\t\t\t\t// eslint-disable-next-line no-console -- ideally we'd use `logger.warn` here, but that creates a circular dependency that Vitest is unable to resolve\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Using \"${deprecatedName}\" environment variable. This is deprecated. Please use \"${variableName}\", instead.`\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn getProcessEnv(deprecatedName, choices);\n\t\t}\n\n\t\treturn defaultValue?.();\n\t};\n}\n\n/**\n * Get the value of an environment variable and check it is one of the choices.\n */\nfunction getProcessEnv<Choices extends readonly string[]>(\n\tvariableName: string,\n\tchoices: Choices | undefined\n): ElementType<Choices> | undefined {\n\tassertOneOf(choices, process.env[variableName]);\n\treturn process.env[variableName];\n}\n\n/**\n * Assert `value` is one of a list of `choices`.\n */\nfunction assertOneOf<Choices extends readonly string[]>(\n\tchoices: Choices | undefined,\n\tvalue: string | undefined\n): asserts value is ElementType<Choices> {\n\tif (Array.isArray(choices) && !choices.includes(value)) {\n\t\tthrow new UserError(\n\t\t\t`Expected ${JSON.stringify(value)} to be one of ${JSON.stringify(choices)}`,\n\t\t\t{ telemetryMessage: false }\n\t\t);\n\t}\n}\n","import { getEnvironmentVariableFactory } from \"./environment-variables/factory\";\n\n/**\n * Returns the configured path to the Docker binary.\n *\n * @returns The value of `WRANGLER_DOCKER_BIN`, or `docker` when unset.\n */\nexport const getDockerPath = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_DOCKER_BIN\",\n\tdefaultValue() {\n\t\treturn \"docker\";\n\t},\n});\n"]}
1
+ {"version":3,"sources":["../src/environment-variables/factory.ts","../src/docker-path.ts"],"names":[],"mappings":";;;;AAwLO,SAAS,qCAAqC,OAAA,EAGvB;AAC7B,EAAA,OAAO,MAAM;AACZ,IAAA,IACC,EAAE,OAAA,CAAQ,YAAA,IAAgB,OAAA,CAAQ,GAAA,CAAA,IAClC,QAAQ,GAAA,CAAI,OAAA,CAAQ,YAAY,CAAA,KAAM,MAAA,EACrC;AACD,MAAA,OAAO,OAAO,OAAA,CAAQ,YAAA,KAAiB,aACpC,OAAA,CAAQ,YAAA,KACR,OAAA,CAAQ,YAAA;AAAA,IACZ;AAEA,IAAA,QAAQ,QAAQ,GAAA,CAAI,OAAA,CAAQ,YAAY,CAAA,EAAG,aAAY;AAAG,MACzD,KAAK,MAAA;AACJ,QAAA,OAAO,IAAA;AAAA,MACR,KAAK,OAAA;AACJ,QAAA,OAAO,KAAA;AAAA,MACR;AACC,QAAA,MAAM,IAAI,SAAA;AAAA,UACT,CAAA,SAAA,EAAY,OAAA,CAAQ,YAAY,CAAA,kCAAA,EAAqC,IAAA,CAAK,SAAA;AAAA,YACzE,OAAA,CAAQ,GAAA,CAAI,OAAA,CAAQ,YAAY;AAAA,WAChC,CAAA,CAAA;AAAA,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AAY,KAAK,SAAA,CAAU,KAAK,CAAC,CAAA,cAAA,EAAiB,IAAA,CAAK,SAAA,CAAU,OAAO,CAAC,CAAA,CAAA;AAAA,MACzE,EAAE,kBAAkB,KAAA;AAAM,KAC3B;AAAA,EACD;AACD;AAVS,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA;;;AC5RF,IAAM,gBAAgB,6BAAA,CAA8B;AAAA,EAC1D,YAAA,EAAc,qBAAA;AAAA,EACd,YAAA,GAAe;AACd,IAAA,OAAO,QAAA;AAAA,EACR;AACD,CAAC","file":"chunk-555CCIJE.mjs","sourcesContent":["import { UserError } from \"../errors\";\n\n/**\n * Environment variables supported by Wrangler for configuration and authentication.\n * Each variable is documented with its individual JSDoc comment below.\n */\ntype VariableNames =\n\t// ## Authentication & API Configuration\n\n\t/** Overrides the account ID for API requests. Can also be set in Wrangler config via `account_id` field. */\n\t| \"CLOUDFLARE_ACCOUNT_ID\"\n\t/** API token for authentication. Preferred over API key + email. */\n\t| \"CLOUDFLARE_API_TOKEN\"\n\t/** Legacy API key for authentication. Requires CLOUDFLARE_EMAIL. It is preferred to use `CLOUDFLARE_API_TOKEN`. */\n\t| \"CLOUDFLARE_API_KEY\"\n\t/** Email address for API key authentication. Used with `CLOUDFLARE_API_KEY`. It is preferred to use `CLOUDFLARE_API_TOKEN`. */\n\t| \"CLOUDFLARE_EMAIL\"\n\t/** Custom API base URL. Defaults to https://api.cloudflare.com/client/v4 */\n\t| \"CLOUDFLARE_API_BASE_URL\"\n\t/** Set to \"fedramp_high\" for FedRAMP High compliance region. This will update the API/AUTH URLs used to make requests to Cloudflare. */\n\t| \"CLOUDFLARE_COMPLIANCE_REGION\"\n\t/** API token for R2 SQL service. */\n\t| \"WRANGLER_R2_SQL_AUTH_TOKEN\"\n\n\t// ## Development & Local Testing\n\n\t/** Controls whether to fetch the cf.json file. Set to \"false\" or \"0\" to disable fetching and use fallback data. Defaults to \"true\". */\n\t| \"CLOUDFLARE_CF_FETCH_ENABLED\"\n\t/** Custom path for caching the cf.json file. Overrides the default node_modules/.mf/cf.json location. */\n\t| \"CLOUDFLARE_CF_FETCH_PATH\"\n\t/** Local database connection strings for Hyperdrive development. The * should be replaced with the Hyperdrive binding name in the Worker. */\n\t| `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_${string}`\n\t/** Suppress Hyperdrive-related warnings during development. */\n\t| \"NO_HYPERDRIVE_WARNING\"\n\t/** Path to HTTPS private key file for running the local development server in HTTPS mode. Without this Wrangler will generate keys automatically. */\n\t| \"WRANGLER_HTTPS_KEY_PATH\"\n\t/** Path to HTTPS certificate file for running the local development server in HTTPS mode. Without this Wrangler will generate keys automatically. */\n\t| \"WRANGLER_HTTPS_CERT_PATH\"\n\t/** Load development variables from .env files (default: true). */\n\t| \"CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV\"\n\t/** Include process.env in development variables (default: false). */\n\t| \"CLOUDFLARE_INCLUDE_PROCESS_ENV\"\n\t/** Include a trace header in all API requests that Wrangler makes (for internal use only) */\n\t| \"WRANGLER_TRACE_ID\"\n\t/** Disable the check for mixed state of subdomain flags (`workers_dev`, `preview_urls`, etc.) (default: false). */\n\t| \"WRANGLER_DISABLE_SUBDOMAIN_MIXED_STATE_CHECK\"\n\n\t// ## Logging & Output\n\n\t/** Set log level: \"debug\", \"info\", \"log\", \"warn\", \"error\". */\n\t| \"WRANGLER_LOG\"\n\t/** Directory for debug log files. */\n\t| \"WRANGLER_LOG_PATH\"\n\t/** Sanitize sensitive data in debug logs (default: true). */\n\t| \"WRANGLER_LOG_SANITIZE\"\n\t/** Directory for ND-JSON output files. */\n\t| \"WRANGLER_OUTPUT_FILE_DIRECTORY\"\n\t/** Hide the Wrangler version banner */\n\t| \"WRANGLER_HIDE_BANNER\"\n\n\t// ## Build & Deployment Configuration\n\n\t/** Specific path for ND-JSON output file. */\n\t| \"WRANGLER_OUTPUT_FILE_PATH\"\n\t/** Comma-separated list of build conditions for esbuild. */\n\t| \"WRANGLER_BUILD_CONDITIONS\"\n\t/** Build platform for esbuild (e.g., \"node\", \"browser\"). */\n\t| \"WRANGLER_BUILD_PLATFORM\"\n\t/** Path to file-based dev registry folder. */\n\t| \"WRANGLER_REGISTRY_PATH\"\n\t/** Additional D1 location choices (internal use). */\n\t| \"WRANGLER_D1_EXTRA_LOCATION_CHOICES\"\n\t/** The Workers environment to target (equivalent to the `--env` CLI param) */\n\t| \"CLOUDFLARE_ENV\"\n\n\t// ## Directory Configuration\n\n\t/** Custom directory for Wrangler's cache files (overrides `node_modules/.cache/wrangler`). */\n\t| \"WRANGLER_CACHE_DIR\"\n\t/** Custom path to cloudflared binary (overrides automatic binary management). */\n\t| \"CLOUDFLARED_PATH\"\n\n\t// ## Advanced Configuration\n\n\t/** Set to \"staging\" to use staging APIs instead of production. */\n\t| \"WRANGLER_API_ENVIRONMENT\"\n\t/** Custom auth domain (usually auto-configured). */\n\t| \"WRANGLER_AUTH_DOMAIN\"\n\t/** Custom auth URL (usually auto-configured). */\n\t| \"WRANGLER_AUTH_URL\"\n\t/** Custom OAuth client ID (usually auto-configured). */\n\t| \"WRANGLER_CLIENT_ID\"\n\t/** Custom OAuth client ID for the `cf` CLI's OAuth app (usually auto-configured). */\n\t| \"CLOUDFLARE_CLIENT_ID\"\n\t/** Custom token URL (usually auto-configured). */\n\t| \"WRANGLER_TOKEN_URL\"\n\t/** Custom token revocation URL (usually auto-configured). */\n\t| \"WRANGLER_REVOKE_URL\"\n\t/** Direct authorization token for API requests. */\n\t| \"WRANGLER_CF_AUTHORIZATION_TOKEN\"\n\n\t// ## Cloudflare Access Service Token (for CI/non-interactive environments)\n\n\t/** Cloudflare Access Service Token Client ID. Used to authenticate with Access-protected domains in non-interactive environments (e.g. CI). */\n\t| \"CLOUDFLARE_ACCESS_CLIENT_ID\"\n\t/** Cloudflare Access Service Token Client Secret. Used with CLOUDFLARE_ACCESS_CLIENT_ID. */\n\t| \"CLOUDFLARE_ACCESS_CLIENT_SECRET\"\n\t/**\n\t * Store OAuth credentials in the OS keychain instead of a plaintext TOML\n\t * file. Overrides the persistent `keyring_enabled` preference written by\n\t * `wrangler login --use-keyring`.\n\t */\n\t| \"CLOUDFLARE_AUTH_USE_KEYRING\"\n\n\t// ## Experimental Feature Flags\n\n\t/** Enable the local explorer UI at /cdn-cgi/local/explorer (experimental, default: false). */\n\t| \"X_LOCAL_EXPLORER\"\n\t/** Enable local-dev observability capture (experimental, default: false). */\n\t| \"X_LOCAL_OBSERVABILITY\"\n\t/** Open the browser in headful (visible) mode when using the Browser Run API in local dev (default: false). */\n\t| \"X_BROWSER_HEADFUL\"\n\n\t// ## CI-specific Variables (Internal Use)\n\n\t/** Override command used by `wrangler init` (default: \"create cloudflare\"). */\n\t| \"WRANGLER_C3_COMMAND\"\n\t/** Enable/disable telemetry data collection. */\n\t| \"WRANGLER_SEND_METRICS\"\n\t/** Enable/disable error reporting to Sentry. */\n\t| \"WRANGLER_SEND_ERROR_REPORTS\"\n\t/** Suppress the prompt that offers to update Cloudflare agent skills. */\n\t| \"WRANGLER_NO_SKILLS_UPDATE_PROMPTS\"\n\t/** CI branch name (internal use). */\n\t| \"WORKERS_CI_BRANCH\"\n\t/** CI tag matching configuration (internal use). */\n\t| \"WRANGLER_CI_MATCH_TAG\"\n\t/** CI override name configuration (internal use). */\n\t| \"WRANGLER_CI_OVERRIDE_NAME\"\n\t/** CI network mode host override (internal use). */\n\t| \"WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST\"\n\t/** CI preview alias generation (internal use). */\n\t| \"WRANGLER_CI_GENERATE_PREVIEW_ALIAS\"\n\t/** Disable config watching in ConfigController. */\n\t| \"WRANGLER_CI_DISABLE_CONFIG_WATCHING\"\n\n\t/** Disable telemetry when set to an opt-out value. */\n\t| \"DO_NOT_TRACK\"\n\n\t// ## Docker Configuration\n\n\t/** Path to docker binary (default: \"docker\"). */\n\t| \"WRANGLER_DOCKER_BIN\"\n\t/** Docker host configuration (handled separately from environment variable factory). */\n\t| \"WRANGLER_DOCKER_HOST\"\n\t/** Docker host configuration (handled separately from environment variable factory). */\n\t| \"DOCKER_HOST\"\n\n\t/** Environment variable used to signal that the current process is being run by the open-next deploy command. */\n\t| \"OPEN_NEXT_DEPLOY\";\n\ntype DeprecatedNames =\n\t| \"CF_ACCOUNT_ID\"\n\t| \"CF_API_TOKEN\"\n\t| \"CF_API_KEY\"\n\t| \"CF_EMAIL\"\n\t| \"CF_API_BASE_URL\";\n\ntype ElementType<A> = A extends readonly (infer T)[] ? T : never;\n\n/**\n * Create a function used to access a boolean environment variable. It may return undefined if the variable is not set.\n *\n * This is not memoized to allow us to change the value at runtime, such as in testing.\n *\n * The environment variable must be either \"true\" or \"false\" (after lowercasing), otherwise it will throw an error.\n */\nexport function getBooleanEnvironmentVariableFactory(options: {\n\tvariableName: VariableNames;\n}): () => boolean | undefined;\nexport function getBooleanEnvironmentVariableFactory(options: {\n\tvariableName: VariableNames;\n\tdefaultValue: boolean | (() => boolean);\n}): () => boolean;\nexport function getBooleanEnvironmentVariableFactory(options: {\n\tvariableName: VariableNames;\n\tdefaultValue?: boolean | (() => boolean);\n}): () => boolean | undefined {\n\treturn () => {\n\t\tif (\n\t\t\t!(options.variableName in process.env) ||\n\t\t\tprocess.env[options.variableName] === undefined\n\t\t) {\n\t\t\treturn typeof options.defaultValue === \"function\"\n\t\t\t\t? options.defaultValue()\n\t\t\t\t: options.defaultValue;\n\t\t}\n\n\t\tswitch (process.env[options.variableName]?.toLowerCase()) {\n\t\t\tcase \"true\":\n\t\t\t\treturn true;\n\t\t\tcase \"false\":\n\t\t\t\treturn false;\n\t\t\tdefault:\n\t\t\t\tthrow new UserError(\n\t\t\t\t\t`Expected ${options.variableName} to be \"true\" or \"false\", but got ${JSON.stringify(\n\t\t\t\t\t\tprocess.env[options.variableName]\n\t\t\t\t\t)}`,\n\t\t\t\t\t{ telemetryMessage: false }\n\t\t\t\t);\n\t\t}\n\t};\n}\n\n/**\n * Create a function used to access an environment variable. It may return undefined if the variable is not set.\n *\n * This is not memoized to allow us to change the value at runtime, such as in testing.\n * A warning is shown if the client is using a deprecated version - but only once.\n * If a list of choices is provided, then the environment variable must be one of those given.\n */\nexport function getEnvironmentVariableFactory<\n\tChoices extends readonly string[],\n>(options: {\n\tvariableName: VariableNames;\n\tdeprecatedName?: DeprecatedNames;\n\tchoices?: Choices;\n}): () => ElementType<Choices> | undefined;\n/**\n * Create a function used to access an environment variable, with a default value if the variable is not set.\n *\n * This is not memoized to allow us to change the value at runtime, such as in testing.\n * A warning is shown if the client is using a deprecated version - but only once.\n * If a list of choices is provided, then the environment variable must be one of those given.\n */\nexport function getEnvironmentVariableFactory<\n\tChoices extends readonly string[],\n>(options: {\n\tvariableName: VariableNames;\n\tdeprecatedName?: DeprecatedNames;\n\tdefaultValue: () => ElementType<Choices>;\n\treadonly choices?: Choices;\n}): () => ElementType<Choices>;\n\nexport function getEnvironmentVariableFactory<\n\tChoices extends readonly string[],\n>({\n\tvariableName,\n\tdeprecatedName,\n\tchoices,\n\tdefaultValue,\n}: {\n\tvariableName: VariableNames;\n\tdeprecatedName?: DeprecatedNames;\n\tdefaultValue?: () => ElementType<Choices>;\n\treadonly choices?: Choices;\n}): () => ElementType<Choices> | undefined {\n\tlet hasWarned = false;\n\treturn () => {\n\t\tif (variableName in process.env) {\n\t\t\treturn getProcessEnv(variableName, choices);\n\t\t}\n\t\tif (deprecatedName && deprecatedName in process.env) {\n\t\t\tif (!hasWarned) {\n\t\t\t\thasWarned = true;\n\t\t\t\t// eslint-disable-next-line no-console -- ideally we'd use `logger.warn` here, but that creates a circular dependency that Vitest is unable to resolve\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Using \"${deprecatedName}\" environment variable. This is deprecated. Please use \"${variableName}\", instead.`\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn getProcessEnv(deprecatedName, choices);\n\t\t}\n\n\t\treturn defaultValue?.();\n\t};\n}\n\n/**\n * Get the value of an environment variable and check it is one of the choices.\n */\nfunction getProcessEnv<Choices extends readonly string[]>(\n\tvariableName: string,\n\tchoices: Choices | undefined\n): ElementType<Choices> | undefined {\n\tassertOneOf(choices, process.env[variableName]);\n\treturn process.env[variableName];\n}\n\n/**\n * Assert `value` is one of a list of `choices`.\n */\nfunction assertOneOf<Choices extends readonly string[]>(\n\tchoices: Choices | undefined,\n\tvalue: string | undefined\n): asserts value is ElementType<Choices> {\n\tif (Array.isArray(choices) && !choices.includes(value)) {\n\t\tthrow new UserError(\n\t\t\t`Expected ${JSON.stringify(value)} to be one of ${JSON.stringify(choices)}`,\n\t\t\t{ telemetryMessage: false }\n\t\t);\n\t}\n}\n","import { getEnvironmentVariableFactory } from \"./environment-variables/factory\";\n\n/**\n * Returns the configured path to the Docker binary.\n *\n * @returns The value of `WRANGLER_DOCKER_BIN`, or `docker` when unset.\n */\nexport const getDockerPath = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_DOCKER_BIN\",\n\tdefaultValue() {\n\t\treturn \"docker\";\n\t},\n});\n"]}
@@ -0,0 +1,12 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
9
+
10
+ export { __name, __require };
11
+ //# sourceMappingURL=chunk-CGILA3WO.mjs.map
12
+ //# sourceMappingURL=chunk-CGILA3WO.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-6LYDFTTF.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-CGILA3WO.mjs"}
@@ -1,4 +1,4 @@
1
- import { __name } from './chunk-6LYDFTTF.mjs';
1
+ import { __name } from './chunk-CGILA3WO.mjs';
2
2
 
3
3
  // src/prometheus-metrics.ts
4
4
  var MetricsRegistry = class {
@@ -50,5 +50,5 @@ var MetricsRegistry = class {
50
50
  };
51
51
 
52
52
  export { MetricsRegistry };
53
- //# sourceMappingURL=chunk-3D4BXUZX.mjs.map
54
- //# sourceMappingURL=chunk-3D4BXUZX.mjs.map
53
+ //# sourceMappingURL=chunk-FEHWZI5W.mjs.map
54
+ //# sourceMappingURL=chunk-FEHWZI5W.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/prometheus-metrics.ts"],"names":[],"mappings":";;;AAuCO,IAAM,kBAAN,MAAsB;AAAA,EAvC7B;AAuC6B,IAAA,MAAA,CAAA,IAAA,EAAA,iBAAA,CAAA;AAAA;AAAA,EACpB,WAA2B,EAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpC,aAAA,CAAc,MAAc,IAAA,EAAuB;AAClD,IAAA,MAAM,KAAA,GAAsB,EAAE,IAAA,EAAM,IAAA,EAAM,OAAO,CAAA,EAAE;AACnD,IAAA,IAAA,CAAK,QAAA,CAAS,KAAK,KAAK,CAAA;AACxB,IAAA,OAAO;AAAA,MACN,qBAAK,MAAA,CAAA,MAAM;AACV,QAAA,KAAA,CAAM,KAAA,EAAA;AAAA,MACP,CAAA,EAFK,KAAA,CAAA;AAAA,MAGL,GAAA,0BAAM,MAAA,KAAmB;AACxB,QAAA,IAAI,SAAS,CAAA,EAAG;AACf,UAAA,MAAM,IAAI,MAAM,+BAA+B,CAAA;AAAA,QAChD;AACA,QAAA,KAAA,CAAM,KAAA,IAAS,MAAA;AAAA,MAChB,CAAA,EALK,KAAA;AAAA,KAMN;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAA,GAAkB;AACjB,IAAA,OAAO,IAAA,CAAK,QAAA,CACV,GAAA,CAAI,CAAC,CAAA,KAAM;AACX,MAAA,IAAI,MAAA,GAAS,EAAA;AACb,MAAA,IAAI,CAAA,CAAE,IAAA,CAAK,MAAA,GAAS,CAAA,EAAG;AACtB,QAAA,MAAA,IAAU,CAAA,OAAA,EAAU,CAAA,CAAE,IAAI,CAAA,CAAA,EAAI,EAAE,IAAI;AAAA,CAAA;AAAA,MACrC;AACA,MAAA,MAAA,IAAU,CAAA,OAAA,EAAU,EAAE,IAAI,CAAA;AAAA,CAAA;AAC1B,MAAA,MAAA,IAAU,CAAA,EAAG,CAAA,CAAE,IAAI,CAAA,CAAA,EAAI,EAAE,KAAK;AAAA,CAAA;AAC9B,MAAA,OAAO,MAAA;AAAA,IACR,CAAC,CAAA,CACA,IAAA,CAAK,EAAE,CAAA;AAAA,EACV;AACD","file":"chunk-3D4BXUZX.mjs","sourcesContent":["/**\n * Lightweight Prometheus metrics registry for push-based counter metrics.\n *\n * Designed for ephemeral per-request usage in Cloudflare Workers that push\n * metrics to a Prometheus push gateway. Replaces the deprecated `promjs` library.\n *\n * @example\n * ```ts\n * const metrics = new MetricsRegistry();\n * const reqCounter = metrics.createCounter(\n * \"service_request_total\",\n * \"Total requests\"\n * );\n * reqCounter.inc();\n *\n * // Push to Prometheus gateway\n * ctx.waitUntil(\n * fetch(prometheusUrl, {\n * method: \"POST\",\n * headers: { Authorization: `Bearer ${token}` },\n * body: metrics.metrics(),\n * })\n * );\n * ```\n */\n\nexport interface Counter {\n\t/** Increment the counter by 1. */\n\tinc(): void;\n\t/** Increment the counter by the given non-negative amount. */\n\tadd(amount: number): void;\n}\n\ninterface CounterEntry {\n\tname: string;\n\thelp: string;\n\tvalue: number;\n}\n\nexport class MetricsRegistry {\n\tprivate counters: CounterEntry[] = [];\n\n\t/**\n\t * Create and register a new counter metric.\n\t *\n\t * @param name - The metric name (e.g. \"service_request_total\")\n\t * @param help - A human-readable description of the metric\n\t * @returns A Counter that can be incremented\n\t */\n\tcreateCounter(name: string, help: string): Counter {\n\t\tconst entry: CounterEntry = { name, help, value: 0 };\n\t\tthis.counters.push(entry);\n\t\treturn {\n\t\t\tinc: () => {\n\t\t\t\tentry.value++;\n\t\t\t},\n\t\t\tadd: (amount: number) => {\n\t\t\t\tif (amount < 0) {\n\t\t\t\t\tthrow new Error(\"Counter value cannot decrease\");\n\t\t\t\t}\n\t\t\t\tentry.value += amount;\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Serialize all registered metrics in Prometheus text exposition format.\n\t *\n\t * @see https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format\n\t */\n\tmetrics(): string {\n\t\treturn this.counters\n\t\t\t.map((c) => {\n\t\t\t\tlet result = \"\";\n\t\t\t\tif (c.help.length > 0) {\n\t\t\t\t\tresult += `# HELP ${c.name} ${c.help}\\n`;\n\t\t\t\t}\n\t\t\t\tresult += `# TYPE ${c.name} counter\\n`;\n\t\t\t\tresult += `${c.name} ${c.value}\\n`;\n\t\t\t\treturn result;\n\t\t\t})\n\t\t\t.join(\"\");\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../src/prometheus-metrics.ts"],"names":[],"mappings":";;;AAuCO,IAAM,kBAAN,MAAsB;AAAA,EAvC7B;AAuC6B,IAAA,MAAA,CAAA,IAAA,EAAA,iBAAA,CAAA;AAAA;AAAA,EACpB,WAA2B,EAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpC,aAAA,CAAc,MAAc,IAAA,EAAuB;AAClD,IAAA,MAAM,KAAA,GAAsB,EAAE,IAAA,EAAM,IAAA,EAAM,OAAO,CAAA,EAAE;AACnD,IAAA,IAAA,CAAK,QAAA,CAAS,KAAK,KAAK,CAAA;AACxB,IAAA,OAAO;AAAA,MACN,qBAAK,MAAA,CAAA,MAAM;AACV,QAAA,KAAA,CAAM,KAAA,EAAA;AAAA,MACP,CAAA,EAFK,KAAA,CAAA;AAAA,MAGL,GAAA,0BAAM,MAAA,KAAmB;AACxB,QAAA,IAAI,SAAS,CAAA,EAAG;AACf,UAAA,MAAM,IAAI,MAAM,+BAA+B,CAAA;AAAA,QAChD;AACA,QAAA,KAAA,CAAM,KAAA,IAAS,MAAA;AAAA,MAChB,CAAA,EALK,KAAA;AAAA,KAMN;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAA,GAAkB;AACjB,IAAA,OAAO,IAAA,CAAK,QAAA,CACV,GAAA,CAAI,CAAC,CAAA,KAAM;AACX,MAAA,IAAI,MAAA,GAAS,EAAA;AACb,MAAA,IAAI,CAAA,CAAE,IAAA,CAAK,MAAA,GAAS,CAAA,EAAG;AACtB,QAAA,MAAA,IAAU,CAAA,OAAA,EAAU,CAAA,CAAE,IAAI,CAAA,CAAA,EAAI,EAAE,IAAI;AAAA,CAAA;AAAA,MACrC;AACA,MAAA,MAAA,IAAU,CAAA,OAAA,EAAU,EAAE,IAAI,CAAA;AAAA,CAAA;AAC1B,MAAA,MAAA,IAAU,CAAA,EAAG,CAAA,CAAE,IAAI,CAAA,CAAA,EAAI,EAAE,KAAK;AAAA,CAAA;AAC9B,MAAA,OAAO,MAAA;AAAA,IACR,CAAC,CAAA,CACA,IAAA,CAAK,EAAE,CAAA;AAAA,EACV;AACD","file":"chunk-FEHWZI5W.mjs","sourcesContent":["/**\n * Lightweight Prometheus metrics registry for push-based counter metrics.\n *\n * Designed for ephemeral per-request usage in Cloudflare Workers that push\n * metrics to a Prometheus push gateway. Replaces the deprecated `promjs` library.\n *\n * @example\n * ```ts\n * const metrics = new MetricsRegistry();\n * const reqCounter = metrics.createCounter(\n * \"service_request_total\",\n * \"Total requests\"\n * );\n * reqCounter.inc();\n *\n * // Push to Prometheus gateway\n * ctx.waitUntil(\n * fetch(prometheusUrl, {\n * method: \"POST\",\n * headers: { Authorization: `Bearer ${token}` },\n * body: metrics.metrics(),\n * })\n * );\n * ```\n */\n\nexport interface Counter {\n\t/** Increment the counter by 1. */\n\tinc(): void;\n\t/** Increment the counter by the given non-negative amount. */\n\tadd(amount: number): void;\n}\n\ninterface CounterEntry {\n\tname: string;\n\thelp: string;\n\tvalue: number;\n}\n\nexport class MetricsRegistry {\n\tprivate counters: CounterEntry[] = [];\n\n\t/**\n\t * Create and register a new counter metric.\n\t *\n\t * @param name - The metric name (e.g. \"service_request_total\")\n\t * @param help - A human-readable description of the metric\n\t * @returns A Counter that can be incremented\n\t */\n\tcreateCounter(name: string, help: string): Counter {\n\t\tconst entry: CounterEntry = { name, help, value: 0 };\n\t\tthis.counters.push(entry);\n\t\treturn {\n\t\t\tinc: () => {\n\t\t\t\tentry.value++;\n\t\t\t},\n\t\t\tadd: (amount: number) => {\n\t\t\t\tif (amount < 0) {\n\t\t\t\t\tthrow new Error(\"Counter value cannot decrease\");\n\t\t\t\t}\n\t\t\t\tentry.value += amount;\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Serialize all registered metrics in Prometheus text exposition format.\n\t *\n\t * @see https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format\n\t */\n\tmetrics(): string {\n\t\treturn this.counters\n\t\t\t.map((c) => {\n\t\t\t\tlet result = \"\";\n\t\t\t\tif (c.help.length > 0) {\n\t\t\t\t\tresult += `# HELP ${c.name} ${c.help}\\n`;\n\t\t\t\t}\n\t\t\t\tresult += `# TYPE ${c.name} counter\\n`;\n\t\t\t\tresult += `${c.name} ${c.value}\\n`;\n\t\t\t\treturn result;\n\t\t\t})\n\t\t\t.join(\"\");\n\t}\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { __name } from './chunk-6LYDFTTF.mjs';
1
+ import { __name } from './chunk-CGILA3WO.mjs';
2
2
 
3
3
  // src/errors.ts
4
4
  var UserError = class extends Error {
@@ -60,5 +60,5 @@ function createFatalError(message, isJson, options) {
60
60
  __name(createFatalError, "createFatalError");
61
61
 
62
62
  export { CommandLineArgsError, DeprecationError, FatalError, JsonFriendlyFatalError, MissingConfigError, UserError, createFatalError };
63
- //# sourceMappingURL=chunk-CPLEE7LH.mjs.map
64
- //# sourceMappingURL=chunk-CPLEE7LH.mjs.map
63
+ //# sourceMappingURL=chunk-KAEJMITB.mjs.map
64
+ //# sourceM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C,UAAA,CAAW;AAAA,EA/DvD;AA+DuD,IAAA,MAAA,CAAA,IAAA,EAAA,wBAAA,CAAA;AAAA;AAAC;AAEjD,IAAM,kBAAA,GAAN,cAAiC,KAAA,CAAM;AAAA,EAjE9C;AAiE8C,IAAA,MAAA,CAAA,IAAA,EAAA,oBAAA,CAAA;AAAA;AAAA,EAC7C,gBAAA;AAAA,EACA,YAAY,GAAA,EAAa;AACxB,IAAA,KAAA,CAAM,CAAA,yBAAA,EAA4B,GAAG,CAAA,CAAE,CAAA;AACvC,IAAA,IAAA,CAAK,gBAAA,GAAmB,4BAA4B,GAAG,CAAA,CAAA;AAAA,EACxD;AACD;AAOO,SAAS,gBAAA,CACf,OAAA,EACA,MAAA,EACA,OAAA,EACQ;AACR,EAAA,IAAI,MAAA,EAAQ;AACX,IAAA,OAAO,IAAI,sBAAA,CAAuB,IAAA,CAAK,SAAA,CAAU,OAAO,GAAG,OAAO,CAAA;AAAA,EACnE;AAEA,EAAA,OAAO,IAAI,UAAA,CAAW,CAAA,EAAG,OAAO,IAAI,OAAO,CAAA;AAC5C;AAVgB,MAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA","file":"chunk-CPLEE7LH.mjs","sourcesContent":["/**\n * This is used to provide telemetry with a sanitised error\n * message that could not have any user-identifying information.\n * Set to `true` to duplicate `message`.\n * */\nexport type TelemetryMessage = {\n\ttelemetryMessage: string | boolean;\n};\n\ntype UserErrorOptions = ErrorOptions & TelemetryMessage;\n\ntype FatalErrorOptions = UserErrorOptions & {\n\tcode?: number;\n};\n/**\n * Base class for errors where the user has done something wrong. These are not\n * reported to Sentry. API errors are intentionally *not* `UserError`s, and are\n * reported to Sentry. This will help us understand which API errors need better\n * messaging.\n */\nexport class UserError extends Error {\n\ttelemetryMessage: string | undefined;\n\tconstructor(message: string, options: UserErrorOptions) {\n\t\tsuper(message, options);\n\t\t// Restore prototype chain:\n\t\t// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget\n\t\tObject.setPrototypeOf(this, new.target.prototype);\n\t\tthis.telemetryMessage =\n\t\t\ttypeof options?.telemetryMessage === \"string\"\n\t\t\t\t? options.telemetryMessage\n\t\t\t\t: options?.telemetryMessage\n\t\t\t\t\t? message\n\t\t\t\t\t: undefined;\n\t}\n}\n\nexport class DeprecationError extends UserError {\n\tconstructor(message: string, options: TelemetryMessage) {\n\t\tsuper(`Deprecation:\\n${message}`, options);\n\t}\n}\n\nexport class FatalError extends UserError {\n\treadonly code: number | undefined;\n\n\tconstructor(message: string, options: FatalErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.code = options.code;\n\t}\n}\n\nexport class CommandLineArgsError extends UserError {}\n\n/**\n * JsonFriendlyFatalError is used to output JSON when wrangler crashes, useful for --json mode.\n *\n * To use, pass stringify'd json into the constructor like so:\n * ```js\n * throw new JsonFriendlyFatalError(JSON.stringify({ error: messageToDisplay }), {\n * telemetryMessage: false,\n * });\n * ```\n */\nexport class JsonFriendlyFatalError extends FatalError {}\n\nexport class MissingConfigError extends Error {\n\ttelemetryMessage: string | undefined;\n\tconstructor(key: string) {\n\t\tsuper(`Missing config value for ${key}`);\n\t\tthis.telemetryMessage = `Missing config value for ${key}`;\n\t}\n}\n\n/**\n * Create either a FatalError or JsonFriendlyFatalError depending upon `isJson` parameter.\n *\n * If `isJson` is true, then the `message` is JSON stringified.\n */\nexport function createFatalError(\n\tmessage: unknown,\n\tisJson: boolean,\n\toptions: FatalErrorOptions\n): Error {\n\tif (isJson) {\n\t\treturn new JsonFriendlyFatalError(JSON.stringify(message), options);\n\t}\n\n\treturn new FatalError(`${message}`, options);\n}\n"]}
1
+ {"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";;;AAoBO,IAAM,SAAA,GAAN,cAAwB,KAAA,CAAM;AAAA,EApBrC;AAoBqC,IAAA,MAAA,CAAA,IAAA,EAAA,WAAA,CAAA;AAAA;AAAA,EACpC,gBAAA;AAAA,EACA,WAAA,CAAY,SAAiB,OAAA,EAA2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ACxB,IAAA,KAAA,CAAM,CAAA,yBAAA,EAA4B,GAAG,CAAA,CAAE,CAAA;AACvC,IAAA,IAAA,CAAK,gBAAA,GAAmB,4BAA4B,GAAG,CAAA,CAAA;AAAA,EACxD;AACD;AAOO,SAAS,gBAAA,CACf,OAAA,EACA,MAAA,EACA,OAAA,EACQ;AACR,EAAA,IAAI,MAAA,EAAQ;AACX,IAAA,OAAO,IAAI,sBAAA,CAAuB,IAAA,CAAK,SAAA,CAAU,OAAO,GAAG,OAAO,CAAA;AAAA,EACnE;AAEA,EAAA,OAAO,IAAI,UAAA,CAAW,CAAA,EAAG,OAAO,IAAI,OAAO,CAAA;AAC5C;AAVgB,MAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA","file":"chunk-KAEJMITB.mjs","sourcesContent":["/**\n * This is used to provide telemetry with a sanitised error\n * message that could not have any user-identifying information.\n * Set to `true` to duplicate `message`.\n * */\nexport type TelemetryMessage = {\n\ttelemetryMessage: string | boolean;\n};\n\ntype UserErrorOptions = ErrorOptions & TelemetryMessage;\n\ntype FatalErrorOptions = UserErrorOptions & {\n\tcode?: number;\n};\n/**\n * Base class for errors where the user has done something wrong. These are not\n * reported to Sentry. API errors are intentionally *not* `UserError`s, and are\n * reported to Sentry. This will help us understand which API errors need better\n * messaging.\n */\nexport class UserError extends Error {\n\ttelemetryMessage: string | undefined;\n\tconstructor(message: string, options: UserErrorOptions) {\n\t\tsuper(message, options);\n\t\t// Restore prototype chain:\n\t\t// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget\n\t\tObject.setPrototypeOf(this, new.target.prototype);\n\t\tthis.telemetryMessage =\n\t\t\ttypeof options?.telemetryMessage === \"string\"\n\t\t\t\t? options.telemetryMessage\n\t\t\t\t: options?.telemetryMessage\n\t\t\t\t\t? message\n\t\t\t\t\t: undefined;\n\t}\n}\n\nexport class DeprecationError extends UserError {\n\tconstructor(message: string, options: TelemetryMessage) {\n\t\tsuper(`Deprecation:\\n${message}`, options);\n\t}\n}\n\nexport class FatalError extends UserError {\n\treadonly code: number | undefined;\n\n\tconstructor(message: string, options: FatalErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.code = options.code;\n\t}\n}\n\nexport class CommandLineArgsError extends UserError {}\n\n/**\n * JsonFriendlyFatalError is used to output JSON when wrangler crashes, useful for --json mode.\n *\n * To use, pass stringify'd json into the constructor like so:\n * ```js\n * throw new JsonFriendlyFatalError(JSON.stringify({ error: messageToDisplay }), {\n * telemetryMessage: false,\n * });\n * ```\n */\nexport class JsonFriendlyFatalError extends FatalError {}\n\nexport class MissingConfigError extends Error {\n\ttelemetryMessage: string | undefined;\n\tconstructor(key: string) {\n\t\tsuper(`Missing config value for ${key}`);\n\t\tthis.telemetryMessage = `Missing config value for ${key}`;\n\t}\n}\n\n/**\n * Create either a FatalError or JsonFriendlyFatalError depending upon `isJson` parameter.\n *\n * If `isJson` is true, then the `message` is JSON stringified.\n */\nexport function createFatalError(\n\tmessage: unknown,\n\tisJson: boolean,\n\toptions: FatalErrorOptions\n): Error {\n\tif (isJson) {\n\t\treturn new JsonFriendlyFatalError(JSON.stringify(message), options);\n\t}\n\n\treturn new FatalError(`${message}`, options);\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { __name } from './chunk-6LYDFTTF.mjs';
1
+ import { __name } from './chunk-CGILA3WO.mjs';
2
2
  import fs from 'node:fs';
3
3
 
4
4
  function isDirectory(path) {
@@ -31,5 +31,5 @@ function removeDirSync(dirPath) {
31
31
  __name(removeDirSync, "removeDirSync");
32
32
 
33
33
  export { isDirectory, removeDir, removeDirSync };
34
- //# sourceMappingURL=chunk-VKFVZ67V.mjs.map
35
- //# sourceMappingURL=chunk-VKFVZ67V.mjs.map
34
+ //# sourceMappingURL=chunk-T6I7NOR4.mjs.map
35
+ //# sourceMappingURL=chunk-T6I7NOR4.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/fs-helpers.ts"],"names":[],"mappings":";;;AAUO,SAAS,YAAY,IAAA,EAAc;AACzC,EAAA,OAAO,EAAA,CAAG,SAAS,IAAA,EAAM,EAAE,gBAAgB,KAAA,EAAO,CAAA,EAAG,WAAA,EAAY,IAAK,KAAA;AACvE;AAFgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA;AA4BT,SAAS,UACf,OAAA,EACA,EAAE,gBAAgB,KAAA,EAAM,GAAiC,EAAC,EACnC;AAOvB,EAAA,MAAM,MAAA,GAAS,EAAA,CAAG,QAAA,CAAS,EAAA,CAAG,OAAA,EAAS;AAAA,IACtC,SAAA,EAAW,IAAA;AAAA,IACX,KAAA,EAAO,IAAA;AAAA,IACP,UAAA,EAAY,CAAA;AAAA,IACZ,UAAA,EAAY;AAAA,GACZ,CAAA;AACD,EAAA,IAAI,aAAA,EAAe;AAElB,IAAA,KAAK,MAAA,CAAO,MAAM,MAAM;AAAA,IAAC,CAAC,CAAA;AAAA,EAC3B,CAAA,MAAO;AACN,IAAA,OAAO,MAAA;AAAA,EACR;AACD;AAtBgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA;AAgCT,SAAS,cAAc,OAAA,EAAuB;AAEpD,EAAA,EAAA,CAAG,OAAO,OAAA,EAAS;AAAA,IAClB,SAAA,EAAW,IAAA;AAAA,IACX,KAAA,EAAO,IAAA;AAAA,IACP,UAAA,EAAY,CAAA;AAAA,IACZ,UAAA,EAAY;AAAA,GACZ,CAAA;AACF;AARgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"chunk-VKFVZ67V.mjs","sourcesContent":["import fs from \"node:fs\";\n\n/**\n * Returns whether the given path is a directory\n *\n * Note: this function never throws; if the path does not exist or is inaccessible, it returns false.\n *\n * @param path The file system path to check\n * @returns `true` if the path is a directory, `false` otherwise\n */\nexport function isDirectory(path: string) {\n\treturn fs.statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false;\n}\n\n/**\n * Recursively remove a directory without waiting for completion or throwing any errors.\n *\n * @param dirPath The directory path to remove\n * @param options An object with a `fireAndForget` property set to `true`\n * @return `void` - the removal is fire-and-forget with errors suppressed\n */\nexport function removeDir(\n\tdirPath: string,\n\t{ fireAndForget }: { fireAndForget: true }\n): void;\n\n/**\n * Recursively remove a directory with retries for Windows compatibility.\n *\n * @param dirPath The directory path to remove\n * @param options An optional object with a `fireAndForget` property set to `false`, if defined\n * @return `Promise<void>` - resolves when the removal is complete, or rejects if the removal fails\n */\nexport function removeDir(\n\tdirPath: string,\n\toptions?: { fireAndForget?: false }\n): Promise<void>;\n\nexport function removeDir(\n\tdirPath: string,\n\t{ fireAndForget = false }: { fireAndForget?: boolean } = {}\n): Promise<void> | void {\n\t// On Windows, `workerd` (and other processes) may not release file handles\n\t// immediately after disposal, causing `EBUSY` errors. Node.js's built-in\n\t// `maxRetries` option handles `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`,\n\t// and `EPERM` errors with automatic backoff retries.\n\n\t// eslint-disable-next-line workers-sdk/no-direct-recursive-rm -- this is the helper itself\n\tconst result = fs.promises.rm(dirPath, {\n\t\trecursive: true,\n\t\tforce: true,\n\t\tmaxRetries: 5,\n\t\tretryDelay: 100,\n\t});\n\tif (fireAndForget) {\n\t\t// Don't wait for the promise, and silently swallow errors by handling if rejected\n\t\tvoid result.catch(() => {});\n\t} else {\n\t\treturn result;\n\t}\n}\n\n/**\n * Synchronously and recursively remove a directory, with retries for Windows compatibility.\n *\n * @see {@link removeDir} for the async version and rationale.\n *\n * @param dirPath The directory path to remove\n * @throws If the removal fails after retries, an error will be thrown\n */\nexport function removeDirSync(dirPath: string): void {\n\t// eslint-disable-next-line workers-sdk/no-direct-recursive-rm -- this is the helper itself\n\tfs.rmSync(dirPath, {\n\t\trecursive: true,\n\t\tforce: true,\n\t\tmaxRetries: 5,\n\t\tretryDelay: 100,\n\t});\n}\n"]}
1
+ {"version":3,"sources":["../src/fs-helpers.ts"],"names":[],"mappings":";;;AAUO,SAAS,YAAY,IAAA,EAAc;AACzC,EAAA,OAAO,EAAA,CAAG,SAAS,IAAA,EAAM,EAAE,gBAAgB,KAAA,EAAO,CAAA,EAAG,WAAA,EAAY,IAAK,KAAA;AACvE;AAFgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA;AA4BT,SAAS,UACf,OAAA,EACA,EAAE,gBAAgB,KAAA,EAAM,GAAiC,EAAC,EACnC;AAOvB,EAAA,MAAM,MAAA,GAAS,EAAA,CAAG,QAAA,CAAS,EAAA,CAAG,OAAA,EAAS;AAAA,IACtC,SAAA,EAAW,IAAA;AAAA,IACX,KAAA,EAAO,IAAA;AAAA,IACP,UAAA,EAAY,CAAA;AAAA,IACZ,UAAA,EAAY;AAAA,GACZ,CAAA;AACD,EAAA,IAAI,aAAA,EAAe;AAElB,IAAA,KAAK,MAAA,CAAO,MAAM,MAAM;AAAA,IAAC,CAAC,CAAA;AAAA,EAC3B,CAAA,MAAO;AACN,IAAA,OAAO,MAAA;AAAA,EACR;AACD;AAtBgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA;AAgCT,SAAS,cAAc,OAAA,EAAuB;AAEpD,EAAA,EAAA,CAAG,OAAO,OAAA,EAAS;AAAA,IAClB,SAAA,EAAW,IAAA;AAAA,IACX,KAAA,EAAO,IAAA;AAAA,IACP,UAAA,EAAY,CAAA;AAAA,IACZ,UAAA,EAAY;AAAA,GACZ,CAAA;AACF;AARgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"chunk-T6I7NOR4.mjs","sourcesContent":["import fs from \"node:fs\";\n\n/**\n * Returns whether the given path is a directory\n *\n * Note: this function never throws; if the path does not exist or is inaccessible, it returns false.\n *\n * @param path The file system path to check\n * @returns `true` if the path is a directory, `false` otherwise\n */\nexport function isDirectory(path: string) {\n\treturn fs.statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false;\n}\n\n/**\n * Recursively remove a directory without waiting for completion or throwing any errors.\n *\n * @param dirPath The directory path to remove\n * @param options An object with a `fireAndForget` property set to `true`\n * @return `void` - the removal is fire-and-forget with errors suppressed\n */\nexport function removeDir(\n\tdirPath: string,\n\t{ fireAndForget }: { fireAndForget: true }\n): void;\n\n/**\n * Recursively remove a directory with retries for Windows compatibility.\n *\n * @param dirPath The directory path to remove\n * @param options An optional object with a `fireAndForget` property set to `false`, if defined\n * @return `Promise<void>` - resolves when the removal is complete, or rejects if the removal fails\n */\nexport function removeDir(\n\tdirPath: string,\n\toptions?: { fireAndForget?: false }\n): Promise<void>;\n\nexport function removeDir(\n\tdirPath: string,\n\t{ fireAndForget = false }: { fireAndForget?: boolean } = {}\n): Promise<void> | void {\n\t// On Windows, `workerd` (and other processes) may not release file handles\n\t// immediately after disposal, causing `EBUSY` errors. Node.js's built-in\n\t// `maxRetries` option handles `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`,\n\t// and `EPERM` errors with automatic backoff retries.\n\n\t// eslint-disable-next-line workers-sdk/no-direct-recursive-rm -- this is the helper itself\n\tconst result = fs.promises.rm(dirPath, {\n\t\trecursive: true,\n\t\tforce: true,\n\t\tmaxRetries: 5,\n\t\tretryDelay: 100,\n\t});\n\tif (fireAndForget) {\n\t\t// Don't wait for the promise, and silently swallow errors by handling if rejected\n\t\tvoid result.catch(() => {});\n\t} else {\n\t\treturn result;\n\t}\n}\n\n/**\n * Synchronously and recursively remove a directory, with retries for Windows compatibility.\n *\n * @see {@link removeDir} for the async version and rationale.\n *\n * @param dirPath The directory path to remove\n * @throws If the removal fails after retries, an error will be thrown\n */\nexport function removeDirSync(dirPath: string): void {\n\t// eslint-disable-next-line workers-sdk/no-direct-recursive-rm -- this is the helper itself\n\tfs.rmSync(dirPath, {\n\t\trecursive: true,\n\t\tforce: true,\n\t\tmaxRetries: 5,\n\t\tretryDelay: 100,\n\t});\n}\n"]}
@@ -1,38 +1,8 @@
1
- import { __name } from './chunk-6LYDFTTF.mjs';
1
+ import { __name } from './chunk-CGILA3WO.mjs';
2
2
  import assert from 'node:assert';
3
3
  import util from 'node:util';
4
+ import { $, yellow, cyan, blue, magenta, green, dim, red } from 'kleur/colors';
4
5
 
5
- // ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
6
- var FORCE_COLOR;
7
- var NODE_DISABLE_COLORS;
8
- var NO_COLOR;
9
- var TERM;
10
- var isTTY = true;
11
- if (typeof process !== "undefined") {
12
- ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
13
- isTTY = process.stdout && process.stdout.isTTY;
14
- }
15
- var $ = {
16
- enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
17
- };
18
- function init(x, y) {
19
- let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
20
- let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
21
- return function(txt) {
22
- if (!$.enabled || txt == null) return txt;
23
- return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
24
- };
25
- }
26
- __name(init, "init");
27
- var dim = init(2, 22);
28
- var red = init(31, 39);
29
- var green = init(32, 39);
30
- var yellow = init(33, 39);
31
- var blue = init(34, 39);
32
- var magenta = init(35, 39);
33
- var cyan = init(36, 39);
34
-
35
- // src/zod-format.ts
36
6
  var originalEnabled = $.enabled;
37
7
  function _forceColour(enabled = originalEnabled) {
38
8
  $.enabled = enabled;
@@ -263,5 +233,5 @@ function formatZodError(error, input) {
263
233
  __name(formatZodError, "formatZodError");
264
234
 
265
235
  export { _forceColour, formatZodError };
266
- //# sourceMappingURL=chunk-W7DIL5J2.mjs.map
267
- //# sourceMappingURL=chunk-W7DIL5J2.mjs.map
236
+ //# sourceMappingURL=chunk-VTOON473.mjs.map
237
+ //# sourceMappingURL=chunk-VTOON473.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/zod-format.ts"],"names":["$colors"],"mappings":";;;;;AAkBA,IAAM,kBAAkBA,CAAA,CAAQ,OAAA;AAKzB,SAAS,YAAA,CAAa,UAAU,eAAA,EAAiB;AACvD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,CAAE,SAAS,eAAA,EAAiB;AAC/B,QAAA,OAAO,EAAA;AAAA,MACR;AACA,MAAA,IAAI,CAAA,CAAE,SAAS,eAAA,EAAiB;AAC/B,QAAA,OAAO,CAAA;AAAA,MACR;AAAA,IACD;AACA,IAAA,OAAO,CAAA;AAAA,EACR,CAAC,CAAA;AAGD,EAAA,IAAI,SAAA;AACJ,EAAA,MAAM,WAAA,GAAc,IAAI,cAAA,EAAe;AACvC,EAAA,KAAA,MAAW,SAAS,YAAA,EAAc;AACjC,IAAA,SAAA,GAAY,QAAA;AAAA,MACX,WAAA;AAAA,MACA,SAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA,CAAM;AAAA,KACP;AAAA,EACD;AAKA,EAAA,MAAM,cAAA,GAAsC;AAAA,IAC3C,KAAA,EAAO,CAAA;AAAA,IACP,QAAQA,CAAA,CAAQ;AAAA,GACjB;AACA,EAAA,OAAO,KAAA,CAAM,cAAA,EAAgB,WAAA,EAAa,SAAS,CAAA;AACpD;AApCgB,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA","file":"chunk-VTOON473.mjs","sourcesContent":["// noinspection JSUnusedAssignment\n// ^ WebStorm incorrectly thinks some variables might not have been initialised\n// before use without this. TypeScript is better at catching these errors. :)\n\nimport assert from \"node:assert\";\nimport util from \"node:util\";\nimport {\n\t$ as $colors,\n\tblue,\n\tcyan,\n\tdim,\n\tgreen,\n\tmagenta,\n\tred,\n\tyellow,\n} from \"kleur/colors\";\nimport type { z } from \"zod\";\n\nconst originalEnabled = $colors.enabled;\n\n// `kleur` is marked as a dev dependency, so will get bundled. We'd still like\n// to be able to control whether it's enabled in tests though. Therefore, export\n// a function that toggles the enabled state of our bundled version.\nexport function _forceColour(enabled = originalEnabled) {\n\t$colors.enabled = enabled;\n}\n\n// This file contains a `formatZodError(error, input)` function for formatting\n// a Zod `error` that came from parsing a specific `input`. This works by\n// building an \"annotated\" version of the `input`, with roughly the same shape,\n// but including messages from the `error`. This is then printed to a string.\n//\n// When the Zod `error` includes an issue at a specific path, that path is\n// replaced with an `Annotation` in the \"annotated\" version. This `Annotation`,\n// includes any messages for that path, along with the actual value at that\n// path. `Annotation`s may be grouped if they are part of a union. In this case,\n// they'll be printed in a different colour and with a group ID to indicate that\n// only one of the issues needs to be fixed for all issues in the group to be\n// resolved.\n//\n// This is best illustrated with some examples:\n//\n// # Primitive Input\n//\n// ```\n// const schema = z.boolean();\n// const input = 42;\n// const error = schema.safeParse(input).error;\n// ↳ ZodError [\n// {\n// \"code\": \"invalid_type\",\n// \"expected\": \"boolean\",\n// \"received\": \"number\",\n// \"path\": [],\n// \"message\": \"Expected boolean, received number\"\n// }\n// ]\n//\n// /* Annotated */\n// {\n// [Symbol(kMessages)]: [ 'Expected boolean, received number' ],\n// [Symbol(kActual)]: 42\n// }\n//\n// const formatted = formatZodError(error, input);\n// ↳ 42\n// ^ Expected boolean, received number\n// ```\n//\n// In this example, we only have a single issue, with `\"path\": []`. This path\n// represents the root, so the root of the input has been replaced with an\n// annotation in the annotated version.\n//\n// ### Object Input\n//\n// ````\n// const schema = z.object({ a: z.number(), b: z.number(), c: z.object({ d: z.number() })});\n// const input = { a: false, b: 42, c: { d: \"not a number\" } };\n// const error = schema.safeParse(input).error;\n// ↳ ZodError: [\n// {\n// \"code\": \"invalid_type\",\n// \"expected\": \"number\",\n// \"received\": \"boolean\",\n// \"path\": [ \"a\" ],\n// \"message\": \"Expected number, received boolean\"\n// },\n// {\n// \"code\": \"invalid_type\",\n// \"expected\": \"number\",\n// \"received\": \"string\",\n// \"path\": [ \"c\", \"d\" ],\n// \"message\": \"Expected number, received boolean\"\n// }\n// ]\n//\n// /* Annotated after 1st issue */\n// {\n// a: {\n// [Symbol(kMessages)]: [ 'Expected number, received boolean' ],\n// [Symbol(kActual)]: false\n// },\n// b: undefined,\n// c: undefined,\n// }\n//\n// /* Annotated after 2nd issue */\n// {\n// a: {\n// [Symbol(kMessages)]: [ 'Expected number, received boolean' ],\n// [Symbol(kActual)]: false\n// },\n// b: undefined,\n// c: {\n// d: {\n// [Symbol(kMessages)]: [ 'Expected number, received string' ],\n// [Symbol(kActual)]: 'not a number'\n// }\n// }\n// }\n//\n// const formatted = formatZodError(error, input);\n// ↳ {\n// a: false,\n// ^ Expected number, received boolean\n// ...,\n// c: {\n// d: true,\n// ^ Expected number, received boolean\n// },\n// }\n// ````\n//\n// If the error contains multiple issues, we annotate them one at a time.\n// For object inputs, the annotated object starts out with the same keys as\n// the object, just with `undefined` values. Keys with values that are\n// `undefined` at the end of annotation will be printed as \"...\". Annotations\n// are inserted on paths where there are issues. Note annotations are\n// effectively the leaves of the annotated tree.\n//\n// ### Array Input\n//\n// ```\n// const schema = z.array(z.number());\n// const input = [1, 2, false, 4];\n// const error = schema.safeParse(input).error;\n// ↳ ZodError: [\n// {\n// \"code\": \"invalid_type\",\n// \"expected\": \"number\",\n// \"received\": \"boolean\",\n// \"path\": [ 2 ],\n// \"message\": \"Expected number, received boolean\"\n// }\n// ]\n//\n// /* Annotated */\n// [\n// <2 empty items>,\n// {\n// [Symbol(kMessages)]: [ 'Expected number, received boolean' ],\n// [Symbol(kActual)]: false\n// },\n// <1 empty item>\n// ]\n//\n// const formatted = formatZodError(error, input);\n// ↳ [\n// ...,\n// /* [2] */ false,\n// ^ Expected number, received boolean\n// ...,\n// ]\n// ```\n//\n// In this case the annotated value is now an array, rather than a plain-object,\n// to match the shape of the input. Note it has the same length as the input,\n// including empty items for array indices that don't have errors. Empty items\n// will be coalesced and printed as \"...\".\n//\n// ### Union Schema and Groups\n//\n// ```\n// const schema = z.union([z.object({ a: z.number() }), z.object({ b: z.string() })]);\n// const input = { c: false };\n// const error = schema.safeParse(input).error;\n// ↳ [\n// {\n// \"code\": \"invalid_union\",\n// \"path\": [],\n// \"message\": \"Invalid input\",\n// \"unionErrors\": [\n// {\n// \"name\": \"ZodError\",\n// \"issues\": [\n// {\n// \"code\": \"invalid_type\",\n// \"expected\": \"number\",\n// \"received\": \"undefined\",\n// \"path\": [ \"a\" ],\n// \"message\": \"Required\"\n// }\n// ]\n// },\n// {\n// \"name\": \"ZodError\",\n// \"issues\": [\n// {\n// \"code\": \"invalid_type\",\n// \"expected\": \"string\",\n// \"received\": \"undefined\",\n// \"path\": [ \"b\" ],\n// \"message\": \"Required\"\n// }\n// ]\n// }\n// ]\n// }\n// ]\n//\n// /* Annotated */\n// {\n// c: undefined,\n// a: {\n// [Symbol(kMessages)]: [ 'Required' ],\n// [Symbol(kActual)]: undefined,\n// [Symbol(kGroupId)]: 0\n// },\n// b: {\n// [Symbol(kMessages)]: [ 'Required' ],\n// [Symbol(kActual)]: undefined,\n// [Symbol(kGroupId)]: 0\n// }\n// }\n//\n// const formatted = formatZodError(error, input);\n// ↳ {\n// ...,\n// a: undefined,\n// ^1 Required *or*\n// b: undefined,\n// ^1 Required\n// }\n// ```\n//\n// In this case, fixing either of the reported issues would solve the problem.\n// To indicate this, we \"group\" issues contained within `unionErrors`. See how\n// annotations have a `[Symbol(kGroupId)]: 0`. Group IDs are 0-indexed\n// internally but 1-indexed when displayed (see \"^1\"). Each group's messages\n// are displayed in a different colour to visually group them. Note the\n// unhelpful \"Invalid input\" message has been hidden. Required options that\n// are not present in the `input` are added to the end of the annotated input.\n//\n\nconst kMessages = Symbol(\"kMessages\");\nconst kActual = Symbol(\"kActual\");\nconst kGroupId = Symbol(\"kGroupId\");\n\n// Set of Zod error messages attached to a specific path in the input\ninterface Annotation {\n\t// Error messages at this specific path in the annotated tree. A path may have\n\t// multiple messages associated with it if the schema is a union/intersection.\n\t[kMessages]: string[];\n\t// The input value at this specific path\n\t[kActual]: unknown;\n\t// Optional 0-indexed group for this annotation. Fixing a single issue in a\n\t// group will usually fix all other issues in the group. Grouped annotations\n\t// are displayed in a different colour with their 1-indexed group ID.\n\t[kGroupId]?: number;\n}\n\n// Object with the same shape as the input, but with undefined at the leaves,\n// or an annotation iff there's an issue at that specific path.\ntype Annotated =\n\t| undefined\n\t| Annotation\n\t| { [key: string]: Annotated }\n\t| Annotated[];\n\n// `green` is a success colour, so only use it for groups if really needed\nconst groupColours = [yellow, /* (green) */ cyan, blue, magenta, green];\n\n// Maps group IDs to the number of annotations in that group. Used to determine\n// whether this isn't the last annotation in a group, and \"or\" should be printed\n// with the message.\nconst GroupCountsMap = Map<number /* [kGroupId] */, number /* count */>;\ntype GroupCountsMap = InstanceType<typeof GroupCountsMap>;\n\nfunction isAnnotation(value: unknown): value is Annotation {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\tkMessages in value &&\n\t\tkActual in value\n\t);\n}\n\nfunction isRecord(value: unknown): value is Record<string | number, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction arrayShallowEqual<T>(a: T[], b: T[]) {\n\tif (a.length !== b.length) {\n\t\treturn false;\n\t}\n\tfor (let i = 0; i < a.length; i++) {\n\t\tif (a[i] !== b[i]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction issueEqual(a: z.core.$ZodIssue, b: z.core.$ZodIssue) {\n\t// We consider issues to be equal if their messages and paths are\n\treturn a.message === b.message && arrayShallowEqual(a.path, b.path);\n}\n\nfunction hasMultipleDistinctMessages(\n\tissues: z.core.$ZodIssue[],\n\tatDepth: number\n) {\n\t// Returns true iff `issues` has issues that aren't \"the same\" at the\n\t// specified depth or below\n\tlet firstIssue: z.core.$ZodIssue | undefined;\n\tfor (const issue of issues) {\n\t\tif (issue.path.length < atDepth) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (firstIssue === undefined) {\n\t\t\tfirstIssue = issue;\n\t\t} else if (!issueEqual(firstIssue, issue)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction annotate(\n\tgroupCounts: GroupCountsMap,\n\tannotated: Annotated,\n\tinput: unknown,\n\tissue: z.core.$ZodIssue,\n\tpath: (string | number)[],\n\tgroupId?: number\n): Annotated {\n\tif (path.length === 0) {\n\t\t// Empty path, `input` has incorrect shape\n\n\t\t// If this is an `invalid_union` error, make sure we include all sub-issues\n\t\tif (issue.code === \"invalid_union\") {\n\t\t\t// In zod v4, `issue.errors` is `$ZodIssue[][]` where each inner\n\t\t\t// array holds the issues for one union branch.\n\t\t\tconst allBranchIssues = issue.errors;\n\t\t\tconst unionIssues = allBranchIssues.flat();\n\n\t\t\t// In zod v4, discriminated unions with an invalid discriminator\n\t\t\t// produce an `invalid_union` issue with an empty `errors` array\n\t\t\t// and the error message on the issue itself. Fall through to\n\t\t\t// treat it as a regular annotation in that case.\n\t\t\tif (unionIssues.length > 0) {\n\t\t\t\t// If the `input` is an object/array with multiple distinct messages,\n\t\t\t\t// annotate it as a group\n\t\t\t\t// In zod v4, branch issue paths are already relative to the union\n\t\t\t\t// issue, so use depth 1 (deeper than current level 0) rather than\n\t\t\t\t// issue.path.length + 1.\n\t\t\t\tconst multipleDistinct = hasMultipleDistinctMessages(unionIssues, 1);\n\n\t\t\t\tlet newGroupId: number | undefined;\n\t\t\t\tif (isRecord(input) && multipleDistinct) {\n\t\t\t\t\tnewGroupId = groupCounts.size;\n\t\t\t\t\tgroupCounts.set(newGroupId, 0);\n\t\t\t\t}\n\n\t\t\t\tfor (const branchIssues of allBranchIssues) {\n\t\t\t\t\tfor (const unionIssue of branchIssues) {\n\t\t\t\t\t\t// In zod v4, branch issue paths are already relative to the\n\t\t\t\t\t\t// union issue (not absolute), so use them directly.\n\t\t\t\t\t\tconst unionPath = unionIssue.path as (string | number)[];\n\t\t\t\t\t\t// If we have multiple distinct messages at deeper levels, and this\n\t\t\t\t\t\t// issue is for the current path, skip it, so we don't end up annotating\n\t\t\t\t\t\t// the current path and sub-paths\n\t\t\t\t\t\tif (multipleDistinct && unionPath.length === 0) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tannotated = annotate(\n\t\t\t\t\t\t\tgroupCounts,\n\t\t\t\t\t\t\tannotated,\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tunionIssue,\n\t\t\t\t\t\t\tunionPath,\n\t\t\t\t\t\t\tnewGroupId\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn annotated;\n\t\t\t}\n\t\t}\n\n\t\tconst message = issue.message;\n\t\t// If we've already annotated this path (existing annotation or union)...\n\t\tif (annotated !== undefined) {\n\t\t\t// ...and if this is a new message for an existing annotation...\n\t\t\tif (isAnnotation(annotated) && !annotated[kMessages].includes(message)) {\n\t\t\t\t// ...add it\n\t\t\t\tannotated[kMessages].push(message);\n\t\t\t}\n\t\t\treturn annotated;\n\t\t}\n\n\t\t// Creating a new annotation\n\n\t\t// If this new annotation is part of a group...\n\t\tif (groupId !== undefined) {\n\t\t\t// ...increment that group's count\n\t\t\tconst current = groupCounts.get(groupId);\n\t\t\tassert(current !== undefined);\n\t\t\tgroupCounts.set(groupId, current + 1);\n\t\t}\n\n\t\treturn <Annotation>{\n\t\t\t[kMessages]: [message],\n\t\t\t[kActual]: input,\n\t\t\t[kGroupId]: groupId,\n\t\t};\n\t}\n\n\t// Non-empty path, `input` should be an object or array\n\tconst [head, ...tail] = path;\n\tassert(isRecord(input), \"Expected object/array input for nested issue\");\n\tif (annotated === undefined) {\n\t\t// Initialise `annotated` to look like `input`, with empty slots for keys\n\t\tif (Array.isArray(input)) {\n\t\t\tannotated = new Array(input.length);\n\t\t} else {\n\t\t\tconst entries = Object.keys(input).map((key) => [key, undefined]);\n\t\t\tannotated = Object.fromEntries(entries);\n\t\t}\n\t}\n\tassert(isRecord(annotated), \"Expected object/array for nested issue\");\n\t// Recursively annotate\n\tannotated[head] = annotate(\n\t\tgroupCounts,\n\t\tannotated[head],\n\t\tinput[head],\n\t\tissue,\n\t\ttail,\n\t\tgroupId\n\t);\n\treturn annotated;\n}\n\ninterface PrintExtras {\n\tprefix?: string;\n\tsuffix?: string;\n}\nfunction print(\n\tinspectOptions: util.InspectOptions,\n\tgroupCounts: GroupCountsMap,\n\tannotated: Annotated,\n\tindent = \"\",\n\textras?: PrintExtras\n): string {\n\tconst prefix = extras?.prefix ?? \"\";\n\tconst suffix = extras?.suffix ?? \"\";\n\n\tif (isAnnotation(annotated)) {\n\t\tconst prefixIndent = indent + \" \".repeat(prefix.length);\n\n\t\t// Print actual value\n\t\tconst actual = util.inspect(annotated[kActual], inspectOptions);\n\t\tconst actualIndented = actual\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line, i) => (i > 0 ? prefixIndent + line : line))\n\t\t\t.join(\"\\n\");\n\n\t\t// Print message\n\t\tlet messageColour = red;\n\t\tlet messagePrefix = prefixIndent + \"^\";\n\t\tlet groupOr = \"\";\n\t\tif (annotated[kGroupId] !== undefined) {\n\t\t\t// If this annotation was part of a group, set the message colour based\n\t\t\t// on the group, and include the group ID in the prefix\n\t\t\tmessageColour = groupColours[annotated[kGroupId] % groupColours.length];\n\t\t\tmessagePrefix += annotated[kGroupId] + 1;\n\t\t\tconst remaining = groupCounts.get(annotated[kGroupId]);\n\t\t\tassert(remaining !== undefined);\n\t\t\tif (remaining > 1) {\n\t\t\t\tgroupOr = \" *or*\";\n\t\t\t}\n\t\t\tgroupCounts.set(annotated[kGroupId], remaining - 1);\n\t\t}\n\t\tmessagePrefix += \" \";\n\n\t\tconst messageIndent = \" \".repeat(messagePrefix.length);\n\t\tconst messageIndented = annotated[kMessages]\n\t\t\t.flatMap((m) => m.split(\"\\n\"))\n\t\t\t.map((line, i) => (i > 0 ? messageIndent + line : line))\n\t\t\t.join(\"\\n\");\n\n\t\t// Print final annotation\n\t\tconst error = messageColour(`${messagePrefix}${messageIndented}${groupOr}`);\n\t\treturn `${indent}${dim(prefix)}${actualIndented}${dim(suffix)}\\n${error}`;\n\t} else if (Array.isArray(annotated)) {\n\t\t// Print array recursively\n\t\tlet result = `${indent}${dim(`${prefix}[`)}\\n`;\n\t\tconst arrayIndent = indent + \" \";\n\t\tfor (let i = 0; i < annotated.length; i++) {\n\t\t\tconst value = annotated[i];\n\t\t\t// Add `...` if the last item wasn't an `...`\n\t\t\tif (value === undefined && (i === 0 || annotated[i - 1] !== undefined)) {\n\t\t\t\tresult += `${arrayIndent}${dim(\"...,\")}\\n`;\n\t\t\t}\n\t\t\tif (value !== undefined) {\n\t\t\t\tresult += print(inspectOptions, groupCounts, value, arrayIndent, {\n\t\t\t\t\tprefix: `/* [${i}] */ `,\n\t\t\t\t\tsuffix: \",\",\n\t\t\t\t});\n\t\t\t\tresult += \"\\n\";\n\t\t\t}\n\t\t}\n\t\tresult += `${indent}${dim(`]${suffix}`)}`;\n\t\treturn result;\n\t} else if (isRecord(annotated)) {\n\t\t// Print object recursively\n\t\tlet result = `${indent}${dim(`${prefix}{`)}\\n`;\n\t\tconst objectIndent = indent + \" \";\n\t\tconst entries = Object.entries(annotated);\n\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\tconst [key, value] = entries[i];\n\t\t\t// Add `...` if the last item wasn't an `...`\n\t\t\tif (value === undefined && (i === 0 || entries[i - 1][1] !== undefined)) {\n\t\t\t\tresult += `${objectIndent}${dim(\"...,\")}\\n`;\n\t\t\t}\n\t\t\tif (value !== undefined) {\n\t\t\t\tresult += print(inspectOptions, groupCounts, value, objectIndent, {\n\t\t\t\t\tprefix: `${key}: `,\n\t\t\t\t\tsuffix: \",\",\n\t\t\t\t});\n\t\t\t\tresult += \"\\n\";\n\t\t\t}\n\t\t}\n\t\tresult += `${indent}${dim(`}${suffix}`)}`;\n\t\treturn result;\n\t}\n\n\treturn \"\";\n}\n\nexport function formatZodError(error: z.ZodError, input: unknown): string {\n\t// Shallow copy and sort array, with `invalid_union` errors first, so we don't\n\t// annotate the input with an `invalid_type` error instead\n\tconst sortedIssues = Array.from(error.issues).sort((a, b) => {\n\t\tif (a.code !== b.code) {\n\t\t\tif (a.code === \"invalid_union\") {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif (b.code === \"invalid_union\") {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t});\n\n\t// Build annotated input\n\tlet annotated: Annotated;\n\tconst groupCounts = new GroupCountsMap();\n\tfor (const issue of sortedIssues) {\n\t\tannotated = annotate(\n\t\t\tgroupCounts,\n\t\t\tannotated,\n\t\t\tinput,\n\t\t\tissue,\n\t\t\tissue.path as (string | number)[]\n\t\t);\n\t}\n\n\t// Print to pretty string\n\t// Build inspect options on each call to `formatZodError()` so we can toggle\n\t// colours per-call\n\tconst inspectOptions: util.InspectOptions = {\n\t\tdepth: 0,\n\t\tcolors: $colors.enabled,\n\t};\n\treturn print(inspectOptions, groupCounts, annotated);\n}\n"]}