[Pkg-javascript-commits] [node-rollup-plugin-commonjs] 01/02: New upstream version 8.1.0

Julien Puydt julien.puydt at laposte.net
Wed Aug 16 11:12:35 UTC 2017


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-rollup-plugin-commonjs.

commit 55c4e5c3613ec5e9ee5f88de9db83173fa79fc75
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Wed Aug 16 11:37:58 2017 +0200

    New upstream version 8.1.0
---
 .eslintrc                                          |   26 +
 .gitignore                                         |    5 +
 .travis.yml                                        |    8 +
 CHANGELOG.md                                       |  173 ++
 README.md                                          |  113 ++
 appveyor.yml                                       |   30 +
 package-lock.json                                  | 1810 ++++++++++++++++++++
 package.json                                       |   47 +
 rollup.config.js                                   |   26 +
 src/ast-utils.js                                   |  104 ++
 src/defaultResolver.js                             |   39 +
 src/helpers.js                                     |   19 +
 src/index.js                                       |  176 ++
 src/transform.js                                   |  416 +++++
 src/utils.js                                       |    7 +
 test/form/async-function/input.js                  |    3 +
 test/form/async-function/output.js                 |    6 +
 test/form/ignore-ids-function/_config.js           |    5 +
 test/form/ignore-ids-function/input.js             |    2 +
 test/form/ignore-ids-function/output.js            |   11 +
 test/form/ignore-ids/_config.js                    |    5 +
 test/form/ignore-ids/input.js                      |    2 +
 test/form/ignore-ids/output.js                     |   11 +
 test/form/multiple-var-declarations-b/input.js     |    4 +
 test/form/multiple-var-declarations-b/output.js    |   13 +
 test/form/multiple-var-declarations-c/input.js     |    5 +
 test/form/multiple-var-declarations-c/output.js    |   14 +
 test/form/multiple-var-declarations/input.js       |    4 +
 test/form/multiple-var-declarations/output.js      |   15 +
 .../input.js                                       |    2 +
 .../output.js                                      |    5 +
 .../optimised-default-export-function/input.js     |    1 +
 .../optimised-default-export-function/output.js    |    4 +
 test/form/optimised-default-export-iife/input.js   |    3 +
 test/form/optimised-default-export-iife/output.js  |    6 +
 test/form/optimised-default-export/input.js        |    1 +
 test/form/optimised-default-export/output.js       |    4 +
 .../form/optimised-named-export-conflicts/input.js |    5 +
 .../optimised-named-export-conflicts/output.js     |   15 +
 test/form/optimised-named-export/input.js          |    2 +
 test/form/optimised-named-export/output.js         |   12 +
 test/form/typeof-module-exports/input.js           |    9 +
 test/form/typeof-module-exports/output.js          |   16 +
 test/form/unambiguous-with-default-export/input.js |    3 +
 .../form/unambiguous-with-default-export/output.js |    3 +
 test/form/unambiguous-with-import/input.js         |    3 +
 test/form/unambiguous-with-import/output.js        |    3 +
 test/form/unambiguous-with-named-export/input.js   |    3 +
 test/form/unambiguous-with-named-export/output.js  |    3 +
 test/function/__esModule/answer.js                 |    2 +
 test/function/__esModule/main.js                   |    5 +
 .../assign-properties-to-default-export/foo.js     |    5 +
 .../assign-properties-to-default-export/main.js    |    4 +
 test/function/assumed-globals/_config.js           |    5 +
 test/function/assumed-globals/document.js          |    5 +
 test/function/assumed-globals/main.js              |    3 +
 test/function/bare-import/bar.js                   |    1 +
 test/function/bare-import/foo.js                   |    1 +
 test/function/bare-import/main.js                  |    3 +
 test/function/basic/_config.js                     |    7 +
 test/function/basic/foo.js                         |    1 +
 test/function/basic/main.js                        |    2 +
 test/function/deconflict-export-and-local/index.js |    3 +
 test/function/deconflict-export-and-local/main.js  |    3 +
 .../deconflict-export-and-local/someValue.js       |    1 +
 test/function/dot/foo.bar.js                       |    1 +
 test/function/dot/main.js                          |    3 +
 test/function/duplicate-default-exports-b/main.js  |    3 +
 test/function/duplicate-default-exports-b/x.js     |    4 +
 test/function/duplicate-default-exports/main.js    |    3 +
 test/function/duplicate-default-exports/x.js       |    4 +
 test/function/dynamic-require-fails/main.js        |   10 +
 test/function/exports/_config.js                   |    7 +
 test/function/exports/foo.js                       |    2 +
 test/function/exports/main.js                      |    4 +
 test/function/external-imports/_config.js          |   10 +
 test/function/external-imports/main.js             |    3 +
 test/function/fallback-no-default/foo.js           |    3 +
 test/function/fallback-no-default/main.js          |    4 +
 test/function/global-not-overwritten/_config.js    |    7 +
 test/function/global-not-overwritten/encode.js     |    5 +
 test/function/global-not-overwritten/main.js       |    8 +
 test/function/global-var/main.js                   |   11 +
 test/function/index/foo/index.js                   |    1 +
 test/function/index/main.js                        |    3 +
 test/function/inline/_config.js                    |    7 +
 test/function/inline/foo.js                        |    1 +
 test/function/inline/main.js                       |    3 +
 test/function/inline/multiply.js                   |    3 +
 test/function/named-exports/foo.js                 |    2 +
 test/function/named-exports/main.js                |    4 +
 test/function/ordering/bar.js                      |    3 +
 test/function/ordering/foo.js                      |    4 +
 test/function/ordering/main.js                     |    5 +
 test/function/ordering/shared.js                   |    3 +
 test/function/react-apollo/commonjs-bar.js         |    6 +
 test/function/react-apollo/commonjs-foo.js         |    4 +
 test/function/react-apollo/main.js                 |    3 +
 test/function/reassignment/foo.js                  |    4 +
 test/function/reassignment/main.js                 |    8 +
 test/function/reexports/_config.js                 |    9 +
 test/function/reexports/bar.js                     |    1 +
 test/function/reexports/foo.js                     |    1 +
 test/function/reexports/main.js                    |    3 +
 test/function/shadowing/main.js                    |   11 +
 test/function/skips-dead-branches/_config.js       |    9 +
 test/function/skips-dead-branches/a.js             |    1 +
 test/function/skips-dead-branches/b.js             |    2 +
 test/function/skips-dead-branches/c.js             |    2 +
 test/function/skips-dead-branches/main.js          |    7 +
 test/function/this/foo.js                          |    5 +
 test/function/this/main.js                         |    7 +
 test/function/toplevel-return-complex/_config.js   |    7 +
 test/function/toplevel-return-complex/bar.js       |    3 +
 test/function/toplevel-return-complex/foo.js       |    6 +
 test/function/toplevel-return-complex/main.js      |    3 +
 test/function/toplevel-return/_config.js           |    7 +
 test/function/toplevel-return/foo.js               |    2 +
 test/function/toplevel-return/main.js              |    3 +
 test/function/trailing-slash/foo/index.js          |    1 +
 test/function/trailing-slash/main.js               |    3 +
 test/function/typeof-require/foo.js                |    5 +
 test/function/typeof-require/main.js               |    3 +
 test/node_modules/.gitkeep                         |    0
 test/node_modules/bar/index.js                     |    4 +
 test/node_modules/baz/index.js                     |    1 +
 test/node_modules/external/index.js                |    2 +
 test/node_modules/foo/index.js                     |    1 +
 test/samples/corejs/literal-with-default.js        |    1 +
 .../custom-named-exports-false-positive/main.js    |    2 +
 .../custom-named-exports-false-positive/other.js   |    2 +
 test/samples/custom-named-exports/main.js          |    5 +
 .../custom-named-exports/secret-named-exporter.js  |    2 +
 test/samples/deconflict-helpers/main.js            |    2 +
 test/samples/define-is-undefined/foo.js            |    9 +
 test/samples/define-is-undefined/main.js           |    3 +
 test/samples/extension/foo.coffee                  |    1 +
 test/samples/extension/main.coffee                 |    2 +
 test/samples/external/main.js                      |    3 +
 test/samples/global-in-if-block/main.js            |    5 +
 test/samples/global/main.js                        |    1 +
 test/samples/ignore-global/firstpass.js            |    2 +
 test/samples/ignore-global/identifier.js           |    4 +
 test/samples/ignore-global/main.js                 |    3 +
 test/samples/ignore-global/this.js                 |    6 +
 .../samples/named-exports-from-object-literal/a.js |    1 +
 .../named-exports-from-object-literal/main.js      |    5 +
 .../named-exports-from-object-literal/other.js     |    9 +
 test/samples/other-transforms/bar.js               |    1 +
 test/samples/other-transforms/foo.js               |    3 +
 test/samples/other-transforms/main.js              |    3 +
 test/samples/paren-expression/index.js             |    1 +
 test/samples/reexport/export.js                    |    1 +
 test/samples/reexport/main.js                      |    3 +
 test/samples/reexport/reexport.js                  |    1 +
 test/samples/reserved-as-property/main.js          |    1 +
 test/samples/sourcemap/foo.js                      |    1 +
 test/samples/sourcemap/main.js                     |    2 +
 test/samples/umd/correct-scoping.js                |    5 +
 test/samples/umd/protobuf.js                       |   11 +
 test/samples/umd/sinon.js                          |   40 +
 test/test.js                                       |  409 +++++
 162 files changed, 4068 insertions(+)

diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..577d976
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,26 @@
+{
+  "rules": {
+    "indent": [ 2, "tab", { "SwitchCase": 1 } ],
+    "quotes": [ 2, "single", { "allowTemplateLiterals": true } ],
+    "semi": [ 2, "always" ],
+    "keyword-spacing": [ 2, { "before": true, "after": true } ],
+    "space-before-blocks": [ 2, "always" ],
+    "space-before-function-paren": [ 2, "always" ],
+    "no-mixed-spaces-and-tabs": [ 2, "smart-tabs" ],
+    "no-cond-assign": [ 0 ],
+    "no-unused-vars": [ 2 ],
+    "no-var": [ 2 ],
+    "prefer-const": [ 2 ],
+    "no-console": [ 0 ]
+  },
+  "env": {
+    "es6": true,
+    "mocha": true,
+    "node": true
+  },
+  "extends": "eslint:recommended",
+  "parserOptions": {
+    "ecmaVersion": 8,
+    "sourceType": "module"
+  }
+}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0abc499
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+.DS_Store
+node_modules
+.gobble*
+dist
+!test/node_modules
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..007e08f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,8 @@
+sudo: false
+language: node_js
+node_js:
+  - "node"
+env:
+  global:
+    - BUILD_TIMEOUT=10000
+install: npm install
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..c287b48
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,173 @@
+# rollup-plugin-commonjs changelog
+
+## 8.1.0
+
+* Handle `options.external` correctly ([#212](https://github.com/rollup/rollup-plugin-commonjs/pull/212))
+* Support top-level return ([#195](https://github.com/rollup/rollup-plugin-commonjs/pull/195))
+
+## 8.0.2
+
+* Fix another `var` rewrite bug ([#181](https://github.com/rollup/rollup-plugin-commonjs/issues/181))
+
+## 8.0.1
+
+* Remove declarators within a var declaration correctly ([#179](https://github.com/rollup/rollup-plugin-commonjs/issues/179))
+
+## 8.0.0
+
+* Prefer the names dependencies are imported by for the common `var foo = require('foo')` pattern ([#176](https://github.com/rollup/rollup-plugin-commonjs/issues/176))
+
+## 7.1.0
+
+* Allow certain `require` statements to pass through unmolested ([#174](https://github.com/rollup/rollup-plugin-commonjs/issues/174))
+
+## 7.0.2
+
+* Handle duplicate default exports ([#158](https://github.com/rollup/rollup-plugin-commonjs/issues/158))
+
+## 7.0.1
+
+* Fix exports with parentheses ([#168](https://github.com/rollup/rollup-plugin-commonjs/issues/168))
+
+## 7.0.0
+
+* Rewrite `typeof module`, `typeof module.exports` and `typeof exports` as `'object'` ([#151](https://github.com/rollup/rollup-plugin-commonjs/issues/151))
+
+## 6.0.1
+
+* Don't overwrite globals ([#127](https://github.com/rollup/rollup-plugin-commonjs/issues/127))
+
+## 6.0.0
+
+* Rewrite top-level `define` as `undefined`, so AMD-first UMD blocks do not cause breakage ([#144](https://github.com/rollup/rollup-plugin-commonjs/issues/144))
+* Support ES2017 syntax ([#132](https://github.com/rollup/rollup-plugin-commonjs/issues/132))
+* Deconflict exported reserved keywords ([#116](https://github.com/rollup/rollup-plugin-commonjs/issues/116))
+
+## 5.0.5
+* Fix parenthesis wrapped exports ([#120](https://github.com/rollup/rollup-plugin-commonjs/issues/120))
+
+## 5.0.4
+
+* Ensure named exports are added to default export in optimised modules ([#112](https://github.com/rollup/rollup-plugin-commonjs/issues/112))
+
+## 5.0.3
+
+* Respect custom `namedExports` in optimised modules ([#35](https://github.com/rollup/rollup-plugin-commonjs/issues/35))
+
+## 5.0.2
+
+* Replace `require` (outside call expressions) with `commonjsRequire` helper ([#77](https://github.com/rollup/rollup-plugin-commonjs/issues/77), [#83](https://github.com/rollup/rollup-plugin-commonjs/issues/83))
+
+## 5.0.1
+
+* Deconflict against globals ([#84](https://github.com/rollup/rollup-plugin-commonjs/issues/84))
+
+## 5.0.0
+
+* Optimise modules that don't need to be wrapped in a function ([#106](https://github.com/rollup/rollup-plugin-commonjs/pull/106))
+* Ignore modules containing `import` and `export` statements ([#96](https://github.com/rollup/rollup-plugin-commonjs/pull/96))
+
+## 4.1.0
+
+* Ignore dead branches ([#93](https://github.com/rollup/rollup-plugin-commonjs/issues/93))
+
+## 4.0.1
+
+* Fix `ignoreGlobal` option ([#86](https://github.com/rollup/rollup-plugin-commonjs/pull/86))
+
+## 4.0.0
+
+* Better interop and smaller output ([#92](https://github.com/rollup/rollup-plugin-commonjs/pull/92))
+
+## 3.3.1
+
+* Deconflict export and local module ([rollup/rollup#554](https://github.com/rollup/rollup/issues/554))
+
+## 3.3.0
+
+* Keep the order of execution for require calls ([#43](https://github.com/rollup/rollup-plugin-commonjs/pull/43))
+* Use interopDefault as helper ([#42](https://github.com/rollup/rollup-plugin-commonjs/issues/42))
+
+## 3.2.0
+
+* Use named exports as a function when no default export is defined ([#524](https://github.com/rollup/rollup/issues/524))
+
+## 3.1.0
+
+* Replace `typeof require` with `'function'` ([#38](https://github.com/rollup/rollup-plugin-commonjs/issues/38))
+* Don't attempt to resolve entry file relative to importer ([#63](https://github.com/rollup/rollup-plugin-commonjs/issues/63))
+
+## 3.0.2
+
+* Handle multiple references to `global`
+
+## 3.0.1
+
+* Return a `name`
+
+## 3.0.0
+
+* Make `transform` stateless ([#71](https://github.com/rollup/rollup-plugin-commonjs/pull/71))
+* Support web worker `global` ([#50](https://github.com/rollup/rollup-plugin-commonjs/issues/50))
+* Ignore global with `options.ignoreGlobal` ([#48](https://github.com/rollup/rollup-plugin-commonjs/issues/48))
+
+## 2.2.1
+
+* Prevent false positives with `namedExports` ([#36](https://github.com/rollup/rollup-plugin-commonjs/issues/36))
+
+## 2.2.0
+
+* Rewrite top-level `this` expressions to mean the same as `global`  ([#31](https://github.com/rollup/rollup-plugin-commonjs/issues/31))
+
+## 2.1.0
+
+* Optimised module wrappers ([#20](https://github.com/rollup/rollup-plugin-commonjs/pull/20))
+* Allow control over named exports via `options.namedExports` ([#18](https://github.com/rollup/rollup-plugin-commonjs/issues/18))
+* Handle bare imports correctly ([#23](https://github.com/rollup/rollup-plugin-commonjs/issues/23))
+* Blacklist all reserved words as export names ([#21](https://github.com/rollup/rollup-plugin-commonjs/issues/21))
+* Configure allowed file extensions via `options.extensions` ([#27](https://github.com/rollup/rollup-plugin-commonjs/pull/27))
+
+## 2.0.0
+
+* Support for transpiled modules – `exports.default` is used as the default export in place of `module.exports`, if applicable, and `__esModule` is not exported ([#16](https://github.com/rollup/rollup-plugin-commonjs/pull/16))
+
+## 1.4.0
+
+* Generate sourcemaps by default
+
+## 1.3.0
+
+* Handle references to `global` ([#6](https://github.com/rollup/rollup-plugin-commonjs/issues/6))
+
+## 1.2.0
+
+* Generate named exports where possible ([#5](https://github.com/rollup/rollup-plugin-commonjs/issues/5))
+* Handle shadowed `require`/`module`/`exports`
+
+## 1.1.0
+
+* Handle dots in filenames ([#3](https://github.com/rollup/rollup-plugin-commonjs/issues/3))
+* Wrap modules in IIFE for more readable output
+
+## 1.0.0
+
+* Stable release, now that Rollup supports plugins
+
+## 0.2.1
+
+* Allow mixed CommonJS/ES6 imports/exports
+* Use `var` instead of `let`
+
+## 0.2.0
+
+* Sourcemap support
+* Support `options.include` and `options.exclude`
+* Bail early if module is obviously not a CommonJS module
+
+## 0.1.1
+
+Add dist files to package (whoops!)
+
+## 0.1.0
+
+* First release
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b7a9fbb
--- /dev/null
+++ b/README.md
@@ -0,0 +1,113 @@
+# rollup-plugin-commonjs [![Build Status][travis-img]][travis]
+
+[travis-img]: https://travis-ci.org/rollup/rollup-plugin-commonjs.svg
+[travis]: https://travis-ci.org/rollup/rollup-plugin-commonjs
+
+Convert CommonJS modules to ES6, so they can be included in a Rollup bundle
+
+
+## Installation
+
+```bash
+npm install --save-dev rollup-plugin-commonjs
+```
+
+
+## Usage
+
+Typically, you would use this plugin alongside [rollup-plugin-node-resolve](https://github.com/rollup/rollup-plugin-node-resolve), so that you could bundle your CommonJS dependencies in `node_modules`.
+
+```js
+// rollup.config.js
+import commonjs from 'rollup-plugin-commonjs';
+import nodeResolve from 'rollup-plugin-node-resolve';
+
+export default {
+  entry: 'main.js',
+  dest: 'bundle.js',
+  format: 'iife',
+  plugins: [
+    nodeResolve({
+      jsnext: true,
+      main: true
+    }),
+
+    commonjs({
+      // non-CommonJS modules will be ignored, but you can also
+      // specifically include/exclude files
+      include: 'node_modules/**',  // Default: undefined
+      exclude: [ 'node_modules/foo/**', 'node_modules/bar/**' ],  // Default: undefined
+      // these values can also be regular expressions
+      // include: /node_modules/
+
+      // search for files other than .js files (must already
+      // be transpiled by a previous plugin!)
+      extensions: [ '.js', '.coffee' ],  // Default: [ '.js' ]
+
+      // if true then uses of `global` won't be dealt with by this plugin
+      ignoreGlobal: false,  // Default: false
+
+      // if false then skip sourceMap generation for CommonJS modules
+      sourceMap: false,  // Default: true
+
+      // explicitly specify unresolvable named exports
+      // (see below for more details)
+      namedExports: { './module.js': ['foo', 'bar' ] },  // Default: undefined
+
+      // sometimes you have to leave require statements
+      // unconverted. Pass an array containing the IDs
+      // or a `id => boolean` function. Only use this
+      // option if you know what you're doing!
+      ignore: [ 'conditional-runtime-dependency' ]
+    })
+  ]
+};
+```
+
+### Custom named exports
+
+This plugin will attempt to create named exports, where appropriate, so you can do this...
+
+```js
+// importer.js
+import { named } from './exporter.js';
+
+// exporter.js
+module.exports = { named: 42 }; // or `exports.named = 42;`
+```
+
+...but that's not always possible:
+
+```js
+// importer.js
+import { named } from 'my-lib';
+
+// my-lib.js
+var myLib = exports;
+myLib.named = 'you can\'t see me';
+```
+
+In those cases, you can specify custom named exports:
+
+```js
+commonjs({
+  namedExports: {
+    // left-hand side can be an absolute path, a path
+    // relative to the current directory, or the name
+    // of a module in node_modules
+    'node_modules/my-lib/index.js': [ 'named' ]
+  }
+})
+```
+
+
+## Strict mode
+
+ES modules are *always* parsed in strict mode. That means that certain non-strict constructs (like octal literals) will be treated as syntax errors when Rollup parses modules that use them. Some older CommonJS modules depend on those constructs, and if you depend on them your bundle will blow up. There's basically nothing we can do about that.
+
+Luckily, there is absolutely no good reason *not* to use strict mode for everything — so the solution to this problem is to lobby the authors of those modules to update them.
+
+
+## License
+
+MIT
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..64ab3aa
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,30 @@
+# http://www.appveyor.com/docs/appveyor-yml
+
+version: "{build}"
+
+clone_depth: 10
+
+init:
+  - git config --global core.autocrlf false
+
+environment:
+  matrix:
+    # node.js
+    - nodejs_version: 8
+
+install:
+  - ps: Install-Product node $env:nodejs_version
+  - npm install
+
+build: off
+
+test_script:
+  - node --version && npm --version
+  - npm test
+
+matrix:
+  fast_finish: false
+
+# cache:
+#   - C:\Users\appveyor\AppData\Roaming\npm-cache -> package.json     # npm cache
+#   - node_modules -> package.json                                    # local npm modules
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..e9223b1
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,1810 @@
+{
+  "name": "rollup-plugin-commonjs",
+  "version": "8.0.2",
+  "lockfileVersion": 1,
+  "requires": true,
+  "dependencies": {
+    "acorn": {
+      "version": "4.0.13",
+      "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz",
+      "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c="
+    },
+    "acorn-jsx": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz",
+      "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=",
+      "dev": true,
+      "requires": {
+        "acorn": "3.3.0"
+      },
+      "dependencies": {
+        "acorn": {
+          "version": "3.3.0",
+          "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
+          "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=",
+          "dev": true
+        }
+      }
+    },
+    "acorn-object-spread": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/acorn-object-spread/-/acorn-object-spread-1.0.0.tgz",
+      "integrity": "sha1-SOrQ9KjrFplaF6Dbn/xqyq2kumg=",
+      "dev": true,
+      "requires": {
+        "acorn": "3.3.0"
+      },
+      "dependencies": {
+        "acorn": {
+          "version": "3.3.0",
+          "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
+          "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=",
+          "dev": true
+        }
+      }
+    },
+    "ajv": {
+      "version": "4.11.8",
+      "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz",
+      "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=",
+      "dev": true,
+      "requires": {
+        "co": "4.6.0",
+        "json-stable-stringify": "1.0.1"
+      }
+    },
+    "ajv-keywords": {
+      "version": "1.5.1",
+      "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz",
+      "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=",
+      "dev": true
+    },
+    "ansi-escapes": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz",
+      "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=",
+      "dev": true
+    },
+    "ansi-regex": {
+      "version": "2.1.1",
+      "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+      "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+      "dev": true
+    },
+    "ansi-styles": {
+      "version": "2.2.1",
+      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
+      "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
+      "dev": true
+    },
+    "argparse": {
+      "version": "1.0.9",
+      "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz",
+      "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=",
+      "dev": true,
+      "requires": {
+        "sprintf-js": "1.0.3"
+      }
+    },
+    "arr-diff": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz",
+      "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=",
+      "requires": {
+        "arr-flatten": "1.1.0"
+      }
+    },
+    "arr-flatten": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
+      "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg=="
+    },
+    "array-union": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
+      "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",
+      "dev": true,
+      "requires": {
+        "array-uniq": "1.0.3"
+      }
+    },
+    "array-uniq": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
+      "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=",
+      "dev": true
+    },
+    "array-unique": {
+      "version": "0.2.1",
+      "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz",
+      "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM="
+    },
+    "arrify": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
+      "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=",
+      "dev": true
+    },
+    "babel-code-frame": {
+      "version": "6.22.0",
+      "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz",
+      "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=",
+      "dev": true,
+      "requires": {
+        "chalk": "1.1.3",
+        "esutils": "2.0.2",
+        "js-tokens": "3.0.2"
+      }
+    },
+    "balanced-match": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
+      "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+      "dev": true
+    },
+    "brace-expansion": {
+      "version": "1.1.8",
+      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
+      "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=",
+      "dev": true,
+      "requires": {
+        "balanced-match": "1.0.0",
+        "concat-map": "0.0.1"
+      }
+    },
+    "braces": {
+      "version": "1.8.5",
+      "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz",
+      "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=",
+      "requires": {
+        "expand-range": "1.8.2",
+        "preserve": "0.2.0",
+        "repeat-element": "1.1.2"
+      }
+    },
+    "browser-resolve": {
+      "version": "1.11.2",
+      "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz",
+      "integrity": "sha1-j/CbCixCFxihBRwmCzLkj0QpOM4=",
+      "dev": true,
+      "requires": {
+        "resolve": "1.1.7"
+      },
+      "dependencies": {
+        "resolve": {
+          "version": "1.1.7",
+          "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
+          "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=",
+          "dev": true
+        }
+      }
+    },
+    "browser-stdout": {
+      "version": "1.3.0",
+      "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz",
+      "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=",
+      "dev": true
+    },
+    "buble": {
+      "version": "0.15.2",
+      "resolved": "https://registry.npmjs.org/buble/-/buble-0.15.2.tgz",
+      "integrity": "sha1-VH/EdIP45egXbYKqXrzLGDsC1hM=",
+      "dev": true,
+      "requires": {
+        "acorn": "3.3.0",
+        "acorn-jsx": "3.0.1",
+        "acorn-object-spread": "1.0.0",
+        "chalk": "1.1.3",
+        "magic-string": "0.14.0",
+        "minimist": "1.2.0",
+        "os-homedir": "1.0.2"
+      },
+      "dependencies": {
+        "acorn": {
+          "version": "3.3.0",
+          "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
+          "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=",
+          "dev": true
+        },
+        "magic-string": {
+          "version": "0.14.0",
+          "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.14.0.tgz",
+          "integrity": "sha1-VyJK7xcByu7Sc7F6OalW5ysXJGI=",
+          "dev": true,
+          "requires": {
+            "vlq": "0.2.2"
+          }
+        }
+      }
+    },
+    "builtin-modules": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
+      "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
+      "dev": true
+    },
+    "caller-path": {
+      "version": "0.1.0",
+      "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz",
+      "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=",
+      "dev": true,
+      "requires": {
+        "callsites": "0.2.0"
+      }
+    },
+    "callsites": {
+      "version": "0.2.0",
+      "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz",
+      "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=",
+      "dev": true
+    },
+    "chalk": {
+      "version": "1.1.3",
+      "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
+      "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
+      "dev": true,
+      "requires": {
+        "ansi-styles": "2.2.1",
+        "escape-string-regexp": "1.0.5",
+        "has-ansi": "2.0.0",
+        "strip-ansi": "3.0.1",
+        "supports-color": "2.0.0"
+      }
+    },
+    "circular-json": {
+      "version": "0.3.3",
+      "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz",
+      "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==",
+      "dev": true
+    },
+    "cli-cursor": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz",
+      "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=",
+      "dev": true,
+      "requires": {
+        "restore-cursor": "1.0.1"
+      }
+    },
+    "cli-width": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.1.0.tgz",
+      "integrity": "sha1-sjTKIJsp72b8UY2bmNWEewDt8Ao=",
+      "dev": true
+    },
+    "co": {
+      "version": "4.6.0",
+      "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
+      "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=",
+      "dev": true
+    },
+    "code-point-at": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
+      "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
+      "dev": true
+    },
+    "commander": {
+      "version": "2.9.0",
+      "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz",
+      "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=",
+      "dev": true,
+      "requires": {
+        "graceful-readlink": "1.0.1"
+      }
+    },
+    "concat-map": {
+      "version": "0.0.1",
+      "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+      "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
+      "dev": true
+    },
+    "concat-stream": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz",
+      "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=",
+      "dev": true,
+      "requires": {
+        "inherits": "2.0.3",
+        "readable-stream": "2.3.3",
+        "typedarray": "0.0.6"
+      }
+    },
+    "core-util-is": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
+      "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
+      "dev": true
+    },
+    "d": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz",
+      "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=",
+      "dev": true,
+      "requires": {
+        "es5-ext": "0.10.26"
+      }
+    },
+    "debug": {
+      "version": "2.6.8",
+      "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz",
+      "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=",
+      "dev": true,
+      "requires": {
+        "ms": "2.0.0"
+      }
+    },
+    "deep-is": {
+      "version": "0.1.3",
+      "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
+      "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
+      "dev": true
+    },
+    "del": {
+      "version": "2.2.2",
+      "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz",
+      "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=",
+      "dev": true,
+      "requires": {
+        "globby": "5.0.0",
+        "is-path-cwd": "1.0.0",
+        "is-path-in-cwd": "1.0.0",
+        "object-assign": "4.1.1",
+        "pify": "2.3.0",
+        "pinkie-promise": "2.0.1",
+        "rimraf": "2.6.1"
+      }
+    },
+    "diff": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz",
+      "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=",
+      "dev": true
+    },
+    "doctrine": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz",
+      "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=",
+      "dev": true,
+      "requires": {
+        "esutils": "2.0.2",
+        "isarray": "1.0.0"
+      }
+    },
+    "es5-ext": {
+      "version": "0.10.26",
+      "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.26.tgz",
+      "integrity": "sha1-UbISilMbcMT2dkCTpzy+u4IYY3I=",
+      "dev": true,
+      "requires": {
+        "es6-iterator": "2.0.1",
+        "es6-symbol": "3.1.1"
+      }
+    },
+    "es6-iterator": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz",
+      "integrity": "sha1-jjGcnwRTv1ddN0lAplWSDlnKVRI=",
+      "dev": true,
+      "requires": {
+        "d": "1.0.0",
+        "es5-ext": "0.10.26",
+        "es6-symbol": "3.1.1"
+      }
+    },
+    "es6-map": {
+      "version": "0.1.5",
+      "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz",
+      "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=",
+      "dev": true,
+      "requires": {
+        "d": "1.0.0",
+        "es5-ext": "0.10.26",
+        "es6-iterator": "2.0.1",
+        "es6-set": "0.1.5",
+        "es6-symbol": "3.1.1",
+        "event-emitter": "0.3.5"
+      }
+    },
+    "es6-set": {
+      "version": "0.1.5",
+      "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz",
+      "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=",
+      "dev": true,
+      "requires": {
+        "d": "1.0.0",
+        "es5-ext": "0.10.26",
+        "es6-iterator": "2.0.1",
+        "es6-symbol": "3.1.1",
+        "event-emitter": "0.3.5"
+      }
+    },
+    "es6-symbol": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz",
+      "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=",
+      "dev": true,
+      "requires": {
+        "d": "1.0.0",
+        "es5-ext": "0.10.26"
+      }
+    },
+    "es6-weak-map": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz",
+      "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=",
+      "dev": true,
+      "requires": {
+        "d": "1.0.0",
+        "es5-ext": "0.10.26",
+        "es6-iterator": "2.0.1",
+        "es6-symbol": "3.1.1"
+      }
+    },
+    "escape-string-regexp": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+      "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+      "dev": true
+    },
+    "escope": {
+      "version": "3.6.0",
+      "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz",
+      "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=",
+      "dev": true,
+      "requires": {
+        "es6-map": "0.1.5",
+        "es6-weak-map": "2.0.2",
+        "esrecurse": "4.2.0",
+        "estraverse": "4.2.0"
+      }
+    },
+    "eslint": {
+      "version": "3.19.0",
+      "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz",
+      "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=",
+      "dev": true,
+      "requires": {
+        "babel-code-frame": "6.22.0",
+        "chalk": "1.1.3",
+        "concat-stream": "1.6.0",
+        "debug": "2.6.8",
+        "doctrine": "2.0.0",
+        "escope": "3.6.0",
+        "espree": "3.4.3",
+        "esquery": "1.0.0",
+        "estraverse": "4.2.0",
+        "esutils": "2.0.2",
+        "file-entry-cache": "2.0.0",
+        "glob": "7.1.2",
+        "globals": "9.18.0",
+        "ignore": "3.3.3",
+        "imurmurhash": "0.1.4",
+        "inquirer": "0.12.0",
+        "is-my-json-valid": "2.16.0",
+        "is-resolvable": "1.0.0",
+        "js-yaml": "3.9.1",
+        "json-stable-stringify": "1.0.1",
+        "levn": "0.3.0",
+        "lodash": "4.17.4",
+        "mkdirp": "0.5.1",
+        "natural-compare": "1.4.0",
+        "optionator": "0.8.2",
+        "path-is-inside": "1.0.2",
+        "pluralize": "1.2.1",
+        "progress": "1.1.8",
+        "require-uncached": "1.0.3",
+        "shelljs": "0.7.8",
+        "strip-bom": "3.0.0",
+        "strip-json-comments": "2.0.1",
+        "table": "3.8.3",
+        "text-table": "0.2.0",
+        "user-home": "2.0.0"
+      }
+    },
+    "espree": {
+      "version": "3.4.3",
+      "resolved": "https://registry.npmjs.org/espree/-/espree-3.4.3.tgz",
+      "integrity": "sha1-KRC1zNSc6JPC//+qtP2LOjG4I3Q=",
+      "dev": true,
+      "requires": {
+        "acorn": "5.1.1",
+        "acorn-jsx": "3.0.1"
+      },
+      "dependencies": {
+        "acorn": {
+          "version": "5.1.1",
+          "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.1.tgz",
+          "integrity": "sha512-vOk6uEMctu0vQrvuSqFdJyqj1Q0S5VTDL79qtjo+DhRr+1mmaD+tluFSCZqhvi/JUhXSzoZN2BhtstaPEeE8cw==",
+          "dev": true
+        }
+      }
+    },
+    "esprima": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
+      "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==",
+      "dev": true
+    },
+    "esquery": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz",
+      "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=",
+      "dev": true,
+      "requires": {
+        "estraverse": "4.2.0"
+      }
+    },
+    "esrecurse": {
+      "version": "4.2.0",
+      "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz",
+      "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=",
+      "dev": true,
+      "requires": {
+        "estraverse": "4.2.0",
+        "object-assign": "4.1.1"
+      }
+    },
+    "estraverse": {
+      "version": "4.2.0",
+      "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz",
+      "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=",
+      "dev": true
+    },
+    "estree-walker": {
+      "version": "0.3.1",
+      "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.3.1.tgz",
+      "integrity": "sha1-5rGlHPcpJSTnI3wxLl/mZgwc4ao="
+    },
+    "esutils": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
+      "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
+      "dev": true
+    },
+    "event-emitter": {
+      "version": "0.3.5",
+      "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
+      "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=",
+      "dev": true,
+      "requires": {
+        "d": "1.0.0",
+        "es5-ext": "0.10.26"
+      }
+    },
+    "exit-hook": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz",
+      "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=",
+      "dev": true
+    },
+    "expand-brackets": {
+      "version": "0.1.5",
+      "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz",
+      "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=",
+      "requires": {
+        "is-posix-bracket": "0.1.1"
+      }
+    },
+    "expand-range": {
+      "version": "1.8.2",
+      "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz",
+      "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=",
+      "requires": {
+        "fill-range": "2.2.3"
+      }
+    },
+    "extglob": {
+      "version": "0.3.2",
+      "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz",
+      "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=",
+      "requires": {
+        "is-extglob": "1.0.0"
+      }
+    },
+    "fast-levenshtein": {
+      "version": "2.0.6",
+      "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+      "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
+      "dev": true
+    },
+    "figures": {
+      "version": "1.7.0",
+      "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz",
+      "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=",
+      "dev": true,
+      "requires": {
+        "escape-string-regexp": "1.0.5",
+        "object-assign": "4.1.1"
+      }
+    },
+    "file-entry-cache": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz",
+      "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=",
+      "dev": true,
+      "requires": {
+        "flat-cache": "1.2.2",
+        "object-assign": "4.1.1"
+      }
+    },
+    "filename-regex": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz",
+      "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY="
+    },
+    "fill-range": {
+      "version": "2.2.3",
+      "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz",
+      "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=",
+      "requires": {
+        "is-number": "2.1.0",
+        "isobject": "2.1.0",
+        "randomatic": "1.1.7",
+        "repeat-element": "1.1.2",
+        "repeat-string": "1.6.1"
+      }
+    },
+    "flat-cache": {
+      "version": "1.2.2",
+      "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.2.2.tgz",
+      "integrity": "sha1-+oZxTnLCHbiGAXYezy9VXRq8a5Y=",
+      "dev": true,
+      "requires": {
+        "circular-json": "0.3.3",
+        "del": "2.2.2",
+        "graceful-fs": "4.1.11",
+        "write": "0.2.1"
+      }
+    },
+    "for-in": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
+      "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA="
+    },
+    "for-own": {
+      "version": "0.1.5",
+      "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz",
+      "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=",
+      "requires": {
+        "for-in": "1.0.2"
+      }
+    },
+    "fs.realpath": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+      "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
+      "dev": true
+    },
+    "generate-function": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz",
+      "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=",
+      "dev": true
+    },
+    "generate-object-property": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz",
+      "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=",
+      "dev": true,
+      "requires": {
+        "is-property": "1.0.2"
+      }
+    },
+    "glob": {
+      "version": "7.1.2",
+      "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
+      "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+      "dev": true,
+      "requires": {
+        "fs.realpath": "1.0.0",
+        "inflight": "1.0.6",
+        "inherits": "2.0.3",
+        "minimatch": "3.0.4",
+        "once": "1.4.0",
+        "path-is-absolute": "1.0.1"
+      }
+    },
+    "glob-base": {
+      "version": "0.3.0",
+      "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz",
+      "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=",
+      "requires": {
+        "glob-parent": "2.0.0",
+        "is-glob": "2.0.1"
+      }
+    },
+    "glob-parent": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz",
+      "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=",
+      "requires": {
+        "is-glob": "2.0.1"
+      }
+    },
+    "globals": {
+      "version": "9.18.0",
+      "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz",
+      "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==",
+      "dev": true
+    },
+    "globby": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz",
+      "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=",
+      "dev": true,
+      "requires": {
+        "array-union": "1.0.2",
+        "arrify": "1.0.1",
+        "glob": "7.1.2",
+        "object-assign": "4.1.1",
+        "pify": "2.3.0",
+        "pinkie-promise": "2.0.1"
+      }
+    },
+    "graceful-fs": {
+      "version": "4.1.11",
+      "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
+      "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=",
+      "dev": true
+    },
+    "graceful-readlink": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
+      "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
+      "dev": true
+    },
+    "growl": {
+      "version": "1.9.2",
+      "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz",
+      "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=",
+      "dev": true
+    },
+    "has-ansi": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
+      "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
+      "dev": true,
+      "requires": {
+        "ansi-regex": "2.1.1"
+      }
+    },
+    "has-flag": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz",
+      "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=",
+      "dev": true
+    },
+    "ignore": {
+      "version": "3.3.3",
+      "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.3.tgz",
+      "integrity": "sha1-QyNS5XrM2HqzEQ6C0/6g5HgSFW0=",
+      "dev": true
+    },
+    "imurmurhash": {
+      "version": "0.1.4",
+      "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+      "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
+      "dev": true
+    },
+    "inflight": {
+      "version": "1.0.6",
+      "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+      "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+      "dev": true,
+      "requires": {
+        "once": "1.4.0",
+        "wrappy": "1.0.2"
+      }
+    },
+    "inherits": {
+      "version": "2.0.3",
+      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+      "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
+      "dev": true
+    },
+    "inquirer": {
+      "version": "0.12.0",
+      "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz",
+      "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=",
+      "dev": true,
+      "requires": {
+        "ansi-escapes": "1.4.0",
+        "ansi-regex": "2.1.1",
+        "chalk": "1.1.3",
+        "cli-cursor": "1.0.2",
+        "cli-width": "2.1.0",
+        "figures": "1.7.0",
+        "lodash": "4.17.4",
+        "readline2": "1.0.1",
+        "run-async": "0.1.0",
+        "rx-lite": "3.1.2",
+        "string-width": "1.0.2",
+        "strip-ansi": "3.0.1",
+        "through": "2.3.8"
+      }
+    },
+    "interpret": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.3.tgz",
+      "integrity": "sha1-y8NcYu7uc/Gat7EKgBURQBr8D5A=",
+      "dev": true
+    },
+    "is-buffer": {
+      "version": "1.1.5",
+      "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz",
+      "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw="
+    },
+    "is-dotfile": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz",
+      "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE="
+    },
+    "is-equal-shallow": {
+      "version": "0.1.3",
+      "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz",
+      "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=",
+      "requires": {
+        "is-primitive": "2.0.0"
+      }
+    },
+    "is-extendable": {
+      "version": "0.1.1",
+      "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
+      "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik="
+    },
+    "is-extglob": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz",
+      "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA="
+    },
+    "is-fullwidth-code-point": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+      "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+      "dev": true,
+      "requires": {
+        "number-is-nan": "1.0.1"
+      }
+    },
+    "is-glob": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz",
+      "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=",
+      "requires": {
+        "is-extglob": "1.0.0"
+      }
+    },
+    "is-my-json-valid": {
+      "version": "2.16.0",
+      "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz",
+      "integrity": "sha1-8Hndm/2uZe4gOKrorLyGqxCeNpM=",
+      "dev": true,
+      "requires": {
+        "generate-function": "2.0.0",
+        "generate-object-property": "1.2.0",
+        "jsonpointer": "4.0.1",
+        "xtend": "4.0.1"
+      }
+    },
+    "is-number": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz",
+      "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=",
+      "requires": {
+        "kind-of": "3.2.2"
+      }
+    },
+    "is-path-cwd": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz",
+      "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=",
+      "dev": true
+    },
+    "is-path-in-cwd": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz",
+      "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=",
+      "dev": true,
+      "requires": {
+        "is-path-inside": "1.0.0"
+      }
+    },
+    "is-path-inside": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz",
+      "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=",
+      "dev": true,
+      "requires": {
+        "path-is-inside": "1.0.2"
+      }
+    },
+    "is-posix-bracket": {
+      "version": "0.1.1",
+      "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz",
+      "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q="
+    },
+    "is-primitive": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz",
+      "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU="
+    },
+    "is-property": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
+      "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=",
+      "dev": true
+    },
+    "is-resolvable": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz",
+      "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=",
+      "dev": true,
+      "requires": {
+        "tryit": "1.0.3"
+      }
+    },
+    "isarray": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+      "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
+    },
+    "isobject": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
+      "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=",
+      "requires": {
+        "isarray": "1.0.0"
+      }
+    },
+    "js-tokens": {
+      "version": "3.0.2",
+      "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
+      "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
+      "dev": true
+    },
+    "js-yaml": {
+      "version": "3.9.1",
+      "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.9.1.tgz",
+      "integrity": "sha512-CbcG379L1e+mWBnLvHWWeLs8GyV/EMw862uLI3c+GxVyDHWZcjZinwuBd3iW2pgxgIlksW/1vNJa4to+RvDOww==",
+      "dev": true,
+      "requires": {
+        "argparse": "1.0.9",
+        "esprima": "4.0.0"
+      }
+    },
+    "json-stable-stringify": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz",
+      "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=",
+      "dev": true,
+      "requires": {
+        "jsonify": "0.0.0"
+      }
+    },
+    "json3": {
+      "version": "3.3.2",
+      "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz",
+      "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=",
+      "dev": true
+    },
+    "jsonify": {
+      "version": "0.0.0",
+      "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
+      "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=",
+      "dev": true
+    },
+    "jsonpointer": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz",
+      "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=",
+      "dev": true
+    },
+    "kind-of": {
+      "version": "3.2.2",
+      "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+      "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+      "requires": {
+        "is-buffer": "1.1.5"
+      }
+    },
+    "levn": {
+      "version": "0.3.0",
+      "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
+      "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
+      "dev": true,
+      "requires": {
+        "prelude-ls": "1.1.2",
+        "type-check": "0.3.2"
+      }
+    },
+    "locate-character": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-2.0.1.tgz",
+      "integrity": "sha1-SPlZnzQtryb3PbMvRZQerje645E=",
+      "dev": true
+    },
+    "lodash": {
+      "version": "4.17.4",
+      "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
+      "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=",
+      "dev": true
+    },
+    "lodash._baseassign": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz",
+      "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=",
+      "dev": true,
+      "requires": {
+        "lodash._basecopy": "3.0.1",
+        "lodash.keys": "3.1.2"
+      }
+    },
+    "lodash._basecopy": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz",
+      "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=",
+      "dev": true
+    },
+    "lodash._basecreate": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz",
+      "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=",
+      "dev": true
+    },
+    "lodash._getnative": {
+      "version": "3.9.1",
+      "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz",
+      "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=",
+      "dev": true
+    },
+    "lodash._isiterateecall": {
+      "version": "3.0.9",
+      "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz",
+      "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=",
+      "dev": true
+    },
+    "lodash.create": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz",
+      "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=",
+      "dev": true,
+      "requires": {
+        "lodash._baseassign": "3.2.0",
+        "lodash._basecreate": "3.0.3",
+        "lodash._isiterateecall": "3.0.9"
+      }
+    },
+    "lodash.isarguments": {
+      "version": "3.1.0",
+      "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz",
+      "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=",
+      "dev": true
+    },
+    "lodash.isarray": {
+      "version": "3.0.4",
+      "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz",
+      "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=",
+      "dev": true
+    },
+    "lodash.keys": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz",
+      "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=",
+      "dev": true,
+      "requires": {
+        "lodash._getnative": "3.9.1",
+        "lodash.isarguments": "3.1.0",
+        "lodash.isarray": "3.0.4"
+      }
+    },
+    "magic-string": {
+      "version": "0.19.1",
+      "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.19.1.tgz",
+      "integrity": "sha1-FNdoATyvLsj96hakmvgvw3fnUgE=",
+      "requires": {
+        "vlq": "0.2.2"
+      }
+    },
+    "micromatch": {
+      "version": "2.3.11",
+      "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz",
+      "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=",
+      "requires": {
+        "arr-diff": "2.0.0",
+        "array-unique": "0.2.1",
+        "braces": "1.8.5",
+        "expand-brackets": "0.1.5",
+        "extglob": "0.3.2",
+        "filename-regex": "2.0.1",
+        "is-extglob": "1.0.0",
+        "is-glob": "2.0.1",
+        "kind-of": "3.2.2",
+        "normalize-path": "2.1.1",
+        "object.omit": "2.0.1",
+        "parse-glob": "3.0.4",
+        "regex-cache": "0.4.3"
+      }
+    },
+    "minimatch": {
+      "version": "3.0.4",
+      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+      "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+      "dev": true,
+      "requires": {
+        "brace-expansion": "1.1.8"
+      }
+    },
+    "minimist": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+      "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+      "dev": true
+    },
+    "mkdirp": {
+      "version": "0.5.1",
+      "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
+      "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
+      "dev": true,
+      "requires": {
+        "minimist": "0.0.8"
+      },
+      "dependencies": {
+        "minimist": {
+          "version": "0.0.8",
+          "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
+          "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
+          "dev": true
+        }
+      }
+    },
+    "mocha": {
+      "version": "3.5.0",
+      "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.0.tgz",
+      "integrity": "sha512-pIU2PJjrPYvYRqVpjXzj76qltO9uBYI7woYAMoxbSefsa+vqAfptjoeevd6bUgwD0mPIO+hv9f7ltvsNreL2PA==",
+      "dev": true,
+      "requires": {
+        "browser-stdout": "1.3.0",
+        "commander": "2.9.0",
+        "debug": "2.6.8",
+        "diff": "3.2.0",
+        "escape-string-regexp": "1.0.5",
+        "glob": "7.1.1",
+        "growl": "1.9.2",
+        "json3": "3.3.2",
+        "lodash.create": "3.1.1",
+        "mkdirp": "0.5.1",
+        "supports-color": "3.1.2"
+      },
+      "dependencies": {
+        "glob": {
+          "version": "7.1.1",
+          "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz",
+          "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=",
+          "dev": true,
+          "requires": {
+            "fs.realpath": "1.0.0",
+            "inflight": "1.0.6",
+            "inherits": "2.0.3",
+            "minimatch": "3.0.4",
+            "once": "1.4.0",
+            "path-is-absolute": "1.0.1"
+          }
+        },
+        "supports-color": {
+          "version": "3.1.2",
+          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz",
+          "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=",
+          "dev": true,
+          "requires": {
+            "has-flag": "1.0.0"
+          }
+        }
+      }
+    },
+    "ms": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+      "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+      "dev": true
+    },
+    "mute-stream": {
+      "version": "0.0.5",
+      "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz",
+      "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=",
+      "dev": true
+    },
+    "natural-compare": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+      "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
+      "dev": true
+    },
+    "normalize-path": {
+      "version": "2.1.1",
+      "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
+      "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
+      "requires": {
+        "remove-trailing-separator": "1.0.2"
+      }
+    },
+    "number-is-nan": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
+      "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
+      "dev": true
+    },
+    "object-assign": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+      "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
+      "dev": true
+    },
+    "object.omit": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz",
+      "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=",
+      "requires": {
+        "for-own": "0.1.5",
+        "is-extendable": "0.1.1"
+      }
+    },
+    "once": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+      "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+      "dev": true,
+      "requires": {
+        "wrappy": "1.0.2"
+      }
+    },
+    "onetime": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz",
+      "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=",
+      "dev": true
+    },
+    "optionator": {
+      "version": "0.8.2",
+      "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
+      "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=",
+      "dev": true,
+      "requires": {
+        "deep-is": "0.1.3",
+        "fast-levenshtein": "2.0.6",
+        "levn": "0.3.0",
+        "prelude-ls": "1.1.2",
+        "type-check": "0.3.2",
+        "wordwrap": "1.0.0"
+      }
+    },
+    "os-homedir": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
+      "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
+      "dev": true
+    },
+    "parse-glob": {
+      "version": "3.0.4",
+      "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz",
+      "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=",
+      "requires": {
+        "glob-base": "0.3.0",
+        "is-dotfile": "1.0.3",
+        "is-extglob": "1.0.0",
+        "is-glob": "2.0.1"
+      }
+    },
+    "path-is-absolute": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+      "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+      "dev": true
+    },
+    "path-is-inside": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
+      "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=",
+      "dev": true
+    },
+    "path-parse": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz",
+      "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME="
+    },
+    "pify": {
+      "version": "2.3.0",
+      "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+      "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+      "dev": true
+    },
+    "pinkie": {
+      "version": "2.0.4",
+      "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
+      "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
+      "dev": true
+    },
+    "pinkie-promise": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
+      "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
+      "dev": true,
+      "requires": {
+        "pinkie": "2.0.4"
+      }
+    },
+    "pluralize": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz",
+      "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=",
+      "dev": true
+    },
+    "prelude-ls": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
+      "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
+      "dev": true
+    },
+    "preserve": {
+      "version": "0.2.0",
+      "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz",
+      "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks="
+    },
+    "process-nextick-args": {
+      "version": "1.0.7",
+      "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
+      "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=",
+      "dev": true
+    },
+    "progress": {
+      "version": "1.1.8",
+      "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz",
+      "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=",
+      "dev": true
+    },
+    "randomatic": {
+      "version": "1.1.7",
+      "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz",
+      "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==",
+      "requires": {
+        "is-number": "3.0.0",
+        "kind-of": "4.0.0"
+      },
+      "dependencies": {
+        "is-number": {
+          "version": "3.0.0",
+          "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
+          "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
+          "requires": {
+            "kind-of": "3.2.2"
+          },
+          "dependencies": {
+            "kind-of": {
+              "version": "3.2.2",
+              "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+              "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+              "requires": {
+                "is-buffer": "1.1.5"
+              }
+            }
+          }
+        },
+        "kind-of": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz",
+          "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=",
+          "requires": {
+            "is-buffer": "1.1.5"
+          }
+        }
+      }
+    },
+    "readable-stream": {
+      "version": "2.3.3",
+      "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
+      "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
+      "dev": true,
+      "requires": {
+        "core-util-is": "1.0.2",
+        "inherits": "2.0.3",
+        "isarray": "1.0.0",
+        "process-nextick-args": "1.0.7",
+        "safe-buffer": "5.1.1",
+        "string_decoder": "1.0.3",
+        "util-deprecate": "1.0.2"
+      }
+    },
+    "readline2": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz",
+      "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=",
+      "dev": true,
+      "requires": {
+        "code-point-at": "1.1.0",
+        "is-fullwidth-code-point": "1.0.0",
+        "mute-stream": "0.0.5"
+      }
+    },
+    "rechoir": {
+      "version": "0.6.2",
+      "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
+      "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
+      "dev": true,
+      "requires": {
+        "resolve": "1.4.0"
+      }
+    },
+    "regex-cache": {
+      "version": "0.4.3",
+      "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.3.tgz",
+      "integrity": "sha1-mxpsNdTQ3871cRrmUejp09cRQUU=",
+      "requires": {
+        "is-equal-shallow": "0.1.3",
+        "is-primitive": "2.0.0"
+      }
+    },
+    "remove-trailing-separator": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz",
+      "integrity": "sha1-abBi2XhyetFNxrVrpKt3L9jXBRE="
+    },
+    "repeat-element": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz",
+      "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo="
+    },
+    "repeat-string": {
+      "version": "1.6.1",
+      "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
+      "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc="
+    },
+    "require-relative": {
+      "version": "0.8.7",
+      "resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz",
+      "integrity": "sha1-eZlTn8ngR6N5KPoZb44VY9q9Nt4=",
+      "dev": true
+    },
+    "require-uncached": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz",
+      "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=",
+      "dev": true,
+      "requires": {
+        "caller-path": "0.1.0",
+        "resolve-from": "1.0.1"
+      }
+    },
+    "resolve": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz",
+      "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==",
+      "requires": {
+        "path-parse": "1.0.5"
+      }
+    },
+    "resolve-from": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz",
+      "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=",
+      "dev": true
+    },
+    "restore-cursor": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz",
+      "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=",
+      "dev": true,
+      "requires": {
+        "exit-hook": "1.1.1",
+        "onetime": "1.1.0"
+      }
+    },
+    "rimraf": {
+      "version": "2.6.1",
+      "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz",
+      "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=",
+      "dev": true,
+      "requires": {
+        "glob": "7.1.2"
+      }
+    },
+    "rollup": {
+      "version": "0.40.2",
+      "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.40.2.tgz",
+      "integrity": "sha1-tZyDdzMvgovjiYMZLzNp5QL55Es=",
+      "dev": true,
+      "requires": {
+        "source-map-support": "0.4.15"
+      }
+    },
+    "rollup-plugin-buble": {
+      "version": "0.15.0",
+      "resolved": "https://registry.npmjs.org/rollup-plugin-buble/-/rollup-plugin-buble-0.15.0.tgz",
+      "integrity": "sha1-g8PonH/SJmx5GPQbo5gDE1Gcf9A=",
+      "dev": true,
+      "requires": {
+        "buble": "0.15.2",
+        "rollup-pluginutils": "1.5.2"
+      },
+      "dependencies": {
+        "estree-walker": {
+          "version": "0.2.1",
+          "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.2.1.tgz",
+          "integrity": "sha1-va/oCVOD2EFNXcLs9MkXO225QS4=",
+          "dev": true
+        },
+        "rollup-pluginutils": {
+          "version": "1.5.2",
+          "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz",
+          "integrity": "sha1-HhVud4+UtyVb+hs9AXi+j1xVJAg=",
+          "dev": true,
+          "requires": {
+            "estree-walker": "0.2.1",
+            "minimatch": "3.0.4"
+          }
+        }
+      }
+    },
+    "rollup-plugin-node-resolve": {
+      "version": "2.1.1",
+      "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-2.1.1.tgz",
+      "integrity": "sha1-y7eDsNFbAnlNWJFTULLw2QK43cg=",
+      "dev": true,
+      "requires": {
+        "browser-resolve": "1.11.2",
+        "builtin-modules": "1.1.1",
+        "resolve": "1.4.0"
+      }
+    },
+    "rollup-pluginutils": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz",
+      "integrity": "sha1-fslbNXP2VDpGpkYb2afFRFJdD8A=",
+      "requires": {
+        "estree-walker": "0.3.1",
+        "micromatch": "2.3.11"
+      }
+    },
+    "rollup-watch": {
+      "version": "3.2.2",
+      "resolved": "https://registry.npmjs.org/rollup-watch/-/rollup-watch-3.2.2.tgz",
+      "integrity": "sha1-XldCMunvNtqRd/RpRtgIDLJnNUs=",
+      "dev": true,
+      "requires": {
+        "require-relative": "0.8.7"
+      }
+    },
+    "run-async": {
+      "version": "0.1.0",
+      "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz",
+      "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=",
+      "dev": true,
+      "requires": {
+        "once": "1.4.0"
+      }
+    },
+    "rx-lite": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz",
+      "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=",
+      "dev": true
+    },
+    "safe-buffer": {
+      "version": "5.1.1",
+      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
+      "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
+      "dev": true
+    },
+    "shelljs": {
+      "version": "0.7.8",
+      "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz",
+      "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=",
+      "dev": true,
+      "requires": {
+        "glob": "7.1.2",
+        "interpret": "1.0.3",
+        "rechoir": "0.6.2"
+      }
+    },
+    "slice-ansi": {
+      "version": "0.0.4",
+      "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz",
+      "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=",
+      "dev": true
+    },
+    "source-map": {
+      "version": "0.5.6",
+      "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz",
+      "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=",
+      "dev": true
+    },
+    "source-map-support": {
+      "version": "0.4.15",
+      "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz",
+      "integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=",
+      "dev": true,
+      "requires": {
+        "source-map": "0.5.6"
+      }
+    },
+    "sprintf-js": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+      "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+      "dev": true
+    },
+    "string_decoder": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
+      "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
+      "dev": true,
+      "requires": {
+        "safe-buffer": "5.1.1"
+      }
+    },
+    "string-width": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+      "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+      "dev": true,
+      "requires": {
+        "code-point-at": "1.1.0",
+        "is-fullwidth-code-point": "1.0.0",
+        "strip-ansi": "3.0.1"
+      }
+    },
+    "strip-ansi": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+      "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+      "dev": true,
+      "requires": {
+        "ansi-regex": "2.1.1"
+      }
+    },
+    "strip-bom": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+      "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
+      "dev": true
+    },
+    "strip-json-comments": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+      "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
+      "dev": true
+    },
+    "supports-color": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
+      "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
+      "dev": true
+    },
+    "table": {
+      "version": "3.8.3",
+      "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz",
+      "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=",
+      "dev": true,
+      "requires": {
+        "ajv": "4.11.8",
+        "ajv-keywords": "1.5.1",
+        "chalk": "1.1.3",
+        "lodash": "4.17.4",
+        "slice-ansi": "0.0.4",
+        "string-width": "2.1.1"
+      },
+      "dependencies": {
+        "ansi-regex": {
+          "version": "3.0.0",
+          "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
+          "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
+          "dev": true
+        },
+        "is-fullwidth-code-point": {
+          "version": "2.0.0",
+          "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+          "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+          "dev": true
+        },
+        "string-width": {
+          "version": "2.1.1",
+          "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
+          "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
+          "dev": true,
+          "requires": {
+            "is-fullwidth-code-point": "2.0.0",
+            "strip-ansi": "4.0.0"
+          }
+        },
+        "strip-ansi": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
+          "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
+          "dev": true,
+          "requires": {
+            "ansi-regex": "3.0.0"
+          }
+        }
+      }
+    },
+    "text-table": {
+      "version": "0.2.0",
+      "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
+      "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
+      "dev": true
+    },
+    "through": {
+      "version": "2.3.8",
+      "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
+      "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
+      "dev": true
+    },
+    "tryit": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz",
+      "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=",
+      "dev": true
+    },
+    "type-check": {
+      "version": "0.3.2",
+      "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
+      "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
+      "dev": true,
+      "requires": {
+        "prelude-ls": "1.1.2"
+      }
+    },
+    "typedarray": {
+      "version": "0.0.6",
+      "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
+      "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
+      "dev": true
+    },
+    "user-home": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz",
+      "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=",
+      "dev": true,
+      "requires": {
+        "os-homedir": "1.0.2"
+      }
+    },
+    "util-deprecate": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+      "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
+      "dev": true
+    },
+    "vlq": {
+      "version": "0.2.2",
+      "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.2.tgz",
+      "integrity": "sha1-4xbVJXtAuGu0PLjV/qXX9U1rDKE="
+    },
+    "wordwrap": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
+      "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
+      "dev": true
+    },
+    "wrappy": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+      "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+      "dev": true
+    },
+    "write": {
+      "version": "0.2.1",
+      "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz",
+      "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=",
+      "dev": true,
+      "requires": {
+        "mkdirp": "0.5.1"
+      }
+    },
+    "xtend": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
+      "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
+      "dev": true
+    }
+  }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..7e41651
--- /dev/null
+++ b/package.json
@@ -0,0 +1,47 @@
+{
+  "name": "rollup-plugin-commonjs",
+  "version": "8.1.0",
+  "description": "Convert CommonJS modules to ES2015",
+  "main": "dist/rollup-plugin-commonjs.cjs.js",
+  "module": "dist/rollup-plugin-commonjs.es.js",
+  "jsnext:main": "dist/rollup-plugin-commonjs.es.js",
+  "scripts": {
+    "test": "mocha",
+    "pretest": "npm run build",
+    "build": "rm -rf dist/* && rollup -c",
+    "dev": "rollup -c -w",
+    "lint": "eslint src/*.js test/*.js",
+    "prepublish": "npm run lint && npm test"
+  },
+  "files": [
+    "src",
+    "dist",
+    "README.md"
+  ],
+  "dependencies": {
+    "acorn": "^4.0.1",
+    "estree-walker": "^0.3.0",
+    "magic-string": "^0.19.0",
+    "resolve": "^1.1.7",
+    "rollup-pluginutils": "^2.0.1"
+  },
+  "devDependencies": {
+    "eslint": "^3.5.0",
+    "locate-character": "^2.0.0",
+    "mocha": "^3.0.2",
+    "require-relative": "^0.8.7",
+    "rollup": "^0.40.2",
+    "rollup-plugin-buble": "^0.15.0",
+    "rollup-plugin-node-resolve": "^2.0.0",
+    "rollup-watch": "^3.1.0",
+    "source-map": "^0.5.6",
+    "source-map-support": "^0.4.2"
+  },
+  "repository": "rollup/rollup-plugin-commonjs",
+  "author": "Rich Harris",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/rollup/rollup-plugin-commonjs/issues"
+  },
+  "homepage": "https://github.com/rollup/rollup-plugin-commonjs"
+}
diff --git a/rollup.config.js b/rollup.config.js
new file mode 100644
index 0000000..b457f61
--- /dev/null
+++ b/rollup.config.js
@@ -0,0 +1,26 @@
+import buble from 'rollup-plugin-buble';
+
+var pkg = require('./package.json');
+
+var external = Object.keys( require( './package.json' ).dependencies ).concat([ 'fs', 'path' ]);
+
+export default {
+	entry: 'src/index.js',
+	plugins: [
+		buble({
+			transforms: { dangerousForOf: true }
+		})
+	],
+	external: external,
+	sourceMap: true,
+	targets: [
+		{
+			format: 'es',
+			dest: pkg.module
+		},
+		{
+			format: 'cjs',
+			dest: pkg.main
+		}
+	]
+};
diff --git a/src/ast-utils.js b/src/ast-utils.js
new file mode 100644
index 0000000..0dda364
--- /dev/null
+++ b/src/ast-utils.js
@@ -0,0 +1,104 @@
+export function isReference ( node, parent ) {
+	if ( parent.type === 'MemberExpression' ) return parent.computed || node === parent.object;
+
+	// disregard the `bar` in { bar: foo }
+	if ( parent.type === 'Property' && node !== parent.value ) return false;
+
+	// disregard the `bar` in `class Foo { bar () {...} }`
+	if ( parent.type === 'MethodDefinition' ) return false;
+
+	// disregard the `bar` in `export { foo as bar }`
+	if ( parent.type === 'ExportSpecifier' && node !== parent.local ) return false;
+
+	return true;
+}
+
+export function flatten ( node ) {
+	const parts = [];
+
+	while ( node.type === 'MemberExpression' ) {
+		if ( node.computed ) return null;
+
+		parts.unshift( node.property.name );
+		node = node.object;
+	}
+
+	if ( node.type !== 'Identifier' ) return null;
+
+	const name = node.name;
+	parts.unshift( name );
+
+	return { name, keypath: parts.join( '.' ) };
+}
+
+export function extractNames ( node ) {
+	const names = [];
+	extractors[ node.type ]( names, node );
+	return names;
+}
+
+const extractors = {
+	Identifier ( names, node ) {
+		names.push( node.name );
+	},
+
+	ObjectPattern ( names, node ) {
+		node.properties.forEach( prop => {
+			extractors[ prop.value.type ]( names, prop.value );
+		});
+	},
+
+	ArrayPattern ( names, node ) {
+		node.elements.forEach( element => {
+			if ( element ) extractors[ element.type ]( names, element );
+		});
+	},
+
+	RestElement ( names, node ) {
+		extractors[ node.argument.type ]( names, node.argument );
+	},
+
+	AssignmentPattern ( names, node ) {
+		extractors[ node.left.type ]( names, node.left );
+	}
+};
+
+
+export function isTruthy ( node ) {
+	if ( node.type === 'Literal' ) return !!node.value;
+	if ( node.type === 'ParenthesizedExpression' ) return isTruthy( node.expression );
+	if ( node.operator in operators ) return operators[ node.operator ]( node );
+}
+
+export function isFalsy ( node ) {
+	return not( isTruthy( node ) );
+}
+
+function not ( value ) {
+	return value === undefined ? value : !value;
+}
+
+function equals ( a, b, strict ) {
+	if ( a.type !== b.type ) return undefined;
+	if ( a.type === 'Literal' ) return strict ? a.value === b.value : a.value == b.value;
+}
+
+const operators = {
+	'==': x => {
+		return equals( x.left, x.right, false );
+	},
+
+	'!=': x => not( operators['==']( x ) ),
+
+	'===': x => {
+		return equals( x.left, x.right, true );
+	},
+
+	'!==': x => not( operators['===']( x ) ),
+
+	'!': x => isFalsy( x.argument ),
+
+	'&&': x => isTruthy( x.left ) && isTruthy( x.right ),
+
+	'||': x => isTruthy( x.left ) || isTruthy( x.right )
+};
diff --git a/src/defaultResolver.js b/src/defaultResolver.js
new file mode 100644
index 0000000..45a282f
--- /dev/null
+++ b/src/defaultResolver.js
@@ -0,0 +1,39 @@
+import * as fs from 'fs';
+import { dirname, resolve } from 'path';
+
+function isFile ( file ) {
+	try {
+		const stats = fs.statSync( file );
+		return stats.isFile();
+	} catch ( err ) {
+		return false;
+	}
+}
+
+function addJsExtensionIfNecessary ( file ) {
+	if ( isFile( file ) ) return file;
+
+	file += '.js';
+	if ( isFile( file ) ) return file;
+
+	return null;
+}
+
+const absolutePath = /^(?:\/|(?:[A-Za-z]:)?[\\|\/])/;
+
+function isAbsolute ( path ) {
+	return absolutePath.test( path );
+}
+
+export default function defaultResolver ( importee, importer ) {
+	// absolute paths are left untouched
+	if ( isAbsolute( importee ) ) return addJsExtensionIfNecessary( resolve( importee ) );
+
+	// if this is the entry point, resolve against cwd
+	if ( importer === undefined ) return addJsExtensionIfNecessary( resolve( process.cwd(), importee ) );
+
+	// external modules are skipped at this stage
+	if ( importee[0] !== '.' ) return null;
+
+	return addJsExtensionIfNecessary( resolve( dirname( importer ), importee ) );
+}
diff --git a/src/helpers.js b/src/helpers.js
new file mode 100644
index 0000000..cb62211
--- /dev/null
+++ b/src/helpers.js
@@ -0,0 +1,19 @@
+export const HELPERS_ID = '\0commonjsHelpers';
+
+export const HELPERS = `
+export var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
+
+export function commonjsRequire () {
+	throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
+}
+
+export function unwrapExports (x) {
+	return x && x.__esModule ? x['default'] : x;
+}
+
+export function createCommonjsModule(fn, module) {
+	return module = { exports: {} }, fn(module, module.exports), module.exports;
+}`;
+
+export const PREFIX = '\0commonjs-proxy:';
+export const EXTERNAL = '\0commonjs-external:';
diff --git a/src/index.js b/src/index.js
new file mode 100644
index 0000000..6533ad9
--- /dev/null
+++ b/src/index.js
@@ -0,0 +1,176 @@
+import { statSync } from 'fs';
+import { dirname, extname, resolve, sep } from 'path';
+import { sync as nodeResolveSync } from 'resolve';
+import { createFilter } from 'rollup-pluginutils';
+import { EXTERNAL, PREFIX, HELPERS_ID, HELPERS } from './helpers.js';
+import defaultResolver from './defaultResolver.js';
+import transformCommonjs from './transform.js';
+import { getName } from './utils.js';
+
+function getCandidatesForExtension ( resolved, extension ) {
+	return [
+		resolved + extension,
+		resolved + `${sep}index${extension}`
+	];
+}
+
+function getCandidates ( resolved, extensions ) {
+	return extensions.reduce(
+		( paths, extension ) => paths.concat( getCandidatesForExtension ( resolved, extension ) ),
+		[resolved]
+	);
+}
+
+// Return the first non-falsy result from an array of
+// maybe-sync, maybe-promise-returning functions
+function first ( candidates ) {
+	return function ( ...args ) {
+		return candidates.reduce( ( promise, candidate ) => {
+			return promise.then( result => result != null ?
+				result :
+				Promise.resolve( candidate( ...args ) ) );
+		}, Promise.resolve() );
+	};
+}
+
+function startsWith ( str, prefix ) {
+	return str.slice( 0, prefix.length ) === prefix;
+}
+
+
+export default function commonjs ( options = {} ) {
+	const extensions = options.extensions || ['.js'];
+	const filter = createFilter( options.include, options.exclude );
+	const ignoreGlobal = options.ignoreGlobal;
+
+	const customNamedExports = {};
+	if ( options.namedExports ) {
+		Object.keys( options.namedExports ).forEach( id => {
+			let resolvedId;
+
+			try {
+				resolvedId = nodeResolveSync( id, { basedir: process.cwd() });
+			} catch ( err ) {
+				resolvedId = resolve( id );
+			}
+
+			customNamedExports[ resolvedId ] = options.namedExports[ id ];
+		});
+	}
+
+	const allowDynamicRequire = !!options.ignore; // TODO maybe this should be configurable?
+
+	const ignoreRequire = typeof options.ignore === 'function' ?
+		options.ignore :
+		Array.isArray( options.ignore ) ? id => ~options.ignore.indexOf( id ) :
+		() => false;
+
+	let entryModuleIdPromise = null;
+	let entryModuleId = null;
+
+	function resolveId ( importee, importer ) {
+		if ( importee === HELPERS_ID ) return importee;
+
+		if ( importer && startsWith( importer, PREFIX ) ) importer = importer.slice( PREFIX.length );
+
+		const isProxyModule = startsWith( importee, PREFIX );
+		if ( isProxyModule ) importee = importee.slice( PREFIX.length );
+
+		return resolveUsingOtherResolvers( importee, importer ).then( resolved => {
+			if ( resolved ) return isProxyModule ? PREFIX + resolved : resolved;
+
+			resolved = defaultResolver( importee, importer );
+
+			if ( isProxyModule ) {
+				if ( resolved ) return PREFIX + resolved;
+				return EXTERNAL + importee; // external
+			}
+
+			return resolved;
+		});
+	}
+
+	const sourceMap = options.sourceMap !== false;
+
+	const commonjsModules = new Map();
+	let resolveUsingOtherResolvers;
+
+	return {
+		name: 'commonjs',
+
+		options ( options ) {
+			const resolvers = ( options.plugins || [] )
+				.map( plugin => {
+					if ( plugin.resolveId === resolveId ) {
+						// substitute CommonJS resolution logic
+						return ( importee, importer ) => {
+							if ( importee[0] !== '.' || !importer ) return; // not our problem
+
+							const resolved = resolve( dirname( importer ), importee );
+							const candidates = getCandidates( resolved, extensions );
+
+							for ( let i = 0; i < candidates.length; i += 1 ) {
+								try {
+									const stats = statSync( candidates[i] );
+									if ( stats.isFile() ) return candidates[i];
+								} catch ( err ) { /* noop */ }
+							}
+						};
+					}
+
+					return plugin.resolveId;
+				})
+				.filter( Boolean );
+
+			const isExternal = options.external ?
+				Array.isArray( options.external ) ? id => ~options.external.indexOf( id ) :
+				options.external :
+				() => false;
+
+			resolvers.unshift( id => isExternal( id ) ? false : null );
+
+			resolveUsingOtherResolvers = first( resolvers );
+
+			entryModuleIdPromise = resolveId( options.entry ).then( resolved => {
+				entryModuleId = resolved;
+			});
+		},
+
+		resolveId,
+
+		load ( id ) {
+			if ( id === HELPERS_ID ) return HELPERS;
+
+			// generate proxy modules
+			if ( startsWith( id, EXTERNAL ) ) {
+				const actualId = id.slice( EXTERNAL.length );
+				const name = getName( actualId );
+
+				return `import ${name} from ${JSON.stringify( actualId )}; export default ${name};`;
+			}
+
+			if ( startsWith( id, PREFIX ) ) {
+				const actualId = id.slice( PREFIX.length );
+				const name = getName( actualId );
+
+				return commonjsModules.has( actualId ) ?
+					`import { __moduleExports } from ${JSON.stringify( actualId )}; export default __moduleExports;` :
+					`import * as ${name} from ${JSON.stringify( actualId )}; export default ( ${name} && ${name}['default'] ) || ${name};`;
+			}
+		},
+
+		transform ( code, id ) {
+			if ( !filter( id ) ) return null;
+			if ( extensions.indexOf( extname( id ) ) === -1 ) return null;
+
+			return entryModuleIdPromise.then( () => {
+				const transformed = transformCommonjs( code, id, id === entryModuleId, ignoreGlobal, ignoreRequire, customNamedExports[ id ], sourceMap, allowDynamicRequire );
+
+				if ( transformed ) {
+					commonjsModules.set( id, true );
+					return transformed;
+				}
+			});
+		}
+	};
+}
diff --git a/src/transform.js b/src/transform.js
new file mode 100644
index 0000000..76cccd3
--- /dev/null
+++ b/src/transform.js
@@ -0,0 +1,416 @@
+import acorn from 'acorn';
+import { walk } from 'estree-walker';
+import MagicString from 'magic-string';
+import { attachScopes, makeLegalIdentifier } from 'rollup-pluginutils';
+import { extractNames, flatten, isReference, isTruthy, isFalsy } from './ast-utils.js';
+import { PREFIX, HELPERS_ID } from './helpers.js';
+import { getName } from './utils.js';
+
+const reserved = 'abstract arguments boolean break byte case catch char class const continue debugger default delete do double else enum eval export extends false final finally float for function goto if implements import in instanceof int interface let long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with yield'.split( ' ' );
+const blacklist = { __esModule: true };
+reserved.forEach( word => blacklist[ word ] = true );
+
+const exportsPattern = /^(?:module\.)?exports(?:\.([a-zA-Z_$][a-zA-Z_$0-9]*))?$/;
+
+const firstpassGlobal = /\b(?:require|module|exports|global)\b/;
+const firstpassNoGlobal = /\b(?:require|module|exports)\b/;
+const importExportDeclaration = /^(?:Import|Export(?:Named|Default))Declaration/;
+
+function deconflict ( scope, globals, identifier ) {
+	let i = 1;
+	let deconflicted = identifier;
+
+	while ( scope.contains( deconflicted ) || globals.has( deconflicted ) || deconflicted in blacklist ) deconflicted = `${identifier}_${i++}`;
+	scope.declarations[ deconflicted ] = true;
+
+	return deconflicted;
+}
+
+function tryParse ( code, id ) {
+	try {
+		return acorn.parse( code, {
+			ecmaVersion: 8,
+			sourceType: 'module',
+			allowReturnOutsideFunction: true
+		});
+	} catch ( err ) {
+		err.message += ` in ${id}`;
+		throw err;
+	}
+}
+
+export default function transformCommonjs ( code, id, isEntry, ignoreGlobal, ignoreRequire, customNamedExports, sourceMap, allowDynamicRequire ) {
+	const firstpass = ignoreGlobal ? firstpassNoGlobal : firstpassGlobal;
+	if ( !firstpass.test( code ) ) return null;
+
+	const ast = tryParse( code, id );
+
+	// if there are top-level import/export declarations, this is ES not CommonJS
+	for ( const node of ast.body ) {
+		if ( importExportDeclaration.test( node.type ) ) return null;
+	}
+
+	const magicString = new MagicString( code );
+
+	const required = {};
+	// Because objects have no guaranteed ordering, yet we need it,
+	// we need to keep track of the order in a array
+	const sources = [];
+
+	let uid = 0;
+
+	let scope = attachScopes( ast, 'scope' );
+	const uses = { module: false, exports: false, global: false, require: false };
+
+	let lexicalDepth = 0;
+	let programDepth = 0;
+
+	const globals = new Set();
+
+	const HELPERS_NAME = deconflict( scope, globals, 'commonjsHelpers' ); // TODO technically wrong since globals isn't populated yet, but ¯\_(ツ)_/¯
+
+	const namedExports = {};
+
+	// TODO handle transpiled modules
+	let shouldWrap = /__esModule/.test( code );
+
+	function isRequireStatement ( node ) {
+		if ( !node ) return;
+		if ( node.type !== 'CallExpression' ) return;
+		if ( node.callee.name !== 'require' || scope.contains( 'require' ) ) return;
+		if ( node.arguments.length !== 1 || node.arguments[0].type !== 'Literal' ) return; // TODO handle these weird cases?
+		if ( ignoreRequire( node.arguments[0].value ) ) return;
+
+		return true;
+	}
+
+	function getRequired ( node, name ) {
+		const source = node.arguments[0].value;
+
+		const existing = required[ source ];
+		if ( existing === undefined ) {
+			sources.push( source );
+
+			if ( !name ) name = `require$$${uid++}`;
+			required[ source ] = { source, name, importsDefault: false };
+		}
+
+		return required[ source ];
+	}
+
+	// do a first pass, see which names are assigned to. This is necessary to prevent
+	// illegally replacing `var foo = require('foo')` with `import foo from 'foo'`,
+	// where `foo` is later reassigned. (This happens in the wild. CommonJS, sigh)
+	const assignedTo = new Set();
+	walk( ast, {
+		enter ( node ) {
+			if ( node.type !== 'AssignmentExpression' ) return;
+			if ( node.left.type === 'MemberExpression' ) return;
+
+			extractNames( node.left ).forEach( name => {
+				assignedTo.add( name );
+			});
+		}
+	});
+
+	walk( ast, {
+		enter ( node, parent ) {
+			if ( sourceMap ) {
+				magicString.addSourcemapLocation( node.start );
+				magicString.addSourcemapLocation( node.end );
+			}
+
+			// skip dead branches
+			if ( parent && ( parent.type === 'IfStatement' || parent.type === 'ConditionalExpression' ) ) {
+				if ( node === parent.consequent && isFalsy( parent.test ) ) return this.skip();
+				if ( node === parent.alternate && isTruthy( parent.test ) ) return this.skip();
+			}
+
+			if ( node._skip ) return this.skip();
+
+			programDepth += 1;
+
+			if ( node.scope ) scope = node.scope;
+			if ( /^Function/.test( node.type ) ) lexicalDepth += 1;
+
+			// if toplevel return, we need to wrap it
+			if ( node.type === 'ReturnStatement' && lexicalDepth === 0 ) {
+				shouldWrap = true;
+			}
+
+			// rewrite `this` as `commonjsHelpers.commonjsGlobal`
+			if ( node.type === 'ThisExpression' && lexicalDepth === 0 ) {
+				uses.global = true;
+				if ( !ignoreGlobal ) magicString.overwrite( node.start, node.end, `${HELPERS_NAME}.commonjsGlobal`, true );
+				return;
+			}
+
+			// rewrite `typeof module`, `typeof module.exports` and `typeof exports` (https://github.com/rollup/rollup-plugin-commonjs/issues/151)
+			if ( node.type === 'UnaryExpression' && node.operator === 'typeof' ) {
+				const flattened = flatten( node.argument );
+				if ( !flattened ) return;
+
+				if ( scope.contains( flattened.name ) ) return;
+
+				if ( flattened.keypath === 'module.exports' || flattened.keypath === 'module' || flattened.keypath === 'exports' ) {
+					magicString.overwrite( node.start, node.end, `'object'`, false );
+				}
+			}
+
+			// rewrite `require` (if not already handled) `global` and `define`, and handle free references to
+			// `module` and `exports` as these mean we need to wrap the module in commonjsHelpers.createCommonjsModule
+			if ( node.type === 'Identifier' ) {
+				if ( isReference( node, parent ) && !scope.contains( node.name ) ) {
+					if ( node.name in uses ) {
+						if ( node.name === 'require' ) {
+							if ( allowDynamicRequire ) return;
+							magicString.overwrite( node.start, node.end, `${HELPERS_NAME}.commonjsRequire`, true );
+						}
+
+						uses[ node.name ] = true;
+						if ( node.name === 'global' && !ignoreGlobal ) {
+							magicString.overwrite( node.start, node.end, `${HELPERS_NAME}.commonjsGlobal`, true );
+						}
+
+						// if module or exports are used outside the context of an assignment
+						// expression, we need to wrap the module
+						if ( node.name === 'module' || node.name === 'exports' ) {
+							shouldWrap = true;
+						}
+					}
+
+					if ( node.name === 'define' ) {
+						magicString.overwrite( node.start, node.end, 'undefined', true );
+					}
+
+					globals.add( node.name );
+				}
+
+				return;
+			}
+
+			// Is this an assignment to exports or module.exports?
+			if ( node.type === 'AssignmentExpression' ) {
+				if ( node.left.type !== 'MemberExpression' ) return;
+
+				const flattened = flatten( node.left );
+				if ( !flattened ) return;
+
+				if ( scope.contains( flattened.name ) ) return;
+
+				const match = exportsPattern.exec( flattened.keypath );
+				if ( !match || flattened.keypath === 'exports' ) return;
+
+				uses[ flattened.name ] = true;
+
+				// we're dealing with `module.exports = ...` or `[module.]exports.foo = ...` –
+				// if this isn't top-level, we'll need to wrap the module
+				if ( programDepth > 3 ) shouldWrap = true;
+
+				node.left._skip = true;
+
+				if ( flattened.keypath === 'module.exports' && node.right.type === 'ObjectExpression' ) {
+					return node.right.properties.forEach( prop => {
+						if ( prop.computed || prop.key.type !== 'Identifier' ) return;
+						const name = prop.key.name;
+						if ( name === makeLegalIdentifier( name ) ) namedExports[ name ] = true;
+					});
+				}
+
+				if ( match[1] ) namedExports[ match[1] ] = true;
+				return;
+			}
+
+			// if this is `var x = require('x')`, we can do `import x from 'x'`
+			if ( node.type === 'VariableDeclarator' && node.id.type === 'Identifier' && isRequireStatement( node.init ) ) {
+				// for now, only do this for top-level requires. maybe fix this in future
+				if ( scope.parent ) return;
+
+				// edge case — CJS allows you to assign to imports. ES doesn't
+				if ( assignedTo.has( node.id.name ) ) return;
+
+				const r = getRequired( node.init, node.id.name );
+				r.importsDefault = true;
+
+				if ( r.name === node.id.name ) {
+					node._shouldRemove = true;
+				}
+			}
+
+			if ( !isRequireStatement( node ) ) return;
+
+			const r = getRequired( node );
+
+			if ( parent.type === 'ExpressionStatement' ) {
+				// is a bare import, e.g. `require('foo');`
+				magicString.remove( parent.start, parent.end );
+			} else {
+				r.importsDefault = true;
+				magicString.overwrite( node.start, node.end, r.name );
+			}
+
+			node.callee._skip = true;
+		},
+
+		leave ( node ) {
+			programDepth -= 1;
+			if ( node.scope ) scope = scope.parent;
+			if ( /^Function/.test( node.type ) ) lexicalDepth -= 1;
+
+			if ( node.type === 'VariableDeclaration' ) {
+				let keepDeclaration = false;
+				let c = node.declarations[0].start;
+
+				for ( let i = 0; i < node.declarations.length; i += 1 ) {
+					const declarator = node.declarations[i];
+
+					if ( declarator._shouldRemove ) {
+						magicString.remove( c, declarator.end );
+					} else {
+						if ( !keepDeclaration ) {
+							magicString.remove( c, declarator.start );
+							keepDeclaration = true;
+						}
+
+						c = declarator.end;
+					}
+				}
+
+				if ( !keepDeclaration ) {
+					magicString.remove( node.start, node.end );
+				}
+			}
+		}
+	});
+
+	if ( !sources.length && !uses.module && !uses.exports && !uses.require && ( ignoreGlobal || !uses.global ) ) {
+		if ( Object.keys( namedExports ).length ) {
+			throw new Error( `Custom named exports were specified for ${id} but it does not appear to be a CommonJS module` );
+		}
+		return null; // not a CommonJS module
+	}
+
+	const includeHelpers = shouldWrap || uses.global || uses.require;
+	const importBlock = ( includeHelpers ? [ `import * as ${HELPERS_NAME} from '${HELPERS_ID}';` ] : [] ).concat(
+		sources.map( source => {
+			// import the actual module before the proxy, so that we know
+			// what kind of proxy to build
+			return `import '${source}';`;
+		}),
+		sources.map( source => {
+			const { name, importsDefault } = required[ source ];
+			return `import ${importsDefault ? `${name} from ` : ``}'${PREFIX}${source}';`;
+		})
+	).join( '\n' ) + '\n\n';
+
+	const namedExportDeclarations = [];
+	let wrapperStart = '';
+	let wrapperEnd = '';
+
+	const moduleName = deconflict( scope, globals, getName( id ) );
+	if ( !isEntry ) {
+		const exportModuleExports = {
+			str: `export { ${moduleName} as __moduleExports };`,
+			name: '__moduleExports'
+		};
+
+		namedExportDeclarations.push( exportModuleExports );
+	}
+
+	const name = getName( id );
+
+	function addExport ( x ) {
+		const deconflicted = deconflict( scope, globals, name );
+
+		const declaration = deconflicted === name ?
+			`export var ${x} = ${moduleName}.${x};` :
+			`var ${deconflicted} = ${moduleName}.${x};\nexport { ${deconflicted} as ${x} };`;
+
+		namedExportDeclarations.push({
+			str: declaration,
+			name: x
+		});
+	}
+
+	if ( customNamedExports ) customNamedExports.forEach( addExport );
+
+	const defaultExportPropertyAssignments = [];
+	let hasDefaultExport = false;
+
+	if ( shouldWrap ) {
+		const args = `module${uses.exports ? ', exports' : ''}`;
+
+		wrapperStart = `var ${moduleName} = ${HELPERS_NAME}.createCommonjsModule(function (${args}) {\n`;
+		wrapperEnd = `\n});`;
+
+		Object.keys( namedExports )
+			.filter( key => !blacklist[ key ] )
+			.forEach( addExport );
+	} else {
+		const names = [];
+
+		ast.body.forEach( node => {
+			if ( node.type === 'ExpressionStatement' && node.expression.type === 'AssignmentExpression' ) {
+				const left = node.expression.left;
+				const flattened = flatten( left );
+
+				if ( !flattened ) return;
+
+				const match = exportsPattern.exec( flattened.keypath );
+				if ( !match ) return;
+
+				if ( flattened.keypath === 'module.exports' ) {
+					hasDefaultExport = true;
+					magicString.overwrite( left.start, left.end, `var ${moduleName}` );
+				} else {
+					const name = match[1];
+					const deconflicted = deconflict( scope, globals, name );
+
+					names.push({ name, deconflicted });
+
+					magicString.overwrite( node.start, left.end, `var ${deconflicted}` );
+
+					const declaration = name === deconflicted ?
+						`export { ${name} };` :
+						`export { ${deconflicted} as ${name} };`;
+
+					namedExportDeclarations.push({
+						str: declaration,
+						name
+					});
+
+					defaultExportPropertyAssignments.push( `${moduleName}.${name} = ${deconflicted};` );
+				}
+			}
+		});
+
+		if ( !hasDefaultExport ) {
+			wrapperEnd = `\n\nvar ${moduleName} = {\n${
+				names.map( ({ name, deconflicted }) => `\t${name}: ${deconflicted}` ).join( ',\n' )
+			}\n};`;
+		}
+	}
+
+	const defaultExport = /__esModule/.test( code ) ?
+		`export default ${HELPERS_NAME}.unwrapExports(${moduleName});` :
+		`export default ${moduleName};`;
+
+	const named = namedExportDeclarations
+		.filter( x => x.name !== 'default' || !hasDefaultExport )
+		.map( x => x.str );
+
+	const exportBlock = '\n\n' + [ defaultExport ]
+		.concat( named )
+		.concat( hasDefaultExport ? defaultExportPropertyAssignments : [] )
+		.join( '\n' );
+
+	magicString.trim()
+		.prepend( importBlock + wrapperStart )
+		.trim()
+		.append( wrapperEnd + exportBlock );
+
+	code = magicString.toString();
+	const map = sourceMap ? magicString.generateMap() : null;
+
+	return { code, map };
+}
diff --git a/src/utils.js b/src/utils.js
new file mode 100644
index 0000000..a98362e
--- /dev/null
+++ b/src/utils.js
@@ -0,0 +1,7 @@
+import { basename, extname } from 'path';
+import { makeLegalIdentifier } from 'rollup-pluginutils';
+
+export function getName ( id ) {
+	return makeLegalIdentifier( basename( id, extname( id ) ) );
+}
+
diff --git a/test/form/async-function/input.js b/test/form/async-function/input.js
new file mode 100644
index 0000000..9f69c29
--- /dev/null
+++ b/test/form/async-function/input.js
@@ -0,0 +1,3 @@
+module.exports = async function () {
+	// TODO
+};
diff --git a/test/form/async-function/output.js b/test/form/async-function/output.js
new file mode 100644
index 0000000..b182c5b
--- /dev/null
+++ b/test/form/async-function/output.js
@@ -0,0 +1,6 @@
+var input = async function () {
+	// TODO
+};
+
+export default input;
+export { input as __moduleExports };
diff --git a/test/form/ignore-ids-function/_config.js b/test/form/ignore-ids-function/_config.js
new file mode 100644
index 0000000..4d386dd
--- /dev/null
+++ b/test/form/ignore-ids-function/_config.js
@@ -0,0 +1,5 @@
+module.exports = {
+	options: {
+		ignore: id => id === 'foo'
+	}
+};
\ No newline at end of file
diff --git a/test/form/ignore-ids-function/input.js b/test/form/ignore-ids-function/input.js
new file mode 100644
index 0000000..572fe11
--- /dev/null
+++ b/test/form/ignore-ids-function/input.js
@@ -0,0 +1,2 @@
+var foo = require( 'foo' );
+var bar = require( 'bar' );
\ No newline at end of file
diff --git a/test/form/ignore-ids-function/output.js b/test/form/ignore-ids-function/output.js
new file mode 100644
index 0000000..c270437
--- /dev/null
+++ b/test/form/ignore-ids-function/output.js
@@ -0,0 +1,11 @@
+import 'bar';
+import bar from 'commonjs-proxy:bar';
+
+var foo = require( 'foo' );
+
+var input = {
+
+};
+
+export default input;
+export { input as __moduleExports };
\ No newline at end of file
diff --git a/test/form/ignore-ids/_config.js b/test/form/ignore-ids/_config.js
new file mode 100644
index 0000000..a02caa2
--- /dev/null
+++ b/test/form/ignore-ids/_config.js
@@ -0,0 +1,5 @@
+module.exports = {
+	options: {
+		ignore: [ 'foo' ]
+	}
+};
\ No newline at end of file
diff --git a/test/form/ignore-ids/input.js b/test/form/ignore-ids/input.js
new file mode 100644
index 0000000..572fe11
--- /dev/null
+++ b/test/form/ignore-ids/input.js
@@ -0,0 +1,2 @@
+var foo = require( 'foo' );
+var bar = require( 'bar' );
\ No newline at end of file
diff --git a/test/form/ignore-ids/output.js b/test/form/ignore-ids/output.js
new file mode 100644
index 0000000..c270437
--- /dev/null
+++ b/test/form/ignore-ids/output.js
@@ -0,0 +1,11 @@
+import 'bar';
+import bar from 'commonjs-proxy:bar';
+
+var foo = require( 'foo' );
+
+var input = {
+
+};
+
+export default input;
+export { input as __moduleExports };
\ No newline at end of file
diff --git a/test/form/multiple-var-declarations-b/input.js b/test/form/multiple-var-declarations-b/input.js
new file mode 100644
index 0000000..c080007
--- /dev/null
+++ b/test/form/multiple-var-declarations-b/input.js
@@ -0,0 +1,4 @@
+var a = require('./a')
+  , b = 42;
+
+console.log( a, b );
\ No newline at end of file
diff --git a/test/form/multiple-var-declarations-b/output.js b/test/form/multiple-var-declarations-b/output.js
new file mode 100644
index 0000000..c2af7f4
--- /dev/null
+++ b/test/form/multiple-var-declarations-b/output.js
@@ -0,0 +1,13 @@
+import './a';
+import a from 'commonjs-proxy:./a';
+
+var b = 42;
+
+console.log( a, b );
+
+var input = {
+
+};
+
+export default input;
+export { input as __moduleExports };
\ No newline at end of file
diff --git a/test/form/multiple-var-declarations-c/input.js b/test/form/multiple-var-declarations-c/input.js
new file mode 100644
index 0000000..da506ce
--- /dev/null
+++ b/test/form/multiple-var-declarations-c/input.js
@@ -0,0 +1,5 @@
+var a = 'a'
+  , b = require( './b' )
+  , c = 'c';
+
+console.log( a, b, c );
\ No newline at end of file
diff --git a/test/form/multiple-var-declarations-c/output.js b/test/form/multiple-var-declarations-c/output.js
new file mode 100644
index 0000000..cd331c6
--- /dev/null
+++ b/test/form/multiple-var-declarations-c/output.js
@@ -0,0 +1,14 @@
+import './b';
+import b from 'commonjs-proxy:./b';
+
+var a = 'a'
+  , c = 'c';
+
+console.log( a, b, c );
+
+var input = {
+
+};
+
+export default input;
+export { input as __moduleExports };
\ No newline at end of file
diff --git a/test/form/multiple-var-declarations/input.js b/test/form/multiple-var-declarations/input.js
new file mode 100644
index 0000000..9a50394
--- /dev/null
+++ b/test/form/multiple-var-declarations/input.js
@@ -0,0 +1,4 @@
+var a = require('./a')()
+  , b = require('./b');
+
+console.log( a, b );
\ No newline at end of file
diff --git a/test/form/multiple-var-declarations/output.js b/test/form/multiple-var-declarations/output.js
new file mode 100644
index 0000000..38b3d13
--- /dev/null
+++ b/test/form/multiple-var-declarations/output.js
@@ -0,0 +1,15 @@
+import './a';
+import './b';
+import require$$0 from 'commonjs-proxy:./a';
+import b from 'commonjs-proxy:./b';
+
+var a = require$$0();
+
+console.log( a, b );
+
+var input = {
+
+};
+
+export default input;
+export { input as __moduleExports };
\ No newline at end of file
diff --git a/test/form/optimised-default-export-function-double-assign/input.js b/test/form/optimised-default-export-function-double-assign/input.js
new file mode 100644
index 0000000..e7b8880
--- /dev/null
+++ b/test/form/optimised-default-export-function-double-assign/input.js
@@ -0,0 +1,2 @@
+var bar;
+module.exports = bar = function foo () {};
diff --git a/test/form/optimised-default-export-function-double-assign/output.js b/test/form/optimised-default-export-function-double-assign/output.js
new file mode 100644
index 0000000..545a7cc
--- /dev/null
+++ b/test/form/optimised-default-export-function-double-assign/output.js
@@ -0,0 +1,5 @@
+var bar;
+var input = bar = function foo () {};
+
+export default input;
+export { input as __moduleExports };
diff --git a/test/form/optimised-default-export-function/input.js b/test/form/optimised-default-export-function/input.js
new file mode 100644
index 0000000..62c5888
--- /dev/null
+++ b/test/form/optimised-default-export-function/input.js
@@ -0,0 +1 @@
+module.exports = function foo () {};
diff --git a/test/form/optimised-default-export-function/output.js b/test/form/optimised-default-export-function/output.js
new file mode 100644
index 0000000..bfb9a41
--- /dev/null
+++ b/test/form/optimised-default-export-function/output.js
@@ -0,0 +1,4 @@
+var input = function foo () {};
+
+export default input;
+export { input as __moduleExports };
diff --git a/test/form/optimised-default-export-iife/input.js b/test/form/optimised-default-export-iife/input.js
new file mode 100644
index 0000000..40afc12
--- /dev/null
+++ b/test/form/optimised-default-export-iife/input.js
@@ -0,0 +1,3 @@
+module.exports = (function foo () {
+  return function fooChild() {};
+}());
diff --git a/test/form/optimised-default-export-iife/output.js b/test/form/optimised-default-export-iife/output.js
new file mode 100644
index 0000000..d10c33f
--- /dev/null
+++ b/test/form/optimised-default-export-iife/output.js
@@ -0,0 +1,6 @@
+var input = (function foo () {
+  return function fooChild() {};
+}());
+
+export default input;
+export { input as __moduleExports };
diff --git a/test/form/optimised-default-export/input.js b/test/form/optimised-default-export/input.js
new file mode 100644
index 0000000..888cae3
--- /dev/null
+++ b/test/form/optimised-default-export/input.js
@@ -0,0 +1 @@
+module.exports = 42;
diff --git a/test/form/optimised-default-export/output.js b/test/form/optimised-default-export/output.js
new file mode 100644
index 0000000..cb7be65
--- /dev/null
+++ b/test/form/optimised-default-export/output.js
@@ -0,0 +1,4 @@
+var input = 42;
+
+export default input;
+export { input as __moduleExports };
diff --git a/test/form/optimised-named-export-conflicts/input.js b/test/form/optimised-named-export-conflicts/input.js
new file mode 100644
index 0000000..9b2c489
--- /dev/null
+++ b/test/form/optimised-named-export-conflicts/input.js
@@ -0,0 +1,5 @@
+var foo = 1;
+var bar = 2;
+
+exports.foo = 'a';
+module.exports.bar = 'b';
diff --git a/test/form/optimised-named-export-conflicts/output.js b/test/form/optimised-named-export-conflicts/output.js
new file mode 100644
index 0000000..f72d8ad
--- /dev/null
+++ b/test/form/optimised-named-export-conflicts/output.js
@@ -0,0 +1,15 @@
+var foo = 1;
+var bar = 2;
+
+var foo_1 = 'a';
+var bar_1 = 'b';
+
+var input = {
+	foo: foo_1,
+	bar: bar_1
+};
+
+export default input;
+export { input as __moduleExports };
+export { foo_1 as foo };
+export { bar_1 as bar };
diff --git a/test/form/optimised-named-export/input.js b/test/form/optimised-named-export/input.js
new file mode 100644
index 0000000..d8b6b12
--- /dev/null
+++ b/test/form/optimised-named-export/input.js
@@ -0,0 +1,2 @@
+exports.foo = 'a';
+module.exports.bar = 'b';
diff --git a/test/form/optimised-named-export/output.js b/test/form/optimised-named-export/output.js
new file mode 100644
index 0000000..32cb2fc
--- /dev/null
+++ b/test/form/optimised-named-export/output.js
@@ -0,0 +1,12 @@
+var foo = 'a';
+var bar = 'b';
+
+var input = {
+	foo: foo,
+	bar: bar
+};
+
+export default input;
+export { input as __moduleExports };
+export { foo };
+export { bar };
diff --git a/test/form/typeof-module-exports/input.js b/test/form/typeof-module-exports/input.js
new file mode 100644
index 0000000..4f5fcff
--- /dev/null
+++ b/test/form/typeof-module-exports/input.js
@@ -0,0 +1,9 @@
+var foo = 42;
+
+if ( typeof exports === 'object' && typeof module === 'object' ) {
+	module.exports = foo;
+} else if ( typeof define === 'function' && define.amd ) {
+	define([], function () { return foo; });
+} else {
+	window.foo = foo;
+}
diff --git a/test/form/typeof-module-exports/output.js b/test/form/typeof-module-exports/output.js
new file mode 100644
index 0000000..a589da1
--- /dev/null
+++ b/test/form/typeof-module-exports/output.js
@@ -0,0 +1,16 @@
+import * as commonjsHelpers from 'commonjsHelpers';
+
+var input = commonjsHelpers.createCommonjsModule(function (module, exports) {
+var foo = 42;
+
+if ( 'object' === 'object' && 'object' === 'object' ) {
+	module.exports = foo;
+} else if ( typeof undefined === 'function' && undefined.amd ) {
+	undefined([], function () { return foo; });
+} else {
+	window.foo = foo;
+}
+});
+
+export default input;
+export { input as __moduleExports };
diff --git a/test/form/unambiguous-with-default-export/input.js b/test/form/unambiguous-with-default-export/input.js
new file mode 100644
index 0000000..3d5f6da
--- /dev/null
+++ b/test/form/unambiguous-with-default-export/input.js
@@ -0,0 +1,3 @@
+require( './foo.js' );
+
+export default {};
diff --git a/test/form/unambiguous-with-default-export/output.js b/test/form/unambiguous-with-default-export/output.js
new file mode 100644
index 0000000..3d5f6da
--- /dev/null
+++ b/test/form/unambiguous-with-default-export/output.js
@@ -0,0 +1,3 @@
+require( './foo.js' );
+
+export default {};
diff --git a/test/form/unambiguous-with-import/input.js b/test/form/unambiguous-with-import/input.js
new file mode 100644
index 0000000..324f256
--- /dev/null
+++ b/test/form/unambiguous-with-import/input.js
@@ -0,0 +1,3 @@
+require( './foo.js' );
+
+import './bar.js';
diff --git a/test/form/unambiguous-with-import/output.js b/test/form/unambiguous-with-import/output.js
new file mode 100644
index 0000000..324f256
--- /dev/null
+++ b/test/form/unambiguous-with-import/output.js
@@ -0,0 +1,3 @@
+require( './foo.js' );
+
+import './bar.js';
diff --git a/test/form/unambiguous-with-named-export/input.js b/test/form/unambiguous-with-named-export/input.js
new file mode 100644
index 0000000..64af252
--- /dev/null
+++ b/test/form/unambiguous-with-named-export/input.js
@@ -0,0 +1,3 @@
+require( './foo.js' );
+
+export {};
diff --git a/test/form/unambiguous-with-named-export/output.js b/test/form/unambiguous-with-named-export/output.js
new file mode 100644
index 0000000..64af252
--- /dev/null
+++ b/test/form/unambiguous-with-named-export/output.js
@@ -0,0 +1,3 @@
+require( './foo.js' );
+
+export {};
diff --git a/test/function/__esModule/answer.js b/test/function/__esModule/answer.js
new file mode 100644
index 0000000..135547a
--- /dev/null
+++ b/test/function/__esModule/answer.js
@@ -0,0 +1,2 @@
+exports.__esModule = true;
+exports.answer = 42;
diff --git a/test/function/__esModule/main.js b/test/function/__esModule/main.js
new file mode 100644
index 0000000..aad08ea
--- /dev/null
+++ b/test/function/__esModule/main.js
@@ -0,0 +1,5 @@
+import * as x from './answer';
+
+assert.ok( 'answer' in x );
+assert.ok( 'default' in x ); // TODO is this right?
+assert.ok( !( '__esModule' in x ) );
diff --git a/test/function/assign-properties-to-default-export/foo.js b/test/function/assign-properties-to-default-export/foo.js
new file mode 100644
index 0000000..b6969d3
--- /dev/null
+++ b/test/function/assign-properties-to-default-export/foo.js
@@ -0,0 +1,5 @@
+var foo = {};
+
+module.exports = foo;
+module.exports.bar = 1;
+exports.baz = 2;
diff --git a/test/function/assign-properties-to-default-export/main.js b/test/function/assign-properties-to-default-export/main.js
new file mode 100644
index 0000000..1698058
--- /dev/null
+++ b/test/function/assign-properties-to-default-export/main.js
@@ -0,0 +1,4 @@
+import foo from './foo.js';
+
+assert.equal( foo.bar, 1 );
+assert.equal( foo.baz, 2 );
diff --git a/test/function/assumed-globals/_config.js b/test/function/assumed-globals/_config.js
new file mode 100644
index 0000000..3e923d6
--- /dev/null
+++ b/test/function/assumed-globals/_config.js
@@ -0,0 +1,5 @@
+module.exports = {
+	context: {
+		document: { real: true }
+	}
+};
diff --git a/test/function/assumed-globals/document.js b/test/function/assumed-globals/document.js
new file mode 100644
index 0000000..6f694ec
--- /dev/null
+++ b/test/function/assumed-globals/document.js
@@ -0,0 +1,5 @@
+if ( typeof document !== 'undefined' ) {
+	module.exports = document;
+} else {
+	module.exports = { fake: true };
+}
diff --git a/test/function/assumed-globals/main.js b/test/function/assumed-globals/main.js
new file mode 100644
index 0000000..18dfb9c
--- /dev/null
+++ b/test/function/assumed-globals/main.js
@@ -0,0 +1,3 @@
+import document from './document.js';
+
+assert.deepEqual( document, { real: true });
diff --git a/test/function/bare-import/bar.js b/test/function/bare-import/bar.js
new file mode 100644
index 0000000..39ebcb9
--- /dev/null
+++ b/test/function/bare-import/bar.js
@@ -0,0 +1 @@
+Math.bar = 42;
diff --git a/test/function/bare-import/foo.js b/test/function/bare-import/foo.js
new file mode 100644
index 0000000..8578323
--- /dev/null
+++ b/test/function/bare-import/foo.js
@@ -0,0 +1 @@
+require( './bar.js' );
diff --git a/test/function/bare-import/main.js b/test/function/bare-import/main.js
new file mode 100644
index 0000000..07d5ba7
--- /dev/null
+++ b/test/function/bare-import/main.js
@@ -0,0 +1,3 @@
+import './foo.js';
+
+assert.equal( Math.bar, 42 );
diff --git a/test/function/basic/_config.js b/test/function/basic/_config.js
new file mode 100644
index 0000000..1f626eb
--- /dev/null
+++ b/test/function/basic/_config.js
@@ -0,0 +1,7 @@
+const assert = require( 'assert' );
+
+module.exports = {
+	exports: exports => {
+		assert.equal( exports, 42 );
+	}
+};
diff --git a/test/function/basic/foo.js b/test/function/basic/foo.js
new file mode 100644
index 0000000..ce0fffb
--- /dev/null
+++ b/test/function/basic/foo.js
@@ -0,0 +1 @@
+module.exports = 21;
diff --git a/test/function/basic/main.js b/test/function/basic/main.js
new file mode 100644
index 0000000..7a8aa33
--- /dev/null
+++ b/test/function/basic/main.js
@@ -0,0 +1,2 @@
+var foo = require( './foo' );
+module.exports = foo * 2;
diff --git a/test/function/deconflict-export-and-local/index.js b/test/function/deconflict-export-and-local/index.js
new file mode 100644
index 0000000..40173b3
--- /dev/null
+++ b/test/function/deconflict-export-and-local/index.js
@@ -0,0 +1,3 @@
+var someValueModule = require('./someValue');
+
+exports.someValue = someValueModule.someValue;
diff --git a/test/function/deconflict-export-and-local/main.js b/test/function/deconflict-export-and-local/main.js
new file mode 100644
index 0000000..0166244
--- /dev/null
+++ b/test/function/deconflict-export-and-local/main.js
@@ -0,0 +1,3 @@
+import { someValue } from './index.js';
+
+assert.equal( someValue, 10 );
diff --git a/test/function/deconflict-export-and-local/someValue.js b/test/function/deconflict-export-and-local/someValue.js
new file mode 100644
index 0000000..5761290
--- /dev/null
+++ b/test/function/deconflict-export-and-local/someValue.js
@@ -0,0 +1 @@
+exports.someValue = 10;
diff --git a/test/function/dot/foo.bar.js b/test/function/dot/foo.bar.js
new file mode 100644
index 0000000..40f6658
--- /dev/null
+++ b/test/function/dot/foo.bar.js
@@ -0,0 +1 @@
+module.exports = 'fubar';
diff --git a/test/function/dot/main.js b/test/function/dot/main.js
new file mode 100644
index 0000000..2a6284a
--- /dev/null
+++ b/test/function/dot/main.js
@@ -0,0 +1,3 @@
+var status = require( './foo.bar' );
+
+assert.equal( status, 'fubar' );
diff --git a/test/function/duplicate-default-exports-b/main.js b/test/function/duplicate-default-exports-b/main.js
new file mode 100644
index 0000000..69bd01f
--- /dev/null
+++ b/test/function/duplicate-default-exports-b/main.js
@@ -0,0 +1,3 @@
+import x from './x';
+
+assert.deepEqual( x, { default: 42 });
\ No newline at end of file
diff --git a/test/function/duplicate-default-exports-b/x.js b/test/function/duplicate-default-exports-b/x.js
new file mode 100644
index 0000000..e48696f
--- /dev/null
+++ b/test/function/duplicate-default-exports-b/x.js
@@ -0,0 +1,4 @@
+var x = {};
+
+module.exports = x;
+module.exports.default = 42;
\ No newline at end of file
diff --git a/test/function/duplicate-default-exports/main.js b/test/function/duplicate-default-exports/main.js
new file mode 100644
index 0000000..389d125
--- /dev/null
+++ b/test/function/duplicate-default-exports/main.js
@@ -0,0 +1,3 @@
+import x from './x';
+
+assert.strictEqual( x.default, x );
\ No newline at end of file
diff --git a/test/function/duplicate-default-exports/x.js b/test/function/duplicate-default-exports/x.js
new file mode 100644
index 0000000..ff6c6fb
--- /dev/null
+++ b/test/function/duplicate-default-exports/x.js
@@ -0,0 +1,4 @@
+var x = {};
+
+module.exports = x;
+module.exports.default = x;
\ No newline at end of file
diff --git a/test/function/dynamic-require-fails/main.js b/test/function/dynamic-require-fails/main.js
new file mode 100644
index 0000000..cde2014
--- /dev/null
+++ b/test/function/dynamic-require-fails/main.js
@@ -0,0 +1,10 @@
+let message;
+
+try {
+	const req = require;
+	req( 'nope' );
+} catch ( err ) {
+	message = err.message;
+}
+
+assert.equal( message, 'Dynamic requires are not currently supported by rollup-plugin-commonjs' );
diff --git a/test/function/exports/_config.js b/test/function/exports/_config.js
new file mode 100644
index 0000000..5e76ac3
--- /dev/null
+++ b/test/function/exports/_config.js
@@ -0,0 +1,7 @@
+const assert = require( 'assert' );
+
+module.exports = {
+	exports: exports => {
+		assert.equal( exports, 'BARBAZ' );
+	}
+};
diff --git a/test/function/exports/foo.js b/test/function/exports/foo.js
new file mode 100644
index 0000000..4d6e59c
--- /dev/null
+++ b/test/function/exports/foo.js
@@ -0,0 +1,2 @@
+exports.bar = 'BAR';
+exports.baz = 'BAZ';
diff --git a/test/function/exports/main.js b/test/function/exports/main.js
new file mode 100644
index 0000000..4e3118f
--- /dev/null
+++ b/test/function/exports/main.js
@@ -0,0 +1,4 @@
+var bar = require( './foo' ).bar;
+var baz = require( './foo' ).baz;
+
+module.exports = bar + baz;
diff --git a/test/function/external-imports/_config.js b/test/function/external-imports/_config.js
new file mode 100644
index 0000000..bbee7d0
--- /dev/null
+++ b/test/function/external-imports/_config.js
@@ -0,0 +1,10 @@
+const assert = require( 'assert' );
+
+module.exports = {
+	options: {
+		external: [ 'foo' ]
+	},
+	exports: exports => {
+		assert.equal( exports, 'foo' );
+	}
+};
diff --git a/test/function/external-imports/main.js b/test/function/external-imports/main.js
new file mode 100644
index 0000000..2a3c671
--- /dev/null
+++ b/test/function/external-imports/main.js
@@ -0,0 +1,3 @@
+var foo = require( 'foo' );
+
+module.exports = foo;
diff --git a/test/function/fallback-no-default/foo.js b/test/function/fallback-no-default/foo.js
new file mode 100644
index 0000000..3c88523
--- /dev/null
+++ b/test/function/fallback-no-default/foo.js
@@ -0,0 +1,3 @@
+export var one = 1;
+
+export var two = 2;
diff --git a/test/function/fallback-no-default/main.js b/test/function/fallback-no-default/main.js
new file mode 100644
index 0000000..5eaa86b
--- /dev/null
+++ b/test/function/fallback-no-default/main.js
@@ -0,0 +1,4 @@
+var foo = require('./foo.js');
+
+assert.equal( foo.one, 1 );
+assert.equal( foo.two, 2 );
diff --git a/test/function/global-not-overwritten/_config.js b/test/function/global-not-overwritten/_config.js
new file mode 100644
index 0000000..05532d6
--- /dev/null
+++ b/test/function/global-not-overwritten/_config.js
@@ -0,0 +1,7 @@
+const assert = require( 'assert' );
+
+module.exports = {
+	exports: function ( exports ) {
+		assert.equal( exports.encoded, encodeURIComponent( 'test string' ) );
+	}
+};
diff --git a/test/function/global-not-overwritten/encode.js b/test/function/global-not-overwritten/encode.js
new file mode 100644
index 0000000..adf6a73
--- /dev/null
+++ b/test/function/global-not-overwritten/encode.js
@@ -0,0 +1,5 @@
+exports.encodeURIComponent = function () {
+	return encodeURIComponent( this.str );
+};
+
+global.foo = exports; // to ensure module is wrapped
diff --git a/test/function/global-not-overwritten/main.js b/test/function/global-not-overwritten/main.js
new file mode 100644
index 0000000..523e69e
--- /dev/null
+++ b/test/function/global-not-overwritten/main.js
@@ -0,0 +1,8 @@
+import { encodeURIComponent } from './encode.js';
+
+var foo = {
+	str: 'test string',
+	encodeURIComponent
+};
+
+export var encoded = foo.encodeURIComponent();
diff --git a/test/function/global-var/main.js b/test/function/global-var/main.js
new file mode 100644
index 0000000..a6ed0a3
--- /dev/null
+++ b/test/function/global-var/main.js
@@ -0,0 +1,11 @@
+function foo () {
+	var a = 1, global = {};
+	global.modified = true;
+	return global;
+}
+
+var notGlobal = foo();
+assert.ok( notGlobal.modified );
+assert.ok( !global.modified );
+
+module.exports = {};
diff --git a/test/function/index/foo/index.js b/test/function/index/foo/index.js
new file mode 100644
index 0000000..888cae3
--- /dev/null
+++ b/test/function/index/foo/index.js
@@ -0,0 +1 @@
+module.exports = 42;
diff --git a/test/function/index/main.js b/test/function/index/main.js
new file mode 100644
index 0000000..bd41a4b
--- /dev/null
+++ b/test/function/index/main.js
@@ -0,0 +1,3 @@
+var foo = require( './foo' );
+
+assert.equal( foo, 42 );
diff --git a/test/function/inline/_config.js b/test/function/inline/_config.js
new file mode 100644
index 0000000..da8aabe
--- /dev/null
+++ b/test/function/inline/_config.js
@@ -0,0 +1,7 @@
+const assert = require( 'assert' );
+
+module.exports = {
+	exports: exports => {
+		assert.equal( exports(), 2 );
+	}
+};
diff --git a/test/function/inline/foo.js b/test/function/inline/foo.js
new file mode 100644
index 0000000..bd816ea
--- /dev/null
+++ b/test/function/inline/foo.js
@@ -0,0 +1 @@
+module.exports = 1;
diff --git a/test/function/inline/main.js b/test/function/inline/main.js
new file mode 100644
index 0000000..2d55090
--- /dev/null
+++ b/test/function/inline/main.js
@@ -0,0 +1,3 @@
+module.exports = function () {
+	return require( './multiply' )( 2, require( './foo' ) );
+};
diff --git a/test/function/inline/multiply.js b/test/function/inline/multiply.js
new file mode 100644
index 0000000..e3ee2fe
--- /dev/null
+++ b/test/function/inline/multiply.js
@@ -0,0 +1,3 @@
+module.exports = function ( a, b ) {
+	return a * b;
+};
diff --git a/test/function/named-exports/foo.js b/test/function/named-exports/foo.js
new file mode 100644
index 0000000..7aabdbd
--- /dev/null
+++ b/test/function/named-exports/foo.js
@@ -0,0 +1,2 @@
+exports.a = 1;
+module.exports.b = 2;
diff --git a/test/function/named-exports/main.js b/test/function/named-exports/main.js
new file mode 100644
index 0000000..c609505
--- /dev/null
+++ b/test/function/named-exports/main.js
@@ -0,0 +1,4 @@
+import { a, b } from './foo.js';
+
+assert.equal( a, 1 );
+assert.equal( b, 2 );
diff --git a/test/function/ordering/bar.js b/test/function/ordering/bar.js
new file mode 100644
index 0000000..b1ab9e8
--- /dev/null
+++ b/test/function/ordering/bar.js
@@ -0,0 +1,3 @@
+var shared = require('./shared');
+
+module.exports = shared.fooLoaded
diff --git a/test/function/ordering/foo.js b/test/function/ordering/foo.js
new file mode 100644
index 0000000..8d276ad
--- /dev/null
+++ b/test/function/ordering/foo.js
@@ -0,0 +1,4 @@
+var shared = require('./shared');
+
+// Mutate the shared module
+shared.fooLoaded = true;
diff --git a/test/function/ordering/main.js b/test/function/ordering/main.js
new file mode 100644
index 0000000..020d915
--- /dev/null
+++ b/test/function/ordering/main.js
@@ -0,0 +1,5 @@
+require('./foo');
+
+var fooLoaded = require('./bar');
+
+assert.ok( fooLoaded );
diff --git a/test/function/ordering/shared.js b/test/function/ordering/shared.js
new file mode 100644
index 0000000..51ed67b
--- /dev/null
+++ b/test/function/ordering/shared.js
@@ -0,0 +1,3 @@
+module.exports = {
+	fooLoaded: false
+};
diff --git a/test/function/react-apollo/commonjs-bar.js b/test/function/react-apollo/commonjs-bar.js
new file mode 100644
index 0000000..d371ae5
--- /dev/null
+++ b/test/function/react-apollo/commonjs-bar.js
@@ -0,0 +1,6 @@
+function Bar () {
+	this.x = 42;
+}
+
+exports.__esModule = true;
+exports.default = Bar;
diff --git a/test/function/react-apollo/commonjs-foo.js b/test/function/react-apollo/commonjs-foo.js
new file mode 100644
index 0000000..ea021a0
--- /dev/null
+++ b/test/function/react-apollo/commonjs-foo.js
@@ -0,0 +1,4 @@
+var Bar = require( './commonjs-bar' );
+
+exports.__esModule = true;
+exports.Bar = Bar.default;
diff --git a/test/function/react-apollo/main.js b/test/function/react-apollo/main.js
new file mode 100644
index 0000000..b3979e6
--- /dev/null
+++ b/test/function/react-apollo/main.js
@@ -0,0 +1,3 @@
+import { Bar } from './commonjs-foo.js';
+
+assert.equal( new Bar().x, 42 );
diff --git a/test/function/reassignment/foo.js b/test/function/reassignment/foo.js
new file mode 100644
index 0000000..8a43725
--- /dev/null
+++ b/test/function/reassignment/foo.js
@@ -0,0 +1,4 @@
+function foo () {}
+foo.something = false;
+
+module.exports = foo;
diff --git a/test/function/reassignment/main.js b/test/function/reassignment/main.js
new file mode 100644
index 0000000..eaf88c1
--- /dev/null
+++ b/test/function/reassignment/main.js
@@ -0,0 +1,8 @@
+var foo = require( './foo.js' );
+
+if ( !foo.something ) {
+	foo = function somethingElse () {}
+	foo.something = true;
+}
+
+assert.ok( foo.something );
diff --git a/test/function/reexports/_config.js b/test/function/reexports/_config.js
new file mode 100644
index 0000000..64301d6
--- /dev/null
+++ b/test/function/reexports/_config.js
@@ -0,0 +1,9 @@
+const path = require( 'path' );
+
+module.exports = {
+	pluginOptions: {
+		namedExports: {
+			[ path.resolve( __dirname, 'foo.js' ) ]: [ 'named' ]
+		}
+	}
+};
diff --git a/test/function/reexports/bar.js b/test/function/reexports/bar.js
new file mode 100644
index 0000000..cbf3e94
--- /dev/null
+++ b/test/function/reexports/bar.js
@@ -0,0 +1 @@
+exports.named = 42;
diff --git a/test/function/reexports/foo.js b/test/function/reexports/foo.js
new file mode 100644
index 0000000..5cc5445
--- /dev/null
+++ b/test/function/reexports/foo.js
@@ -0,0 +1 @@
+module.exports = require( './bar.js' );
diff --git a/test/function/reexports/main.js b/test/function/reexports/main.js
new file mode 100644
index 0000000..5805d48
--- /dev/null
+++ b/test/function/reexports/main.js
@@ -0,0 +1,3 @@
+import { named } from './foo.js';
+
+assert.equal( named, 42 );
diff --git a/test/function/shadowing/main.js b/test/function/shadowing/main.js
new file mode 100644
index 0000000..aab4e01
--- /dev/null
+++ b/test/function/shadowing/main.js
@@ -0,0 +1,11 @@
+function foo ( require ) {
+	require( 'not-an-actual-require-statement' );
+}
+
+var result;
+
+foo( function ( msg ) {
+	result = msg;
+});
+
+assert.equal( result, 'not-an-actual-require-statement' );
diff --git a/test/function/skips-dead-branches/_config.js b/test/function/skips-dead-branches/_config.js
new file mode 100644
index 0000000..8be3f58
--- /dev/null
+++ b/test/function/skips-dead-branches/_config.js
@@ -0,0 +1,9 @@
+const assert = require( 'assert' );
+
+module.exports = {
+	global: global => {
+		assert.equal( global.a, undefined );
+		assert.equal( global.b, 2 );
+		assert.equal( global.c, undefined );
+	}
+};
diff --git a/test/function/skips-dead-branches/a.js b/test/function/skips-dead-branches/a.js
new file mode 100644
index 0000000..9830a83
--- /dev/null
+++ b/test/function/skips-dead-branches/a.js
@@ -0,0 +1 @@
+global.a = 1;
diff --git a/test/function/skips-dead-branches/b.js b/test/function/skips-dead-branches/b.js
new file mode 100644
index 0000000..89d532d
--- /dev/null
+++ b/test/function/skips-dead-branches/b.js
@@ -0,0 +1,2 @@
+global.b = 2;
+module.exports = 'b';
diff --git a/test/function/skips-dead-branches/c.js b/test/function/skips-dead-branches/c.js
new file mode 100644
index 0000000..5574ed4
--- /dev/null
+++ b/test/function/skips-dead-branches/c.js
@@ -0,0 +1,2 @@
+global.c = 3;
+module.exports = 'c';
diff --git a/test/function/skips-dead-branches/main.js b/test/function/skips-dead-branches/main.js
new file mode 100644
index 0000000..2ca3826
--- /dev/null
+++ b/test/function/skips-dead-branches/main.js
@@ -0,0 +1,7 @@
+if ( 'development' === 'production' ) {
+	require( './a.js' );
+}
+
+module.exports = true ?
+	require( './b.js' ) :
+	require( './c.js' );
diff --git a/test/function/this/foo.js b/test/function/this/foo.js
new file mode 100644
index 0000000..4c05b90
--- /dev/null
+++ b/test/function/this/foo.js
@@ -0,0 +1,5 @@
+module.exports = function augmentThis () {
+	this.x = 'x';
+};
+
+this.y = 'y';
diff --git a/test/function/this/main.js b/test/function/this/main.js
new file mode 100644
index 0000000..672a8ba
--- /dev/null
+++ b/test/function/this/main.js
@@ -0,0 +1,7 @@
+var foo = require( './foo' );
+
+var obj = {};
+foo.call( obj );
+
+assert.equal( obj.x, 'x' );
+assert.equal( this.y, 'y' );
diff --git a/test/function/toplevel-return-complex/_config.js b/test/function/toplevel-return-complex/_config.js
new file mode 100644
index 0000000..6b39af4
--- /dev/null
+++ b/test/function/toplevel-return-complex/_config.js
@@ -0,0 +1,7 @@
+const assert = require( 'assert' );
+
+module.exports = {
+	exports:  exports => {
+		assert.equal( exports, 'bar' );
+	}
+};
diff --git a/test/function/toplevel-return-complex/bar.js b/test/function/toplevel-return-complex/bar.js
new file mode 100644
index 0000000..9d12d7d
--- /dev/null
+++ b/test/function/toplevel-return-complex/bar.js
@@ -0,0 +1,3 @@
+module.exports = function () {
+  return true;
+};
diff --git a/test/function/toplevel-return-complex/foo.js b/test/function/toplevel-return-complex/foo.js
new file mode 100644
index 0000000..6342604
--- /dev/null
+++ b/test/function/toplevel-return-complex/foo.js
@@ -0,0 +1,6 @@
+var bar = require('./bar');
+module.exports = 'bar';
+if (bar()) {
+  return;
+}
+module.exports = 'foo';
diff --git a/test/function/toplevel-return-complex/main.js b/test/function/toplevel-return-complex/main.js
new file mode 100644
index 0000000..4da43ff
--- /dev/null
+++ b/test/function/toplevel-return-complex/main.js
@@ -0,0 +1,3 @@
+var foo = require('./foo');
+
+module.exports = foo;
diff --git a/test/function/toplevel-return/_config.js b/test/function/toplevel-return/_config.js
new file mode 100644
index 0000000..d310c8b
--- /dev/null
+++ b/test/function/toplevel-return/_config.js
@@ -0,0 +1,7 @@
+const assert = require( 'assert' );
+
+module.exports = {
+	exports: exports => {
+		assert.equal( exports, 'foo' );
+	}
+};
diff --git a/test/function/toplevel-return/foo.js b/test/function/toplevel-return/foo.js
new file mode 100644
index 0000000..6acdc8f
--- /dev/null
+++ b/test/function/toplevel-return/foo.js
@@ -0,0 +1,2 @@
+module.exports = 'foo';
+return;
diff --git a/test/function/toplevel-return/main.js b/test/function/toplevel-return/main.js
new file mode 100644
index 0000000..56509b3
--- /dev/null
+++ b/test/function/toplevel-return/main.js
@@ -0,0 +1,3 @@
+var foo = require('./foo');
+
+module.exports = 'foo';
diff --git a/test/function/trailing-slash/foo/index.js b/test/function/trailing-slash/foo/index.js
new file mode 100644
index 0000000..888cae3
--- /dev/null
+++ b/test/function/trailing-slash/foo/index.js
@@ -0,0 +1 @@
+module.exports = 42;
diff --git a/test/function/trailing-slash/main.js b/test/function/trailing-slash/main.js
new file mode 100644
index 0000000..c2fe350
--- /dev/null
+++ b/test/function/trailing-slash/main.js
@@ -0,0 +1,3 @@
+var foo = require( './foo/' );
+
+assert.equal( foo, 42 );
diff --git a/test/function/typeof-require/foo.js b/test/function/typeof-require/foo.js
new file mode 100644
index 0000000..596262b
--- /dev/null
+++ b/test/function/typeof-require/foo.js
@@ -0,0 +1,5 @@
+if ( typeof require === 'function' && require ) {
+	module.exports = 1;
+} else {
+	module.exports = 2;
+}
diff --git a/test/function/typeof-require/main.js b/test/function/typeof-require/main.js
new file mode 100644
index 0000000..e2b1718
--- /dev/null
+++ b/test/function/typeof-require/main.js
@@ -0,0 +1,3 @@
+import foo from './foo.js';
+
+assert.equal( foo, 1 );
diff --git a/test/node_modules/.gitkeep b/test/node_modules/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/test/node_modules/bar/index.js b/test/node_modules/bar/index.js
new file mode 100644
index 0000000..41bd6d6
--- /dev/null
+++ b/test/node_modules/bar/index.js
@@ -0,0 +1,4 @@
+const baz = require('baz');
+module.exports = function () {
+	return baz;
+};
\ No newline at end of file
diff --git a/test/node_modules/baz/index.js b/test/node_modules/baz/index.js
new file mode 100644
index 0000000..58deca1
--- /dev/null
+++ b/test/node_modules/baz/index.js
@@ -0,0 +1 @@
+module.exports = 'hello';
\ No newline at end of file
diff --git a/test/node_modules/external/index.js b/test/node_modules/external/index.js
new file mode 100644
index 0000000..6a59a24
--- /dev/null
+++ b/test/node_modules/external/index.js
@@ -0,0 +1,2 @@
+var externalLib = exports;
+externalLib.message = 'it works';
diff --git a/test/node_modules/foo/index.js b/test/node_modules/foo/index.js
new file mode 100644
index 0000000..d00e0a2
--- /dev/null
+++ b/test/node_modules/foo/index.js
@@ -0,0 +1 @@
+module.exports = 'foo';
\ No newline at end of file
diff --git a/test/samples/corejs/literal-with-default.js b/test/samples/corejs/literal-with-default.js
new file mode 100644
index 0000000..6d4f280
--- /dev/null
+++ b/test/samples/corejs/literal-with-default.js
@@ -0,0 +1 @@
+module.exports = { default: 'foobar', __esModule: true };
diff --git a/test/samples/custom-named-exports-false-positive/main.js b/test/samples/custom-named-exports-false-positive/main.js
new file mode 100644
index 0000000..881df7e
--- /dev/null
+++ b/test/samples/custom-named-exports-false-positive/main.js
@@ -0,0 +1,2 @@
+import { thing } from './other.js';
+assert.equal( thing, 'yes' );
diff --git a/test/samples/custom-named-exports-false-positive/other.js b/test/samples/custom-named-exports-false-positive/other.js
new file mode 100644
index 0000000..644906d
--- /dev/null
+++ b/test/samples/custom-named-exports-false-positive/other.js
@@ -0,0 +1,2 @@
+/* require (https://github.com/rollup/rollup-plugin-commonjs/issues/36) */
+export var thing = 'yes';
diff --git a/test/samples/custom-named-exports/main.js b/test/samples/custom-named-exports/main.js
new file mode 100644
index 0000000..850c688
--- /dev/null
+++ b/test/samples/custom-named-exports/main.js
@@ -0,0 +1,5 @@
+import { named } from './secret-named-exporter.js';
+import { message } from 'external';
+
+assert.equal( named, 42 );
+assert.equal( message, 'it works' );
diff --git a/test/samples/custom-named-exports/secret-named-exporter.js b/test/samples/custom-named-exports/secret-named-exporter.js
new file mode 100644
index 0000000..90e540e
--- /dev/null
+++ b/test/samples/custom-named-exports/secret-named-exporter.js
@@ -0,0 +1,2 @@
+var myLib = exports;
+myLib.named = 42;
diff --git a/test/samples/deconflict-helpers/main.js b/test/samples/deconflict-helpers/main.js
new file mode 100644
index 0000000..6065c64
--- /dev/null
+++ b/test/samples/deconflict-helpers/main.js
@@ -0,0 +1,2 @@
+var commonjsHelpers = { commonjsGlobal: 'nope' };
+module.exports = global;
diff --git a/test/samples/define-is-undefined/foo.js b/test/samples/define-is-undefined/foo.js
new file mode 100644
index 0000000..f1417a1
--- /dev/null
+++ b/test/samples/define-is-undefined/foo.js
@@ -0,0 +1,9 @@
+(function (global, factory) {
+	typeof define === 'function' && define.amd ? define(factory) :
+	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+	(global.foo = factory());
+}(this, (function () { 'use strict';
+
+	return 42;
+
+})));
diff --git a/test/samples/define-is-undefined/main.js b/test/samples/define-is-undefined/main.js
new file mode 100644
index 0000000..28d309c
--- /dev/null
+++ b/test/samples/define-is-undefined/main.js
@@ -0,0 +1,3 @@
+import foo from './foo.js';
+
+export default 42;
diff --git a/test/samples/extension/foo.coffee b/test/samples/extension/foo.coffee
new file mode 100644
index 0000000..ce0fffb
--- /dev/null
+++ b/test/samples/extension/foo.coffee
@@ -0,0 +1 @@
+module.exports = 21;
diff --git a/test/samples/extension/main.coffee b/test/samples/extension/main.coffee
new file mode 100644
index 0000000..7a8aa33
--- /dev/null
+++ b/test/samples/extension/main.coffee
@@ -0,0 +1,2 @@
+var foo = require( './foo' );
+module.exports = foo * 2;
diff --git a/test/samples/external/main.js b/test/samples/external/main.js
new file mode 100644
index 0000000..bddba27
--- /dev/null
+++ b/test/samples/external/main.js
@@ -0,0 +1,3 @@
+import bar from 'bar';
+
+export default bar().toUpperCase();
\ No newline at end of file
diff --git a/test/samples/global-in-if-block/main.js b/test/samples/global-in-if-block/main.js
new file mode 100644
index 0000000..c5b42bb
--- /dev/null
+++ b/test/samples/global-in-if-block/main.js
@@ -0,0 +1,5 @@
+if (!global.count) {
+	global.count = 0;
+}
+
+global.count += 1;
diff --git a/test/samples/global/main.js b/test/samples/global/main.js
new file mode 100644
index 0000000..55ec32f
--- /dev/null
+++ b/test/samples/global/main.js
@@ -0,0 +1 @@
+global.foo = 'bar';
diff --git a/test/samples/ignore-global/firstpass.js b/test/samples/ignore-global/firstpass.js
new file mode 100644
index 0000000..2602494
--- /dev/null
+++ b/test/samples/ignore-global/firstpass.js
@@ -0,0 +1,2 @@
+export var immediate = typeof global.setImmediate === 'function' ?
+   global.setImmediate : global.setTimeout;
diff --git a/test/samples/ignore-global/identifier.js b/test/samples/ignore-global/identifier.js
new file mode 100644
index 0000000..a53ce5f
--- /dev/null
+++ b/test/samples/ignore-global/identifier.js
@@ -0,0 +1,4 @@
+// require (firstpass)
+
+export var immediate = typeof global.setImmediate === 'function' ?
+   global.setImmediate : global.setTimeout;
diff --git a/test/samples/ignore-global/main.js b/test/samples/ignore-global/main.js
new file mode 100644
index 0000000..588798f
--- /dev/null
+++ b/test/samples/ignore-global/main.js
@@ -0,0 +1,3 @@
+export { immediate as immediate1 } from './firstpass';
+export { immediate as immediate2 } from './identifier';
+export { immediate as immediate3 } from './this';
diff --git a/test/samples/ignore-global/this.js b/test/samples/ignore-global/this.js
new file mode 100644
index 0000000..f8aeb6a
--- /dev/null
+++ b/test/samples/ignore-global/this.js
@@ -0,0 +1,6 @@
+// require (firstpass)
+
+// "this" will be rewritten with "undefined" by rollup
+export var immediate = typeof this === 'undefined' ? 
+   null : typeof this.setImmediate === 'function' ?
+   this.setImmediate : this.setTimeout;
diff --git a/test/samples/named-exports-from-object-literal/a.js b/test/samples/named-exports-from-object-literal/a.js
new file mode 100644
index 0000000..bd816ea
--- /dev/null
+++ b/test/samples/named-exports-from-object-literal/a.js
@@ -0,0 +1 @@
+module.exports = 1;
diff --git a/test/samples/named-exports-from-object-literal/main.js b/test/samples/named-exports-from-object-literal/main.js
new file mode 100644
index 0000000..063779d
--- /dev/null
+++ b/test/samples/named-exports-from-object-literal/main.js
@@ -0,0 +1,5 @@
+import { a, b, c } from './other.js';
+
+assert.equal( a, 1 );
+assert.equal( b, 2 );
+assert.equal( c, 3 );
diff --git a/test/samples/named-exports-from-object-literal/other.js b/test/samples/named-exports-from-object-literal/other.js
new file mode 100644
index 0000000..09a5b66
--- /dev/null
+++ b/test/samples/named-exports-from-object-literal/other.js
@@ -0,0 +1,9 @@
+var a = require( './a.js' );
+var b = 2;
+
+module.exports = {
+  a: a,
+  b: b,
+  c: a + b,
+  2: 1 + 1
+};
diff --git a/test/samples/other-transforms/bar.js b/test/samples/other-transforms/bar.js
new file mode 100644
index 0000000..f967812
--- /dev/null
+++ b/test/samples/other-transforms/bar.js
@@ -0,0 +1 @@
+module.exports = 40;
diff --git a/test/samples/other-transforms/foo.js b/test/samples/other-transforms/foo.js
new file mode 100644
index 0000000..c52d053
--- /dev/null
+++ b/test/samples/other-transforms/foo.js
@@ -0,0 +1,3 @@
+var bar = require( './bar.js' );
+
+module.exports = bar + 1;
diff --git a/test/samples/other-transforms/main.js b/test/samples/other-transforms/main.js
new file mode 100644
index 0000000..c01e9a1
--- /dev/null
+++ b/test/samples/other-transforms/main.js
@@ -0,0 +1,3 @@
+import foo from './foo.js';
+
+assert.equal( foo, 42 );
diff --git a/test/samples/paren-expression/index.js b/test/samples/paren-expression/index.js
new file mode 100644
index 0000000..6cd2155
--- /dev/null
+++ b/test/samples/paren-expression/index.js
@@ -0,0 +1 @@
+module.exports = (42);
diff --git a/test/samples/reexport/export.js b/test/samples/reexport/export.js
new file mode 100644
index 0000000..5cb3237
--- /dev/null
+++ b/test/samples/reexport/export.js
@@ -0,0 +1 @@
+exports.named = 2;
diff --git a/test/samples/reexport/main.js b/test/samples/reexport/main.js
new file mode 100644
index 0000000..bb942f4
--- /dev/null
+++ b/test/samples/reexport/main.js
@@ -0,0 +1,3 @@
+import { named } from './reexport.js';
+
+assert.equal(named, 2);
diff --git a/test/samples/reexport/reexport.js b/test/samples/reexport/reexport.js
new file mode 100644
index 0000000..fb12c58
--- /dev/null
+++ b/test/samples/reexport/reexport.js
@@ -0,0 +1 @@
+module.exports = require('./export.js');
diff --git a/test/samples/reserved-as-property/main.js b/test/samples/reserved-as-property/main.js
new file mode 100644
index 0000000..63b60c7
--- /dev/null
+++ b/test/samples/reserved-as-property/main.js
@@ -0,0 +1 @@
+module.exports.delete = 'foo';
diff --git a/test/samples/sourcemap/foo.js b/test/samples/sourcemap/foo.js
new file mode 100644
index 0000000..7a4e8a7
--- /dev/null
+++ b/test/samples/sourcemap/foo.js
@@ -0,0 +1 @@
+export default 42;
diff --git a/test/samples/sourcemap/main.js b/test/samples/sourcemap/main.js
new file mode 100644
index 0000000..ab8ec70
--- /dev/null
+++ b/test/samples/sourcemap/main.js
@@ -0,0 +1,2 @@
+var foo = require( './foo' );
+console.log( foo );
diff --git a/test/samples/umd/correct-scoping.js b/test/samples/umd/correct-scoping.js
new file mode 100644
index 0000000..9ab6fc6
--- /dev/null
+++ b/test/samples/umd/correct-scoping.js
@@ -0,0 +1,5 @@
+if ( typeof require === 'function' ) {
+	module.exports = function ( require ) {
+		return typeof require;
+	}( {} );
+}
diff --git a/test/samples/umd/protobuf.js b/test/samples/umd/protobuf.js
new file mode 100644
index 0000000..670ccfc
--- /dev/null
+++ b/test/samples/umd/protobuf.js
@@ -0,0 +1,11 @@
+// From https://github.com/rollup/rollup-plugin-commonjs/issues/38
+(function(global, factory) {
+    /* AMD */ if (typeof define === 'function' && define["amd"])
+        define(["foo"], factory);
+    /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
+        module["exports"] = factory(require("foo"), true);
+    /* Global */ else
+        (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
+})(this, function(ByteBuffer, isCommonJS) {
+  return isCommonJS;
+})
diff --git a/test/samples/umd/sinon.js b/test/samples/umd/sinon.js
new file mode 100644
index 0000000..a07f665
--- /dev/null
+++ b/test/samples/umd/sinon.js
@@ -0,0 +1,40 @@
+// From https://github.com/rollup/rollup-plugin-commonjs/issues/38
+var sinon = (function () { // eslint-disable-line no-unused-vars
+    "use strict";
+
+    var sinonModule;
+    var isNode = typeof module !== "undefined" && module.exports && typeof require === "function";
+    var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+    function loadDependencies(require, exports, module) {
+        sinonModule = module.exports = require("./sinon/util/core");
+        require("./sinon/extend");
+        require("./sinon/walk");
+        require("./sinon/typeOf");
+        require("./sinon/times_in_words");
+        require("./sinon/spy");
+        require("./sinon/call");
+        require("./sinon/behavior");
+        require("./sinon/stub");
+        require("./sinon/mock");
+        require("./sinon/collection");
+        require("./sinon/assert");
+        require("./sinon/sandbox");
+        require("./sinon/test");
+        require("./sinon/test_case");
+        require("./sinon/match");
+        require("./sinon/format");
+        require("./sinon/log_error");
+    }
+
+    if (isAMD) {
+        define(loadDependencies);
+    } else if (isNode) {
+        loadDependencies(require, module.exports, module);
+        sinonModule = module.exports;
+    } else {
+        sinonModule = {};
+    }
+
+    return sinonModule;
+}());
diff --git a/test/test.js b/test/test.js
new file mode 100644
index 0000000..e3b15df
--- /dev/null
+++ b/test/test.js
@@ -0,0 +1,409 @@
+const path = require( 'path' );
+const fs = require( 'fs' );
+const assert = require( 'assert' );
+const relative = require( 'require-relative' );
+const { SourceMapConsumer } = require( 'source-map' );
+const { getLocator } = require( 'locate-character' );
+const { rollup } = require( 'rollup' );
+const resolve = require( 'rollup-plugin-node-resolve' );
+const commonjs = require( '..' );
+
+require( 'source-map-support' ).install();
+
+process.chdir( __dirname );
+
+function execute ( code, context = {} ) {
+	let fn;
+
+	const contextKeys = Object.keys( context );
+
+	const argNames = contextKeys.concat( 'module', 'exports', 'require', 'global', 'assert', code );
+
+	try {
+		fn = new Function( ...argNames );
+	} catch ( err ) {
+		// syntax error
+		console.log( code );
+		throw err;
+	}
+
+	const module = { exports: {} };
+	const global = {};
+
+	const argValues = contextKeys.map( key => context[ key ] ).concat(
+		module,
+		module.exports,
+		name => relative( name, 'test/x.js' ),
+		global,
+		assert
+	);
+
+	fn( ...argValues );
+
+	return {
+		code,
+		exports: module.exports,
+		global
+	};
+}
+
+function executeBundle ( bundle, { context, exports } = {} ) {
+	const options = { format: 'cjs' };
+	if ( exports ) options.exports = exports;
+
+	const { code } = bundle.generate( options );
+	return execute( code, context );
+}
+
+describe( 'rollup-plugin-commonjs', () => {
+	describe( 'form', () => {
+		fs.readdirSync( 'form' ).forEach( dir => {
+			let config;
+
+			try {
+				config = require( `./form/${dir}/_config.js` );
+			} catch ( err ) {
+				config = {};
+			}
+
+			( config.solo ? it.only : it )( dir, () => {
+				const { transform, options } = commonjs( config.options );
+				options({ entry: 'main.js' });
+
+				const input = fs.readFileSync( `form/${dir}/input.js`, 'utf-8' );
+				const expected = fs.readFileSync( `form/${dir}/output.js`, 'utf-8' ).trim();
+
+				return transform( input, 'input.js' ).then( transformed => {
+					const actual = ( transformed ? transformed.code : input ).trim().replace( /\0/g, '' );
+					assert.equal( actual, expected );
+				});
+			});
+		});
+	});
+
+	describe( 'function', () => {
+		fs.readdirSync( 'function' ).forEach( dir => {
+			let config;
+
+			try {
+				config = require( `./function/${dir}/_config.js` );
+			} catch ( err ) {
+				config = {};
+			}
+
+			( config.solo ? it.only : it )( dir, () => {
+				const options = Object.assign({
+					entry: `function/${dir}/main.js`,
+					plugins: [ commonjs( config.pluginOptions ) ]
+				}, config.options || {} );
+
+				return rollup( options ).then( bundle => {
+					const { code } = bundle.generate({ format: 'cjs' });
+					if ( config.show || config.solo ) {
+						console.error( code );
+					}
+
+					const { exports, global } = execute( code, config.context );
+
+					if ( config.exports ) config.exports( exports );
+					if ( config.global ) config.global( global );
+				});
+			});
+		});
+	});
+
+	describe( 'misc tests', () => {
+		// most of these should be moved over to function...
+		it( 'generates a sourcemap', () => {
+			return rollup({
+				entry: 'samples/sourcemap/main.js',
+				plugins: [ commonjs({ sourceMap: true }) ]
+			}).then( bundle => {
+				const generated = bundle.generate({
+					format: 'cjs',
+					sourceMap: true,
+					sourceMapFile: path.resolve( 'bundle.js' )
+				});
+
+				const smc = new SourceMapConsumer( generated.map );
+				const locator = getLocator( generated.code, { offsetLine: 1 });
+
+				let generatedLoc = locator( '42' );
+				let loc = smc.originalPositionFor( generatedLoc ); // 42
+				assert.equal( loc.source, 'samples/sourcemap/foo.js' );
+				assert.equal( loc.line, 1 );
+				assert.equal( loc.column, 15 );
+
+				generatedLoc = locator( 'log' );
+				loc = smc.originalPositionFor( generatedLoc ); // log
+				assert.equal( loc.source, 'samples/sourcemap/main.js' );
+				assert.equal( loc.line, 2 );
+				assert.equal( loc.column, 8 );
+			});
+		});
+
+		it( 'handles references to `global`', () => {
+			return rollup({
+				entry: 'samples/global/main.js',
+				plugins: [ commonjs() ]
+			}).then( bundle => {
+				const generated = bundle.generate({
+					format: 'cjs'
+				});
+
+				const mockWindow = {};
+				const mockGlobal = {};
+				const mockSelf = {};
+
+				const fn = new Function ( 'module', 'window', 'global', 'self', generated.code );
+
+				fn( {}, mockWindow, mockGlobal,  mockSelf);
+				assert.equal( mockWindow.foo, 'bar', generated.code );
+				assert.equal( mockGlobal.foo, undefined, generated.code );
+				assert.equal( mockSelf.foo, undefined, generated.code );
+
+				fn( {}, undefined, mockGlobal,  mockSelf );
+				assert.equal( mockGlobal.foo, 'bar', generated.code );
+				assert.equal( mockSelf.foo, undefined, generated.code );
+
+				fn( {}, undefined, undefined, mockSelf );
+				assert.equal( mockSelf.foo, 'bar', generated.code );
+
+			});
+		});
+
+		it( 'handles multiple references to `global`', () => {
+			return rollup({
+				entry: 'samples/global-in-if-block/main.js',
+				plugins: [ commonjs() ]
+			}).then( bundle => {
+				const generated = bundle.generate({
+					format: 'cjs'
+				});
+
+				const fn = new Function ( 'module', 'exports', 'window', generated.code );
+
+				const module = { exports: {} };
+				const window = {};
+
+				fn( module, module.exports, window );
+				assert.equal( window.count, 1 );
+
+				fn( module, module.exports, window );
+				assert.equal( window.count, 2 );
+			});
+		});
+
+		it( 'handles transpiled CommonJS modules', () => {
+			return rollup({
+				entry: 'samples/corejs/literal-with-default.js',
+				plugins: [ commonjs() ]
+			}).then( bundle => {
+				const generated = bundle.generate({
+					format: 'cjs'
+				});
+
+				const module = { exports: {} };
+
+				const fn = new Function ( 'module', 'exports', generated.code );
+				fn( module, module.exports );
+
+				assert.equal( module.exports, 'foobar', generated.code );
+			});
+		});
+
+		it( 'allows named exports to be added explicitly via config', () => {
+			return rollup({
+				entry: 'samples/custom-named-exports/main.js',
+				plugins: [
+					resolve({ main: true }),
+					commonjs({
+						namedExports: {
+							'samples/custom-named-exports/secret-named-exporter.js': [ 'named' ],
+							'external': [ 'message' ]
+						}
+					})
+				]
+			}).then( executeBundle );
+		});
+
+		it( 'ignores false positives with namedExports (#36)', () => {
+			return rollup({
+				entry: 'samples/custom-named-exports-false-positive/main.js',
+				plugins: [
+					resolve({ main: true }),
+					commonjs({
+						namedExports: {
+							'irrelevant': [ 'lol' ]
+						}
+					})
+				]
+			}).then( executeBundle );
+		});
+
+		it( 'converts a CommonJS module with custom file extension', () => {
+			return rollup({
+				entry: 'samples/extension/main.coffee',
+				plugins: [ commonjs({ extensions: ['.coffee' ]}) ]
+			}).then( bundle => {
+				assert.equal( executeBundle( bundle ).exports, 42 );
+			});
+		});
+
+		it( 'can ignore references to `global`', () => {
+			return rollup({
+				entry: 'samples/ignore-global/main.js',
+				plugins: [
+					commonjs({ ignoreGlobal: true })
+				],
+				onwarn: warning => {
+					if ( warning.code === 'THIS_IS_UNDEFINED' ) return;
+					console.warn( warning.message );
+				}
+			}).then( bundle => {
+				const generated = bundle.generate({
+					format: 'cjs'
+				});
+
+				const { exports, global } = executeBundle( bundle );
+
+				assert.equal( exports.immediate1, global.setImmediate, generated.code );
+				assert.equal( exports.immediate2, global.setImmediate, generated.code );
+				assert.equal( exports.immediate3, null, generated.code );
+			});
+		});
+
+		it( 'can handle parens around right have node while producing default export', () => {
+			return rollup({
+				entry: 'samples/paren-expression/index.js',
+				plugins: [ commonjs() ]
+			}).then( bundle => {
+				assert.equal( executeBundle( bundle ).exports, 42 );
+			});
+		});
+
+		describe( 'typeof transforms', () => {
+			it( 'correct-scoping', () => {
+				return rollup({
+					entry: 'samples/umd/correct-scoping.js',
+					plugins: [ commonjs() ]
+				}).then( bundle => {
+					assert.equal( executeBundle( bundle ).exports, 'object' );
+				});
+			});
+
+			it( 'protobuf', () => {
+				return rollup({
+					entry: 'samples/umd/protobuf.js',
+					external: [ 'bytebuffer' ],
+					plugins: [ commonjs() ]
+				}).then( bundle => {
+					assert.equal( executeBundle( bundle ).exports, true );
+				});
+			});
+
+			it( 'sinon', () => {
+				return rollup({
+					entry: 'samples/umd/sinon.js',
+					plugins: [ commonjs() ]
+				}).then( bundle => {
+					const code = bundle.generate({ format: 'es' }).code;
+
+					assert.equal( code.indexOf( 'typeof require' ), -1, code );
+					// assert.notEqual( code.indexOf( 'typeof module' ), -1, code ); // #151 breaks this test
+					// assert.notEqual( code.indexOf( 'typeof define' ), -1, code ); // #144 breaks this test
+				});
+			});
+		});
+
+		it( 'deconflicts helper name', () => {
+			return rollup({
+				entry: 'samples/deconflict-helpers/main.js',
+				plugins: [ commonjs() ]
+			}).then( executeBundle ).then( ({ exports }) => {
+				assert.notEqual( exports, 'nope' );
+			});
+		});
+
+		it( 'deconflicts reserved keywords', () => {
+			return rollup({
+				entry: 'samples/reserved-as-property/main.js',
+				plugins: [ commonjs() ]
+			})
+			.then( bundle => {
+				assert.doesNotThrow(() => {
+					const reservedProp = executeBundle( bundle, { exports: 'named' }).exports.delete;
+					assert.equal(reservedProp, 'foo');
+				});
+			});
+		});
+
+		it( 'does not process the entry file when it has a leading "." (issue #63)', () => {
+			return rollup({
+				entry: './function/basic/main.js',
+				plugins: [ commonjs() ]
+			}).then( executeBundle );
+		});
+
+		it( 'does not reexport named contents', () => {
+			return rollup({
+				entry: 'samples/reexport/main.js',
+				plugins: [ commonjs() ]
+			})
+			.then( executeBundle )
+			.catch( error => {
+				assert.equal( error.message, `'named' is not exported by samples${path.sep}reexport${path.sep}reexport.js` );
+			});
+		});
+
+		it( 'respects other plugins', () => {
+			return rollup({
+				entry: 'samples/other-transforms/main.js',
+				plugins: [
+					{
+						transform ( code, id ) {
+							if ( id[0] === '\0' ) return null;
+							return code.replace( '40', '41' );
+						}
+					},
+					commonjs()
+				]
+			}).then( executeBundle );
+		});
+
+		it( 'rewrites top-level defines', () => {
+			return rollup({
+				entry: 'samples/define-is-undefined/main.js',
+				plugins: [ commonjs() ]
+			})
+			.then( bundle => {
+				function define () {
+					throw new Error( 'nope' );
+				}
+
+				define.amd = true;
+
+				const { exports } = executeBundle( bundle, { context: { define } });
+				assert.equal( exports, 42 );
+			});
+		});
+
+		it( 'respects options.external', () => {
+			return rollup({
+				entry: 'samples/external/main.js',
+				plugins: [
+					resolve(),
+					commonjs()
+				],
+				external: ['baz']
+			})
+			.then( async bundle => {
+				const { code } = await bundle.generate({ format: 'cjs' });
+				assert.equal( code.indexOf( 'hello' ), -1 );
+
+				const { exports } = executeBundle( bundle );
+				assert.equal( exports, 'HELLO' );
+			});
+		});
+	});
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-rollup-plugin-commonjs.git



More information about the Pkg-javascript-commits mailing list