@powerlines/plugin-cloudflare 0.6.55 → 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.
Files changed (71) hide show
  1. package/package.json +8 -8
  2. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  3. package/dist/components/cloudflare-builtin.cjs +0 -917
  4. package/dist/components/cloudflare-builtin.d.cts +0 -12
  5. package/dist/components/cloudflare-builtin.d.cts.map +0 -1
  6. package/dist/components/cloudflare-builtin.d.mts +0 -12
  7. package/dist/components/cloudflare-builtin.d.mts.map +0 -1
  8. package/dist/components/cloudflare-builtin.mjs +0 -915
  9. package/dist/components/cloudflare-builtin.mjs.map +0 -1
  10. package/dist/components/env-builtin.cjs +0 -32
  11. package/dist/components/env-builtin.d.cts +0 -12
  12. package/dist/components/env-builtin.d.cts.map +0 -1
  13. package/dist/components/env-builtin.d.mts +0 -12
  14. package/dist/components/env-builtin.d.mts.map +0 -1
  15. package/dist/components/env-builtin.mjs +0 -30
  16. package/dist/components/env-builtin.mjs.map +0 -1
  17. package/dist/components/index.cjs +0 -8
  18. package/dist/components/index.d.cts +0 -4
  19. package/dist/components/index.d.mts +0 -4
  20. package/dist/components/index.mjs +0 -5
  21. package/dist/components/worker-entry.cjs +0 -203
  22. package/dist/components/worker-entry.d.cts +0 -15
  23. package/dist/components/worker-entry.d.cts.map +0 -1
  24. package/dist/components/worker-entry.d.mts +0 -15
  25. package/dist/components/worker-entry.d.mts.map +0 -1
  26. package/dist/components/worker-entry.mjs +0 -201
  27. package/dist/components/worker-entry.mjs.map +0 -1
  28. package/dist/helpers/constants.cjs +0 -7
  29. package/dist/helpers/constants.d.cts +0 -5
  30. package/dist/helpers/constants.d.cts.map +0 -1
  31. package/dist/helpers/constants.d.mts +0 -5
  32. package/dist/helpers/constants.d.mts.map +0 -1
  33. package/dist/helpers/constants.mjs +0 -6
  34. package/dist/helpers/constants.mjs.map +0 -1
  35. package/dist/helpers/wrangler.cjs +0 -21
  36. package/dist/helpers/wrangler.d.cts +0 -36
  37. package/dist/helpers/wrangler.d.cts.map +0 -1
  38. package/dist/helpers/wrangler.d.mts +0 -36
  39. package/dist/helpers/wrangler.d.mts.map +0 -1
  40. package/dist/helpers/wrangler.mjs +0 -20
  41. package/dist/helpers/wrangler.mjs.map +0 -1
  42. package/dist/index.cjs +0 -190
  43. package/dist/index.d.cts +0 -21
  44. package/dist/index.d.cts.map +0 -1
  45. package/dist/index.d.mts +0 -21
  46. package/dist/index.d.mts.map +0 -1
  47. package/dist/index.mjs +0 -181
  48. package/dist/index.mjs.map +0 -1
  49. package/dist/types/index.cjs +0 -9
  50. package/dist/types/index.d.cts +0 -4
  51. package/dist/types/index.d.mts +0 -4
  52. package/dist/types/index.mjs +0 -3
  53. package/dist/types/plugin.cjs +0 -0
  54. package/dist/types/plugin.d.cts +0 -91
  55. package/dist/types/plugin.d.cts.map +0 -1
  56. package/dist/types/plugin.d.mts +0 -91
  57. package/dist/types/plugin.d.mts.map +0 -1
  58. package/dist/types/plugin.mjs +0 -1
  59. package/dist/types/worker-module.cjs +0 -0
  60. package/dist/types/worker-module.d.cts +0 -42
  61. package/dist/types/worker-module.d.cts.map +0 -1
  62. package/dist/types/worker-module.d.mts +0 -42
  63. package/dist/types/worker-module.d.mts.map +0 -1
  64. package/dist/types/worker-module.mjs +0 -1
  65. package/dist/types/wrangler.cjs +0 -172
  66. package/dist/types/wrangler.d.cts +0 -40
  67. package/dist/types/wrangler.d.cts.map +0 -1
  68. package/dist/types/wrangler.d.mts +0 -40
  69. package/dist/types/wrangler.d.mts.map +0 -1
  70. package/dist/types/wrangler.mjs +0 -163
  71. package/dist/types/wrangler.mjs.map +0 -1
