@powerlines/plugin-cloudflare 0.6.32 → 0.6.33

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.
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
3
4
  let _alloy_js_core = require("@alloy-js/core");
4
5
  let defu = require("defu");
5
6
  defu = require_runtime.__toESM(defu);
6
7
  let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
7
- let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
8
8
  let _powerlines_plugin_alloy_core_contexts = require("@powerlines/plugin-alloy/core/contexts");
9
9
  let _powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
10
10
  let _stryke_hash = require("@stryke/hash");
@@ -24,155 +24,179 @@ function WorkerEntry(props) {
24
24
  ]);
25
25
  const context = (0, _powerlines_plugin_alloy_core_contexts.usePowerlines)();
26
26
  const entryPath = (0, _alloy_js_core.computed)(() => `./${(0, _stryke_path_replace.replaceExtension)((0, _stryke_path_find.relativePath)(context.entryPath, worker.metadata.entry.input?.file || worker.metadata.entry.file))}`);
27
- return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, {
28
- path: `worker-${(0, _stryke_hash.murmurhash)(worker.metadata.entry, { maxLength: 8 })}-entry.ts`,
29
- ...rest,
30
- imports: (0, defu.default)({
31
- "@cloudflare/workers-types": [
32
- {
33
- name: "Request",
34
- type: true
35
- },
36
- {
37
- name: "Response",
38
- type: true
39
- },
40
- {
41
- name: "ExecutionContext",
42
- type: true
43
- },
44
- {
45
- name: "IncomingRequestCfProperties",
46
- type: true
47
- },
48
- {
49
- name: "ScheduledController",
50
- type: true
51
- },
52
- {
53
- name: "ForwardableEmailMessage",
54
- type: true
55
- },
56
- {
57
- name: "MessageBatch",
58
- type: true
59
- },
60
- {
61
- name: "TailStream",
62
- type: true
63
- },
64
- {
65
- name: "TraceItem",
66
- type: true
67
- },
68
- {
69
- name: "TailStream.TailEvent",
70
- type: true
71
- },
72
- {
73
- name: "TailStream.Onset",
74
- type: true
75
- },
76
- {
77
- name: "TailStream.TailEventHandlerType",
78
- type: true
79
- }
80
- ],
81
- [entryPath.value]: "worker"
82
- }, imports ?? {}),
83
- builtinImports: (0, defu.default)({ cloudflare: [
84
- "withFetchContext",
85
- "withTailContext",
86
- "withTraceContext",
87
- "withTailStreamContext",
88
- "withScheduledContext",
89
- "withTestContext",
90
- "withEmailContext",
91
- "withQueueContext"
92
- ] }, builtinImports ?? {}),
93
- children: [
94
- _alloy_js_core.code`export default { `,
95
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
96
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
97
- when: worker.fetch,
98
- children: _alloy_js_core.code` async fetch(request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: CloudflareBindings, ctx: ExecutionContext): Promise<Response> {
27
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({ get path() {
28
+ return `worker-${(0, _stryke_hash.murmurhash)(worker.metadata.entry, { maxLength: 8 })}-entry.ts`;
29
+ } }, rest, {
30
+ get imports() {
31
+ return (0, defu.default)({
32
+ "@cloudflare/workers-types": [
33
+ {
34
+ name: "Request",
35
+ type: true
36
+ },
37
+ {
38
+ name: "Response",
39
+ type: true
40
+ },
41
+ {
42
+ name: "ExecutionContext",
43
+ type: true
44
+ },
45
+ {
46
+ name: "IncomingRequestCfProperties",
47
+ type: true
48
+ },
49
+ {
50
+ name: "ScheduledController",
51
+ type: true
52
+ },
53
+ {
54
+ name: "ForwardableEmailMessage",
55
+ type: true
56
+ },
57
+ {
58
+ name: "MessageBatch",
59
+ type: true
60
+ },
61
+ {
62
+ name: "TailStream",
63
+ type: true
64
+ },
65
+ {
66
+ name: "TraceItem",
67
+ type: true
68
+ },
69
+ {
70
+ name: "TailStream.TailEvent",
71
+ type: true
72
+ },
73
+ {
74
+ name: "TailStream.Onset",
75
+ type: true
76
+ },
77
+ {
78
+ name: "TailStream.TailEventHandlerType",
79
+ type: true
80
+ }
81
+ ],
82
+ [entryPath.value]: "worker"
83
+ }, imports ?? {});
84
+ },
85
+ get builtinImports() {
86
+ return (0, defu.default)({ cloudflare: [
87
+ "withFetchContext",
88
+ "withTailContext",
89
+ "withTraceContext",
90
+ "withTailStreamContext",
91
+ "withScheduledContext",
92
+ "withTestContext",
93
+ "withEmailContext",
94
+ "withQueueContext"
95
+ ] }, builtinImports ?? {});
96
+ },
97
+ get children() {
98
+ return [
99
+ _alloy_js_core.code`export default { `,
100
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
101
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
102
+ get when() {
103
+ return worker.fetch;
104
+ },
105
+ children: _alloy_js_core.code` async fetch(request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: CloudflareBindings, ctx: ExecutionContext): Promise<Response> {
99
106
  return await withFetchContext({ request, env, ctx }, async (context) => {
100
107
  return worker.fetch(context.request, context.env, context.ctx);
101
108
  });
102
109
  }, `
103
- }),
104
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
105
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
106
- when: worker.tail,
107
- children: _alloy_js_core.code` async tail(events: TraceItem[], env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
110
+ }),
111
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
112
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
113
+ get when() {
114
+ return worker.tail;
115
+ },
116
+ children: _alloy_js_core.code` async tail(events: TraceItem[], env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
108
117
  return withTailContext({ events, env, ctx }, async (context) => {
109
118
  return worker.tail(context.events, context.env, context.ctx);
110
119
  });
111
120
  }, `
112
- }),
113
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
114
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
115
- when: worker.trace,
116
- children: _alloy_js_core.code` async trace(traces: TraceItem[], env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
121
+ }),
122
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
123
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
124
+ get when() {
125
+ return worker.trace;
126
+ },
127
+ children: _alloy_js_core.code` async trace(traces: TraceItem[], env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
117
128
  return withTraceContext({ traces, env, ctx }, async (context) => {
118
129
  return worker.trace(context.traces, context.env, context.ctx);
119
130
  });
120
131
  }, `
121
- }),
122
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
123
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
124
- when: worker.tailStream,
125
- children: _alloy_js_core.code` async tailStream(event: TailStream.TailEvent<TailStream.Onset>, env: CloudflareBindings, ctx: ExecutionContext): Promise<ReadableStream> {
132
+ }),
133
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
134
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
135
+ get when() {
136
+ return worker.tailStream;
137
+ },
138
+ children: _alloy_js_core.code` async tailStream(event: TailStream.TailEvent<TailStream.Onset>, env: CloudflareBindings, ctx: ExecutionContext): Promise<ReadableStream> {
126
139
  return await withTailStreamContext({ event, env, ctx }, async (context) => {
127
140
  return await worker.tailStream(context.event, context.env, context.ctx);
128
141
  });
129
142
  }, `
