@powerlines/plugin-cloudflare 0.6.201 → 0.6.202

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 (118) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +0 -14
  2. package/dist/components/cloudflare-builtin.cjs +1 -8
  3. package/dist/components/cloudflare-builtin.mjs +1 -3
  4. package/dist/components/cloudflare-builtin.mjs.map +1 -1
  5. package/dist/components/env-builtin.cjs +1 -8
  6. package/dist/components/env-builtin.mjs +1 -3
  7. package/dist/components/env-builtin.mjs.map +1 -1
  8. package/dist/components/worker-entry.cjs +1 -8
  9. package/dist/components/worker-entry.mjs +1 -3
  10. package/dist/components/worker-entry.mjs.map +1 -1
  11. package/dist/helpers/wrangler.cjs +1 -9
  12. package/dist/helpers/wrangler.mjs +1 -3
  13. package/dist/helpers/wrangler.mjs.map +1 -1
  14. package/dist/types/wrangler.cjs +1 -15
  15. package/dist/types/wrangler.mjs +1 -10
  16. package/dist/types/wrangler.mjs.map +1 -1
  17. package/package.json +10 -107
  18. package/dist/_virtual/_rolldown/runtime.mjs +0 -18
  19. package/dist/components/cloudflare-builtin.test.cjs +0 -16
  20. package/dist/components/cloudflare-builtin.test.d.cts +0 -1
  21. package/dist/components/cloudflare-builtin.test.d.mts +0 -1
  22. package/dist/components/cloudflare-builtin.test.mjs +0 -18
  23. package/dist/components/cloudflare-builtin.test.mjs.map +0 -1
  24. package/dist/components/env-builtin.test.cjs +0 -16
  25. package/dist/components/env-builtin.test.d.cts +0 -1
  26. package/dist/components/env-builtin.test.d.mts +0 -1
  27. package/dist/components/env-builtin.test.mjs +0 -18
  28. package/dist/components/env-builtin.test.mjs.map +0 -1
  29. package/dist/components/worker-entry.test.cjs +0 -16
  30. package/dist/components/worker-entry.test.d.cts +0 -1
  31. package/dist/components/worker-entry.test.d.mts +0 -1
  32. package/dist/components/worker-entry.test.mjs +0 -18
  33. package/dist/components/worker-entry.test.mjs.map +0 -1
  34. package/dist/helpers/constants.test.cjs +0 -18
  35. package/dist/helpers/constants.test.d.cts +0 -1
  36. package/dist/helpers/constants.test.d.mts +0 -1
  37. package/dist/helpers/constants.test.mjs +0 -20
  38. package/dist/helpers/constants.test.mjs.map +0 -1
  39. package/dist/helpers/wrangler.test.cjs +0 -16
  40. package/dist/helpers/wrangler.test.d.cts +0 -1
  41. package/dist/helpers/wrangler.test.d.mts +0 -1
  42. package/dist/helpers/wrangler.test.mjs +0 -18
  43. package/dist/helpers/wrangler.test.mjs.map +0 -1
  44. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +0 -78
  45. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -78
  46. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +0 -1
  47. package/dist/node_modules/.pnpm/@vitest_expect@4.1.7/node_modules/@vitest/expect/dist/index.cjs +0 -1487
  48. package/dist/node_modules/.pnpm/@vitest_expect@4.1.7/node_modules/@vitest/expect/dist/index.mjs +0 -1473
  49. package/dist/node_modules/.pnpm/@vitest_expect@4.1.7/node_modules/@vitest/expect/dist/index.mjs.map +0 -1
  50. package/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.7/node_modules/@vitest/pretty-format/dist/index.cjs +0 -889
  51. package/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.7/node_modules/@vitest/pretty-format/dist/index.mjs +0 -888
  52. package/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.7/node_modules/@vitest/pretty-format/dist/index.mjs.map +0 -1
  53. package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/chunk-artifact.cjs +0 -1614
  54. package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/chunk-artifact.mjs +0 -1594
  55. package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/chunk-artifact.mjs.map +0 -1
  56. package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/index.cjs +0 -1
  57. package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/index.mjs +0 -3
  58. package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/utils.cjs +0 -1
  59. package/dist/node_modules/.pnpm/@vitest_runner@4.1.7/node_modules/@vitest/runner/dist/utils.mjs +0 -3
  60. package/dist/node_modules/.pnpm/@vitest_snapshot@4.1.7/node_modules/@vitest/snapshot/dist/index.cjs +0 -923
  61. package/dist/node_modules/.pnpm/@vitest_snapshot@4.1.7/node_modules/@vitest/snapshot/dist/index.mjs +0 -922
  62. package/dist/node_modules/.pnpm/@vitest_snapshot@4.1.7/node_modules/@vitest/snapshot/dist/index.mjs.map +0 -1
  63. package/dist/node_modules/.pnpm/@vitest_spy@4.1.7/node_modules/@vitest/spy/dist/index.cjs +0 -391
  64. package/dist/node_modules/.pnpm/@vitest_spy@4.1.7/node_modules/@vitest/spy/dist/index.mjs +0 -386
  65. package/dist/node_modules/.pnpm/@vitest_spy@4.1.7/node_modules/@vitest/spy/dist/index.mjs.map +0 -1
  66. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.cjs +0 -82
  67. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs +0 -82
  68. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs.map +0 -1
  69. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/diff.cjs +0 -1358
  70. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/diff.mjs +0 -1357
  71. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/diff.mjs.map +0 -1
  72. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/display.cjs +0 -561
  73. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/display.mjs +0 -559
  74. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/display.mjs.map +0 -1
  75. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/error.cjs +0 -37
  76. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/error.mjs +0 -38
  77. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/error.mjs.map +0 -1
  78. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/helpers.cjs +0 -197
  79. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/helpers.mjs +0 -181
  80. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/helpers.mjs.map +0 -1
  81. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/offset.cjs +0 -29
  82. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/offset.mjs +0 -27
  83. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/offset.mjs.map +0 -1
  84. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/serialize.cjs +0 -77
  85. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/serialize.mjs +0 -77
  86. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/serialize.mjs.map +0 -1
  87. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/source-map.cjs +0 -374
  88. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/source-map.mjs +0 -374
  89. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/source-map.mjs.map +0 -1
  90. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/timers.cjs +0 -38
  91. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/timers.mjs +0 -37
  92. package/dist/node_modules/.pnpm/@vitest_utils@4.1.7/node_modules/@vitest/utils/dist/timers.mjs.map +0 -1
  93. package/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.cjs +0 -2978
  94. package/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.mjs +0 -2973
  95. package/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.mjs.map +0 -1
  96. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.cjs +0 -939
  97. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +0 -940
  98. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs.map +0 -1
  99. package/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.cjs +0 -87
  100. package/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.mjs +0 -87
  101. package/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.mjs.map +0 -1
  102. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.cjs +0 -6
  103. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs +0 -6
  104. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs.map +0 -1
  105. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/rpc.MzXet3jl.cjs +0 -54
  106. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs +0 -52
  107. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/rpc.MzXet3jl.mjs.map +0 -1
  108. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/test.DNmyFkvJ.cjs +0 -2696
  109. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs +0 -2697
  110. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/test.DNmyFkvJ.mjs.map +0 -1
  111. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.cjs +0 -47
  112. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs +0 -45
  113. package/dist/node_modules/.pnpm/vitest@4.1.7_@opentelemetry_api@1.9.1_@types_node@25.9.1_@vitest_coverage-v8@4.1.7_vite_34dd47607c0af5e5ae7f1b2f95fc48c3/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.mjs.map +0 -1
  114. package/dist/types/wrangler.test.cjs +0 -16
  115. package/dist/types/wrangler.test.d.cts +0 -1
  116. package/dist/types/wrangler.test.d.mts +0 -1
  117. package/dist/types/wrangler.test.mjs +0 -18
  118. package/dist/types/wrangler.test.mjs.map +0 -1
