ESM wrapper generator that just get's the job done
UNDER HEAVY DEVELOPMENT, THE API MIGHT CHANGE
- 🤏 Tiny, less than 1KB (894B brotli, 1KB gzipped)
- ✨ Supports input globs
- 🌳 Tree Shakeable
- 📦 Programmable API supports ESM Module
- 🐕 Built by Dogfooding
npm install -D esmwrap
#or
yarn add -D esmwrap
Usage esmwrap
$ esmwrap input-glob output-directory
Options
-ext the target file extension (eg: .mjs)
-h print this help doc
eg:
$ esmwrap './dist/*.js' ./dist/esm
✔ ESM Wrappers Created!
$ esmwrap './dist/*.js' ./dist/esm -ext .mjs
✔ ESM Wrappers Created!
esmwrap(sourceGlob: PathGlob ,destinationDirectory: string ,options: ESMWRAPOptions)
Require Syntax
const { esmwrap } = require("esmwrap");
esmwrap("./dist/*.js", "./dist/esm", { options: ".esm.js" });
Import Syntax
import { esmwrap } from "esmwrap";
esmwrap("./dist/*.js", "./dist/esm", { options: ".mjs" });
type PathGlob = string;
type ESMWRAPOptions = {
extenstion: string;
};
- Add Tests
- Add suffix support (Folks might want it to output with a different name , eg:
index.esm.js
) - Optimize the file matcher
Contributions are always welcome!
Follow the general github flow of Fork => PR, make sure that you let the authors know about the issue you pick to avoid overlaps.
For support, email ahoy@barelyhuman.dev