bun-plugin-rename
v0.1.1
Published
A Bun build plugin to rename build artifact files.
Readme
bun-plugin-rename
A Bun build plugin to rename build artifact files.
Installation
bun add -D bun-plugin-renameBundler Usage
bun-plugin-rename lets you rename build artifacts Bun.build. pluginRename takes an array of match/replace objects of the same types accepted by string.replace().
import { pluginRename } from 'bun-plugin-rename';
await Bun.build({
// ...
plugins: [
pluginRename([
{match:/\.html$/,replace:".htm"}, // for 90s compatibility
{match:"classic",replace:"clbuttic"}, // naive censoring gone wrong
{match:/([0-9])/g,replace:(_,capture)=>(9-Number.parseInt(capture)).toString()}, // flip digits
]),
],
});Rename rules will be applied in order, so the replaced output filename from the first rule will be the input filename for the second rule's match string/regex, and so on.
Development
Setup
git clone https://github.com/sparr/bun-plugin-rename.git
cd bun-plugin-rename
bun installContributing
Contributions are welcome! Please feel free to submit a Pull Request.
