@alcalzone/esm2cjs
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -27,2 +27,15 @@ #!/usr/bin/env node | ||
}) | ||
.option("platform", { | ||
alias: "p", | ||
type: "string", | ||
default: "node", | ||
choices: ["node", "browser", "neutral"], | ||
description: "Change the platform the code is meant to be run on. Details see https://esbuild.github.io/api/#platform" | ||
}) | ||
.option("target", { | ||
alias: "t", | ||
type: "string", | ||
default: "node10", | ||
description: "Override the default compile target. Details see https://esbuild.github.io/api/#target" | ||
}) | ||
.option("loglevel", { | ||
@@ -42,3 +55,3 @@ alias: "l", | ||
.option("writePackageJson", { | ||
alias: "p", | ||
alias: "j", | ||
type: "boolean", | ||
@@ -69,2 +82,4 @@ default: true, | ||
globs: argv.glob, | ||
target: argv.target, | ||
platform: /** @type {any} */ (argv.platform), | ||
writePackageJson: argv.writePackageJson, | ||
@@ -71,0 +86,0 @@ logLevel: /** @type {any} */ (argv.loglevel), |
@@ -7,3 +7,3 @@ { | ||
"description": "Command line utility to compile a JS project from ES modules to CommonJS", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"bin": "bin/esm2cjs.js", | ||
@@ -65,2 +65,2 @@ "main": "build/cjs/index.js", | ||
} | ||
} | ||
} |
# esm2cjs | ||
Command line utility to compile a JS project from ES modules to CommonJS. | ||
This is handy when building hybrid ESM/CommonJS npm packages. | ||
Command line utility to compile a JS project from ES modules to CommonJS. This is handy when building hybrid ESM/CommonJS npm packages. | ||
Built on top of the blazing fast [esbuild](https://github.com/evanw/esbuild) and supports all modern JS features. | ||
## Install (globally) | ||
```bash | ||
@@ -26,4 +28,20 @@ # using npm | ||
## Performance | ||
### Test case 1: [`zwave-js`](https://github.com/zwave-js/node-zwave-js) | ||
| No. of input files | total size | time taken | | ||
| ------------------ | ---------- | ---------- | | ||
| 141 | 987 KB | 390 ms | | ||
## Changelog | ||
<!-- | ||
Placeholder for the next version: | ||
### **WORK IN PROGRESS** | ||
--> | ||
### 1.1.0 (2021-06-19) | ||
* Support specifying output target and platform | ||
### 1.0.0 (2021-06-16) | ||
Initial release |
13429
228
47