Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed
MCP
code on this site's /mcp
CLI
none: the JSON below is the answer
JSON
/christopher/abso-core/files/scripts/build-client.mjs?version=170&format=json
69 linesnode20 100%Last change node20 in version 170, 2 versions changed it

You're reading version 170. The newest is 318, and 2 versions since then changed this file. Go to the newestCompare with 318

1// Builds client/bin/abso.mjs: the whole client, client/abso.ts and everything it imports (yaml included),
2// as one plain-JS file for Node 20 or later. Node 20 can't run the .ts files themselves (it has no type
3// stripping), so this file is how a checkout runs on it:
4//
5// node client/bin/abso.mjs help
6//
7// npm run build:client rebuilds it; run it after changing the client and push the result.
8// npm run check:client-bundle fails when the file isn't what a build of this folder gives (the check runs it).
9//
10// The file is committed, so a fresh clone runs it with no install and no build. It sits one folder under
11// client/, so the client's own folder (client-version.ts) is still client/. The build is deterministic:
12// paths in it are relative to the repo, so it comes out the same on every machine.
13//
14// Plain JS on purpose: it runs before anything is built.
15import { readFileSync, writeFileSync } from "node:fs";
16import { createRequire } from "node:module";
17import { dirname, join, resolve } from "node:path";
18import { fileURLToPath } from "node:url";
20const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
21const OUT = "client/bin/abso.mjs";
23/** The bundle's text, built in memory. */
24export function buildClient() {
25 const esbuild = createRequire(import.meta.url)("esbuild");
26 const result = esbuild.buildSync({
27 absWorkingDir: root,
28 entryPoints: ["client/abso.ts"],
29 bundle: true,
30 platform: "node",
31 format: "esm",
32 target: "node20",
33 write: false,
34 outfile: OUT,
35 logLevel: "warning",
36 // A bundled CommonJS package (yaml) calls require("process") lazily, which an ES module bundle
37 // can't do without a real require.
38 banner: {
39 js: [
40 "// Built from client/abso.ts by scripts/build-client.mjs (npm run build:client). Don't edit it by hand.",
41 'import { createRequire as __absoCreateRequire } from "node:module";',
42 "const require = __absoCreateRequire(import.meta.url);",
43 ].join("\n"),
44 },
45 });
46 // esbuild leaves control characters in string literals as they are (yaml's lexer has \x02, \x18 and \x1f).
47 // Escaped, the file is plain text that every tool shows and stores as it is.
48 return result.outputFiles[0].text.replace(
49 /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,
50 (c) => `\\x${c.charCodeAt(0).toString(16).padStart(2, "0")}`,
51 );
54if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
55 const path = join(root, OUT);
56 const text = buildClient();
57 if (process.argv.includes("--check")) {
58 let have = "";
59 try {
60 have = readFileSync(path, "utf8").replace(/\r\n/g, "\n");
61 } catch {}
62 if (have !== text) {
63 process.stderr.write(
64 `${OUT} is not a build of this folder's client: run npm run build:client and push the file it writes.\n`,
65 );
66 process.exit(1);
67 }
68 } else writeFileSync(path, text);