From 9976e3f528bae74667a2f4742c4b165b7f68c76d Mon Sep 17 00:00:00 2001 From: dave caruso Date: Thu, 14 Sep 2023 00:39:36 -0400 Subject: fix(runtime): make most globals configurable/deletable, allow resuming the console iterator (#5216) * Fix #5177 * Fix #5175 * make most globals deletable/overridable * not done * cool * a * done * fix test * oops * yippee --- src/js/_codegen/build-modules.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/js/_codegen/build-modules.ts') diff --git a/src/js/_codegen/build-modules.ts b/src/js/_codegen/build-modules.ts index 3443db6f6..2e49dfffe 100644 --- a/src/js/_codegen/build-modules.ts +++ b/src/js/_codegen/build-modules.ts @@ -5,6 +5,7 @@ import { cap, fmtCPPString, readdirRecursive, resolveSyncOrNull } from "./helper import { createAssertClientJS, createLogClientJS } from "./client-js"; import { builtinModules } from "node:module"; import { BuildConfig } from "bun"; +import { define } from "./replacements"; const t = new Bun.Transpiler({ loader: "tsx" }); @@ -173,6 +174,7 @@ const config = ({ platform, debug }: { platform: string; debug?: boolean }) => target: "bun", external: builtinModules, define: { + ...define, IS_BUN_DEVELOPMENT: String(!!debug), __intrinsic__debug: debug ? "$debug_log_enabled" : "false", "process.platform": JSON.stringify(platform), @@ -222,7 +224,7 @@ for (const [name, bundle, outputs] of [ .replace(/\$\$EXPORT\$\$\((.*)\).\$\$EXPORT_END\$\$;/, "return $1") .replace(/]\s*,\s*__(debug|assert)_end__\)/g, ")") .replace(/]\s*,\s*__debug_end__\)/g, ")") - .replace(/__intrinsic__lazy\(/g, "globalThis[globalThis.Symbol.for('Bun.lazy')](") + // .replace(/__intrinsic__lazy\(/g, "globalThis[globalThis.Symbol.for('Bun.lazy')](") .replace(/import.meta.require\((.*?)\)/g, (expr, specifier) => { try { const str = JSON.parse(specifier); -- cgit v1.2.3