@@ -5,19 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __exportAll = (all, no_symbols) => {
9
- let target = {};
10
- for (var name in all) {
11
- __defProp(target, name, {
12
- get: all[name],
13
- enumerable: true
14
- });
15
- }
16
- if (!no_symbols) {
17
- __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- }
19
- return target;
20
- };
21
8
  var __copyProps = (to, from, except, desc) => {
22
9
  if (from && typeof from === "object" || typeof from === "function") {
23
10
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -39,5 +26,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
39
26
 
40
27
  //#endregion
41
28
 
42
- exports.__exportAll = __exportAll;
43
29
  exports.__toESM = __toESM;
@@ -11,7 +11,6 @@ let _powerlines_plugin_alloy_typescript_components_interface_declaration = requi
11
11
  let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
12
12
 
13
13
  //#region src/components/cloudflare-builtin.tsx
14
- var cloudflare_builtin_exports = /* @__PURE__ */ require_runtime.__exportAll({ CloudflareBuiltin: () => CloudflareBuiltin });
15
14
  /**
16
15
  * Generates the Cloudflare environment configuration module for the Powerlines project.
17
16
  */
@@ -915,10 +914,4 @@ return context as CloudflareTestContext<Env>; `
915
914
  }
916
915
 
917
916
  //#endregion
918
- exports.CloudflareBuiltin = CloudflareBuiltin;
919
- Object.defineProperty(exports, 'cloudflare_builtin_exports', {
920
- enumerable: true,
921
- get: function () {
922
- return cloudflare_builtin_exports;
923
- }
924
- });
917
+ exports.CloudflareBuiltin = CloudflareBuiltin;
@@ -1,4 +1,3 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
1
  import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
3
2
  import { Show, code, splitProps } from "@alloy-js/core";
4
3
  import defu from "defu";
@@ -9,7 +8,6 @@ import { InterfaceDeclaration, InterfaceMember } from "@powerlines/plugin-alloy/
9
8
  import { TSDoc, TSDocParam, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
10
9
 
11
10
  //#region src/components/cloudflare-builtin.tsx
12
- var cloudflare_builtin_exports = /* @__PURE__ */ __exportAll({ CloudflareBuiltin: () => CloudflareBuiltin });
13
11
  /**
14
12
  * Generates the Cloudflare environment configuration module for the Powerlines project.
15
13
  */
@@ -913,5 +911,5 @@ return context as CloudflareTestContext<Env>; `
913
911
  }
914
912
 
915
913
  //#endregion
916
- export { CloudflareBuiltin, cloudflare_builtin_exports };
914
+ export { CloudflareBuiltin };
917
915
  //# sourceMappingURL=cloudflare-builtin.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloudflare-builtin.mjs","names":[],"sources":["../../src/components/cloudflare-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport { FunctionDeclaration, VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n InterfaceDeclaration,\n InterfaceMember\n} from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport type CloudflareBuiltinProps = Partial<BuiltinFileProps> &\n Omit<BuiltinFileProps, \"id\" | \"description\">;\n\n/**\n * Generates the Cloudflare environment configuration module for the Powerlines project.\n */\nexport function CloudflareBuiltin(props: CloudflareBuiltinProps) {\n const [{ imports, children }, rest] = splitProps(props, [\n \"imports\",\n \"children\"\n ]);\n\n return (\n <BuiltinFile\n id=\"cloudflare\"\n description=\"A set of helpful runtime utilities for integrating Cloudflare services.\"\n {...rest}\n imports={defu(\n {\n \"node:async_hooks\": [\"AsyncLocalStorage\"],\n \"@cloudflare/workers-types\": [\n { name: \"Request\", type: true },\n { name: \"Response\", type: true },\n { name: \"ExecutionContext\", type: true },\n { name: \"IncomingRequestCfProperties\", type: true },\n { name: \"ScheduledController\", type: true },\n { name: \"ForwardableEmailMessage\", type: true },\n { name: \"MessageBatch\", type: true },\n { name: \"TailStream\", type: true },\n { name: \"TraceItem\", type: true },\n { name: \"TailStream.TailEvent\", type: true },\n { name: \"TailStream.Onset\", type: true },\n { name: \"TailStream.TailEventHandlerType\", type: true }\n ]\n },\n imports ?? {}\n )}>\n <VarDeclaration\n const\n name=\"globalContextStorage\"\n initializer={code`globalThis as unknown as Record<PropertyKey, unknown>; `}\n />\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareFetchContext\"\n typeParameters={[\n { name: \"Env\", default: \"CloudflareBindings\" },\n { name: \"CfHostMetadata\", default: \"unknown\" }\n ]}\n doc=\"An interface representing the runtime context for Cloudflare operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"request\"\n type=\"Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>\"\n doc=\"The incoming Cloudflare request.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the incoming request.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_FETCH_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-fetch\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"fetchContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare fetch context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_FETCH_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareFetchContext>()) as AsyncLocalStorage<CloudflareFetchContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare fetch context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare fetch context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getFetchContext\"\n typeParameters={[\n { name: \"Env\", default: \"CloudflareBindings\" },\n { name: \"CfHostMetadata\", default: \"unknown\" }\n ]}\n parameters={[]}\n returnType=\"CloudflareFetchContext<Env, CfHostMetadata>\">\n {code`const context = fetchContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare fetch context is not available. Ensure that you are calling this function within the scope of a Cloudflare fetch request.\");\n}\nreturn context as CloudflareFetchContext<Env, CfHostMetadata>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare fetch context. This is typically used to set up the context for handling a Cloudflare fetch request, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getFetchContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare fetch context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withFetchContext\"\n typeParameters={[\n { name: \"Env\", default: \"CloudflareBindings\" },\n { name: \"CfHostMetadata\", default: \"unknown\" }\n ]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareFetchContext<Env, CfHostMetadata>\"\n },\n {\n name: \"callback\",\n type: \"(request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext) => Promise<Response>\"\n }\n ]}\n returnType=\"Promise<Response>\">\n {code`return fetchContextStorage.run(context, () => callback(context.request, context.env, context.ctx)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareScheduledContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the runtime context for Cloudflare scheduled operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"controller\"\n type=\"ScheduledController\"\n doc=\"The Cloudflare scheduled controller for the scheduled operation.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the scheduled operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_SCHEDULED_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-scheduled\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"scheduledContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare scheduled runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_SCHEDULED_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareScheduledContext>()) as AsyncLocalStorage<CloudflareScheduledContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare scheduled runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare scheduled runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getScheduledContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareScheduledContext<Env>\">\n {code`const context = scheduledContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare scheduled context is not available. Ensure that you are calling this function within the scope of a Cloudflare scheduled operation.\");\n}\nreturn context as CloudflareScheduledContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare scheduled context. This is typically used to set up the context for handling a Cloudflare scheduled operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getScheduledContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare scheduled context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withScheduledContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareScheduledContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareScheduledContext<Env>) => Promise<void>\"\n }\n ]}\n returnType=\"Promise<void>\">\n {code`return scheduledContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareEmailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the runtime context for Cloudflare email operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"message\"\n type=\"ForwardableEmailMessage\"\n doc=\"The Cloudflare email instance for the email operation.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the email operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_EMAIL_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-email\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"emailContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare email runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_EMAIL_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareEmailContext>()) as AsyncLocalStorage<CloudflareEmailContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare email runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare email runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getEmailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareEmailContext<Env>\">\n {code`const context = emailContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare email context is not available. Ensure that you are calling this function within the scope of a Cloudflare email operation.\");\n}\nreturn context as CloudflareEmailContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare email context. This is typically used to set up the context for handling a Cloudflare email operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getEmailContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare email context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`A promise that resolves with the result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withEmailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareEmailContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareEmailContext<Env>) => Promise<void>\"\n }\n ]}\n returnType=\"Promise<void>\">\n {code`return emailContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareQueueContext\"\n typeParameters={[\n { name: \"Message\", default: \"unknown\" },\n { name: \"Env\", default: \"CloudflareBindings\" }\n ]}\n doc=\"An interface representing the runtime context for Cloudflare queue operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"batch\"\n type=\"MessageBatch<Message>\"\n doc=\"The Cloudflare queue event instance for the queue operation.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the queue operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_QUEUE_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-queue\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"queueContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare queue runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_QUEUE_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareQueueContext>()) as AsyncLocalStorage<CloudflareQueueContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare queue runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare queue runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getQueueContext\"\n typeParameters={[\n { name: \"Message\", default: \"unknown\" },\n { name: \"Env\", default: \"CloudflareBindings\" }\n ]}\n parameters={[]}\n returnType=\"CloudflareQueueContext<Message, Env>\">\n {code`const context = queueContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare queue context is not available. Ensure that you are calling this function within the scope of a Cloudflare queue operation.\");\n}\nreturn context as CloudflareQueueContext<Message, Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare queue context. This is typically used to set up the context for handling a Cloudflare queue operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getQueueContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare queue context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withQueueContext\"\n typeParameters={[\n { name: \"Message\", default: \"unknown\" },\n { name: \"Env\", default: \"CloudflareBindings\" }\n ]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareQueueContext<Message, Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareQueueContext<Message, Env>) => Promise<void>\"\n }\n ]}\n returnType=\"Promise<void>\">\n {code`return queueContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareTailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the tail context for Cloudflare tail operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"events\"\n type=\"TraceItem[]\"\n doc=\"An array of trace items representing the events in the Cloudflare tail context.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the tail operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_TAIL_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-tail\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"tailContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare tail runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_TAIL_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTailContext>()) as AsyncLocalStorage<CloudflareTailContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare tail runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare tail runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getTailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareTailContext<Env>\">\n {code`const context = tailContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare tail context is not available. Ensure that you are calling this function within the scope of a Cloudflare tail operation.\");\n}\nreturn context as CloudflareTailContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare tail context. This is typically used to set up the context for handling a Cloudflare tail operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTailContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare tail context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withTailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareTailContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareTailContext<Env>) => Promise<void>\"\n }\n ]}\n returnType=\"T\">\n {code`return tailContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareTailStreamContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the tail context for Cloudflare tail stream operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"event\"\n type=\"TailStream.TailEvent<TailStream.Onset>\"\n doc=\"The tail event associated with the Cloudflare tail stream context.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the tail stream operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_TAIL_STREAM_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-tail-stream\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"tailStreamContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare tail stream runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_TAIL_STREAM_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTailStreamContext>()) as AsyncLocalStorage<CloudflareTailStreamContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare tail stream runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare tail stream runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getTailStreamContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareTailStreamContext<Env>\">\n {code`const context = tailStreamContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare tail stream context is not available. Ensure that you are calling this function within the scope of a Cloudflare tail stream operation.\");\n}\nreturn context as CloudflareTailStreamContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare tail stream context. This is typically used to set up the context for handling a Cloudflare tail stream operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTailStreamContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare tail stream context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withTailStreamContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareTailStreamContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareTailStreamContext<Env>) => Promise<TailStream.TailEventHandlerType>\"\n }\n ]}\n returnType=\"Promise<TailStream.TailEventHandlerType>\">\n {code`return tailStreamContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareTraceContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the trace context for Cloudflare trace operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"traces\"\n type=\"TraceItem[]\"\n doc=\"An array of trace items associated with the Cloudflare trace context.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the trace operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_TRACE_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-trace\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"traceContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare trace runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_TRACE_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTraceContext>()) as AsyncLocalStorage<CloudflareTraceContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare trace runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare trace runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getTraceContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareTraceContext<Env>\">\n {code`const context = traceContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare trace context is not available. Ensure that you are calling this function within the scope of a Cloudflare trace operation.\");\n}\nreturn context as CloudflareTraceContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare trace context. This is typically used to set up the context for handling a Cloudflare trace operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTraceContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare trace context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withTraceContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareTraceContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareTraceContext<Env>) => Promise<void>\"\n }\n ]}\n returnType=\"Promise<void>\">\n {code`return traceContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareTestContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the test context for Cloudflare trace operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"controller\"\n type=\"TestController\"\n doc=\"The test controller associated with the Cloudflare test context.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the test operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_TEST_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-test\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"testContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare test runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_TEST_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTestContext>()) as AsyncLocalStorage<CloudflareTestContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare test runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare test runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getTestContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareTestContext<Env>\">\n {code`const context = testContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare test context is not available. Ensure that you are calling this function within the scope of a Cloudflare test operation.\");\n}\nreturn context as CloudflareTestContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare test context. This is typically used to set up the context for handling a Cloudflare test operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTestContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare test context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withTestContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareTestContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareTestContext<Env>) => Promise<void>\"\n }\n ]}\n returnType=\"Promise<void>\">\n {code`return testContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6BA,SAAO,kBAAA,OAAA;CACL,MAAK,CAAA,EACL,SACA,YACA,QAAO,WAAW,OAAO,CAAK,WAAW,UAAC,CAAU;CACtD,OAAO,gBAAgB,aAAA,WAAA;;EAEvB,aAAY;CACV,GAAA,MAAK;;GAEL,OAAA,KAAA;IACC,oBAAyB,CAAA,mBAAY;IACtC,6BAAA;KAAA;MACK,MAAS;MACN,MAAC;KACN;KAAA;MACA,MAAQ;MACT,MAAA;;;MAEK,MAAA;MACJ,MAAA;KACG;KAAE;MACJ,MAAA;MACI,MAAI;KACR;KAAA;MACE,MAAA;MACE,MAAM;KACR;KAAG;MACD,MAAI;MACJ,MAAI;KACN;KAAG;MACD,MAAI;MACJ,MAAI;KACN;KAAG;MACD,MAAI;MACJ,MAAI;KACN;KAAG;MACD,MAAI;MACJ,MAAI;KACN;KAAG;MACD,MAAA;MACD,MAAA;KACD;KAAA;MACA,MAAA;MACD,MAAA;KACC;KAAA;MACA,MAAM;MACN,MAAA;KACD;IAAA;GACD,GAAC,WAAS,CAAA,CAAA;EACZ;EACA,IAAG,WAAA;GACD,OAAE;IAAA,gBAAA,gBAAA;KACA,SAAM;KACN,MAAA;KACA,aAAW,IAAM;IACnB,CAAC;IAAG,gBAAS,SAAiB,CAAA,CAAA;IAAA,gBAAmB,SAAA,CAAA,CAAA;IAAA,gBAAA,sBAAA;KAC/C,UAAC;KACD,MAAK;KACL,gBAAC,CAAA;MACC,MAAM;MACN,SAAM;KACR,GAAE;MACD,MAAA;MACA,SAAA;KACD,CAAC;KAC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,gBAAA,cAAA,EACK,UAAA,IAAA,uCACL,CAAA;MAAK;KACJ;IACF,CAAC;IAAC,gBAAK,qBAAA;KACN,UAAA;KACC,MAAA;KACA,gBAAM,CAAA;MACN,MAAA;MACA,SAAW;KACX,CAAA;KACA,YAAY,CAAA;MACf,MAAS;MACN,MAAI;KACZ,GAAA;MACO,MAAQ;MACP,MAAA;KACD,CAAA;KACA,YAAa;KACZ,UAAC,IAAW;IACd,CAAC;IAAE,gBAAiB,SAAW,CAAA,CAAA;IAAK,gBAAgB,SAAQ,CAAA,CAAA;IAAO,gBAAiB,sBAAqB;KACvG,UAAC;KACD,MAAK;KACN,gBAAA,CAAA;MACC,MAAA;MACA,SAAM;KACN,CAAA;KACA,KAAA;KACA,IAAE,WAAA;MACA,OAAO;OAAC,gBAAS,iBAAA;QACf,MAAM;QACP,MAAA;QACD,KAAA;OACA,CAAC;OAAC,gBAAgB,iBAAA;QAChB,MAAM;QACR,MAAA;QACD,KAAA;OACD,CAAA;OAAA,gBAAwB,iBAAE;QACzB,MAAK;QACN,MAAA;QACD,KAAS;OACT,CAAA;MAAA;KACA;IACD,CAAA;IAAA,gBAAW,OAAA,CAAA,CAAA;IAAA,gBAAA,gBAAA;KACd,SAAA;KACH,MAAA"}
1
+ {"version":3,"file":"cloudflare-builtin.mjs","names":[],"sources":["../../src/components/cloudflare-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport { FunctionDeclaration, VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n InterfaceDeclaration,\n InterfaceMember\n} from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport type CloudflareBuiltinProps = Partial<BuiltinFileProps> &\n Omit<BuiltinFileProps, \"id\" | \"description\">;\n\n/**\n * Generates the Cloudflare environment configuration module for the Powerlines project.\n */\nexport function CloudflareBuiltin(props: CloudflareBuiltinProps) {\n const [{ imports, children }, rest] = splitProps(props, [\n \"imports\",\n \"children\"\n ]);\n\n return (\n <BuiltinFile\n id=\"cloudflare\"\n description=\"A set of helpful runtime utilities for integrating Cloudflare services.\"\n {...rest}\n imports={defu(\n {\n \"node:async_hooks\": [\"AsyncLocalStorage\"],\n \"@cloudflare/workers-types\": [\n { name: \"Request\", type: true },\n { name: \"Response\", type: true },\n { name: \"ExecutionContext\", type: true },\n { name: \"IncomingRequestCfProperties\", type: true },\n { name: \"ScheduledController\", type: true },\n { name: \"ForwardableEmailMessage\", type: true },\n { name: \"MessageBatch\", type: true },\n { name: \"TailStream\", type: true },\n { name: \"TraceItem\", type: true },\n { name: \"TailStream.TailEvent\", type: true },\n { name: \"TailStream.Onset\", type: true },\n { name: \"TailStream.TailEventHandlerType\", type: true }\n ]\n },\n imports ?? {}\n )}>\n <VarDeclaration\n const\n name=\"globalContextStorage\"\n initializer={code`globalThis as unknown as Record<PropertyKey, unknown>; `}\n />\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareFetchContext\"\n typeParameters={[\n { name: \"Env\", default: \"CloudflareBindings\" },\n { name: \"CfHostMetadata\", default: \"unknown\" }\n ]}\n doc=\"An interface representing the runtime context for Cloudflare operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"request\"\n type=\"Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>\"\n doc=\"The incoming Cloudflare request.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the incoming request.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_FETCH_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-fetch\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"fetchContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare fetch context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_FETCH_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareFetchContext>()) as AsyncLocalStorage<CloudflareFetchContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare fetch context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare fetch context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getFetchContext\"\n typeParameters={[\n { name: \"Env\", default: \"CloudflareBindings\" },\n { name: \"CfHostMetadata\", default: \"unknown\" }\n ]}\n parameters={[]}\n returnType=\"CloudflareFetchContext<Env, CfHostMetadata>\">\n {code`const context = fetchContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare fetch context is not available. Ensure that you are calling this function within the scope of a Cloudflare fetch request.\");\n}\nreturn context as CloudflareFetchContext<Env, CfHostMetadata>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare fetch context. This is typically used to set up the context for handling a Cloudflare fetch request, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getFetchContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare fetch context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withFetchContext\"\n typeParameters={[\n { name: \"Env\", default: \"CloudflareBindings\" },\n { name: \"CfHostMetadata\", default: \"unknown\" }\n ]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareFetchContext<Env, CfHostMetadata>\"\n },\n {\n name: \"callback\",\n type: \"(request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext) => Promise<Response>\"\n }\n ]}\n returnType=\"Promise<Response>\">\n {code`return fetchContextStorage.run(context, () => callback(context.request, context.env, context.ctx)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareScheduledContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the runtime context for Cloudflare scheduled operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"controller\"\n type=\"ScheduledController\"\n doc=\"The Cloudflare scheduled controller for the scheduled operation.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the scheduled operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_SCHEDULED_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-scheduled\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"scheduledContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare scheduled runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_SCHEDULED_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareScheduledContext>()) as AsyncLocalStorage<CloudflareScheduledContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare scheduled runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare scheduled runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getScheduledContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareScheduledContext<Env>\">\n {code`const context = scheduledContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare scheduled context is not available. Ensure that you are calling this function within the scope of a Cloudflare scheduled operation.\");\n}\nreturn context as CloudflareScheduledContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare scheduled context. This is typically used to set up the context for handling a Cloudflare scheduled operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getScheduledContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare scheduled context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withScheduledContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareScheduledContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareScheduledContext<Env>) => Promise<void>\"\n }\n ]}\n returnType=\"Promise<void>\">\n {code`return scheduledContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareEmailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the runtime context for Cloudflare email operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"message\"\n type=\"ForwardableEmailMessage\"\n doc=\"The Cloudflare email instance for the email operation.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the email operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_EMAIL_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-email\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"emailContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare email runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_EMAIL_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareEmailContext>()) as AsyncLocalStorage<CloudflareEmailContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare email runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare email runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getEmailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareEmailContext<Env>\">\n {code`const context = emailContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare email context is not available. Ensure that you are calling this function within the scope of a Cloudflare email operation.\");\n}\nreturn context as CloudflareEmailContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare email context. This is typically used to set up the context for handling a Cloudflare email operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getEmailContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare email context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`A promise that resolves with the result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withEmailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareEmailContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareEmailContext<Env>) => Promise<void>\"\n }\n ]}\n returnType=\"Promise<void>\">\n {code`return emailContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareQueueContext\"\n typeParameters={[\n { name: \"Message\", default: \"unknown\" },\n { name: \"Env\", default: \"CloudflareBindings\" }\n ]}\n doc=\"An interface representing the runtime context for Cloudflare queue operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"batch\"\n type=\"MessageBatch<Message>\"\n doc=\"The Cloudflare queue event instance for the queue operation.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the queue operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_QUEUE_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-queue\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"queueContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare queue runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_QUEUE_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareQueueContext>()) as AsyncLocalStorage<CloudflareQueueContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare queue runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare queue runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getQueueContext\"\n typeParameters={[\n { name: \"Message\", default: \"unknown\" },\n { name: \"Env\", default: \"CloudflareBindings\" }\n ]}\n parameters={[]}\n returnType=\"CloudflareQueueContext<Message, Env>\">\n {code`const context = queueContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare queue context is not available. Ensure that you are calling this function within the scope of a Cloudflare queue operation.\");\n}\nreturn context as CloudflareQueueContext<Message, Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare queue context. This is typically used to set up the context for handling a Cloudflare queue operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getQueueContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare queue context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withQueueContext\"\n typeParameters={[\n { name: \"Message\", default: \"unknown\" },\n { name: \"Env\", default: \"CloudflareBindings\" }\n ]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareQueueContext<Message, Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareQueueContext<Message, Env>) => Promise<void>\"\n }\n ]}\n returnType=\"Promise<void>\">\n {code`return queueContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareTailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the tail context for Cloudflare tail operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"events\"\n type=\"TraceItem[]\"\n doc=\"An array of trace items representing the events in the Cloudflare tail context.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the tail operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_TAIL_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-tail\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"tailContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare tail runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_TAIL_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTailContext>()) as AsyncLocalStorage<CloudflareTailContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare tail runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare tail runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getTailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareTailContext<Env>\">\n {code`const context = tailContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare tail context is not available. Ensure that you are calling this function within the scope of a Cloudflare tail operation.\");\n}\nreturn context as CloudflareTailContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare tail context. This is typically used to set up the context for handling a Cloudflare tail operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTailContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare tail context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withTailContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareTailContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareTailContext<Env>) => Promise<void>\"\n }\n ]}\n returnType=\"T\">\n {code`return tailContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareTailStreamContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the tail context for Cloudflare tail stream operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"event\"\n type=\"TailStream.TailEvent<TailStream.Onset>\"\n doc=\"The tail event associated with the Cloudflare tail stream context.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the tail stream operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_TAIL_STREAM_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-tail-stream\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"tailStreamContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare tail stream runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_TAIL_STREAM_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTailStreamContext>()) as AsyncLocalStorage<CloudflareTailStreamContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare tail stream runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare tail stream runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getTailStreamContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareTailStreamContext<Env>\">\n {code`const context = tailStreamContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare tail stream context is not available. Ensure that you are calling this function within the scope of a Cloudflare tail stream operation.\");\n}\nreturn context as CloudflareTailStreamContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare tail stream context. This is typically used to set up the context for handling a Cloudflare tail stream operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTailStreamContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare tail stream context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withTailStreamContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareTailStreamContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareTailStreamContext<Env>) => Promise<TailStream.TailEventHandlerType>\"\n }\n ]}\n returnType=\"Promise<TailStream.TailEventHandlerType>\">\n {code`return tailStreamContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareTraceContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the trace context for Cloudflare trace operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"traces\"\n type=\"TraceItem[]\"\n doc=\"An array of trace items associated with the Cloudflare trace context.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the trace operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_TRACE_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-trace\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"traceContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare trace runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_TRACE_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTraceContext>()) as AsyncLocalStorage<CloudflareTraceContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare trace runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare trace runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getTraceContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareTraceContext<Env>\">\n {code`const context = traceContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare trace context is not available. Ensure that you are calling this function within the scope of a Cloudflare trace operation.\");\n}\nreturn context as CloudflareTraceContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare trace context. This is typically used to set up the context for handling a Cloudflare trace operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTraceContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare trace context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withTraceContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareTraceContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareTraceContext<Env>) => Promise<void>\"\n }\n ]}\n returnType=\"Promise<void>\">\n {code`return traceContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <InterfaceDeclaration\n export\n name=\"CloudflareTestContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n doc=\"An interface representing the test context for Cloudflare trace operations, containing relevant information and utilities for performing actions within the Cloudflare environment.\">\n <InterfaceMember\n name=\"controller\"\n type=\"TestController\"\n doc=\"The test controller associated with the Cloudflare test context.\"\n />\n <InterfaceMember\n name=\"env\"\n type=\"Env\"\n doc=\"The Cloudflare environment bindings available during runtime.\"\n />\n <InterfaceMember\n name=\"ctx\"\n type=\"ExecutionContext\"\n doc=\"The Cloudflare execution context for the test operation.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <VarDeclaration\n const\n name=\"CLOUDFLARE_TEST_CONTEXT_KEY\"\n initializer={code`Symbol.for(\"powerlines-cloudflare-test\"); `}\n />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"testContextStorage\"\n doc=\"An AsyncLocalStorage instance for managing the Cloudflare test runtime context.\"\n initializer={code`(globalContextStorage[CLOUDFLARE_TEST_CONTEXT_KEY] ??= new AsyncLocalStorage<CloudflareTestContext>()) as AsyncLocalStorage<CloudflareTestContext>; `}\n />\n <hbr />\n <TSDoc heading=\"Retrieves the current Cloudflare test runtime context from the AsyncLocalStorage. This context contains relevant information and utilities for performing actions within the Cloudflare environment. If no context is currently set, this function will throw an error.\">\n <TSDocReturns>{code`The current Cloudflare test runtime context.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getTestContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[]}\n returnType=\"CloudflareTestContext<Env>\">\n {code`const context = testContextStorage.getStore();\nif (!context) {\n throw new Error(\"Cloudflare test context is not available. Ensure that you are calling this function within the scope of a Cloudflare test operation.\");\n}\nreturn context as CloudflareTestContext<Env>; `}\n </FunctionDeclaration>\n <hbr />\n <TSDoc heading=\"Runs a given function within the scope of a Cloudflare test context. This is typically used to set up the context for handling a Cloudflare test operation, ensuring that any code executed within the function has access to the relevant Cloudflare environment information and utilities. The provided context will be available through the `getTestContext` function for any code executed within the callback.\">\n <TSDocParam name=\"context\">{code`The Cloudflare test context to run the function with.`}</TSDocParam>\n <TSDocParam name=\"callback\">{code`The function to execute within the scope of the provided context.`}</TSDocParam>\n <TSDocReturns>{code`The result of the executed function.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"withTestContext\"\n typeParameters={[{ name: \"Env\", default: \"CloudflareBindings\" }]}\n parameters={[\n {\n name: \"context\",\n type: \"CloudflareTestContext<Env>\"\n },\n {\n name: \"callback\",\n type: \"(ctx: CloudflareTestContext<Env>) => Promise<void>\"\n }\n ]}\n returnType=\"Promise<void>\">\n {code`return testContextStorage.run(context, () => callback(context)); `}\n </FunctionDeclaration>\n <Spacing />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA6BA,SAAO,kBAAA,OAAA;CACL,MAAK,CAAA,EACL,SACA,YACA,QAAO,WAAW,OAAO,CAAK,WAAW,UAAC,CAAU;CACtD,OAAO,gBAAgB,aAAA,WAAA;;EAEvB,aAAY;CACV,GAAA,MAAK;;GAEL,OAAA,KAAA;IACC,oBAAyB,CAAA,mBAAY;IACtC,6BAAA;KAAA;MACK,MAAS;MACN,MAAC;KACN;KAAA;MACA,MAAQ;MACT,MAAA;;;MAEK,MAAA;MACJ,MAAA;K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,KAAA;OACD,CAAA;OAAA,gBAAwB,iBAAE;QACzB,MAAK;QACN,MAAA;QACD,KAAS;OACT,CAAA;MAAA;KACA;IACD,CAAA;IAAA,gBAAW,OAAA,CAAA,CAAA;IAAA,gBAAA,gBAAA;KACd,SAAA;KACH,MAAA"}
@@ -8,7 +8,6 @@ let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plug
8
8
  let _powerlines_plugin_env_components_env_builtin = require("@powerlines/plugin-env/components/env-builtin");