package/dist/index.mjs DELETED
@@ -1,181 +0,0 @@
1
- import { CloudflareBuiltin } from "./components/cloudflare-builtin.mjs";
2
- import { CloudflareEnvBuiltin } from "./components/env-builtin.mjs";
3
- import { WorkerEntry } from "./components/worker-entry.mjs";
4
- import "./components/index.mjs";
5
- import { resolveWranglerConfigPath } from "./helpers/wrangler.mjs";
6
- import { createComponent } from "@alloy-js/core/jsx-runtime";
7
- import { For } from "@alloy-js/core";
8
- import { getCloudflarePreset } from "@cloudflare/unenv-preset";
9
- import { render } from "@powerlines/plugin-alloy/render";
10
- import { readEnvTypeReflection } from "@powerlines/plugin-env/helpers";
11
- import { resolveModule } from "@powerlines/plugin-esbuild/helpers/resolve";
12
- import pulumi from "@powerlines/plugin-pulumi";
13
- import unenv from "@powerlines/plugin-unenv";
14
- import * as pulumiCloudflare from "@pulumi/cloudflare";
15
- import { omit } from "@stryke/helpers/omit";
16
- import { joinPaths, replaceExtension } from "@stryke/path";
17
- import { kebabCase } from "@stryke/string-format/kebab-case";
18
- import { isFunction } from "@stryke/type-checks/is-function";
19
- import defu from "defu";
20
- import { unstable_readConfig } from "wrangler";
21
-
22
- //#region src/index.tsx
23
- /**
24
- * A Powerlines plugin to assist in developing other Powerlines plugins.
25
- */
26
- function plugin(options = {}) {
27
- return [
28
- unenv(options.unenv),
29
- ...pulumi(options.pulumi),
30
- {
31
- name: "cloudflare",
32
- config() {
33
- return {
34
- cloudflare: defu(omit(options, ["unenv", "pulumi"]), { configPath: resolveWranglerConfigPath(this) }),
35
- resolve: { skipNodeModulesBundle: false },
36
- unenv: { presets: [getCloudflarePreset({
37
- compatibilityDate: this.config.compatibilityDate?.toString(),
38
- compatibilityFlags: ["nodejs_als"]
39
- })] }
40
- };
41
- },
42
- configResolved() {
43
- this.devDependencies["@cloudflare/workers-types"] = "^4.20240616.0";
44
- const config = unstable_readConfig({ config: this.config.cloudflare?.configPath }, {
45
- preserveOriginalMain: true,
46
- hideWarnings: true
47
- });
48
- this.cloudflare.wrangler = structuredClone(config);
49
- },
50
- async prepare() {
51
- const result = await readEnvTypeReflection(this, "env");
52
- return render(this, [createComponent(CloudflareBuiltin, {}), createComponent(CloudflareEnvBuiltin, { reflection: result })]);
53
- },
54
- build: {
55
- order: "pre",
56
- async handler() {
57
- const _self$ = this;
58
- this.cloudflare ??= { workers: [] };
59
- this.cloudflare.workers = await Promise.all(this.entry.map(async (entry, i, arr) => {
60
- if (!entry.input) throw new Error(`Cloudflare Worker entry "${entry.file}" is missing an input file.`);
61
- const workerModule = await resolveModule(this, entry.input);
62
- if (!workerModule?.default) throw new Error(`Cloudflare Worker entry "${entry.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".`);
63
- const name = workerModule.metadata?.name || replaceExtension(entry.input.file || entry.file) || arr.length > 1 ? `${this.config.name}-${i}` : this.config.name;
64
- return {
65
- metadata: {
66
- name,
67
- pattern: `${name}.{domain}`,
68
- entry
69
- },
70
- fetch: isFunction(workerModule.default.fetch),
71
- tail: isFunction(workerModule.default.tail),
72
- trace: isFunction(workerModule.default.trace),
73
- tailStream: isFunction(workerModule.default.tailStream),
74
- scheduled: isFunction(workerModule.default.scheduled),
75
- test: isFunction(workerModule.default.test),
76
- email: isFunction(workerModule.default.email),
77
- queue: isFunction(workerModule.default.queue)
78
- };
79
- }));
80
- return render(this, createComponent(For, {
81
- get each() {
82
- return _self$.cloudflare.workers;
83
- },
84
- children: (worker) => createComponent(WorkerEntry, { worker })
85
- }));
86
- }
87
- },
88
- async deploy() {
89
- let apiToken = process.env.CLOUDFLARE_API_TOKEN;
90
- if (!apiToken) {
91
- apiToken = this.config.cloudflare.apiToken;
92
- if (apiToken) 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.");
93
- else throw new Error("Unable to determine the Cloudflare API token. Please set the `CLOUDFLARE_API_TOKEN` environment variable.");
94
- }
95
- },
96
- pulumi: { async deploy() {
97
- let apiToken = process.env.CLOUDFLARE_API_TOKEN;
98
- if (!apiToken) {
99
- apiToken = this.config.cloudflare.apiToken;
100
- if (apiToken) 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.");
101
- else throw new Error("Unable to determine the Cloudflare API token. Please set the `CLOUDFLARE_API_TOKEN` environment variable.");
102
- }
103
- await this.pulumi.setConfig("cloudflare:apiToken", { value: apiToken });
104
- const provider = new pulumiCloudflare.Provider("cloudflare-provider", { apiToken });
105
- const zone = await pulumiCloudflare.getZone({ filter: {
106
- account: { id: this.config.cloudflare.accountId },
107
- name: this.config.cloudflare.domain
108
- } }, { provider });
109
- const workers = [];
110
- const workerVersions = [];
111
- const workersDeployments = [];
112
- const workersRoutes = [];
113
- const dnsRecords = [];
114
- for (const worker of this.cloudflare.workers) {
115
- const resource = new pulumiCloudflare.Worker(`${this.config.organization ? `${this.config.organization}.` : ""}${kebabCase(this.config.name) === kebabCase(worker.metadata.name) ? kebabCase(this.config.name) : `${kebabCase(this.config.name)}.${kebabCase(worker.metadata.name)}`}.${kebabCase(this.config.mode)}.worker`, defu({
116
- accountId: this.config.cloudflare.accountId,
117
- name: worker.metadata.name,
118
- tags: [
119
- `project:${kebabCase(this.config.name)}`,
120
- this.config.organization ? `organization:${kebabCase(this.config.organization)}` : void 0,
121
- this.config.mode ? `mode:${kebabCase(this.config.mode)}` : void 0
122
- ].filter(Boolean)
123
- }, worker.metadata), { provider });
124
- workers.push(resource);
125
- const workerVersion = new pulumiCloudflare.WorkerVersion(`${this.config.organization ? `${this.config.organization}.` : ""}${kebabCase(this.config.name) === kebabCase(worker.metadata.name) ? kebabCase(this.config.name) : `${kebabCase(this.config.name)}.${kebabCase(worker.metadata.name)}`}.${kebabCase(this.config.mode)}.worker-version`, defu({
126
- accountId: this.config.cloudflare.accountId,
127
- workerId: resource.id,
128
- mainModule: joinPaths(this.config.output.path, "index.mjs"),
129
- modules: [{
130
- name: joinPaths(this.config.output.path, "index.mjs"),
131
- contentType: "application/javascript+module",
132
- contentFile: joinPaths(this.config.output.path, "index.mjs")
133
- }]
134
- }, worker.metadata, {
135
- compatibilityDate: this.config.compatibilityDate?.cloudflare?.toString(),
136
- compatibilityFlags: ["nodejs_als"]
137
- }), { provider });
138
- workerVersions.push(workerVersion);
139
- const workersDeployment = new pulumiCloudflare.WorkersDeployment(`${this.config.organization ? `${this.config.organization}.` : ""}${kebabCase(this.config.name) === kebabCase(worker.metadata.name) ? kebabCase(this.config.name) : `${kebabCase(this.config.name)}-${kebabCase(worker.metadata.name)}`}.${kebabCase(this.config.mode)}.workers-deployment`, defu({
140
- accountId: this.config.cloudflare.accountId,
141
- zoneId: zone.id,
142
- strategy: "percentage",
143
- scriptName: resource.name,
144
- versions: [{
145
- percentage: 100,
146
- versionId: workerVersion.id
147
- }]
148
- }), { provider });
149
- workersDeployments.push(workersDeployment);
150
- const workersRoute = new pulumiCloudflare.WorkersRoute(`${this.config.organization ? `${this.config.organization}.` : ""}${kebabCase(this.config.name) === kebabCase(worker.metadata.name) ? kebabCase(this.config.name) : `${kebabCase(this.config.name)}-${kebabCase(worker.metadata.name)}`}.${kebabCase(this.config.mode)}.workers-route`, defu({
151
- accountId: this.config.cloudflare.accountId,
152
- zoneId: zone.id,
153
- pattern: worker.metadata.pattern.replace("{domain}", this.config.cloudflare.domain).replace("{scriptName}", worker.metadata.name).replace("{mode}", this.config.mode),
154
- script: resource.name
155
- }), { provider });
156
- workersRoutes.push(workersRoute);
157
- const dnsRecord = new pulumiCloudflare.DnsRecord(`${this.config.organization ? `${this.config.organization}.` : ""}${kebabCase(this.config.name) === kebabCase(worker.metadata.name) ? kebabCase(this.config.name) : `${kebabCase(this.config.name)}-${kebabCase(worker.metadata.name)}`}.${kebabCase(this.config.mode)}.dns-record`, {
158
- name: workersRoute.pattern,
159
- type: "A",
160
- content: "192.0.2.1",
161
- zoneId: zone.id,
162
- proxied: true,
163
- ttl: 1
164
- }, { provider });
165
- dnsRecords.push(dnsRecord);
166
- }
167
- return {
168
- workers,
169
- workerVersions,
170
- workersDeployments,
171
- workersRoutes,
172
- dnsRecords
173
- };
174
- } }
175
- }
176
- ];
177
- }
178
-
179
- //#endregion
180
- export { CloudflareBuiltin, CloudflareEnvBuiltin, WorkerEntry, plugin as default, plugin };
181
- //# sourceMappingURL=index.mjs.map
@@ -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 dnsRec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A,IAAA,iBAAA,UAAA,GAAA,KAAA,OAAA,eAAA,GAAA,KAAA,OAAA,aAAA,KAAA,KAAA,UAAA,KAAA,OAAA,KAAA,KAAA,UAAA,OAAA,SAAA,KAAA,GAAA,UAAA,KAAA,OAAA,KAAA,GAAA,GAAA,UAAA,KAAA,OAAA,KAAA,CAAA,GAAA,UAAA,OAAA,SAAA,KAAA,GAAA,GAAA,UAAA,KAAA,OAAA,KAAA,CAAA,cAAA;MACD,MAAE,aAAS;MACZ,MAAA;;MAED,QAAM,KAAS;MACf,SAAM;MACN,KAAM;MACN,EAAA,EACA,UACA,CAAA;AACA,gBAAQ,KAAQ,UAAO;;AAEzB,WAAO;KACL;KACA;KACA;KACA;KACA;KACD;MAEJ;GACF;EAAC"}
@@ -1,9 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_types_wrangler = require('./wrangler.cjs');
3
-
4
- exports.JsonSchema = require_types_wrangler.JsonSchema;
5
- exports.LiteralSchema = require_types_wrangler.LiteralSchema;
6
- exports.PathSchema = require_types_wrangler.PathSchema;
7
- exports.defaultWranglerConfig = require_types_wrangler.defaultWranglerConfig;
8
- exports.isCyclic = require_types_wrangler.isCyclic;
9
- exports.parseWithRootPath = require_types_wrangler.parseWithRootPath;
@@ -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 };
@@ -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 };
@@ -1,3 +0,0 @@
1
- import { JsonSchema, LiteralSchema, PathSchema, defaultWranglerConfig, isCyclic, parseWithRootPath } from "./wrangler.mjs";
2
-
3
- export { JsonSchema, LiteralSchema, PathSchema, defaultWranglerConfig, isCyclic, parseWithRootPath };
File without changes
@@ -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"}
@@ -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"}
@@ -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
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker-module.d.mts","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 +0,0 @@
1
- export { };