{"name":"@std/esm","version":"0.7.1","description":"Enable ES modules in Node today!","keywords":["commonjs","ecmascript","export","import","modules","node","require"],"repository":{"type":"git","url":"git+https://github.com/standard-things/esm.git"},"license":"MIT","author":{"name":"John-David Dalton","email":"john.david.dalton@gmail.com"},"main":"index.js","engines":{"node":">=4"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"files":["index.js","esm.js.gz"],"gitHead":"22f0feda90f786c8503c8b9f27e235ba8a5d9f56","bugs":{"url":"https://github.com/standard-things/esm/issues"},"homepage":"https://github.com/standard-things/esm#readme","_id":"@std/esm@0.7.1","_npmVersion":"5.3.0","_nodeVersion":"8.3.0","_npmUser":{"name":"jdalton","email":"john.david.dalton@gmail.com"},"dist":{"integrity":"sha512-UlzeWnrIjacUSFL2Az1sX2vtROL5efRbB+caZc/js6HiYCKWhITb9qiCnJLcLGDYCX0wmfN2WSEj9E1tDb+j7Q==","shasum":"f612e3f10b87622c2054f241d1933585ea9050fe","tarball":"http://registry-npm.ywwl.com/@std/esm/download/@std/esm-0.7.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICn1bh4loNjtHsaAKlOzFoBWFdqLvUYJr+ilOKeL1woBAiEAiyWQX0vWTyw6uEvkA8GXRm6kZ7dkuQLL0QZleApmwRc="}],"size":47729,"noattachment":false,"key":"/@std/esm/-/@std/esm-0.7.1.tgz"},"maintainers":[{"name":"jdalton","email":"john.david.dalton@gmail.com"},{"name":"mathias","email":"mathias@qiwi.be"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/esm-0.7.1.tgz_1504107319499_0.5339896604418755"},"directories":{},"readme":"# @std/esm\n\nThis fast, small, zero-dependency package is all you need to enable\nES modules in Node 6+ today!\n\nSee the release [post](https://medium.com/web-on-the-edge/es-modules-in-node-today-32cff914e4b)\n:book: and [video](https://www.youtube.com/watch?v=60S1PFndbn0) :movie_camera:\nfor all the details.\n\nDiscontinued\n---\n\nThis package has been discontinued in favor of [`esm`](https://www.npmjs.com/package/esm).\n\nGetting started\n---\n\nRun `npm i --save @std/esm` in your app or package directory.\n\nThere are three ways to enable ESM with `@std/esm`.\n\n1. Enable ESM with a CJS bridge:\n\n    **index.js**\n    ```js\n    // Provide options as a parameter, environment variable, or rc file.\n    require = require(\"@std/esm\")(module/*, options*/)\n    module.exports = require(\"./main.mjs\").default\n    ```\n\n2. Enable ESM in the Node CLI with the [`-r` option](https://nodejs.org/api/cli.html#cli_r_require_module):\n\n    ```shell\n    node -r @std/esm main.mjs\n    ```\n\n3. Enable ESM in the Node REPL:\n\n    ```shell\n    node -r @std/esm\n    ```\n\n    or upon entering:\n\n    ```shell\n    $ node\n    > require(\"@std/esm\")\n    @std/esm enabled\n    ```\n\n*Note: All `\"cjs\"` options are [unlocked](#unlockables) in the Node REPL.*\n\nStandard Features\n---\n\nThe `@std/esm` loader is as spec-compliant\nas possible and follows Node’s [ESM rules](https://github.com/nodejs/node-eps/blob/master/002-es-modules.md).\n\n:point_right: This means, by default, ESM requires the use of the `.mjs` file\nextension.<br>\n:unlock: You can [unlock](#unlockables) ESM with the `.js` file extension using\nthe `\"js\"` ESM mode.\n\nOut of the box `@std/esm` just works, no configuration necessary, and supports:\n\n* [`import`](https://ponyfoo.com/articles/es6-modules-in-depth#import) / [`export`](https://ponyfoo.com/articles/es6-modules-in-depth#export)\n* [`import.meta`](https://github.com/tc39/proposal-import-meta)\n* [Dynamic `import`](https://github.com/tc39/proposal-dynamic-import)\n* [Improved errors](https://github.com/standard-things/esm/wiki/improved-errors)\n* [Live bindings](https://ponyfoo.com/articles/es6-modules-in-depth#bindings-not-values)\n* [Loading `.mjs` files as ESM](https://github.com/nodejs/node-eps/blob/master/002-es-modules.md#32-determining-if-source-is-an-es-module)\n* [The file URI scheme](https://en.wikipedia.org/wiki/File_URI_scheme)\n* Node [`--eval`](https://nodejs.org/api/cli.html#cli_e_eval_script) and [`--print`](https://nodejs.org/api/cli.html#cli_p_print_script) flags\n* Node 6+ support\n\nUnlockables\n---\n\nUnlock features with options specified as one of the following:\n\n* The `\"@std/esm\"` field in your package.json\n* [JSON6](https://github.com/d3x0r/json6) in an .esmrc or .esmrc.json file\n* JSON6 or file path in the `ESM_OPTIONS` environment variable\n* CJS/ESM in an .esmrc.js or .esmrc.mjs file\n\nCommonly used options may be specified in shorthand form:\n\n* `\"@std/esm\":\"js\"` is shorthand for `\"@std/esm\":{\"mode\":\"js\"}`\n* `\"@std/esm\":\"cjs\"` is shorthand for `\"@std/esm\":{\"cjs\":true,\"mode\":\"js\"}`\n\n<table><tr><td colspan=2><code>{</code><tr><td valign=top><code>\"mode\":</code><td><p>A string mode:<ul><li><code>\"all\"</code> files as ESM<li><code>\"js\"</code> and other files with <code>import</code>, <code>import.meta</code>, <code>export</code>, or <a href=https://github.com/tc39/proposal-modules-pragma><code>\"use module\"</code></a> as ESM</ul><tr><td valign=top><code>\"cjs\":</code><td><p>A boolean or object to unlock CJS features in ESM.<details><summary>Unlockable Features</summary><table><tr><td colspan=2><code>{</code><tr><td valign=top><code>\"cache\":</code><td><p>A boolean for storing ES modules in <code>require.cache</code>.<tr><td valign=top><code>\"extensions\":</code><td><p>A boolean for respecting <code>require.extensions</code> in ESM.<tr><td valign=top><code>\"interop\":</code><td><p>A boolean for <code>__esModule</code> interoperability.<tr><td valign=top><code>\"namedExports\":</code><td><p>A boolean for <a href=https://ponyfoo.com/articles/es6-modules-in-depth#importing-named-exports>importing named exports</a> of CJS modules.<tr><td valign=top><code>\"paths\":</code><td><p>A boolean for following CJS <a href=https://github.com/nodejs/node-eps/blob/master/002-es-modules.md#432-removal-of-non-local-dependencies>path rules</a> in ESM.<tr><td valign=top><code>\"topLevelReturn\":</code><td><p>A boolean for <a href=http://stackoverflow.com/questions/28955047/why-does-a-module-level-return-statement-work-in-node-js/#28955050>top-level <code>return</code></a>.<tr><td valign=top><code>\"vars\":</code><td><p>A boolean for <code>__dirname</code>, <code>__filename</code>, and <code>require</code> in ESM.<tr><td colspan=2><code>}</code></table></details><tr><td valign=top><code>\"await\":</code><td><p>A boolean for <a href=https://github.com/MylesBorins/proposal-top-level-await#variant-c-top-level-await-can-only-be-used-in-modules-without-exports>top-level <code>await</code></a> in modules without ESM exports. <i>(requires Node 7.6+)</i><tr><td colspan=2><code>}</code></table>\n\nDevOpts\n---\n\n<table><tr><td colspan=2><code>{</code><tr><td valign=top><code>\"cache\":</code><td><p>A boolean for toggling cache creation or string path of the cache directory.<tr><td valign=top><code>\"debug\":</code><td><p>A boolean for unmasking stack traces.<tr><td valign=top><code>\"sourceMap\":</code><td><p>A boolean for including inline source maps.<tr><td valign=top><code>\"warnings\":</code><td><p>A boolean for logging development parse and runtime warnings.<tr><td colspan=2><code>}</code></table>\n\nTips\n---\n* Load `@std/esm` before\n  [`@babel/register`](https://github.com/babel/babel/tree/master/packages/babel-register) v7+\n* Load `@std/esm` with the *“require”* option of\n  [`ava`](https://github.com/avajs/ava#options),\n  [`mocha`](https://mochajs.org/#-r---require-module-name),\n  [`nyc`](https://github.com/istanbuljs/nyc#require-additional-modules), and\n  [`tape`](https://github.com/substack/tape#preloading-modules)\n* Load `@std/esm` with the `--node-arg=-r --node-arg=@std/esm` option of\n  [`node-tap`](http://www.node-tap.org/cli/)\n* Load `@std/esm` with the `--node-args=\"-r @std/esm\"` option of\n  [`pm2`](http://pm2.keymetrics.io/docs/usage/quick-start/#options)\n* Load `@std/esm` with [`wallaby.js`](https://wallabyjs.com/docs/integration/node.html#es-modules)\n* Use `@std/esm` to load [`jasmine`](https://jasmine.github.io/setup/nodejs.html#a-simple-example-using-the-library)\n* Use `\"@std/esm\":\"cjs\"` for the `--watch` and `--watch-extensions` options of\n  [`mocha`](https://mochajs.org/#-w---watch)\n* Use `\"@std/esm\":\"cjs\"` for [`ava`](https://github.com/avajs/ava) and [`webpack`](https://github.com/webpack/webpack)\n* When in doubt, use `\"@std/esm\":\"cjs\"`\n","publish_time":1504107319637,"_cnpm_publish_time":1504107319637,"dist-tags":{"latest":"0.26.0"}}