diff options
author | 2023-09-15 11:22:06 -0400 | |
---|---|---|
committer | 2023-09-15 08:22:06 -0700 | |
commit | 29b22175bf6fc726d0b028c7bf5619ab89fca09a (patch) | |
tree | f0664d677e6cd2d130c76db9fb135402ae2c1110 /src/js/_codegen/build-functions.ts | |
parent | 75697890ce1040d2c2f9bc50499faf54b3205915 (diff) | |
download | bun-29b22175bf6fc726d0b028c7bf5619ab89fca09a.tar.gz bun-29b22175bf6fc726d0b028c7bf5619ab89fca09a.tar.zst bun-29b22175bf6fc726d0b028c7bf5619ab89fca09a.zip |
feat(runtime): add `process.binding` `uv`/`natives`/`config` + make global object properties lazy (#5355)
* binding uv
* we did that
* some more bindings
* fix doc
* fix uv
* yo
* static hash table nonsense <3
* huge refactor to the global object i am not ready for merge conflicts
* it works part 3
* lose
---------
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Diffstat (limited to 'src/js/_codegen/build-functions.ts')
-rw-r--r-- | src/js/_codegen/build-functions.ts | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/js/_codegen/build-functions.ts b/src/js/_codegen/build-functions.ts index fcce0263a..0f752e8a1 100644 --- a/src/js/_codegen/build-functions.ts +++ b/src/js/_codegen/build-functions.ts @@ -3,38 +3,7 @@ import path from "path"; import { sliceSourceCode } from "./builtin-parser"; import { applyGlobalReplacements, define } from "./replacements"; import { cap, fmtCPPString, low } from "./helpers"; -import { spawn } from "bun"; - -async function createStaticHashtables() { - const STATIC_HASH_TABLES = ["src/bun.js/bindings/Process.cpp", "src/bun.js/bindings/BunObject.cpp"]; - console.time("Creating static hash tables..."); - const create_hash_table = path.join(import.meta.dir, "../../../src/bun.js/scripts/create_hash_table"); - if (!create_hash_table) { - console.warn( - "Could not find create_hash_table executable. Run `bun i` or clone webkit to build static hash tables", - ); - return; - } - for (let cpp of STATIC_HASH_TABLES) { - cpp = path.join(import.meta.dir, "../../../", cpp); - const { stdout, exited } = spawn({ - cmd: [create_hash_table, cpp], - stdout: "pipe", - stderr: "inherit", - }); - await exited; - let str = await new Response(stdout).text(); - str = str.replaceAll(/^\/\/.*$/gm, ""); - str = str.replaceAll(/^#include.*$/gm, ""); - str = str.replaceAll(`namespace JSC {`, ""); - str = str.replaceAll(`} // namespace JSC`, ""); - str = "// File generated via `make generate-builtins`\n" + str.trim() + "\n"; - await Bun.write(cpp.replace(/\.cpp$/, ".lut.h"), str); - } - console.timeEnd("Creating static hash tables..."); -} -const staticHashTablePromise = createStaticHashtables(); console.log("Bundling Bun builtin functions..."); const MINIFY = process.argv.includes("--minify") || process.argv.includes("-m"); @@ -634,8 +603,6 @@ if (!KEEP_TMP) { await rmSync(TMP_DIR, { recursive: true }); } -await staticHashTablePromise; - console.log( `Embedded JS size: %s bytes (across %s functions, %s files)`, totalJSSize, |