esmwrap
ESM wrapper generator that just get's the job done
UNDER HEAVY DEVELOPMENT, THE API MIGHT CHANGE
Badges
Features
-
🤏 Tiny, less than 1KB (894B brotli, 1KB gzipped) -
✨ Supports input globs -
🌳 Tree Shakeable -
📦 Programmable API supports ESM Module -
🐕 Built by Dogfooding
Installation
npm install -D esmwrap
#or
yarn add -D esmwrap
Usage/Examples
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!
API Reference
PathGlob ,destinationDirectory: string ,options: ESMWRAPOptions)
esmwrap(sourceGlob: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" });
Types
PathGlob
type PathGlob = string;
ESMWRAPOptions
type ESMWRAPOptions = {
extenstion: string;
};
Roadmap
- [ ] Add Tests
- [x] Add suffix support (Folks might want it to output with a different name , eg:
index.esm.js
) - [ ] Optimize the file matcher
Contributing
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.
Authors
Support
For support, email ahoy@barelyhuman.dev