1// Concatenates the libraries, in the canonical order from libs.ts, into dist/nobel.js and minifies it into dist/nobel.min.js.2import { transform } from "npm:esbuild@0.25";3import { brotliCompressSync } from "node:zlib";4import { libs } from "./libs.ts";56const order = libs.map((l) => l.name);7const root = new URL("../", import.meta.url);8const parts = await Promise.all(order.map((n) => Deno.readTextFile(new URL(`${n}/${n}.js`, root))));9const src = order.map((n, i) => `// ${n}.js\n${parts[i].trim()};\n`).join("");10const { code } = await transform(src, { minify: true, target: "es2022" });1112await Deno.mkdir(new URL("dist/", root), { recursive: true });13await Deno.writeTextFile(new URL("dist/nobel.js", root), src);14await Deno.writeTextFile(new URL("dist/nobel.min.js", root), code);15const br = brotliCompressSync(new TextEncoder().encode(code)).length;16console.log(`dist/nobel.js ${src.length} raw | dist/nobel.min.js ${code.length} min, ${br} br`);17Deno.exit(0);