diff options
Diffstat (limited to 'node_modules/@ava')
32 files changed, 0 insertions, 1105 deletions
diff --git a/node_modules/@ava/babel-plugin-throws-helper/index.js b/node_modules/@ava/babel-plugin-throws-helper/index.js deleted file mode 100644 index e370480f1..000000000 --- a/node_modules/@ava/babel-plugin-throws-helper/index.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict'; - -module.exports = babelCore => { - const t = babelCore.types; - const wrapArg = babelCore.template('(START(t, ASSERTION, FILE, LINE), END(t, ARG))'); - const helpers = babelCore.template(`function START(t, assertion, file, line) { - if (t._throwsArgStart) { - t._throwsArgStart(assertion, file, line); - } -} - -function END(t, arg) { - if (t._throwsArgEnd) { - t._throwsArgEnd(); - } - - return arg; -}`); - - const assertionVisitor = { - CallExpression(path, state) { - const callee = path.get('callee'); - if (!callee.isMemberExpression() || !callee.get('object').isIdentifier({name: 't'}) || !callee.get('property').isIdentifier()) { - return; - } - - const assertion = callee.get('property').get('name').node; - if (assertion !== 'throws' && assertion !== 'notThrows') { - return; - } - - const arg0 = path.node.arguments[0]; - if (!(arg0 && arg0.loc && (typeof arg0.start === 'number') && (typeof arg0.end === 'number'))) { - return; - } - - // Wrap the argument expression, so that the stack trace of the assertion - // isn't affected. - path.node.arguments[0] = wrapArg(Object.assign({ - ARG: arg0, - ASSERTION: t.stringLiteral(assertion), - FILE: t.stringLiteral(state.file.opts.filename), - LINE: t.numericLiteral(arg0.loc.start.line) - }, this.installHelper())).expression; - } - }; - - return { - visitor: { - Program(path, state) { - const START = t.identifier(path.scope.generateUid('avaThrowsHelperStart')); - const END = t.identifier(path.scope.generateUid('avaThrowsHelperEnd')); - const helperIdentifiers = {START, END}; - - let created = false; - path.traverse(assertionVisitor, { - installHelper() { - if (!created) { - created = true; - path.unshiftContainer('body', helpers(helperIdentifiers)); - } - - return helperIdentifiers; - }, - file: state.file - }); - } - } - }; -}; diff --git a/node_modules/@ava/babel-plugin-throws-helper/license b/node_modules/@ava/babel-plugin-throws-helper/license deleted file mode 100644 index ad5d021ed..000000000 --- a/node_modules/@ava/babel-plugin-throws-helper/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) James Talmage <james@talmage.io> (github.com/jamestalmage) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/@ava/babel-plugin-throws-helper/package.json b/node_modules/@ava/babel-plugin-throws-helper/package.json deleted file mode 100644 index 83dbf4659..000000000 --- a/node_modules/@ava/babel-plugin-throws-helper/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "@ava/babel-plugin-throws-helper", - "version": "2.0.0", - "description": "Babel plugin for protecting against improper use of `t.throws()` in AVA", - "license": "MIT", - "repository": "avajs/babel-plugin-throws-helper", - "author": { - "name": "James Talmage", - "email": "james@talmage.io", - "url": "github.com/jamestalmage" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava", - "preversion": "WRITE_EXAMPLES=1 npm run test && git add example-output.md" - }, - "files": [ - "index.js" - ], - "keywords": [ - "babel-plugin", - "babel", - "helper", - "ava", - "assertion", - "throws" - ], - "devDependencies": { - "ava": "^0.18.2", - "babel-core": "^6.7.5", - "xo": "^0.17.0" - } -} diff --git a/node_modules/@ava/babel-plugin-throws-helper/readme.md b/node_modules/@ava/babel-plugin-throws-helper/readme.md deleted file mode 100644 index faa91d49d..000000000 --- a/node_modules/@ava/babel-plugin-throws-helper/readme.md +++ /dev/null @@ -1,33 +0,0 @@ -# babel-plugin-throws-helper [](https://travis-ci.org/avajs/babel-plugin-throws-helper) - -> Babel plugin for protecting against improper use of `t.throws()` in [AVA](https://ava.li) - -Probably not useful except as an internal plugin for the AVA test runner. - -[Genesis of the idea.](https://github.com/sindresorhus/eslint-plugin-ava/issues/75) - -## Issue - -> I've seen a lot of incorrect use of the throws assertion in other test runner and even done the mistake myself sometimes. Now I'm beginning to see it with AVA too, so would be nice to be preemptive about it. -> -> People don't realize they need to wrap their call in a function, so many end up doing `t.throws(foo())` instead of `t.throws(() => foo());`. It's an easy mistake to make. - -The difficulty is that `t.throws(foo())` is allowed if `foo()` returns a promise or a function. There is no good way to differentiate between the two at runtime. So providing a good error message is going to take some AST transform magic. - - -## Solution - -See [`example-output.md`](example-output.md) for the transformation this plugin performs. - -The example output can be generated by calling: - -``` -$ WRITE_EXAMPLES=1 ava -``` - -Contributors should not commit new examples. They will be regenerated as part of the release process. - - -## License - -MIT © [James Talmage](https://github.com/jamestalmage) diff --git a/node_modules/@ava/babel-preset-stage-4/index.js b/node_modules/@ava/babel-preset-stage-4/index.js deleted file mode 100644 index fb972935a..000000000 --- a/node_modules/@ava/babel-preset-stage-4/index.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; -/* eslint-disable import/no-dynamic-require */ -module.exports = () => { - const plugins = require(`./plugins/best-match`) - .map(module => require(module)); - - return {plugins}; -}; diff --git a/node_modules/@ava/babel-preset-stage-4/license b/node_modules/@ava/babel-preset-stage-4/license deleted file mode 100644 index 060edd7f2..000000000 --- a/node_modules/@ava/babel-preset-stage-4/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Mark Wubben <mark@novemberborn.net> (novemberborn.net) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/browser.js b/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/browser.js deleted file mode 100644 index 50b9b27cd..000000000 --- a/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/browser.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; -var md5OMatic = require('md5-o-matic'); - -module.exports = function (input) { - if (Array.isArray(input)) { - input = input.join(''); - } - - return md5OMatic(input); -}; diff --git a/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/index.js b/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/index.js deleted file mode 100644 index c52bddd7c..000000000 --- a/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/index.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; -var crypto = require('crypto'); - -module.exports = function (input) { - var hash = crypto.createHash('md5'); - - var update = function (buf) { - var inputEncoding = typeof buf === 'string' ? 'utf8' : undefined; - hash.update(buf, inputEncoding); - }; - - if (arguments.length > 1) { - throw new Error('Too many arguments. Try specifying an array.'); - } - - if (Array.isArray(input)) { - input.forEach(update); - } else { - update(input); - } - - return hash.digest('hex'); -}; diff --git a/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/license b/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/license deleted file mode 100644 index 654d0bfe9..000000000 --- a/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/package.json b/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/package.json deleted file mode 100644 index 9dc26627f..000000000 --- a/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "md5-hex", - "version": "1.3.0", - "description": "Create a MD5 hash with hex encoding", - "license": "MIT", - "repository": "sindresorhus/md5-hex", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "browser": "browser.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js", - "browser.js" - ], - "keywords": [ - "hash", - "crypto", - "md5", - "hex", - "buffer", - "browser", - "browserify" - ], - "dependencies": { - "md5-o-matic": "^0.1.1" - }, - "devDependencies": { - "ava": "*", - "xo": "*" - } -} diff --git a/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/readme.md b/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/readme.md deleted file mode 100644 index df40a9415..000000000 --- a/node_modules/@ava/babel-preset-stage-4/node_modules/md5-hex/readme.md +++ /dev/null @@ -1,44 +0,0 @@ -# md5-hex [](https://travis-ci.org/sindresorhus/md5-hex) - -> Create a MD5 hash with hex encoding - -*Please don't use MD5 hashes for anything sensitive!* - -Checkout [`hasha`](https://github.com/sindresorhus/hasha) if you need something more flexible. - - -## Install - -``` -$ npm install --save md5-hex -``` - - -## Usage - -```js -const fs = require('fs'); -const md5Hex = require('md5-hex'); -const buffer = fs.readFileSync('unicorn.png'); - -md5Hex(buffer); -//=> '1abcb33beeb811dca15f0ac3e47b88d9' -``` - - -## API - -### md5Hex(input) - -#### input - -Type: `buffer` `string` `array[string|buffer]` - -Prefer buffers as they're faster to hash, but strings can be useful for small things. - -Pass an array instead of concatenating strings and/or buffers. The output is the same, but arrays do not incur the overhead of concatenation. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/LICENSE b/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/LICENSE deleted file mode 100644 index ee1e36789..000000000 --- a/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -ISC License (ISC) -Copyright (c) 2016, Mark Wubben - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. diff --git a/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/README.md b/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/README.md deleted file mode 100644 index 211a1b6e0..000000000 --- a/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# package-hash - -Generates a hash for an installed npm package, useful for salting caches. -[AVA](https://github.com/sindresorhus/ava) for example caches precompiled test -files. It generates a salt for its cache based on the various packages that are -used when compiling the test files. - -`package-hash` can generate an appropriate hash based on the package location -(on disk) and the `package.json` file. This hash is salted with a hash -for the `package-hash` itself. - -`package-hash` can detect when the package-to-be-hashed is a Git repository. In -the AVA example this is useful when you're debugging one of the packages used to -compile the test files. You can clone it locally and use `npm link` so AVA can -find the clone. The hash will include the HEAD (`.git/HEAD`) and its -corresponding ref (e.g. `.git/refs/heads/master`), any packed refs -(`.git/packed-refs`), as well as the diff (`git diff`) for any non-committed -changes. This makes it really easy to test your changes without having to -explicitly clear the cache in the parent project. - -## Installation - -```console -$ npm install --save package-hash -``` - -## Usage - -```js -const sync = require('package-hash').sync - -const hash = sync(require.resolve('babel-core/package.json')) -``` - -`sync()` can be called with a directory or file path. File paths are translated -to directories using -[`path.dirname()`](https://nodejs.org/api/path.html#path_path_dirname_p). The -path must exist. A `package.json` must exist within the directory. - -To get the path to an npm package it's best to use -`require.resolve('the-name/package.json')`, since `require.resolve('the-name')` -may resolve to a subdirectory of the package. - -You can provide multiple paths: - -```js -const hash = sync([ - require.resolve('babel-core/package.json'), - require.resolve('babel-preset-es2015/package.json') -]) -``` - -An optional salt value can also be provided: - -```js -const hash = sync(require.resolve('babel-core/package.json'), 'salt value') -``` - -Currently only a synchronous interface is available. - -## API - -### `sync(paths, salt?)` - -`paths: string | string[]` ➜ can be a single directory or file path, or an array of paths. - -`salt: Array | Buffer | Object | string` ➜ optional. If an `Array` or `Object` (not `null`) it is first converted to a JSON string. - -## Compatibility - -`package-hash` has been tested with Node 0.10 and above, including Windows -support. Note that `git diff` support is not available in Node 0.10. diff --git a/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/index.js b/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/index.js deleted file mode 100644 index ff3d61b89..000000000 --- a/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/index.js +++ /dev/null @@ -1,125 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -exports.sync = sync; - -var _child_process = require('child_process'); - -var _fs = require('fs'); - -var _path = require('path'); - -var _md5Hex = require('md5-hex'); - -var _md5Hex2 = _interopRequireDefault(_md5Hex); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function tryReadFileSync(file) { - try { - return (0, _fs.readFileSync)(file); - } catch (err) { - return null; - } -} - -var TEN_MEBIBYTE = 1024 * 1024 * 10; - -var git = { - tryGetRef: function (dir, head) { - var m = /^ref: (.+)$/.exec(head.toString('utf8').trim()); - if (!m) return null; - - return tryReadFileSync((0, _path.join)(dir, '.git', m[1])); - }, - tryGetDiff: function (dir) { - if (!_child_process.execFileSync) return null; - - try { - // Attempt to get consistent output no matter the platform. Diff both - // staged and unstaged changes. - return (0, _child_process.execFileSync)('git', ['--no-pager', 'diff', 'HEAD', '--no-color', '--no-ext-diff'], { - cwd: dir, - maxBuffer: TEN_MEBIBYTE, - env: _extends({}, process.env, { - // Force the GIT_DIR to prevent git from diffing a parent repository - // in case the directory isn't actually a repository. - GIT_DIR: (0, _path.join)(dir, '.git') - }), - // Ignore stderr. - stdio: ['ignore', 'pipe', 'ignore'] - }); - } catch (err) { - return null; - } - } -}; - -function addPackageData(inputs, path) { - var dir = (0, _fs.statSync)(path).isDirectory() ? path : (0, _path.dirname)(path); - inputs.push(dir); - - var pkg = (0, _fs.readFileSync)((0, _path.join)(dir, 'package.json')); - inputs.push(pkg); - - var head = tryReadFileSync((0, _path.join)(dir, '.git', 'HEAD')); - if (head) { - inputs.push(head); - - var packed = tryReadFileSync((0, _path.join)(dir, '.git', 'packed-refs')); - if (packed) inputs.push(packed); - - var ref = git.tryGetRef(dir, head); - if (ref) inputs.push(ref); - - var diff = git.tryGetDiff(dir); - if (diff) inputs.push(diff); - } -} - -function computeHash(paths, pepper, salt) { - var inputs = []; - if (pepper) inputs.push(pepper); - - if (typeof salt !== 'undefined') { - if (Buffer.isBuffer(salt) || typeof salt === 'string') { - inputs.push(salt); - } else if (typeof salt === 'object' && salt !== null) { - inputs.push(JSON.stringify(salt)); - } else { - throw new TypeError('Salt must be an Array, Buffer, Object or string'); - } - } - - for (var i = 0; i < paths.length; i++) { - addPackageData(inputs, paths[i]); - } - - return (0, _md5Hex2.default)(inputs); -} - -var ownHash = null; -function sync(paths, salt) { - if (!ownHash) { - // Memoize the hash for package-hash itself. - ownHash = new Buffer(computeHash([__dirname]), 'hex'); - } - - if (paths === __dirname && typeof salt === 'undefined') { - // Special case that allow the pepper value to be obtained. Mainly here for - // testing purposes. - return ownHash.toString('hex'); - } - - if (Array.isArray(paths)) { - return computeHash(paths, ownHash, salt); - } else { - return computeHash([paths], ownHash, salt); - } -} -//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/index.js.map b/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/index.js.map deleted file mode 100644 index eeac1a048..000000000 --- a/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["src/index.js"],"names":[],"mappings":"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","file":"index.js","sourcesContent":["import { execFileSync } from 'child_process'\nimport { readFileSync, statSync } from 'fs'\nimport { dirname, join } from 'path'\n\nimport md5hex from 'md5-hex'\n\nfunction tryReadFileSync (file) {\n try {\n return readFileSync(file)\n } catch (err) {\n return null\n }\n}\n\nconst TEN_MEBIBYTE = 1024 * 1024 * 10\n\nconst git = {\n tryGetRef (dir, head) {\n const m = /^ref: (.+)$/.exec(head.toString('utf8').trim())\n if (!m) return null\n\n return tryReadFileSync(join(dir, '.git', m[1]))\n },\n\n tryGetDiff (dir) {\n if (!execFileSync) return null\n\n try {\n // Attempt to get consistent output no matter the platform. Diff both\n // staged and unstaged changes.\n return execFileSync('git', ['--no-pager', 'diff', 'HEAD', '--no-color', '--no-ext-diff'], {\n cwd: dir,\n maxBuffer: TEN_MEBIBYTE,\n env: Object.assign({}, process.env, {\n // Force the GIT_DIR to prevent git from diffing a parent repository\n // in case the directory isn't actually a repository.\n GIT_DIR: join(dir, '.git')\n }),\n // Ignore stderr.\n stdio: ['ignore', 'pipe', 'ignore']\n })\n } catch (err) {\n return null\n }\n }\n}\n\nfunction addPackageData (inputs, path) {\n const dir = statSync(path).isDirectory() ? path : dirname(path)\n inputs.push(dir)\n\n const pkg = readFileSync(join(dir, 'package.json'))\n inputs.push(pkg)\n\n const head = tryReadFileSync(join(dir, '.git', 'HEAD'))\n if (head) {\n inputs.push(head)\n\n const packed = tryReadFileSync(join(dir, '.git', 'packed-refs'))\n if (packed) inputs.push(packed)\n\n const ref = git.tryGetRef(dir, head)\n if (ref) inputs.push(ref)\n\n const diff = git.tryGetDiff(dir)\n if (diff) inputs.push(diff)\n }\n}\n\nfunction computeHash (paths, pepper, salt) {\n const inputs = []\n if (pepper) inputs.push(pepper)\n\n if (typeof salt !== 'undefined') {\n if (Buffer.isBuffer(salt) || typeof salt === 'string') {\n inputs.push(salt)\n } else if (typeof salt === 'object' && salt !== null) {\n inputs.push(JSON.stringify(salt))\n } else {\n throw new TypeError('Salt must be an Array, Buffer, Object or string')\n }\n }\n\n for (let i = 0; i < paths.length; i++) {\n addPackageData(inputs, paths[i])\n }\n\n return md5hex(inputs)\n}\n\nlet ownHash = null\nexport function sync (paths, salt) {\n if (!ownHash) {\n // Memoize the hash for package-hash itself.\n ownHash = new Buffer(computeHash([__dirname]), 'hex')\n }\n\n if (paths === __dirname && typeof salt === 'undefined') {\n // Special case that allow the pepper value to be obtained. Mainly here for\n // testing purposes.\n return ownHash.toString('hex')\n }\n\n if (Array.isArray(paths)) {\n return computeHash(paths, ownHash, salt)\n } else {\n return computeHash([paths], ownHash, salt)\n }\n}\n"]}
\ No newline at end of file diff --git a/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/package.json b/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/package.json deleted file mode 100644 index 0ff36dedf..000000000 --- a/node_modules/@ava/babel-preset-stage-4/node_modules/package-hash/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "package-hash", - "version": "1.2.0", - "description": "Generates a hash for an installed npm package, useful for salting caches", - "main": "index.js", - "files": [ - "index.js", - "index.js.map" - ], - "scripts": { - "clean": "rimraf index.js index.js.map", - "prebuild": "npm run clean", - "build": "babel src --out-dir ./ --source-maps", - "prepublish": "npm run build", - "lint": "as-i-preach", - "unpack-fixtures": "node scripts/unpack-fixtures.js", - "pregenerate-fixture-index": "npm run unpack-fixtures", - "generate-fixture-index": "node scripts/generate-fixture-index.js", - "pretest": "npm run unpack-fixtures", - "test": "ava", - "posttest": "npm run lint", - "coverage": "nyc npm test", - "watch:build": "npm run build -- --watch", - "watch:test": "npm run test -- --watch" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/novemberborn/package-hash.git" - }, - "author": "Mark Wubben (https://novemberborn.net/)", - "license": "ISC", - "bugs": { - "url": "https://github.com/novemberborn/package-hash/issues" - }, - "homepage": "https://github.com/novemberborn/package-hash#readme", - "dependencies": { - "md5-hex": "^1.3.0" - }, - "devDependencies": { - "@novemberborn/as-i-preach": "^2.0.1", - "ava": "^0.14.0", - "babel-cli": "^6.7.5", - "babel-plugin-transform-es2015-block-scoping": "^6.7.1", - "babel-plugin-transform-es2015-modules-commonjs": "^6.7.4", - "babel-plugin-transform-es2015-shorthand-properties": "^6.5.0", - "babel-plugin-transform-object-assign": "^6.5.0", - "babel-plugin-transform-strict-mode": "^6.6.5", - "nyc": "^6.4.0", - "proxyquire": "^1.7.4", - "rimraf": "^2.5.2", - "tar": "^2.2.1" - }, - "babel": { - "plugins": [ - "transform-object-assign", - "transform-es2015-block-scoping", - "transform-es2015-modules-commonjs", - "transform-es2015-shorthand-properties", - "transform-strict-mode" - ] - }, - "nyc": { - "cache": true, - "exclude": [ - "scripts", - "test" - ], - "reporter": [ - "html", - "lcov", - "text" - ] - } -} diff --git a/node_modules/@ava/babel-preset-stage-4/package-hash.js b/node_modules/@ava/babel-preset-stage-4/package-hash.js deleted file mode 100644 index ed9e2969f..000000000 --- a/node_modules/@ava/babel-preset-stage-4/package-hash.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -const packageHash = require('package-hash'); - -const plugins = require('./plugins/best-match') - .map(module => require.resolve(`${module}/package.json`)); - -module.exports = packageHash.sync([require.resolve('./package.json')].concat(plugins)); diff --git a/node_modules/@ava/babel-preset-stage-4/package.json b/node_modules/@ava/babel-preset-stage-4/package.json deleted file mode 100644 index b9ea11af2..000000000 --- a/node_modules/@ava/babel-preset-stage-4/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "@ava/babel-preset-stage-4", - "version": "1.1.0", - "description": "Efficiently applies the minimum of transforms to run stage 4 code on Node.js 4, 6 and 8", - "license": "MIT", - "repository": "avajs/babel-preset-stage-4", - "author": "Mark Wubben (https://novemberborn.net)", - "publishConfig": { - "access": "public" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava", - "posttest": "xo", - "coverage": "nyc npm test" - }, - "files": [ - "index.js", - "package-hash.js", - "plugins" - ], - "keywords": [ - "ava", - "babel-preset" - ], - "dependencies": { - "babel-plugin-check-es2015-constants": "^6.8.0", - "babel-plugin-syntax-trailing-function-commas": "^6.20.0", - "babel-plugin-transform-async-to-generator": "^6.16.0", - "babel-plugin-transform-es2015-destructuring": "^6.19.0", - "babel-plugin-transform-es2015-function-name": "^6.9.0", - "babel-plugin-transform-es2015-modules-commonjs": "^6.18.0", - "babel-plugin-transform-es2015-parameters": "^6.21.0", - "babel-plugin-transform-es2015-spread": "^6.8.0", - "babel-plugin-transform-es2015-sticky-regex": "^6.8.0", - "babel-plugin-transform-es2015-unicode-regex": "^6.11.0", - "babel-plugin-transform-exponentiation-operator": "^6.8.0", - "package-hash": "^1.2.0" - }, - "devDependencies": { - "ava": "^0.17.0", - "coveralls": "^2.11.15", - "nyc": "^10.1.2", - "proxyquire": "^1.7.10", - "xo": "^0.17.1" - }, - "nyc": { - "reporter": [ - "html", - "lcov", - "text" - ] - } -} diff --git a/node_modules/@ava/babel-preset-stage-4/plugins/4.json b/node_modules/@ava/babel-preset-stage-4/plugins/4.json deleted file mode 100644 index fff34682a..000000000 --- a/node_modules/@ava/babel-preset-stage-4/plugins/4.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - "babel-plugin-check-es2015-constants", - "babel-plugin-syntax-trailing-function-commas", - "babel-plugin-transform-async-to-generator", - "babel-plugin-transform-es2015-destructuring", - "babel-plugin-transform-es2015-function-name", - "babel-plugin-transform-es2015-modules-commonjs", - "babel-plugin-transform-es2015-parameters", - "babel-plugin-transform-es2015-spread", - "babel-plugin-transform-es2015-sticky-regex", - "babel-plugin-transform-es2015-unicode-regex", - "babel-plugin-transform-exponentiation-operator" -] diff --git a/node_modules/@ava/babel-preset-stage-4/plugins/6.json b/node_modules/@ava/babel-preset-stage-4/plugins/6.json deleted file mode 100644 index ffd1f7601..000000000 --- a/node_modules/@ava/babel-preset-stage-4/plugins/6.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "babel-plugin-syntax-trailing-function-commas", - "babel-plugin-transform-async-to-generator", - "babel-plugin-transform-es2015-modules-commonjs", - "babel-plugin-transform-exponentiation-operator" -] diff --git a/node_modules/@ava/babel-preset-stage-4/plugins/8.json b/node_modules/@ava/babel-preset-stage-4/plugins/8.json deleted file mode 100644 index 2b6732560..000000000 --- a/node_modules/@ava/babel-preset-stage-4/plugins/8.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "babel-plugin-transform-es2015-modules-commonjs" -] diff --git a/node_modules/@ava/babel-preset-stage-4/plugins/best-match.js b/node_modules/@ava/babel-preset-stage-4/plugins/best-match.js deleted file mode 100644 index 89d459790..000000000 --- a/node_modules/@ava/babel-preset-stage-4/plugins/best-match.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; -/* eslint-disable import/no-dynamic-require, import/no-unresolved */ -const process = require('process'); - -function getClosestVersion() { - const version = parseFloat(process.versions.node); - if (version >= 8) { - return 8; - } - - if (version >= 6) { - return 6; - } - - // Node.js 4 is the minimal supported version. - return 4; -} - -module.exports = require(`./${getClosestVersion()}.json`); diff --git a/node_modules/@ava/babel-preset-stage-4/readme.md b/node_modules/@ava/babel-preset-stage-4/readme.md deleted file mode 100644 index 351cef0cd..000000000 --- a/node_modules/@ava/babel-preset-stage-4/readme.md +++ /dev/null @@ -1,30 +0,0 @@ -# @ava/babel-preset-stage-4 [](https://travis-ci.org/avajs/babel-preset-stage-4) - -> [Babel] preset for use with [AVA] - -Aspires to bring ECMAScript stage 4 proposals to AVA's test and helper files. - -Efficiently applies the minimum of transforms to run stage 4 code on Node.js 4, 6 and 8. - -Built-ins are not added or extended, so features like Proxies, `Array.prototype.includes` or `String.prototype.padStart` will only be available if the Node.js version running the tests supports it. Consult [node.green] for details. - -Sometimes a particular feature is *mostly* implemented in Node.js. In that case transforms are not applied. This applies to `new.target` and iterator closing, which are not supported in Node.js 4 even though classes and iterators are. - - -## Install - -```console -$ npm install --save @ava/babel-preset-stage-4 -``` - - -## Usage - -Add `@ava/stage-4` to your [Babel] presets. - -Require `@ava/babel-preset-stage-4/package-hash` to get a combined hash for the installed version of the preset, as well as the plugins that were selected for the active Node.js version. - - -[AVA]: https://ava.li -[Babel]: https://babeljs.io -[node.green]: http://node.green diff --git a/node_modules/@ava/babel-preset-transform-test-files/espower-patterns.json b/node_modules/@ava/babel-preset-transform-test-files/espower-patterns.json deleted file mode 100644 index 832309a5f..000000000 --- a/node_modules/@ava/babel-preset-transform-test-files/espower-patterns.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "t.truthy(value, [message])", - "t.falsy(value, [message])", - "t.true(value, [message])", - "t.false(value, [message])", - "t.regex(contents, regex, [message])", - "t.notRegex(contents, regex, [message])" -] diff --git a/node_modules/@ava/babel-preset-transform-test-files/index.js b/node_modules/@ava/babel-preset-transform-test-files/index.js deleted file mode 100644 index 7af76c7e1..000000000 --- a/node_modules/@ava/babel-preset-transform-test-files/index.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -const ESPOWER_PATTERNS = require('./espower-patterns.json'); - -module.exports = (context, options) => { - const plugins = []; - - if (!options || options.powerAssert !== false) { - plugins.push(require('babel-plugin-espower/create')(context, { - embedAst: true, - patterns: ESPOWER_PATTERNS - })); - } - - plugins.push(require('@ava/babel-plugin-throws-helper')); - - return {plugins}; -}; diff --git a/node_modules/@ava/babel-preset-transform-test-files/license b/node_modules/@ava/babel-preset-transform-test-files/license deleted file mode 100644 index 060edd7f2..000000000 --- a/node_modules/@ava/babel-preset-transform-test-files/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Mark Wubben <mark@novemberborn.net> (novemberborn.net) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/@ava/babel-preset-transform-test-files/package.json b/node_modules/@ava/babel-preset-transform-test-files/package.json deleted file mode 100644 index 6ce914164..000000000 --- a/node_modules/@ava/babel-preset-transform-test-files/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "@ava/babel-preset-transform-test-files", - "version": "3.0.0", - "description": "Babel preset for use with AVA test files", - "license": "MIT", - "repository": "avajs/babel-preset-transform-test-files", - "author": "Mark Wubben (https://novemberborn.net)", - "publishConfig": { - "access": "public" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava", - "posttest": "xo", - "coverage": "nyc npm test" - }, - "files": [ - "index.js", - "espower-patterns.json", - "package-hash.js" - ], - "keywords": [ - "ava", - "babel-preset" - ], - "dependencies": { - "@ava/babel-plugin-throws-helper": "^2.0.0", - "babel-plugin-espower": "^2.3.2" - }, - "devDependencies": { - "ava": "^0.18.2", - "babel-core": "^6.21.0", - "coveralls": "^2.11.15", - "empower-core": "^0.6.1", - "nyc": "^10.1.2", - "xo": "^0.18.1" - }, - "nyc": { - "reporter": [ - "html", - "lcov", - "text" - ] - } -} diff --git a/node_modules/@ava/babel-preset-transform-test-files/readme.md b/node_modules/@ava/babel-preset-transform-test-files/readme.md deleted file mode 100644 index eba6dc701..000000000 --- a/node_modules/@ava/babel-preset-transform-test-files/readme.md +++ /dev/null @@ -1,34 +0,0 @@ -# @ava/babel-preset-transform-test-files [](https://travis-ci.org/avajs/babel-preset-transform-test-files) - -> [Babel] preset for use with [AVA] test files - -Currently contains: - -- [`babel-plugin-espower`](https://github.com/power-assert-js/babel-plugin-espower) and the patterns that should be enhanced -- [`@ava/babel-plugin-throws-helper`](https://github.com/avajs/babel-plugin-throws-helper/) - - -## Install - -```console -$ npm install --save @ava/babel-preset-transform-test-files -``` - - -## Usage - -Add `@ava/transform-test-files` to your [Babel] presets. You can disable `babel-plugin-espower` by setting the `powerAssert` option to `false`: - -```json -{ - "presets": [ - ["@ava/transform-test-files", {"powerAsssert": false}] - ] -} -``` - -Require `@ava/babel-preset-transform-test-files/package-hash` to get a combined hash for the installed version of the preset, as well as the plugins used. - - -[AVA]: https://ava.li -[Babel]: https://babeljs.io diff --git a/node_modules/@ava/write-file-atomic/LICENSE b/node_modules/@ava/write-file-atomic/LICENSE deleted file mode 100644 index 95e65a770..000000000 --- a/node_modules/@ava/write-file-atomic/LICENSE +++ /dev/null @@ -1,6 +0,0 @@ -Copyright (c) 2015, Rebecca Turner - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - diff --git a/node_modules/@ava/write-file-atomic/README.md b/node_modules/@ava/write-file-atomic/README.md deleted file mode 100644 index d74b12710..000000000 --- a/node_modules/@ava/write-file-atomic/README.md +++ /dev/null @@ -1,54 +0,0 @@ -write-file-atomic ------------------ - -**Forked from https://github.com/npm/write-file-atomic to include https://github.com/npm/write-file-atomic/pull/25, for -use with [AVA](https://github.com/avajs/ava/).** - ---- - -This is an extension for node's `fs.writeFile` that makes its operation -atomic and allows you set ownership (uid/gid of the file). - -### var writeFileAtomic = require('write-file-atomic')<br>writeFileAtomic(filename, data, [options], callback) - -* filename **String** -* data **String** | **Buffer** -* options **Object** - * chown **Object** - * uid **Number** - * gid **Number** - * encoding **String** | **Null** default = 'utf8' - * fsync **Boolean** default = true - * mode **Number** default = 438 (aka 0666 in Octal) -callback **Function** - -Atomically and asynchronously writes data to a file, replacing the file if it already -exists. data can be a string or a buffer. - -The file is initially named `filename + "." + murmurhex(__filename, process.pid, ++invocations)`. -If writeFile completes successfully then, if passed the **chown** option it will change -the ownership of the file. Finally it renames the file back to the filename you specified. If -it encounters errors at any of these steps it will attempt to unlink the temporary file and then -pass the error back to the caller. - -If provided, the **chown** option requires both **uid** and **gid** properties or else -you'll get an error. - -The **encoding** option is ignored if **data** is a buffer. It defaults to 'utf8'. - -If the **fsync** option is **false**, writeFile will skip the final fsync call. - -The callback is always invoked with the initial (temporary) filename. - -Example: - -```javascript -writeFileAtomic('message.txt', 'Hello Node', {chown:{uid:100,gid:50}}, function (err) { - if (err) throw err; - console.log('It\'s saved!'); -}); -``` - -### var writeFileAtomicSync = require('write-file-atomic').sync<br>writeFileAtomicSync(filename, data, [options]) - -The synchronous version of **writeFileAtomic**. Returns the initial (temporary) filename. diff --git a/node_modules/@ava/write-file-atomic/index.js b/node_modules/@ava/write-file-atomic/index.js deleted file mode 100644 index 647280670..000000000 --- a/node_modules/@ava/write-file-atomic/index.js +++ /dev/null @@ -1,135 +0,0 @@ -'use strict' -module.exports = writeFile -module.exports.sync = writeFileSync -module.exports._getTmpname = getTmpname // for testing - -var fs = require('graceful-fs') -var chain = require('slide').chain -var MurmurHash3 = require('imurmurhash') - -var invocations = 0 -function getTmpname (filename) { - return filename + '.' + - MurmurHash3(__filename) - .hash(String(process.pid)) - .hash(String(++invocations)) - .result() -} - -function writeFile (filename, data, options, callback) { - if (options instanceof Function) { - callback = options - options = null - } - if (!options) options = {} - fs.realpath(filename, function (_, realname) { - _writeFile(realname || filename, data, options, callback) - }) -} -function _writeFile (filename, data, options, callback) { - var tmpfile = getTmpname(filename) - - if (options.mode && options.chown) { - return thenWriteFile() - } else { - // Either mode or chown is not explicitly set - // Default behavior is to copy it from original file - return fs.stat(filename, function (err, stats) { - if (err || !stats) return thenWriteFile() - - options = Object.assign({}, options) - if (!options.mode) { - options.mode = stats.mode - } - if (!options.chown && process.getuid) { - options.chown = { uid: stats.uid, gid: stats.gid } - } - return thenWriteFile() - }) - } - - function thenWriteFile () { - chain([ - [writeFileAsync, tmpfile, data, options.mode, options.encoding || 'utf8'], - options.chown && [fs, fs.chown, tmpfile, options.chown.uid, options.chown.gid], - options.mode && [fs, fs.chmod, tmpfile, options.mode], - [fs, fs.rename, tmpfile, filename] - ], function (err) { - err ? fs.unlink(tmpfile, function () { callback(err, tmpfile) }) - : callback(null, tmpfile) - }) - } - - // doing this instead of `fs.writeFile` in order to get the ability to - // call `fsync`. - function writeFileAsync (file, data, mode, encoding, cb) { - fs.open(file, 'w', options.mode, function (err, fd) { - if (err) return cb(err) - if (Buffer.isBuffer(data)) { - return fs.write(fd, data, 0, data.length, 0, syncAndClose) - } else if (data != null) { - return fs.write(fd, String(data), 0, String(encoding), syncAndClose) - } else { - return syncAndClose() - } - function syncAndClose (err) { - if (err) return cb(err) - if (options.fsync !== false) { - fs.fsync(fd, function (err) { - if (err) return cb(err) - fs.close(fd, cb) - }) - } else { - fs.close(fd, cb) - } - } - }) - } -} - -function writeFileSync (filename, data, options) { - if (!options) options = {} - try { - filename = fs.realpathSync(filename) - } catch (ex) { - // it's ok, it'll happen on a not yet existing file - } - var tmpfile = getTmpname(filename) - - try { - if (!options.mode || !options.chown) { - // Either mode or chown is not explicitly set - // Default behavior is to copy it from original file - try { - var stats = fs.statSync(filename) - options = Object.assign({}, options) - if (!options.mode) { - options.mode = stats.mode - } - if (!options.chown && process.getuid) { - options.chown = { uid: stats.uid, gid: stats.gid } - } - } catch (ex) { - // ignore stat errors - } - } - - var fd = fs.openSync(tmpfile, 'w', options.mode) - if (Buffer.isBuffer(data)) { - fs.writeSync(fd, data, 0, data.length, 0) - } else if (data != null) { - fs.writeSync(fd, String(data), 0, String(options.encoding || 'utf8')) - } - if (options.fsync !== false) { - fs.fsyncSync(fd) - } - fs.closeSync(fd) - if (options.chown) fs.chownSync(tmpfile, options.chown.uid, options.chown.gid) - if (options.mode) fs.chmodSync(tmpfile, options.mode) - fs.renameSync(tmpfile, filename) - return tmpfile - } catch (err) { - try { fs.unlinkSync(tmpfile) } catch (e) {} - throw err - } -} diff --git a/node_modules/@ava/write-file-atomic/package.json b/node_modules/@ava/write-file-atomic/package.json deleted file mode 100644 index 87b1d0e6c..000000000 --- a/node_modules/@ava/write-file-atomic/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@ava/write-file-atomic", - "version": "2.2.0", - "description": "Write files in an atomic fashion w/configurable ownership", - "main": "index.js", - "scripts": { - "test": "standard && tap --100 test/*.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/avajs/write-file-atomic" - }, - "keywords": [ - "writeFile", - "atomic" - ], - "author": "Rebecca Turner <me@re-becca.org> (http://re-becca.org)", - "license": "ISC", - "bugs": { - "url": "https://github.com/iarna/write-file-atomic/issues" - }, - "homepage": "https://github.com/iarna/write-file-atomic", - "dependencies": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "slide": "^1.1.5" - }, - "devDependencies": { - "mkdirp": "^0.5.1", - "require-inject": "^1.4.0", - "rimraf": "^2.5.4", - "standard": "^10.0.2", - "tap": "^10.3.2" - }, - "files": [ - "index.js" - ] -} |