A collection of utility functions for building esbuild plugins, including file scanning, reading, writing, transforming, and output handling. Current version 0.1.3 is an early PoC with limited API surface. Requires esbuild >=0.19.0. Ships TypeScript types. Key differentiators: provides high-level helpers like getFilesList, getOutputFiles, readFiles, transformFile, writeFile, writeFiles, resolveEntryPointsPaths, renderList, and parseContentsLayout, reducing boilerplate for esbuild plugin development. Release cadence is irregular; maintained by antongolub as part of a monorepo.
npm install esbuild-plugin-utilsVerified import paths — ran on the pinned version, not inferred.
Scans directory for files, reads first 3, applies uppercase transform with rename, and writes output to 'out' subdirectory.
Pin to exact version and test upgrades thoroughly.
Upgrade esbuild to >=0.19.0.
Check buildResult.outputFiles before passing, or provide a fallback path.
Use writeFiles with an array to future-proof.
Use a synchronous operation within callbacks, or wrap in a custom async transform before calling transformFile.
Switch to ES modules (e.g., set type: 'module' in package.json or use .mjs extension) and use import syntax.
Use named imports: import { getOutputFiles } from 'esbuild-plugin-utils'.Install the package: npm install esbuild-plugin-utils. Ensure TypeScript version >=4.0 and no conflicting moduleResolution.