- MCP
- blame on this site's /mcp
- CLI
- abso blame scripts/build-client.mjs --version 261 --json
- JSON
- /christopher/abso-core/blame/scripts/build-client.mjs?version=261&format=json
58 linesnode20 100%Last change node20 in version 172,
58 lines from 3 changes in 3 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",
34 // A bundled CommonJS package (yaml) calls require("process") lazily, which an ES module bundle
35 // can't do without a real require.
36 banner: {
37 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.Compare38 "// 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.Compare39 'import { createRequire as __absoCreateRequire } from "node:module";',
40 "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.Compare41 ...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.Compare42 ].join("\n"),
43 },
44 });
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.Compare45 // esbuild leaves control characters in string literals as they are (yaml's lexer has \x02, \x18 and \x1f).
46 // Escaped, the file is plain text that every tool shows and stores as it is.
47 return result.outputFiles[0].text.replace(
48 /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,
49 (c) => `\\x${c.charCodeAt(0).toString(16).padStart(2, "0")}`,
50 );
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.Compare51}
53if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
54 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.Compare55 mkdirSync(dirname(path), { recursive: true });
56 writeFileSync(path, buildClient());
57 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.Compare58}