@powerlines/plugin-cloudflare 0.6.56 → 0.6.57
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/package.json +8 -8
- package/dist/_virtual/_rolldown/runtime.cjs +0 -1
- package/dist/components/cloudflare-builtin.cjs +0 -33
- package/dist/components/cloudflare-builtin.d.cts +0 -12
- package/dist/components/cloudflare-builtin.d.cts.map +0 -1
- package/dist/components/cloudflare-builtin.d.mts +0 -12
- package/dist/components/cloudflare-builtin.d.mts.map +0 -1
- package/dist/components/cloudflare-builtin.mjs +0 -34
- package/dist/components/cloudflare-builtin.mjs.map +0 -1
- package/dist/components/env-builtin.cjs +0 -1
- package/dist/components/env-builtin.d.cts +0 -12
- package/dist/components/env-builtin.d.cts.map +0 -1
- package/dist/components/env-builtin.d.mts +0 -12
- package/dist/components/env-builtin.d.mts.map +0 -1
- package/dist/components/env-builtin.mjs +0 -2
- package/dist/components/env-builtin.mjs.map +0 -1
- package/dist/components/index.cjs +0 -1
- package/dist/components/index.d.cts +0 -4
- package/dist/components/index.d.mts +0 -4
- package/dist/components/index.mjs +0 -1
- package/dist/components/worker-entry.cjs +0 -33
- package/dist/components/worker-entry.d.cts +0 -15
- package/dist/components/worker-entry.d.cts.map +0 -1
- package/dist/components/worker-entry.d.mts +0 -15
- package/dist/components/worker-entry.d.mts.map +0 -1
- package/dist/components/worker-entry.mjs +0 -34
- package/dist/components/worker-entry.mjs.map +0 -1
- package/dist/helpers/constants.cjs +0 -1
- package/dist/helpers/constants.d.cts +0 -5
- package/dist/helpers/constants.d.cts.map +0 -1
- package/dist/helpers/constants.d.mts +0 -5
- package/dist/helpers/constants.d.mts.map +0 -1
- package/dist/helpers/constants.mjs +0 -2
- package/dist/helpers/constants.mjs.map +0 -1
- package/dist/helpers/wrangler.cjs +0 -1
- package/dist/helpers/wrangler.d.cts +0 -36
- package/dist/helpers/wrangler.d.cts.map +0 -1
- package/dist/helpers/wrangler.d.mts +0 -36
- package/dist/helpers/wrangler.d.mts.map +0 -1
- package/dist/helpers/wrangler.mjs +0 -2
- package/dist/helpers/wrangler.mjs.map +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +0 -21
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -21
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -2
- package/dist/index.mjs.map +0 -1
- package/dist/types/index.cjs +0 -1
- package/dist/types/index.d.cts +0 -4
- package/dist/types/index.d.mts +0 -4
- package/dist/types/index.mjs +0 -1
- package/dist/types/plugin.cjs +0 -0
- package/dist/types/plugin.d.cts +0 -91
- package/dist/types/plugin.d.cts.map +0 -1
- package/dist/types/plugin.d.mts +0 -91
- package/dist/types/plugin.d.mts.map +0 -1
- package/dist/types/plugin.mjs +0 -1
- package/dist/types/worker-module.cjs +0 -0
- package/dist/types/worker-module.d.cts +0 -42
- package/dist/types/worker-module.d.cts.map +0 -1
- package/dist/types/worker-module.d.mts +0 -42
- package/dist/types/worker-module.d.mts.map +0 -1
- package/dist/types/worker-module.mjs +0 -1
- package/dist/types/wrangler.cjs +0 -1
- package/dist/types/wrangler.d.cts +0 -40
- package/dist/types/wrangler.d.cts.map +0 -1
- package/dist/types/wrangler.d.mts +0 -40
- package/dist/types/wrangler.d.mts.map +0 -1
- package/dist/types/wrangler.mjs +0 -2
- package/dist/types/wrangler.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
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":"ujBA+BA,SAAY,EAAgB,EAAG,CAC7B,GAAK,CAAA,CACH,SACD,WAAA,UAED,kBACC,GAAU,EAAG,EAAW,CAAA,SAAe,WAAY,UAAW,iBAAY,CAAA,CAC3E,EAAA,GAAA,CACK,EAAS,MAAmB,KAAA,EAAkB,EAAA,EAAA,UAAA,EAAA,SAAA,MAAA,OAAA,MAAA,EAAA,SAAA,MAAA,KAAA,CAAA,GAAA,CACnD,OAAO,EAAkB,EAAW,EAAA,CAClC,IAAA,MAAK,CACH,MAAO,UAAG,EAAY,EAAW,SAAA,MAAe,CACnD,UAAA,EAAA,CAAA,CAAA,YAGD,CAAA,EAAM,CACJ,IAAI,SAAA,CACF,OAAK,EAAA,CACH,4BAAY,CAAA,CACV,KAAA,UACA,KAAM,GACR,CAAA,CACA,KAAA,WACL,KAAA,KAEM,KAAA,mBACJ,KAAA,GACC,CAAK,CACH,KAAA,8BACE,KAAM,GACP,CAAC,CACJ,KAAS,sBACP,KAAA,GACC,CAAE,CACD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AE,MAAO,CACP,OAAA,EAAA,OAEF,SAAI,CAAA;;;;WAKL,CAAC,CAAE,EAAc,MAAM,EAAO,CAAC,CAAA,EAAoB,EAAA,CAClD,IAAE,MAAA,CACA,OAAA,EAAA,OAEH,SAAK,CAAA;;;;WAKT,CAAA,CAAA,EAAA,MAAA,EAAA,CAAA,CAAA,CAAA,qDAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACH,IAAA,MAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),exports.PATH_TO_DEPLOY_CONFIG=`.wrangler/deploy/config.json`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.cts","names":[],"sources":["../../src/helpers/constants.ts"],"mappings":";cAkBa,qBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.mts","names":[],"sources":["../../src/helpers/constants.ts"],"mappings":";cAkBa,qBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","names":[],"sources":["../../src/helpers/constants.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\nexport const PATH_TO_DEPLOY_CONFIG = \".wrangler/deploy/config.json\";\n"],"mappings":"AAkBA,MAAa,EAAwB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@stryke/path`);function t(t){for(let n of[`jsonc`,`json`,`toml`])if(t.fs.existsSync((0,e.joinPaths)(t.config.root,`wrangler.${n}`)))return(0,e.joinPaths)(t.config.root,`wrangler.${n}`)}exports.resolveWranglerConfigPath=t;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { UnresolvedContext } from "powerlines";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/wrangler.d.ts
|
|
4
|
-
interface ResolveConfigPathOptions {
|
|
5
|
-
useRedirectIfAvailable?: boolean;
|
|
6
|
-
}
|
|
7
|
-
interface ConfigPaths {
|
|
8
|
-
/**
|
|
9
|
-
* Absolute path to the actual configuration being used (possibly redirected from the user's config).
|
|
10
|
-
*/
|
|
11
|
-
configPath: string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Absolute path to the user's configuration, which may not be the same as `configPath` if it was redirected.
|
|
14
|
-
*/
|
|
15
|
-
userConfigPath: string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Absolute path to the deploy config path used
|
|
18
|
-
*/
|
|
19
|
-
deployConfigPath: string | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Was a redirected config file read?
|
|
22
|
-
*/
|
|
23
|
-
redirected: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Resolves the Wrangler configuration file path by checking for allowed extensions in the specified root directory.
|
|
27
|
-
*
|
|
28
|
-
* @param context - The Cloudflare plugin context containing the configuration and file system access.
|
|
29
|
-
* @returns The absolute path to the found configuration file, or undefined if no file is found.
|
|
30
|
-
*/
|
|
31
|
-
declare function resolveWranglerConfigPath(context: UnresolvedContext): string | undefined;
|
|
32
|
-
declare type __ΩResolveConfigPathOptions = any[];
|
|
33
|
-
declare type __ΩConfigPaths = any[];
|
|
34
|
-
//#endregion
|
|
35
|
-
export { ConfigPaths, ResolveConfigPathOptions, __ΩConfigPaths, __ΩResolveConfigPathOptions, resolveWranglerConfigPath };
|
|
36
|
-
//# sourceMappingURL=wrangler.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wrangler.d.cts","names":[],"sources":["../../src/helpers/wrangler.ts"],"mappings":";;;UAqBiB,wBAAA;EACf,sBAAA;AAAA;AAAA,UAGe,WAAA;;;;EAIf,UAAA;EAJ0B;;;EAQ1B,cAAA;EAAA;;;EAIA,gBAAA;EAIU;AASZ;;EATE,UAAA;AAAA;;;;;;;iBASc,yBAAA,CACd,OAAA,EAAS,iBAAA;AAAA"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { UnresolvedContext } from "powerlines";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/wrangler.d.ts
|
|
4
|
-
interface ResolveConfigPathOptions {
|
|
5
|
-
useRedirectIfAvailable?: boolean;
|
|
6
|
-
}
|
|
7
|
-
interface ConfigPaths {
|
|
8
|
-
/**
|
|
9
|
-
* Absolute path to the actual configuration being used (possibly redirected from the user's config).
|
|
10
|
-
*/
|
|
11
|
-
configPath: string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Absolute path to the user's configuration, which may not be the same as `configPath` if it was redirected.
|
|
14
|
-
*/
|
|
15
|
-
userConfigPath: string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Absolute path to the deploy config path used
|
|
18
|
-
*/
|
|
19
|
-
deployConfigPath: string | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Was a redirected config file read?
|
|
22
|
-
*/
|
|
23
|
-
redirected: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Resolves the Wrangler configuration file path by checking for allowed extensions in the specified root directory.
|
|
27
|
-
*
|
|
28
|
-
* @param context - The Cloudflare plugin context containing the configuration and file system access.
|
|
29
|
-
* @returns The absolute path to the found configuration file, or undefined if no file is found.
|
|
30
|
-
*/
|
|
31
|
-
declare function resolveWranglerConfigPath(context: UnresolvedContext): string | undefined;
|
|
32
|
-
declare type __ΩResolveConfigPathOptions = any[];
|
|
33
|
-
declare type __ΩConfigPaths = any[];
|
|
34
|
-
//#endregion
|
|
35
|
-
export { ConfigPaths, ResolveConfigPathOptions, __ΩConfigPaths, __ΩResolveConfigPathOptions, resolveWranglerConfigPath };
|
|
36
|
-
//# sourceMappingURL=wrangler.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wrangler.d.mts","names":[],"sources":["../../src/helpers/wrangler.ts"],"mappings":";;;UAqBiB,wBAAA;EACf,sBAAA;AAAA;AAAA,UAGe,WAAA;;;;EAIf,UAAA;EAJ0B;;;EAQ1B,cAAA;EAAA;;;EAIA,gBAAA;EAIU;AASZ;;EATE,UAAA;AAAA;;;;;;;iBASc,yBAAA,CACd,OAAA,EAAS,iBAAA;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
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":"yCA0BA,SAAI,EAAA,EAAA,CACF,IAAG,IAAQ,IAAa,CAAA,QAAO,OAAA,OAAc,CAC3C,GAAA,EAAA,GAAA,WAAA,EAAA,EAAA,OAAA,KAAA,YAAA,IAAA,CAAA,CACF,OAAW,EAAU,EAAA,OAAS,KAAA,YAAA,IAAA"}
|
package/dist/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./components/cloudflare-builtin.cjs`),n=require(`./components/env-builtin.cjs`),r=require(`./components/worker-entry.cjs`);require(`./components/index.cjs`);const i=require(`./helpers/wrangler.cjs`);let a=require(`@alloy-js/core/jsx-runtime`),o=require(`@alloy-js/core`),s=require(`@cloudflare/unenv-preset`),c=require(`@powerlines/plugin-alloy/render`),l=require(`@powerlines/plugin-env/helpers`),u=require(`@powerlines/plugin-esbuild/helpers/resolve`),d=require(`@powerlines/plugin-pulumi`);d=e.__toESM(d);let f=require(`@powerlines/plugin-unenv`);f=e.__toESM(f);let p=require(`@pulumi/cloudflare`);p=e.__toESM(p);let m=require(`@stryke/helpers/omit`),h=require(`@stryke/path`),g=require(`@stryke/string-format/kebab-case`),_=require(`@stryke/type-checks/is-function`),v=require(`defu`);v=e.__toESM(v);let y=require(`wrangler`);function b(e={}){return[(0,f.default)(e.unenv),...(0,d.default)(e.pulumi),{name:`cloudflare`,config(){return{cloudflare:(0,v.default)((0,m.omit)(e,[`unenv`,`pulumi`]),{configPath:i.resolveWranglerConfigPath(this)}),resolve:{skipNodeModulesBundle:!1},unenv:{presets:[(0,s.getCloudflarePreset)({compatibilityDate:this.config.compatibilityDate?.toString(),compatibilityFlags:[`nodejs_als`]})]}}},configResolved(){this.devDependencies[`@cloudflare/workers-types`]=`^4.20240616.0`;let e=(0,y.unstable_readConfig)({config:this.config.cloudflare?.configPath},{preserveOriginalMain:!0,hideWarnings:!0});this.cloudflare.wrangler=structuredClone(e)},async prepare(){let e=await(0,l.readEnvTypeReflection)(this,`env`);return(0,c.render)(this,[(0,a.createComponent)(t.CloudflareBuiltin,{}),(0,a.createComponent)(n.CloudflareEnvBuiltin,{reflection:e})])},build:{order:`pre`,async handler(){let e=this;return this.cloudflare??={workers:[]},this.cloudflare.workers=await Promise.all(this.entry.map(async(e,t,n)=>{if(!e.input)throw Error(`Cloudflare Worker entry "${e.file}" is missing an input file.`);let r=await(0,u.resolveModule)(this,e.input);if(!r?.default)throw Error(`Cloudflare Worker entry "${e.file}" does not export a default handler. The Powerlines Cloudflare plugin expects each Worker entry module to export a default object matching the \`ExportedHandler\` interface from "@cloudflare/workers-types".`);let i=r.metadata?.name||(0,h.replaceExtension)(e.input.file||e.file)||n.length>1?`${this.config.name}-${t}`:this.config.name;return{metadata:{name:i,pattern:`${i}.{domain}`,entry:e},fetch:(0,_.isFunction)(r.default.fetch),tail:(0,_.isFunction)(r.default.tail),trace:(0,_.isFunction)(r.default.trace),tailStream:(0,_.isFunction)(r.default.tailStream),scheduled:(0,_.isFunction)(r.default.scheduled),test:(0,_.isFunction)(r.default.test),email:(0,_.isFunction)(r.default.email),queue:(0,_.isFunction)(r.default.queue)}})),(0,c.render)(this,(0,a.createComponent)(o.For,{get each(){return e.cloudflare.workers},children:e=>(0,a.createComponent)(r.WorkerEntry,{worker:e})}))}},async deploy(){let e=process.env.CLOUDFLARE_API_TOKEN;if(!e)if(e=this.config.cloudflare.apiToken,e)this.warn("If possible, please use the `CLOUDFLARE_API_TOKEN` environment variable instead of using the `apiToken` option directly. The `apiToken` option will work; however, this is a less secure method of configuration.");else throw Error("Unable to determine the Cloudflare API token. Please set the `CLOUDFLARE_API_TOKEN` environment variable.")},pulumi:{async deploy(){let e=process.env.CLOUDFLARE_API_TOKEN;if(!e)if(e=this.config.cloudflare.apiToken,e)this.warn("If possible, please use the `CLOUDFLARE_API_TOKEN` environment variable instead of using the `apiToken` option directly. The `apiToken` option will work; however, this is a less secure method of configuration.");else throw Error("Unable to determine the Cloudflare API token. Please set the `CLOUDFLARE_API_TOKEN` environment variable.");await this.pulumi.setConfig(`cloudflare:apiToken`,{value:e});let t=new p.Provider(`cloudflare-provider`,{apiToken:e}),n=await p.getZone({filter:{account:{id:this.config.cloudflare.accountId},name:this.config.cloudflare.domain}},{provider:t}),r=[],i=[],a=[],o=[],s=[];for(let e of this.cloudflare.workers){let c=new p.Worker(`${this.config.organization?`${this.config.organization}.`:``}${(0,g.kebabCase)(this.config.name)===(0,g.kebabCase)(e.metadata.name)?(0,g.kebabCase)(this.config.name):`${(0,g.kebabCase)(this.config.name)}.${(0,g.kebabCase)(e.metadata.name)}`}.${(0,g.kebabCase)(this.config.mode)}.worker`,(0,v.default)({accountId:this.config.cloudflare.accountId,name:e.metadata.name,tags:[`project:${(0,g.kebabCase)(this.config.name)}`,this.config.organization?`organization:${(0,g.kebabCase)(this.config.organization)}`:void 0,this.config.mode?`mode:${(0,g.kebabCase)(this.config.mode)}`:void 0].filter(Boolean)},e.metadata),{provider:t});r.push(c);let l=new p.WorkerVersion(`${this.config.organization?`${this.config.organization}.`:``}${(0,g.kebabCase)(this.config.name)===(0,g.kebabCase)(e.metadata.name)?(0,g.kebabCase)(this.config.name):`${(0,g.kebabCase)(this.config.name)}.${(0,g.kebabCase)(e.metadata.name)}`}.${(0,g.kebabCase)(this.config.mode)}.worker-version`,(0,v.default)({accountId:this.config.cloudflare.accountId,workerId:c.id,mainModule:(0,h.joinPaths)(this.config.output.path,`index.mjs`),modules:[{name:(0,h.joinPaths)(this.config.output.path,`index.mjs`),contentType:`application/javascript+module`,contentFile:(0,h.joinPaths)(this.config.output.path,`index.mjs`)}]},e.metadata,{compatibilityDate:this.config.compatibilityDate?.cloudflare?.toString(),compatibilityFlags:[`nodejs_als`]}),{provider:t});i.push(l);let u=new p.WorkersDeployment(`${this.config.organization?`${this.config.organization}.`:``}${(0,g.kebabCase)(this.config.name)===(0,g.kebabCase)(e.metadata.name)?(0,g.kebabCase)(this.config.name):`${(0,g.kebabCase)(this.config.name)}-${(0,g.kebabCase)(e.metadata.name)}`}.${(0,g.kebabCase)(this.config.mode)}.workers-deployment`,(0,v.default)({accountId:this.config.cloudflare.accountId,zoneId:n.id,strategy:`percentage`,scriptName:c.name,versions:[{percentage:100,versionId:l.id}]}),{provider:t});a.push(u);let d=new p.WorkersRoute(`${this.config.organization?`${this.config.organization}.`:``}${(0,g.kebabCase)(this.config.name)===(0,g.kebabCase)(e.metadata.name)?(0,g.kebabCase)(this.config.name):`${(0,g.kebabCase)(this.config.name)}-${(0,g.kebabCase)(e.metadata.name)}`}.${(0,g.kebabCase)(this.config.mode)}.workers-route`,(0,v.default)({accountId:this.config.cloudflare.accountId,zoneId:n.id,pattern:e.metadata.pattern.replace(`{domain}`,this.config.cloudflare.domain).replace(`{scriptName}`,e.metadata.name).replace(`{mode}`,this.config.mode),script:c.name}),{provider:t});o.push(d);let f=new p.DnsRecord(`${this.config.organization?`${this.config.organization}.`:``}${(0,g.kebabCase)(this.config.name)===(0,g.kebabCase)(e.metadata.name)?(0,g.kebabCase)(this.config.name):`${(0,g.kebabCase)(this.config.name)}-${(0,g.kebabCase)(e.metadata.name)}`}.${(0,g.kebabCase)(this.config.mode)}.dns-record`,{name:d.pattern,type:`A`,content:`192.0.2.1`,zoneId:n.id,proxied:!0,ttl:1},{provider:t});s.push(f)}return{workers:r,workerVersions:i,workersDeployments:a,workersRoutes:o,dnsRecords:s}}}}]}exports.CloudflareBuiltin=t.CloudflareBuiltin,exports.CloudflareEnvBuiltin=n.CloudflareEnvBuiltin,exports.WorkerEntry=r.WorkerEntry,exports.default=b,exports.plugin=b;
|
package/dist/index.d.cts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { CloudflareBuiltin, CloudflareBuiltinProps, __ΩCloudflareBuiltinProps } from "./components/cloudflare-builtin.cjs";
|
|
2
|
-
import { CloudflareEnvBuiltin, CloudflareEnvBuiltinProps, __ΩCloudflareEnvBuiltinProps } from "./components/env-builtin.cjs";
|
|
3
|
-
import { Json, JsonSchema, Literal, LiteralSchema, OptionalZodTypeOf, PathSchema, WranglerResolvedConfig, WranglerUserConfig, __ΩJson, __ΩLiteral, __ΩOptionalZodTypeOf, __ΩWranglerResolvedConfig, __ΩWranglerUserConfig, defaultWranglerConfig, isCyclic, parseWithRootPath } from "./types/wrangler.cjs";
|
|
4
|
-
import { WorkerModule, WorkerModuleMetadata, __ΩWorkerModule, __ΩWorkerModuleMetadata } from "./types/worker-module.cjs";
|
|
5
|
-
import { CloudflarePluginContext, CloudflarePluginOptions, CloudflarePluginResolvedConfig, CloudflarePluginUserConfig, CloudflareWorkerEntryModule, CloudflareWorkerMetadata, __ΩCloudflarePluginContext, __ΩCloudflarePluginOptions, __ΩCloudflarePluginResolvedConfig, __ΩCloudflarePluginUserConfig, __ΩCloudflareWorkerEntryModule, __ΩCloudflareWorkerMetadata } from "./types/plugin.cjs";
|
|
6
|
-
import { WorkerEntry, WorkerEntryProps, __ΩWorkerEntryProps } from "./components/worker-entry.cjs";
|
|
7
|
-
import { Plugin } from "powerlines";
|
|
8
|
-
|
|
9
|
-
//#region src/index.d.ts
|
|
10
|
-
declare module "powerlines" {
|
|
11
|
-
interface Config {
|
|
12
|
-
cloudflare?: CloudflarePluginOptions;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
17
|
-
*/
|
|
18
|
-
declare function plugin<TContext extends CloudflarePluginContext = CloudflarePluginContext>(options?: CloudflarePluginOptions): Plugin<TContext>[];
|
|
19
|
-
//#endregion
|
|
20
|
-
export { CloudflareBuiltin, CloudflareBuiltinProps, CloudflareEnvBuiltin, CloudflareEnvBuiltinProps, CloudflarePluginContext, CloudflarePluginOptions, CloudflarePluginResolvedConfig, CloudflarePluginUserConfig, CloudflareWorkerEntryModule, CloudflareWorkerMetadata, Json, JsonSchema, Literal, LiteralSchema, OptionalZodTypeOf, PathSchema, WorkerEntry, WorkerEntryProps, WorkerModule, WorkerModuleMetadata, WranglerResolvedConfig, WranglerUserConfig, __ΩCloudflareBuiltinProps, __ΩCloudflareEnvBuiltinProps, __ΩCloudflarePluginContext, __ΩCloudflarePluginOptions, __ΩCloudflarePluginResolvedConfig, __ΩCloudflarePluginUserConfig, __ΩCloudflareWorkerEntryModule, __ΩCloudflareWorkerMetadata, __ΩJson, __ΩLiteral, __ΩOptionalZodTypeOf, __ΩWorkerEntryProps, __ΩWorkerModule, __ΩWorkerModuleMetadata, __ΩWranglerResolvedConfig, __ΩWranglerUserConfig, plugin as default, plugin, defaultWranglerConfig, isCyclic, parseWithRootPath };
|
|
21
|
-
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;;;;YAmDY,MAAA;IACR,UAAA,GAAa,uBAAA;EAAA;AAAA;;;AAJY;iBAWb,MAAA,kBACG,uBAAA,GAA0B,uBAAA,CAAA,CAC3C,OAAA,GAAS,uBAAA,GAA+B,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { CloudflareBuiltin, CloudflareBuiltinProps, __ΩCloudflareBuiltinProps } from "./components/cloudflare-builtin.mjs";
|
|
2
|
-
import { CloudflareEnvBuiltin, CloudflareEnvBuiltinProps, __ΩCloudflareEnvBuiltinProps } from "./components/env-builtin.mjs";
|
|
3
|
-
import { Json, JsonSchema, Literal, LiteralSchema, OptionalZodTypeOf, PathSchema, WranglerResolvedConfig, WranglerUserConfig, __ΩJson, __ΩLiteral, __ΩOptionalZodTypeOf, __ΩWranglerResolvedConfig, __ΩWranglerUserConfig, defaultWranglerConfig, isCyclic, parseWithRootPath } from "./types/wrangler.mjs";
|
|
4
|
-
import { WorkerModule, WorkerModuleMetadata, __ΩWorkerModule, __ΩWorkerModuleMetadata } from "./types/worker-module.mjs";
|
|
5
|
-
import { CloudflarePluginContext, CloudflarePluginOptions, CloudflarePluginResolvedConfig, CloudflarePluginUserConfig, CloudflareWorkerEntryModule, CloudflareWorkerMetadata, __ΩCloudflarePluginContext, __ΩCloudflarePluginOptions, __ΩCloudflarePluginResolvedConfig, __ΩCloudflarePluginUserConfig, __ΩCloudflareWorkerEntryModule, __ΩCloudflareWorkerMetadata } from "./types/plugin.mjs";
|
|
6
|
-
import { WorkerEntry, WorkerEntryProps, __ΩWorkerEntryProps } from "./components/worker-entry.mjs";
|
|
7
|
-
import { Plugin } from "powerlines";
|
|
8
|
-
|
|
9
|
-
//#region src/index.d.ts
|
|
10
|
-
declare module "powerlines" {
|
|
11
|
-
interface Config {
|
|
12
|
-
cloudflare?: CloudflarePluginOptions;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
17
|
-
*/
|
|
18
|
-
declare function plugin<TContext extends CloudflarePluginContext = CloudflarePluginContext>(options?: CloudflarePluginOptions): Plugin<TContext>[];
|
|
19
|
-
//#endregion
|
|
20
|
-
export { CloudflareBuiltin, CloudflareBuiltinProps, CloudflareEnvBuiltin, CloudflareEnvBuiltinProps, CloudflarePluginContext, CloudflarePluginOptions, CloudflarePluginResolvedConfig, CloudflarePluginUserConfig, CloudflareWorkerEntryModule, CloudflareWorkerMetadata, Json, JsonSchema, Literal, LiteralSchema, OptionalZodTypeOf, PathSchema, WorkerEntry, WorkerEntryProps, WorkerModule, WorkerModuleMetadata, WranglerResolvedConfig, WranglerUserConfig, __ΩCloudflareBuiltinProps, __ΩCloudflareEnvBuiltinProps, __ΩCloudflarePluginContext, __ΩCloudflarePluginOptions, __ΩCloudflarePluginResolvedConfig, __ΩCloudflarePluginUserConfig, __ΩCloudflareWorkerEntryModule, __ΩCloudflareWorkerMetadata, __ΩJson, __ΩLiteral, __ΩOptionalZodTypeOf, __ΩWorkerEntryProps, __ΩWorkerModule, __ΩWorkerModuleMetadata, __ΩWranglerResolvedConfig, __ΩWranglerUserConfig, plugin as default, plugin, defaultWranglerConfig, isCyclic, parseWithRootPath };
|
|
21
|
-
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;;;;YAmDY,MAAA;IACR,UAAA,GAAa,uBAAA;EAAA;AAAA;;;AAJY;iBAWb,MAAA,kBACG,uBAAA,GAA0B,uBAAA,CAAA,CAC3C,OAAA,GAAS,uBAAA,GAA+B,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{CloudflareBuiltin as e}from"./components/cloudflare-builtin.mjs";import{CloudflareEnvBuiltin as t}from"./components/env-builtin.mjs";import{WorkerEntry as n}from"./components/worker-entry.mjs";import"./components/index.mjs";import{resolveWranglerConfigPath as r}from"./helpers/wrangler.mjs";import{createComponent as i}from"@alloy-js/core/jsx-runtime";import{For as a}from"@alloy-js/core";import{getCloudflarePreset as o}from"@cloudflare/unenv-preset";import{render as s}from"@powerlines/plugin-alloy/render";import{readEnvTypeReflection as c}from"@powerlines/plugin-env/helpers";import{resolveModule as l}from"@powerlines/plugin-esbuild/helpers/resolve";import u from"@powerlines/plugin-pulumi";import d from"@powerlines/plugin-unenv";import*as f from"@pulumi/cloudflare";import{omit as p}from"@stryke/helpers/omit";import{joinPaths as m,replaceExtension as h}from"@stryke/path";import{kebabCase as g}from"@stryke/string-format/kebab-case";import{isFunction as _}from"@stryke/type-checks/is-function";import v from"defu";import{unstable_readConfig as y}from"wrangler";function b(b={}){return[d(b.unenv),...u(b.pulumi),{name:`cloudflare`,config(){return{cloudflare:v(p(b,[`unenv`,`pulumi`]),{configPath:r(this)}),resolve:{skipNodeModulesBundle:!1},unenv:{presets:[o({compatibilityDate:this.config.compatibilityDate?.toString(),compatibilityFlags:[`nodejs_als`]})]}}},configResolved(){this.devDependencies[`@cloudflare/workers-types`]=`^4.20240616.0`;let e=y({config:this.config.cloudflare?.configPath},{preserveOriginalMain:!0,hideWarnings:!0});this.cloudflare.wrangler=structuredClone(e)},async prepare(){let n=await c(this,`env`);return s(this,[i(e,{}),i(t,{reflection:n})])},build:{order:`pre`,async handler(){let e=this;return this.cloudflare??={workers:[]},this.cloudflare.workers=await Promise.all(this.entry.map(async(e,t,n)=>{if(!e.input)throw Error(`Cloudflare Worker entry "${e.file}" is missing an input file.`);let r=await l(this,e.input);if(!r?.default)throw Error(`Cloudflare Worker entry "${e.file}" does not export a default handler. The Powerlines Cloudflare plugin expects each Worker entry module to export a default object matching the \`ExportedHandler\` interface from "@cloudflare/workers-types".`);let i=r.metadata?.name||h(e.input.file||e.file)||n.length>1?`${this.config.name}-${t}`:this.config.name;return{metadata:{name:i,pattern:`${i}.{domain}`,entry:e},fetch:_(r.default.fetch),tail:_(r.default.tail),trace:_(r.default.trace),tailStream:_(r.default.tailStream),scheduled:_(r.default.scheduled),test:_(r.default.test),email:_(r.default.email),queue:_(r.default.queue)}})),s(this,i(a,{get each(){return e.cloudflare.workers},children:e=>i(n,{worker:e})}))}},async deploy(){let e=process.env.CLOUDFLARE_API_TOKEN;if(!e)if(e=this.config.cloudflare.apiToken,e)this.warn("If possible, please use the `CLOUDFLARE_API_TOKEN` environment variable instead of using the `apiToken` option directly. The `apiToken` option will work; however, this is a less secure method of configuration.");else throw Error("Unable to determine the Cloudflare API token. Please set the `CLOUDFLARE_API_TOKEN` environment variable.")},pulumi:{async deploy(){let e=process.env.CLOUDFLARE_API_TOKEN;if(!e)if(e=this.config.cloudflare.apiToken,e)this.warn("If possible, please use the `CLOUDFLARE_API_TOKEN` environment variable instead of using the `apiToken` option directly. The `apiToken` option will work; however, this is a less secure method of configuration.");else throw Error("Unable to determine the Cloudflare API token. Please set the `CLOUDFLARE_API_TOKEN` environment variable.");await this.pulumi.setConfig(`cloudflare:apiToken`,{value:e});let t=new f.Provider(`cloudflare-provider`,{apiToken:e}),n=await f.getZone({filter:{account:{id:this.config.cloudflare.accountId},name:this.config.cloudflare.domain}},{provider:t}),r=[],i=[],a=[],o=[],s=[];for(let e of this.cloudflare.workers){let c=new f.Worker(`${this.config.organization?`${this.config.organization}.`:``}${g(this.config.name)===g(e.metadata.name)?g(this.config.name):`${g(this.config.name)}.${g(e.metadata.name)}`}.${g(this.config.mode)}.worker`,v({accountId:this.config.cloudflare.accountId,name:e.metadata.name,tags:[`project:${g(this.config.name)}`,this.config.organization?`organization:${g(this.config.organization)}`:void 0,this.config.mode?`mode:${g(this.config.mode)}`:void 0].filter(Boolean)},e.metadata),{provider:t});r.push(c);let l=new f.WorkerVersion(`${this.config.organization?`${this.config.organization}.`:``}${g(this.config.name)===g(e.metadata.name)?g(this.config.name):`${g(this.config.name)}.${g(e.metadata.name)}`}.${g(this.config.mode)}.worker-version`,v({accountId:this.config.cloudflare.accountId,workerId:c.id,mainModule:m(this.config.output.path,`index.mjs`),modules:[{name:m(this.config.output.path,`index.mjs`),contentType:`application/javascript+module`,contentFile:m(this.config.output.path,`index.mjs`)}]},e.metadata,{compatibilityDate:this.config.compatibilityDate?.cloudflare?.toString(),compatibilityFlags:[`nodejs_als`]}),{provider:t});i.push(l);let u=new f.WorkersDeployment(`${this.config.organization?`${this.config.organization}.`:``}${g(this.config.name)===g(e.metadata.name)?g(this.config.name):`${g(this.config.name)}-${g(e.metadata.name)}`}.${g(this.config.mode)}.workers-deployment`,v({accountId:this.config.cloudflare.accountId,zoneId:n.id,strategy:`percentage`,scriptName:c.name,versions:[{percentage:100,versionId:l.id}]}),{provider:t});a.push(u);let d=new f.WorkersRoute(`${this.config.organization?`${this.config.organization}.`:``}${g(this.config.name)===g(e.metadata.name)?g(this.config.name):`${g(this.config.name)}-${g(e.metadata.name)}`}.${g(this.config.mode)}.workers-route`,v({accountId:this.config.cloudflare.accountId,zoneId:n.id,pattern:e.metadata.pattern.replace(`{domain}`,this.config.cloudflare.domain).replace(`{scriptName}`,e.metadata.name).replace(`{mode}`,this.config.mode),script:c.name}),{provider:t});o.push(d);let p=new f.DnsRecord(`${this.config.organization?`${this.config.organization}.`:``}${g(this.config.name)===g(e.metadata.name)?g(this.config.name):`${g(this.config.name)}-${g(e.metadata.name)}`}.${g(this.config.mode)}.dns-record`,{name:d.pattern,type:`A`,content:`192.0.2.1`,zoneId:n.id,proxied:!0,ttl:1},{provider:t});s.push(p)}return{workers:r,workerVersions:i,workersDeployments:a,workersRoutes:o,dnsRecords:s}}}}]}export{e as CloudflareBuiltin,t as CloudflareEnvBuiltin,n as WorkerEntry,b as default,b as plugin};
|
|
2
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 { For } from \"@alloy-js/core\";\nimport { getCloudflarePreset } from \"@cloudflare/unenv-preset\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { readEnvTypeReflection } from \"@powerlines/plugin-env/helpers\";\nimport { resolveModule } from \"@powerlines/plugin-esbuild/helpers/resolve\";\nimport pulumi from \"@powerlines/plugin-pulumi\";\nimport unenv from \"@powerlines/plugin-unenv\";\nimport * as pulumiCloudflare from \"@pulumi/cloudflare\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths, replaceExtension } from \"@stryke/path\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { PartialKeys } from \"@stryke/types\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\n\nimport { unstable_readConfig } from \"wrangler\";\nimport { CloudflareEnvBuiltin } from \"./components\";\nimport { CloudflareBuiltin } from \"./components/cloudflare-builtin\";\nimport { WorkerEntry } from \"./components/worker-entry\";\nimport { resolveWranglerConfigPath } from \"./helpers/wrangler\";\nimport {\n CloudflarePluginContext,\n CloudflarePluginOptions,\n CloudflareWorkerEntryModule\n} from \"./types/plugin\";\nimport { WorkerModule } from \"./types/worker-module\";\nimport { WranglerResolvedConfig, WranglerUserConfig } from \"./types/wrangler\";\n\nexport * from \"./components\";\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n cloudflare?: CloudflarePluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport function plugin<\n TContext extends CloudflarePluginContext = CloudflarePluginContext\n>(options: CloudflarePluginOptions = {}): Plugin<TContext>[] {\n return [\n unenv<TContext>(options.unenv),\n ...pulumi<TContext>(options.pulumi),\n {\n name: \"cloudflare\",\n config() {\n return {\n cloudflare: defu(omit(options, [\"unenv\", \"pulumi\"]), {\n configPath: resolveWranglerConfigPath(this)\n }),\n resolve: {\n skipNodeModulesBundle: false\n },\n unenv: {\n presets: [\n getCloudflarePreset({\n compatibilityDate: this.config.compatibilityDate?.toString(),\n compatibilityFlags: [\"nodejs_als\"]\n })\n ]\n }\n };\n },\n configResolved() {\n this.devDependencies[\"@cloudflare/workers-types\"] = \"^4.20240616.0\";\n\n const config: PartialKeys<WranglerUserConfig, \"build\" | \"define\"> =\n unstable_readConfig(\n { config: this.config.cloudflare?.configPath },\n { preserveOriginalMain: true, hideWarnings: true }\n );\n this.cloudflare.wrangler = structuredClone(\n config\n ) as WranglerResolvedConfig;\n },\n async prepare() {\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <>\n <CloudflareBuiltin />\n <CloudflareEnvBuiltin reflection={result} />\n </>\n );\n },\n build: {\n order: \"pre\",\n async handler() {\n this.cloudflare ??= { workers: [] };\n this.cloudflare.workers = (await Promise.all(\n this.entry.map(async (entry, i, arr) => {\n if (!entry.input) {\n throw new Error(\n `Cloudflare Worker entry \"${entry.file}\" is missing an input file.`\n );\n }\n\n const workerModule = await resolveModule<WorkerModule>(\n this,\n entry.input\n );\n if (!workerModule?.default) {\n throw new Error(\n `Cloudflare Worker entry \"${\n entry.file\n }\" does not export a default handler. The Powerlines Cloudflare plugin expects each Worker entry module to export a default object matching the \\`ExportedHandler\\` interface from \"@cloudflare/workers-types\".`\n );\n }\n\n const name =\n workerModule.metadata?.name ||\n replaceExtension(entry.input.file || entry.file) ||\n arr.length > 1\n ? `${this.config.name}-${i}`\n : this.config.name;\n\n return {\n metadata: {\n name,\n pattern: `${name}.{domain}`,\n entry\n },\n fetch: isFunction(workerModule.default.fetch),\n tail: isFunction(workerModule.default.tail),\n trace: isFunction(workerModule.default.trace),\n tailStream: isFunction(workerModule.default.tailStream),\n scheduled: isFunction(workerModule.default.scheduled),\n test: isFunction(workerModule.default.test),\n email: isFunction(workerModule.default.email),\n queue: isFunction(workerModule.default.queue)\n };\n })\n )) as CloudflareWorkerEntryModule[];\n\n return render(\n this,\n <For each={this.cloudflare.workers}>\n {worker => <WorkerEntry worker={worker} />}\n </For>\n );\n }\n },\n async deploy() {\n let apiToken = process.env.CLOUDFLARE_API_TOKEN;\n if (!apiToken) {\n apiToken = this.config.cloudflare.apiToken;\n if (apiToken) {\n this.warn(\n \"If possible, please use the `CLOUDFLARE_API_TOKEN` environment variable instead of using the `apiToken` option directly. The `apiToken` option will work; however, this is a less secure method of configuration.\"\n );\n } else {\n throw new Error(\n \"Unable to determine the Cloudflare API token. Please set the `CLOUDFLARE_API_TOKEN` environment variable.\"\n );\n }\n }\n\n // for (const worker of this.cloudflare.workers) {\n // }\n },\n pulumi: {\n async deploy() {\n let apiToken = process.env.CLOUDFLARE_API_TOKEN;\n if (!apiToken) {\n apiToken = this.config.cloudflare.apiToken;\n if (apiToken) {\n this.warn(\n \"If possible, please use the `CLOUDFLARE_API_TOKEN` environment variable instead of using the `apiToken` option directly. The `apiToken` option will work; however, this is a less secure method of configuration.\"\n );\n } else {\n throw new Error(\n \"Unable to determine the Cloudflare API token. Please set the `CLOUDFLARE_API_TOKEN` environment variable.\"\n );\n }\n }\n\n await this.pulumi.setConfig(\"cloudflare:apiToken\", {\n value: apiToken\n });\n\n const provider = new pulumiCloudflare.Provider(\n \"cloudflare-provider\",\n {\n apiToken\n }\n );\n\n const zone = await pulumiCloudflare.getZone(\n {\n filter: {\n account: { id: this.config.cloudflare.accountId },\n name: this.config.cloudflare.domain\n }\n },\n { provider }\n );\n\n const workers = [] as pulumiCloudflare.Worker[];\n const workerVersions = [] as pulumiCloudflare.WorkerVersion[];\n const workersDeployments = [] as pulumiCloudflare.WorkersDeployment[];\n const workersRoutes = [] as pulumiCloudflare.WorkersRoute[];\n const dnsRecords = [] as pulumiCloudflare.DnsRecord[];\n for (const worker of this.cloudflare.workers) {\n const resource = new pulumiCloudflare.Worker(\n `${this.config.organization ? `${this.config.organization}.` : \"\"}${\n kebabCase(this.config.name) === kebabCase(worker.metadata.name)\n ? kebabCase(this.config.name)\n : `${kebabCase(this.config.name)}.${kebabCase(\n worker.metadata.name\n )}`\n }.${kebabCase(this.config.mode)}.worker`,\n defu(\n {\n accountId: this.config.cloudflare.accountId,\n name: worker.metadata.name,\n tags: [\n `project:${kebabCase(this.config.name)}`,\n this.config.organization\n ? `organization:${kebabCase(this.config.organization)}`\n : undefined,\n this.config.mode\n ? `mode:${kebabCase(this.config.mode)}`\n : undefined\n ].filter(Boolean) as string[]\n },\n worker.metadata\n ),\n { provider }\n );\n workers.push(resource);\n\n const workerVersion = new pulumiCloudflare.WorkerVersion(\n `${this.config.organization ? `${this.config.organization}.` : \"\"}${\n kebabCase(this.config.name) === kebabCase(worker.metadata.name)\n ? kebabCase(this.config.name)\n : `${kebabCase(this.config.name)}.${kebabCase(\n worker.metadata.name\n )}`\n }.${kebabCase(this.config.mode)}.worker-version`,\n defu(\n {\n accountId: this.config.cloudflare.accountId,\n workerId: resource.id,\n mainModule: joinPaths(this.config.output.path, \"index.mjs\"),\n modules: [\n {\n name: joinPaths(this.config.output.path, \"index.mjs\"),\n contentType: \"application/javascript+module\",\n contentFile: joinPaths(\n this.config.output.path,\n \"index.mjs\"\n )\n }\n ]\n },\n worker.metadata,\n {\n compatibilityDate:\n this.config.compatibilityDate?.cloudflare?.toString() as string,\n compatibilityFlags: [\"nodejs_als\"]\n }\n ) as pulumiCloudflare.WorkerVersionArgs,\n { provider }\n );\n workerVersions.push(workerVersion);\n\n const workersDeployment = new pulumiCloudflare.WorkersDeployment(\n `${this.config.organization ? `${this.config.organization}.` : \"\"}${\n kebabCase(this.config.name) === kebabCase(worker.metadata.name)\n ? kebabCase(this.config.name)\n : `${kebabCase(this.config.name)}-${kebabCase(\n worker.metadata.name\n )}`\n }.${kebabCase(this.config.mode)}.workers-deployment`,\n defu({\n accountId: this.config.cloudflare.accountId,\n zoneId: zone.id,\n strategy: \"percentage\",\n scriptName: resource.name,\n versions: [\n {\n percentage: 100,\n versionId: workerVersion.id\n }\n ]\n }),\n { provider }\n );\n workersDeployments.push(workersDeployment);\n\n const workersRoute = new pulumiCloudflare.WorkersRoute(\n `${this.config.organization ? `${this.config.organization}.` : \"\"}${\n kebabCase(this.config.name) === kebabCase(worker.metadata.name)\n ? kebabCase(this.config.name)\n : `${kebabCase(this.config.name)}-${kebabCase(\n worker.metadata.name\n )}`\n }.${kebabCase(this.config.mode)}.workers-route`,\n defu({\n accountId: this.config.cloudflare.accountId,\n zoneId: zone.id,\n pattern: worker.metadata.pattern\n .replace(\"{domain}\", this.config.cloudflare.domain)\n .replace(\"{scriptName}\", worker.metadata.name)\n .replace(\"{mode}\", this.config.mode),\n script: resource.name\n }),\n { provider }\n );\n workersRoutes.push(workersRoute);\n\n const dnsRecord = new pulumiCloudflare.DnsRecord(\n `${this.config.organization ? `${this.config.organization}.` : \"\"}${\n kebabCase(this.config.name) === kebabCase(worker.metadata.name)\n ? kebabCase(this.config.name)\n : `${kebabCase(this.config.name)}-${kebabCase(\n worker.metadata.name\n )}`\n }.${kebabCase(this.config.mode)}.dns-record`,\n {\n name: workersRoute.pattern,\n type: \"A\",\n content: \"192.0.2.1\",\n zoneId: zone.id,\n proxied: true,\n ttl: 1\n },\n { provider }\n );\n dnsRecords.push(dnsRecord);\n }\n\n return {\n workers,\n workerVersions,\n workersDeployments,\n workersRoutes,\n dnsRecords\n };\n }\n }\n }\n ] as Plugin<TContext>[];\n}\n\nexport default plugin;\n"],"mappings":"qkCA+CA,MAAS,CAAA,EAAO,EAAC,MAAW,CAAA,GAAA,EAAA,EAAA,OAAA,CAAA,CAC5B,KAAO,sBAEP,MAAQ,CACN,WAAiB,EAAA,EAAA,EAAA,CAAA,QAAA,SAAA,CAAA,CAAA,CACf,WAAa,EAAuB,KAAA,CACtC,CAAA,CACF,QAAA,CAAA,sBAAA,GAEE,CACG,MAAU,CACb,QAAA,CAAA,EAAA,CACK,kBAAe,KAAA,OAAA,mBAAA,UAAA,CACX,mBAAQ,CAAA,aAA0B,CAClC,CAAA,CAAA,CACF,CACL,EAEA,gBAAA,CACE,KAAK,gBAAa,6BAAA,gBAClB,IAAM,EAAG,EAAA,CACP,OAAO,KAA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ler.cjs`);exports.JsonSchema=e.JsonSchema,exports.LiteralSchema=e.LiteralSchema,exports.PathSchema=e.PathSchema,exports.defaultWranglerConfig=e.defaultWranglerConfig,exports.isCyclic=e.isCyclic,exports.parseWithRootPath=e.parseWithRootPath;
|
package/dist/types/index.d.cts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Json, JsonSchema, Literal, LiteralSchema, OptionalZodTypeOf, PathSchema, WranglerResolvedConfig, WranglerUserConfig, __ΩJson, __ΩLiteral, __ΩOptionalZodTypeOf, __ΩWranglerResolvedConfig, __ΩWranglerUserConfig, defaultWranglerConfig, isCyclic, parseWithRootPath } from "./wrangler.cjs";
|
|
2
|
-
import { WorkerModule, WorkerModuleMetadata, __ΩWorkerModule, __ΩWorkerModuleMetadata } from "./worker-module.cjs";
|
|
3
|
-
import { CloudflarePluginContext, CloudflarePluginOptions, CloudflarePluginResolvedConfig, CloudflarePluginUserConfig, CloudflareWorkerEntryModule, CloudflareWorkerMetadata, __ΩCloudflarePluginContext, __ΩCloudflarePluginOptions, __ΩCloudflarePluginResolvedConfig, __ΩCloudflarePluginUserConfig, __ΩCloudflareWorkerEntryModule, __ΩCloudflareWorkerMetadata } from "./plugin.cjs";
|
|
4
|
-
export { CloudflarePluginContext, CloudflarePluginOptions, CloudflarePluginResolvedConfig, CloudflarePluginUserConfig, CloudflareWorkerEntryModule, CloudflareWorkerMetadata, Json, JsonSchema, Literal, LiteralSchema, OptionalZodTypeOf, PathSchema, WorkerModule, WorkerModuleMetadata, WranglerResolvedConfig, WranglerUserConfig, __ΩCloudflarePluginContext, __ΩCloudflarePluginOptions, __ΩCloudflarePluginResolvedConfig, __ΩCloudflarePluginUserConfig, __ΩCloudflareWorkerEntryModule, __ΩCloudflareWorkerMetadata, __ΩJson, __ΩLiteral, __ΩOptionalZodTypeOf, __ΩWorkerModule, __ΩWorkerModuleMetadata, __ΩWranglerResolvedConfig, __ΩWranglerUserConfig, defaultWranglerConfig, isCyclic, parseWithRootPath };
|
package/dist/types/index.d.mts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Json, JsonSchema, Literal, LiteralSchema, OptionalZodTypeOf, PathSchema, WranglerResolvedConfig, WranglerUserConfig, __ΩJson, __ΩLiteral, __ΩOptionalZodTypeOf, __ΩWranglerResolvedConfig, __ΩWranglerUserConfig, defaultWranglerConfig, isCyclic, parseWithRootPath } from "./wrangler.mjs";
|
|
2
|
-
import { WorkerModule, WorkerModuleMetadata, __ΩWorkerModule, __ΩWorkerModuleMetadata } from "./worker-module.mjs";
|
|
3
|
-
import { CloudflarePluginContext, CloudflarePluginOptions, CloudflarePluginResolvedConfig, CloudflarePluginUserConfig, CloudflareWorkerEntryModule, CloudflareWorkerMetadata, __ΩCloudflarePluginContext, __ΩCloudflarePluginOptions, __ΩCloudflarePluginResolvedConfig, __ΩCloudflarePluginUserConfig, __ΩCloudflareWorkerEntryModule, __ΩCloudflareWorkerMetadata } from "./plugin.mjs";
|
|
4
|
-
export { CloudflarePluginContext, CloudflarePluginOptions, CloudflarePluginResolvedConfig, CloudflarePluginUserConfig, CloudflareWorkerEntryModule, CloudflareWorkerMetadata, Json, JsonSchema, Literal, LiteralSchema, OptionalZodTypeOf, PathSchema, WorkerModule, WorkerModuleMetadata, WranglerResolvedConfig, WranglerUserConfig, __ΩCloudflarePluginContext, __ΩCloudflarePluginOptions, __ΩCloudflarePluginResolvedConfig, __ΩCloudflarePluginUserConfig, __ΩCloudflareWorkerEntryModule, __ΩCloudflareWorkerMetadata, __ΩJson, __ΩLiteral, __ΩOptionalZodTypeOf, __ΩWorkerModule, __ΩWorkerModuleMetadata, __ΩWranglerResolvedConfig, __ΩWranglerUserConfig, defaultWranglerConfig, isCyclic, parseWithRootPath };
|
package/dist/types/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{JsonSchema as e,LiteralSchema as t,PathSchema as n,defaultWranglerConfig as r,isCyclic as i,parseWithRootPath as a}from"./wrangler.mjs";export{e as JsonSchema,t as LiteralSchema,n as PathSchema,r as defaultWranglerConfig,i as isCyclic,a as parseWithRootPath};
|
package/dist/types/plugin.cjs
DELETED
|
File without changes
|
package/dist/types/plugin.d.cts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { WranglerResolvedConfig } from "./wrangler.cjs";
|
|
2
|
-
import { WorkerModuleMetadata } from "./worker-module.cjs";
|
|
3
|
-
import { ExportedHandler } from "@cloudflare/workers-types";
|
|
4
|
-
import { EnvPluginContext, EnvPluginResolvedConfig, EnvPluginUserConfig } from "@powerlines/plugin-env";
|
|
5
|
-
import { PulumiPluginContext, PulumiPluginOptions, PulumiPluginResolvedConfig, PulumiPluginUserConfig } from "@powerlines/plugin-pulumi";
|
|
6
|
-
import { UnenvPluginContext, UnenvPluginOptions, UnenvPluginResolvedConfig, UnenvPluginUserConfig } from "@powerlines/plugin-unenv";
|
|
7
|
-
import { RequiredKeys } from "@stryke/types/base";
|
|
8
|
-
import { PluginContext, ResolvedEntryTypeDefinition } from "powerlines";
|
|
9
|
-
|
|
10
|
-
//#region src/types/plugin.d.ts
|
|
11
|
-
interface CloudflarePluginOptions {
|
|
12
|
-
/**
|
|
13
|
-
* The Cloudflare account ID to use for the plugin.
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* This is required for certain features of the plugin, such as deploying a Cloudflare Worker entry module. This option can also be set via the `CLOUDFLARE_ACCOUNT_ID` environment variable. If both are provided, the value from the plugin options will take precedence.
|
|
17
|
-
*
|
|
18
|
-
* @see https://developers.cloudflare.com/fundamentals/account/find-account-and-zone-ids/
|
|
19
|
-
*/
|
|
20
|
-
accountId?: string;
|
|
21
|
-
/**
|
|
22
|
-
* The Cloudflare API token to use for the plugin.
|
|
23
|
-
*
|
|
24
|
-
* @remarks
|
|
25
|
-
* This option can also be set via the `CLOUDFLARE_API_TOKEN` environment variable. If both are provided, the value from the plugin options will take precedence.
|
|
26
|
-
*
|
|
27
|
-
* @see https://developers.cloudflare.com/fundamentals/api/get-started/create-token/
|
|
28
|
-
*/
|
|
29
|
-
apiToken?: string;
|
|
30
|
-
/**
|
|
31
|
-
* A path to the Wrangler configuration file (either `.toml` or `.jsonc`) to use as the base configuration for the plugin.
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
* This is required for certain features of the plugin, such as deploying a Cloudflare Worker entry module. If not provided, the plugin will look for a Wrangler configuration file in the project root directory with the default name `wrangler.toml`. You can also specify a custom path to the Wrangler configuration file using this option.
|
|
35
|
-
*/
|
|
36
|
-
configPath?: string;
|
|
37
|
-
/**
|
|
38
|
-
* The domain to use for the Cloudflare deployed resources.
|
|
39
|
-
*/
|
|
40
|
-
domain?: string;
|
|
41
|
-
/**
|
|
42
|
-
* The [unenv](https://unjs.dev/packages/unenv) plugin configuration options.
|
|
43
|
-
*
|
|
44
|
-
* @remarks
|
|
45
|
-
* The plugin will automatically include the Cloudflare preset for unenv, which provides compatibility with Cloudflare Workers runtimes. You can customize the unenv configuration by providing options here, but the Cloudflare preset will always be included.
|
|
46
|
-
*/
|
|
47
|
-
unenv?: UnenvPluginOptions;
|
|
48
|
-
/**
|
|
49
|
-
* The configuration options for Pulumi.
|
|
50
|
-
*/
|
|
51
|
-
pulumi?: PulumiPluginOptions;
|
|
52
|
-
}
|
|
53
|
-
type CloudflarePluginUserConfig = EnvPluginUserConfig & PulumiPluginUserConfig & UnenvPluginUserConfig & {
|
|
54
|
-
/**
|
|
55
|
-
* Options for the Cloudflare plugin.
|
|
56
|
-
*/
|
|
57
|
-
cloudflare?: Omit<CloudflarePluginOptions, "unenv" | "pulumi">;
|
|
58
|
-
};
|
|
59
|
-
type CloudflarePluginResolvedConfig = EnvPluginResolvedConfig & PulumiPluginResolvedConfig & UnenvPluginResolvedConfig & {
|
|
60
|
-
/**
|
|
61
|
-
* Options for the Cloudflare plugin.
|
|
62
|
-
*/
|
|
63
|
-
cloudflare: Required<Omit<CloudflarePluginOptions, "unenv" | "pulumi">>;
|
|
64
|
-
};
|
|
65
|
-
type CloudflareWorkerMetadata = RequiredKeys<WorkerModuleMetadata, "name" | "pattern"> & {
|
|
66
|
-
/**
|
|
67
|
-
* The resolved entry definition for the Worker module, including the original entry definition and the resolved file path to the module.
|
|
68
|
-
*/
|
|
69
|
-
entry: ResolvedEntryTypeDefinition;
|
|
70
|
-
};
|
|
71
|
-
type CloudflareWorkerEntryModule = Record<keyof ExportedHandler, boolean> & {
|
|
72
|
-
/**
|
|
73
|
-
* The metadata for the Worker module, including the name of the Cloudflare Worker script to deploy. If no name is provided, the plugin will use the `name` configuration value from the plugin configuration as the default name for the Worker script.
|
|
74
|
-
*/
|
|
75
|
-
metadata: CloudflareWorkerMetadata;
|
|
76
|
-
};
|
|
77
|
-
type CloudflarePluginContext<TResolvedConfig extends CloudflarePluginResolvedConfig = CloudflarePluginResolvedConfig> = PluginContext<TResolvedConfig> & EnvPluginContext<TResolvedConfig> & PulumiPluginContext<TResolvedConfig> & UnenvPluginContext<TResolvedConfig> & {
|
|
78
|
-
cloudflare: {
|
|
79
|
-
wrangler?: WranglerResolvedConfig;
|
|
80
|
-
workers: CloudflareWorkerEntryModule[];
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
declare type __ΩCloudflarePluginOptions = any[];
|
|
84
|
-
declare type __ΩCloudflarePluginUserConfig = any[];
|
|
85
|
-
declare type __ΩCloudflarePluginResolvedConfig = any[];
|
|
86
|
-
declare type __ΩCloudflareWorkerMetadata = any[];
|
|
87
|
-
declare type __ΩCloudflareWorkerEntryModule = any[];
|
|
88
|
-
declare type __ΩCloudflarePluginContext = any[];
|
|
89
|
-
//#endregion
|
|
90
|
-
export { CloudflarePluginContext, CloudflarePluginOptions, CloudflarePluginResolvedConfig, CloudflarePluginUserConfig, CloudflareWorkerEntryModule, CloudflareWorkerMetadata, __ΩCloudflarePluginContext, __ΩCloudflarePluginOptions, __ΩCloudflarePluginResolvedConfig, __ΩCloudflarePluginUserConfig, __ΩCloudflareWorkerEntryModule, __ΩCloudflareWorkerMetadata };
|
|
91
|
-
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;;UAyCiB,uBAAA;;AAAjB;;;;;;;EASE,SAAA;EA+BA;;;;;;AAQF;;EA7BE,QAAA;EA6BuC;;;;;;EArBvC,UAAA;EAqBuC;;;EAhBvC,MAAA;EAsBe;;;;AAGjB;;EAjBE,KAAA,GAAQ,kBAAA;EAiBmC;;;EAZ3C,MAAA,GAAS,mBAAA;AAAA;AAAA,KAGC,0BAAA,GAA6B,mBAAA,GACvC,sBAAA,GACA,qBAAA;EAasB;;;EATpB,UAAA,GAAa,IAAA,CAAK,uBAAA;AAAA;AAAA,KAGV,8BAAA,GAAiC,uBAAA,GAC3C,0BAAA,GACA,yBAAA;EAIc;;;EAAZ,UAAA,EAAY,QAAA,CAAS,IAAA,CAAK,uBAAA;AAAA;AAAA,KAGlB,wBAAA,GAA2B,YAAA,CACrC,oBAAA;EADkC;;;EAOlC,KAAA,EAAO,2BAAA;AAAA;AAAA,KAGG,2BAAA,GAA8B,MAAA,OAClC,eAAA;EAJ4B;;;EAUlC,QAAA,EAAU,wBAAA;AAAA;AAAA,KAGA,uBAAA,yBACc,8BAAA,GACtB,8BAAA,IACA,aAAA,CAAc,eAAA,IAChB,gBAAA,CAAiB,eAAA,IACjB,mBAAA,CAAoB,eAAA,IACpB,kBAAA,CAAmB,eAAA;EACjB,UAAA;IACE,QAAA,GAAW,sBAAA;IACX,OAAA,EAAS,2BAAA;EAAA;AAAA;AAAA"}
|
package/dist/types/plugin.d.mts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { WranglerResolvedConfig } from "./wrangler.mjs";
|
|
2
|
-
import { WorkerModuleMetadata } from "./worker-module.mjs";
|
|
3
|
-
import { PulumiPluginContext, PulumiPluginOptions, PulumiPluginResolvedConfig, PulumiPluginUserConfig } from "@powerlines/plugin-pulumi";
|
|
4
|
-
import { UnenvPluginContext, UnenvPluginOptions, UnenvPluginResolvedConfig, UnenvPluginUserConfig } from "@powerlines/plugin-unenv";
|
|
5
|
-
import { ExportedHandler } from "@cloudflare/workers-types";
|
|
6
|
-
import { EnvPluginContext, EnvPluginResolvedConfig, EnvPluginUserConfig } from "@powerlines/plugin-env";
|
|
7
|
-
import { RequiredKeys } from "@stryke/types/base";
|
|
8
|
-
import { PluginContext, ResolvedEntryTypeDefinition } from "powerlines";
|
|
9
|
-
|
|
10
|
-
//#region src/types/plugin.d.ts
|
|
11
|
-
interface CloudflarePluginOptions {
|
|
12
|
-
/**
|
|
13
|
-
* The Cloudflare account ID to use for the plugin.
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* This is required for certain features of the plugin, such as deploying a Cloudflare Worker entry module. This option can also be set via the `CLOUDFLARE_ACCOUNT_ID` environment variable. If both are provided, the value from the plugin options will take precedence.
|
|
17
|
-
*
|
|
18
|
-
* @see https://developers.cloudflare.com/fundamentals/account/find-account-and-zone-ids/
|
|
19
|
-
*/
|
|
20
|
-
accountId?: string;
|
|
21
|
-
/**
|
|
22
|
-
* The Cloudflare API token to use for the plugin.
|
|
23
|
-
*
|
|
24
|
-
* @remarks
|
|
25
|
-
* This option can also be set via the `CLOUDFLARE_API_TOKEN` environment variable. If both are provided, the value from the plugin options will take precedence.
|
|
26
|
-
*
|
|
27
|
-
* @see https://developers.cloudflare.com/fundamentals/api/get-started/create-token/
|
|
28
|
-
*/
|
|
29
|
-
apiToken?: string;
|
|
30
|
-
/**
|
|
31
|
-
* A path to the Wrangler configuration file (either `.toml` or `.jsonc`) to use as the base configuration for the plugin.
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
* This is required for certain features of the plugin, such as deploying a Cloudflare Worker entry module. If not provided, the plugin will look for a Wrangler configuration file in the project root directory with the default name `wrangler.toml`. You can also specify a custom path to the Wrangler configuration file using this option.
|
|
35
|
-
*/
|
|
36
|
-
configPath?: string;
|
|
37
|
-
/**
|
|
38
|
-
* The domain to use for the Cloudflare deployed resources.
|
|
39
|
-
*/
|
|
40
|
-
domain?: string;
|
|
41
|
-
/**
|
|
42
|
-
* The [unenv](https://unjs.dev/packages/unenv) plugin configuration options.
|
|
43
|
-
*
|
|
44
|
-
* @remarks
|
|
45
|
-
* The plugin will automatically include the Cloudflare preset for unenv, which provides compatibility with Cloudflare Workers runtimes. You can customize the unenv configuration by providing options here, but the Cloudflare preset will always be included.
|
|
46
|
-
*/
|
|
47
|
-
unenv?: UnenvPluginOptions;
|
|
48
|
-
/**
|
|
49
|
-
* The configuration options for Pulumi.
|
|
50
|
-
*/
|
|
51
|
-
pulumi?: PulumiPluginOptions;
|
|
52
|
-
}
|
|
53
|
-
type CloudflarePluginUserConfig = EnvPluginUserConfig & PulumiPluginUserConfig & UnenvPluginUserConfig & {
|
|
54
|
-
/**
|
|
55
|
-
* Options for the Cloudflare plugin.
|
|
56
|
-
*/
|
|
57
|
-
cloudflare?: Omit<CloudflarePluginOptions, "unenv" | "pulumi">;
|
|
58
|
-
};
|
|
59
|
-
type CloudflarePluginResolvedConfig = EnvPluginResolvedConfig & PulumiPluginResolvedConfig & UnenvPluginResolvedConfig & {
|
|
60
|
-
/**
|
|
61
|
-
* Options for the Cloudflare plugin.
|
|
62
|
-
*/
|
|
63
|
-
cloudflare: Required<Omit<CloudflarePluginOptions, "unenv" | "pulumi">>;
|
|
64
|
-
};
|
|
65
|
-
type CloudflareWorkerMetadata = RequiredKeys<WorkerModuleMetadata, "name" | "pattern"> & {
|
|
66
|
-
/**
|
|
67
|
-
* The resolved entry definition for the Worker module, including the original entry definition and the resolved file path to the module.
|
|
68
|
-
*/
|
|
69
|
-
entry: ResolvedEntryTypeDefinition;
|
|
70
|
-
};
|
|
71
|
-
type CloudflareWorkerEntryModule = Record<keyof ExportedHandler, boolean> & {
|
|
72
|
-
/**
|
|
73
|
-
* The metadata for the Worker module, including the name of the Cloudflare Worker script to deploy. If no name is provided, the plugin will use the `name` configuration value from the plugin configuration as the default name for the Worker script.
|
|
74
|
-
*/
|
|
75
|
-
metadata: CloudflareWorkerMetadata;
|
|
76
|
-
};
|
|
77
|
-
type CloudflarePluginContext<TResolvedConfig extends CloudflarePluginResolvedConfig = CloudflarePluginResolvedConfig> = PluginContext<TResolvedConfig> & EnvPluginContext<TResolvedConfig> & PulumiPluginContext<TResolvedConfig> & UnenvPluginContext<TResolvedConfig> & {
|
|
78
|
-
cloudflare: {
|
|
79
|
-
wrangler?: WranglerResolvedConfig;
|
|
80
|
-
workers: CloudflareWorkerEntryModule[];
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
declare type __ΩCloudflarePluginOptions = any[];
|
|
84
|
-
declare type __ΩCloudflarePluginUserConfig = any[];
|
|
85
|
-
declare type __ΩCloudflarePluginResolvedConfig = any[];
|
|
86
|
-
declare type __ΩCloudflareWorkerMetadata = any[];
|
|
87
|
-
declare type __ΩCloudflareWorkerEntryModule = any[];
|
|
88
|
-
declare type __ΩCloudflarePluginContext = any[];
|
|
89
|
-
//#endregion
|
|
90
|
-
export { CloudflarePluginContext, CloudflarePluginOptions, CloudflarePluginResolvedConfig, CloudflarePluginUserConfig, CloudflareWorkerEntryModule, CloudflareWorkerMetadata, __ΩCloudflarePluginContext, __ΩCloudflarePluginOptions, __ΩCloudflarePluginResolvedConfig, __ΩCloudflarePluginUserConfig, __ΩCloudflareWorkerEntryModule, __ΩCloudflareWorkerMetadata };
|
|
91
|
-
//# sourceMappingURL=plugin.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;;UAyCiB,uBAAA;;AAAjB;;;;;;;EASE,SAAA;EA+BA;;;;;;AAQF;;EA7BE,QAAA;EA6BuC;;;;;;EArBvC,UAAA;EAqBuC;;;EAhBvC,MAAA;EAsBe;;;;AAGjB;;EAjBE,KAAA,GAAQ,kBAAA;EAiBmC;;;EAZ3C,MAAA,GAAS,mBAAA;AAAA;AAAA,KAGC,0BAAA,GAA6B,mBAAA,GACvC,sBAAA,GACA,qBAAA;EAasB;;;EATpB,UAAA,GAAa,IAAA,CAAK,uBAAA;AAAA;AAAA,KAGV,8BAAA,GAAiC,uBAAA,GAC3C,0BAAA,GACA,yBAAA;EAIc;;;EAAZ,UAAA,EAAY,QAAA,CAAS,IAAA,CAAK,uBAAA;AAAA;AAAA,KAGlB,wBAAA,GAA2B,YAAA,CACrC,oBAAA;EADkC;;;EAOlC,KAAA,EAAO,2BAAA;AAAA;AAAA,KAGG,2BAAA,GAA8B,MAAA,OAClC,eAAA;EAJ4B;;;EAUlC,QAAA,EAAU,wBAAA;AAAA;AAAA,KAGA,uBAAA,yBACc,8BAAA,GACtB,8BAAA,IACA,aAAA,CAAc,eAAA,IAChB,gBAAA,CAAiB,eAAA,IACjB,mBAAA,CAAoB,eAAA,IACpB,kBAAA,CAAmB,eAAA;EACjB,UAAA;IACE,QAAA,GAAW,sBAAA;IACX,OAAA,EAAS,2BAAA;EAAA;AAAA;AAAA"}
|
package/dist/types/plugin.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{};
|
|
File without changes
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { WranglerUserConfig } from "./wrangler.cjs";
|
|
2
|
-
import { ExportedHandler } from "@cloudflare/workers-types";
|
|
3
|
-
|
|
4
|
-
//#region src/types/worker-module.d.ts
|
|
5
|
-
type WorkerModuleMetadata = Partial<Omit<WranglerUserConfig, "account_id" | "name">> & {
|
|
6
|
-
/**
|
|
7
|
-
* The name of the Cloudflare Worker script to deploy - used in URLs and route configuration.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* If no value is provided, the {@link Config.name} configuration value will be used.
|
|
11
|
-
*/
|
|
12
|
-
name?: string;
|
|
13
|
-
/**
|
|
14
|
-
* A path to the Wrangler configuration file (either `.toml` or `.jsonc`) to use as the base configuration for the plugin.
|
|
15
|
-
*
|
|
16
|
-
* @remarks
|
|
17
|
-
* This is required for certain features of the plugin, such as deploying a Cloudflare Worker entry module. If not provided, the plugin will look for a Wrangler configuration file in the project root directory with the default name `wrangler.toml`. You can also specify a custom path to the Wrangler configuration file using this option.
|
|
18
|
-
*/
|
|
19
|
-
configPath?: string;
|
|
20
|
-
/**
|
|
21
|
-
* A routing pattern to associate with the deployed Worker script.
|
|
22
|
-
*
|
|
23
|
-
* @remarks
|
|
24
|
-
* This is required for the Worker script to be accessible via a public URL. The plugin will replace the string `{domain}` in the pattern with the value of the `domain` configuration option, if provided. If no pattern is provided, a default pattern will be generated based on the script name and plugin mode (e.g. `https://{scriptName}.{mode}.worker-script.{domain}`).
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* // Example pattern for: "worker-script.my-example-domain.com"
|
|
29
|
-
* pattern: "worker-script.{domain}"
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
pattern?: string;
|
|
33
|
-
};
|
|
34
|
-
interface WorkerModule {
|
|
35
|
-
metadata?: WorkerModuleMetadata;
|
|
36
|
-
default: ExportedHandler;
|
|
37
|
-
}
|
|
38
|
-
declare type __ΩWorkerModuleMetadata = any[];
|
|
39
|
-
declare type __ΩWorkerModule = any[];
|
|
40
|
-
//#endregion
|
|
41
|
-
export { WorkerModule, WorkerModuleMetadata, __ΩWorkerModule, __ΩWorkerModuleMetadata };
|
|
42
|
-
//# sourceMappingURL=worker-module.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker-module.d.cts","names":[],"sources":["../../src/types/worker-module.ts"],"mappings":";;;;KAqBY,oBAAA,GAAuB,OAAA,CACjC,IAAA,CAAK,kBAAA;;AADP;;;;;EASE,IAAA;EATwC;;;;;;EAiBxC,UAAA;EAcA;;;AAGF;;;;;;;;;EAHE,OAAA;AAAA;AAAA,UAGe,YAAA;EACf,QAAA,GAAW,oBAAA;EACX,OAAA,EAAS,eAAA;AAAA;AAAA"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { WranglerUserConfig } from "./wrangler.mjs";
|
|
2
|
-
import { ExportedHandler } from "@cloudflare/workers-types";
|
|
3
|
-
|
|
4
|
-
//#region src/types/worker-module.d.ts
|
|
5
|
-
type WorkerModuleMetadata = Partial<Omit<WranglerUserConfig, "account_id" | "name">> & {
|
|
6
|
-
/**
|
|
7
|
-
* The name of the Cloudflare Worker script to deploy - used in URLs and route configuration.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* If no value is provided, the {@link Config.name} configuration value will be used.
|
|
11
|
-
*/
|
|
12
|
-
name?: string;
|
|
13
|
-
/**
|
|
14
|
-
* A path to the Wrangler configuration file (either `.toml` or `.jsonc`) to use as the base configuration for the plugin.
|
|
15
|
-
*
|
|
16
|
-
* @remarks
|
|
17
|
-
* This is required for certain features of the plugin, such as deploying a Cloudflare Worker entry module. If not provided, the plugin will look for a Wrangler configuration file in the project root directory with the default name `wrangler.toml`. You can also specify a custom path to the Wrangler configuration file using this option.
|
|
18
|
-
*/
|
|
19
|
-
configPath?: string;
|
|
20
|
-
/**
|
|
21
|
-
* A routing pattern to associate with the deployed Worker script.
|
|
22
|
-
*
|
|
23
|
-
* @remarks
|
|
24
|
-
* This is required for the Worker script to be accessible via a public URL. The plugin will replace the string `{domain}` in the pattern with the value of the `domain` configuration option, if provided. If no pattern is provided, a default pattern will be generated based on the script name and plugin mode (e.g. `https://{scriptName}.{mode}.worker-script.{domain}`).
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* // Example pattern for: "worker-script.my-example-domain.com"
|
|
29
|
-
* pattern: "worker-script.{domain}"
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
pattern?: string;
|
|
33
|
-
};
|
|
34
|
-
interface WorkerModule {
|
|
35
|
-
metadata?: WorkerModuleMetadata;
|
|
36
|
-
default: ExportedHandler;
|
|
37
|
-
}
|
|
38
|
-
declare type __ΩWorkerModuleMetadata = any[];
|
|
39
|
-
declare type __ΩWorkerModule = any[];
|
|
40
|
-
//#endregion
|
|
41
|
-
export { WorkerModule, WorkerModuleMetadata, __ΩWorkerModule, __ΩWorkerModuleMetadata };
|
|
42
|
-
//# sourceMappingURL=worker-module.d.mts.map
|