@nightintelligence/cloudflare-workers-utils 0.35.0-patch3 → 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 (49) hide show
  1. package/dist/browser.mjs +2 -2
  2. package/dist/browser.mjs.map +1 -1
  3. package/dist/chunk-47QFQIPP.mjs +180 -0
  4. package/dist/chunk-47QFQIPP.mjs.map +1 -0
  5. package/dist/chunk-555CCIJE.mjs +75 -0
  6. package/dist/chunk-555CCIJE.mjs.map +1 -0
  7. package/dist/chunk-CGILA3WO.mjs +12 -0
  8. package/dist/{chunk-PAWJFY3S.mjs.map → chunk-CGILA3WO.mjs.map} +1 -1
  9. package/dist/chunk-FEHWZI5W.mjs +54 -0
  10. package/dist/chunk-FEHWZI5W.mjs.map +1 -0
  11. package/dist/chunk-KAEJMITB.mjs +64 -0
  12. package/dist/chunk-KAEJMITB.mjs.map +1 -0
  13. package/dist/chunk-T6I7NOR4.mjs +35 -0
  14. package/dist/chunk-T6I7NOR4.mjs.map +1 -0
  15. package/dist/chunk-VTOON473.mjs +237 -0
  16. package/dist/chunk-VTOON473.mjs.map +1 -0
  17. package/dist/chunk-W4SU7D4X.mjs +575 -0
  18. package/dist/chunk-W4SU7D4X.mjs.map +1 -0
  19. package/dist/chunk-YTEYGQOX.mjs +157 -0
  20. package/dist/chunk-YTEYGQOX.mjs.map +1 -0
  21. package/dist/chunk-Z7Q743IF.mjs +477 -0
  22. package/dist/chunk-Z7Q743IF.mjs.map +1 -0
  23. package/dist/chunk-ZZBYXY7A.mjs +44 -0
  24. package/dist/chunk-ZZBYXY7A.mjs.map +1 -0
  25. package/dist/compatibility-date.mjs +2 -42
  26. package/dist/compatibility-date.mjs.map +1 -1
  27. package/dist/compliance.mjs +6 -2
  28. package/dist/compliance.mjs.map +1 -1
  29. package/dist/docker-path.mjs +3 -11
  30. package/dist/docker-path.mjs.map +1 -1
  31. package/dist/errors.mjs +2 -61
  32. package/dist/errors.mjs.map +1 -1
  33. package/dist/fs-helpers.mjs +2 -33
  34. package/dist/fs-helpers.mjs.map +1 -1
  35. package/dist/global-wrangler-config-path.mjs +3 -28
  36. package/dist/global-wrangler-config-path.mjs.map +1 -1
  37. package/dist/index.mjs +9398 -54
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/local-env.mjs +3 -3
  40. package/dist/local-env.mjs.map +1 -1
  41. package/dist/metafile-esm.json +1 -1
  42. package/dist/prometheus-metrics.mjs +2 -51
  43. package/dist/prometheus-metrics.mjs.map +1 -1
  44. package/dist/test-helpers/index.mjs +307 -7
  45. package/dist/test-helpers/index.mjs.map +1 -1
  46. package/dist/zod-format.mjs +2 -235
  47. package/dist/zod-format.mjs.map +1 -1
  48. package/package.json +1 -1
  49. package/dist/chunk-PAWJFY3S.mjs +0 -6
@@ -1,4 +1,4 @@
1
- import { __name } from './chunk-PAWJFY3S.mjs';
1
+ import { __name } from './chunk-CGILA3WO.mjs';
2
2
  import * as fs from 'node:fs/promises';
3
3
  import * as path from 'node:path';
4
4
  import { parse } from 'dotenv';
@@ -69,8 +69,8 @@ async function loadDevVars(envDir, mode) {
69
69
  __name(loadDevVars, "loadDevVars");
70
70
  async function tryParseFile(filePath, parse) {
71
71
  try {
72
- const stat = await fs.stat(filePath);
73
- if (!stat.isFile() && !stat.isFIFO()) {
72
+ const stat2 = await fs.stat(filePath);
73
+ if (!stat2.isFile() && !stat2.isFIFO()) {
74
74
  return;
75
75
  }
76
76
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/local-env.ts"],"names":["parseDotEnv"],"mappings":";;;;;;AA2BO,SAAS,WAAA,CAAY,QAAwB,IAAA,EAAyB;AAC5E,EAAA,IAAI,WAAW,KAAA,EAAO;AACrB,IAAA,OAAO,EAAC;AAAA,EACT;AAEA,EAAA,MAAM,SAAA,GAAY;AAAA,IACjB,MAAA;AAAA,IACA,YAAA;AAAA,IACA,GAAI,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,CAAC,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AK,MAAA,MAAY,CAAC,IAAA,CAAK,QAAO,EAAG;AACrC,MAAA;AAAA,IACD;AACA,IAAA,OAAO;AAAA,MACN,IAAA,EAAM,QAAA;AAAA,MACN,QAAQ,KAAA,CAAM,MAAM,GAAG,QAAA,CAAS,QAAA,EAAU,MAAM,CAAC;AAAA,KAClD;AAAA,EACD,SAAS,KAAA,EAAO;AACf,IAAA,IAAI,kBAAA,CAAmB,KAAK,CAAA,EAAG;AAC9B,MAAA;AAAA,IACD;AACA,IAAA,MAAM,KAAA;AAAA,EACP;AACD;AAnBe,MAAA,CAAA,YAAA,EAAA,cAAA,CAAA;AAqBf,SAAS,mBAAmB,KAAA,EAAyB;AACpD,EAAA,OACC,KAAA,YAAiB,SACjB,MAAA,IAAU,KAAA,KACT,MAAM,IAAA,KAAS,QAAA,IAAY,MAAM,IAAA,KAAS,SAAA,CAAA;AAE7C;AANS,MAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA;AAQT,SAAS,cAAA,GAAyC;AACjD,EAAA,OAAO,MAAA,CAAO,WAAA;AAAA,IACb,MAAA,CAAO,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAA,CAAE,MAAA;AAAA,MAC3B,CAAC,KAAA,KAAqC,KAAA,CAAM,CAAC,CAAA,KAAM;AAAA;AACpD,GACD;AACD;AANS,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA","file":"local-env.mjs","sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { parse as parseDotEnv } from \"dotenv\";\nimport { expand } from \"dotenv-expand\";\n\nexport type LocalEnvValueSource =\n\t| { type: \"file\"; path: string }\n\t| { type: \"process\" };\n\nexport interface LoadedEnv {\n\tvalues: Record<string, string>;\n\tsources: Record<string, LocalEnvValueSource>;\n}\n\ninterface ParsedFile {\n\tpath: string;\n\tvalues: Record<string, string>;\n}\n\n/**\n * Returns the local `.env` candidates in increasing precedence order.\n *\n * @param envDir The resolved environment directory. `false` disables file\n * loading, matching Vite's `envDir` convention.\n * @param mode The optional mode used for mode-specific files.\n * @returns Absolute candidate paths in load order.\n */\nexport function getEnvPaths(envDir: string | false, mode?: string): string[] {\n\tif (envDir === false) {\n\t\treturn [];\n\t}\n\n\tconst filenames = [\n\t\t\".env\",\n\t\t\".env.local\",\n\t\t...(mode === undefined ? [] : [`.env.${mode}`, `.env.${mode}.local`]),\n\t];\n\treturn filenames.map((filename) => path.resolve(envDir, filename));\n}\n\n/**\n * Returns the `.dev.vars` candidates in decreasing selection priority.\n *\n * @param envDir The resolved environment directory. `false` disables file\n * loading, matching Vite's `envDir` convention.\n * @param mode The optional mode used to select `.dev.vars.<mode>`.\n * @returns Absolute candidate paths in selection order.\n */\nexport function getDevVarsCandidatePaths(\n\tenvDir: string | false,\n\tmode?: string\n): string[] {\n\tif (envDir === false) {\n\t\treturn [];\n\t}\n\n\treturn [\n\t\t...(mode === undefined ? [] : [`.dev.vars.${mode}`]),\n\t\t\".dev.vars\",\n\t].map((filename) => path.resolve(envDir, filename));\n}\n\n/**\n * Loads local `.env` files using Vite-compatible file precedence and\n * Wrangler-compatible parsing and expansion.\n *\n * Expansion is progressive: references can use process values and values\n * declared earlier in the merged environment, but not values declared later.\n * Loading has no process-global side effects.\n *\n * @param envDir The resolved environment directory. `false` disables file\n * loading, matching Vite's `envDir` convention.\n * @param mode The optional mode used for mode-specific files.\n * @returns Resolved values and metadata describing their sources.\n */\nexport async function loadEnv(\n\tenvDir: string | false,\n\tmode?: string\n): Promise<LoadedEnv> {\n\tif (mode === \"local\") {\n\t\tthrow new Error(\n\t\t\t'\"local\" cannot be used as a mode name because it conflicts with the .local postfix for .env files.'\n\t\t);\n\t}\n\n\tconst candidateFiles = getEnvPaths(envDir, mode);\n\tconst parsed: Record<string, string> = {};\n\tconst parsedSources: Record<string, LocalEnvValueSource> = {};\n\n\tfor (const candidate of candidateFiles) {\n\t\tconst loaded = await tryParseFile(candidate, parseDotEnv);\n\t\tif (loaded === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const [key, value] of Object.entries(loaded.values)) {\n\t\t\tparsed[key] = value;\n\t\t\tparsedSources[key] = { type: \"file\", path: loaded.path };\n\t\t}\n\t}\n\n\tconst processEnv = copyProcessEnv();\n\texpand({ parsed, processEnv: { ...processEnv } });\n\n\tconst values = { ...parsed };\n\tconst sources = { ...parsedSources };\n\n\tfor (const [key, value] of Object.entries(processEnv)) {\n\t\tvalues[key] = value;\n\t\tsources[key] = { type: \"process\" };\n\t}\n\n\treturn { values, sources };\n}\n\n/**\n * Loads the first existing `.dev.vars` candidate without merging it with other\n * files or process-environment values.\n *\n * @param envDir The resolved environment directory. `false` disables file\n * loading, matching Vite's `envDir` convention.\n * @param mode The optional mode used to select `.dev.vars.<mode>`.\n * @returns The selected `.dev.vars` values, or `undefined` when no candidate exists.\n */\nexport async function loadDevVars(\n\tenvDir: string | false,\n\tmode?: string\n): Promise<Record<string, string> | undefined> {\n\tconst candidateFiles = getDevVarsCandidatePaths(envDir, mode);\n\tfor (const candidate of candidateFiles) {\n\t\tconst loaded = await tryParseFile(candidate, parseDotEnv);\n\t\tif (loaded === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn loaded.values;\n\t}\n}\n\nasync function tryParseFile(\n\tfilePath: string,\n\tparse: (contents: string) => Record<string, string>\n): Promise<ParsedFile | undefined> {\n\ttry {\n\t\tconst stat = await fs.stat(filePath);\n\t\tif (!stat.isFile() && !stat.isFIFO()) {\n\t\t\treturn;\n\t\t}\n\t\treturn {\n\t\t\tpath: filePath,\n\t\t\tvalues: parse(await fs.readFile(filePath, \"utf8\")),\n\t\t};\n\t} catch (error) {\n\t\tif (isMissingFileError(error)) {\n\t\t\treturn;\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nfunction isMissingFileError(error: unknown): boolean {\n\treturn (\n\t\terror instanceof Error &&\n\t\t\"code\" in error &&\n\t\t(error.code === \"ENOENT\" || error.code === \"ENOTDIR\")\n\t);\n}\n\nfunction copyProcessEnv(): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(process.env).filter(\n\t\t\t(entry): entry is [string, string] => entry[1] !== undefined\n\t\t)\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../src/local-env.ts"],"names":["parseDotEnv","stat"],"mappings":";;;;;;AA2BO,SAAS,WAAA,CAAY,QAAwB,IAAA,EAAyB;AAC5E,EAAA,IAAI,WAAW,KAAA,EAAO;AACrB,IAAA,OAAO,EAAC;AAAA,EACT;AAEA,EAAA,MAAM,SAAA,GAAY;AAAA,IACjB,MAAA;AAAA,IACA,YAAA;AAAA,IACA,GAAI,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,CAAC,CAAA,KAAA,EAAQ,IAAI,CAAA,CAAA,EAAI,CAAA,KAAA,EAAQ,IAAI,CAAA,MAAA,CAAQ;AAAA,GACpE;AACA,EAAA,OAAO,UAAU,GAAA,CAAI,CAAC,aAAkB,IAAA,CAAA,OAAA,CAAQ,MAAA,EAAQ,QAAQ,CAAC,CAAA;AAClE;AAXgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA;AAqBT,SAAS,wBAAA,CACf,QACA,IAAA,EACW;AACX,EAAA,IAAI,WAAW,KAAA,EAAO;AACrB,IAAA,OAAO,EAAC;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACN,GAAI,SAAS,MAAA,GAAY,KAAK,CAAC,CAAA,UAAA,EAAa,IAAI,CAAA,CAAE,CAAA;AAAA,IAClD;AAAA,IACC,GAAA,CAAI,CAAC,aAAkB,IAAA,CAAA,OAAA,CAAQ,MAAA,EAAQ,QAAQ,CAAC,CAAA;AACnD;AAZgB,MAAA,CAAA,wBAAA,EAAA,0BAAA,CAAA;AA2BhB,eAAsB,OAAA,CACrB,QACA,IAAA,EACqB;AACrB,EAAA,IAAI,SAAS,OAAA,EAAS;AACrB,IAAA,MAAM,IAAI,KAAA;AAAA,MACT;AAAA,KACD;AAAA,EACD;AAEA,EAAA,MAAM,cAAA,GAAiB,WAAA,CAA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,GACD;AACD;AANS,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA","file":"local-env.mjs","sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { parse as parseDotEnv } from \"dotenv\";\nimport { expand } from \"dotenv-expand\";\n\nexport type LocalEnvValueSource =\n\t| { type: \"file\"; path: string }\n\t| { type: \"process\" };\n\nexport interface LoadedEnv {\n\tvalues: Record<string, string>;\n\tsources: Record<string, LocalEnvValueSource>;\n}\n\ninterface ParsedFile {\n\tpath: string;\n\tvalues: Record<string, string>;\n}\n\n/**\n * Returns the local `.env` candidates in increasing precedence order.\n *\n * @param envDir The resolved environment directory. `false` disables file\n * loading, matching Vite's `envDir` convention.\n * @param mode The optional mode used for mode-specific files.\n * @returns Absolute candidate paths in load order.\n */\nexport function getEnvPaths(envDir: string | false, mode?: string): string[] {\n\tif (envDir === false) {\n\t\treturn [];\n\t}\n\n\tconst filenames = [\n\t\t\".env\",\n\t\t\".env.local\",\n\t\t...(mode === undefined ? [] : [`.env.${mode}`, `.env.${mode}.local`]),\n\t];\n\treturn filenames.map((filename) => path.resolve(envDir, filename));\n}\n\n/**\n * Returns the `.dev.vars` candidates in decreasing selection priority.\n *\n * @param envDir The resolved environment directory. `false` disables file\n * loading, matching Vite's `envDir` convention.\n * @param mode The optional mode used to select `.dev.vars.<mode>`.\n * @returns Absolute candidate paths in selection order.\n */\nexport function getDevVarsCandidatePaths(\n\tenvDir: string | false,\n\tmode?: string\n): string[] {\n\tif (envDir === false) {\n\t\treturn [];\n\t}\n\n\treturn [\n\t\t...(mode === undefined ? [] : [`.dev.vars.${mode}`]),\n\t\t\".dev.vars\",\n\t].map((filename) => path.resolve(envDir, filename));\n}\n\n/**\n * Loads local `.env` files using Vite-compatible file precedence and\n * Wrangler-compatible parsing and expansion.\n *\n * Expansion is progressive: references can use process values and values\n * declared earlier in the merged environment, but not values declared later.\n * Loading has no process-global side effects.\n *\n * @param envDir The resolved environment directory. `false` disables file\n * loading, matching Vite's `envDir` convention.\n * @param mode The optional mode used for mode-specific files.\n * @returns Resolved values and metadata describing their sources.\n */\nexport async function loadEnv(\n\tenvDir: string | false,\n\tmode?: string\n): Promise<LoadedEnv> {\n\tif (mode === \"local\") {\n\t\tthrow new Error(\n\t\t\t'\"local\" cannot be used as a mode name because it conflicts with the .local postfix for .env files.'\n\t\t);\n\t}\n\n\tconst candidateFiles = getEnvPaths(envDir, mode);\n\tconst parsed: Record<string, string> = {};\n\tconst parsedSources: Record<string, LocalEnvValueSource> = {};\n\n\tfor (const candidate of candidateFiles) {\n\t\tconst loaded = await tryParseFile(candidate, parseDotEnv);\n\t\tif (loaded === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const [key, value] of Object.entries(loaded.values)) {\n\t\t\tparsed[key] = value;\n\t\t\tparsedSources[key] = { type: \"file\", path: loaded.path };\n\t\t}\n\t}\n\n\tconst processEnv = copyProcessEnv();\n\texpand({ parsed, processEnv: { ...processEnv } });\n\n\tconst values = { ...parsed };\n\tconst sources = { ...parsedSources };\n\n\tfor (const [key, value] of Object.entries(processEnv)) {\n\t\tvalues[key] = value;\n\t\tsources[key] = { type: \"process\" };\n\t}\n\n\treturn { values, sources };\n}\n\n/**\n * Loads the first existing `.dev.vars` candidate without merging it with other\n * files or process-environment values.\n *\n * @param envDir The resolved environment directory. `false` disables file\n * loading, matching Vite's `envDir` convention.\n * @param mode The optional mode used to select `.dev.vars.<mode>`.\n * @returns The selected `.dev.vars` values, or `undefined` when no candidate exists.\n */\nexport async function loadDevVars(\n\tenvDir: string | false,\n\tmode?: string\n): Promise<Record<string, string> | undefined> {\n\tconst candidateFiles = getDevVarsCandidatePaths(envDir, mode);\n\tfor (const candidate of candidateFiles) {\n\t\tconst loaded = await tryParseFile(candidate, parseDotEnv);\n\t\tif (loaded === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn loaded.values;\n\t}\n}\n\nasync function tryParseFile(\n\tfilePath: string,\n\tparse: (contents: string) => Record<string, string>\n): Promise<ParsedFile | undefined> {\n\ttry {\n\t\tconst stat = await fs.stat(filePath);\n\t\tif (!stat.isFile() && !stat.isFIFO()) {\n\t\t\treturn;\n\t\t}\n\t\treturn {\n\t\t\tpath: filePath,\n\t\t\tvalues: parse(await fs.readFile(filePath, \"utf8\")),\n\t\t};\n\t} catch (error) {\n\t\tif (isMissingFileError(error)) {\n\t\t\treturn;\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nfunction isMissingFileError(error: unknown): boolean {\n\treturn (\n\t\terror instanceof Error &&\n\t\t\"code\" in error &&\n\t\t(error.code === \"ENOENT\" || error.code === \"ENOTDIR\")\n\t);\n}\n\nfunction copyProcessEnv(): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(process.env).filter(\n\t\t\t(entry): entry is [string, string] => entry[1] !== undefined\n\t\t)\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"inputs":{"src/browser.ts":{"bytes":71,"imports":[],"format":"esm"},"src/compatibility-date.ts":{"bytes":5077,"imports":[],"format":"esm"},"src/compliance.ts":{"bytes":296,"imports":[],"format":"esm"},"src/docker-path.ts":{"bytes":362,"imports":[],"format":"esm"},"src/errors.ts":{"bytes":2592,"imports":[],"format":"esm"},"src/fs-helpers.ts":{"bytes":2580,"imports":[],"format":"esm"},"src/global-wrangler-config-path.ts":{"bytes":2050,"imports":[],"format":"esm"},"src/index.ts":{"bytes":5265,"imports":[],"format":"esm"},"src/local-env.ts":{"bytes":4877,"imports":[],"format":"esm"},"src/prometheus-metrics.ts":{"bytes":2014,"imports":[],"format":"esm"},"src/zod-format.ts":{"bytes":18038,"imports":[],"format":"esm"},"src/test-helpers/index.ts":{"bytes":536,"imports":[],"format":"esm"}},"outputs":{"dist/local-env.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7348},"dist/local-env.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"dotenv","kind":"import-statement","external":true},{"path":"dotenv-expand","kind":"import-statement","external":true}],"exports":["getDevVarsCandidatePaths","getEnvPaths","loadDevVars","loadEnv"],"entryPoint":"src/local-env.ts","inputs":{"src/local-env.ts":{"bytesInOutput":2871}},"bytes":3000},"dist/prometheus-metrics.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3056},"dist/prometheus-metrics.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"}],"exports":["MetricsRegistry"],"entryPoint":"src/prometheus-metrics.ts","inputs":{"src/prometheus-metrics.ts":{"bytesInOutput":1210}},"bytes":1289},"dist/zod-format.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":24717},"dist/zod-format.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"},{"path":"node:assert","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"kleur/colors","kind":"import-statement","external":true}],"exports":["_forceColour","formatZodError"],"entryPoint":"src/zod-format.ts","inputs":{"src/zod-format.ts":{"bytesInOutput":7064}},"bytes":7158},"dist/test-helpers/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":946},"dist/test-helpers/index.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"},{"path":"./mock","kind":"import-statement","external":true},{"path":"./email-header-validation","kind":"import-statement","external":true},{"path":"./normalize","kind":"import-statement","external":true},{"path":"./run-in-tmp","kind":"import-statement","external":true},{"path":"./seed","kind":"import-statement","external":true},{"path":"./wrangler-config","kind":"import-statement","external":true}],"exports":["EMAIL_HEADER_NAME_CASES","EMAIL_HEADER_VALUE_CASES","MANAGED_EMAIL_HEADER_CASES","createDeferred","mockConsoleMethods","mockCreateDate","mockEndDate","mockModifiedDate","mockQueuedDate","mockStartDate","normalizeString","readWranglerConfig","runInTempDir","seed","writeDeployRedirectConfig","writeRedirectedWranglerConfig","writeWranglerConfig"],"entryPoint":"src/test-helpers/index.ts","inputs":{"src/test-helpers/index.ts":{"bytesInOutput":546}},"bytes":952},"dist/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":206},"dist/browser.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"},{"path":"./construct-wrangler-config","kind":"import-statement","external":true}],"exports":["constructWranglerConfig"],"entryPoint":"src/browser.ts","inputs":{"src/browser.ts":{"bytesInOutput":71}},"bytes":140},"dist/compatibility-date.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6293},"dist/compatibility-date.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"},{"path":"node:assert","kind":"import-statement","external":true}],"exports":["NODEJS_COMPAT_DEFAULT_ON_DATE","NODEJS_COMPAT_V2_SWITCH_OVER_DATE","getTodaysCompatDate","isCompatDate","isNodejsCompatDefaultOn","resolveNodejsCompat","stripRedundantNodejsCompatFlags"],"entryPoint":"src/compatibility-date.ts","inputs":{"src/compatibility-date.ts":{"bytesInOutput":1918}},"bytes":2172},"dist/compliance.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":496},"dist/compliance.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"},{"path":"./environment-variables/misc-variables","kind":"import-statement","external":true}],"exports":["COMPLIANCE_REGION_CONFIG_PUBLIC","COMPLIANCE_REGION_CONFIG_UNKNOWN","getCloudflareApiBaseUrl","getCloudflareComplianceRegion","getComplianceRegionSubdomain"],"entryPoint":"src/compliance.ts","inputs":{"src/compliance.ts":{"bytesInOutput":220}},"bytes":425},"dist/docker-path.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":608},"dist/docker-path.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"},{"path":"./environment-variables/factory","kind":"import-statement","external":true}],"exports":["getDockerPath"],"entryPoint":"src/docker-path.ts","inputs":{"src/docker-path.ts":{"bytesInOutput":222}},"bytes":281},"dist/errors.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3791},"dist/errors.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"}],"exports":["CommandLineArgsError","DeprecationError","FatalError","JsonFriendlyFatalError","MissingConfigError","UserError","createFatalError"],"entryPoint":"src/errors.ts","inputs":{"src/errors.ts":{"bytesInOutput":1457}},"bytes":1656},"dist/fs-helpers.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3334},"dist/fs-helpers.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"},{"path":"node:fs","kind":"import-statement","external":true}],"exports":["isDirectory","removeDir","removeDirSync"],"entryPoint":"src/fs-helpers.ts","inputs":{"src/fs-helpers.ts":{"bytesInOutput":671}},"bytes":776},"dist/global-wrangler-config-path.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2748},"dist/global-wrangler-config-path.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"./fs-helpers","kind":"import-statement","external":true},{"path":"./xdg-app-paths","kind":"import-statement","external":true}],"exports":["getGlobalConfigPath","getGlobalWranglerCachePath"],"entryPoint":"src/global-wrangler-config-path.ts","inputs":{"src/global-wrangler-config-path.ts":{"bytesInOutput":759}},"bytes":872},"dist/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7349},"dist/index.mjs":{"imports":[{"path":"dist/chunk-PAWJFY3S.mjs","kind":"import-statement"},{"path":"./config/environment","kind":"import-statement","external":true},{"path":"./config/exports","kind":"import-statement","external":true},{"path":"./config/durable-object-exports","kind":"import-statement","external":true},{"path":"./config/containers","kind":"import-statement","external":true},{"path":"./config/config","kind":"import-statement","external":true},{"path":"./config","kind":"import-statement","external":true},{"path":"./config/patch-config","kind":"import-statement","external":true},{"path":"./worker","kind":"import-statement","external":true},{"path":"./types","kind":"import-statement","external":true},{"path":"./parse","kind":"import-statement","external":true},{"path":"./config/validation","kind":"import-statement","external":true},{"path":"./config/validation","kind":"import-statement","external":true},{"path":"./config/binding-local-support","kind":"import-statement","external":true},{"path":"./config/validation-pages","kind":"import-statement","external":true},{"path":"./config/diagnostics","kind":"import-statement","external":true},{"path":"./config/validation-helpers","kind":"import-statement","external":true},{"path":"./config/config-helpers","kind":"import-statement","external":true},{"path":"./errors","kind":"import-statement","external":true},{"path":"./assert-never","kind":"import-statement","external":true},{"path":"./package-resolution","kind":"import-statement","external":true},{"path":"./constants","kind":"import-statement","external":true},{"path":"./map-worker-metadata-bindings","kind":"import-statement","external":true},{"path":"./construct-wrangler-config","kind":"import-statement","external":true},{"path":"./binding-utils","kind":"import-statement","external":true},{"path":"./print-bindings","kind":"import-statement","external":true},{"path":"./environment-variables/factory","kind":"import-statement","external":true},{"path":"./environment-variables/misc-variables","kind":"import-statement","external":true},{"path":"./global-wrangler-config-path","kind":"import-statement","external":true},{"path":"./compatibility-date","kind":"import-statement","external":true},{"path":"./default-compat-date","kind":"import-statement","external":true},{"path":"./config/validation","kind":"import-statement","external":true},{"path":"./fs-helpers","kind":"import-statement","external":true},{"path":"./config-cache","kind":"import-statement","external":true},{"path":"./wrangler-tmp-dir","kind":"import-statement","external":true},{"path":"./prometheus-metrics","kind":"import-statement","external":true},{"path":"./tunnel","kind":"import-statement","external":true},{"path":"./cloudflared","kind":"import-statement","external":true},{"path":"./cfetch","kind":"import-statement","external":true},{"path":"./update-check","kind":"import-statement","external":true},{"path":"./logger","kind":"import-statement","external":true},{"path":"./is-interactive","kind":"import-statement","external":true},{"path":"./open-in-browser","kind":"import-statement","external":true},{"path":"./output","kind":"import-statement","external":true},{"path":"./retry","kind":"import-statement","external":true},{"path":"./format-time","kind":"import-statement","external":true},{"path":"./route-utils","kind":"import-statement","external":true},{"path":"./package-manager","kind":"import-statement","external":true},{"path":"./worker-name","kind":"import-statement","external":true},{"path":"./zod-format","kind":"import-statement","external":true},{"path":"./url-path","kind":"import-statement","external":true}],"exports":["APIError","BunPackageManager","DEFAULT_COMPAT_DATE","Diagnostics","LOGGER_LEVELS","MetricsRegistry","NODEJS_COMPAT_DEFAULT_ON_DATE","NODEJS_COMPAT_V2_SWITCH_OVER_DATE","NpmPackageManager","NubPackageManager","ParseError","PatchConfigError","PnpmPackageManager","YarnPackageManager","_forceColour","assertNever","bucketFormatMessage","checkWorkerNameValidity","clearOutputFilePath","configFileName","configFormat","constructWranglerConfig","convertConfigToBindings","createConfigCache","defaultWranglerConfig","experimental_patchConfig","experimental_readRawConfig","extractBindingsOfType","fetchLatestNpmVersion","findWranglerConfig","formatConfigSnippet","formatTime","formatZodError","friendlyBindingNames","getBindingLocalSupport","getBindingTypeFriendlyName","getBindings","getBooleanEnvironmentVariableFactory","getContainerDurableObjectClassNames","getContainerNameToClassNameMap","getDurableObjectExports","getEnvironmentVariableFactory","getGlobalConfigPath","getGlobalWranglerCachePath","getHostFromRoute","getHostFromUrl","getInstalledPackageVersion","getPackagePath","getTodaysCompatDate","getWorkerName","getWorkerNameFromProject","getWranglerHiddenDirPath","getWranglerTmpDir","getZoneFromRoute","hasDurableObjectExports","hasProperty","indexLocation","isCI","isCompatDate","isDirectory","isDockerfile","isInteractive","isNodejsCompatDefaultOn","isNonInteractiveOrCI","isOptionalProperty","isPackageInstalled","isPagesConfig","isRedirectedConfig","isRequiredProperty","isUnsafeBindingType","isValidR2BucketName","mapWorkerMetadataBindings","normalizeAndValidateConfig","openInBrowser","parseByteSize","parseHumanDuration","parseJSON","parseJSONC","parseNonHyphenedUuid","parsePackageJSON","parseTOML","partitionExports","printBindings","readFileSync","readFileSyncToBuffer","removeDir","removeDirSync","resolveContainerClassName","resolveNodejsCompat","resolveWranglerConfigPath","retryOnAPIFailure","searchLocation","spawnCloudflared","startTunnel","stripRedundantNodejsCompatFlags","sweepStaleWranglerTmpDirs","toUrlPath","toValidWorkerName","validateBindingRemoteSetting","validatePagesConfig","writeOutput"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":4017}},"bytes":6285},"dist/chunk-PAWJFY3S.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/chunk-PAWJFY3S.mjs":{"imports":[],"exports":["__name"],"inputs":{},"bytes":151}}}
1
+ {"inputs":{"src/default-compat-date.ts":{"bytes":953,"imports":[],"format":"esm"},"src/assert-never.ts":{"bytes":46,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/map-worker-metadata-bindings.ts":{"bytes":10882,"imports":[{"path":"src/assert-never.ts","kind":"import-statement","original":"./assert-never"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/construct-wrangler-config.ts":{"bytes":3833,"imports":[{"path":"src/default-compat-date.ts","kind":"import-statement","original":"./default-compat-date"},{"path":"src/map-worker-metadata-bindings.ts","kind":"import-statement","original":"./map-worker-metadata-bindings"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/browser.ts":{"bytes":71,"imports":[{"path":"src/construct-wrangler-config.ts","kind":"import-statement","original":"./construct-wrangler-config"}],"format":"esm"},"src/compatibility-date.ts":{"bytes":5077,"imports":[{"path":"node:assert","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/errors.ts":{"bytes":2592,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/fs-helpers.ts":{"bytes":2580,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/xdg-app-paths.ts":{"bytes":7028,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/global-wrangler-config-path.ts":{"bytes":2050,"imports":[{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/fs-helpers.ts","kind":"import-statement","original":"./fs-helpers"},{"path":"src/xdg-app-paths.ts","kind":"import-statement","original":"./xdg-app-paths"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/environment-variables/factory.ts":{"bytes":11642,"imports":[{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/docker-path.ts":{"bytes":362,"imports":[{"path":"src/environment-variables/factory.ts","kind":"import-statement","original":"./environment-variables/factory"}],"format":"esm"},"src/environment-variables/misc-variables.ts":{"bytes":15791,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"ts-dedent","kind":"import-statement","external":true},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"src/global-wrangler-config-path.ts","kind":"import-statement","original":"../global-wrangler-config-path"},{"path":"src/environment-variables/factory.ts","kind":"import-statement","original":"./factory"},{"path":"src/docker-path.ts","kind":"import-statement","original":"../docker-path"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/compliance.ts":{"bytes":296,"imports":[{"path":"src/environment-variables/misc-variables.ts","kind":"import-statement","original":"./environment-variables/misc-variables"}],"format":"esm"},"src/config/environment.ts":{"bytes":56770,"imports":[],"format":"esm"},"src/config/exports.ts":{"bytes":1134,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/config/durable-object-exports.ts":{"bytes":561,"imports":[{"path":"src/config/exports.ts","kind":"import-statement","original":"./exports"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/config/containers.ts":{"bytes":2372,"imports":[{"path":"src/config/durable-object-exports.ts","kind":"import-statement","original":"./durable-object-exports"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/config/config.ts":{"bytes":13480,"imports":[],"format":"esm"},"src/parse.ts":{"bytes":10880,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"jsonc-parser","kind":"import-statement","external":true},{"path":"smol-toml","kind":"import-statement","external":true},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/constants.ts":{"bytes":427,"imports":[],"format":"esm"},"src/config/config-helpers.ts":{"bytes":5252,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"empathic/find","kind":"import-statement","external":true},{"path":"ts-dedent","kind":"import-statement","external":true},{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"src/parse.ts","kind":"import-statement","original":"../parse"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/config/index.ts":{"bytes":3735,"imports":[{"path":"smol-toml","kind":"import-statement","external":true},{"path":"src/parse.ts","kind":"import-statement","original":"../parse"},{"path":"src/config/config-helpers.ts","kind":"import-statement","original":"./config-helpers"},{"path":"src/config/exports.ts","kind":"import-statement","original":"./exports"},{"path":"src/config/containers.ts","kind":"import-statement","original":"./containers"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/config/patch-config.ts":{"bytes":3360,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"jsonc-parser","kind":"import-statement","external":true},{"path":"smol-toml","kind":"import-statement","external":true},{"path":"src/parse.ts","kind":"import-statement","original":"../parse"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/worker.ts":{"bytes":11393,"imports":[],"format":"esm"},"src/types.ts":{"bytes":22024,"imports":[],"format":"esm"},"src/config/diagnostics.ts":{"bytes":2606,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/config/validation-helpers.ts":{"bytes":18384,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/config/validation.ts":{"bytes":195201,"imports":[{"path":"node:assert","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@cloudflare/workflows-shared/src/lib/validators","kind":"import-statement","external":true},{"path":"ts-dedent","kind":"import-statement","external":true},{"path":"src/environment-variables/misc-variables.ts","kind":"import-statement","original":"../environment-variables/misc-variables"},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"src/fs-helpers.ts","kind":"import-statement","original":"../fs-helpers"},{"path":"src/config/config-helpers.ts","kind":"import-statement","original":"./config-helpers"},{"path":"src/config/containers.ts","kind":"import-statement","original":"./containers"},{"path":"src/config/diagnostics.ts","kind":"import-statement","original":"./diagnostics"},{"path":"src/config/durable-object-exports.ts","kind":"import-statement","original":"./durable-object-exports"},{"path":"src/config/environment.ts","kind":"import-statement","original":"./environment"},{"path":"src/config/validation-helpers.ts","kind":"import-statement","original":"./validation-helpers"},{"path":"src/config/index.ts","kind":"import-statement","original":"."},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/config/binding-local-support.ts":{"bytes":5509,"imports":[{"path":"src/assert-never.ts","kind":"import-statement","original":"../assert-never"},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"src/config/validation.ts","kind":"import-statement","original":"./validation"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/config/validation-pages.ts":{"bytes":5938,"imports":[{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"src/config/config.ts","kind":"import-statement","original":"./config"},{"path":"src/config/diagnostics.ts","kind":"import-statement","original":"./diagnostics"},{"path":"src/config/validation-helpers.ts","kind":"import-statement","original":"./validation-helpers"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/package-resolution.ts":{"bytes":5071,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/parse.ts","kind":"import-statement","original":"./parse"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/binding-utils.ts":{"bytes":9956,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/print-bindings.ts":{"bytes":27834,"imports":[{"path":"node:util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"src/binding-utils.ts","kind":"import-statement","original":"./binding-utils"},{"path":"src/config/validation.ts","kind":"import-statement","original":"./config/validation"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/is-interactive.ts":{"bytes":3667,"imports":[{"path":"ci-info","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/config-cache.ts":{"bytes":4930,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"empathic/find","kind":"import-statement","external":true},{"path":"src/environment-variables/misc-variables.ts","kind":"import-statement","original":"./environment-variables/misc-variables"},{"path":"src/fs-helpers.ts","kind":"import-statement","original":"./fs-helpers"},{"path":"src/is-interactive.ts","kind":"import-statement","original":"./is-interactive"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/wrangler-tmp-dir.ts":{"bytes":2981,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"signal-exit","kind":"import-statement","external":true},{"path":"src/fs-helpers.ts","kind":"import-statement","original":"./fs-helpers"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/prometheus-metrics.ts":{"bytes":2014,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/cloudflared.ts":{"bytes":22279,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"command-exists","kind":"import-statement","external":true},{"path":"undici","kind":"import-statement","external":true},{"path":"src/environment-variables/misc-variables.ts","kind":"import-statement","original":"./environment-variables/misc-variables"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/fs-helpers.ts","kind":"import-statement","original":"./fs-helpers"},{"path":"src/global-wrangler-config-path.ts","kind":"import-statement","original":"./global-wrangler-config-path"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/tunnel.ts":{"bytes":8650,"imports":[{"path":"src/cloudflared.ts","kind":"import-statement","original":"./cloudflared"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/cfetch/errors.ts":{"bytes":1135,"imports":[{"path":"src/parse.ts","kind":"import-statement","original":"../parse"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/cfetch/index.ts":{"bytes":16333,"imports":[{"path":"node:assert","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"undici","kind":"import-statement","external":true},{"path":"src/environment-variables/misc-variables.ts","kind":"import-statement","original":"../environment-variables/misc-variables"},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"src/parse.ts","kind":"import-statement","original":"../parse"},{"path":"src/cfetch/errors.ts","kind":"import-statement","original":"./errors"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/update-check.ts":{"bytes":2303,"imports":[{"path":"node:timers/promises","kind":"import-statement","external":true},{"path":"update-check","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/logger.ts":{"bytes":670,"imports":[],"format":"esm"},"src/open-in-browser.ts":{"bytes":1788,"imports":[{"path":"open","kind":"dynamic-import","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/output.ts":{"bytes":7336,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/environment-variables/misc-variables.ts","kind":"import-statement","original":"./environment-variables/misc-variables"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/retry.ts":{"bytes":2150,"imports":[{"path":"node:timers/promises","kind":"import-statement","external":true},{"path":"src/parse.ts","kind":"import-statement","original":"./parse"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/format-time.ts":{"bytes":106,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/route-utils.ts":{"bytes":2919,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/package-manager.ts":{"bytes":1476,"imports":[],"format":"esm"},"src/worker-name.ts":{"bytes":4368,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"src/environment-variables/misc-variables.ts","kind":"import-statement","original":"./environment-variables/misc-variables"},{"path":"src/parse.ts","kind":"import-statement","original":"./parse"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/zod-format.ts":{"bytes":18038,"imports":[{"path":"node:assert","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"kleur/colors","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/url-path.ts":{"bytes":973,"imports":[{"path":"node:console","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":5265,"imports":[{"path":"src/config/environment.ts","kind":"import-statement","original":"./config/environment"},{"path":"src/config/exports.ts","kind":"import-statement","original":"./config/exports"},{"path":"src/config/durable-object-exports.ts","kind":"import-statement","original":"./config/durable-object-exports"},{"path":"src/config/containers.ts","kind":"import-statement","original":"./config/containers"},{"path":"src/config/config.ts","kind":"import-statement","original":"./config/config"},{"path":"src/config/index.ts","kind":"import-statement","original":"./config"},{"path":"src/config/patch-config.ts","kind":"import-statement","original":"./config/patch-config"},{"path":"src/worker.ts","kind":"import-statement","original":"./worker"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/parse.ts","kind":"import-statement","original":"./parse"},{"path":"src/config/validation.ts","kind":"import-statement","original":"./config/validation"},{"path":"src/config/validation.ts","kind":"import-statement","original":"./config/validation"},{"path":"src/config/binding-local-support.ts","kind":"import-statement","original":"./config/binding-local-support"},{"path":"src/config/validation-pages.ts","kind":"import-statement","original":"./config/validation-pages"},{"path":"src/config/diagnostics.ts","kind":"import-statement","original":"./config/diagnostics"},{"path":"src/config/validation-helpers.ts","kind":"import-statement","original":"./config/validation-helpers"},{"path":"src/config/config-helpers.ts","kind":"import-statement","original":"./config/config-helpers"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/assert-never.ts","kind":"import-statement","original":"./assert-never"},{"path":"src/package-resolution.ts","kind":"import-statement","original":"./package-resolution"},{"path":"src/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/map-worker-metadata-bindings.ts","kind":"import-statement","original":"./map-worker-metadata-bindings"},{"path":"src/construct-wrangler-config.ts","kind":"import-statement","original":"./construct-wrangler-config"},{"path":"src/binding-utils.ts","kind":"import-statement","original":"./binding-utils"},{"path":"src/print-bindings.ts","kind":"import-statement","original":"./print-bindings"},{"path":"src/environment-variables/factory.ts","kind":"import-statement","original":"./environment-variables/factory"},{"path":"src/environment-variables/misc-variables.ts","kind":"import-statement","original":"./environment-variables/misc-variables"},{"path":"src/global-wrangler-config-path.ts","kind":"import-statement","original":"./global-wrangler-config-path"},{"path":"src/compatibility-date.ts","kind":"import-statement","original":"./compatibility-date"},{"path":"src/default-compat-date.ts","kind":"import-statement","original":"./default-compat-date"},{"path":"src/config/validation.ts","kind":"import-statement","original":"./config/validation"},{"path":"src/fs-helpers.ts","kind":"import-statement","original":"./fs-helpers"},{"path":"src/config-cache.ts","kind":"import-statement","original":"./config-cache"},{"path":"src/wrangler-tmp-dir.ts","kind":"import-statement","original":"./wrangler-tmp-dir"},{"path":"src/prometheus-metrics.ts","kind":"import-statement","original":"./prometheus-metrics"},{"path":"src/tunnel.ts","kind":"import-statement","original":"./tunnel"},{"path":"src/cloudflared.ts","kind":"import-statement","original":"./cloudflared"},{"path":"src/cfetch/index.ts","kind":"import-statement","original":"./cfetch"},{"path":"src/update-check.ts","kind":"import-statement","original":"./update-check"},{"path":"src/logger.ts","kind":"import-statement","original":"./logger"},{"path":"src/is-interactive.ts","kind":"import-statement","original":"./is-interactive"},{"path":"src/open-in-browser.ts","kind":"import-statement","original":"./open-in-browser"},{"path":"src/output.ts","kind":"import-statement","original":"./output"},{"path":"src/retry.ts","kind":"import-statement","original":"./retry"},{"path":"src/format-time.ts","kind":"import-statement","original":"./format-time"},{"path":"src/route-utils.ts","kind":"import-statement","original":"./route-utils"},{"path":"src/package-manager.ts","kind":"import-statement","original":"./package-manager"},{"path":"src/worker-name.ts","kind":"import-statement","original":"./worker-name"},{"path":"src/zod-format.ts","kind":"import-statement","original":"./zod-format"},{"path":"src/url-path.ts","kind":"import-statement","original":"./url-path"}],"format":"esm"},"src/local-env.ts":{"bytes":4877,"imports":[{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"dotenv","kind":"import-statement","external":true},{"path":"dotenv-expand","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/test-helpers/normalize.ts":{"bytes":3782,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/test-helpers/mock.ts":{"bytes":2796,"imports":[{"path":"node:util","kind":"import-statement","external":true},{"path":"vitest","kind":"import-statement","external":true},{"path":"src/test-helpers/normalize.ts","kind":"import-statement","original":"./normalize"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/test-helpers/email-header-validation.ts":{"bytes":1026,"imports":[],"format":"esm"},"src/test-helpers/run-in-tmp.ts":{"bytes":1085,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"vitest","kind":"import-statement","external":true},{"path":"src/fs-helpers.ts","kind":"import-statement","original":"../fs-helpers"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/test-helpers/seed.ts":{"bytes":500,"imports":[{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/test-helpers/wrangler-config.ts":{"bytes":1835,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/config/index.ts","kind":"import-statement","original":"../config"},{"path":"src/constants.ts","kind":"import-statement","original":"../constants"},{"path":"src/parse.ts","kind":"import-statement","original":"../parse"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/test-helpers/index.ts":{"bytes":536,"imports":[{"path":"src/test-helpers/mock.ts","kind":"import-statement","original":"./mock"},{"path":"src/test-helpers/email-header-validation.ts","kind":"import-statement","original":"./email-header-validation"},{"path":"src/test-helpers/normalize.ts","kind":"import-statement","original":"./normalize"},{"path":"src/test-helpers/run-in-tmp.ts","kind":"import-statement","original":"./run-in-tmp"},{"path":"src/test-helpers/seed.ts","kind":"import-statement","original":"./seed"},{"path":"src/test-helpers/wrangler-config.ts","kind":"import-statement","original":"./wrangler-config"}],"format":"esm"}},"outputs":{"dist/local-env.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7341},"dist/local-env.mjs":{"imports":[{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"dotenv","kind":"import-statement","external":true},{"path":"dotenv-expand","kind":"import-statement","external":true}],"exports":["getDevVarsCandidatePaths","getEnvPaths","loadDevVars","loadEnv"],"entryPoint":"src/local-env.ts","inputs":{"src/local-env.ts":{"bytesInOutput":2874}},"bytes":3024},"dist/prometheus-metrics.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/prometheus-metrics.mjs":{"imports":[{"path":"dist/chunk-FEHWZI5W.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["MetricsRegistry"],"entryPoint":"src/prometheus-metrics.ts","inputs":{},"bytes":119},"dist/zod-format.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/zod-format.mjs":{"imports":[{"path":"dist/chunk-VTOON473.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["_forceColour","formatZodError"],"entryPoint":"src/zod-format.ts","inputs":{},"bytes":149},"dist/test-helpers/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":18855},"dist/test-helpers/index.mjs":{"imports":[{"path":"dist/chunk-W4SU7D4X.mjs","kind":"import-statement"},{"path":"dist/chunk-KAEJMITB.mjs","kind":"import-statement"},{"path":"dist/chunk-T6I7NOR4.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"},{"path":"node:util","kind":"import-statement","external":true},{"path":"vitest","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"vitest","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["EMAIL_HEADER_NAME_CASES","EMAIL_HEADER_VALUE_CASES","MANAGED_EMAIL_HEADER_CASES","createDeferred","mockConsoleMethods","mockCreateDate","mockEndDate","mockModifiedDate","mockQueuedDate","mockStartDate","normalizeString","readWranglerConfig","runInTempDir","seed","writeDeployRedirectConfig","writeRedirectedWranglerConfig","writeWranglerConfig"],"entryPoint":"src/test-helpers/index.ts","inputs":{"src/test-helpers/mock.ts":{"bytesInOutput":2636},"src/test-helpers/normalize.ts":{"bytesInOutput":3086},"src/test-helpers/index.ts":{"bytesInOutput":0},"src/test-helpers/email-header-validation.ts":{"bytesInOutput":993},"src/test-helpers/run-in-tmp.ts":{"bytesInOutput":837},"src/test-helpers/seed.ts":{"bytesInOutput":345},"src/test-helpers/wrangler-config.ts":{"bytesInOutput":1745}},"bytes":10510},"dist/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/browser.mjs":{"imports":[{"path":"dist/chunk-Z7Q743IF.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["constructWranglerConfig"],"entryPoint":"src/browser.ts","inputs":{"src/browser.ts":{"bytesInOutput":0}},"bytes":135},"dist/compatibility-date.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/compatibility-date.mjs":{"imports":[{"path":"dist/chunk-ZZBYXY7A.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["NODEJS_COMPAT_DEFAULT_ON_DATE","NODEJS_COMPAT_V2_SWITCH_OVER_DATE","getTodaysCompatDate","isCompatDate","isNodejsCompatDefaultOn","resolveNodejsCompat","stripRedundantNodejsCompatFlags"],"entryPoint":"src/compatibility-date.ts","inputs":{},"bytes":469},"dist/compliance.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/compliance.mjs":{"imports":[{"path":"dist/chunk-47QFQIPP.mjs","kind":"import-statement"},{"path":"dist/chunk-555CCIJE.mjs","kind":"import-statement"},{"path":"dist/chunk-KAEJMITB.mjs","kind":"import-statement"},{"path":"dist/chunk-YTEYGQOX.mjs","kind":"import-statement"},{"path":"dist/chunk-T6I7NOR4.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["COMPLIANCE_REGION_CONFIG_PUBLIC","COMPLIANCE_REGION_CONFIG_UNKNOWN","getCloudflareApiBaseUrl","getCloudflareComplianceRegion","getComplianceRegionSubdomain"],"entryPoint":"src/compliance.ts","inputs":{"src/compliance.ts":{"bytesInOutput":0}},"bytes":531},"dist/docker-path.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/docker-path.mjs":{"imports":[{"path":"dist/chunk-555CCIJE.mjs","kind":"import-statement"},{"path":"dist/chunk-KAEJMITB.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["getDockerPath"],"entryPoint":"src/docker-path.ts","inputs":{},"bytes":146},"dist/errors.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/errors.mjs":{"imports":[{"path":"dist/chunk-KAEJMITB.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["CommandLineArgsError","DeprecationError","FatalError","JsonFriendlyFatalError","MissingConfigError","UserError","createFatalError"],"entryPoint":"src/errors.ts","inputs":{},"bytes":359},"dist/fs-helpers.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/fs-helpers.mjs":{"imports":[{"path":"dist/chunk-T6I7NOR4.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["isDirectory","removeDir","removeDirSync"],"entryPoint":"src/fs-helpers.ts","inputs":{},"bytes":171},"dist/global-wrangler-config-path.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/global-wrangler-config-path.mjs":{"imports":[{"path":"dist/chunk-YTEYGQOX.mjs","kind":"import-statement"},{"path":"dist/chunk-T6I7NOR4.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["getGlobalConfigPath","getGlobalWranglerCachePath"],"entryPoint":"src/global-wrangler-config-path.ts","inputs":{},"bytes":218},"dist/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":662579},"dist/index.mjs":{"imports":[{"path":"dist/chunk-FEHWZI5W.mjs","kind":"import-statement"},{"path":"dist/chunk-VTOON473.mjs","kind":"import-statement"},{"path":"dist/chunk-W4SU7D4X.mjs","kind":"import-statement"},{"path":"dist/chunk-Z7Q743IF.mjs","kind":"import-statement"},{"path":"dist/chunk-ZZBYXY7A.mjs","kind":"import-statement"},{"path":"dist/chunk-47QFQIPP.mjs","kind":"import-statement"},{"path":"dist/chunk-555CCIJE.mjs","kind":"import-statement"},{"path":"dist/chunk-KAEJMITB.mjs","kind":"import-statement"},{"path":"dist/chunk-YTEYGQOX.mjs","kind":"import-statement"},{"path":"dist/chunk-T6I7NOR4.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"},{"path":"node:fs","kind":"import-statement","external":true},{"path":"jsonc-parser","kind":"import-statement","external":true},{"path":"smol-toml","kind":"import-statement","external":true},{"path":"node:assert","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@cloudflare/workflows-shared/src/lib/validators","kind":"import-statement","external":true},{"path":"ts-dedent","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"empathic/find","kind":"import-statement","external":true},{"path":"ci-info","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"signal-exit","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"command-exists","kind":"import-statement","external":true},{"path":"undici","kind":"import-statement","external":true},{"path":"node:assert","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"undici","kind":"import-statement","external":true},{"path":"node:timers/promises","kind":"import-statement","external":true},{"path":"update-check","kind":"import-statement","external":true},{"path":"open","kind":"dynamic-import","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:timers/promises","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:console","kind":"import-statement","external":true}],"exports":["APIError","ARTIFACTS_EVENT_TYPES","BunPackageManager","COMPLIANCE_REGION_CONFIG_PUBLIC","COMPLIANCE_REGION_CONFIG_UNKNOWN","CommandLineArgsError","DEFAULT_COMPAT_DATE","DeprecationError","Diagnostics","ENVIRONMENT_TAG_PREFIX","FatalError","INHERIT_SYMBOL","JSON_CONFIG_FORMATS","JsonFriendlyFatalError","LOGGER_LEVELS","MetricsRegistry","MissingConfigError","NODEJS_COMPAT_DEFAULT_ON_DATE","NODEJS_COMPAT_V2_SWITCH_OVER_DATE","NpmPackageManager","NubPackageManager","PATH_TO_DEPLOY_CONFIG","ParseError","PatchConfigError","PnpmPackageManager","SERVICE_TAG_PREFIX","UserError","YarnPackageManager","_forceColour","addAuthorizationHeader","assertNever","bucketFormatMessage","checkWorkerNameValidity","clearOutputFilePath","configFileName","configFormat","constructWranglerConfig","convertConfigToBindings","createConfigCache","createFatalError","defaultWranglerConfig","experimental_patchConfig","experimental_readRawConfig","extractAccountTag","extractBindingsOfType","extractWAFBlockRayId","fetchInternalBase","fetchKVGetValueBase","fetchLatestNpmVersion","fetchListResultBase","fetchResultBase","findWranglerConfig","formatConfigSnippet","formatTime","formatZodError","friendlyBindingNames","getBindingLocalSupport","getBindingTypeFriendlyName","getBindings","getBooleanEnvironmentVariableFactory","getBrowserRenderingHeadfulFromEnv","getBuildConditionsFromEnv","getBuildPlatformFromEnv","getC3CommandFromEnv","getCIGeneratePreviewAlias","getCIMatchTag","getCIOverrideName","getCIOverrideNetworkModeHost","getCfFetchEnabledFromEnv","getCfFetchPathFromEnv","getCloudflareApiBaseUrl","getCloudflareApiEnvironmentFromEnv","getCloudflareComplianceRegion","getCloudflareEnv","getCloudflareIncludeProcessEnvFromEnv","getCloudflareLoadDevVarsFromDotEnv","getCloudflaredPathFromEnv","getComplianceRegionSubdomain","getContainerDurableObjectClassNames","getContainerNameToClassNameMap","getD1ExtraLocationChoices","getDisableConfigWatching","getDockerPath","getDurableObjectExports","getEnvironmentVariableFactory","getGlobalConfigPath","getGlobalWranglerCachePath","getHostFromRoute","getHostFromUrl","getInstalledPackageVersion","getLocalExplorerEnabledFromEnv","getLocalObservabilityEnabledFromEnv","getNoSkillsUpdatePromptsFromEnv","getOpenNextDeployFromEnv","getOutputFileDirectoryFromEnv","getOutputFilePathFromEnv","getPackagePath","getRegistryPath","getSanitizeLogs","getSubdomainMixedStateCheckDisabled","getTodaysCompatDate","getTraceHeader","getWorkerName","getWorkerNameFromProject","getWorkersCIBranchName","getWranglerCacheDirFromEnv","getWranglerHiddenDirPath","getWranglerHideBanner","getWranglerSendErrorReportsFromEnv","getWranglerSendMetricsFromEnv","getWranglerTmpDir","getZoneFromRoute","hasCursor","hasDurableObjectExports","hasMorePages","hasProperty","indexLocation","isCI","isCompatDate","isDirectory","isDoNotTrackEnabled","isDockerfile","isInteractive","isNodejsCompatDefaultOn","isNonInteractiveOrCI","isOptionalProperty","isPackageInstalled","isPagesConfig","isRedirectedConfig","isRequiredProperty","isUnsafeBindingType","isValidR2BucketName","isWAFBlockResponse","mapWorkerMetadataBindings","maybeAddTraceHeader","normalizeAndValidateConfig","openInBrowser","parseByteSize","parseHumanDuration","parseJSON","parseJSONC","parseNonHyphenedUuid","parsePackageJSON","parseRetryAfterMs","parseRetryAfterValue","parseTOML","partitionExports","performApiFetchBase","printBindings","readFileSync","readFileSyncToBuffer","removeDir","removeDirSync","renderError","resolveContainerClassName","resolveNodejsCompat","resolveWranglerConfigPath","retryOnAPIFailure","searchLocation","spawnCloudflared","startTunnel","stripRedundantNodejsCompatFlags","sweepStaleWranglerTmpDirs","throwFetchError","toUrlPath","toValidWorkerName","truncate","validateBindingRemoteSetting","validatePagesConfig","writeOutput"],"entryPoint":"src/index.ts","inputs":{"src/config/environment.ts":{"bytesInOutput":321},"src/index.ts":{"bytesInOutput":50},"src/config/config.ts":{"bytesInOutput":3435},"src/config/patch-config.ts":{"bytesInOutput":1993},"src/config/validation.ts":{"bytesInOutput":181242},"src/config/diagnostics.ts":{"bytesInOutput":2250},"src/config/validation-helpers.ts":{"bytesInOutput":11509},"src/config/binding-local-support.ts":{"bytesInOutput":4278},"src/config/validation-pages.ts":{"bytesInOutput":4503},"src/package-resolution.ts":{"bytesInOutput":2218},"src/binding-utils.ts":{"bytesInOutput":9788},"src/print-bindings.ts":{"bytesInOutput":26862},"src/config-cache.ts":{"bytesInOutput":2934},"src/is-interactive.ts":{"bytesInOutput":573},"src/wrangler-tmp-dir.ts":{"bytesInOutput":1738},"src/cloudflared.ts":{"bytesInOutput":16977},"src/tunnel.ts":{"bytesInOutput":7965},"src/cfetch/index.ts":{"bytesInOutput":13046},"src/cfetch/errors.ts":{"bytesInOutput":624},"src/update-check.ts":{"bytesInOutput":843},"src/logger.ts":{"bytesInOutput":92},"src/open-in-browser.ts":{"bytesInOutput":944},"src/output.ts":{"bytesInOutput":1339},"src/retry.ts":{"bytesInOutput":1547},"src/format-time.ts":{"bytesInOutput":117},"src/route-utils.ts":{"bytesInOutput":1041},"src/package-manager.ts":{"bytesInOutput":555},"src/worker-name.ts":{"bytesInOutput":1959},"src/url-path.ts":{"bytesInOutput":273}},"bytes":308799},"dist/chunk-FEHWZI5W.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3063},"dist/chunk-FEHWZI5W.mjs":{"imports":[{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["MetricsRegistry"],"inputs":{"src/prometheus-metrics.ts":{"bytesInOutput":1217}},"bytes":1327},"dist/chunk-VTOON473.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":24719},"dist/chunk-VTOON473.mjs":{"imports":[{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"},{"path":"node:assert","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"kleur/colors","kind":"import-statement","external":true}],"exports":["_forceColour","formatZodError"],"inputs":{"src/zod-format.ts":{"bytesInOutput":7052}},"bytes":7169},"dist/chunk-W4SU7D4X.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":37717},"dist/chunk-W4SU7D4X.mjs":{"imports":[{"path":"dist/chunk-KAEJMITB.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"jsonc-parser","kind":"import-statement","external":true},{"path":"smol-toml","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"empathic/find","kind":"import-statement","external":true},{"path":"ts-dedent","kind":"import-statement","external":true},{"path":"smol-toml","kind":"import-statement","external":true}],"exports":["APIError","ENVIRONMENT_TAG_PREFIX","INHERIT_SYMBOL","JSON_CONFIG_FORMATS","PATH_TO_DEPLOY_CONFIG","ParseError","SERVICE_TAG_PREFIX","configFileName","configFormat","experimental_readRawConfig","findWranglerConfig","formatConfigSnippet","getContainerDurableObjectClassNames","getContainerNameToClassNameMap","getDurableObjectExports","hasDurableObjectExports","indexLocation","isRedirectedConfig","isRedirectedRawConfig","parseByteSize","parseHumanDuration","parseJSON","parseJSONC","parseNonHyphenedUuid","parsePackageJSON","parseTOML","partitionExports","readFileSync","readFileSyncToBuffer","resolveContainerClassName","resolveWranglerConfigPath","searchLocation"],"inputs":{"src/config/exports.ts":{"bytesInOutput":571},"src/config/durable-object-exports.ts":{"bytesInOutput":333},"src/config/containers.ts":{"bytesInOutput":1256},"src/parse.ts":{"bytesInOutput":8271},"src/constants.ts":{"bytesInOutput":245},"src/config/config-helpers.ts":{"bytesInOutput":3724},"src/config/index.ts":{"bytesInOutput":1716}},"bytes":17119},"dist/chunk-Z7Q743IF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":27467},"dist/chunk-Z7Q743IF.mjs":{"imports":[{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["DEFAULT_COMPAT_DATE","assertNever","constructWranglerConfig","mapWorkerMetadataBindings"],"inputs":{"src/default-compat-date.ts":{"bytesInOutput":40},"src/assert-never.ts":{"bytesInOutput":69},"src/map-worker-metadata-bindings.ts":{"bytesInOutput":11064},"src/construct-wrangler-config.ts":{"bytesInOutput":1635}},"bytes":13095},"dist/chunk-ZZBYXY7A.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6295},"dist/chunk-ZZBYXY7A.mjs":{"imports":[{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"},{"path":"node:assert","kind":"import-statement","external":true}],"exports":["NODEJS_COMPAT_DEFAULT_ON_DATE","NODEJS_COMPAT_V2_SWITCH_OVER_DATE","getTodaysCompatDate","isCompatDate","isNodejsCompatDefaultOn","resolveNodejsCompat","stripRedundantNodejsCompatFlags"],"inputs":{"src/compatibility-date.ts":{"bytesInOutput":1914}},"bytes":2199},"dist/chunk-47QFQIPP.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":19729},"dist/chunk-47QFQIPP.mjs":{"imports":[{"path":"dist/chunk-555CCIJE.mjs","kind":"import-statement"},{"path":"dist/chunk-KAEJMITB.mjs","kind":"import-statement"},{"path":"dist/chunk-YTEYGQOX.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"},{"path":"node:path","kind":"import-statement","external":true},{"path":"ts-dedent","kind":"import-statement","external":true}],"exports":["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"],"inputs":{"src/environment-variables/misc-variables.ts":{"bytesInOutput":6775}},"bytes":8231},"dist/chunk-555CCIJE.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14202},"dist/chunk-555CCIJE.mjs":{"imports":[{"path":"dist/chunk-KAEJMITB.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["getBooleanEnvironmentVariableFactory","getDockerPath","getEnvironmentVariableFactory"],"inputs":{"src/environment-variables/factory.ts":{"bytesInOutput":1924},"src/docker-path.ts":{"bytesInOutput":139}},"bytes":2330},"dist/chunk-KAEJMITB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3821},"dist/chunk-KAEJMITB.mjs":{"imports":[{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"}],"exports":["CommandLineArgsError","DeprecationError","FatalError","JsonFriendlyFatalError","MissingConfigError","UserError","createFatalError"],"inputs":{"src/errors.ts":{"bytesInOutput":1499}},"bytes":1717},"dist/chunk-YTEYGQOX.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12974},"dist/chunk-YTEYGQOX.mjs":{"imports":[{"path":"dist/chunk-T6I7NOR4.mjs","kind":"import-statement"},{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["getGlobalConfigPath","getGlobalWranglerCachePath"],"inputs":{"src/global-wrangler-config-path.ts":{"bytesInOutput":672},"src/xdg-app-paths.ts":{"bytesInOutput":3856}},"bytes":4799},"dist/chunk-T6I7NOR4.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3336},"dist/chunk-T6I7NOR4.mjs":{"imports":[{"path":"dist/chunk-CGILA3WO.mjs","kind":"import-statement"},{"path":"node:fs","kind":"import-statement","external":true}],"exports":["isDirectory","removeDir","removeDirSync"],"inputs":{"src/fs-helpers.ts":{"bytesInOutput":671}},"bytes":799},"dist/chunk-CGILA3WO.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/chunk-CGILA3WO.mjs":{"imports":[],"exports":["__name","__require"],"inputs":{},"bytes":529}}}
@@ -1,53 +1,4 @@
1
- import { __name } from './chunk-PAWJFY3S.mjs';
2
-
3
- class MetricsRegistry {
4
- static {
5
- __name(this, "MetricsRegistry");
6
- }
7
- counters = [];
8
- /**
9
- * Create and register a new counter metric.
10
- *
11
- * @param name - The metric name (e.g. "service_request_total")
12
- * @param help - A human-readable description of the metric
13
- * @returns A Counter that can be incremented
14
- */
15
- createCounter(name, help) {
16
- const entry = { name, help, value: 0 };
17
- this.counters.push(entry);
18
- return {
19
- inc: /* @__PURE__ */ __name(() => {
20
- entry.value++;
21
- }, "inc"),
22
- add: /* @__PURE__ */ __name((amount) => {
23
- if (amount < 0) {
24
- throw new Error("Counter value cannot decrease");
25
- }
26
- entry.value += amount;
27
- }, "add")
28
- };
29
- }
30
- /**
31
- * Serialize all registered metrics in Prometheus text exposition format.
32
- *
33
- * @see https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format
34
- */
35
- metrics() {
36
- return this.counters.map((c) => {
37
- let result = "";
38
- if (c.help.length > 0) {
39
- result += `# HELP ${c.name} ${c.help}
40
- `;
41
- }
42
- result += `# TYPE ${c.name} counter
43
- `;
44
- result += `${c.name} ${c.value}
45
- `;
46
- return result;
47
- }).join("");
48
- }
49
- }
50
-
51
- export { MetricsRegistry };
1
+ export { MetricsRegistry } from './chunk-FEHWZI5W.mjs';
2
+ import './chunk-CGILA3WO.mjs';
52
3
  //# sourceMappingURL=prometheus-metr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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":"prometheus-metrics.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":[],"names":[],"mappings":"","file":"prometheus-metrics.mjs"}