@base44/functions-compiler 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +137 -0
  2. package/lib/dist/activation-shim.mjs +237 -0
  3. package/lib/dist/actor.mjs +1129 -0
  4. package/lib/dist/deno-shim.mjs +2347 -0
  5. package/lib/src/actor-compat.d.ts +24 -0
  6. package/lib/src/actor-compat.js +302 -0
  7. package/lib/src/actor-compat.js.map +1 -0
  8. package/lib/src/bundler.d.ts +51 -0
  9. package/lib/src/bundler.js +321 -0
  10. package/lib/src/bundler.js.map +1 -0
  11. package/lib/src/contracts.d.ts +108 -0
  12. package/lib/src/contracts.js +39 -0
  13. package/lib/src/contracts.js.map +1 -0
  14. package/lib/src/deno-bundle.d.ts +30 -0
  15. package/lib/src/deno-bundle.js +146 -0
  16. package/lib/src/deno-bundle.js.map +1 -0
  17. package/lib/src/errors.d.ts +16 -0
  18. package/lib/src/errors.js +11 -0
  19. package/lib/src/errors.js.map +1 -0
  20. package/lib/src/esbuild/deno-resolver.d.ts +26 -0
  21. package/lib/src/esbuild/deno-resolver.js +436 -0
  22. package/lib/src/esbuild/deno-resolver.js.map +1 -0
  23. package/lib/src/esbuild/node-builtin-require.d.ts +2 -0
  24. package/lib/src/esbuild/node-builtin-require.js +33 -0
  25. package/lib/src/esbuild/node-builtin-require.js.map +1 -0
  26. package/lib/src/esbuild/private-data-sources-virtual.d.ts +3 -0
  27. package/lib/src/esbuild/private-data-sources-virtual.js +127 -0
  28. package/lib/src/esbuild/private-data-sources-virtual.js.map +1 -0
  29. package/lib/src/esbuild/runtime-context-virtual.d.ts +3 -0
  30. package/lib/src/esbuild/runtime-context-virtual.js +42 -0
  31. package/lib/src/esbuild/runtime-context-virtual.js.map +1 -0
  32. package/lib/src/esbuild/runtime-virtual.d.ts +2 -0
  33. package/lib/src/esbuild/runtime-virtual.js +52 -0
  34. package/lib/src/esbuild/runtime-virtual.js.map +1 -0
  35. package/lib/src/esbuild/user-files.d.ts +15 -0
  36. package/lib/src/esbuild/user-files.js +73 -0
  37. package/lib/src/esbuild/user-files.js.map +1 -0
  38. package/lib/src/fetch-guard.d.ts +26 -0
  39. package/lib/src/fetch-guard.js +67 -0
  40. package/lib/src/fetch-guard.js.map +1 -0
  41. package/lib/src/index.d.ts +12 -0
  42. package/lib/src/index.js +11 -0
  43. package/lib/src/index.js.map +1 -0
  44. package/lib/src/log.d.ts +7 -0
  45. package/lib/src/log.js +39 -0
  46. package/lib/src/log.js.map +1 -0
  47. package/lib/src/private-data-sources/build-http.ts +51 -0
  48. package/lib/src/private-data-sources/elasticsearch.ts +8 -0
  49. package/lib/src/private-data-sources/http-url.ts +23 -0
  50. package/lib/src/private-data-sources/http.ts +6 -0
  51. package/lib/src/private-data-sources/hyperdrive.ts +48 -0
  52. package/lib/src/private-data-sources/ioredis-adapter.ts +229 -0
  53. package/lib/src/private-data-sources/manifest.ts +150 -0
  54. package/lib/src/private-data-sources/mariadb.ts +8 -0
  55. package/lib/src/private-data-sources/mongodb.ts +70 -0
  56. package/lib/src/private-data-sources/mysql.ts +8 -0
  57. package/lib/src/private-data-sources/node-net-adapter.ts +244 -0
  58. package/lib/src/private-data-sources/postgres.ts +8 -0
  59. package/lib/src/private-data-sources/redis-auth.ts +83 -0
  60. package/lib/src/private-data-sources/redis.ts +47 -0
  61. package/lib/src/private-data-sources/runtime-environment.ts +4 -0
  62. package/lib/src/private-data-sources/runtime-manifest-store.ts +32 -0
  63. package/lib/src/private-data-sources/sqlserver.ts +22 -0
  64. package/lib/src/private-data-sources/tcp.ts +86 -0
  65. package/lib/src/private-data-sources/tedious-adapter.ts +67 -0
  66. package/lib/src/private-data-sources/types.ts +29 -0
  67. package/lib/src/runtime/index.ts +30 -0
  68. package/lib/src/runtime-context.ts +29 -0
  69. package/lib/src/static-egress-marker.d.ts +1 -0
  70. package/lib/src/static-egress-marker.js +7 -0
  71. package/lib/src/static-egress-marker.js.map +1 -0
  72. package/lib/src/telemetry.d.ts +32 -0
  73. package/lib/src/telemetry.js +84 -0
  74. package/lib/src/telemetry.js.map +1 -0
  75. package/lib/src/tracing.d.ts +9 -0
  76. package/lib/src/tracing.js +21 -0
  77. package/lib/src/tracing.js.map +1 -0
  78. package/lib/src/worker-entry.d.ts +36 -0
  79. package/lib/src/worker-entry.js +320 -0
  80. package/lib/src/worker-entry.js.map +1 -0
  81. package/package.json +43 -0
