@powerlines/plugin-cloudflare 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +304 -0
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/components/cloudflare-builtin.cjs +916 -0
- package/dist/components/cloudflare-builtin.d.cts +13 -0
- package/dist/components/cloudflare-builtin.d.cts.map +1 -0
- package/dist/components/cloudflare-builtin.d.mts +13 -0
- package/dist/components/cloudflare-builtin.d.mts.map +1 -0
- package/dist/components/cloudflare-builtin.mjs +915 -0
- package/dist/components/cloudflare-builtin.mjs.map +1 -0
- package/dist/components/env-builtin.cjs +31 -0
- package/dist/components/env-builtin.d.cts +13 -0
- package/dist/components/env-builtin.d.cts.map +1 -0
- package/dist/components/env-builtin.d.mts +13 -0
- package/dist/components/env-builtin.d.mts.map +1 -0
- package/dist/components/env-builtin.mjs +30 -0
- package/dist/components/env-builtin.mjs.map +1 -0
- package/dist/components/index.cjs +7 -0
- package/dist/components/index.d.cts +4 -0
- package/dist/components/index.d.mts +4 -0
- package/dist/components/index.mjs +5 -0
- package/dist/components/worker-entry.cjs +202 -0
- package/dist/components/worker-entry.d.cts +17 -0
- package/dist/components/worker-entry.d.cts.map +1 -0
- package/dist/components/worker-entry.d.mts +17 -0
- package/dist/components/worker-entry.d.mts.map +1 -0
- package/dist/components/worker-entry.mjs +201 -0
- package/dist/components/worker-entry.mjs.map +1 -0
- package/dist/index.cjs +88 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +81 -0
- package/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/get-words.cjs +38 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/get-words.mjs +38 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/get-words.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/kebab-case.cjs +33 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/kebab-case.mjs +34 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/kebab-case.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.34/node_modules/@stryke/type-checks/dist/get-object-tag.cjs +15 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.34/node_modules/@stryke/type-checks/dist/get-object-tag.mjs +15 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.34/node_modules/@stryke/type-checks/dist/get-object-tag.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.34/node_modules/@stryke/type-checks/dist/is-function.cjs +25 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.34/node_modules/@stryke/type-checks/dist/is-function.mjs +26 -0
- package/dist/node_modules/.pnpm/@stryke_type-checks@0.5.34/node_modules/@stryke/type-checks/dist/is-function.mjs.map +1 -0
- package/dist/types/index.cjs +0 -0
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/plugin.cjs +0 -0
- package/dist/types/plugin.d.cts +63 -0
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +63 -0
- package/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.mjs +1 -0
- package/package.json +168 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare-builtin.mjs","names":["code","Show","splitProps","FunctionDeclaration","VarDeclaration","Spacing","BuiltinFile","InterfaceDeclaration","InterfaceMember","TSDoc","TSDocParam","TSDocReturns","defu","CloudflareBuiltin","props","imports","children","rest","_$createComponent","_$mergeProps","id","description","name","type","initializer","typeParameters","default","doc","_$createIntrinsic","heading","parameters","returnType","when","Boolean"],"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":";;;;;;;;;;;;;AA0CA,SAAgBa,kBAAkBC,OAA+B;CAC/D,MAAM,CAAC,EAAEC,SAASC,YAAYC,QAAQf,WAAWY,OAAO,CACtD,WACA,WACD,CAAC;AAEF,QAAAI,gBACGZ,aAAWa,WAAA;EACVC,IAAE;EACFC,aAAW;EAAA,EACPJ,MAAI;EAAA,IACRF,UAAO;AAAA,UAAEH,KACP;IACE,oBAAoB,CAAC,oBAAoB;IACzC,6BAA6B;KAC3B;MAAEU,MAAM;MAAWC,MAAM;MAAM;KAC/B;MAAED,MAAM;MAAYC,MAAM;MAAM;KAChC;MAAED,MAAM;MAAoBC,MAAM;MAAM;KACxC;MAAED,MAAM;MAA+BC,MAAM;MAAM;KACnD;MAAED,MAAM;MAAuBC,MAAM;MAAM;KAC3C;MAAED,MAAM;MAA2BC,MAAM;MAAM;KAC/C;MAAED,MAAM;MAAgBC,MAAM;MAAM;KACpC;MAAED,MAAM;MAAcC,MAAM;MAAM;KAClC;MAAED,MAAM;MAAaC,MAAM;MAAM;KACjC;MAAED,MAAM;MAAwBC,MAAM;MAAM;KAC5C;MAAED,MAAM;MAAoBC,MAAM;MAAM;KACxC;MAAED,MAAM;MAAmCC,MAAM;MAAM;KAAA;IAE1D,EACDR,WAAW,EACb,CAAC;;EAAA,IAAAC,WAAA;AAAA,UAAA;IAAAE,gBACAd,gBAAc;KAAA,SAAA;KAEbkB,MAAI;KACJE,aAAaxB,IAAI;KAAyD,CAAA;IAAAkB,gBAE3Eb,SAAO,EAAA,CAAA;IAAAa,gBACPb,SAAO,EAAA,CAAA;IAAAa,gBACPX,sBAAoB;KAAA,UAAA;KAEnBe,MAAI;KACJG,gBAAgB,CACd;MAAEH,MAAM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B,MAAI;KACJG,gBAAgB,CAAC;MAAEH,MAAM;MAAOI,SAAS;MAAsB,CAAC;KAChEI,YAAY,EAAE;KACdC,YAAU;KAAAf,UACThB,IAAI;;;;;KAIkC,CAAA;IAAA4B,gBAAA,OAAA,EAAA,CAAA;IAAAV,gBAGxCT,OAAK;KAACoB,SAAO;KAAA,IAAAb,WAAA;AAAA,aAAA;OAAAE,gBACXR,YAAU;QAACY,MAAI;QAAAN,UAAYhB,IAAI;QAAuD,CAAA;OAAAkB,gBACtFR,YAAU;QAACY,MAAI;QAAAN,UAAahB,IAAI;QAAmE,CAAA;OAAAkB,gBACnGP,cAAY,EAAAK,UAAEhB,IAAI,wCAAsC,CAAA;OAAA;;KAAA,CAAA;IAAAkB,gBAE1Df,qBAAmB;KAAA,UAAA;KAElBmB,MAAI;KACJG,gBAAgB,CAAC;MAAEH,MAAM;MAAOI,SAAS;MAAsB,CAAC;KAChEI,YAAY,CACV;MACER,MAAM;MACNC,MAAM;MACP,EACD;MACED,MAAM;MACNC,MAAM;MACP,CACF;KACDQ,YAAU;KAAAf,UACThB,IAAI;KAAmE,CAAA;IAAAkB,gBAEzEb,SAAO,EAAA,CAAA;IAAAa,gBACPb,SAAO,EAAA,CAAA;IAAAa,gBACPjB,MAAI;KAAA,IAAC+B,OAAI;AAAA,aAAEC,QAAQjB,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
let defu = require("defu");
|
|
5
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
6
|
+
let __powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
7
|
+
let __powerlines_plugin_env_components_env_builtin = require("@powerlines/plugin-env/components/env-builtin");
|
|
8
|
+
|
|
9
|
+
//#region src/components/env-builtin.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Generates the Cloudflare environment configuration module for the Powerlines project.
|
|
12
|
+
*/
|
|
13
|
+
function CloudflareEnvBuiltin(props) {
|
|
14
|
+
const [{ children, imports }, rest] = (0, __alloy_js_core.splitProps)(props, ["children", "imports"]);
|
|
15
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_env_components_env_builtin.EnvBuiltin, (0, __alloy_js_core_jsx_runtime.mergeProps)({ defaultConfig: __alloy_js_core.code`env` }, rest, {
|
|
16
|
+
get imports() {
|
|
17
|
+
return (0, defu.default)({ "cloudflare:workers": ["env"] }, imports ?? {});
|
|
18
|
+
},
|
|
19
|
+
get children() {
|
|
20
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
21
|
+
get when() {
|
|
22
|
+
return Boolean(children);
|
|
23
|
+
},
|
|
24
|
+
children
|
|
25
|
+
})];
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.CloudflareEnvBuiltin = CloudflareEnvBuiltin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
2
|
+
import { EnvBuiltinProps } from "@powerlines/plugin-env/components/env-builtin";
|
|
3
|
+
|
|
4
|
+
//#region src/components/env-builtin.d.ts
|
|
5
|
+
type CloudflareEnvBuiltinProps = Omit<EnvBuiltinProps, "defaultConfig">;
|
|
6
|
+
/**
|
|
7
|
+
* Generates the Cloudflare environment configuration module for the Powerlines project.
|
|
8
|
+
*/
|
|
9
|
+
declare function CloudflareEnvBuiltin(props: CloudflareEnvBuiltinProps): _alloy_js_core1.Children;
|
|
10
|
+
declare type __ΩCloudflareEnvBuiltinProps = any[];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { CloudflareEnvBuiltin, CloudflareEnvBuiltinProps, __ΩCloudflareEnvBuiltinProps };
|
|
13
|
+
//# sourceMappingURL=env-builtin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-builtin.d.cts","names":[],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":[],"mappings":";;;;KA0BY,yBAAA,GAA4B,KAAK;;;AAA7C;AAKgB,iBAAA,oBAAA,CAA4B,KAAA,EAAA,yBAAyB,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { EnvBuiltinProps } from "@powerlines/plugin-env/components/env-builtin";
|
|
3
|
+
|
|
4
|
+
//#region src/components/env-builtin.d.ts
|
|
5
|
+
type CloudflareEnvBuiltinProps = Omit<EnvBuiltinProps, "defaultConfig">;
|
|
6
|
+
/**
|
|
7
|
+
* Generates the Cloudflare environment configuration module for the Powerlines project.
|
|
8
|
+
*/
|
|
9
|
+
declare function CloudflareEnvBuiltin(props: CloudflareEnvBuiltinProps): _alloy_js_core0.Children;
|
|
10
|
+
declare type __ΩCloudflareEnvBuiltinProps = any[];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { CloudflareEnvBuiltin, CloudflareEnvBuiltinProps, __ΩCloudflareEnvBuiltinProps };
|
|
13
|
+
//# sourceMappingURL=env-builtin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-builtin.d.mts","names":[],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":[],"mappings":";;;;KA0BY,yBAAA,GAA4B,KAAK;;;AAA7C;AAKgB,iBAAA,oBAAA,CAA4B,KAAA,EAAA,yBAAyB,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { Show, code, splitProps } from "@alloy-js/core";
|
|
3
|
+
import defu from "defu";
|
|
4
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
5
|
+
import { EnvBuiltin } from "@powerlines/plugin-env/components/env-builtin";
|
|
6
|
+
|
|
7
|
+
//#region src/components/env-builtin.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Generates the Cloudflare environment configuration module for the Powerlines project.
|
|
10
|
+
*/
|
|
11
|
+
function CloudflareEnvBuiltin(props) {
|
|
12
|
+
const [{ children, imports }, rest] = splitProps(props, ["children", "imports"]);
|
|
13
|
+
return createComponent(EnvBuiltin, mergeProps({ defaultConfig: code`env` }, rest, {
|
|
14
|
+
get imports() {
|
|
15
|
+
return defu({ "cloudflare:workers": ["env"] }, imports ?? {});
|
|
16
|
+
},
|
|
17
|
+
get children() {
|
|
18
|
+
return [createComponent(Spacing, {}), createComponent(Show, {
|
|
19
|
+
get when() {
|
|
20
|
+
return Boolean(children);
|
|
21
|
+
},
|
|
22
|
+
children
|
|
23
|
+
})];
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { CloudflareEnvBuiltin };
|
|
30
|
+
//# sourceMappingURL=env-builtin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-builtin.mjs","names":["code","Show","splitProps","Spacing","EnvBuiltin","defu","CloudflareEnvBuiltin","props","children","imports","rest","_$createComponent","_$mergeProps","defaultConfig","when","Boolean"],"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":";;;;;;;;;;AA+BA,SAAgBM,qBAAqBC,OAAkC;CACrE,MAAM,CAAC,EAAEC,UAAUC,WAAWC,QAAQR,WAAWK,OAAO,CACtD,YACA,UACD,CAAC;AAEF,QAAAI,gBACGP,YAAUQ,WAAA,EACTC,eAAeb,IAAI,OAAK,EACpBU,MAAI;EAAA,IACRD,UAAO;AAAA,UAAEJ,KACP,EACE,sBAAsB,CAAC,MAAK,EAC7B,EACDI,WAAW,EACb,CAAC;;EAAA,IAAAD,WAAA;AAAA,UAAA,CAAAG,gBACAR,SAAO,EAAA,CAAA,EAAAQ,gBACPV,MAAI;IAAA,IAACa,OAAI;AAAA,YAAEC,QAAQP,SAAS;;IAAGA;IAAQ,CAAA,CAAA;;EAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const require_components_cloudflare_builtin = require('./cloudflare-builtin.cjs');
|
|
2
|
+
const require_components_env_builtin = require('./env-builtin.cjs');
|
|
3
|
+
const require_components_worker_entry = require('./worker-entry.cjs');
|
|
4
|
+
|
|
5
|
+
exports.CloudflareBuiltin = require_components_cloudflare_builtin.CloudflareBuiltin;
|
|
6
|
+
exports.CloudflareEnvBuiltin = require_components_env_builtin.CloudflareEnvBuiltin;
|
|
7
|
+
exports.WorkerEntry = require_components_worker_entry.WorkerEntry;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CloudflareBuiltin, CloudflareBuiltinProps, __ΩCloudflareBuiltinProps } from "./cloudflare-builtin.cjs";
|
|
2
|
+
import { CloudflareEnvBuiltin, CloudflareEnvBuiltinProps, __ΩCloudflareEnvBuiltinProps } from "./env-builtin.cjs";
|
|
3
|
+
import { WorkerEntry, WorkerEntryProps, __ΩWorkerEntryProps } from "./worker-entry.cjs";
|
|
4
|
+
export { CloudflareBuiltin, CloudflareBuiltinProps, CloudflareEnvBuiltin, CloudflareEnvBuiltinProps, WorkerEntry, WorkerEntryProps, __ΩCloudflareBuiltinProps, __ΩCloudflareEnvBuiltinProps, __ΩWorkerEntryProps };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CloudflareBuiltin, CloudflareBuiltinProps, __ΩCloudflareBuiltinProps } from "./cloudflare-builtin.mjs";
|
|
2
|
+
import { CloudflareEnvBuiltin, CloudflareEnvBuiltinProps, __ΩCloudflareEnvBuiltinProps } from "./env-builtin.mjs";
|
|
3
|
+
import { WorkerEntry, WorkerEntryProps, __ΩWorkerEntryProps } from "./worker-entry.mjs";
|
|
4
|
+
export { CloudflareBuiltin, CloudflareBuiltinProps, CloudflareEnvBuiltin, CloudflareEnvBuiltinProps, WorkerEntry, WorkerEntryProps, __ΩCloudflareBuiltinProps, __ΩCloudflareEnvBuiltinProps, __ΩWorkerEntryProps };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
let defu = require("defu");
|
|
5
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
6
|
+
let __powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
7
|
+
let __powerlines_plugin_alloy_core_contexts = require("@powerlines/plugin-alloy/core/contexts");
|
|
8
|
+
let __powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
9
|
+
let __stryke_hash = require("@stryke/hash");
|
|
10
|
+
let __stryke_path_find = require("@stryke/path/find");
|
|
11
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
12
|
+
|
|
13
|
+
//#region src/components/worker-entry.tsx
|
|
14
|
+
/**
|
|
15
|
+
* 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
|
+
*/
|
|
17
|
+
function WorkerEntry(props) {
|
|
18
|
+
const [{ worker, children, imports, builtinImports }, rest] = (0, __alloy_js_core.splitProps)(props, [
|
|
19
|
+
"worker",
|
|
20
|
+
"children",
|
|
21
|
+
"imports",
|
|
22
|
+
"builtinImports"
|
|
23
|
+
]);
|
|
24
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts.usePowerlines)();
|
|
25
|
+
const entryPath = (0, __alloy_js_core.computed)(() => `./${(0, __stryke_path_replace.replaceExtension)((0, __stryke_path_find.relativePath)(context.entryPath, worker.entry.input?.file || worker.entry.file))}`);
|
|
26
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({ get path() {
|
|
27
|
+
return `worker-${(0, __stryke_hash.murmurhash)(worker.entry, { maxLength: 8 })}-entry.ts`;
|
|
28
|
+
} }, rest, {
|
|
29
|
+
get imports() {
|
|
30
|
+
return (0, defu.default)({
|
|
31
|
+
"@cloudflare/workers-types": [
|
|
32
|
+
{
|
|
33
|
+
name: "Request",
|
|
34
|
+
type: true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "Response",
|
|
38
|
+
type: true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "ExecutionContext",
|
|
42
|
+
type: true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "IncomingRequestCfProperties",
|
|
46
|
+
type: true
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "ScheduledController",
|
|
50
|
+
type: true
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "ForwardableEmailMessage",
|
|
54
|
+
type: true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "MessageBatch",
|
|
58
|
+
type: true
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "TailStream",
|
|
62
|
+
type: true
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "TraceItem",
|
|
66
|
+
type: true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "TailStream.TailEvent",
|
|
70
|
+
type: true
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "TailStream.Onset",
|
|
74
|
+
type: true
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "TailStream.TailEventHandlerType",
|
|
78
|
+
type: true
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
[entryPath.value]: "worker"
|
|
82
|
+
}, imports ?? {});
|
|
83
|
+
},
|
|
84
|
+
get builtinImports() {
|
|
85
|
+
return (0, defu.default)({ cloudflare: [
|
|
86
|
+
"withFetchContext",
|
|
87
|
+
"withTailContext",
|
|
88
|
+
"withTraceContext",
|
|
89
|
+
"withTailStreamContext",
|
|
90
|
+
"withScheduledContext",
|
|
91
|
+
"withTestContext",
|
|
92
|
+
"withEmailContext",
|
|
93
|
+
"withQueueContext"
|
|
94
|
+
] }, builtinImports ?? {});
|
|
95
|
+
},
|
|
96
|
+
get children() {
|
|
97
|
+
return [
|
|
98
|
+
__alloy_js_core.code`export default { `,
|
|
99
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
100
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
101
|
+
get when() {
|
|
102
|
+
return worker.fetch;
|
|
103
|
+
},
|
|
104
|
+
children: __alloy_js_core.code` async fetch(request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: CloudflareBindings, ctx: ExecutionContext): Promise<Response> {
|
|
105
|
+
return await withFetchContext({ request, env, ctx }, async (context) => {
|
|
106
|
+
return worker.fetch(context.request, context.env, context.ctx);
|
|
107
|
+
});
|
|
108
|
+
}, `
|
|
109
|
+
}),
|
|
110
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
111
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
112
|
+
get when() {
|
|
113
|
+
return worker.tail;
|
|
114
|
+
},
|
|
115
|
+
children: __alloy_js_core.code` async tail(events: TraceItem[], env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
|
|
116
|
+
return withTailContext({ events, env, ctx }, async (context) => {
|
|
117
|
+
return worker.tail(context.events, context.env, context.ctx);
|
|
118
|
+
});
|
|
119
|
+
}, `
|
|
120
|
+
}),
|
|
121
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
122
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
123
|
+
get when() {
|
|
124
|
+
return worker.trace;
|
|
125
|
+
},
|
|
126
|
+
children: __alloy_js_core.code` async trace(traces: TraceItem[], env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
|
|
127
|
+
return withTraceContext({ traces, env, ctx }, async (context) => {
|
|
128
|
+
return worker.trace(context.traces, context.env, context.ctx);
|
|
129
|
+
});
|
|
130
|
+
}, `
|
|
131
|
+
}),
|
|
132
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
133
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
134
|
+
get when() {
|
|
135
|
+
return worker.tailStream;
|
|
136
|
+
},
|
|
137
|
+
children: __alloy_js_core.code` async tailStream(event: TailStream.TailEvent<TailStream.Onset>, env: CloudflareBindings, ctx: ExecutionContext): Promise<ReadableStream> {
|
|
138
|
+
return await withTailStreamContext({ event, env, ctx }, async (context) => {
|
|
139
|
+
return await worker.tailStream(context.event, context.env, context.ctx);
|
|
140
|
+
});
|
|
141
|
+
}, `
|
|
142
|
+
}),
|
|
143
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
144
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
145
|
+
get when() {
|
|
146
|
+
return worker.scheduled;
|
|
147
|
+
},
|
|
148
|
+
children: __alloy_js_core.code` async scheduled(controller: ScheduledController, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
|
|
149
|
+
return withScheduledContext({ controller, env, ctx }, async (context) => {
|
|
150
|
+
return worker.scheduled(context.controller, context.env, context.ctx);
|
|
151
|
+
});
|
|
152
|
+
}, `
|
|
153
|
+
}),
|
|
154
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
155
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
156
|
+
get when() {
|
|
157
|
+
return worker.test;
|
|
158
|
+
},
|
|
159
|
+
children: __alloy_js_core.code` async test(controller: TestController, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
|
|
160
|
+
return withTestContext({ controller, env, ctx }, async (context) => {
|
|
161
|
+
return worker.test(context.controller, context.env, context.ctx);
|
|
162
|
+
});
|
|
163
|
+
}, `
|
|
164
|
+
}),
|
|
165
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
166
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
167
|
+
get when() {
|
|
168
|
+
return worker.email;
|
|
169
|
+
},
|
|
170
|
+
children: __alloy_js_core.code` async email(message: ForwardableEmailMessage, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
|
|
171
|
+
return withEmailContext({ message, env, ctx }, async (context) => {
|
|
172
|
+
return worker.email(context.message, context.env, context.ctx);
|
|
173
|
+
});
|
|
174
|
+
}, `
|
|
175
|
+
}),
|
|
176
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
177
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
178
|
+
get when() {
|
|
179
|
+
return worker.queue;
|
|
180
|
+
},
|
|
181
|
+
children: __alloy_js_core.code` async queue(batch: MessageBatch, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
|
|
182
|
+
return withQueueContext({ batch, env, ctx }, async (context) => {
|
|
183
|
+
return worker.queue(context.batch, context.env, context.ctx);
|
|
184
|
+
});
|
|
185
|
+
}, `
|
|
186
|
+
}),
|
|
187
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
188
|
+
__alloy_js_core.code` } satisfies ExportedHandler<CloudflareBindings>; `,
|
|
189
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
190
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
191
|
+
get when() {
|
|
192
|
+
return Boolean(children);
|
|
193
|
+
},
|
|
194
|
+
children
|
|
195
|
+
})
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
//#endregion
|
|
202
|
+
exports.WorkerEntry = WorkerEntry;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CloudflareWorkerEntryModule } from "../types/plugin.cjs";
|
|
2
|
+
import "../types/index.cjs";
|
|
3
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
4
|
+
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
5
|
+
|
|
6
|
+
//#region src/components/worker-entry.d.ts
|
|
7
|
+
type WorkerEntryProps = Partial<EntryFileProps> & Omit<EntryFileProps, "path"> & {
|
|
8
|
+
worker: CloudflareWorkerEntryModule;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 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.
|
|
12
|
+
*/
|
|
13
|
+
declare function WorkerEntry(props: WorkerEntryProps): _alloy_js_core0.Children;
|
|
14
|
+
declare type __ΩWorkerEntryProps = any[];
|
|
15
|
+
//#endregion
|
|
16
|
+
export { WorkerEntry, WorkerEntryProps, __ΩWorkerEntryProps };
|
|
17
|
+
//# sourceMappingURL=worker-entry.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-entry.d.cts","names":[],"sources":["../../src/components/worker-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;KA+BY,gBAAA,GAAmB,QAAQ,kBACrC,KAAK;UACK;;;AAFZ;;AAA+B,iBAQf,WAAA,CARe,KAAA,EAQI,gBARJ,CAAA,EAQoB,eAAA,CAAA,QARpB;AACxB,mCAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CloudflareWorkerEntryModule } from "../types/plugin.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
3
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
4
|
+
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
5
|
+
|
|
6
|
+
//#region src/components/worker-entry.d.ts
|
|
7
|
+
type WorkerEntryProps = Partial<EntryFileProps> & Omit<EntryFileProps, "path"> & {
|
|
8
|
+
worker: CloudflareWorkerEntryModule;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 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.
|
|
12
|
+
*/
|
|
13
|
+
declare function WorkerEntry(props: WorkerEntryProps): _alloy_js_core0.Children;
|
|
14
|
+
declare type __ΩWorkerEntryProps = any[];
|
|
15
|
+
//#endregion
|
|
16
|
+
export { WorkerEntry, WorkerEntryProps, __ΩWorkerEntryProps };
|
|
17
|
+
//# sourceMappingURL=worker-entry.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-entry.d.mts","names":[],"sources":["../../src/components/worker-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;KA+BY,gBAAA,GAAmB,QAAQ,kBACrC,KAAK;UACK;;;AAFZ;;AAA+B,iBAQf,WAAA,CARe,KAAA,EAQI,gBARJ,CAAA,EAQoB,eAAA,CAAA,QARpB;AACxB,mCAAA,GAAA,EAAA"}
|