Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

barelyhuman/esmwrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esmwrap

ESM wrapper generator that just get's the job done

UNDER HEAVY DEVELOPMENT, THE API MIGHT CHANGE

Badges

GitHub JavaScript Style Guide Version Downloads

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

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" });

Types

PathGlob

type PathGlob = string;

ESMWRAPOptions

type ESMWRAPOptions = {
  extenstion: string;
};

Roadmap

  • Add Tests
  • 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

License

MIT