From 8549134658960bb5b07a4e5f8da5c2abf61513ec Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Sun, 11 Dec 2022 16:38:52 -0800 Subject: [PATCH] [Bun.Transpiler] Introduce `inline` flag --- packages/bun-types/bun.d.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts index 804d9c861c..f716d3bd0e 100644 --- a/packages/bun-types/bun.d.ts +++ b/packages/bun-types/bun.d.ts @@ -656,6 +656,20 @@ declare module "bun" { treeShaking?: boolean; trimUnusedImports?: boolean; jsxOptimizationInline?: boolean; + + /** + * This does two things (and possibly more in the future): + * 1. `const` declarations to primitive types (excluding Object/Array) at the top of a scope before any `let` or `var` declarations will be inlined into their usages. + * 2. `let` and `const` declarations only used once are inlined into their usages. + * + * JavaScript engines typically do these optimizations internally, however + * it might only happen much later in the compilation pipeline, after code + * has been executed many many times. + * + * This will typically shrink the output size of code, but it might increase + * it in some cases. Do your own benchmarks! + */ + inline?: boolean; } /**