130
- }),
131
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
132
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
133
- when: worker.scheduled,
134
- children: _alloy_js_core.code` async scheduled(controller: ScheduledController, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
143
+ }),
144
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
145
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
146
+ get when() {
147
+ return worker.scheduled;
148
+ },
149
+ children: _alloy_js_core.code` async scheduled(controller: ScheduledController, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
135
150
  return withScheduledContext({ controller, env, ctx }, async (context) => {
136
151
  return worker.scheduled(context.controller, context.env, context.ctx);
137
152
  });
138
153
  }, `
139
- }),
140
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
141
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
142
- when: worker.test,
143
- children: _alloy_js_core.code` async test(controller: TestController, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
154
+ }),
155
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
156
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
157
+ get when() {
158
+ return worker.test;
159
+ },
160
+ children: _alloy_js_core.code` async test(controller: TestController, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
144
161
  return withTestContext({ controller, env, ctx }, async (context) => {
145
162
  return worker.test(context.controller, context.env, context.ctx);
146
163
  });
147
164
  }, `
148
- }),
149
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
150
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
151
- when: worker.email,
152
- children: _alloy_js_core.code` async email(message: ForwardableEmailMessage, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
165
+ }),
166
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
167
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
168
+ get when() {
169
+ return worker.email;
170
+ },
171
+ children: _alloy_js_core.code` async email(message: ForwardableEmailMessage, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
153
172
  return withEmailContext({ message, env, ctx }, async (context) => {
154
173
  return worker.email(context.message, context.env, context.ctx);
155
174
  });
156
175
  }, `
157
- }),
158
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
159
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
160
- when: worker.queue,
161
- children: _alloy_js_core.code` async queue(batch: MessageBatch, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
176
+ }),
177
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
178
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
179
+ get when() {
180
+ return worker.queue;
181
+ },
182
+ children: _alloy_js_core.code` async queue(batch: MessageBatch, env: CloudflareBindings, ctx: ExecutionContext): Promise<void> {
162
183
  return withQueueContext({ batch, env, ctx }, async (context) => {
163
184
  return worker.queue(context.batch, context.env, context.ctx);
164
185
  });
165
186
  }, `