@@ -0,0 +1,321 @@
1
+ import { applyActorCompat } from "./actor-compat.js";
2
+ import { bundleToModule } from "./deno-bundle.js";
3
+ import { DenoCompatError } from "./errors.js";
4
+ import { setSpanTags, withSpan } from "./tracing.js";
5
+ import { prepareApp, prepareFunction, } from "./worker-entry.js";
6
+ // The single-module output is uploaded to Workers-for-Platforms under this
7
+ // name. Keep stable: the Python `BundlerClient`'s caller persists this in
8
+ // the script metadata's `main_module`.
9
+ const NORMALIZED_MAIN_MODULE = "_bundled.mjs";
10
+ // Per-function compiles run concurrently; each materializes its own temp dir
11
+ // and esbuild build, so peak memory scales with how many run at once — bound it.
12
+ const MAX_PARALLEL_COMPILES = 4;
13
+ export async function bundle(req) {
14
+ // Check for Actor before the Deno-shim path.
15
+ let actor;
16
+ try {
17
+ actor = applyActorCompat(req.entry, req.files);
18
+ }
19
+ catch (e) {
20
+ return denoCompatErrorOrThrow(e);
21
+ }
22
+ if (actor) {
23
+ if (req.runtimeSecrets) {
24
+ // Actors are binding-mode by design: their code runs in a Durable Object
25
+ // that reads secrets from the DO env, and actor connect dials the
26
+ // dispatcher without a handshake — an activation wrapper would leave them
27
+ // with no secrets at all. The backend already forces binding mode for
28
+ // actors, so this combination is a caller bug. Fail loud instead of
29
+ // returning a bundle that silently ignored the flag.
30
+ return denoCompatErrorOrThrow(new DenoCompatError("runtimeSecrets is not supported for Actor entries: an Actor reads secrets " +
31
+ "from its Durable Object env, so it must be deployed in binding mode."));
32
+ }
33
+ const outcome = await installAndCompile({
34
+ entry: actor.entry,
35
+ files: actor.files,
36
+ });
37
+ if (outcome.ok) {
38
+ return {
39
+ ok: true,
40
+ module: outcome.module,
41
+ main_module: NORMALIZED_MAIN_MODULE,
42
+ warnings: outcome.warnings,
43
+ handler_name: actor.handlerName,
44
+ do_class_name: actor.doClassName,
45
+ };
46
+ }
47
+ return { ok: false, stage: outcome.stage, errors: outcome.errors };
48
+ }
49
+ let prepared;
50
+ try {
51
+ prepared = await prepareFunction(req.entry, req.files, req.postResponseTelemetry, req.runtimeSecrets);
52
+ }
53
+ catch (e) {
54
+ return denoCompatErrorOrThrow(e);
55
+ }
56
+ const outcome = await installAndCompile(prepared);
57
+ if (outcome.ok) {
58
+ return {
59
+ ok: true,
60
+ module: outcome.module,
61
+ main_module: NORMALIZED_MAIN_MODULE,
62
+ warnings: outcome.warnings,
63
+ };
64
+ }
65
+ return { ok: false, stage: outcome.stage, errors: outcome.errors };
66
+ }
67
+ // One combined build resolves npm deps once and dedupes them across functions.
68
+ // esbuild fails the whole build on any unresolved import, so on failure we map
69
+ // each error to the function it came from, drop those, and rebuild the rest.
70
+ export async function bundleApp(req) {
71
+ const telemetry = req.postResponseTelemetry ?? false;
72
+ const runtimeSecrets = req.runtimeSecrets ?? false;
73
+ const entries = req.functions.map((fn, index) => ({
74
+ index,
75
+ fn,
76
+ }));
77
+ let combined;
78
+ try {
79
+ combined = await compileApp(entries, telemetry, runtimeSecrets);
80
+ }
81
+ catch (e) {
82
+ if (e instanceof DenoCompatError)
83
+ return bundleAppPerFunction(entries, telemetry, runtimeSecrets);
84
+ throw e;
85
+ }
86
+ if (combined.ok) {
87
+ return appResponse(combined.module, allOk(entries));
88
+ }
89
+ const { byIndex, unattributable } = classifyAppErrors(combined.errors);
90
+ // An error we can't pin to one function (deep in a shared dep, or no location)
91
+ // means the combined build can't tell us what to drop — isolate per function.
92
+ if (unattributable.length > 0) {
93
+ return bundleAppPerFunction(entries, telemetry, runtimeSecrets);
94
+ }
95
+ const functions = entries.map((e) => byIndex.has(e.index)
96
+ ? { name: e.fn.name, ok: false, errors: byIndex.get(e.index) }
97
+ : { name: e.fn.name, ok: true });
98
+ const survivors = entries.filter((e) => !byIndex.has(e.index));
99
+ if (survivors.length === 0) {
100
+ return { ok: false, module: null, functions };
101
+ }
102
+ let rebuilt;
103
+ try {
104
+ rebuilt = await compileApp(survivors, telemetry, runtimeSecrets);
105
+ }
106
+ catch (e) {
107
+ if (e instanceof DenoCompatError)
108
+ return bundleAppPerFunction(entries, telemetry, runtimeSecrets);
109
+ throw e;
110
+ }
111
+ if (rebuilt.ok)
112
+ return appResponse(rebuilt.module, functions);
113
+ // Survivors still don't build — fall back rather than fail the whole app.
114
+ return bundleAppPerFunction(entries, telemetry, runtimeSecrets);
115
+ }
116
+ async function compileApp(entries, telemetry = false, runtimeSecrets = false) {
117
+ const outcome = await installAndCompile(prepareApp(entries, telemetry, runtimeSecrets));
118
+ return outcome.ok
119
+ ? { ok: true, module: outcome.module }
120
+ : { ok: false, errors: outcome.errors };
121
+ }
122
+ function allOk(entries) {
123
+ return entries.map((e) => ({ name: e.fn.name, ok: true }));
124
+ }
125
+ function appResponse(module, functions) {
126
+ return { ok: true, module, main_module: NORMALIZED_MAIN_MODULE, functions };
127
+ }
128
+ /** Map each combined-build error to the function whose `fn_<index>/` subtree it
129
+ * came from, stripping that prefix so the user sees their own path. Errors with
130
+ * no `fn_<index>/` prefix (a shared dep deep in node_modules, or no location)
131
+ * can't be pinned to one function. */
132
+ export function classifyAppErrors(errors) {
133
+ const byIndex = new Map();
134
+ const unattributable = [];
135
+ for (const err of errors) {
136
+ const match = err.file?.match(/^fn_(\d+)\/(.*)$/);
137
+ if (!match) {
138
+ unattributable.push(err);
139
+ continue;
140
+ }
141
+ const index = Number(match[1]);
142
+ const list = byIndex.get(index) ?? [];
143
+ list.push({ ...err, file: match[2] });
144
+ byIndex.set(index, list);
145
+ }
146
+ return { byIndex, unattributable };
147
+ }
148
+ /** Fallback for the rare error the combined build can't attribute to one
149
+ * function: compile each function alone — where every error is unambiguously
150
+ * its own — to learn which build, then build the survivors together. Reuses
151
+ * the same combined-build path, so there's no second bundling engine. */
152
+ async function bundleAppPerFunction(entries, telemetry = false, runtimeSecrets = false) {
153
+ const probes = await mapWithConcurrency(entries, MAX_PARALLEL_COMPILES, (entry) => probeFunction(entry, runtimeSecrets));
154
+ const functions = probes.map((p) => p.ok
155
+ ? { name: p.entry.fn.name, ok: true }
156
+ : { name: p.entry.fn.name, ok: false, errors: p.errors });
157
+ const survivors = probes.filter((p) => p.ok).map((p) => p.entry);
158
+ if (survivors.length === 0) {
159
+ return { ok: false, module: null, functions };
160
+ }
161
+ const combined = await compileApp(survivors, telemetry, runtimeSecrets);
162
+ if (combined.ok)
163
+ return appResponse(combined.module, functions);
164
+ // Each survivor built alone but not together: the combined graph resolved a
165
+ // shared npm package onto a version some importer can't use. Deterministic
166
+ // user-dep breakage — a 500 here gets retried by the platform and surfaced
167
+ // as an infrastructure error, hiding the diagnostics the agent needs.
168
+ return assembleWithoutConflicting(survivors, functions, combined.errors, telemetry, runtimeSecrets);
169
+ }
170
+ /** Assembly failed on errors originating inside shared npm deps. Blame the
171
+ * functions whose source imports the package (and major) the errors come
172
+ * from, rebuild the rest, and report the blamed ones with the real
173
+ * diagnostics. When nothing can be blamed — or the rebuild still fails —
174
+ * every remaining function reports the diagnostics instead of a crash. */
175
+ async function assembleWithoutConflicting(survivors, functions, errors, telemetry, runtimeSecrets = false) {
176
+ const failWith = (entries, items) => {
177
+ for (const e of entries) {
178
+ functions[e.index] = { name: e.fn.name, ok: false, errors: items };
179
+ }
180
+ };
181
+ const conflictErrors = [
182
+ {
183
+ message: "npm dependency version conflict: this function's dependencies resolve " +
184
+ "differently when bundled with the app's other functions. Align the " +
185
+ "conflicting package versions across functions.",
186
+ },
187
+ ...errors,
188
+ ];
189
+ const blamed = survivors.filter((e) => importsConflictingPackage(e, errors));
190
+ const rest = survivors.filter((e) => !blamed.includes(e));
191
+ if (blamed.length > 0 && rest.length > 0) {
192
+ const rebuilt = await compileApp(rest, telemetry, runtimeSecrets);
193
+ if (rebuilt.ok) {
194
+ failWith(blamed, conflictErrors);
195
+ return appResponse(rebuilt.module, functions);
196
+ }
197
+ // Removing the blamed functions exposed a further failure — no module was
198
+ // produced, so every survivor must report it (ok:false means all failed).
199
+ failWith(blamed, conflictErrors);
200
+ failWith(rest, [conflictErrors[0], ...rebuilt.errors]);
201
+ return { ok: false, module: null, functions };
202
+ }
203
+ failWith(blamed.length > 0 ? blamed : survivors, conflictErrors);
204
+ return { ok: false, module: null, functions };
205
+ }
206
+ // `imported from '…registry.npmjs.org/<pkg>/<version>/…'` — the package whose
207
+ // own imports the combined graph broke, i.e. the one to trace back to a function.
208
+ const IMPORTED_FROM_PACKAGE = /imported from '[^']*registry\.npmjs\.org\/((?:@[^/]+\/)?[^/@]+)\/(\d+)/g;
209
+ /** Does this function's source import one of the packages the assembly errors
210
+ * originate from, at (or possibly at) the failing major? A specifier pinned to
211
+ * a different major is exonerated — its copy of the package is the one that
212
+ * works; an unpinned specifier stays blamed. */
213
+ export function importsConflictingPackage(entry, errors) {
214
+ const culprits = new Map();
215
+ for (const err of errors) {
216
+ for (const m of err.message.matchAll(IMPORTED_FROM_PACKAGE)) {
217
+ (culprits.get(m[1]) ?? culprits.set(m[1], new Set()).get(m[1])).add(m[2]);
218
+ }
219
+ }
220
+ const sources = Object.values(entry.fn.files);
221
+ for (const [pkg, majors] of culprits) {
222
+ const spec = new RegExp(`['"](?:npm:)?(${escapeRegExp(pkg)})(@[^'"]*)?['"/]`);
223
+ for (const source of sources) {
224
+ const m = source.match(spec);
225
+ if (!m)
226
+ continue;
227
+ const pinnedMajor = m[2]?.match(/\d+/)?.[0];
228
+ if (!pinnedMajor || majors.has(pinnedMajor))
229
+ return true;
230
+ }
231
+ }
232
+ return false;
233
+ }
234
+ function escapeRegExp(s) {
235
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
236
+ }
237
+ /** Compile one function alone. With only its files in the build, every error is
238
+ * its own — the `fn_<index>/` ones stripped, the rest (deep deps) kept as-is.
239
+ * Compiles in the real `runtimeSecrets` mode so a mode-dependent failure (a
240
+ * user file named the reserved activation filename) is attributed to its
241
+ * function instead of leaking out of the final assembly as a 500. */
242
+ async function probeFunction(entry, runtimeSecrets = false) {
243
+ let outcome;
244
+ try {
245
+ outcome = await compileApp([entry], false, runtimeSecrets);
246
+ }
247
+ catch (e) {
248
+ if (e instanceof DenoCompatError) {
249
+ return { ok: false, entry, errors: [denoCompatErrorItem(e)] };
250
+ }
251
+ throw e;
252
+ }
253
+ if (outcome.ok)
254
+ return { ok: true, entry };
255
+ const { byIndex, unattributable } = classifyAppErrors(outcome.errors);
256
+ return {
257
+ ok: false,
258
+ entry,
259
+ errors: [...(byIndex.get(entry.index) ?? []), ...unattributable],
260
+ };
261
+ }
262
+ /** Map with a bounded number of concurrent workers; results keep input order. */
263
+ async function mapWithConcurrency(items, limit, fn) {
264
+ const results = new Array(items.length);
265
+ let cursor = 0;
266
+ const worker = async () => {
267
+ while (cursor < items.length) {
268
+ const index = cursor++;
269
+ results[index] = await fn(items[index]);
270
+ }
271
+ };
272
+ const size = Math.min(limit, items.length);
273
+ await Promise.all(Array.from({ length: size }, () => worker()));
274
+ return results;
275
+ }
276
+ // The resolution failures that only happen in "none" mode and that "auto" fixes.
277
+ const NODE_MODULES_FALLBACK = /ERR_MODULE_NOT_FOUND|Could not find referrer npm package/;
278
+ /** Compile the prepared tree to a single module via the Deno resolver engine.
279
+ * Shared by the single-function path and the combined app build. */
280
+ async function installAndCompile(prepared) {
281
+ return withSpan("base44.bundler.compile", async () => {
282
+ // The problem this solves: we resolve npm from the shared cache without a
283
+ // per-build node_modules ("none") because it's fast. But Deno sometimes splits
284
+ // a package into a deduplicated "phantom" copy — e.g. two resend versions both
285
+ // pull react-dom, so it creates react-dom@18.2.0 AND react-dom@18.2.0_1 — and
286
+ // that "_1" copy has no folder on disk, so "none" can't load its files and the
287
+ // whole app fails to bundle. Retry just that failure with "auto", which writes
288
+ // a real node_modules where the phantom copy becomes a real directory.
289
+ let mode = "none";
290
+ let result = await bundleToModule(prepared, mode);
291
+ if (!result.ok &&
292
+ result.errors.some((e) => NODE_MODULES_FALLBACK.test(e.message))) {
293
+ mode = "auto";
294
+ result = await bundleToModule(prepared, mode);
295
+ }
296
+ // node_modules_mode:auto marks the fallback firing; with outcome it shows how
297
+ // often the edge case hits and whether "auto" then rescued it.
298
+ await setSpanTags({
299
+ node_modules_mode: mode,
300
+ outcome: result.ok ? "ok" : "failed",
301
+ });
302
+ if (result.ok) {
303
+ return { ok: true, module: result.module, warnings: result.warnings };
304
+ }
305
+ return { ok: false, stage: "esbuild", errors: result.errors };
306
+ });
307
+ }
308
+ function denoCompatErrorOrThrow(e) {
309
+ if (e instanceof DenoCompatError) {
310
+ return {
311
+ ok: false,
312
+ stage: "deno_compat",
313
+ errors: [denoCompatErrorItem(e)],
314
+ };
315
+ }
316
+ throw e;
317
+ }
318
+ function denoCompatErrorItem(e) {
319
+ return { message: e.message, file: e.file };
320
+ }
321
+ //# sourceMappingURL=bundler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler.js","sourceRoot":"","sources":["../../src/bundler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAwB,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAGL,UAAU,EACV,eAAe,GAChB,MAAM,mBAAmB,CAAC;AA6C3B,2EAA2E;AAC3E,0EAA0E;AAC1E,uCAAuC;AACvC,MAAM,sBAAsB,GAAG,cAAc,CAAC;AAE9C,6EAA6E;AAC7E,iFAAiF;AACjF,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,GAA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E,EAAE,CAAC;YACd,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxE,CAAC;QACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB,CAAC,CAAU;IACxC,IAAI,CAAC,YAAY,eAAe,EAAE,CAAC;QACjC,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;SACjC,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,CAAC;AACV,CAAC;AAED,SAAS,mBAAmB,CAAC,CAAkB;IAC7C,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { z } from "zod";
2
+ export declare const bundleRequestSchema: z.ZodEffects<z.ZodObject<{
3
+ entry: z.ZodString;
4
+ files: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>;
5
+ postResponseTelemetry: z.ZodOptional<z.ZodBoolean>;
6
+ runtimeSecrets: z.ZodOptional<z.ZodBoolean>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ entry: string;
9
+ files: Record<string, string>;
10
+ postResponseTelemetry?: boolean | undefined;
11
+ runtimeSecrets?: boolean | undefined;
12
+ }, {
13
+ entry: string;
14
+ files: Record<string, string>;
15
+ postResponseTelemetry?: boolean | undefined;
16
+ runtimeSecrets?: boolean | undefined;
17
+ }>, {
18
+ entry: string;
19
+ files: Record<string, string>;
20
+ postResponseTelemetry?: boolean | undefined;
21
+ runtimeSecrets?: boolean | undefined;
22
+ }, {
23
+ entry: string;
24
+ files: Record<string, string>;
25
+ postResponseTelemetry?: boolean | undefined;
26
+ runtimeSecrets?: boolean | undefined;
27
+ }>;
28
+ export declare const appFunctionSchema: z.ZodEffects<z.ZodObject<{
29
+ name: z.ZodString;
30
+ entry: z.ZodString;
31
+ files: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ entry: string;
34
+ files: Record<string, string>;
35
+ name: string;
36
+ }, {
37
+ entry: string;
38
+ files: Record<string, string>;
39
+ name: string;
40
+ }>, {
41
+ entry: string;
42
+ files: Record<string, string>;
43
+ name: string;
44
+ }, {
45
+ entry: string;
46
+ files: Record<string, string>;
47
+ name: string;
48
+ }>;
49
+ export declare const bundleAppRequestSchema: z.ZodEffects<z.ZodObject<{
50
+ functions: z.ZodArray<z.ZodEffects<z.ZodObject<{
51
+ name: z.ZodString;
52
+ entry: z.ZodString;
53
+ files: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ entry: string;
56
+ files: Record<string, string>;
57
+ name: string;
58
+ }, {
59
+ entry: string;
60
+ files: Record<string, string>;
61
+ name: string;
62
+ }>, {
63
+ entry: string;
64
+ files: Record<string, string>;
65
+ name: string;
66
+ }, {
67
+ entry: string;
68
+ files: Record<string, string>;
69
+ name: string;
70
+ }>, "many">;
71
+ postResponseTelemetry: z.ZodOptional<z.ZodBoolean>;
72
+ runtimeSecrets: z.ZodOptional<z.ZodBoolean>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ functions: {
75
+ entry: string;
76
+ files: Record<string, string>;
77
+ name: string;
78
+ }[];
79
+ postResponseTelemetry?: boolean | undefined;
80
+ runtimeSecrets?: boolean | undefined;
81
+ }, {
82
+ functions: {
83
+ entry: string;
84
+ files: Record<string, string>;
85
+ name: string;
86
+ }[];
87
+ postResponseTelemetry?: boolean | undefined;
88
+ runtimeSecrets?: boolean | undefined;
89
+ }>, {
90
+ functions: {
91
+ entry: string;
92
+ files: Record<string, string>;
93
+ name: string;
94
+ }[];
95
+ postResponseTelemetry?: boolean | undefined;
96
+ runtimeSecrets?: boolean | undefined;
97
+ }, {
98
+ functions: {
99
+ entry: string;
100
+ files: Record<string, string>;
101
+ name: string;
102
+ }[];
103
+ postResponseTelemetry?: boolean | undefined;
104
+ runtimeSecrets?: boolean | undefined;
105
+ }>;
106
+ export type BundleRequest = z.infer<typeof bundleRequestSchema>;
107
+ export type AppFunctionInput = z.infer<typeof appFunctionSchema>;
108
+ export type BundleAppRequest = z.infer<typeof bundleAppRequestSchema>;
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ const fileMapSchema = z
3
+ .record(z.string().min(1), z.string())
4
+ .refine((files) => Object.keys(files).length > 0, {
5
+ message: "must contain at least one file",
6
+ });
7
+ export const bundleRequestSchema = z
8
+ .object({
9
+ entry: z.string().min(1),
10
+ files: fileMapSchema,
11
+ // Backend-evaluated post-response-telemetry flag: bake the
12
+ // detached-work telemetry prelude into the generated Worker entry.
13
+ postResponseTelemetry: z.boolean().optional(),
14
+ // Backend-evaluated runtime-secrets flag: bake the encrypted activation
15
+ // handshake into the generated Worker entry (secrets arrive per isolate
16
+ // instead of as secret_text bindings).
17
+ runtimeSecrets: z.boolean().optional(),
18
+ })
19
+ .refine((body) => body.entry in body.files, {
20
+ message: "`entry` must be a key in `files`",
21
+ });
22
+ export const appFunctionSchema = z
23
+ .object({
24
+ name: z.string().min(1),
25
+ entry: z.string().min(1),
26
+ files: fileMapSchema,
27
+ })
28
+ .refine((fn) => fn.entry in fn.files, {
29
+ message: "`entry` must be a key in `files`",
30
+ });
31
+ export const bundleAppRequestSchema = z
32
+ .object({
33
+ functions: z.array(appFunctionSchema).min(1),
34
+ postResponseTelemetry: z.boolean().optional(),
35
+ runtimeSecrets: z.boolean().optional(),
36
+ })
37
+ .refine((body) => new Set(body.functions.map((fn) => fn.name)).size ===
38
+ body.functions.length, { message: "function names must be unique" });
39
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,aAAa,GAAG,CAAC;KACpB,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;KACrC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;IAChD,OAAO,EAAE,gCAAgC;CAC1C,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,KAAK,EAAE,aAAa;IACpB,2DAA2D;IAC3D,mEAAmE;IACnE,qBAAqB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC7C,wEAAwE;IACxE,wEAAwE;IACxE,uCAAuC;IACvC,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC;KACD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE;IAC1C,OAAO,EAAE,kCAAkC;CAC5C,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,KAAK,EAAE,aAAa;CACrB,CAAC;KACD,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,KAAK,EAAE;IACpC,OAAO,EAAE,kCAAkC;CAC5C,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,qBAAqB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC7C,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC;KACD,MAAM,CACL,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;IACjD,IAAI,CAAC,SAAS,CAAC,MAAM,EACvB,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAC7C,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Bundle engine. Compiles a prepared worker tree (user files + injected shim +
3
+ * generated entry) into a single workerd ESM module using Deno's own resolver
4
+ * via the `deno-resolver` adapter over `@deno/loader`: `npm:`, `jsr:`, and
5
+ * `https:` specifiers resolve exactly as Deno resolves them (multiple versions,
6
+ * nested deps, correct exports).
7
+ *
8
+ * The loader reads source from a real filesystem, so the tree is materialized
9
+ * into a per-request temp dir, compiled, and removed. `node:` builtins stay
10
+ * external (workerd's `nodejs_compat` provides them) and `cloudflare:*` stays
11
+ * external (provided by the runtime).
12
+ */
13
+ import type { BundleErrorItem } from "./errors.js";
14
+ import type { PreparedWorker } from "./worker-entry.js";
15
+ export type NodeModulesMode = "none" | "auto";
16
+ type EngineResult = {
17
+ ok: true;
18
+ module: string;
19
+ warnings: string[];
20
+ } | {
21
+ ok: false;
22
+ errors: BundleErrorItem[];
23
+ };
24
+ /**
25
+ * Compile `prepared` to a single ESM module string. Resolution/compile failures
26
+ * (user-attributable) return `{ ok: false }`; infrastructure failures (temp dir,
27
+ * missing output) throw.
28
+ */
29
+ export declare function bundleToModule(prepared: PreparedWorker, nodeModulesDir?: NodeModulesMode): Promise<EngineResult>;
30
+ export {};