An esbuild plugin that inlines JavaScript functions annotated with /* @inline */ hints, eliminating function call overhead. Version 0.2.0 (stable, active development). Unlike manual inlining or other tools, it automatically handles imports, dependencies, control flow (early returns, conditionals), variable scoping, and execution order. Supports both regular functions and arrow functions. Includes a /* @pure */ annotation to enable hoisting of duplicate pure function calls. Ships TypeScript declarations. Requires @babel/parser, @babel/traverse, @babel/types as peer dependencies. Works in any esbuild context (e.g., tsup, Vite, pure esbuild).
npm install esbuild-plugin-inline-functionsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage with esbuild: import the plugin, apply it, and annotate functions with /* @inline */ to inline their calls.
Set esbuild plugins after ensuring esbuild handles TypeScript (type stripping) or use the plugin only on JavaScript files. Alternatively, verify if plugin version supports TypeScript via @babel/preset-typescript.
Update esbuild to version 0.12 or later.
Use /* @inline */ exactly; avoid // @inline or other whitespace variations.
Pin to 0.2.0 or check release notes for breaking changes.
Run npm install @babel/parser@^7.26.3
Use import { inlineFunctionsPlugin } from 'esbuild-plugin-inline-functions';Call inlineFunctionsPlugin() without arguments. If options are needed in future, check docs.