alanode

The Binary To Run Node.JS Files With Import And Export Statements.

Usage no npm install needed!

<script type="module">
  import alanode from 'https://cdn.skypack.dev/alanode';
</script>

README

alanode

npm version

alanode is The Binary To Run Node.JS Files With Import And Export Statements.

yarn add -DE alanode # project-based
yarn global add alanode # user-based

Table Of Contents

CLI

The package can be run from the CLI:

$ alanode source

It uses ÀLaMode regex-based transpiler to change import and export statements into require calls and module.export expressions (no Babel). It also normalises process.argv to hide its presence, so that programs can safely keep using the argv array without unexpected results.

With the following file that uses an import:

import { constants } from 'os'
console.log(process.argv)
console.log(constants.signals.SIGINT)

$ alanode t will generate the result successfully:

[
  '/Users/anton/.nvm/versions/node/v12.14.1/bin/node',
  '/Users/anton/a-la/alanode/test/fixture/t'
]
2

Copyright

(c) À La Mode 2019