9
9
 
10
10
  //#region src/components/env-builtin.tsx
11
- var env_builtin_exports = /* @__PURE__ */ require_runtime.__exportAll({ CloudflareEnvBuiltin: () => CloudflareEnvBuiltin });
12
11
  /**
13
12
  * Generates the Cloudflare environment configuration module for the Powerlines project.
14
13
  */
@@ -30,10 +29,4 @@ function CloudflareEnvBuiltin(props) {
30
29
  }
31
30
 
32
31
  //#endregion
33
- exports.CloudflareEnvBuiltin = CloudflareEnvBuiltin;
34
- Object.defineProperty(exports, 'env_builtin_exports', {
35
- enumerable: true,
36
- get: function () {
37
- return env_builtin_exports;
38
- }
39
- });
32
+ exports.CloudflareEnvBuiltin = CloudflareEnvBuiltin;
@@ -1,4 +1,3 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
1
  import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
3
2
  import { Show, code, splitProps } from "@alloy-js/core";
4
3
  import defu from "defu";
@@ -6,7 +5,6 @@ import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
6
5
  import { EnvBuiltin } from "@powerlines/plugin-env/components/env-builtin";
7
6
 
8
7
  //#region src/components/env-builtin.tsx
9
- var env_builtin_exports = /* @__PURE__ */ __exportAll({ CloudflareEnvBuiltin: () => CloudflareEnvBuiltin });
10
8
  /**
11
9
  * Generates the Cloudflare environment configuration module for the Powerlines project.
12
10
  */
@@ -28,5 +26,5 @@ function CloudflareEnvBuiltin(props) {
28
26
  }
29
27
 
30
28
  //#endregion
31
- export { CloudflareEnvBuiltin, env_builtin_exports };
29
+ export { CloudflareEnvBuiltin };
32
30
  //# sourceMappingURL=env-builtin.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport {\n EnvBuiltin,\n EnvBuiltinProps\n} from \"@powerlines/plugin-env/components/env-builtin\";\nimport defu from \"defu\";\n\nexport type CloudflareEnvBuiltinProps = Omit<EnvBuiltinProps, \"defaultConfig\">;\n\n/**\n * Generates the Cloudflare environment configuration module for the Powerlines project.\n */\nexport function CloudflareEnvBuiltin(props: CloudflareEnvBuiltinProps) {\n const [{ children, imports }, rest] = splitProps(props, [\n \"children\",\n \"imports\"\n ]);\n\n return (\n <EnvBuiltin\n defaultConfig={code`env`}\n {...rest}\n imports={defu(\n {\n \"cloudflare:workers\": [\"env\"]\n },\n imports ?? {}\n )}>\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </EnvBuiltin>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,SAAY,qBAAyB,OAAO;UAE1C,UACC,WACD,QAAA,WAAA,OAAA,CAAA,YAAA,SAAA,CAAA;CACF,OAAO,gBAAS,YAAqB,WAAO,EAC1C,eAAiB,IAAE,MACnB,GAAG,MAAA;EACD,IAAC,UAAO;GACR,OAAA,KAAA,gCAEF,GAAO,WAAA,CAAA,CAAA;EACL;EACA,IAAE,WAAa;GACb,OAAI,CAAI,gBAAA,SAAA,CAAA,CAAA,GAAA,gBAAA,MAAA;IACR,IAAA,OAAa;KACX,OAAA,QAAA,QAAA;IACA;IACC;GACH,CAAC,CAAC;EACJ;CACF,CAAC,CAAC;AACJ"}
1
+ {"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport {\n EnvBuiltin,\n EnvBuiltinProps\n} from \"@powerlines/plugin-env/components/env-builtin\";\nimport defu from \"defu\";\n\nexport type CloudflareEnvBuiltinProps = Omit<EnvBuiltinProps, \"defaultConfig\">;\n\n/**\n * Generates the Cloudflare environment configuration module for the Powerlines project.\n */\nexport function CloudflareEnvBuiltin(props: CloudflareEnvBuiltinProps) {\n const [{ children, imports }, rest] = splitProps(props, [\n \"children\",\n \"imports\"\n ]);\n\n return (\n <EnvBuiltin\n defaultConfig={code`env`}\n {...rest}\n imports={defu(\n {\n \"cloudflare:workers\": [\"env\"]\n },\n imports ?? {}\n )}>\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </EnvBuiltin>\n );\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAY,qBAAyB,OAAO;UAE1C,UACC,WACD,QAAA,WAAA,OAAA,CAAA,YAAA,SAAA,CAAA;CACF,OAAO,gBAAS,YAAqB,WAAO,EAC1C,eAAiB,IAAE,MACnB,GAAG,MAAA;EACD,IAAC,UAAO;GACR,OAAA,KAAA,gCAEF,GAAO,WAAA,CAAA,CAAA;EACL;EACA,IAAE,WAAa;GACb,OAAI,CAAI,gBAAA,SAAA,CAAA,CAAA,GAAA,gBAAA,MAAA;IACR,IAAA,OAAa;KACX,OAAA,QAAA,QAAA;IACA;IACC;GACH,CAAC,CAAC;EACJ;CACF,CAAC,CAAC;AACJ"}
@@ -12,7 +12,6 @@ let _stryke_path_find = require("@stryke/path/find");
12
12
  let _stryke_path_replace = require("@stryke/path/replace");
13
13
 
14
14
  //#region src/components/worker-entry.tsx
15
- var worker_entry_exports = /* @__PURE__ */ require_runtime.__exportAll({ WorkerEntry: () => WorkerEntry });
16
15
  /**
17
16
  * Generates a [Cloudflare Worker](https://developers.cloudflare.com/workers/runtime-apis/handlers/) entry module for the Powerlines project, providing a runtime context and utilities for integrating with Cloudflare services. This module defines a `CloudflareContext` interface, an `AsyncLocalStorage` instance for managing the context, and helper functions for retrieving and running code within the context. The generated module is designed to be used as a built-in file within the Powerlines environment, allowing developers to easily access Cloudflare-specific functionality in their applications.
18
17
  */
@@ -201,10 +200,4 @@ function WorkerEntry(props) {
201
200
  }
202
201
 
203
202
  //#endregion
204
- exports.WorkerEntry = WorkerEntry;
205
- Object.defineProperty(exports, 'worker_entry_exports', {
206
- enumerable: true,
207
- get: function () {
208
- return worker_entry_exports;
209
- }
210
- });
203
+ exports.WorkerEntry = WorkerEntry;
@@ -1,4 +1,3 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
1
  import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
3
2
  import { Show, code, computed, splitProps } from "@alloy-js/core";
4
3
  import defu from "defu";
@@ -10,7 +9,6 @@ import { relativePath } from "@stryke/path/find";
10
9
  import { replaceExtension } from "@stryke/path/replace";
11
10
 
12
11
  //#region src/components/worker-entry.tsx
13
- var worker_entry_exports = /* @__PURE__ */ __exportAll({ WorkerEntry: () => WorkerEntry });
14
12
  /**
15
13
  * Generates a [Cloudflare Worker](https://developers.cloudflare.com/workers/runtime-apis/handlers/) entry module for the Powerlines project, providing a runtime context and utilities for integrating with Cloudflare services. This module defines a `CloudflareContext` interface, an `AsyncLocalStorage` instance for managing the context, and helper functions for retrieving and running code within the context. The generated module is designed to be used as a built-in file within the Powerlines environment, allowing developers to easily access Cloudflare-specific functionality in their applications.
16
14
  */
@@ -199,5 +197,5 @@ function WorkerEntry(props) {
199
197
  }
200
198
 
201
199
  //#endregion
202
- export { WorkerEntry, worker_entry_exports };
200
+ export { WorkerEntry };
203
201
  //# sourceMappingURL=worker-entry.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-entry.mjs","names":[],"sources":["../../src/components/worker-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, Show, splitProps } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts\";\nimport {\n EntryFile,\n EntryFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { murmurhash } from \"@stryke/hash\";\nimport { relativePath } from \"@stryke/path/find\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport defu from \"defu\";\nimport { CloudflarePluginContext, CloudflareWorkerEntryModule } from \"../types\";\n\nexport type WorkerEntryProps = Partial<EntryFileProps> &\n Omit<EntryFileProps, \"path\"> & {\n worker: CloudflareWorkerEntryModule;\n };\n\n/**\n * Generates a [Cloudflare Worker](https://developers.cloudflare.com/workers/runtime-apis/handlers/) entry module for the Powerlines project, providing a runtime context and utilities for integrating with Cloudflare services. This module defines a `CloudflareContext` interface, an `AsyncLocalStorage` instance for managing the context, and helper functions for retrieving and running code within the context. The generated module is designed to be used as a built-in file within the Powerlines environment, allowing developers to easily access Cloudflare-specific functionality in their applications.\n */\nexport function WorkerEntry(props: WorkerEntryProps) {\n const [{ worker, children, imports, builtinImports }, rest] = splitProps(\n props,\n [\"worker\", \"children\", \"imports\", \"builtinImports\"]\n );\n\n const context = usePowerlines<CloudflarePluginContext>();\n const entryPath = computed(\n () =>\n `./${replaceExtension(\n relativePath(\n context.entryPath,\n worker.metadata.entry.input?.file || worker.metadata.entry.file\n )\n )}`\n );\n\n return (\n <EntryFile\n path={`worker-${murmurhash(worker.metadata.entry, {\n maxLength: 8\n })}-entry.ts`}\n {...rest}\n imports={defu(\n {\n \"@cloudflare/workers-types\": [\n { name: \"Request\", type: true },\n { name: \"Response\", type: true },\n { name: \"ExecutionContext\", type: true },\n { name: \"IncomingRequestCfProperties\", type: true },\n { name: \"ScheduledController\", type: true },\n { name: \"ForwardableEmailMessage\", type: true },\n { name: \"MessageBatch\", type: true },\n { name: \"TailStream\", type: true },\n { name: \"TraceItem\", type: true },\n { name: \"TailStream.TailEvent\", type: true },\n { name: \"TailStream.Onset\", type: true },\n { name: \"TailStream.TailEventHandlerType\", type: true }\n ],\n [entryPath.value]: \"worker\"\n },\n imports ?? {}\n )}\n builtinImports={defu(\n {\n cloudflare: [\n \"withFetchContext\",\n \"withTailContext\",\n \"withTraceContext\",\n \"withTailStreamContext\",\n \"withScheduledContext\",\n \"withTestContext\",\n \"withEmailContext\",\n \"withQueueContext\"\n ]\n },\n builtinImports ?? {}\n )}>\n {code`export default { `}\n <hbr />\n <Show when={worker.fetch}>\n {code` async fetch(request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: CloudflareBindings, ctx: ExecutionContext): Promise<Response> {\n return await withFetchContext({ request, env, ctx }, async (context) => {\n return worker.fetch(context.request, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.tail}>\n {code` async tail(events: TraceItem[], env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withTailContext({ events, env, ctx }, async (context) => {\n return worker.tail(context.events, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.trace}>\n {code` async trace(traces: TraceItem[], env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withTraceContext({ traces, env, ctx }, async (context) => {\n return worker.trace(context.traces, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.tailStream}>\n {code` async tailStream(event: TailStream.TailEvent<TailStream.Onset>, env: CloudflareBindings, ctx: ExecutionContext): Promise<ReadableStream> {\n return await withTailStreamContext({ event, env, ctx }, async (context) => {\n return await worker.tailStream(context.event, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.scheduled}>\n {code` async scheduled(controller: ScheduledController, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withScheduledContext({ controller, env, ctx }, async (context) => {\n return worker.scheduled(context.controller, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.test}>\n {code` async test(controller: TestController, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withTestContext({ controller, env, ctx }, async (context) => {\n return worker.test(context.controller, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.email}>\n {code` async email(message: ForwardableEmailMessage, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withEmailContext({ message, env, ctx }, async (context) => {\n return worker.email(context.message, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.queue}>\n {code` async queue(batch: MessageBatch, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withQueueContext({ batch, env, ctx }, async (context) => {\n return worker.queue(context.batch, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n {code` } satisfies ExportedHandler<CloudflareBindings>; `}\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </EntryFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA+BA,SAAY,YAAgB,OAAG;CAC7B,MAAK,CAAA,EACH,QACD,mBAED,kBACC,QAAU,WAAG,OAAW;EAAA;EAAe;EAAY;EAAW;CAAY,CAAA;CAC3E,MAAA,UAAA,cAAA;CACF,MAAO,YAAS,eAAmB,KAAA,iBAAkB,aAAA,QAAA,WAAA,OAAA,SAAA,MAAA,OAAA,QAAA,OAAA,SAAA,MAAA,IAAA,CAAA,GAAA;CACnD,OAAO,gBAAkB,WAAW,WAAA,EAClC,IAAA,OAAK;EACH,OAAO,UAAG,WAAY,OAAW,SAAA,OAAe,EACnD,WAAA;CAED,EACA,GAAA,MAAM;EACJ,IAAI,UAAA;GACF,OAAK,KAAA;IACH,6BAAY;KAAA;MACV,MAAA;MACA,MAAM;KACR;KAAA;MACA,MAAA;MACL,MAAA;;;MAEM,MAAA;MACJ,MAAA;KACC;KAAK;MACH,MAAA;MACE,MAAM;KACR;KAAE;MACJ,MAAS;MACP,MAAA;KACA;KAAG;MACD,MAAI;MACJ,MAAI;KACN;KAAG;MACD,MAAI;MACJ,MAAI;KACN;KAAG;MACD,MAAI;MACJ,MAAI;KACN;KAAG;MACD,MAAI;MACJ,MAAI;KACN;KAAG;MACD,MAAC;MACD,MAAC;KACH;KAAC;MACD,MAAQ;MACT,MAAA;KACD;KAAA;MACE,MAAA;MACE,MAAA;KACF;IAAC;KACA,UAAI,QAAA;GACP,GAAG,WAAI,CAAA,CAAA;EACT;EACA,IAAI,iBAAK;GACP,OAAO,KAAA,EACL,YAAK;IAAA;IAAiB;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;GAAA,EACxB,GAAG,kBAAI,CAAA,CAAgB;EACzB;EACA,IAAI,WAAC;GACH,OAAE;IAAA,IAAA;IAAmB,gBAAA,OAAA,CAAA,CAAA;IAAA,gBAAA,MAAA;KACnB,IAAA,OAAA;MACD,OAAK,OAAO;KACZ;KACA,UAAW,IAAA;;;;;IAKZ,CAAC;IAAG,gBAAA,OAAA,CAAA,CAAA;IAAA,gBAAA,MAAA;KACF,IAAI,OAAA;MACF,OAAE,OAAA;KACL;KACC,UAAO,IAAM;;;;;IAKf,CAAC;IAAC,gBAAI,OAAA,CAAA,CAAA;IAAA,gBAAA,MAAA;KACL,IAAK,OAAA;MACL,OAAU,OAAO;KAChB;KACA,UAAO,IAAA;;;;;IAKT,CAAC;IAAG,gBAAE,OAAA,CAAA,CAAA;IAAA,gBAAA,MAAA;KACL,IAAK,OAAM;MACT,OAAM,OAAM;KACb;KACA,UAAS,IAAK;;;;;IAKhB,CAAC;IAAA,gBAAkB,OAAU,CAAA,CAAA;IAAA,gBAAA,MAAA;KAC3B,IAAC,OAAM;MACP,OAAO,OAAA;KACP;KACA,UAAE,IAAA;;;;;IAKJ,CAAC;IAAE,gBAAiB,OAAA,CAAU,CAAC;IAAC,gBAAoB,MAAC;KACnD,IAAA,OAAO;MACL,OAAO,OAAO;KAChB;KACA,UAAE,IAAA;;;;;IAKJ,CAAC;IAAC,gBAAO,OAAmB,CAAA,CAAA;IAAA,gBAAqB,MAAO;KACtD,IAAE,OAAO;MACP,OAAA,OAAA;KACF;KACA,UAAI,IAAA;;;;;IAKN,CAAC;IAAG,gBAAc,OAAM,CAAA,CAAO;IAAC,gBAAoB,MAAA;KAClD,IAAE,OAAA;MACA,OAAA,OAAA;KACF;KACD,UAAK,IAAA;;;;;IAKT,CAAA;IAAA,gBAAA,OAAA,CAAA,CAAA;IAAA,IAAA;IAAA,gBAAA,SAAA,CAAA,CAAA;IAAA,gBAAA,MAAA;KACH,IAAA,OAAA"}
