Skip to content

Commit c59f1b4

Browse files
build(serialization): move bundle banner into build.mjs (no // in package.json)
The build script's --banner put a `//` comment string inside package.json; move bundling into crates/runtime/js/build.mjs (Bun.build API) so package.json stays comment-free. Output is unchanged.
1 parent 89e9e35 commit c59f1b4

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

crates/runtime/js/build.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Bundles serialization/index.ts into the embedded runtime module
2+
// crates/runtime/src/runtime_modules/serialization.js. Run: bun run build
3+
const BANNER = "// @generated by `bun run build` in crates/runtime/js — do not edit by hand.\n";
4+
const OUT = new URL("../src/runtime_modules/serialization.js", import.meta.url);
5+
6+
const result = await Bun.build({
7+
entrypoints: [new URL("./serialization/index.ts", import.meta.url).pathname],
8+
format: "esm",
9+
target: "node",
10+
});
11+
12+
if (!result.success) {
13+
for (const log of result.logs) console.error(log);
14+
process.exit(1);
15+
}
16+
17+
const code = await result.outputs[0].text();
18+
await Bun.write(OUT, BANNER + code);
19+
console.log("wrote", OUT.pathname, `(${(BANNER.length + code.length)} bytes)`);

crates/runtime/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "module",
55
"description": "Source for the runtime:serialization module — pure-JS Protobuf (reflection) + thin wrappers over the Rust-backed text/binary parser ops. Bundled into crates/runtime/src/runtime_modules/serialization.js.",
66
"scripts": {
7-
"build": "bun build serialization/index.ts --format=esm --target=node --banner='// @generated by `bun run build` in crates/runtime/js — do not edit by hand.' --outfile=../src/runtime_modules/serialization.js",
7+
"build": "bun build.mjs",
88
"test": "bun test"
99
},
1010
"devDependencies": {

crates/runtime/src/runtime_modules/serialization.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// @generated by `bun run build` in crates/runtime/js — do not edit by hand.
2-
32
// serialization/protobuf/lexer.ts
43
var IDENT_START = /[A-Za-z_]/;
54
var IDENT_PART = /[A-Za-z0-9_]/;

0 commit comments

Comments
 (0)