@base44/functions-compiler 0.1.0 → 0.1.2
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/README.md +103 -37
- package/lib/src/assembly.d.ts +43 -0
- package/lib/src/assembly.js +167 -0
- package/lib/src/assembly.js.map +1 -0
- package/lib/src/deno-bundle.js +3 -0
- package/lib/src/deno-bundle.js.map +1 -1
- package/lib/src/index.d.ts +8 -0
- package/lib/src/index.js +4 -0
- package/lib/src/index.js.map +1 -1
- package/lib/src/invocation-logs.d.ts +6 -0
- package/lib/src/invocation-logs.js +51 -0
- package/lib/src/invocation-logs.js.map +1 -0
- package/lib/src/shards/build.d.ts +55 -0
- package/lib/src/shards/build.js +156 -0
- package/lib/src/shards/build.js.map +1 -0
- package/lib/src/shards/plan.d.ts +50 -0
- package/lib/src/shards/plan.js +78 -0
- package/lib/src/shards/plan.js.map +1 -0
- package/lib/src/shards/size.d.ts +45 -0
- package/lib/src/shards/size.js +64 -0
- package/lib/src/shards/size.js.map +1 -0
- package/lib/src/version.d.ts +15 -0
- package/lib/src/version.js +16 -0
- package/lib/src/version.js.map +1 -0
- package/lib/src/worker-entry.d.ts +2 -3
- package/lib/src/worker-entry.js +46 -10
- package/lib/src/worker-entry.js.map +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -17,52 +17,91 @@ Two consumers share this one engine:
|
|
|
17
17
|
Internal to Base44 — published **public** so apper's bundler service can install
|
|
18
18
|
it, but it is not a supported public API: the CLI bundles it at build time so
|
|
19
19
|
end users never install it, and it carries no compatibility promise to anyone
|
|
20
|
-
outside this repo.
|
|
21
|
-
|
|
20
|
+
outside this repo. Compilation is the whole of its job, and that now includes
|
|
21
|
+
source assembly, shard planning, size measurement and splitting. Artifact
|
|
22
|
+
writing, version creation, upload and deploy live above it.
|
|
22
23
|
|
|
23
24
|
The package carries no credentials and reads no configuration of its own. It
|
|
24
25
|
names the environment variables and headers the generated worker will use at
|
|
25
26
|
runtime (`BASE44_*`, `X-Base44-*`) but holds none of their values, and the code
|
|
26
27
|
it ships is the same code already compiled into every deployed user worker.
|
|
27
28
|
|
|
28
|
-
##
|
|
29
|
+
## Shards and whole-app builds
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
This package turns an app's whole backend function set into deployable Cloudflare
|
|
32
|
+
Workers: it assembles each function's sources, groups them into shards, compiles
|
|
33
|
+
each shard, measures it against Cloudflare's ceilings, and halves any shard whose
|
|
34
|
+
module is over one. `compileFunctionShards` is the entry point, and unlike
|
|
35
|
+
`bundleApp` it refuses a partial result — a module missing a handler is a broken
|
|
36
|
+
app, not a smaller success.
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
Each piece came from apper, and the provenance is worth keeping:
|
|
39
|
+
|
|
40
|
+
| Piece | Where it came from | Here |
|
|
38
41
|
|---|---|---|
|
|
39
|
-
| Source assembly | `function_bundle.py` — `cfw_bundle_input`, `collect_reachable_backend_files` |
|
|
40
|
-
| Fresh shard planning | `shard_planning.py` — `full_repartition`, `target_shard_count` |
|
|
41
|
-
| Size measurement | `cloudflare_wfp_runtime.py` — `measure_bundle_bytes`, `judge_bundle_size` |
|
|
42
|
-
| Split on overflow | `cloudflare_wfp_runtime.py` — `_build_shard_with_split` |
|
|
43
|
-
| Whole-build validation | apper PR #23460 |
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
the
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
42
|
+
| Source assembly | `function_bundle.py` — `cfw_bundle_input`, `collect_reachable_backend_files` | `src/assembly.ts` |
|
|
43
|
+
| Fresh shard planning | `shard_planning.py` — `full_repartition`, `target_shard_count` | `src/shards/plan.ts` |
|
|
44
|
+
| Size measurement | `cloudflare_wfp_runtime.py` — `measure_bundle_bytes`, `judge_bundle_size` | `src/shards/size.ts` |
|
|
45
|
+
| Split on overflow | `cloudflare_wfp_runtime.py` — `_build_shard_with_split` | `src/shards/build.ts` |
|
|
46
|
+
| Whole-build validation | apper PR #23460 | `src/shards/build.ts` |
|
|
47
|
+
|
|
48
|
+
Policy numbers — shard size, shard count, the compressed cap — arrive as inputs.
|
|
49
|
+
The package reads no settings and no feature flags, and the two wrapper flags
|
|
50
|
+
(`postResponseTelemetry`, `runtimeSecrets`) are handed to it, because both change
|
|
51
|
+
the emitted bytes and only the platform knows their value for an app.
|
|
52
|
+
|
|
53
|
+
Deliberately not here: Deno deployment targets, existing-Worker reuse, provider
|
|
54
|
+
upload, binding resolution, secret delivery, and incremental shard reuse — every
|
|
55
|
+
version is built from scratch, so nothing here remembers a previous deploy. The
|
|
56
|
+
engine keeps its actor support for the legacy service that still uses it.
|
|
57
|
+
|
|
58
|
+
### What a bundle says about itself
|
|
59
|
+
|
|
60
|
+
The first line of a compiled shard is its own manifest:
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
//!b44:1 {"functions":["cleanupForgottenDepartures","health","sendReminder"],"telemetry":false,"runtimeSecrets":false,"compiler":"0.1.0"}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`//!b44:<format>` is a fixed sentinel, so `head -1` on a script pulled from
|
|
67
|
+
Cloudflare answers "what is in this?" without executing or parsing anything, and
|
|
68
|
+
the payload is JSON so a tool parses it in one call. Only the app path emits it;
|
|
69
|
+
the legacy single-function `bundle()` stays bannerless, which keeps that lane
|
|
70
|
+
byte-comparable with the engine apper still runs.
|
|
71
|
+
|
|
72
|
+
`functions` is sorted whatever order the shard was built in. `telemetry` and
|
|
73
|
+
`runtimeSecrets` are there because they change the emitted bytes and a deploy has
|
|
74
|
+
to pair its secrets delivery with them. `compiler` is this package's version.
|
|
75
|
+
|
|
76
|
+
Nothing volatile may be added: a timestamp or build id would re-mint a version
|
|
77
|
+
for unchanged code, the app id would make the same functions compile differently
|
|
78
|
+
per app, and the shard's position would make two identical shards differ.
|
|
79
|
+
|
|
80
|
+
### Reproducibility is a contract, not a nicety
|
|
81
|
+
|
|
82
|
+
A version's identity is the hash of the **compiled artifacts**, never of the
|
|
83
|
+
sources. Anything that shifts the emitted bytes therefore mints a new version of
|
|
84
|
+
code that did not change, and all of these do:
|
|
85
|
+
|
|
86
|
+
- the version of this package, and the depth of the `node_modules` it was built
|
|
87
|
+
against — esbuild writes each vendored chunk's relative path into the minified
|
|
88
|
+
output, so building one directory shallower changes every user Worker's bytes;
|
|
89
|
+
- the order the caller hands functions over in, for a single shard: that path
|
|
90
|
+
builds in caller order, while a multi-shard plan sorts by name. Both branches
|
|
91
|
+
are as apper has them, and `shard-build.e2e.test.ts` pins the difference;
|
|
92
|
+
- either wrapper flag.
|
|
93
|
+
|
|
94
|
+
Two behaviours differ from apper's Python on purpose, and both are tested:
|
|
95
|
+
|
|
96
|
+
- **An unparseable source.** apper reads each file on its own, so a file it
|
|
97
|
+
cannot parse contributes no edges while the rest of the set still assembles.
|
|
98
|
+
esbuild's walk is one build over the whole graph, so anything unparseable in it
|
|
99
|
+
rejects — the fallback is the flat single-file submission, and the compiler then
|
|
100
|
+
reports the error itself.
|
|
101
|
+
- **Compressed size.** Node's gzip reads about 0.7% heavier than Python's on
|
|
102
|
+
identical input: 43,057 bytes against 42,765 on a real 122,324-byte module. The
|
|
103
|
+
direction is the safe one, since this lane refuses slightly earlier than the
|
|
104
|
+
service would.
|
|
66
105
|
|
|
67
106
|
## Using it
|
|
68
107
|
|
|
@@ -135,3 +174,30 @@ bun run build # shims + tsc -> lib/ + assets; what gets published
|
|
|
135
174
|
a sibling workspace — needs `bun run build` here first. There is deliberately
|
|
136
175
|
no source-resolving export condition: the tarball ships `lib/` alone, and a
|
|
137
176
|
second resolution path would mean two answers to "which code ran".
|
|
177
|
+
|
|
178
|
+
## Releasing
|
|
179
|
+
|
|
180
|
+
Run the **Manual Functions Compiler Publish** workflow
|
|
181
|
+
(`.github/workflows/functions-compiler-publish.yml`) from the Actions tab. It
|
|
182
|
+
bumps the version, syncs the `COMPILER_VERSION` literal, builds `lib/`,
|
|
183
|
+
publishes to npm, and pushes a `functions-compiler-v<version>` tag plus the
|
|
184
|
+
release commit.
|
|
185
|
+
|
|
186
|
+
A version lives in two files — `package.json` and the literal in
|
|
187
|
+
`src/version.ts` that goes into every compiled shard's banner. Bumping by hand
|
|
188
|
+
means running `bun run scripts/sync-version.ts` after editing `package.json`;
|
|
189
|
+
`version.test.ts` fails the build if the two drift apart. The CLI's own
|
|
190
|
+
release train is a separate workflow with its own `v<version>` tags; the two
|
|
191
|
+
never move together.
|
|
192
|
+
|
|
193
|
+
Authentication is npm **trusted publishing** (OIDC) — no token in the repo. The
|
|
194
|
+
registry keys a trusted publisher on the repo *and the workflow filename*, so
|
|
195
|
+
`@base44/functions-compiler` needs its own entry on npmjs.com pointing at
|
|
196
|
+
`functions-compiler-publish.yml`; the entries for `manual-publish.yml` do not
|
|
197
|
+
cover it.
|
|
198
|
+
|
|
199
|
+
The workflow only builds and publishes. What proves the tarball actually works —
|
|
200
|
+
`scripts/verify-package.ts`, which packs, installs the tarball into a throwaway
|
|
201
|
+
directory and compiles a real function there — runs in `functions-compiler.yml`
|
|
202
|
+
on every push to `main`, behind the Wix embargo gateway. Publish from a commit
|
|
203
|
+
that went green there.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn a backend function into the `{entry, files}` the compiler takes.
|
|
3
|
+
*
|
|
4
|
+
* A function may import a helper beside it or a module shared across functions
|
|
5
|
+
* (`../../shared/x.ts`). The compiler resolves relative imports by exact match
|
|
6
|
+
* inside `files`, so anything the function reaches has to be submitted with it —
|
|
7
|
+
* otherwise the import has no target and the build fails with "can't reach
|
|
8
|
+
* outside the function".
|
|
9
|
+
*
|
|
10
|
+
* Ported from apper's `backend/app/cloudflare_functions/function_bundle.py`.
|
|
11
|
+
* That walks the import graph with a tree-sitter parse, as a stand-in for what
|
|
12
|
+
* the bundler would see; here esbuild does the walk, so it is not a stand-in —
|
|
13
|
+
* the file set is what the compiler itself reaches. Verified against the Python
|
|
14
|
+
* fixtures in assembly.test.ts.
|
|
15
|
+
*/
|
|
16
|
+
export interface BundleInput {
|
|
17
|
+
entry: string;
|
|
18
|
+
files: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Every backend file reachable from `entryPath` through `./` and `../` imports,
|
|
22
|
+
* including the entry. A specifier with no target in `backendFiles` — a typo, or
|
|
23
|
+
* a frontend file the caller deliberately excluded — is left out, so it stays
|
|
24
|
+
* forbidden by the compiler rather than being resolved here. `npm:`, `jsr:`,
|
|
25
|
+
* `node:` and bare specifiers are not edges into the project and are ignored.
|
|
26
|
+
*
|
|
27
|
+
* A source the walk cannot parse yields the entry alone, so the function
|
|
28
|
+
* compiles as the flat single-file submission and the compiler reports the
|
|
29
|
+
* error itself.
|
|
30
|
+
*/
|
|
31
|
+
export declare function collectReachableFiles(entryPath: string, backendFiles: Record<string, string>): Promise<Record<string, string>>;
|
|
32
|
+
/**
|
|
33
|
+
* The `{entry, files}` to compile for one function.
|
|
34
|
+
*
|
|
35
|
+
* A function that reaches nothing beyond its own entry keeps the flat
|
|
36
|
+
* `main.ts` submission, byte-identical to how it compiles today. One that
|
|
37
|
+
* reaches a helper or a shared module gets its real project path as the entry,
|
|
38
|
+
* so `../../shared/x.ts` resolves against the files beside it.
|
|
39
|
+
*
|
|
40
|
+
* `backendFiles` must hold the backend tree only. A frontend path left in it
|
|
41
|
+
* would resolve, and a function would silently bundle frontend code.
|
|
42
|
+
*/
|
|
43
|
+
export declare function cfwBundleInput(entryPath: string, entryContent: string, backendFiles: Record<string, string>): Promise<BundleInput>;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn a backend function into the `{entry, files}` the compiler takes.
|
|
3
|
+
*
|
|
4
|
+
* A function may import a helper beside it or a module shared across functions
|
|
5
|
+
* (`../../shared/x.ts`). The compiler resolves relative imports by exact match
|
|
6
|
+
* inside `files`, so anything the function reaches has to be submitted with it —
|
|
7
|
+
* otherwise the import has no target and the build fails with "can't reach
|
|
8
|
+
* outside the function".
|
|
9
|
+
*
|
|
10
|
+
* Ported from apper's `backend/app/cloudflare_functions/function_bundle.py`.
|
|
11
|
+
* That walks the import graph with a tree-sitter parse, as a stand-in for what
|
|
12
|
+
* the bundler would see; here esbuild does the walk, so it is not a stand-in —
|
|
13
|
+
* the file set is what the compiler itself reaches. Verified against the Python
|
|
14
|
+
* fixtures in assembly.test.ts.
|
|
15
|
+
*/
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import { build } from "esbuild";
|
|
18
|
+
const NAMESPACE = "base44-reachability";
|
|
19
|
+
/** The flat shape a single-file function has always been submitted as. Keeping
|
|
20
|
+
* it means those functions compile to the same bytes they do today. */
|
|
21
|
+
const FLAT_ENTRY = "main.ts";
|
|
22
|
+
function loaderFor(filePath) {
|
|
23
|
+
if (/\.(ts|mts|cts)$/.test(filePath))
|
|
24
|
+
return "ts";
|
|
25
|
+
if (filePath.endsWith(".tsx"))
|
|
26
|
+
return "tsx";
|
|
27
|
+
if (filePath.endsWith(".jsx"))
|
|
28
|
+
return "jsx";
|
|
29
|
+
if (filePath.endsWith(".json"))
|
|
30
|
+
return "json";
|
|
31
|
+
return "js";
|
|
32
|
+
}
|
|
33
|
+
function resolveRelative(importer, spec, files) {
|
|
34
|
+
const dir = importer.includes("/")
|
|
35
|
+
? importer.slice(0, importer.lastIndexOf("/"))
|
|
36
|
+
: "";
|
|
37
|
+
const resolved = path.posix.normalize(path.posix.join(dir, spec));
|
|
38
|
+
return resolved in files ? resolved : null;
|
|
39
|
+
}
|
|
40
|
+
/** esbuild's own account of what the entry reaches: the metafile inputs, keyed
|
|
41
|
+
* by the paths the plugin resolved. Its own function so a failure can be
|
|
42
|
+
* handled by the caller. */
|
|
43
|
+
async function walkInputs(entryPath, backendFiles) {
|
|
44
|
+
const result = await build({
|
|
45
|
+
entryPoints: [entryPath],
|
|
46
|
+
bundle: true,
|
|
47
|
+
write: false,
|
|
48
|
+
metafile: true,
|
|
49
|
+
logLevel: "silent",
|
|
50
|
+
// Only the metafile is read, never the output, so neither of these can
|
|
51
|
+
// change what the compiler emits. They decide what the walk ACCEPTS: the
|
|
52
|
+
// default iife format rejects top-level await, which a Deno function may
|
|
53
|
+
// legitimately use, and the walk would then reject a file the compiler
|
|
54
|
+
// itself compiles fine.
|
|
55
|
+
format: "esm",
|
|
56
|
+
platform: "neutral",
|
|
57
|
+
// Every path here is a project path served from memory and nothing resolves
|
|
58
|
+
// to the filesystem, so this only has to be a valid absolute path — and
|
|
59
|
+
// `path.sep` is not one on Windows, where esbuild refuses "\\".
|
|
60
|
+
absWorkingDir: process.cwd(),
|
|
61
|
+
// TypeScript drops an import whose bindings go unused, which would hide a
|
|
62
|
+
// file the function really does pull in. Keep every import as written.
|
|
63
|
+
tsconfigRaw: { compilerOptions: { verbatimModuleSyntax: true } },
|
|
64
|
+
plugins: [
|
|
65
|
+
{
|
|
66
|
+
name: "base44-reachability",
|
|
67
|
+
setup(pluginBuild) {
|
|
68
|
+
pluginBuild.onResolve({ filter: /.*/ }, (args) => {
|
|
69
|
+
if (args.kind === "entry-point") {
|
|
70
|
+
return { path: entryPath, namespace: NAMESPACE };
|
|
71
|
+
}
|
|
72
|
+
if (args.path.startsWith("./") || args.path.startsWith("../")) {
|
|
73
|
+
const target = resolveRelative(args.importer, args.path, backendFiles);
|
|
74
|
+
if (target)
|
|
75
|
+
return { path: target, namespace: NAMESPACE };
|
|
76
|
+
}
|
|
77
|
+
return { path: args.path, external: true };
|
|
78
|
+
});
|
|
79
|
+
pluginBuild.onLoad({ filter: /.*/, namespace: NAMESPACE }, (args) => ({
|
|
80
|
+
contents: backendFiles[args.path],
|
|
81
|
+
loader: loaderFor(args.path),
|
|
82
|
+
}));
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
});
|
|
87
|
+
return result.metafile.inputs;
|
|
88
|
+
}
|
|
89
|
+
/** Did this build fail on the user's code, rather than on how the walk was
|
|
90
|
+
* set up? Every message esbuild raises about a source it loaded carries a
|
|
91
|
+
* location in this plugin's namespace; a configuration fault carries no
|
|
92
|
+
* location at all (verified against both shapes). */
|
|
93
|
+
function isUserSourceFailure(error) {
|
|
94
|
+
const errors = error.errors;
|
|
95
|
+
return (Array.isArray(errors) &&
|
|
96
|
+
errors.length > 0 &&
|
|
97
|
+
errors.every((e) => e.location?.file?.startsWith(`${NAMESPACE}:`) === true));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Every backend file reachable from `entryPath` through `./` and `../` imports,
|
|
101
|
+
* including the entry. A specifier with no target in `backendFiles` — a typo, or
|
|
102
|
+
* a frontend file the caller deliberately excluded — is left out, so it stays
|
|
103
|
+
* forbidden by the compiler rather than being resolved here. `npm:`, `jsr:`,
|
|
104
|
+
* `node:` and bare specifiers are not edges into the project and are ignored.
|
|
105
|
+
*
|
|
106
|
+
* A source the walk cannot parse yields the entry alone, so the function
|
|
107
|
+
* compiles as the flat single-file submission and the compiler reports the
|
|
108
|
+
* error itself.
|
|
109
|
+
*/
|
|
110
|
+
export async function collectReachableFiles(entryPath, backendFiles) {
|
|
111
|
+
if (!(entryPath in backendFiles)) {
|
|
112
|
+
throw new Error(`entry "${entryPath}" is not among the backend files`);
|
|
113
|
+
}
|
|
114
|
+
let inputs;
|
|
115
|
+
try {
|
|
116
|
+
inputs = await walkInputs(entryPath, backendFiles);
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
// apper's walk cannot fail this way: it reads each file on its own, so a
|
|
120
|
+
// file it cannot parse contributes no edges and the rest of the set still
|
|
121
|
+
// assembles. esbuild's walk is all-or-nothing — one unparseable source
|
|
122
|
+
// anywhere in the graph rejects here. Falling back to the entry alone keeps
|
|
123
|
+
// the flat submission a single-file function has always had, and the compile
|
|
124
|
+
// then fails with the compiler's own diagnostic, which the builder agent can
|
|
125
|
+
// act on. An exception out of assembly has nowhere to be reported at all.
|
|
126
|
+
//
|
|
127
|
+
// Only for the user's own sources, though. A fault in how this walk is
|
|
128
|
+
// configured also arrives here, and degrading it to a flat submission
|
|
129
|
+
// reports OUR bug as the user's unresolved import — which is how the format
|
|
130
|
+
// and working-directory defects above stayed invisible.
|
|
131
|
+
if (!isUserSourceFailure(e))
|
|
132
|
+
throw e;
|
|
133
|
+
return { [entryPath]: backendFiles[entryPath] };
|
|
134
|
+
}
|
|
135
|
+
const reached = {};
|
|
136
|
+
for (const input of Object.keys(inputs)) {
|
|
137
|
+
const filePath = input.startsWith(`${NAMESPACE}:`)
|
|
138
|
+
? input.slice(NAMESPACE.length + 1)
|
|
139
|
+
: input;
|
|
140
|
+
if (filePath in backendFiles)
|
|
141
|
+
reached[filePath] = backendFiles[filePath];
|
|
142
|
+
}
|
|
143
|
+
return reached;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The `{entry, files}` to compile for one function.
|
|
147
|
+
*
|
|
148
|
+
* A function that reaches nothing beyond its own entry keeps the flat
|
|
149
|
+
* `main.ts` submission, byte-identical to how it compiles today. One that
|
|
150
|
+
* reaches a helper or a shared module gets its real project path as the entry,
|
|
151
|
+
* so `../../shared/x.ts` resolves against the files beside it.
|
|
152
|
+
*
|
|
153
|
+
* `backendFiles` must hold the backend tree only. A frontend path left in it
|
|
154
|
+
* would resolve, and a function would silently bundle frontend code.
|
|
155
|
+
*/
|
|
156
|
+
export async function cfwBundleInput(entryPath, entryContent, backendFiles) {
|
|
157
|
+
const files = await collectReachableFiles(entryPath, {
|
|
158
|
+
...backendFiles,
|
|
159
|
+
[entryPath]: entryContent,
|
|
160
|
+
});
|
|
161
|
+
const reachedOnlyTheEntry = Object.keys(files).length === 1 && entryPath in files;
|
|
162
|
+
if (reachedOnlyTheEntry) {
|
|
163
|
+
return { entry: FLAT_ENTRY, files: { [FLAT_ENTRY]: entryContent } };
|
|
164
|
+
}
|
|
165
|
+
return { entry: entryPath, files };
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=assembly.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assembly.js","sourceRoot":"","sources":["../../src/assembly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,SAAS,GAAG,qBAAqB,CAAC;AAExC;wEACwE;AACxE,MAAM,UAAU,GAAG,SAAS,CAAC;AAO7B,SAAS,SAAS,CAAC,QAAgB;IACjC,IAAI,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAa,CAAC;IAC3D,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,KAAc,CAAC;IACrD,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,KAAc,CAAC;IACrD,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,MAAe,CAAC;IACvD,OAAO,IAAa,CAAC;AACvB,CAAC;AAED,SAAS,eAAe,CACtB,QAAgB,EAChB,IAAY,EACZ,KAA6B;IAE7B,MAAM,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;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AAE,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,YAAY,EAAE,EAAE,CAAC;IACtE,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACrC,CAAC"}
|
package/lib/src/deno-bundle.js
CHANGED
|
@@ -54,6 +54,9 @@ export async function bundleToModule(prepared, nodeModulesDir = "none") {
|
|
|
54
54
|
// (npm/Emscripten glue), leaving loader-bound CJS locals intact.
|
|
55
55
|
define: { __dirname: '"/"', __filename: '"/index.js"' },
|
|
56
56
|
minify: true,
|
|
57
|
+
// Prepended verbatim and not minified away, which is the point: it is
|
|
58
|
+
// the one place a compiled module says what is inside it.
|
|
59
|
+
...(prepared.banner ? { banner: { js: prepared.banner } } : {}),
|
|
57
60
|
sourcemap: false,
|
|
58
61
|
// Errors are surfaced structurally (return value / BuildFailure); keep
|
|
59
62
|
// esbuild from dumping diagnostics to the service's stderr.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deno-bundle.js","sourceRoot":"","sources":["../../src/deno-bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAqB,KAAK,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MA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C;IAC7D,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC"}
|
package/lib/src/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type { BundleInput } from "./assembly.js";
|
|
2
|
+
export { cfwBundleInput, collectReachableFiles } from "./assembly.js";
|
|
1
3
|
export type { AppErrorClassification, AppFunctionStatus, BundleAppResponse, BundleErrorStage, BundleResponse, } from "./bundler.js";
|
|
2
4
|
export { bundle, bundleApp, classifyAppErrors, importsConflictingPackage, } from "./bundler.js";
|
|
3
5
|
export type { AppFunctionInput, BundleAppRequest, BundleRequest, } from "./contracts.js";
|
|
@@ -7,6 +9,12 @@ export { DenoCompatError } from "./errors.js";
|
|
|
7
9
|
export { createGuardedFetch, installFetchGuard } from "./fetch-guard.js";
|
|
8
10
|
export type { Field, Level, LogSink } from "./log.js";
|
|
9
11
|
export { setLogSink } from "./log.js";
|
|
12
|
+
export type { CompiledShard, ShardBuildFailure, ShardBuildResult, } from "./shards/build.js";
|
|
13
|
+
export { compileFunctionShards } from "./shards/build.js";
|
|
14
|
+
export type { ShardPolicy } from "./shards/plan.js";
|
|
15
|
+
export { assertWithinCapacity, planFreshShards, ShardCapacityError, targetShardCount, } from "./shards/plan.js";
|
|
16
|
+
export type { BundleSize, SizeVerdict } from "./shards/size.js";
|
|
17
|
+
export { BUNDLE_GZIP_LEVEL, judgeBundleSize, measureBundleBytes, WORKER_RAW_SIZE_CEILING_BYTES, workerGzipCapBreach, workerRawSizeBreach, } from "./shards/size.js";
|
|
10
18
|
export { STATIC_EGRESS_ARTIFACT_MARKER } from "./static-egress-marker.js";
|
|
11
19
|
export type { CompilerTracer } from "./tracing.js";
|
|
12
20
|
export { setCompilerTracer } from "./tracing.js";
|
package/lib/src/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
// Public surface of the production function compiler. Everything else under
|
|
2
2
|
// src/ is either an internal engine module or a compile-time asset read as text
|
|
3
3
|
// by the esbuild plugins.
|
|
4
|
+
export { cfwBundleInput, collectReachableFiles } from "./assembly.js";
|
|
4
5
|
export { bundle, bundleApp, classifyAppErrors, importsConflictingPackage, } from "./bundler.js";
|
|
5
6
|
export { appFunctionSchema, bundleAppRequestSchema, bundleRequestSchema, } from "./contracts.js";
|
|
6
7
|
export { DenoCompatError } from "./errors.js";
|
|
7
8
|
export { createGuardedFetch, installFetchGuard } from "./fetch-guard.js";
|
|
8
9
|
export { setLogSink } from "./log.js";
|
|
10
|
+
export { compileFunctionShards } from "./shards/build.js";
|
|
11
|
+
export { assertWithinCapacity, planFreshShards, ShardCapacityError, targetShardCount, } from "./shards/plan.js";
|
|
12
|
+
export { BUNDLE_GZIP_LEVEL, judgeBundleSize, measureBundleBytes, WORKER_RAW_SIZE_CEILING_BYTES, workerGzipCapBreach, workerRawSizeBreach, } from "./shards/size.js";
|
|
9
13
|
export { STATIC_EGRESS_ARTIFACT_MARKER } from "./static-egress-marker.js";
|
|
10
14
|
export { setCompilerTracer } from "./tracing.js";
|
|
11
15
|
//# sourceMappingURL=index.js.map
|
package/lib/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gFAAgF;AAChF,0BAA0B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gFAAgF;AAChF,0BAA0B;AAG1B,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAQtE,OAAO,EACL,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAMtB,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAMtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,6BAA6B,EAC7B,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CAPTURE_LOGS_HEADER = "X-B44-Capture-Logs";
|
|
2
|
+
export declare const INVOCATION_LOGS_HEADER = "X-B44-Invocation-Logs";
|
|
3
|
+
export declare const MAX_CAPTURED_LINES = 40;
|
|
4
|
+
export declare const ASCII_ESCAPE = "const _b44Ascii = (s) => s.replace(/[\\u007f-\\uffff]/g, (c) => '\\\\u' + c.charCodeAt(0).toString(16).padStart(4, '0'));";
|
|
5
|
+
export declare const CAPTURE_PATCH: string;
|
|
6
|
+
export declare const INVOCATION_LOGS_PATCH: string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const CAPTURE_LOGS_HEADER = "X-B44-Capture-Logs";
|
|
2
|
+
export const INVOCATION_LOGS_HEADER = "X-B44-Invocation-Logs";
|
|
3
|
+
// Budgets are in escaped bytes and stay under the 8 KB the backend accepts for
|
|
4
|
+
// this header (INVOCATION_LOGS_MAX_HEADER_BYTES), with room for the function's
|
|
5
|
+
// own headers.
|
|
6
|
+
export const MAX_CAPTURED_LINES = 40;
|
|
7
|
+
const MAX_CAPTURED_BYTES = 6144;
|
|
8
|
+
const LINE_ENVELOPE_BYTES = 30;
|
|
9
|
+
const RESPONSE_HEADER_BUDGET = 7168;
|
|
10
|
+
const HEADER_LINE_OVERHEAD = 4;
|
|
11
|
+
// workerd's headers.set throws on any code unit above 0xff, which would silently
|
|
12
|
+
// cost the request its logs; escaped text also makes the byte budget exact.
|
|
13
|
+
export const ASCII_ESCAPE = "const _b44Ascii = (s) => s.replace(/[\\u007f-\\uffff]/g, (c) => '\\\\u' + c.charCodeAt(0).toString(16).padStart(4, '0'));";
|
|
14
|
+
export const CAPTURE_PATCH = [
|
|
15
|
+
"const _b44Capture = (c, lvl, msg) => {",
|
|
16
|
+
" if (!c.invocationLogs) return;",
|
|
17
|
+
` const cost = _b44Ascii(JSON.stringify(msg)).length + ${LINE_ENVELOPE_BYTES};`,
|
|
18
|
+
` if (c.invocationLogs.length >= ${MAX_CAPTURED_LINES} || c.invocationLogsBytes + cost > ${MAX_CAPTURED_BYTES}) { c.invocationLogsDropped += 1; return; }`,
|
|
19
|
+
" c.invocationLogsBytes += cost;",
|
|
20
|
+
" c.invocationLogs.push({ level: lvl, message: msg });",
|
|
21
|
+
"};",
|
|
22
|
+
].join("\n");
|
|
23
|
+
export const INVOCATION_LOGS_PATCH = [
|
|
24
|
+
`const _b44CaptureStore = (request) => request.headers.get(${JSON.stringify(CAPTURE_LOGS_HEADER)}) === '1' ? { invocationLogs: [], invocationLogsBytes: 0, invocationLogsDropped: 0 } : {};`,
|
|
25
|
+
"const _b44AttachInvocationLogs = (res) => {",
|
|
26
|
+
" const c = _b44Context();",
|
|
27
|
+
" if (!c || !c.invocationLogs) return res;",
|
|
28
|
+
" if (!(res instanceof Response) || res.status === 101 || res.webSocket) return res;",
|
|
29
|
+
` let existingBytes = ${INVOCATION_LOGS_HEADER.length + HEADER_LINE_OVERHEAD};`,
|
|
30
|
+
` res.headers.forEach((v, k) => { existingBytes += k.length + v.length + ${HEADER_LINE_OVERHEAD}; });`,
|
|
31
|
+
" let payload = _b44Ascii(JSON.stringify({ lines: c.invocationLogs, dropped: c.invocationLogsDropped }));",
|
|
32
|
+
` if (existingBytes + payload.length > ${RESPONSE_HEADER_BUDGET}) payload = JSON.stringify({ lines: [], dropped: c.invocationLogs.length + c.invocationLogsDropped });`,
|
|
33
|
+
` if (existingBytes + payload.length > ${RESPONSE_HEADER_BUDGET}) return res;`,
|
|
34
|
+
" let wrapped;",
|
|
35
|
+
" try { wrapped = new Response(res.body, res); } catch (e) { return res; }",
|
|
36
|
+
` try { wrapped.headers.set(${JSON.stringify(INVOCATION_LOGS_HEADER)}, payload); } catch (e) {}`,
|
|
37
|
+
" return wrapped;",
|
|
38
|
+
"};",
|
|
39
|
+
// Same body as the dispatcher's user-exception answer (apps-dispatcher errors.ts:55);
|
|
40
|
+
// the dispatcher strips X-Base44-Cf-Error from user responses (run.ts:73), so this
|
|
41
|
+
// streams as a plain 500 without the dispatch_error metric. Errors the dispatcher
|
|
42
|
+
// classifies by message (errors.ts:41-45) rethrow so their 429 stands.
|
|
43
|
+
"const _b44CrashResponse = (e) => {",
|
|
44
|
+
" const c = _b44Context();",
|
|
45
|
+
" if (!c || !c.invocationLogs) return null;",
|
|
46
|
+
" const m = String(e instanceof Error ? e.message : e).toLowerCase();",
|
|
47
|
+
" if (m.includes('cpu time limit') || m.includes('too many subrequests')) return null;",
|
|
48
|
+
" return _b44AttachInvocationLogs(new Response(JSON.stringify({ error: 'user-exception', detail: 'user worker threw an exception' }), { status: 500, headers: { 'Content-Type': 'application/json' } }));",
|
|
49
|
+
"};",
|
|
50
|
+
].join("\n");
|
|
51
|
+
//# sourceMappingURL=invocation-logs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation-logs.js","sourceRoot":"","sources":["../../src/invocation-logs.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AACxD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AAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compile an app's functions into the final Cloudflare Workers shards.
|
|
3
|
+
*
|
|
4
|
+
* The loop is: plan the partition, compile each shard, measure it, and halve any
|
|
5
|
+
* shard whose module is over a ceiling before anything is uploaded. Ported from
|
|
6
|
+
* `_build_shard_with_split` in apper's `cloudflare_wfp_runtime.py`.
|
|
7
|
+
*
|
|
8
|
+
* That function also splits on two exceptions, and neither is a trigger here.
|
|
9
|
+
* The bundler's 413 is its HTTP request-body cap — a property of the shard's
|
|
10
|
+
* packed SOURCE going over the wire, not of the module coming out, and there is
|
|
11
|
+
* no request to reject locally. Cloudflare's 10027 is a real Worker limit, but
|
|
12
|
+
* it is the same 64 MiB `workerRawSizeBreach` already computes from the bytes in
|
|
13
|
+
* hand, so reaching it from a rejected upload is a failsafe, not the design.
|
|
14
|
+
* Measuring is the design, and it happens here.
|
|
15
|
+
*
|
|
16
|
+
* Unlike the compiler's own `bundleApp`, this refuses a partial result. A module
|
|
17
|
+
* missing a handler is not a smaller success, it is a broken app.
|
|
18
|
+
*/
|
|
19
|
+
import type { AppFunctionInput } from "../contracts.js";
|
|
20
|
+
import type { BundleErrorItem } from "../errors.js";
|
|
21
|
+
import { type ShardPolicy } from "./plan.js";
|
|
22
|
+
export interface CompiledShard {
|
|
23
|
+
/** Position in the emitted list. Not a deployment identity — the caller owns
|
|
24
|
+
* placement, and a split makes more shards than the plan had. */
|
|
25
|
+
index: number;
|
|
26
|
+
/** Function names in this shard, in the order they were compiled. */
|
|
27
|
+
functions: string[];
|
|
28
|
+
module: string;
|
|
29
|
+
mainModule: string;
|
|
30
|
+
rawBytes: number;
|
|
31
|
+
gzipBytes: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ShardBuildFailure {
|
|
34
|
+
/** The function this is about, when it belongs to one. */
|
|
35
|
+
function?: string;
|
|
36
|
+
message: string;
|
|
37
|
+
errors?: BundleErrorItem[];
|
|
38
|
+
}
|
|
39
|
+
export type ShardBuildResult = {
|
|
40
|
+
ok: true;
|
|
41
|
+
shards: CompiledShard[];
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
failures: ShardBuildFailure[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Compile every function into shards, or fail the whole build.
|
|
48
|
+
*
|
|
49
|
+
* Succeeds only when each declared function appears exactly once across the
|
|
50
|
+
* shards and every one of them compiled.
|
|
51
|
+
*/
|
|
52
|
+
export declare function compileFunctionShards(functions: AppFunctionInput[], policy: ShardPolicy, options?: {
|
|
53
|
+
postResponseTelemetry?: boolean;
|
|
54
|
+
runtimeSecrets?: boolean;
|
|
55
|
+
}): Promise<ShardBuildResult>;
|