1
+ {"version":3,"file":"worker-entry.mjs","names":[],"sources":["../../src/components/worker-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, Show, splitProps } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts\";\nimport {\n EntryFile,\n EntryFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { murmurhash } from \"@stryke/hash\";\nimport { relativePath } from \"@stryke/path/find\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport defu from \"defu\";\nimport { CloudflarePluginContext, CloudflareWorkerEntryModule } from \"../types\";\n\nexport type WorkerEntryProps = Partial<EntryFileProps> &\n Omit<EntryFileProps, \"path\"> & {\n worker: CloudflareWorkerEntryModule;\n };\n\n/**\n * Generates a [Cloudflare Worker](https://developers.cloudflare.com/workers/runtime-apis/handlers/) entry module for the Powerlines project, providing a runtime context and utilities for integrating with Cloudflare services. This module defines a `CloudflareContext` interface, an `AsyncLocalStorage` instance for managing the context, and helper functions for retrieving and running code within the context. The generated module is designed to be used as a built-in file within the Powerlines environment, allowing developers to easily access Cloudflare-specific functionality in their applications.\n */\nexport function WorkerEntry(props: WorkerEntryProps) {\n const [{ worker, children, imports, builtinImports }, rest] = splitProps(\n props,\n [\"worker\", \"children\", \"imports\", \"builtinImports\"]\n );\n\n const context = usePowerlines<CloudflarePluginContext>();\n const entryPath = computed(\n () =>\n `./${replaceExtension(\n relativePath(\n context.entryPath,\n worker.metadata.entry.input?.file || worker.metadata.entry.file\n )\n )}`\n );\n\n return (\n <EntryFile\n path={`worker-${murmurhash(worker.metadata.entry, {\n maxLength: 8\n })}-entry.ts`}\n {...rest}\n imports={defu(\n {\n \"@cloudflare/workers-types\": [\n { name: \"Request\", type: true },\n { name: \"Response\", type: true },\n { name: \"ExecutionContext\", type: true },\n { name: \"IncomingRequestCfProperties\", type: true },\n { name: \"ScheduledController\", type: true },\n { name: \"ForwardableEmailMessage\", type: true },\n { name: \"MessageBatch\", type: true },\n { name: \"TailStream\", type: true },\n { name: \"TraceItem\", type: true },\n { name: \"TailStream.TailEvent\", type: true },\n { name: \"TailStream.Onset\", type: true },\n { name: \"TailStream.TailEventHandlerType\", type: true }\n ],\n [entryPath.value]: \"worker\"\n },\n imports ?? {}\n )}\n builtinImports={defu(\n {\n cloudflare: [\n \"withFetchContext\",\n \"withTailContext\",\n \"withTraceContext\",\n \"withTailStreamContext\",\n \"withScheduledContext\",\n \"withTestContext\",\n \"withEmailContext\",\n \"withQueueContext\"\n ]\n },\n builtinImports ?? {}\n )}>\n {code`export default { `}\n <hbr />\n <Show when={worker.fetch}>\n {code` async fetch(request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: CloudflareBindings, ctx: ExecutionContext): Promise<Response> {\n return await withFetchContext({ request, env, ctx }, async (context) => {\n return worker.fetch(context.request, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.tail}>\n {code` async tail(events: TraceItem[], env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withTailContext({ events, env, ctx }, async (context) => {\n return worker.tail(context.events, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.trace}>\n {code` async trace(traces: TraceItem[], env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withTraceContext({ traces, env, ctx }, async (context) => {\n return worker.trace(context.traces, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.tailStream}>\n {code` async tailStream(event: TailStream.TailEvent<TailStream.Onset>, env: CloudflareBindings, ctx: ExecutionContext): Promise<ReadableStream> {\n return await withTailStreamContext({ event, env, ctx }, async (context) => {\n return await worker.tailStream(context.event, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.scheduled}>\n {code` async scheduled(controller: ScheduledController, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withScheduledContext({ controller, env, ctx }, async (context) => {\n return worker.scheduled(context.controller, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.test}>\n {code` async test(controller: TestController, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withTestContext({ controller, env, ctx }, async (context) => {\n return worker.test(context.controller, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.email}>\n {code` async email(message: ForwardableEmailMessage, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withEmailContext({ message, env, ctx }, async (context) => {\n return worker.email(context.message, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n <Show when={worker.queue}>\n {code` async queue(batch: MessageBatch, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {\n return withQueueContext({ batch, env, ctx }, async (context) => {\n return worker.queue(context.batch, context.env, context.ctx);\n });\n }, `}\n </Show>\n <hbr />\n {code` } satisfies ExportedHandler<CloudflareBindings>; `}\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </EntryFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAY,YAAgB,OAAG;CAC7B,MAAK,CAAA,EACH,QACD,mBAED,kBACC,QAAU,WAAG,OAAW;EAAA;EAAe;EAAY;EAAW;CAAY,CAAA;CAC3E,MAAA,UAAA,cAAA;CACF,MAAO,YAAS,eAAmB,KAAA,iBAAkB,aAAA,QAAA,WAAA,OAAA,SAAA,MAAA,OAAA,QAAA,OAAA,SAAA,MAAA,IAAA,CAAA,GAAA;CACnD,OAAO,gBAAkB,WAAW,WAAA,EAClC,IAAA,OAAK;EACH,OAAO,UAAG,WAAY,OAAW,SAAA,OAAe,EACn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A;IAAA,gBAAA,MAAA;KAC3B,IAAC,OAAM;MACP,OAAO,OAAA;KACP;KACA,UAAE,IAAA;;;;;IAKJ,CAAC;IAAE,gBAAiB,OAAA,CAAU,CAAC;IAAC,gBAAoB,MAAC;KACnD,IAAA,OAAO;MACL,OAAO,OAAO;KAChB;KACA,UAAE,IAAA;;;;;IAKJ,CAAC;IAAC,gBAAO,OAAmB,CAAA,CAAA;IAAA,gBAAqB,MAAO;KACtD,IAAE,OAAO;MACP,OAAA,OAAA;KACF;KACA,UAAI,IAAA;;;;;IAKN,CAAC;IAAG,gBAAc,OAAM,CAAA,CAAO;IAAC,gBAAoB,MAAA;KAClD,IAAE,OAAA;MACA,OAAA,OAAA;KACF;KACD,UAAK,IAAA;;;;;IAKT,CAAA;IAAA,gBAAA,OAAA,CAAA,CAAA;IAAA,IAAA;IAAA,gBAAA,SAAA,CAAA,CAAA;IAAA,gBAAA,MAAA;KACH,IAAA,OAAA"}
@@ -1,9 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let _stryke_path = require("@stryke/path");
4
3
 
5
4
  //#region src/helpers/wrangler.ts
6
- var wrangler_exports = /* @__PURE__ */ require_runtime.__exportAll({ resolveWranglerConfigPath: () => resolveWranglerConfigPath });
7
5
  /**
8
6
  * Resolves the Wrangler configuration file path by checking for allowed extensions in the specified root directory.
9
7
  *
@@ -19,10 +17,4 @@ function resolveWranglerConfigPath(context) {
19
17
  }
20
18
 
21
19
  //#endregion
22
- exports.resolveWranglerConfigPath = resolveWranglerConfigPath;
23
- Object.defineProperty(exports, 'wrangler_exports', {
24
- enumerable: true,
25
- get: function () {
26
- return wrangler_exports;
27
- }
28
- });
20
+ exports.resolveWranglerConfigPath = resolveWranglerConfigPath;
@@ -1,8 +1,6 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
1
  import { joinPaths } from "@stryke/path";
3
2
 
4
3
  //#region src/helpers/wrangler.ts
5
- var wrangler_exports = /* @__PURE__ */ __exportAll({ resolveWranglerConfigPath: () => resolveWranglerConfigPath });
6
4
  /**
7
5
  * Resolves the Wrangler configuration file path by checking for allowed extensions in the specified root directory.
8
6
  *
@@ -18,5 +16,5 @@ function resolveWranglerConfigPath(context) {
18
16
  }
19
17
 
20
18
  //#endregion
21
- export { resolveWranglerConfigPath, wrangler_exports };
19
+ export { resolveWranglerConfigPath };
22
20
  //# sourceMappingURL=wrangler.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"wrangler.mjs","names":[],"sources":["../../src/helpers/wrangler.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path\";\nimport { UnresolvedContext } from \"powerlines\";\n\nexport interface ResolveConfigPathOptions {\n useRedirectIfAvailable?: boolean;\n}\n\nexport interface ConfigPaths {\n /**\n * Absolute path to the actual configuration being used (possibly redirected from the user's config).\n */\n configPath: string | undefined;\n /**\n * Absolute path to the user's configuration, which may not be the same as `configPath` if it was redirected.\n */\n userConfigPath: string | undefined;\n /**\n * Absolute path to the deploy config path used\n */\n deployConfigPath: string | undefined;\n /**\n * Was a redirected config file read?\n */\n redirected: boolean;\n}\n\n/**\n * Resolves the Wrangler configuration file path by checking for allowed extensions in the specified root directory.\n *\n * @param context - The Cloudflare plugin context containing the configuration and file system access.\n * @returns The absolute path to the found configuration file, or undefined if no file is found.\n */\nexport function resolveWranglerConfigPath(\n context: UnresolvedContext\n): string | undefined {\n for (const extension of [\"jsonc\", \"json\", \"toml\"]) {\n if (\n context.fs.existsSync(\n joinPaths(context.config.root, `wrangler.${extension}`)\n )\n ) {\n return joinPaths(context.config.root, `wrangler.${extension}`);\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;AA0BA,SAAI,0BAAA,SAAA;CACF,KAAG,MAAQ,aAAa;EAAA;EAAO;EAAA;CAAc,GAC3C,IAAA,QAAA,GAAA,WAAA,UAAA,QAAA,OAAA,MAAA,YAAA,WAAA,CAAA,GACF,OAAW,UAAU,QAAA,OAAS,MAAA,YAAA,WAAA;AAIhC"}
1
+ {"version":3,"file":"wrangler.mjs","names":[],"sources":["../../src/helpers/wrangler.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path\";\nimport { UnresolvedContext } from \"powerlines\";\n\nexport interface ResolveConfigPathOptions {\n useRedirectIfAvailable?: boolean;\n}\n\nexport interface ConfigPaths {\n /**\n * Absolute path to the actual configuration being used (possibly redirected from the user's config).\n */\n configPath: string | undefined;\n /**\n * Absolute path to the user's configuration, which may not be the same as `configPath` if it was redirected.\n */\n userConfigPath: string | undefined;\n /**\n * Absolute path to the deploy config path used\n */\n deployConfigPath: string | undefined;\n /**\n * Was a redirected config file read?\n */\n redirected: boolean;\n}\n\n/**\n * Resolves the Wrangler configuration file path by checking for allowed extensions in the specified root directory.\n *\n * @param context - The Cloudflare plugin context containing the configuration and file system access.\n * @returns The absolute path to the found configuration file, or undefined if no file is found.\n */\nexport function resolveWranglerConfigPath(\n context: UnresolvedContext\n): string | undefined {\n for (const extension of [\"jsonc\", \"json\", \"toml\"]) {\n if (\n context.fs.existsSync(\n joinPaths(context.config.root, `wrangler.${extension}`)\n )\n ) {\n return joinPaths(context.config.root, `wrangler.${extension}`);\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAI,0BAAA,SAAA;CACF,KAAG,MAAQ,aAAa;EAAA;EAAO;EAAA;CAAc,GAC3C,IAAA,QAAA,GAAA,WAAA,UAAA,QAAA,OAAA,MAAA,YAAA,WAAA,CAAA,GACF,OAAW,UAAU,QAAA,OAAS,MAAA,YAAA,WAAA;AAIhC"}
@@ -8,14 +8,6 @@ let zod = require("zod");
8
8
  zod = require_runtime.__toESM(zod, 1);
9
9
 
10
10
  //#region src/types/wrangler.ts
11
- var wrangler_exports = /* @__PURE__ */ require_runtime.__exportAll({
12
- JsonSchema: () => JsonSchema,
13
- LiteralSchema: () => LiteralSchema,
14
- PathSchema: () => PathSchema,
15
- defaultWranglerConfig: () => defaultWranglerConfig,
16
- isCyclic: () => isCyclic,
17
- parseWithRootPath: () => parseWithRootPath
18
- });
19
11
  const LiteralSchema = zod.union([
20
12
  zod.string(),
21
13
  zod.number(),
@@ -177,10 +169,4 @@ exports.LiteralSchema = LiteralSchema;
177
169
  exports.PathSchema = PathSchema;
178
170
  exports.defaultWranglerConfig = defaultWranglerConfig;
179
171
  exports.isCyclic = isCyclic;
180
- exports.parseWithRootPath = parseWithRootPath;
181
- Object.defineProperty(exports, 'wrangler_exports', {
182
- enumerable: true,
183
- get: function () {
184
- return wrangler_exports;
185
- }
186
- });
172
+ exports.parseWithRootPath = parseWithRootPath;
@@ -1,17 +1,8 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
1
  import assert from "node:assert";
3
2
  import path from "node:path";
4
3
  import * as z from "zod";
5
4
 
6
5
  //#region src/types/wrangler.ts
7
- var wrangler_exports = /* @__PURE__ */ __exportAll({
8
- JsonSchema: () => JsonSchema,
9
- LiteralSchema: () => LiteralSchema,
10
- PathSchema: () => PathSchema,
11
- defaultWranglerConfig: () => defaultWranglerConfig,
12
- isCyclic: () => isCyclic,
13
- parseWithRootPath: () => parseWithRootPath
14
- });
15
6
  const LiteralSchema = z.union([
16
7
  z.string(),
17
8
  z.number(),
@@ -168,5 +159,5 @@ const defaultWranglerConfig = {
168
159
  };
169
160
 
170
161
  //#endregion
171
- export { JsonSchema, LiteralSchema, PathSchema, defaultWranglerConfig, isCyclic, parseWithRootPath, wrangler_exports };
162
+ export { JsonSchema, LiteralSchema, PathSchema, defaultWranglerConfig, isCyclic, parseWithRootPath };
172
163
  //# sourceMappingURL=wrangler.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"wrangler.mjs","names":[],"sources":["../../src/types/wrangler.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport assert from \"node:assert\";\nimport path from \"node:path\";\n\nimport type { Unstable_Config, Unstable_RawConfig } from \"wrangler\";\nimport * as z from \"zod\";\nimport * as z4 from \"zod/v4/core\";\n\nexport type OptionalZodTypeOf<T extends z4.$ZodType | undefined> =\n T extends z4.$ZodType ? z4.infer<T> : undefined;\n\n// https://github.com/colinhacks/zod/blob/59768246aa57133184b2cf3f7c2a1ba5c3ab08c3/README.md?plain=1#L1302-L1317\nexport const LiteralSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null()\n]);\nexport type Literal = z.infer<typeof LiteralSchema>;\nexport type Json = Literal | { [key: string]: Json } | Json[];\nexport const JsonSchema: z.ZodType<Json> = z.lazy(() =>\n z.union([\n LiteralSchema,\n z.array(JsonSchema),\n z.record(z.string(), JsonSchema)\n ])\n);\n\nlet rootPath: string | undefined;\nexport async function parseWithRootPath<Z extends z4.$ZodType>(\n newRootPath: string,\n schema: Z,\n payload: z4.ParsePayload<any>,\n ctx: z.core.ParseContextInternal\n) {\n rootPath = newRootPath;\n try {\n return await schema._zod.parse(payload, ctx);\n } finally {\n rootPath = undefined;\n }\n}\nexport const PathSchema = z.string().transform(p => {\n assert(\n rootPath !== undefined,\n \"Expected `PathSchema` to be parsed within `parseWithRootPath()`\"\n );\n return path.resolve(rootPath, p);\n});\n\nexport function isCyclic(value: unknown, seen = new Set<unknown>()) {\n if (typeof value !== \"object\" || value === null) return false;\n for (const child of Object.values(value)) {\n if (seen.has(child)) return true;\n seen.add(child);\n if (isCyclic(child, seen)) return true;\n seen.delete(child);\n }\n return false;\n}\n\nexport type WranglerUserConfig = Unstable_RawConfig;\n\n/**\n * This is the static type definition for the configuration object.\n *\n * It reflects a normalized and validated version of the configuration that you can write in a Wrangler configuration file,\n * and optionally augment with arguments passed directly to wrangler.\n *\n * For more information about the configuration object, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration\n *\n * @remarks\n * - Fields that are only specified in `ConfigFields` and not `Environment` can only appear\n * in the top level config and should not appear in any environments.\n * - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects\n * - All top level fields in config and environments are optional in the Wrangler configuration file.\n */\n\nexport type WranglerResolvedConfig = Unstable_Config;\n\nexport const defaultWranglerConfig: WranglerResolvedConfig = {\n /* COMPUTED_FIELDS */\n configPath: undefined,\n userConfigPath: undefined,\n topLevelName: undefined,\n definedEnvironments: undefined,\n targetEnvironment: undefined,\n\n /*= =================================================== */\n /* Fields supported by both Workers & Pages */\n /*= =================================================== */\n /* TOP-LEVEL ONLY FIELDS */\n pages_build_output_dir: undefined,\n send_metrics: undefined,\n dev: {\n ip: process.platform === \"win32\" ? \"127.0.0.1\" : \"localhost\",\n port: undefined, // the default of 8787 is set at runtime\n inspector_port: undefined, // the default of 9229 is set at runtime\n inspector_ip: undefined, // the default of 127.0.0.1 is set at runtime\n local_protocol: \"http\",\n upstream_protocol: \"http\",\n host: undefined,\n // Note this one is also workers only\n enable_containers: true,\n container_engine: undefined,\n generate_types: false\n },\n\n /** INHERITABLE ENVIRONMENT FIELDS */\n name: undefined,\n compatibility_date: undefined,\n compatibility_flags: [],\n limits: undefined,\n placement: undefined,\n\n /** NON-INHERITABLE ENVIRONMENT FIELDS */\n vars: {},\n durable_objects: { bindings: [] },\n kv_namespaces: [],\n queues: {\n producers: [],\n consumers: [] // WORKERS SUPPORT ONLY!!\n },\n r2_buckets: [],\n d1_databases: [],\n vectorize: [],\n hyperdrive: [],\n workflows: [],\n secrets_store_secrets: [],\n services: [],\n analytics_engine_datasets: [],\n ai: undefined,\n images: undefined,\n stream: undefined,\n media: undefined,\n version_metadata: undefined,\n unsafe_hello_world: [],\n ratelimits: [],\n worker_loaders: [],\n\n /*= =================================================== */\n /* Fields supported by Workers only */\n /*= =================================================== */\n /* TOP-LEVEL ONLY FIELDS */\n legacy_env: true,\n site: undefined,\n wasm_modules: undefined,\n text_blobs: undefined,\n data_blobs: undefined,\n keep_vars: undefined,\n alias: undefined,\n\n /** INHERITABLE ENVIRONMENT FIELDS */\n account_id: undefined,\n main: undefined,\n find_additional_modules: undefined,\n preserve_file_names: undefined,\n base_dir: undefined,\n workers_dev: undefined,\n preview_urls: undefined,\n route: undefined,\n routes: undefined,\n tsconfig: undefined,\n jsx_factory: \"React.createElement\",\n jsx_fragment: \"React.Fragment\",\n migrations: [],\n triggers: {\n crons: undefined\n },\n rules: [],\n build: { command: undefined, watch_dir: \"./src\", cwd: undefined },\n no_bundle: undefined,\n minify: undefined,\n keep_names: undefined,\n dispatch_namespaces: [],\n first_party_worker: undefined,\n logfwdr: { bindings: [] },\n logpush: undefined,\n upload_source_maps: undefined,\n assets: undefined,\n observability: { enabled: true },\n cache: undefined,\n /** The default here is undefined so that we can delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable. */\n compliance_region: undefined,\n python_modules: { exclude: [\"**/*.pyc\"] },\n\n /** NON-INHERITABLE ENVIRONMENT FIELDS */\n define: {},\n cloudchamber: {},\n containers: undefined,\n send_email: [],\n browser: undefined,\n unsafe: {},\n mtls_certificates: [],\n tail_consumers: undefined,\n streaming_tail_consumers: undefined,\n pipelines: [],\n vpc_services: [],\n ai_search_namespaces: []\n} as unknown as WranglerResolvedConfig;\n"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAY,gBAAgB,EAAA,MAAK;CAAA,EAAA,OAAA;CAAA,EAAA,OAAA;CAAA,EAAA,QAAA;CAAA,EAAA,KAAA;AAAA,CAAA;;;;;;AAEjC,IAAA;AACA,eAAgB,kBAAwB,aAAS,QAAA,SAAA,KAAA;;CAE/C,IAAC;SACI,MAAM,OAAA,KAAgB,MAAE,SAAM,GAAA;CACnC,UAAU;EACR,WAAQ;CACV;AACF;AACA,MAAE,aAAA,EAAA,OAAA,EAAA,WAAA,MAAA;CACF,OAAO,aAAe,QAAQ,iEAAqB;CACnD,OAAO,KAAK,QAAO,UAAa,CAAA;AAChC,CAAA;AACA,SAAU,SAAA,OAAA,uBAAA,IAAA,IAAA,GAAA;CACR,IAAE,OAAA,UAAa,YAAA,UAAA,MAAA,OAAA;CACf,KAAI,MAAM,SAAU,OAAC,OAAA,KAAA,GAAA;EACnB,IAAE,KAAO,IAAE,KAAO,GAAG,OAAA;EACtB,KAAA,IAAA,KAAA;EACF,IAAA,SAAA,OAAA,IAAA,GAAA,OAAA;;CAED;CACA,OAAO;AACP;;;;;;;;;;;;;;;AAiBA,MAAa,wBAAqB;;CAGlC,gBAAgB;CACd,cAAW;CACX,qBAAoB;CACpB,mBAAe;CAKf,wBAAY;CACd,cAAA;;EAEA,IAAO,QAAK,aAAA,UAAqB,cAAkB;;EAGhD,gBAAY;EAEZ,cAAc;EAEh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":[],"sources":["../../src/types/wrangler.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport assert from \"node:assert\";\nimport path from \"node:path\";\n\nimport type { Unstable_Config, Unstable_RawConfig } from \"wrangler\";\nimport * as z from \"zod\";\nimport * as z4 from \"zod/v4/core\";\n\nexport type OptionalZodTypeOf<T extends z4.$ZodType | undefined> =\n T extends z4.$ZodType ? z4.infer<T> : undefined;\n\n// https://github.com/colinhacks/zod/blob/59768246aa57133184b2cf3f7c2a1ba5c3ab08c3/README.md?plain=1#L1302-L1317\nexport const LiteralSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null()\n]);\nexport type Literal = z.infer<typeof LiteralSchema>;\nexport type Json = Literal | { [key: string]: Json } | Json[];\nexport const JsonSchema: z.ZodType<Json> = z.lazy(() =>\n z.union([\n LiteralSchema,\n z.array(JsonSchema),\n z.record(z.string(), JsonSchema)\n ])\n);\n\nlet rootPath: string | undefined;\nexport async function parseWithRootPath<Z extends z4.$ZodType>(\n newRootPath: string,\n schema: Z,\n payload: z4.ParsePayload<any>,\n ctx: z.core.ParseContextInternal\n) {\n rootPath = newRootPath;\n try {\n return await schema._zod.parse(payload, ctx);\n } finally {\n rootPath = undefined;\n }\n}\nexport const PathSchema = z.string().transform(p => {\n assert(\n rootPath !== undefined,\n \"Expected `PathSchema` to be parsed within `parseWithRootPath()`\"\n );\n return path.resolve(rootPath, p);\n});\n\nexport function isCyclic(value: unknown, seen = new Set<unknown>()) {\n if (typeof value !== \"object\" || value === null) return false;\n for (const child of Object.values(value)) {\n if (seen.has(child)) return true;\n seen.add(child);\n if (isCyclic(child, seen)) return true;\n seen.delete(child);\n }\n return false;\n}\n\nexport type WranglerUserConfig = Unstable_RawConfig;\n\n/**\n * This is the static type definition for the configuration object.\n *\n * It reflects a normalized and validated version of the configuration that you can write in a Wrangler configuration file,\n * and optionally augment with arguments passed directly to wrangler.\n *\n * For more information about the configuration object, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration\n *\n * @remarks\n * - Fields that are only specified in `ConfigFields` and not `Environment` can only appear\n * in the top level config and should not appear in any environments.\n * - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects\n * - All top level fields in config and environments are optional in the Wrangler configuration file.\n */\n\nexport type WranglerResolvedConfig = Unstable_Config;\n\nexport const defaultWranglerConfig: WranglerResolvedConfig = {\n /* COMPUTED_FIELDS */\n configPath: undefined,\n userConfigPath: undefined,\n topLevelName: undefined,\n definedEnvironments: undefined,\n targetEnvironment: undefined,\n\n /*= =================================================== */\n /* Fields supported by both Workers & Pages */\n /*= =================================================== */\n /* TOP-LEVEL ONLY FIELDS */\n pages_build_output_dir: undefined,\n send_metrics: undefined,\n dev: {\n ip: process.platform === \"win32\" ? \"127.0.0.1\" : \"localhost\",\n port: undefined, // the default of 8787 is set at runtime\n inspector_port: undefined, // the default of 9229 is set at runtime\n inspector_ip: undefined, // the default of 127.0.0.1 is set at runtime\n local_protocol: \"http\",\n upstream_protocol: \"http\",\n host: undefined,\n // Note this one is also workers only\n enable_containers: true,\n container_engine: undefined,\n generate_types: false\n },\n\n /** INHERITABLE ENVIRONMENT FIELDS */\n name: undefined,\n compatibility_date: undefined,\n compatibility_flags: [],\n limits: undefined,\n placement: undefined,\n\n /** NON-INHERITABLE ENVIRONMENT FIELDS */\n vars: {},\n durable_objects: { bindings: [] },\n kv_namespaces: [],\n queues: {\n producers: [],\n consumers: [] // WORKERS SUPPORT ONLY!!\n },\n r2_buckets: [],\n d1_databases: [],\n vectorize: [],\n hyperdrive: [],\n workflows: [],\n secrets_store_secrets: [],\n services: [],\n analytics_engine_datasets: [],\n ai: undefined,\n images: undefined,\n stream: undefined,\n media: undefined,\n version_metadata: undefined,\n unsafe_hello_world: [],\n ratelimits: [],\n worker_loaders: [],\n\n /*= =================================================== */\n /* Fields supported by Workers only */\n /*= =================================================== */\n /* TOP-LEVEL ONLY FIELDS */\n legacy_env: true,\n site: undefined,\n wasm_modules: undefined,\n text_blobs: undefined,\n data_blobs: undefined,\n keep_vars: undefined,\n alias: undefined,\n\n /** INHERITABLE ENVIRONMENT FIELDS */\n account_id: undefined,\n main: undefined,\n find_additional_modules: undefined,\n preserve_file_names: undefined,\n base_dir: undefined,\n workers_dev: undefined,\n preview_urls: undefined,\n route: undefined,\n routes: undefined,\n tsconfig: undefined,\n jsx_factory: \"React.createElement\",\n jsx_fragment: \"React.Fragment\",\n migrations: [],\n triggers: {\n crons: undefined\n },\n rules: [],\n build: { command: undefined, watch_dir: \"./src\", cwd: undefined },\n no_bundle: undefined,\n minify: undefined,\n keep_names: undefined,\n dispatch_namespaces: [],\n first_party_worker: undefined,\n logfwdr: { bindings: [] },\n logpush: undefined,\n upload_source_maps: undefined,\n assets: undefined,\n observability: { enabled: true },\n cache: undefined,\n /** The default here is undefined so that we can delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable. */\n compliance_region: undefined,\n python_modules: { exclude: [\"**/*.pyc\"] },\n\n /** NON-INHERITABLE ENVIRONMENT FIELDS */\n define: {},\n cloudchamber: {},\n containers: undefined,\n send_email: [],\n browser: undefined,\n unsafe: {},\n mtls_certificates: [],\n tail_consumers: undefined,\n streaming_tail_consumers: undefined,\n pipelines: [],\n vpc_services: [],\n ai_search_namespaces: []\n} as unknown as WranglerResolvedConfig;\n"],"mappings":";;;;;AAuBA,MAAY,gBAAgB,EAAA,MAAK;CAAA,EAAA,OAAA;CAAA,EAAA,OAAA;CAAA,EAAA,QAAA;CAAA,EAAA,KAAA;AAAA,CAAA;;;;;;AAEj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