- MCP
- blame on this site's /mcp
- CLI
- abso blame scripts/build-client.mjs --version 293 --json
- JSON
- /christopher/abso-core/blame/scripts/build-client.mjs?version=293&format=json
61 linesnode20 95% · pinch 5%Last change pinch in version 287,
61 lines from 4 changes in 4 versions.
node20169Run the client on Node 20: commit a plain-JS build of it as client/bin/abso.mjs, built by npm run build:client and checked current by the project's check. Docs give each real Node minimum: the client 20 (bundle) or 24 (TypeScript), the server's wrangler 22, with a way to run it from Node 20. engines is now >=20.Compare1// 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//
node20172Build the client for Node 20 instead of committing the build: npm run build writes client/bin/abso.mjs from client/abso.ts, and npm run pack:npm -- <version> packs that same build as the npm package @abso-cli/abso (it never publishes). The committed bundle and the check that kept it current are gone, so client changes need no rebuild. The READMEs give the build steps.Compare5// npm ci && npm run build
node20169Run the client on Node 20: commit a plain-JS build of it as client/bin/abso.mjs, built by npm run build:client and checked current by the project's check. Docs give each real Node minimum: the client 20 (bundle) or 24 (TypeScript), the server's wrangler 22, with a way to run it from Node 20. engines is now >=20.Compare6// node client/bin/abso.mjs help
7//
node20172Build the client for Node 20 instead of committing the build: npm run build writes client/bin/abso.mjs from client/abso.ts, and npm run pack:npm -- <version> packs that same build as the npm package @abso-cli/abso (it never publishes). The committed bundle and the check that kept it current are gone, so client changes need no rebuild. The READMEs give the build steps.Compare8// The file isn't committed (.gitignore leaves client/bin/ out); build it again after pulling. It sits one
9// folder under client/, so the client's own folder (client-version.ts) is still client/. scripts/pack-npm.mjs
10// puts the same build in the npm package.
node20169Run the client on Node 20: commit a plain-JS build of it as client/bin/abso.mjs, built by npm run build:client and checked current by the project's check. Docs give each real Node minimum: the client 20 (bundle) or 24 (TypeScript), the server's wrangler 22, with a way to run it from Node 20. engines is now >=20.Compare11//
12// Plain JS on purpose: it runs before anything is built.
node20172Build the client for Node 20 instead of committing the build: npm run build writes client/bin/abso.mjs from client/abso.ts, and npm run pack:npm -- <version> packs that same build as the npm package @abso-cli/abso (it never publishes). The committed bundle and the check that kept it current are gone, so client changes need no rebuild. The READMEs give the build steps.Compare13import { mkdirSync, writeFileSync } from "node:fs";
node20169Run the client on Node 20: commit a plain-JS build of it as client/bin/abso.mjs, built by npm run build:client and checked current by the project's check. Docs give each real Node minimum: the client 20 (bundle) or 24 (TypeScript), the server's wrangler 22, with a way to run it from Node 20. engines is now >=20.Compare14import { createRequire } from "node:module";
15import { dirname, join, resolve } from "node:path";
16import { fileURLToPath } from "node:url";
18const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
19const OUT = "client/bin/abso.mjs";
node20172Build the client for Node 20 instead of committing the build: npm run build writes client/bin/abso.mjs from client/abso.ts, and npm run pack:npm -- <version> packs that same build as the npm package @abso-cli/abso (it never publishes). The committed bundle and the check that kept it current are gone, so client changes need no rebuild. The READMEs give the build steps.Compare21/** The bundle's text, built in memory. `banner` adds lines at its top (the npm package stamps its version). */
22export function buildClient(banner = []) {
node20169Run the client on Node 20: commit a plain-JS build of it as client/bin/abso.mjs, built by npm run build:client and checked current by the project's check. Docs give each real Node minimum: the client 20 (bundle) or 24 (TypeScript), the server's wrangler 22, with a way to run it from Node 20. engines is now >=20.Compare23 const esbuild = createRequire(import.meta.url)("esbuild");
24 const result = esbuild.buildSync({
25 absWorkingDir: root,
26 entryPoints: ["client/abso.ts"],
27 bundle: true,
28 platform: "node",
29 format: "esm",
30 target: "node20",
31 write: false,
32 outfile: OUT,
33 logLevel: "warning",
pinch287Local projects: abso init --local keeps a project's history on this machine, with no server, sign-in or network
A local folder's calls never leave the process. The client runs the open server's own router and project object (server/src) in-process, over Node's built-in SQLite. It's the same engine with the same answers, so what the commands print matches a server.
- abso init --local [--project <name>] [--agent <name>] [--store <folder>] makes the project, and abso join <project> --local adds a folder. After that, record, push, pull, log, blame and the held collisions work as usual. The folder's config says "server": "local".
- Where the store lives: --store (kept in the folder's config; a store inside the folder is left out of its files through .absoignore), else ABSO_STORE, else this user's data folder: %LOCALAPPDATA%\abso\store, ~/Library/Application Support/abso/store, or $XDG_DATA_HOME/abso/store. Nothing needs a writable home folder when ABSO_STORE or --store is set.
- Each project is <store>/<project>/project.sqlite. Every call runs in one SQLite write transaction, which is the store's lock: other processes wait for it, and a process that dies mid-call keeps nothing half-written. A process reloads the project only when SQLite's data_version shows another process wrote.
- No credential goes with a local folder's calls. The edit mod leaves local folders alone, so abso record sends their edits. Issues, asks and news aren't in local projects yet.
- Needs Node 22.13 or later (node:sqlite); its experimental warning is kept out of the output. Run as .ts, a module hook supplies the Durable Object base class (client/src/durable-object-stand-in.ts); the build aliases cloudflare:workers to the same file. client/src/local-server.mjs, with its .d.mts, keeps the client's typecheck out of server/src, which has its own.
- Each command closes the store files it opened.
Tests: local (8, with fetch replaced by one that throws: init, record, push, join, pull, log, blame, a held collision, --store inside the folder, refusals), plus failed-start, install, caller, doctor, lost-pull, help, body-files: 60 pass; tsc clean. The bundle built with the alias runs init, push and log locally.Compare34 // Local projects run the open server's code in the client (client/src/local-store.ts); its Durable Object
35 // base class comes from the Workers runtime, so the bundle gets the client's stand-in.
36 alias: { "cloudflare:workers": "./client/src/durable-object-stand-in.ts" },
node20169Run the client on Node 20: commit a plain-JS build of it as client/bin/abso.mjs, built by npm run build:client and checked current by the project's check. Docs give each real Node minimum: the client 20 (bundle) or 24 (TypeScript), the server's wrangler 22, with a way to run it from Node 20. engines is now >=20.Compare37 // A bundled CommonJS package (yaml) calls require("process") lazily, which an ES module bundle
38 // can't do without a real require.
39 banner: {
40 js: [
node20172Build the client for Node 20 instead of committing the build: npm run build writes client/bin/abso.mjs from client/abso.ts, and npm run pack:npm -- <version> packs that same build as the npm package @abso-cli/abso (it never publishes). The committed bundle and the check that kept it current are gone, so client changes need no rebuild. The READMEs give the build steps.Compare41 "// Built from client/abso.ts by scripts/build-client.mjs (npm run build). Don't edit it by hand.",
node20169Run the client on Node 20: commit a plain-JS build of it as client/bin/abso.mjs, built by npm run build:client and checked current by the project's check. Docs give each real Node minimum: the client 20 (bundle) or 24 (TypeScript), the server's wrangler 22, with a way to run it from Node 20. engines is now >=20.Compare42 'import { createRequire as __absoCreateRequire } from "node:module";',
43 "const require = __absoCreateRequire(import.meta.url);",
node20172Build the client for Node 20 instead of committing the build: npm run build writes client/bin/abso.mjs from client/abso.ts, and npm run pack:npm -- <version> packs that same build as the npm package @abso-cli/abso (it never publishes). The committed bundle and the check that kept it current are gone, so client changes need no rebuild. The READMEs give the build steps.Compare44 ...banner,
node20169Run the client on Node 20: commit a plain-JS build of it as client/bin/abso.mjs, built by npm run build:client and checked current by the project's check. Docs give each real Node minimum: the client 20 (bundle) or 24 (TypeScript), the server's wrangler 22, with a way to run it from Node 20. engines is now >=20.Compare45 ].join("\n"),
46 },
47 });
node20170Write control characters in the client bundle as escapes, so the committed client/bin/abso.mjs is plain text that every tool shows and stores unchanged. It runs the same.Compare48 // esbuild leaves control characters in string literals as they are (yaml's lexer has \x02, \x18 and \x1f).
49 // Escaped, the file is plain text that every tool shows and stores as it is.
50 return result.outputFiles[0].text.replace(
51 /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,
52 (c) => `\\x${c.charCodeAt(0).toString(16).padStart(2, "0")}`,
53 );
node20169Run the client on Node 20: commit a plain-JS build of it as client/bin/abso.mjs, built by npm run build:client and checked current by the project's check. Docs give each real Node minimum: the client 20 (bundle) or 24 (TypeScript), the server's wrangler 22, with a way to run it from Node 20. engines is now >=20.Compare54}
56if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
57 const path = join(root, OUT);
node20172Build the client for Node 20 instead of committing the build: npm run build writes client/bin/abso.mjs from client/abso.ts, and npm run pack:npm -- <version> packs that same build as the npm package @abso-cli/abso (it never publishes). The committed bundle and the check that kept it current are gone, so client changes need no rebuild. The READMEs give the build steps.Compare58 mkdirSync(dirname(path), { recursive: true });
59 writeFileSync(path, buildClient());
60 process.stdout.write(`Built ${OUT}: node ${OUT} help\n`);
node20169Run the client on Node 20: commit a plain-JS build of it as client/bin/abso.mjs, built by npm run build:client and checked current by the project's check. Docs give each real Node minimum: the client 20 (bundle) or 24 (TypeScript), the server's wrangler 22, with a way to run it from Node 20. engines is now >=20.Compare61}