New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

modconv

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modconv

Module conversion tool for node

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

modconv

Module conversion tool for node.

GitHub license Build Status npm Project Status

Usage

modconv -d dist src

modconv does one thing, convert from one js module syntax to another. It uses Babel behind the scenes and has a very small set of flags you can use.

Why use this?

The main thing this tool does that many other module conversion tools do not is handle default exports from ECMAScript 6 module (esm) format when producing CommonJS (cjs) output. Normally you end up doing something like this from your converted modules:

const myModule = require('my-module').default;

This still works, but leaving off the .default part also works. That means you can simply require converted modules like this, and they will work as expected:

const myModule = require('my-module');

It's very useful for published modules that are written in esm, since using the cjs version in node feels very natural. (Note that other target module formats do not work this way, only cjs).

This is all thanks to babel-plugin-add-module-exports.

Options

FlagDescription
--helpShow help information
-f, --formatDesired output format, see --help for available formats
-d, --out-dirTarget directory for all converted code to be written
-o, --out-fileTarget file for all converted code to be written
--silentPrevent status output, converted module will still be sent to stdout if -d or -o are not used

License

MIT © w33ble

Keywords

esm

FAQs

Package last updated on 22 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts