diff options
author | 2022-12-10 00:18:44 -0800 | |
---|---|---|
committer | 2022-12-10 00:19:19 -0800 | |
commit | 047754d5ddae0b760b807adafcb3678d8702d7df (patch) | |
tree | 2ef334fdf69e2e2440822bb660ae5c2ae085f1ea /src/bun.js/api/transpiler.zig | |
parent | b400dfb386be65ca1d16ada005e75683ec48c1a5 (diff) | |
download | bun-047754d5ddae0b760b807adafcb3678d8702d7df.tar.gz bun-047754d5ddae0b760b807adafcb3678d8702d7df.tar.zst bun-047754d5ddae0b760b807adafcb3678d8702d7df.zip |
Implement simple version of inlining single-use expressions and statements
Diffstat (limited to 'src/bun.js/api/transpiler.zig')
-rw-r--r-- | src/bun.js/api/transpiler.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bun.js/api/transpiler.zig b/src/bun.js/api/transpiler.zig index e932199ae..341a0d9db 100644 --- a/src/bun.js/api/transpiler.zig +++ b/src/bun.js/api/transpiler.zig @@ -103,6 +103,7 @@ const TranspilerOptions = struct { runtime: Runtime.Features = Runtime.Features{ .top_level_await = true }, tree_shaking: bool = false, trim_unused_imports: ?bool = null, + inlining: bool = false, }; // Mimalloc gets unstable if we try to move this to a different thread @@ -555,6 +556,10 @@ fn transformOptionsFromJSC(ctx: JSC.C.JSContextRef, temp_allocator: std.mem.Allo } } + if (object.get(globalThis, "inline")) |flag| { + transpiler.runtime.inlining = flag.toBoolean(); + } + if (object.get(globalThis, "sourcemap")) |flag| { if (flag.isBoolean() or flag.isUndefinedOrNull()) { if (flag.toBoolean()) { @@ -784,6 +789,7 @@ pub fn constructor( bundler.options.trim_unused_imports = transpiler_options.trim_unused_imports; bundler.options.allow_runtime = transpiler_options.runtime.allow_runtime; bundler.options.auto_import_jsx = transpiler_options.runtime.auto_import_jsx; + bundler.options.inlining = transpiler_options.runtime.inlining; bundler.options.hot_module_reloading = transpiler_options.runtime.hot_module_reloading; bundler.options.jsx.supports_fast_refresh = bundler.options.hot_module_reloading and bundler.options.allow_runtime and transpiler_options.runtime.react_fast_refresh; |