diff options
author | 2023-10-17 19:42:37 -0700 | |
---|---|---|
committer | 2023-10-17 19:42:37 -0700 | |
commit | cb5c4c71c866362dce24eff79251fed6add53e9f (patch) | |
tree | 5635cf21140ff2eac14539316f7c6d6704925bd3 /src/codegen/create-hash-table.ts | |
parent | bf12268274faac1a38d33007be7a48af9e570761 (diff) | |
download | bun-jarred/prepare-for-libuv.tar.gz bun-jarred/prepare-for-libuv.tar.zst bun-jarred/prepare-for-libuv.zip |
Diffstat (limited to 'src/codegen/create-hash-table.ts')
-rw-r--r-- | src/codegen/create-hash-table.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/codegen/create-hash-table.ts b/src/codegen/create-hash-table.ts index 776abfdea..0d9b08d41 100644 --- a/src/codegen/create-hash-table.ts +++ b/src/codegen/create-hash-table.ts @@ -1,12 +1,12 @@ import { spawn } from "bun"; import path from "path"; +import { writeIfNotChanged } from "./helpers"; const input = process.argv[2]; -const out_dir = process.argv[3]; +const output = process.argv[3]; const create_hash_table = path.join(import.meta.dir, "./create_hash_table"); -console.time("Generate LUT"); const { stdout, exited } = spawn({ cmd: [create_hash_table, input], stdout: "pipe", @@ -18,6 +18,6 @@ str = str.replaceAll(/^\/\/.*$/gm, ""); str = str.replaceAll(/^#include.*$/gm, ""); str = str.replaceAll(`namespace JSC {`, ""); str = str.replaceAll(`} // namespace JSC`, ""); -str = "// File generated via `make static-hash-table` / `make cpp`\n" + str.trim() + "\n"; -await Bun.write(input.replace(/\.cpp$/, ".lut.h").replace(/(\.lut)?\.txt$/, ".lut.h"), str); -console.log("Wrote", path.join(out_dir, path.basename(process.cwd(), input.replace(/\.cpp$/, ".lut.h")))); +str = "// File generated via `static-hash-table.ts`\n" + str.trim() + "\n"; + +writeIfNotChanged(output, str); |