166
- }),
167
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
168
- _alloy_js_core.code` } satisfies ExportedHandler<CloudflareBindings>; `,
169
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components.Spacing, {}),
170
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
171
- when: Boolean(children),
172
- children
173
- })
174
- ]
175
- });
187
+ }),
188
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
189
+ _alloy_js_core.code` } satisfies ExportedHandler<CloudflareBindings>; `,
190
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
191
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
192
+ get when() {
193
+ return Boolean(children);
194
+ },
195
+ children
196
+ })
197
+ ];
198
+ }
199
+ }));
176
200
  }
177
201
 
178
202
  //#endregion
@@ -1,5 +1,4 @@
1
1
  import { CloudflareWorkerEntryModule } from "../types/plugin.cjs";
2
- import * as _$_alloy_js_core0 from "@alloy-js/core";
3
2
  import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
4
3
 
5
4
  //#region src/components/worker-entry.d.ts
@@ -9,7 +8,7 @@ type WorkerEntryProps = Partial<EntryFileProps> & Omit<EntryFileProps, "path"> &
9
8
  /**
10
9
  * 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.
11
10
  */
12
- declare function WorkerEntry(props: WorkerEntryProps): _$_alloy_js_core0.Children;
11
+ declare function WorkerEntry(props: WorkerEntryProps): any;
13
12
  declare type __ΩWorkerEntryProps = any[];
14
13
  //#endregion
15
14
  export { WorkerEntry, WorkerEntryProps, __ΩWorkerEntryProps };
@@ -1 +1 @@
1
- {"version":3,"file":"worker-entry.d.cts","names":[],"sources":["../../src/components/worker-entry.tsx"],"mappings":";;;;;KA+BY,gBAAA,GAAmB,OAAA,CAAQ,cAAA,IACrC,IAAA,CAAK,cAAA;EACH,MAAA,EAAQ,2BAAA;AAAA;;AAFZ;;iBAQgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA;AAAA"}
1
+ {"version":3,"file":"worker-entry.d.cts","names":[],"sources":["../../src/components/worker-entry.tsx"],"mappings":";;;;KA+BY,gBAAA,GAAmB,OAAA,CAAQ,cAAA,IACrC,IAAA,CAAK,cAAA;EACH,MAAA,EAAQ,2BAAA;AAAA;AAFZ;;;AAAA,iBAQgB,WAAA,CAAY,KAAA,EAAO,gBAAA;AAAA"}
@@ -1,5 +1,4 @@
1
1
  import { CloudflareWorkerEntryModule } from "../types/plugin.mjs";
2
- import * as _$_alloy_js_core0 from "@alloy-js/core";
3
2
  import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
4
3
 
5
4
  //#region src/components/worker-entry.d.ts
@@ -9,7 +8,7 @@ type WorkerEntryProps = Partial<EntryFileProps> & Omit<EntryFileProps, "path"> &
9
8
  /**
10
9
  * 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.
11
10
  */
12
- declare function WorkerEntry(props: WorkerEntryProps): _$_alloy_js_core0.Children;
11
+ declare function WorkerEntry(props: WorkerEntryProps): any;
13
12
  declare type __ΩWorkerEntryProps = any[];
14
13
  //#endregion
15
14
  export { WorkerEntry, WorkerEntryProps, __ΩWorkerEntryProps };
@@ -1 +1 @@
1
- {"version":3,"file":"worker-entry.d.mts","names":[],"sources":["../../src/components/worker-entry.tsx"],"mappings":";;;;;KA+BY,gBAAA,GAAmB,OAAA,CAAQ,cAAA,IACrC,IAAA,CAAK,cAAA;EACH,MAAA,EAAQ,2BAAA;AAAA;;AAFZ;;iBAQgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA;AAAA"}
1
+ {"version":3,"file":"worker-entry.d.mts","names":[],"sources":["../../src/components/worker-entry.tsx"],"mappings":";;;;KA+BY,gBAAA,GAAmB,OAAA,CAAQ,cAAA,IACrC,IAAA,CAAK,cAAA;EACH,MAAA,EAAQ,2BAAA;AAAA;AAFZ;;;AAAA,iBAQgB,WAAA,CAAY,KAAA,EAAO,gBAAA;AAAA"}