summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/libcipm/node_modules
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/libcipm/node_modules')
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/lock-verify/LICENSE13
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/lock-verify/README.md44
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/lock-verify/index.js73
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/LICENSE15
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/README.md81
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/npa.js270
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/package.json64
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/lock-verify/package.json64
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/CHANGELOG.md46
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/LICENSE.md16
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/README.md147
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/index.js192
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/package.json83
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/CHANGELOG.md55
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/LICENSE20
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/README.md346
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/index.js349
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/CHANGELOG.md36
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/README.md223
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/genfun.js296
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/method.js86
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/role.js17
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/util.js37
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/package.json79
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/protoduck/package.json88
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/.travis.yml12
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/LICENSE.md13
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/README.md144
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/basic/child.js5
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/basic/index.js13
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/pi/calc.js22
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/pi/index.js41
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/index.d.ts44
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/child/index.js52
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/farm.js339
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/fork.js32
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/index.js34
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/.travis.yml11
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/README.md145
-rwxr-xr-xdeps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/build.js43
-rwxr-xr-xdeps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/cli.js22
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/custom.js57
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/errno.js313
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.npmignore1
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.travis.yml10
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE.md11
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/README.md47
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/package.json58
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/prr.js63
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/test.js169
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/package.json62
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/test.js88
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/.npmignore1
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/LICENCE19
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/Makefile4
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/README.md32
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/immutable.js19
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/mutable.js17
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/package.json86
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/test.js83
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/package.json60
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/child.js85
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/debug.js11
-rw-r--r--deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/index.js541
64 files changed, 5549 insertions, 0 deletions
diff --git a/deps/npm/node_modules/libcipm/node_modules/lock-verify/LICENSE b/deps/npm/node_modules/libcipm/node_modules/lock-verify/LICENSE
new file mode 100644
index 0000000000..e0040f6659
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/lock-verify/LICENSE
@@ -0,0 +1,13 @@
+Copyright (c) 2017, Rebecca Turner <me@re-becca.org>
+
+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/deps/npm/node_modules/libcipm/node_modules/lock-verify/README.md b/deps/npm/node_modules/libcipm/node_modules/lock-verify/README.md
new file mode 100644
index 0000000000..e9466f0a64
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/lock-verify/README.md
@@ -0,0 +1,44 @@
+# lock-verify
+
+Report if your package.json is out of sync with your package-lock.json.
+
+## USAGE
+
+Call it with no arguments to verify the current project's lock file. Errors
+are printed out to stdout and the status code set to 1.
+
+```
+$ npx lock-verify
+Invalid: lock file's example@2.1.0 does not satisfy example@^1.1.0
+Errors found
+$
+```
+
+
+Call it with a path to a project to verify that project's lock file. If there
+are no errors, it prints nothing and the status code is 0.
+
+
+```
+$ npx lock-verify /path/to/my/project
+$
+```
+
+## OR AS A LIBRARY
+
+```
+const lockVerify = require('lock-verify')
+lockVerify(moduleDir).then(result => {
+ result.warnings.forEach(w => console.error('Warning:', w))
+ if (!result.status) {
+ result.errors.forEach(e => console.error(e))
+ process.exit(1)
+ }
+})
+```
+
+As a library it's a function that takes the path to a module and returns a
+promise that resolves to an object with `.status`, `.warnings` and `.errors`
+properties. The first will be true if everything was ok (though warnings
+may exist). If there's no `package.json` or no lockfile in `moduleDir` or they're
+unreadable then the promise will be rejected.
diff --git a/deps/npm/node_modules/libcipm/node_modules/lock-verify/index.js b/deps/npm/node_modules/libcipm/node_modules/lock-verify/index.js
new file mode 100644
index 0000000000..2272132913
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/lock-verify/index.js
@@ -0,0 +1,73 @@
+'use strict'
+module.exports = lockVerify
+
+const fs = require('fs')
+const path = require('path')
+const npa = require('npm-package-arg')
+const semver = require('semver')
+
+function lockVerify(check) {
+ if (!check) check = '.'
+
+ const pjson = readJson(`${check}/package.json`)
+ let plock = readJson(`${check}/npm-shrinkwrap.json`)
+ .catch(() => readJson(`${check}/package-lock.json`))
+
+ return Promise.all([pjson, plock]).then(result => {
+ const pjson = result[0]
+ const plock = result[1]
+ let warnings = []
+ let errors = []
+ for (let type of [['dependencies'], ['devDependencies'], ['optionalDependencies', true]]) {
+ const deps = pjson[type[0]]
+ if (!deps) continue
+ const isOptional = type[1]
+ Object.keys(deps).forEach(name => {
+ const spec = npa.resolve(name, deps[name])
+ const lock = plock.dependencies[name]
+ if (!lock) {
+ if (isOptional) {
+ warnings.push('Optional missing: ' + name + '@' + deps[name])
+ } else {
+ errors.push('Missing: ' + name + '@' + deps[name])
+ }
+ return
+ }
+ if (spec.registry) {
+ // Can't match tags to package-lock w/o network
+ if (spec.type === 'tag') return
+ if (!semver.satisfies(lock.version, spec.fetchSpec)) {
+ errors.push("Invalid: lock file's " + name + '@' + lock.version + ' does not satisfy ' + name + '@' + spec.fetchSpec)
+ return
+ }
+ } else if (spec.type === 'git') {
+ // can't verify git w/o network
+ return
+ } else if (spec.type === 'remote') {
+ if (lock.version !== spec.fetchSpec) {
+ errors.push("Invalid: lock file's " + name + '@' + lock.version + ' does not satisfy ' + name + '@' + spec.fetchSpec)
+ return
+ }
+ } else if (spec.type === 'file' || spec.type === 'directory') {
+ const lockSpec = npa.resolve(name, lock.version)
+ if (spec.fetchSpec !== lockSpec.fetchSpec) {
+ errors.push("Invalid: lock file's " + name + '@' + lock.version + ' does not satisfy ' + name + '@' + deps[name])
+ return
+ }
+ } else {
+ console.log(spec)
+ }
+ })
+ }
+ return Promise.resolve({status: errors.length === 0, warnings: warnings, errors: errors})
+ })
+}
+
+function readJson (file) {
+ return new Promise((resolve, reject) => {
+ fs.readFile(file, (err, content) => {
+ if (err) return reject(err)
+ return resolve(JSON.parse(content))
+ })
+ })
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/LICENSE b/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/LICENSE
new file mode 100644
index 0000000000..05eeeb88c2
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/LICENSE
@@ -0,0 +1,15 @@
+The ISC License
+
+Copyright (c) Isaac Z. Schlueter
+
+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/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/README.md b/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/README.md
new file mode 100644
index 0000000000..d45032dc74
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/README.md
@@ -0,0 +1,81 @@
+# npm-package-arg
+
+Parses package name and specifier passed to commands like `npm install` or
+`npm cache add`, or as found in `package.json` dependency sections.
+
+## EXAMPLES
+
+```javascript
+var assert = require("assert")
+var npa = require("npm-package-arg")
+
+// Pass in the descriptor, and it'll return an object
+try {
+ var parsed = npa("@bar/foo@1.2")
+} catch (ex) {
+ …
+}
+```
+
+## USING
+
+`var npa = require('npm-package-arg')`
+
+### var result = npa(*arg*[, *where*])
+
+* *arg* - a string that you might pass to `npm install`, like:
+`foo@1.2`, `@bar/foo@1.2`, `foo@user/foo`, `http://x.com/foo.tgz`,
+`git+https://github.com/user/foo`, `bitbucket:user/foo`, `foo.tar.gz`,
+`../foo/bar/` or `bar`. If the *arg* you provide doesn't have a specifier
+part, eg `foo` then the specifier will default to `latest`.
+* *where* - Optionally the path to resolve file paths relative to. Defaults to `process.cwd()`
+
+**Throws** if the package name is invalid, a dist-tag is invalid or a URL's protocol is not supported.
+
+### var result = npa.resolve(*name*, *spec*[, *where*])
+
+* *name* - The name of the module you want to install. For example: `foo` or `@bar/foo`.
+* *spec* - The specifier indicating where and how you can get this module. Something like:
+`1.2`, `^1.7.17`, `http://x.com/foo.tgz`, `git+https://github.com/user/foo`,
+`bitbucket:user/foo`, `file:foo.tar.gz` or `file:../foo/bar/`. If not
+included then the default is `latest`.
+* *where* - Optionally the path to resolve file paths relative to. Defaults to `process.cwd()`
+
+**Throws** if the package name is invalid, a dist-tag is invalid or a URL's protocol is not supported.
+
+## RESULT OBJECT
+
+The objects that are returned by npm-package-arg contain the following
+keys:
+
+* `type` - One of the following strings:
+ * `git` - A git repo
+ * `tag` - A tagged version, like `"foo@latest"`
+ * `version` - A specific version number, like `"foo@1.2.3"`
+ * `range` - A version range, like `"foo@2.x"`
+ * `file` - A local `.tar.gz`, `.tar` or `.tgz` file.
+ * `directory` - A local directory.
+ * `remote` - An http url (presumably to a tgz)
+* `registry` - If true this specifier refers to a resource hosted on a
+ registry. This is true for `tag`, `version` and `range` types.
+* `name` - If known, the `name` field expected in the resulting pkg.
+* `scope` - If a name is something like `@org/module` then the `scope`
+ field will be set to `@org`. If it doesn't have a scoped name, then
+ scope is `null`.
+* `escapedName` - A version of `name` escaped to match the npm scoped packages
+ specification. Mostly used when making requests against a registry. When
+ `name` is `null`, `escapedName` will also be `null`.
+* `rawSpec` - The specifier part that was parsed out in calls to `npa(arg)`,
+ or the value of `spec` in calls to `npa.resolve(name, spec).
+* `saveSpec` - The normalized specifier, for saving to package.json files.
+ `null` for registry dependencies.
+* `fetchSpec` - The version of the specifier to be used to fetch this
+ resource. `null` for shortcuts to hosted git dependencies as there isn't
+ just one URL to try with them.
+* `gitRange` - If set, this is a semver specifier to match against git tags with
+* `gitCommittish` - If set, this is the specific committish to use with a git dependency.
+* `hosted` - If `from === 'hosted'` then this will be a `hosted-git-info`
+ object. This property is not included when serializing the object as
+ JSON.
+* `raw` - The original un-modified string that was provided. If called as
+ `npa.resolve(name, spec)` then this will be `name + '@' + spec`.
diff --git a/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/npa.js b/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/npa.js
new file mode 100644
index 0000000000..a61c057429
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/npa.js
@@ -0,0 +1,270 @@
+'use strict'
+module.exports = npa
+module.exports.resolve = resolve
+module.exports.Result = Result
+
+let url
+let HostedGit
+let semver
+let path
+let validatePackageName
+let osenv
+
+const isWindows = process.platform === 'win32' || global.FAKE_WINDOWS
+const hasSlashes = isWindows ? /\\|[/]/ : /[/]/
+const isURL = /^(?:git[+])?[a-z]+:/i
+const isFilename = /[.](?:tgz|tar.gz|tar)$/i
+
+function npa (arg, where) {
+ let name
+ let spec
+ const nameEndsAt = arg[0] === '@' ? arg.slice(1).indexOf('@') + 1 : arg.indexOf('@')
+ const namePart = nameEndsAt > 0 ? arg.slice(0, nameEndsAt) : arg
+ if (isURL.test(arg)) {
+ spec = arg
+ } else if (namePart[0] !== '@' && (hasSlashes.test(namePart) || isFilename.test(namePart))) {
+ spec = arg
+ } else if (nameEndsAt > 0) {
+ name = namePart
+ spec = arg.slice(nameEndsAt + 1)
+ } else {
+ if (!validatePackageName) validatePackageName = require('validate-npm-package-name')
+ const valid = validatePackageName(arg)
+ if (valid.validForOldPackages) {
+ name = arg
+ } else {
+ spec = arg
+ }
+ }
+ return resolve(name, spec, where, arg)
+}
+
+const isFilespec = isWindows ? /^(?:[.]|~[/]|[/\\]|[a-zA-Z]:)/ : /^(?:[.]|~[/]|[/]|[a-zA-Z]:)/
+
+function resolve (name, spec, where, arg) {
+ const res = new Result({
+ raw: arg,
+ name: name,
+ rawSpec: spec,
+ fromArgument: arg != null
+ })
+
+ if (name) res.setName(name)
+
+ if (spec && (isFilespec.test(spec) || /^file:/i.test(spec))) {
+ return fromFile(res, where)
+ }
+ if (!HostedGit) HostedGit = require('hosted-git-info')
+ const hosted = HostedGit.fromUrl(spec, {noGitPlus: true, noCommittish: true})
+ if (hosted) {
+ return fromHostedGit(res, hosted)
+ } else if (spec && isURL.test(spec)) {
+ return fromURL(res)
+ } else if (spec && (hasSlashes.test(spec) || isFilename.test(spec))) {
+ return fromFile(res, where)
+ } else {
+ return fromRegistry(res)
+ }
+}
+
+function invalidPackageName (name, valid) {
+ const err = new Error(`Invalid package name "${name}": ${valid.errors.join('; ')}`)
+ err.code = 'EINVALIDPACKAGENAME'
+ return err
+}
+function invalidTagName (name) {
+ const err = new Error(`Invalid tag name "${name}": Tags may not have any characters that encodeURIComponent encodes.`)
+ err.code = 'EINVALIDTAGNAME'
+ return err
+}
+
+function Result (opts) {
+ this.type = opts.type
+ this.registry = opts.registry
+ this.where = opts.where
+ if (opts.raw == null) {
+ this.raw = opts.name ? opts.name + '@' + opts.rawSpec : opts.rawSpec
+ } else {
+ this.raw = opts.raw
+ }
+ this.name = undefined
+ this.escapedName = undefined
+ this.scope = undefined
+ this.rawSpec = opts.rawSpec == null ? '' : opts.rawSpec
+ this.saveSpec = opts.saveSpec
+ this.fetchSpec = opts.fetchSpec
+ if (opts.name) this.setName(opts.name)
+ this.gitRange = opts.gitRange
+ this.gitCommittish = opts.gitCommittish
+ this.hosted = opts.hosted
+}
+Result.prototype = {}
+
+Result.prototype.setName = function (name) {
+ if (!validatePackageName) validatePackageName = require('validate-npm-package-name')
+ const valid = validatePackageName(name)
+ if (!valid.validForOldPackages) {
+ throw invalidPackageName(name, valid)
+ }
+ this.name = name
+ this.scope = name[0] === '@' ? name.slice(0, name.indexOf('/')) : undefined
+ // scoped packages in couch must have slash url-encoded, e.g. @foo%2Fbar
+ this.escapedName = name.replace('/', '%2f')
+ return this
+}
+
+Result.prototype.toString = function () {
+ const full = []
+ if (this.name != null && this.name !== '') full.push(this.name)
+ const spec = this.saveSpec || this.fetchSpec || this.rawSpec
+ if (spec != null && spec !== '') full.push(spec)
+ return full.length ? full.join('@') : this.raw
+}
+
+Result.prototype.toJSON = function () {
+ const result = Object.assign({}, this)
+ delete result.hosted
+ return result
+}
+
+function setGitCommittish (res, committish) {
+ if (committish != null && committish.length >= 7 && committish.slice(0, 7) === 'semver:') {
+ res.gitRange = decodeURIComponent(committish.slice(7))
+ res.gitCommittish = null
+ } else if (committish == null || committish === '') {
+ res.gitCommittish = 'master'
+ } else {
+ res.gitCommittish = committish
+ }
+ return res
+}
+
+const isAbsolutePath = /^[/]|^[A-Za-z]:/
+
+function resolvePath (where, spec) {
+ if (isAbsolutePath.test(spec)) return spec
+ if (!path) path = require('path')
+ return path.resolve(where, spec)
+}
+
+function isAbsolute (dir) {
+ if (dir[0] === '/') return true
+ if (/^[A-Za-z]:/.test(dir)) return true
+ return false
+}
+
+function fromFile (res, where) {
+ if (!where) where = process.cwd()
+ res.type = isFilename.test(res.rawSpec) ? 'file' : 'directory'
+ res.where = where
+
+ const spec = res.rawSpec.replace(/\\/g, '/')
+ .replace(/^file:[/]*([A-Za-z]:)/, '$1') // drive name paths on windows
+ .replace(/^file:(?:[/]*([~./]))?/, '$1')
+ if (/^~[/]/.test(spec)) {
+ // this is needed for windows and for file:~/foo/bar
+ if (!osenv) osenv = require('osenv')
+ res.fetchSpec = resolvePath(osenv.home(), spec.slice(2))
+ res.saveSpec = 'file:' + spec
+ } else {
+ res.fetchSpec = resolvePath(where, spec)
+ if (isAbsolute(spec)) {
+ res.saveSpec = 'file:' + spec
+ } else {
+ if (!path) path = require('path')
+ res.saveSpec = 'file:' + path.relative(where, res.fetchSpec)
+ }
+ }
+ return res
+}
+
+function fromHostedGit (res, hosted) {
+ res.type = 'git'
+ res.hosted = hosted
+ res.saveSpec = hosted.toString({noGitPlus: false, noCommittish: false})
+ res.fetchSpec = hosted.getDefaultRepresentation() === 'shortcut' ? null : hosted.toString()
+ return setGitCommittish(res, hosted.committish)
+}
+
+function unsupportedURLType (protocol, spec) {
+ const err = new Error(`Unsupported URL Type "${protocol}": ${spec}`)
+ err.code = 'EUNSUPPORTEDPROTOCOL'
+ return err
+}
+
+function matchGitScp (spec) {
+ // git ssh specifiers are overloaded to also use scp-style git
+ // specifiers, so we have to parse those out and treat them special.
+ // They are NOT true URIs, so we can't hand them to `url.parse`.
+ //
+ // This regex looks for things that look like:
+ // git+ssh://git@my.custom.git.com:username/project.git#deadbeef
+ //
+ // ...and various combinations. The username in the beginning is *required*.
+ const matched = spec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i)
+ return matched && !matched[1].match(/:[0-9]+\/?.*$/i) && {
+ fetchSpec: matched[1],
+ gitCommittish: matched[2] || 'master'
+ }
+}
+
+function fromURL (res) {
+ if (!url) url = require('url')
+ const urlparse = url.parse(res.rawSpec)
+ res.saveSpec = res.rawSpec
+ // check the protocol, and then see if it's git or not
+ switch (urlparse.protocol) {
+ case 'git:':
+ case 'git+http:':
+ case 'git+https:':
+ case 'git+rsync:':
+ case 'git+ftp:':
+ case 'git+file:':
+ case 'git+ssh:':
+ res.type = 'git'
+ const match = urlparse.protocol === 'git+ssh:' && matchGitScp(res.rawSpec)
+ if (match) {
+ res.fetchSpec = match.fetchSpec
+ res.gitCommittish = match.gitCommittish
+ } else {
+ setGitCommittish(res, urlparse.hash != null ? urlparse.hash.slice(1) : '')
+ urlparse.protocol = urlparse.protocol.replace(/^git[+]/, '')
+ delete urlparse.hash
+ res.fetchSpec = url.format(urlparse)
+ }
+ break
+ case 'http:':
+ case 'https:':
+ res.type = 'remote'
+ res.fetchSpec = res.saveSpec
+ break
+
+ default:
+ throw unsupportedURLType(urlparse.protocol, res.rawSpec)
+ }
+
+ return res
+}
+
+function fromRegistry (res) {
+ res.registry = true
+ const spec = res.rawSpec === '' ? 'latest' : res.rawSpec
+ // no save spec for registry components as we save based on the fetched
+ // version, not on the argument so this can't compute that.
+ res.saveSpec = null
+ res.fetchSpec = spec
+ if (!semver) semver = require('semver')
+ const version = semver.valid(spec, true)
+ const range = semver.validRange(spec, true)
+ if (version) {
+ res.type = 'version'
+ } else if (range) {
+ res.type = 'range'
+ } else {
+ if (encodeURIComponent(spec) !== spec) {
+ throw invalidTagName(spec)
+ }
+ res.type = 'tag'
+ }
+ return res
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/package.json b/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/package.json
new file mode 100644
index 0000000000..8e046f0813
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/lock-verify/node_modules/npm-package-arg/package.json
@@ -0,0 +1,64 @@
+{
+ "_from": "npm-package-arg@^5.1.2",
+ "_id": "npm-package-arg@5.1.2",
+ "_inBundle": false,
+ "_integrity": "sha512-wJBsrf0qpypPT7A0LART18hCdyhpCMxeTtcb0X4IZO2jsP6Om7EHN1d9KSKiqD+KVH030RVNpWS9thk+pb7wzA==",
+ "_location": "/libcipm/lock-verify/npm-package-arg",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "npm-package-arg@^5.1.2",
+ "name": "npm-package-arg",
+ "escapedName": "npm-package-arg",
+ "rawSpec": "^5.1.2",
+ "saveSpec": null,
+ "fetchSpec": "^5.1.2"
+ },
+ "_requiredBy": [
+ "/libcipm/lock-verify"
+ ],
+ "_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-5.1.2.tgz",
+ "_shasum": "fb18d17bb61e60900d6312619919bd753755ab37",
+ "_spec": "npm-package-arg@^5.1.2",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/libcipm/node_modules/lock-verify",
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me",
+ "url": "http://blog.izs.me/"
+ },
+ "bugs": {
+ "url": "https://github.com/npm/npm-package-arg/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "hosted-git-info": "^2.4.2",
+ "osenv": "^0.1.4",
+ "semver": "^5.1.0",
+ "validate-npm-package-name": "^3.0.0"
+ },
+ "deprecated": false,
+ "description": "Parse the things that can be arguments to `npm install`",
+ "devDependencies": {
+ "standard": "9.0.2",
+ "tap": "^10.3.0"
+ },
+ "directories": {
+ "test": "test"
+ },
+ "files": [
+ "npa.js"
+ ],
+ "homepage": "https://github.com/npm/npm-package-arg",
+ "license": "ISC",
+ "main": "npa.js",
+ "name": "npm-package-arg",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/npm/npm-package-arg.git"
+ },
+ "scripts": {
+ "test": "standard && tap -J --coverage test/*.js"
+ },
+ "version": "5.1.2"
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/lock-verify/package.json b/deps/npm/node_modules/libcipm/node_modules/lock-verify/package.json
new file mode 100644
index 0000000000..ee25a30710
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/lock-verify/package.json
@@ -0,0 +1,64 @@
+{
+ "_from": "lock-verify@^2.0.0",
+ "_id": "lock-verify@2.0.0",
+ "_inBundle": false,
+ "_integrity": "sha512-ZK+fx1rQBBvyRp12tPgKaMrKlxv+72hO+QCAvdW8BGwKx/Jn3wVD7GooG2ftF80W29hfj+R1o0tTI8m6/pl1Mw==",
+ "_location": "/libcipm/lock-verify",
+ "_phantomChildren": {
+ "hosted-git-info": "2.5.0",
+ "osenv": "0.1.4",
+ "semver": "5.4.1",
+ "validate-npm-package-name": "3.0.0"
+ },
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "lock-verify@^2.0.0",
+ "name": "lock-verify",
+ "escapedName": "lock-verify",
+ "rawSpec": "^2.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^2.0.0"
+ },
+ "_requiredBy": [
+ "/libcipm"
+ ],
+ "_resolved": "https://registry.npmjs.org/lock-verify/-/lock-verify-2.0.0.tgz",
+ "_shasum": "0c957bd542aeae19272408b066b0cad819410452",
+ "_spec": "lock-verify@^2.0.0",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/libcipm",
+ "author": {
+ "name": "Rebecca Turner",
+ "email": "me@re-becca.org",
+ "url": "http://re-becca.org/"
+ },
+ "bugs": {
+ "url": "https://github.com/iarna/lock-verify/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "npm-package-arg": "^5.1.2",
+ "semver": "^5.4.1"
+ },
+ "deprecated": false,
+ "description": "Report if your package.json is out of sync with your package-lock.json.",
+ "devDependencies": {
+ "@iarna/cli": "^1.2.0"
+ },
+ "files": [
+ "index.js"
+ ],
+ "homepage": "https://github.com/iarna/lock-verify#readme",
+ "keywords": [],
+ "license": "ISC",
+ "main": "index.js",
+ "name": "lock-verify",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/iarna/lock-verify.git"
+ },
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "version": "2.0.0"
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/CHANGELOG.md b/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/CHANGELOG.md
new file mode 100644
index 0000000000..1a9b371161
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/CHANGELOG.md
@@ -0,0 +1,46 @@
+# Change Log
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+<a name="1.2.1"></a>
+## [1.2.1](https://github.com/npm/logical-tree/compare/v1.2.0...v1.2.1) (2018-01-19)
+
+
+### Bug Fixes
+
+* **requires:** stop requiring version match -- only what require would pick up ([6388fbd](https://github.com/npm/logical-tree/commit/6388fbd))
+
+
+
+<a name="1.2.0"></a>
+# [1.2.0](https://github.com/npm/logical-tree/compare/v1.1.0...v1.2.0) (2017-10-13)
+
+
+### Bug Fixes
+
+* **json:** fix repository url ([e51448a](https://github.com/npm/logical-tree/commit/e51448a))
+
+
+### Features
+
+* **api:** additional utility functions for dealing with trees ([23f6e69](https://github.com/npm/logical-tree/commit/23f6e69))
+
+
+
+<a name="1.1.0"></a>
+# [1.1.0](https://github.com/npm/npm-logical-tree/compare/v1.0.0...v1.1.0) (2017-10-11)
+
+
+### Features
+
+* **requiredBy:** add requiredBy field to nodes ([c4056fb](https://github.com/npm/npm-logical-tree/commit/c4056fb))
+
+
+
+<a name="1.0.0"></a>
+# 1.0.0 (2017-10-07)
+
+
+### Features
+
+* **api:** Initial Commit™ ([1025259](https://github.com/npm/npm-logical-tree/commit/1025259))
diff --git a/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/LICENSE.md b/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/LICENSE.md
new file mode 100644
index 0000000000..8d28acf866
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/LICENSE.md
@@ -0,0 +1,16 @@
+ISC License
+
+Copyright (c) npm, Inc.
+
+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 COPYRIGHT HOLDER DISCLAIMS
+ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER 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/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/README.md b/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/README.md
new file mode 100644
index 0000000000..33260d9f2a
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/README.md
@@ -0,0 +1,147 @@
+# npm-logical-tree [![npm version](https://img.shields.io/npm/v/npm-logical-tree.svg)](https://npm.im/npm-logical-tree) [![license](https://img.shields.io/npm/l/npm-logical-tree.svg)](https://npm.im/npm-logical-tree) [![Travis](https://img.shields.io/travis/npm/logical-tree.svg)](https://travis-ci.org/npm/logical-tree) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/npm/logical-tree?svg=true)](https://ci.appveyor.com/project/npm/logical-tree) [![Coverage Status](https://coveralls.io/repos/github/npm/logical-tree/badge.svg?branch=latest)](https://coveralls.io/github/npm/logical-tree?branch=latest)
+
+[`npm-logical-tree`](https://github.com/npm/npm-logical-tree) is a Node.js
+library that takes the contents of a `package.json` and `package-lock.json` (or
+`npm-shrinkwrap.json`) and returns a nested tree data structure representing the
+logical relationships between the different dependencies.
+
+## Install
+
+`$ npm install npm-logical-tree`
+
+## Table of Contents
+
+* [Example](#example)
+* [Contributing](#contributing)
+* [API](#api)
+ * [`logicalTree`](#logical-tree)
+ * [`logicalTree.node`](#make-node)
+ * [`tree.isRoot`](#is-root)
+ * [`tree.addDep`](#add-dep)
+ * [`tree.delDep`](#del-dep)
+ * [`tree.getDep`](#get-dep)
+ * [`tree.path`](#path)
+ * [`tree.hasCycle`](#has-cycle)
+ * [`tree.forEach`](#for-each)
+ * [`tree.forEachAsync`](#for-each-async)
+
+### Example
+
+```javascript
+const fs = require('fs')
+const logicalTree = require('npm-logical-tree')
+
+const pkg = require('./package.json')
+const pkgLock = require('./package-lock.json')
+
+logicalTree(pkg, pkgLock)
+// returns:
+LogicalTree {
+ name: 'npm-logical-tree',
+ version: '1.0.0',
+ address: null,
+ optional: false,
+ dev: false,
+ bundled: false,
+ resolved: undefined,
+ integrity: undefined,
+ requiredBy: Set { },
+ dependencies:
+ Map {
+ 'foo' => LogicalTree {
+ name: 'foo',
+ version: '1.2.3',
+ address: 'foo',
+ optional: false,
+ dev: true,
+ bundled: false,
+ resolved: 'https://registry.npmjs.org/foo/-/foo-1.2.3.tgz',
+ integrity: 'sha1-rYUK/p261/SXByi0suR/7Rw4chw=',
+ dependencies: Map { ... },
+ requiredBy: Set { ... },
+ },
+ ...
+ }
+}
+```
+
+### Contributing
+
+The npm team enthusiastically welcomes contributions and project participation!
+There's a bunch of things you can do if you want to contribute! The [Contributor
+Guide](CONTRIBUTING.md) has all the information you need for everything from
+reporting bugs to contributing entire new features. Please don't hesitate to
+jump in if you'd like to, or even ask us questions if something isn't clear.
+
+All participants and maintainers in this project are expected to follow [Code of
+Conduct](CODE_OF_CONDUCT.md), and just generally be excellent to each other.
+
+Please refer to the [Changelog](CHANGELOG.md) for project history details, too.
+
+Happy hacking!
+
+### API
+
+#### <a name="logical-tree"></a> `> logicalTree(pkg, lock) -> LogicalTree`
+
+Calculates a logical tree based on a matching `package.json` and
+`package-lock.json` pair. A "logical tree" is a fully-nested dependency graph
+for an npm package, as opposed to a physical tree which might be flattened.
+
+`logical-tree` will represent deduplicated/flattened nodes using the same object
+throughout the tree, so duplication can be checked by object identity.
+
+##### Example
+
+```javascript
+const pkg = require('./package.json')
+const pkgLock = require('./package-lock.json')
+
+logicalTree(pkg, pkgLock)
+// returns:
+LogicalTree {
+ name: 'npm-logical-tree',
+ version: '1.0.0',
+ address: null,
+ optional: false,
+ dev: false,
+ bundled: false,
+ resolved: undefined,
+ integrity: undefined,
+ requiredBy: Set { },
+ dependencies:
+ Map {
+ 'foo' => LogicalTree {
+ name: 'foo',
+ version: '1.2.3',
+ address: 'foo',
+ optional: false,
+ dev: true,
+ bundled: false,
+ resolved: 'https://registry.npmjs.org/foo/-/foo-1.2.3.tgz',
+ integrity: 'sha1-rYUK/p261/SXByi0suR/7Rw4chw=',
+ requiredBy: Set { ... },
+ dependencies: Map { ... }
+ },
+ ...
+ }
+}
+```
+
+#### <a name="make-node"></a> `> logicalTree.node(name, [address, [opts]]) -> LogicalTree`
+
+Manually creates a new LogicalTree node.
+
+##### Options
+
+* `opts.version` - version of the node.
+* `opts.optional` - is this node an optionalDep?
+* `opts.dev` - is this node a devDep?
+* `opts.bundled` - is this bundled?
+* `opts.resolved` - resolved address.
+* `opts.integrity` - SRI string.
+
+##### Example
+```javascript
+logicalTree.node('hello', 'subpath:to:@foo/bar', {dev: true})
+```
diff --git a/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/index.js b/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/index.js
new file mode 100644
index 0000000000..10ab7599f6
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/index.js
@@ -0,0 +1,192 @@
+'use strict'
+
+let path
+
+class LogicalTree {
+ constructor (name, address, opts) {
+ this.name = name
+ this.version = opts.version
+ this.address = address || ''
+ this.optional = !!opts.optional
+ this.dev = !!opts.dev
+ this.bundled = !!opts.bundled
+ this.resolved = opts.resolved
+ this.integrity = opts.integrity
+ this.dependencies = new Map()
+ this.requiredBy = new Set()
+ }
+
+ get isRoot () { return !this.requiredBy.size }
+
+ addDep (dep) {
+ this.dependencies.set(dep.name, dep)
+ dep.requiredBy.add(this)
+ return this
+ }
+
+ delDep (dep) {
+ this.dependencies.delete(dep.name)
+ dep.requiredBy.delete(this)
+ return this
+ }
+
+ getDep (name) {
+ return this.dependencies.get(name)
+ }
+
+ path (prefix) {
+ if (this.isRoot) {
+ // The address of the root is the prefix itself.
+ return prefix || ''
+ } else {
+ if (!path) { path = require('path') }
+ return path.join(
+ prefix || '',
+ 'node_modules',
+ this.address.replace(/:/g, '/node_modules/')
+ )
+ }
+ }
+
+ // This finds cycles _from_ a given node: if some deeper dep has
+ // its own cycle, but that cycle does not refer to this node,
+ // it will return false.
+ hasCycle (_seen, _from) {
+ if (!_seen) { _seen = new Set() }
+ if (!_from) { _from = this }
+ for (let dep of this.dependencies.values()) {
+ if (_seen.has(dep)) { continue }
+ _seen.add(dep)
+ if (dep === _from || dep.hasCycle(_seen, _from)) {
+ return true
+ }
+ }
+ return false
+ }
+
+ forEachAsync (fn, opts, _pending) {
+ if (!opts) { opts = _pending || {} }
+ if (!_pending) { _pending = new Map() }
+ const P = opts.Promise || Promise
+ if (_pending.has(this)) {
+ return P.resolve(this.hasCycle() || _pending.get(this))
+ }
+ const pending = P.resolve().then(() => {
+ return fn(this, () => {
+ return promiseMap(
+ this.dependencies.values(),
+ dep => dep.forEachAsync(fn, opts, _pending),
+ opts
+ )
+ })
+ })
+ _pending.set(this, pending)
+ return pending
+ }
+
+ forEach (fn, _seen) {
+ if (!_seen) { _seen = new Set() }
+ if (_seen.has(this)) { return }
+ _seen.add(this)
+ fn(this, () => {
+ for (let dep of this.dependencies.values()) {
+ dep.forEach(fn, _seen)
+ }
+ })
+ }
+}
+
+module.exports = lockTree
+function lockTree (pkg, pkgLock, opts) {
+ const tree = makeNode(pkg.name, null, pkg)
+ const allDeps = new Map()
+ Array.from(
+ new Set(Object.keys(pkg.devDependencies || {})
+ .concat(Object.keys(pkg.optionalDependencies || {}))
+ .concat(Object.keys(pkg.dependencies || {})))
+ ).forEach(name => {
+ let dep = allDeps.get(name)
+ if (!dep) {
+ const depNode = (pkgLock.dependencies || {})[name]
+ dep = makeNode(name, name, depNode)
+ }
+ addChild(dep, tree, allDeps, pkgLock)
+ })
+ return tree
+}
+
+module.exports.node = makeNode
+function makeNode (name, address, opts) {
+ return new LogicalTree(name, address, opts || {})
+}
+
+function addChild (dep, tree, allDeps, pkgLock) {
+ tree.addDep(dep)
+ allDeps.set(dep.address, dep)
+ const addr = dep.address
+ const lockNode = atAddr(pkgLock, addr)
+ Object.keys(lockNode.requires || {}).forEach(name => {
+ const tdepAddr = reqAddr(pkgLock, name, addr)
+ let tdep = allDeps.get(tdepAddr)
+ if (!tdep) {
+ tdep = makeNode(name, tdepAddr, atAddr(pkgLock, tdepAddr))
+ addChild(tdep, dep, allDeps, pkgLock)
+ } else {
+ dep.addDep(tdep)
+ }
+ })
+}
+
+module.exports._reqAddr = reqAddr
+function reqAddr (pkgLock, name, fromAddr) {
+ const lockNode = atAddr(pkgLock, fromAddr)
+ const child = (lockNode.dependencies || {})[name]
+ if (child) {
+ return `${fromAddr}:${name}`
+ } else {
+ const parts = fromAddr.split(':')
+ while (parts.length) {
+ parts.pop()
+ const joined = parts.join(':')
+ const parent = atAddr(pkgLock, joined)
+ if (parent) {
+ const child = (parent.dependencies || {})[name]
+ if (child) {
+ return `${joined}${parts.length ? ':' : ''}${name}`
+ }
+ }
+ }
+ const err = new Error(`${name} not accessible from ${fromAddr}`)
+ err.pkgLock = pkgLock
+ err.target = name
+ err.from = fromAddr
+ throw err
+ }
+}
+
+module.exports._atAddr = atAddr
+function atAddr (pkgLock, addr) {
+ if (!addr.length) { return pkgLock }
+ const parts = addr.split(':')
+ return parts.reduce((acc, next) => {
+ return acc && (acc.dependencies || {})[next]
+ }, pkgLock)
+}
+
+function promiseMap (arr, fn, opts, _index) {
+ _index = _index || 0
+ const P = (opts && opts.Promise) || Promise
+ if (P.map) {
+ return P.map(arr, fn, opts)
+ } else {
+ if (!(arr instanceof Array)) {
+ arr = Array.from(arr)
+ }
+ if (_index >= arr.length) {
+ return P.resolve()
+ } else {
+ return P.resolve(fn(arr[_index], _index, arr))
+ .then(() => promiseMap(arr, fn, opts, _index + 1))
+ }
+ }
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/package.json b/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/package.json
new file mode 100644
index 0000000000..b423a762c4
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/npm-logical-tree/package.json
@@ -0,0 +1,83 @@
+{
+ "_from": "npm-logical-tree@^1.2.1",
+ "_id": "npm-logical-tree@1.2.1",
+ "_inBundle": false,
+ "_integrity": "sha512-AJI/qxDB2PWI4LG1CYN579AY1vCiNyWfkiquCsJWqntRu/WwimVrC8yXeILBFHDwxfOejxewlmnvW9XXjMlYIg==",
+ "_location": "/libcipm/npm-logical-tree",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "npm-logical-tree@^1.2.1",
+ "name": "npm-logical-tree",
+ "escapedName": "npm-logical-tree",
+ "rawSpec": "^1.2.1",
+ "saveSpec": null,
+ "fetchSpec": "^1.2.1"
+ },
+ "_requiredBy": [
+ "/libcipm"
+ ],
+ "_resolved": "https://registry.npmjs.org/npm-logical-tree/-/npm-logical-tree-1.2.1.tgz",
+ "_shasum": "44610141ca24664cad35d1e607176193fd8f5b88",
+ "_spec": "npm-logical-tree@^1.2.1",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/libcipm",
+ "author": {
+ "name": "Kat Marchán",
+ "email": "kzm@sykosomatic.org"
+ },
+ "bugs": {
+ "url": "https://github.com/npm/logical-tree/issues"
+ },
+ "bundleDependencies": false,
+ "config": {
+ "nyc": {
+ "exclude": [
+ "node_modules/**",
+ "test/**"
+ ]
+ }
+ },
+ "contributors": [
+ {
+ "name": "Rebecca Turner",
+ "email": "me@re-becca.org"
+ }
+ ],
+ "deprecated": false,
+ "description": "Calculate 'logical' trees from a package.json + package-lock",
+ "devDependencies": {
+ "bluebird": "^3.5.1",
+ "nyc": "^11.1.0",
+ "standard": "^10.0.2",
+ "standard-version": "^4.2.0",
+ "tap": "^10.7.0",
+ "weallbehave": "^1.2.0",
+ "weallcontribute": "^1.0.8"
+ },
+ "files": [
+ "*.js"
+ ],
+ "homepage": "https://github.com/npm/logical-tree#readme",
+ "keywords": [
+ "npm",
+ "package manager"
+ ],
+ "license": "ISC",
+ "main": "index.js",
+ "name": "npm-logical-tree",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/npm/logical-tree.git"
+ },
+ "scripts": {
+ "postrelease": "npm publish && git push --follow-tags",
+ "prerelease": "npm t",
+ "pretest": "standard lib test *.js",
+ "release": "standard-version -s",
+ "test": "nyc --all -- tap -J test/*.js",
+ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'",
+ "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'"
+ },
+ "version": "1.2.1"
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/protoduck/CHANGELOG.md b/deps/npm/node_modules/libcipm/node_modules/protoduck/CHANGELOG.md
new file mode 100644
index 0000000000..dd7669aa13
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/CHANGELOG.md
@@ -0,0 +1,55 @@
+# Change Log
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+<a name="5.0.0"></a>
+# [5.0.0](https://github.com/zkat/protoduck/compare/v4.0.0...v5.0.0) (2017-12-12)
+
+
+### Bug Fixes
+
+* **license:** relicense to MIT ([55cdd89](https://github.com/zkat/protoduck/commit/55cdd89))
+* **platforms:** drop support for node 4 and 7 ([07a19b1](https://github.com/zkat/protoduck/commit/07a19b1))
+
+
+### BREAKING CHANGES
+
+* **platforms:** node 4 and node 7 are no longer officially supported
+* **license:** license changed from CC0-1.0 to MIT
+
+
+
+<a name="4.0.0"></a>
+# [4.0.0](https://github.com/zkat/protoduck/compare/v3.3.2...v4.0.0) (2017-04-17)
+
+
+### Bug Fixes
+
+* **test:** .name is inconsistently available ([3483f4a](https://github.com/zkat/protoduck/commit/3483f4a))
+
+
+### Features
+
+* **api:** Fresh New API™ ([#2](https://github.com/zkat/protoduck/issues/2)) ([534e5cf](https://github.com/zkat/protoduck/commit/534e5cf))
+* **constraints:** added optional where-constraints ([16ad124](https://github.com/zkat/protoduck/commit/16ad124))
+* **defaults:** allow default impls without arrays in defs ([6cf7d84](https://github.com/zkat/protoduck/commit/6cf7d84))
+* **deps:** use genfun[@4](https://github.com/4) ([f6810a7](https://github.com/zkat/protoduck/commit/f6810a7))
+* **meta:** bringing project stuff up to date ([61791da](https://github.com/zkat/protoduck/commit/61791da))
+
+
+### BREAKING CHANGES
+
+* **api:** The API was significantly overhauled.
+
+* New protocol creating is now through protoduck.define() instead of protoduck()
+* Implementations are through Duck#impl instead of Duck(...)
+* The `private` option was removed
+* Static protocols were removed -- only method-style protocols are available now.
+* As part of that: the target argument to impl can no longer be omitted
+* The main export object is now the metaobject. protoduck.impl can be used to extend to MOP
+* .isDerivable is now a property on Duck instances, not a static method
+* .hasImpl is now a method on Duck instances, not a static method
+* Protoduck will now genfunnify existing functions as default methods for genfuns declared in a protocol when implementing
+* Error messages have been overhauled to be more helpful
+* **deps:** nextMethod is now an extra argument to methods
+* **meta:** node@<4 is no longer supported
diff --git a/deps/npm/node_modules/libcipm/node_modules/protoduck/LICENSE b/deps/npm/node_modules/libcipm/node_modules/protoduck/LICENSE
new file mode 100644
index 0000000000..1e0a1d6f8d
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+Copyright (c) 2017 Kat Marchán
+
+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/deps/npm/node_modules/libcipm/node_modules/protoduck/README.md b/deps/npm/node_modules/libcipm/node_modules/protoduck/README.md
new file mode 100644
index 0000000000..2dc70a3071
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/README.md
@@ -0,0 +1,346 @@
+# protoduck [![npm version](https://img.shields.io/npm/v/protoduck.svg)](https://npm.im/protoduck) [![license](https://img.shields.io/npm/l/protoduck.svg)](https://npm.im/protoduck) [![Travis](https://img.shields.io/travis/zkat/protoduck.svg)](https://travis-ci.org/zkat/protoduck) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/protoduck?svg=true)](https://ci.appveyor.com/project/zkat/protoduck) [![Coverage Status](https://coveralls.io/repos/github/zkat/protoduck/badge.svg?branch=latest)](https://coveralls.io/github/zkat/protoduck?branch=latest)
+
+[`protoduck`](https://github.com/zkat/protoduck) is a JavaScript library is a
+library for making groups of methods, called "protocols".
+
+If you're familiar with the concept of ["duck
+typing"](https://en.wikipedia.org/wiki/Duck_typing), then it might make sense to
+think of protocols as things that explicitly define what methods you need in
+order to "clearly be a duck".
+
+## Install
+
+`$ npm install -S protoduck`
+
+## Table of Contents
+
+* [Example](#example)
+* [Features](#features)
+* [Guide](#guide)
+ * [Introduction](#introduction)
+ * [Defining protocols](#defining-protocols)
+ * [Implementations](#protocol-impls)
+ * [Multiple dispatch](#multiple-dispatch)
+ * [Constraints](#constraints)
+* [API](#api)
+ * [`define()`](#define)
+ * [`proto.impl()`](#impl)
+
+### Example
+
+```javascript
+const protoduck = require('protoduck')
+
+// Quackable is a protocol that defines three methods
+const Quackable = protoduck.define({
+ walk: [],
+ talk: [],
+ isADuck: [() => true] // default implementation -- it's optional!
+})
+
+// `duck` must implement `Quackable` for this function to work. It doesn't
+// matter what type or class duck is, as long as it implements Quackable.
+function doStuffToDucks (duck) {
+ if (!duck.isADuck()) {
+ throw new Error('I want a duck!')
+ } else {
+ console.log(duck.walk())
+ console.log(duck.talk())
+ }
+}
+
+// ...In a different package:
+const ducks = require('./ducks')
+
+class Duck () {}
+
+// Implement the protocol on the Duck class.
+ducks.Quackable.impl(Duck, {
+ walk () { return "*hobble hobble*" }
+ talk () { return "QUACK QUACK" }
+})
+
+// main.js
+ducks.doStuffToDucks(new Duck()) // works!
+```
+
+### Features
+
+* Verifies implementations in case methods are missing or wrong ones added
+* Helpful, informative error messages
+* Optional default method implementations
+* Fresh JavaScript Feel™ -- methods work just like native methods when called
+* Methods can dispatch on arguments, not just `this` ([multimethods](https://npm.im/genfun))
+* Type constraints
+
+### Guide
+
+#### Introduction
+
+Like most Object-oriented languages, JavaScript comes with its own way of
+defining methods: You simply add regular `function`s as properties to regular
+objects, and when you do `obj.method()`, it calls the right code! ES6/ES2015
+further extended this by adding a `class` syntax that allowed this same system
+to work with more familiar syntax sugar: `class Foo { method() { ... } }`.
+
+The point of "protocols" is to have a more explicit definitions of what methods
+"go together". That is, a protocol is a description of a type of object your
+code interacts with. If someone passes an object into your library, and it fits
+your defined protocol, the assumption is that the object will work just as well.
+
+Duck typing is a common term for this sort of thing: If it walks like a duck,
+and it talks like a duck, then it may as well be a duck, as far as any of our
+code is concerned.
+
+Many other languages have similar or identical concepts under different names:
+Java's interfaces, Haskell's typeclasses, Rust's traits. Elixir and Clojure both
+call them "protocols" as well.
+
+One big advantage to using these protocols is that they let users define their
+own versions of some abstraction, without requiring the type to inherit from
+another -- protocols are independent of inheritance, even though they're able to
+work together with it. If you've ever found yourself in some sort of inheritance
+mess, this is exactly the sort of thing you use to escape it.
+
+#### Defining Protocols
+
+The first step to using `protoduck` is to define a protocol. Protocol
+definitions look like this:
+
+```javascript
+// import the library first!
+const protoduck = require('protoduck')
+
+// `Ducklike` is the name of our protocol. It defines what it means for
+// something to be "like a duck", as far as our code is concerned.
+const Ducklike = protoduck.define([], {
+ walk: [], // This says that the protocol requires a "walk" method.
+ talk: [] // and ducks also need to talk
+ peck: [] // and they can even be pretty scary
+})
+```
+
+Protocols by themselves don't really *do* anything, they simply define what
+methods are included in the protocol, and thus what will need to be implemented.
+
+#### Protocol Impls
+
+The simplest type of definitions for protocols are as regular methods. In this
+style, protocols end up working exactly like normal JavaScript methods: they're
+added as properties of the target type/object, and we call them using the
+`foo.method()` syntax. `this` is accessible inside the methods, as usual.
+
+Implementation syntax is very similar to protocol definitions, using `.impl`:
+
+```javascript
+class Dog {}
+
+// Implementing `Ducklike` for `Dog`s
+Ducklike.impl(Dog, [], {
+ walk () { return '*pads on all fours*' }
+ talk () { return 'woof woof. I mean "quack" >_>' }
+ peck (victim) { return 'Can I just bite ' + victim + ' instead?...' }
+})
+```
+
+So now, our `Dog` class has two extra methods: `walk`, and `talk`, and we can
+just call them:
+
+```javascript
+const pupper = new Dog()
+
+pupper.walk() // *pads on all fours*
+pupper.talk() // woof woof. I mean "quack" >_>
+pupper.peck('this string') // Can I just bite this string instead?...
+```
+
+#### Multiple Dispatch
+
+You may have noticed before that we have these `[]` in various places that don't
+seem to have any obvious purpose.
+
+These arrays allow protocols to be implemented not just for a single value of
+`this`, but across *all arguments*. That is, you can have methods in these
+protocols that use both `this`, and the first argument (or any other arguments)
+in order to determine what code to actually execute.
+
+This type of method is called a multimethod, and is one of the differences
+between protoduck and the default `class` syntax.
+
+To use it: in the protocol *definitions*, you put matching
+strings in different spots where those empty arrays were, and when you
+*implement* the protocol, you give the definition the actual types/objects you
+want to implement it on, and it takes care of mapping types to the strings you
+defined, and making sure the right code is run:
+
+```javascript
+const Playful = protoduck.define(['friend'], {// <---\
+ playWith: ['friend'] // <------------ these correspond to each other
+})
+
+class Cat {}
+class Human {}
+class Dog {}
+
+// The first protocol is for Cat/Human combination
+Playful.impl(Cat, [Human], {
+ playWith (human) {
+ return '*headbutt* *purr* *cuddle* omg ilu, ' + human.name
+ }
+})
+
+// And we define it *again* for a different combination
+Playful.impl(Cat, [Dog], {
+ playWith (dog) {
+ return '*scratches* *hisses* omg i h8 u, ' + dog.name
+ }
+})
+
+// depending on what you call it with, it runs different methods:
+const cat = new Cat()
+const human = new Human()
+const dog = new Dog()
+
+cat.playWith(human) // *headbutt* *purr* *cuddle* omg ilu, Sam
+cat.playWith(dog) // *scratches* *hisses* omg i h8 u, Pupper
+```
+
+#### Constraints
+
+Sometimes, you want to have all the functionality of a certain protocol, but you
+want to add a few requirements or other bits an pieces. Usually, you would have
+to define the entire functionality of the "parent" protocol in your own protocol
+in order to pull this off. This isn't very DRY and thus prone to errors, missing
+or out-of-sync functionality, or other issues. You could also just tell users
+"hey, if you implement this, make sure to implement that", but there's no
+guarantee they'll know about it, or know which arguments map to what.
+
+This is where constraints come in: You can define a protocol that expects
+anything that implements it to *also* implement one or more "parent" protocols.
+
+```javascript
+const Show = proto.define({
+ // This syntax allows default impls without using arrays.
+ toString () {
+ return Object.prototype.toString.call(this)
+ },
+ toJSON () {
+ return JSON.stringify(this)
+ }
+})
+
+const Log = proto.define({
+ log () { console.log(this.toString()) }
+}, {
+ where: Show()
+ // Also valid:
+ // [Show('this'), Show('a')]
+ // [Show('this', ['a', 'b'])]
+})
+
+// This fails with an error: must implement Show:
+Log.impl(MyThing)
+
+// So derive Show first...
+Show.impl(MyThing)
+// And now it's ok!
+Log.impl(MyThing)
+```
+
+### API
+
+#### <a name="define"></a> `define(<types>?, <spec>, <opts>)`
+
+Defines a new protocol on across arguments of types defined by `<types>`, which
+will expect implementations for the functions specified in `<spec>`.
+
+If `<types>` is missing, it will be treated the same as if it were an empty
+array.
+
+The types in `<spec>` entries must map, by string name, to the type names
+specified in `<types>`, or be an empty array if `<types>` is omitted. The types
+in `<spec>` will then be used to map between method implementations for the
+individual functions, and the provided types in the impl.
+
+Protocols can include an `opts` object as the last argument, with the following
+available options:
+
+* `opts.name` `{String}` - The name to use when referring to the protocol.
+
+* `opts.where` `{Array[Constraint]|Constraint}` - Protocol constraints to use.
+
+* `opts.metaobject` - Accepts an object implementing the
+ `Protoduck` protocol, which can be used to alter protocol definition
+ mechanisms in `protoduck`.
+
+##### Example
+
+```javascript
+const Eq = protoduck.define(['a'], {
+ eq: ['a']
+})
+```
+
+#### <a name="impl"></a> `proto.impl(<target>, <types>?, <implementations>?)`
+
+Adds a new implementation to the given protocol across `<types>`.
+
+`<implementations>` must be an object with functions matching the protocol's
+API. If given, the types in `<types>` will be mapped to their corresponding
+method arguments according to the original protocol definition.
+
+If a protocol is derivable -- that is, all its functions have default impls,
+then the `<implementations>` object can be omitted entirely, and the protocol
+will be automatically derived for the given `<types>`
+
+##### Example
+
+```javascript
+import protoduck from 'protoduck'
+
+// Singly-dispatched protocols
+const Show = protoduck.define({
+ show: []
+})
+
+class Foo {
+ constructor (name) {
+ this.name = name
+ }
+}
+
+Show.impl(Foo, {
+ show () { return `[object Foo(${this.name})]` }
+})
+
+const f = new Foo('alex')
+f.show() === '[object Foo(alex)]'
+```
+
+```javascript
+import protoduck from 'protoduck'
+
+// Multi-dispatched protocols
+const Comparable = protoduck.define(['target'], {
+ compare: ['target'],
+})
+
+class Foo {}
+class Bar {}
+class Baz {}
+
+Comparable.impl(Foo, [Bar], {
+ compare (bar) { return 'bars are ok' }
+})
+
+Comparable.impl(Foo, [Baz], {
+ compare (baz) { return 'but bazzes are better' }
+})
+
+const foo = new Foo()
+const bar = new Bar()
+const baz = new Baz()
+
+foo.compare(bar) // 'bars are ok'
+foo.compare(baz) // 'but bazzes are better'
+```
diff --git a/deps/npm/node_modules/libcipm/node_modules/protoduck/index.js b/deps/npm/node_modules/libcipm/node_modules/protoduck/index.js
new file mode 100644
index 0000000000..3596bb3299
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/index.js
@@ -0,0 +1,349 @@
+'use strict'
+
+const genfun = require('genfun')
+
+class Duck extends Function {
+ // Duck.impl(Foo, [String, Array], { frob (str, arr) { ... }})
+ impl (target, types, impls) {
+ if (!impls && !isArray(types)) {
+ impls = types
+ types = []
+ }
+ if (!impls && this.isDerivable) {
+ impls = this._defaultImpls
+ }
+ if (!impls) {
+ impls = {}
+ }
+ if (typeof target === 'function' && !target.isGenfun) {
+ target = target.prototype
+ }
+ checkImpls(this, target, impls)
+ checkArgTypes(this, types)
+ this._constraints.forEach(c => {
+ if (!c.verify(target, types)) {
+ throw new Error(`Implementations of ${
+ this.name || 'this protocol'
+ } must first implement ${
+ c.parent.name || 'its constraint protocols defined in opts.where.'
+ }`)
+ }
+ })
+ this._methodNames.forEach(name => {
+ defineMethod(this, name, target, types, impls)
+ })
+ }
+
+ hasImpl (arg, args) {
+ args = args || []
+ const fns = this._methodNames
+ var gf
+ if (typeof arg === 'function' && !arg.isGenfun) {
+ arg = arg.prototype
+ }
+ args = args.map(arg => {
+ if (typeof arg === 'function' && !arg.isGenfun) {
+ return arg.prototype
+ } else {
+ return arg
+ }
+ })
+ for (var i = 0; i < fns.length; i++) {
+ gf = arg[fns[i]]
+ if (!gf ||
+ (gf.hasMethod
+ ? !gf.hasMethod.apply(gf, args)
+ : typeof gf === 'function')) {
+ return false
+ }
+ }
+ return true
+ }
+
+ // MyDuck.matches('a', ['this', 'c'])
+ matches (thisType, argTypes) {
+ if (!argTypes && isArray(thisType)) {
+ argTypes = thisType
+ thisType = 'this'
+ }
+ if (!thisType) {
+ thisType = 'this'
+ }
+ if (!argTypes) {
+ argTypes = []
+ }
+ return new Constraint(this, thisType, argTypes)
+ }
+}
+Duck.prototype.isDuck = true
+Duck.prototype.isProtocol = true
+
+const Protoduck = module.exports = define(['duck'], {
+ createGenfun: ['duck', _metaCreateGenfun],
+ addMethod: ['duck', _metaAddMethod]
+}, {name: 'Protoduck'})
+
+const noImplFound = module.exports.noImplFound = genfun.noApplicableMethod
+
+module.exports.define = define
+function define (types, spec, opts) {
+ if (!isArray(types)) {
+ // protocol(spec, opts?) syntax for method-based protocols
+ opts = spec
+ spec = types
+ types = []
+ }
+ const duck = function (thisType, argTypes) {
+ return duck.matches(thisType, argTypes)
+ }
+ Object.setPrototypeOf(duck, Duck.prototype)
+ duck.isDerivable = true
+ Object.defineProperty(duck, 'name', {
+ value: (opts && opts.name) || 'Protocol'
+ })
+ if (opts && opts.where) {
+ let where = opts.where
+ if (!isArray(opts.where)) { where = [opts.where] }
+ duck._constraints = where.map(w => w.isProtocol // `where: [Foo]`
+ ? w.matches()
+ : w
+ )
+ } else {
+ duck._constraints = []
+ }
+ duck.isProtocol = true
+ duck._metaobject = opts && opts.metaobject
+ duck._types = types
+ duck._defaultImpls = {}
+ duck._gfTypes = {}
+ duck._methodNames = Object.keys(spec)
+ duck._methodNames.forEach(name => {
+ checkMethodSpec(duck, name, spec)
+ })
+ duck._constraints.forEach(c => c.attach(duck))
+ return duck
+}
+
+function checkMethodSpec (duck, name, spec) {
+ let gfTypes = spec[name]
+ if (typeof gfTypes === 'function') {
+ duck._defaultImpls[name] = gfTypes
+ gfTypes = [gfTypes]
+ } if (typeof gfTypes[gfTypes.length - 1] === 'function') {
+ duck._defaultImpls[name] = gfTypes.pop()
+ } else {
+ duck.isDerivable = false
+ }
+ duck._gfTypes[name] = gfTypes.map(typeId => {
+ const idx = duck._types.indexOf(typeId)
+ if (idx === -1) {
+ throw new Error(
+ `type '${
+ typeId
+ }' for function '${
+ name
+ }' does not match any protocol types (${
+ duck._types.join(', ')
+ }).`
+ )
+ } else {
+ return idx
+ }
+ })
+}
+
+function defineMethod (duck, name, target, types, impls) {
+ const methodTypes = duck._gfTypes[name].map(function (typeIdx) {
+ return types[typeIdx]
+ })
+ for (let i = methodTypes.length - 1; i >= 0; i--) {
+ if (methodTypes[i] === undefined) {
+ methodTypes.pop()
+ } else {
+ break
+ }
+ }
+ const useMetaobject = duck._metaobject && duck._metaobject !== Protoduck
+ // `target` does not necessarily inherit from `Object`
+ if (!Object.prototype.hasOwnProperty.call(target, name)) {
+ // Make a genfun if there's nothing there
+ const gf = useMetaobject
+ ? duck._metaobject.createGenfun(duck, target, name, null)
+ : _metaCreateGenfun(duck, target, name, null)
+ target[name] = gf
+ } else if (typeof target[name] === 'function' && !target[name].isGenfun) {
+ // Turn non-gf functions into genfuns
+ const gf = useMetaobject
+ ? duck._metaobject.createGenfun(duck, target, name, target[name])
+ : _metaCreateGenfun(duck, target, name, target[name])
+ target[name] = gf
+ }
+
+ const fn = impls[name] || duck._defaultImpls[name]
+ if (fn) { // checkImpls made sure this is safe
+ useMetaobject
+ ? duck._metaobject.addMethod(duck, target, name, methodTypes, fn)
+ : _metaAddMethod(duck, target, name, methodTypes, fn)
+ }
+}
+
+function checkImpls (duck, target, impls) {
+ duck._methodNames.forEach(function (name) {
+ if (
+ !impls[name] &&
+ !duck._defaultImpls[name] &&
+ // Existing methods on the target are acceptable defaults.
+ typeof target[name] !== 'function'
+ ) {
+ throw new Error(`Missing implementation for ${
+ formatMethod(duck, name, duck.name)
+ }. Make sure the method is present in your ${
+ duck.name || 'protocol'
+ } definition. Required methods: ${
+ duck._methodNames.filter(m => {
+ return !duck._defaultImpls[m]
+ }).map(m => formatMethod(duck, m)).join(', ')
+ }.`)
+ }
+ })
+ Object.keys(impls).forEach(function (name) {
+ if (duck._methodNames.indexOf(name) === -1) {
+ throw new Error(
+ `${name}() was included in the impl, but is not part of ${
+ duck.name || 'the protocol'
+ }. Allowed methods: ${
+ duck._methodNames.map(m => formatMethod(duck, m)).join(', ')
+ }.`
+ )
+ }
+ })
+}
+
+function formatMethod (duck, name, withDuckName) {
+ return `${
+ withDuckName && duck.name ? `${duck.name}#` : ''
+ }${name}(${duck._gfTypes[name].map(n => duck._types[n]).join(', ')})`
+}
+
+function checkArgTypes (duck, types) {
+ var requiredTypes = duck._types
+ if (types.length > requiredTypes.length) {
+ throw new Error(
+ `${
+ duck.name || 'Protocol'
+ } expects to be defined across ${
+ requiredTypes.length
+ } type${requiredTypes.length > 1 ? 's' : ''}, but ${
+ types.length
+ } ${types.length > 1 ? 'were' : 'was'} specified.`
+ )
+ }
+}
+
+function typeName (obj) {
+ return (/\[object ([a-zA-Z0-9]+)\]/).exec(({}).toString.call(obj))[1]
+}
+
+function installMethodErrorMessage (proto, gf, target, name) {
+ noImplFound.add([gf], function (gf, thisArg, args) {
+ let parent = Object.getPrototypeOf(thisArg)
+ while (parent && parent[name] === gf) {
+ parent = Object.getPrototypeOf(parent)
+ }
+ if (parent && parent[name] && typeof parent[name] === 'function') {
+ }
+ var msg = `No ${typeName(thisArg)} impl for ${
+ proto.name ? `${proto.name}#` : ''
+ }${name}(${[].map.call(args, typeName).join(', ')}). You must implement ${
+ proto.name
+ ? formatMethod(proto, name, true)
+ : `the protocol ${formatMethod(proto, name)} belongs to`
+ } in order to call ${typeName(thisArg)}#${name}(${
+ [].map.call(args, typeName).join(', ')
+ }).`
+ const err = new Error(msg)
+ err.protocol = proto
+ err.function = gf
+ err.thisArg = thisArg
+ err.args = args
+ err.code = 'ENOIMPL'
+ throw err
+ })
+}
+
+function isArray (x) {
+ return Object.prototype.toString.call(x) === '[object Array]'
+}
+
+// Metaobject Protocol
+Protoduck.impl(Protoduck) // defaults configured by definition
+
+function _metaCreateGenfun (proto, target, name, deflt) {
+ var gf = genfun({
+ default: deflt,
+ name: `${proto.name ? `${proto.name}#` : ''}${name}`
+ })
+ installMethodErrorMessage(proto, gf, target, name)
+ gf.duck = proto
+ return gf
+}
+
+function _metaAddMethod (duck, target, name, methodTypes, fn) {
+ return target[name].add(methodTypes, fn)
+}
+
+// Constraints
+class Constraint {
+ constructor (parent, thisType, argTypes) {
+ this.parent = parent
+ this.target = thisType
+ this.types = argTypes
+ }
+
+ attach (obj) {
+ this.child = obj
+ if (this.target === 'this') {
+ this.thisIdx = 'this'
+ } else {
+ const idx = this.child._types.indexOf(this.target)
+ if (idx === -1) {
+ this.thisIdx = null
+ } else {
+ this.thisIdx = idx
+ }
+ }
+ this.indices = this.types.map(typeId => {
+ if (typeId === 'this') {
+ return 'this'
+ } else {
+ const idx = this.child._types.indexOf(typeId)
+ if (idx === -1) {
+ return null
+ } else {
+ return idx
+ }
+ }
+ })
+ }
+
+ verify (target, types) {
+ const thisType = (
+ this.thisIdx === 'this' || this.thisIdx == null
+ )
+ ? target
+ : types[this.thisIdx]
+ const parentTypes = this.indices.map(idx => {
+ if (idx === 'this') {
+ return target
+ } else if (idx === 'this') {
+ return types[this.thisIdx]
+ } else if (idx === null) {
+ return Object
+ } else {
+ return types[idx] || Object.prototype
+ }
+ })
+ return this.parent.hasImpl(thisType, parentTypes)
+ }
+}
+Constraint.prototype.isConstraint = true
diff --git a/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/CHANGELOG.md b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/CHANGELOG.md
new file mode 100644
index 0000000000..c72d719ea3
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/CHANGELOG.md
@@ -0,0 +1,36 @@
+# Change Log
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+<a name="4.0.1"></a>
+## [4.0.1](https://github.com/zkat/genfun/compare/v4.0.0...v4.0.1) (2017-04-16)
+
+
+### Bug Fixes
+
+* **cache:** stop side-effecting cached applicableMethods ([09cee84](https://github.com/zkat/genfun/commit/09cee84))
+
+
+
+<a name="4.0.0"></a>
+# [4.0.0](https://github.com/zkat/genfun/compare/v3.2.1...v4.0.0) (2017-04-16)
+
+
+### Bug Fixes
+
+* **genfun:** make internal properties private ([e855c72](https://github.com/zkat/genfun/commit/e855c72))
+* **perf:** short-circuit default methods ([7a9b06b](https://github.com/zkat/genfun/commit/7a9b06b))
+
+
+### Features
+
+* **addMethod:** default-method shortcut syntax for gf.add ([40a3ebb](https://github.com/zkat/genfun/commit/40a3ebb))
+* **genfun:** default method and name opts + default shortcut ([0a40939](https://github.com/zkat/genfun/commit/0a40939))
+* **genfun:** now with inheritance! ([74abcc2](https://github.com/zkat/genfun/commit/74abcc2))
+* **nextMethod:** arg-based nextMethod calls ([17a0b35](https://github.com/zkat/genfun/commit/17a0b35))
+* **noNext:** allow users to disable nextMethod functionality ([cc00d95](https://github.com/zkat/genfun/commit/cc00d95))
+
+
+### BREAKING CHANGES
+
+* **nextMethod:** next methods are now passed in as arguments. context/callNextMethod/etc are all gone.
diff --git a/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/README.md b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/README.md
new file mode 100644
index 0000000000..01417ff879
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/README.md
@@ -0,0 +1,223 @@
+# Genfun [![Travis](https://img.shields.io/travis/zkat/genfun.svg)](https://travis-ci.org/zkat/genfun) [![npm](https://img.shields.io/npm/v/genfun.svg)](https://npm.im/genfun) [![npm](https://img.shields.io/npm/l/genfun.svg)](https://npm.im/genfun)
+
+[`genfun`](https://github.com/zkat/genfun) is a Javascript library that lets you
+define generic functions: regular-seeming functions that can be invoked just
+like any other function, but that automatically dispatch methods based on the
+combination of arguments passed to it when it's called, also known as multiple
+dispatch.
+
+It was inspired by [Slate](http://slatelanguage.org/),
+[CLOS](http://en.wikipedia.org/wiki/CLOS) and
+[Sheeple](http://github.com/zkat/sheeple).
+
+## Install
+
+`$ npm install genfun`
+
+## Table of Contents
+
+* [Example](#example)
+* [API](#api)
+ * [`Genfun()`](#genfun)
+ * [`gf.add()`](#addMethod)
+ * [`Genfun.callNextMethod()`](#callNextMethod)
+ * [`Genfun.noApplicableMethod()`](#noApplicableMethod)
+* [Performance](#performance)
+
+### Example
+
+Various examples are available to look at in the examples/ folder included in
+this project. Most examples are also runnable by just invoking them with node.
+
+```javascript
+import Genfun from "genfun"
+
+class Person {}
+class Dog {}
+
+const frobnicate = Genfun()
+
+frobnicate.add([Person], (person) => {
+ console.log('Got a person!')
+})
+
+frobnicate.add([Dog], (dog) => {
+ console.log('Got a dog!')
+})
+
+frobnicate.add([String, Person, Dog], (greeting, person, dog) => {
+ console.log(person, ' greets ', dog, ', \'' + greeting + '\'')
+})
+
+const person = new Person()
+const dog = new Dog()
+
+frobnicate(person) // Got a person!
+frobnicate(dog) // Got a dog!
+frobnicate('Hi, dog!', person, dog); // {} greets {}, 'Hi, dog!'
+```
+
+### API
+
+The basic API for `Genfun` is fairly simple: You create a new `genfun` by
+calling `Genfun()`, and add methods to them. Then you call the `genfun` object
+like a regular function, and it takes care of dispatching the appropriate
+methods!
+
+#### `Genfun()`
+
+Takes no arguments. Simply creates a new `genfun`. A `genfun` is a regular
+function object with overriden function call/dispatch behavior.
+
+When called, it will look at its arguments and determine if a matching method
+has been defined that applies to **all** arguments passed in, considered
+together.
+
+New methods may be added to the `genfun` object with [`gf.add()`](#addMethod).
+
+If no method is found, or none has been defined, it will invoke
+[`Genfun.noApplicableMethod`](#noApplicableMethod) with the appropriate
+arguments.
+
+Genfuns preserve the value of `this` if invoked using `.call` or `.apply`.
+
+##### Example
+
+```javascript
+var gf = Genfun()
+
+//... add some methods ..
+
+// These calls are all identical.
+gf(1, 2, 3)
+gf.call(null, 1, 2, 3)
+gf.apply(null, [1, 2, 3])
+```
+
+#### <a name="addMethod"></a> `gf.add(<selector>, <body>)`
+
+Adds a new method to `gf` and returns `gf` to allow chaining multiple `add`s.
+
+`<selector>` must be an array of objects that will receive new `Role`s (dispatch
+positions) for the method. If an object in the selector is a function, its
+`.prototype` field will receive the new `Role`. The array must not contain any
+frozen objects.
+
+When a `genfun` is called (like a function), it will look at its set of added
+methods and, based on the `Role`s assigned, and corresponding prototype chains,
+will determine which method, if any, will be invoked. On invocation, a method's
+`<body>` argument will be the called with the arguments passed to the `genfun`,
+including its `this` and `arguments` values`.
+
+Within the `<body>`, [`Genfun.callNextMethod`](#callNextMethod) may be called.
+
+##### Example
+
+```javascript
+
+var numStr = Genfun()
+
+numStr.add([String, Number], function (str, num) {
+ console.log('got a str:', str, 'and a num: ', num)
+})
+
+numStr.add([Number, String], function (num, str) {
+ console.log('got a num:', num, 'and a str:', str)
+})
+
+```
+
+#### <a name="callNextMethod"></a> `Genfun.callNextMethod([...<arguments>])`
+
+**NOTE**: This function can only be called synchronously. To call it
+asynchronously (for example, in a `Promise` or in a callback), use
+[`getContext`](#getContext)
+
+Calls the "next" applicable method in the method chain. Can only be called
+within the body of a method.
+
+If no arguments are given, `callNextMethod` will pass the current method's
+original arguments to the next method.
+
+If arguments are passed to `callNextMethod`, it will invoke the next applicable
+method (based on the **original** method list calculation), with **the given
+arguments**, even if they would otherwise not have triggered that method.
+
+Returns whatever value the next method returns.
+
+There **must** be a next method available when invoked. This function **will
+not** call `noApplicableMethod` when it runs out of methods to call. It will
+instead throw an error.
+
+##### Example
+
+```javascript
+class Foo {}
+class Bar extends Foo {}
+
+var cnm = Genfun()
+
+cnm.add([Foo], function (foo) {
+ console.log('calling the method on Foo with', foo)
+ return foo
+})
+
+cnm.add([Bar], function (bar) {
+ console.log('calling the method on Bar with', bar)
+ return Genfun.callNextMethod('some other value!')
+})
+
+cnm(new Bar())
+// calling the method on Bar with {}
+// calling the method on Foo with "some other value!"
+// => 'some other value!'
+```
+
+#### <a name="getContext"></a> `Genfun.getContext()`
+
+The `context` returned by this function will have a `callNextMethod` method
+which can be used to invoke the correct next method even during asynchronous
+calls (for example, when used in a callback or a `Promise`).
+
+This function must be called synchronously within the body of the method before
+any asynchronous calls, and will error if invoked outside the context of a
+method call.
+
+##### Example
+
+```javascript
+someGenfun.add([MyThing], function (thing) {
+ const ctx = Genfun.getContext()
+ return somePromisedCall(thing).then(res => ctx.callNextMethod(res))
+})
+```
+
+#### <a name="noApplicableMethod"></a> `Genfun.noApplicableMethod(<gf>, <this>, <args>)`
+
+`Genfun.noApplicableMethod` is a `genfun` itself, which is called whenever **any `genfun`** fails to find a matching method for its given arguments.
+
+It will be called with the `genfun` as its first argument, then the `this`
+value, and then the arguments it was called with.
+
+By default, this will simply throw a NoApplicableMethod error.
+
+Users may override this behavior for particular `genfun` and `this`
+combinations, although `args` will always be an `Array`. The value returned from
+the dispatched `noApplicableMethod` method will be returned by `genfun` as if it
+had been its original method. Comparable to [Ruby's
+`method_missing`](http://ruby-doc.org/core-2.1.0/BasicObject.html#method-i-method_missing).
+
+### Performance
+
+`Genfun` pulls a few caching tricks to make sure dispatch, specially for common
+cases, is as fast as possible.
+
+How fast? Well, not much slower than native methods:
+
+```
+Regular function: 30.402ms
+Native method: 28.109ms
+Singly-dispatched genfun: 64.467ms
+Double-dispatched genfun: 70.052ms
+Double-dispatched genfun with string primitive: 76.742ms
+```
diff --git a/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/genfun.js b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/genfun.js
new file mode 100644
index 0000000000..c6ba01ca54
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/genfun.js
@@ -0,0 +1,296 @@
+'use strict'
+
+const Method = require('./method')
+const Role = require('./role')
+const util = require('./util')
+
+const kCache = Symbol('cache')
+const kDefaultMethod = Symbol('defaultMethod')
+const kMethods = Symbol('methods')
+const kNoNext = Symbol('noNext')
+
+module.exports = function genfun (opts) {
+ function gf () {
+ if (!gf[kMethods].length && gf[kDefaultMethod]) {
+ return gf[kDefaultMethod].func.apply(this, arguments)
+ } else {
+ return gf.applyGenfun(this, arguments)
+ }
+ }
+ Object.setPrototypeOf(gf, Genfun.prototype)
+ gf[kMethods] = []
+ gf[kCache] = {key: [], methods: [], state: STATES.UNINITIALIZED}
+ if (opts && typeof opts === 'function') {
+ gf.add(opts)
+ } else if (opts && opts.default) {
+ gf.add(opts.default)
+ }
+ if (opts && opts.name) {
+ Object.defineProperty(gf, 'name', {
+ value: opts.name
+ })
+ }
+ if (opts && opts.noNextMethod) {
+ gf[kNoNext] = true
+ }
+ return gf
+}
+
+class Genfun extends Function {}
+Genfun.prototype.isGenfun = true
+
+const STATES = {
+ UNINITIALIZED: 0,
+ MONOMORPHIC: 1,
+ POLYMORPHIC: 2,
+ MEGAMORPHIC: 3
+}
+
+const MAX_CACHE_SIZE = 32
+
+/**
+ * Defines a method on a generic function.
+ *
+ * @function
+ * @param {Array-like} selector - Selector array for dispatching the method.
+ * @param {Function} methodFunction - Function to execute when the method
+ * successfully dispatches.
+ */
+Genfun.prototype.add = function addMethod (selector, func) {
+ if (!func && typeof selector === 'function') {
+ func = selector
+ selector = []
+ }
+ selector = [].slice.call(selector)
+ for (var i = 0; i < selector.length; i++) {
+ if (!selector.hasOwnProperty(i)) {
+ selector[i] = Object.prototype
+ }
+ }
+ this[kCache] = {key: [], methods: [], state: STATES.UNINITIALIZED}
+ let method = new Method(this, selector, func)
+ if (selector.length) {
+ this[kMethods].push(method)
+ } else {
+ this[kDefaultMethod] = method
+ }
+ return this
+}
+
+/**
+ * Removes a previously-defined method on `genfun` that matches
+ * `selector` exactly.
+ *
+ * @function
+ * @param {Genfun} genfun - Genfun to remove a method from.
+ * @param {Array-like} selector - Objects to match on when finding a
+ * method to remove.
+ */
+Genfun.prototype.rm = function removeMethod () {
+ throw new Error('not yet implemented')
+}
+
+/**
+ * Returns true if there are methods that apply to the given arguments on
+ * `genfun`. Additionally, makes sure the cache is warmed up for the given
+ * arguments.
+ *
+ */
+Genfun.prototype.hasMethod = function hasMethod () {
+ const methods = this.getApplicableMethods(arguments)
+ return !!(methods && methods.length)
+}
+
+/**
+ * This generic function is called when `genfun` has been called and no
+ * applicable method was found. The default method throws an `Error`.
+ *
+ * @function
+ * @param {Genfun} genfun - Generic function instance that was called.
+ * @param {*} newthis - value of `this` the genfun was called with.
+ * @param {Array} callArgs - Arguments the genfun was called with.
+ */
+module.exports.noApplicableMethod = module.exports()
+module.exports.noApplicableMethod.add([], (gf, thisArg, args) => {
+ let msg =
+ 'No applicable method found when called with arguments of types: (' +
+ [].map.call(args, (arg) => {
+ return (/\[object ([a-zA-Z0-9]+)\]/)
+ .exec(({}).toString.call(arg))[1]
+ }).join(', ') + ')'
+ let err = new Error(msg)
+ err.genfun = gf
+ err.thisArg = thisArg
+ err.args = args
+ throw err
+})
+
+/*
+ * Internal
+ */
+Genfun.prototype.applyGenfun = function applyGenfun (newThis, args) {
+ let applicableMethods = this.getApplicableMethods(args)
+ if (applicableMethods.length === 1 || this[kNoNext]) {
+ return applicableMethods[0].func.apply(newThis, args)
+ } else if (applicableMethods.length > 1) {
+ let idx = 0
+ const nextMethod = function nextMethod () {
+ if (arguments.length) {
+ // Replace args if passed in explicitly
+ args = arguments
+ Array.prototype.push.call(args, nextMethod)
+ }
+ const next = applicableMethods[idx++]
+ if (idx >= applicableMethods.length) {
+ Array.prototype.pop.call(args)
+ }
+ return next.func.apply(newThis, args)
+ }
+ Array.prototype.push.call(args, nextMethod)
+ return nextMethod()
+ } else {
+ return module.exports.noApplicableMethod(this, newThis, args)
+ }
+}
+
+Genfun.prototype.getApplicableMethods = function getApplicableMethods (args) {
+ if (!args.length || !this[kMethods].length) {
+ return this[kDefaultMethod] ? [this[kDefaultMethod]] : []
+ }
+ let applicableMethods
+ let maybeMethods = cachedMethods(this, args)
+ if (maybeMethods) {
+ applicableMethods = maybeMethods
+ } else {
+ applicableMethods = computeApplicableMethods(this, args)
+ cacheArgs(this, args, applicableMethods)
+ }
+ return applicableMethods
+}
+
+function cacheArgs (genfun, args, methods) {
+ if (genfun[kCache].state === STATES.MEGAMORPHIC) { return }
+ var key = []
+ var proto
+ for (var i = 0; i < args.length; i++) {
+ proto = cacheableProto(genfun, args[i])
+ if (proto) {
+ key[i] = proto
+ } else {
+ return null
+ }
+ }
+ genfun[kCache].key.unshift(key)
+ genfun[kCache].methods.unshift(methods)
+ if (genfun[kCache].key.length === 1) {
+ genfun[kCache].state = STATES.MONOMORPHIC
+ } else if (genfun[kCache].key.length < MAX_CACHE_SIZE) {
+ genfun[kCache].state = STATES.POLYMORPHIC
+ } else {
+ genfun[kCache].state = STATES.MEGAMORPHIC
+ }
+}
+
+function cacheableProto (genfun, arg) {
+ var dispatchable = util.dispatchableObject(arg)
+ if (Object.hasOwnProperty.call(dispatchable, Role.roleKeyName)) {
+ for (var j = 0; j < dispatchable[Role.roleKeyName].length; j++) {
+ var role = dispatchable[Role.roleKeyName][j]
+ if (role.method.genfun === genfun) {
+ return null
+ }
+ }
+ }
+ return Object.getPrototypeOf(dispatchable)
+}
+
+function cachedMethods (genfun, args) {
+ if (genfun[kCache].state === STATES.UNINITIALIZED ||
+ genfun[kCache].state === STATES.MEGAMORPHIC) {
+ return null
+ }
+ var protos = []
+ var proto
+ for (var i = 0; i < args.length; i++) {
+ proto = cacheableProto(genfun, args[i])
+ if (proto) {
+ protos[i] = proto
+ } else {
+ return
+ }
+ }
+ for (i = 0; i < genfun[kCache].key.length; i++) {
+ if (matchCachedMethods(genfun[kCache].key[i], protos)) {
+ return genfun[kCache].methods[i]
+ }
+ }
+}
+
+function matchCachedMethods (key, protos) {
+ if (key.length !== protos.length) { return false }
+ for (var i = 0; i < key.length; i++) {
+ if (key[i] !== protos[i]) {
+ return false
+ }
+ }
+ return true
+}
+
+function computeApplicableMethods (genfun, args) {
+ args = [].slice.call(args)
+ let discoveredMethods = []
+ function findAndRankRoles (object, hierarchyPosition, index) {
+ var roles = Object.hasOwnProperty.call(object, Role.roleKeyName)
+ ? object[Role.roleKeyName]
+ : []
+ roles.forEach(role => {
+ if (role.method.genfun === genfun && index === role.position) {
+ if (discoveredMethods.indexOf(role.method) < 0) {
+ Method.clearRank(role.method)
+ discoveredMethods.push(role.method)
+ }
+ Method.setRankHierarchyPosition(role.method, index, hierarchyPosition)
+ }
+ })
+ // When a discovered method would receive more arguments than
+ // were specialized, we pretend all extra arguments have a role
+ // on Object.prototype.
+ if (util.isObjectProto(object)) {
+ discoveredMethods.forEach(method => {
+ if (method.minimalSelector <= index) {
+ Method.setRankHierarchyPosition(method, index, hierarchyPosition)
+ }
+ })
+ }
+ }
+ args.forEach((arg, index) => {
+ getPrecedenceList(util.dispatchableObject(arg))
+ .forEach((obj, hierarchyPosition) => {
+ findAndRankRoles(obj, hierarchyPosition, index)
+ })
+ })
+ let applicableMethods = discoveredMethods.filter(method => {
+ return (args.length === method._rank.length &&
+ Method.isFullySpecified(method))
+ })
+ applicableMethods.sort((a, b) => Method.score(a) - Method.score(b))
+ if (genfun[kDefaultMethod]) {
+ applicableMethods.push(genfun[kDefaultMethod])
+ }
+ return applicableMethods
+}
+
+/*
+ * Helper function for getting an array representing the entire
+ * inheritance/precedence chain for an object by navigating its
+ * prototype pointers.
+ */
+function getPrecedenceList (obj) {
+ var precedenceList = []
+ var nextObj = obj
+ while (nextObj) {
+ precedenceList.push(nextObj)
+ nextObj = Object.getPrototypeOf(nextObj)
+ }
+ return precedenceList
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/method.js b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/method.js
new file mode 100644
index 0000000000..5a9d9f788e
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/method.js
@@ -0,0 +1,86 @@
+'use strict'
+
+/*
+ * Method
+ *
+ * Methods are added, conceptually, to Genfuns, not to objects
+ * themselves, although the Genfun object does not have any pointers to
+ * method objects.
+ *
+ * The _rank vector is an internal datastructure used during dispatch
+ * to figure out whether a method is applicable, and if so, how to
+ * order multiple discovered methods.
+ *
+ * Right now, the score method on Method does not take into account any
+ * ordering, and all arguments to a method are ranked equally for the
+ * sake of ordering.
+ *
+ */
+const Role = require('./role')
+const util = require('./util')
+
+module.exports = Method
+function Method (genfun, selector, func) {
+ var method = this
+ method.genfun = genfun
+ method.func = func
+ method._rank = []
+ method.minimalSelector = 0
+
+ const tmpSelector = selector.length ? selector : [Object.prototype]
+ for (var object, i = tmpSelector.length - 1; i >= 0; i--) {
+ object = Object.hasOwnProperty.call(tmpSelector, i)
+ ? tmpSelector[i]
+ : Object.prototype
+ object = util.dispatchableObject(object)
+ if (
+ typeof object === 'function' &&
+ !object.isGenfun
+ ) {
+ object = object.prototype
+ }
+ if (i > 0 &&
+ !method.minimalSelector &&
+ util.isObjectProto(object)) {
+ continue
+ } else {
+ method.minimalSelector++
+ if (!Object.hasOwnProperty.call(object, Role.roleKeyName)) {
+ if (Object.defineProperty) {
+ // Object.defineProperty is JS 1.8.0+
+ Object.defineProperty(
+ object, Role.roleKeyName, {value: [], enumerable: false})
+ } else {
+ object[Role.roleKeyName] = []
+ }
+ }
+ // XXX HACK - no method replacement now, so we just shove
+ // it in a place where it'll always show up first. This
+ // would probably seriously break method combination if we
+ // had it.
+ object[Role.roleKeyName].unshift(new Role(method, i))
+ }
+ }
+}
+
+Method.setRankHierarchyPosition = (method, index, hierarchyPosition) => {
+ method._rank[index] = hierarchyPosition
+}
+
+Method.clearRank = method => {
+ method._rank = []
+}
+
+Method.isFullySpecified = method => {
+ for (var i = 0; i < method.minimalSelector; i++) {
+ if (!method._rank.hasOwnProperty(i)) {
+ return false
+ }
+ }
+ return true
+}
+
+Method.score = method => {
+ // TODO - this makes all items in the list equal
+ return method._rank.reduce((a, b) => a + b, 0)
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/role.js b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/role.js
new file mode 100644
index 0000000000..69e35c2e58
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/role.js
@@ -0,0 +1,17 @@
+'use strict'
+
+/*
+ * Role
+ *
+ * A Role encapsulates a particular object's 'role' in a method's
+ * dispatch. They are added directly to the selector for a method, and thus
+ * do not prevent the objects a method was defined on from being garbage
+ * collected.
+ */
+module.exports = Role
+function Role (method, position) {
+ this.method = method
+ this.position = position
+}
+
+Role.roleKeyName = Symbol('roles')
diff --git a/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/util.js b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/util.js
new file mode 100644
index 0000000000..23770629d3
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/lib/util.js
@@ -0,0 +1,37 @@
+'use strict'
+
+module.exports.isObjectProto = isObjectProto
+function isObjectProto (obj) {
+ return obj === Object.prototype
+}
+
+const _null = {}
+const _undefined = {}
+const Bool = Boolean
+const Num = Number
+const Str = String
+const boolCache = {
+ true: new Bool(true),
+ false: new Bool(false)
+}
+const numCache = {}
+const strCache = {}
+
+/*
+ * Returns a useful dispatch object for value using a process similar to
+ * the ToObject operation specified in http://es5.github.com/#x9.9
+ */
+module.exports.dispatchableObject = dispatchableObject
+function dispatchableObject (value) {
+ // To shut up jshint, which doesn't let me turn off this warning.
+ const Obj = Object
+ if (value === null) { return _null }
+ if (value === undefined) { return _undefined }
+ switch (typeof value) {
+ case 'object': return value
+ case 'boolean': return boolCache[value]
+ case 'number': return numCache[value] || (numCache[value] = new Num(value))
+ case 'string': return strCache[value] || (strCache[value] = new Str(value))
+ default: return new Obj(value)
+ }
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/package.json b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/package.json
new file mode 100644
index 0000000000..e404938743
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/node_modules/genfun/package.json
@@ -0,0 +1,79 @@
+{
+ "_from": "genfun@^4.0.1",
+ "_id": "genfun@4.0.1",
+ "_inBundle": false,
+ "_integrity": "sha1-7RAEHy5KfxsKOEZtF6XD4n3x38E=",
+ "_location": "/libcipm/protoduck/genfun",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "genfun@^4.0.1",
+ "name": "genfun",
+ "escapedName": "genfun",
+ "rawSpec": "^4.0.1",
+ "saveSpec": null,
+ "fetchSpec": "^4.0.1"
+ },
+ "_requiredBy": [
+ "/libcipm/protoduck"
+ ],
+ "_resolved": "https://registry.npmjs.org/genfun/-/genfun-4.0.1.tgz",
+ "_shasum": "ed10041f2e4a7f1b0a38466d17a5c3e27df1dfc1",
+ "_spec": "genfun@^4.0.1",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/libcipm/node_modules/protoduck",
+ "author": {
+ "name": "Kat Marchán",
+ "email": "kzm@sykosomatic.org"
+ },
+ "bugs": {
+ "url": "https://github.com/zkat/genfun/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {},
+ "deprecated": false,
+ "description": "Fast, prototype-friendly multimethods.",
+ "devDependencies": {
+ "mocha": "^3.2.0",
+ "nyc": "^10.2.0",
+ "standard": "^10.0.2",
+ "standard-version": "^4.0.0",
+ "weallbehave": "^1.0.3",
+ "weallcontribute": "^1.0.8"
+ },
+ "files": [
+ "lib/*.js"
+ ],
+ "homepage": "http://github.com/zkat/genfun",
+ "keywords": [
+ "clos",
+ "functional",
+ "oop",
+ "util",
+ "object oriented",
+ "prototypes",
+ "multimethod",
+ "generic functions",
+ "multiple dispatch",
+ "polymorphism",
+ "polymorphic",
+ "protocols"
+ ],
+ "license": "CC0-1.0",
+ "main": "lib/genfun.js",
+ "name": "genfun",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/zkat/genfun.git"
+ },
+ "scripts": {
+ "postrelease": "npm publish && git push --follow-tags",
+ "prerelease": "npm t",
+ "pretest": "standard lib",
+ "release": "standard-version -s",
+ "test": "nyc -- mocha --reporter spec",
+ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'",
+ "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'"
+ },
+ "version": "4.0.1"
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/protoduck/package.json b/deps/npm/node_modules/libcipm/node_modules/protoduck/package.json
new file mode 100644
index 0000000000..28959e813c
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/protoduck/package.json
@@ -0,0 +1,88 @@
+{
+ "_from": "protoduck@^5.0.0",
+ "_id": "protoduck@5.0.0",
+ "_inBundle": false,
+ "_integrity": "sha512-agsGWD8/RZrS4ga6v82Fxb0RHIS2RZnbsSue6A9/MBRhB/jcqOANAMNrqM9900b8duj+Gx+T/JMy5IowDoO/hQ==",
+ "_location": "/libcipm/protoduck",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "protoduck@^5.0.0",
+ "name": "protoduck",
+ "escapedName": "protoduck",
+ "rawSpec": "^5.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^5.0.0"
+ },
+ "_requiredBy": [
+ "/libcipm"
+ ],
+ "_resolved": "https://registry.npmjs.org/protoduck/-/protoduck-5.0.0.tgz",
+ "_shasum": "752145e6be0ad834cb25716f670a713c860dce70",
+ "_spec": "protoduck@^5.0.0",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/libcipm",
+ "author": {
+ "name": "Kat Marchán",
+ "email": "kzm@sykosomatic.org"
+ },
+ "bugs": {
+ "url": "https://github.com/zkat/protoduck/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "genfun": "^4.0.1"
+ },
+ "deprecated": false,
+ "description": "Fancy duck typing for the most serious of ducks.",
+ "devDependencies": {
+ "mocha": "^3.2.0",
+ "nyc": "^10.2.0",
+ "standard": "^10.0.2",
+ "standard-version": "^4.0.0",
+ "tap": "^10.3.2",
+ "weallbehave": "^1.0.3",
+ "weallcontribute": "^1.0.8"
+ },
+ "files": [
+ "index.js"
+ ],
+ "homepage": "https://github.com/zkat/protoduck#readme",
+ "keywords": [
+ "oop",
+ "util",
+ "object oriented",
+ "duck type",
+ "ducktype",
+ "ducktyping",
+ "protocols",
+ "multimethod",
+ "clojure",
+ "haskell",
+ "rust",
+ "generic",
+ "functions",
+ "clos",
+ "polymorphism",
+ "impl",
+ "typeclass",
+ "traits"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "name": "protoduck",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/zkat/protoduck.git"
+ },
+ "scripts": {
+ "postrelease": "npm publish && git push --follow-tags",
+ "prerelease": "npm t",
+ "pretest": "standard",
+ "release": "standard-version -s",
+ "test": "tap -J --coverage test/*.js",
+ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'",
+ "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'"
+ },
+ "version": "5.0.0"
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/.travis.yml b/deps/npm/node_modules/libcipm/node_modules/worker-farm/.travis.yml
new file mode 100644
index 0000000000..1c9e2b559d
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/.travis.yml
@@ -0,0 +1,12 @@
+language: node_js
+node_js:
+ - 4
+ - 6
+ - 8
+ - 9
+branches:
+ only:
+ - master
+notifications:
+ email:
+ - rod@vagg.org
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/LICENSE.md b/deps/npm/node_modules/libcipm/node_modules/worker-farm/LICENSE.md
new file mode 100644
index 0000000000..274c9b4607
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/LICENSE.md
@@ -0,0 +1,13 @@
+The MIT License (MIT)
+=====================
+
+Copyright (c) 2014 LevelUP contributors
+---------------------------------------
+
+*LevelUP contributors listed at <https://github.com/rvagg/node-levelup#contributors>*
+
+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/deps/npm/node_modules/libcipm/node_modules/worker-farm/README.md b/deps/npm/node_modules/libcipm/node_modules/worker-farm/README.md
new file mode 100644
index 0000000000..87ee4b61b5
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/README.md
@@ -0,0 +1,144 @@
+# Worker Farm [![Build Status](https://secure.travis-ci.org/rvagg/node-worker-farm.png)](http://travis-ci.org/rvagg/node-worker-farm)
+
+[![NPM](https://nodei.co/npm/worker-farm.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/worker-farm/) [![NPM](https://nodei.co/npm-dl/worker-farm.png?months=6&height=3)](https://nodei.co/npm/worker-farm/)
+
+
+Distribute processing tasks to child processes with an über-simple API and baked-in durability & custom concurrency options. *Available in npm as <strong>worker-farm</strong>*.
+
+## Example
+
+Given a file, *child.js*:
+
+```js
+module.exports = function (inp, callback) {
+ callback(null, inp + ' BAR (' + process.pid + ')')
+}
+```
+
+And a main file:
+
+```js
+var workerFarm = require('worker-farm')
+ , workers = workerFarm(require.resolve('./child'))
+ , ret = 0
+
+for (var i = 0; i < 10; i++) {
+ workers('#' + i + ' FOO', function (err, outp) {
+ console.log(outp)
+ if (++ret == 10)
+ workerFarm.end(workers)
+ })
+}
+```
+
+We'll get an output something like the following:
+
+```
+#1 FOO BAR (8546)
+#0 FOO BAR (8545)
+#8 FOO BAR (8545)
+#9 FOO BAR (8546)
+#2 FOO BAR (8548)
+#4 FOO BAR (8551)
+#3 FOO BAR (8549)
+#6 FOO BAR (8555)
+#5 FOO BAR (8553)
+#7 FOO BAR (8557)
+```
+
+This example is contained in the *[examples/basic](https://github.com/rvagg/node-worker-farm/tree/master/examples/basic/)* directory.
+
+### Example #1: Estimating π using child workers
+
+You will also find a more complex example in *[examples/pi](https://github.com/rvagg/node-worker-farm/tree/master/examples/pi/)* that estimates the value of **π** by using a Monte Carlo *area-under-the-curve* method and compares the speed of doing it all in-process vs using child workers to complete separate portions.
+
+Running `node examples/pi` will give you something like:
+
+```
+Doing it the slow (single-process) way...
+π ≈ 3.1416269360000006 (0.0000342824102075312 away from actual!)
+took 8341 milliseconds
+Doing it the fast (multi-process) way...
+π ≈ 3.1416233600000036 (0.00003070641021052367 away from actual!)
+took 1985 milliseconds
+```
+
+## Durability
+
+An important feature of Worker Farm is **call durability**. If a child process dies for any reason during the execution of call(s), those calls will be re-queued and taken care of by other child processes. In this way, when you ask for something to be done, unless there is something *seriously* wrong with what you're doing, you should get a result on your callback function.
+
+## My use-case
+
+There are other libraries for managing worker processes available but my use-case was fairly specific: I need to make heavy use of the [node-java](https://github.com/nearinfinity/node-java) library to interact with JVM code. Unfortunately, because the JVM garbage collector is so difficult to interact with, it's prone to killing your Node process when the GC kicks under heavy load. For safety I needed a durable way to make calls so that (1) it wouldn't kill my main process and (2) any calls that weren't successful would be resubmitted for processing.
+
+Worker Farm allows me to spin up multiple JVMs to be controlled by Node, and have a single, uncomplicated API that acts the same way as an in-process API and the calls will be taken care of by a child process even if an error kills a child process while it is working as the call will simply be passed to a new child process.
+
+**But**, don't think that Worker Farm is specific to that use-case, it's designed to be very generic and simple to adapt to anything requiring the use of child Node processes.
+
+## API
+
+Worker Farm exports a main function and an `end()` method. The main function sets up a "farm" of coordinated child-process workers and it can be used to instantiate multiple farms, all operating independently.
+
+### workerFarm([options, ]pathToModule[, exportedMethods])
+
+In its most basic form, you call `workerFarm()` with the path to a module file to be invoked by the child process. You should use an **absolute path** to the module file, the best way to obtain the path is with `require.resolve('./path/to/module')`, this function can be used in exactly the same way as `require('./path/to/module')` but it returns an absolute path.
+
+#### `exportedMethods`
+
+If your module exports a single function on `module.exports` then you should omit the final parameter. However, if you are exporting multiple functions on `module.exports` then you should list them in an Array of Strings:
+
+```js
+var workers = workerFarm(require.resolve('./mod'), [ 'doSomething', 'doSomethingElse' ])
+workers.doSomething(function () {})
+workers.doSomethingElse(function () {})
+```
+
+Listing the available methods will instruct Worker Farm what API to provide you with on the returned object. If you don't list a `exportedMethods` Array then you'll get a single callable function to use; but if you list the available methods then you'll get an object with callable functions by those names.
+
+**It is assumed that each function you call on your child module will take a `callback` function as the last argument.**
+
+#### `options`
+
+If you don't provide an `options` object then the following defaults will be used:
+
+```js
+{
+ maxCallsPerWorker : Infinity
+ , maxConcurrentWorkers : require('os').cpus().length
+ , maxConcurrentCallsPerWorker : 10
+ , maxConcurrentCalls : Infinity
+ , maxCallTime : Infinity
+ , maxRetries : Infinity
+ , autoStart : false
+}
+```
+
+ * **<code>maxCallsPerWorker</code>** allows you to control the lifespan of your child processes. A positive number will indicate that you only want each child to accept that many calls before it is terminated. This may be useful if you need to control memory leaks or similar in child processes.
+
+ * **<code>maxConcurrentWorkers</code>** will set the number of child processes to maintain concurrently. By default it is set to the number of CPUs available on the current system, but it can be any reasonable number, including `1`.
+
+ * **<code>maxConcurrentCallsPerWorker</code>** allows you to control the *concurrency* of individual child processes. Calls are placed into a queue and farmed out to child processes according to the number of calls they are allowed to handle concurrently. It is arbitrarily set to 10 by default so that calls are shared relatively evenly across workers, however if your calls predictably take a similar amount of time then you could set it to `Infinity` and Worker Farm won't queue any calls but spread them evenly across child processes and let them go at it. If your calls aren't I/O bound then it won't matter what value you use here as the individual workers won't be able to execute more than a single call at a time.
+
+ * **<code>maxConcurrentCalls</code>** allows you to control the maximum number of calls in the queue&mdash;either actively being processed or waiting for a worker to be processed. `Infinity` indicates no limit but if you have conditions that may endlessly queue jobs and you need to set a limit then provide a `>0` value and any calls that push the limit will return on their callback with a `MaxConcurrentCallsError` error (check `err.type == 'MaxConcurrentCallsError'`).
+
+ * **<code>maxCallTime</code>** *(use with caution, understand what this does before you use it!)* when `!== Infinity`, will cap a time, in milliseconds, that *any single call* can take to execute in a worker. If this time limit is exceeded by just a single call then the worker running that call will be killed and any calls running on that worker will have their callbacks returned with a `TimeoutError` (check `err.type == 'TimeoutError'`). If you are running with `maxConcurrentCallsPerWorker` value greater than `1` then **all calls currently executing** will fail and will be automatically resubmitted uless you've changed the `maxRetries` option. Use this if you have jobs that may potentially end in infinite loops that you can't programatically end with your child code. Preferably run this with a `maxConcurrentCallsPerWorker` so you don't interrupt other calls when you have a timeout. This timeout operates on a per-call basis but will interrupt a whole worker.
+
+ * **<code>maxRetries</code>** allows you to control the max number of call requeues after worker termination (unexpected or timeout). By default this option is set to `Infinity` which means that each call of each terminated worker will always be auto requeued. When the number of retries exceeds `maxRetries` value, the job callback will be executed with a `ProcessTerminatedError`. Note that if you are running with finite `maxCallTime` and `maxConcurrentCallsPerWorkers` greater than `1` then any `TimeoutError` will increase the retries counter *for each* concurrent call of the terminated worker.
+
+ * **<code>autoStart</code>** when set to `true` will start the workers as early as possible. Use this when your workers have to do expensive initialization. That way they'll be ready when the first request comes through.
+
+### workerFarm.end(farm)
+
+Child processes stay alive waiting for jobs indefinitely and your farm manager will stay alive managing its workers, so if you need it to stop then you have to do so explicitly. If you send your farm API to `workerFarm.end()` then it'll cleanly end your worker processes. Note though that it's a *soft* ending so it'll wait for child processes to finish what they are working on before asking them to die.
+
+Any calls that are queued and not yet being handled by a child process will be discarded. `end()` only waits for those currently in progress.
+
+Once you end a farm, it won't handle any more calls, so don't even try!
+
+## Related
+
+* [farm-cli](https://github.com/Kikobeats/farm-cli) – Launch a farm of workers from CLI.
+
+## License
+
+Worker Farm is Copyright (c) 2014 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/basic/child.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/basic/child.js
new file mode 100644
index 0000000000..41e124b06e
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/basic/child.js
@@ -0,0 +1,5 @@
+'use strict'
+
+module.exports = function (inp, callback) {
+ callback(null, inp + ' BAR (' + process.pid + ')')
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/basic/index.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/basic/index.js
new file mode 100644
index 0000000000..3c9a1086e9
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/basic/index.js
@@ -0,0 +1,13 @@
+'use strict'
+
+let workerFarm = require('../../')
+ , workers = workerFarm(require.resolve('./child'))
+ , ret = 0
+
+for (let i = 0; i < 10; i++) {
+ workers('#' + i + ' FOO', function (err, outp) {
+ console.log(outp)
+ if (++ret == 10)
+ workerFarm.end(workers)
+ })
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/pi/calc.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/pi/calc.js
new file mode 100644
index 0000000000..42c77c2bd2
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/pi/calc.js
@@ -0,0 +1,22 @@
+'use strict'
+
+/* A simple π estimation function using a Monte Carlo method
+ * For 0 to `points`, take 2 random numbers < 1, square and add them to
+ * find the area under that point in a 1x1 square. If that area is <= 1
+ * then it's *within* a quarter-circle, otherwise it's outside.
+ * Take the number of points <= 1 and multiply it by 4 and you have an
+ * estimate!
+ * Do this across multiple processes and average the results to
+ * increase accuracy.
+ */
+
+module.exports = function (points, callback) {
+ let inside = 0
+ , i = points
+
+ while (i--)
+ if (Math.pow(Math.random(), 2) + Math.pow(Math.random(), 2) <= 1)
+ inside++
+
+ callback(null, (inside / points) * 4)
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/pi/index.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/pi/index.js
new file mode 100644
index 0000000000..b7b26839ed
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/examples/pi/index.js
@@ -0,0 +1,41 @@
+'use strict'
+
+const CHILDREN = 500
+ , POINTS_PER_CHILD = 1000000
+ , FARM_OPTIONS = {
+ maxConcurrentWorkers : require('os').cpus().length
+ , maxCallsPerWorker : Infinity
+ , maxConcurrentCallsPerWorker : 1
+ }
+
+let workerFarm = require('../../')
+ , calcDirect = require('./calc')
+ , calcWorker = workerFarm(FARM_OPTIONS, require.resolve('./calc'))
+
+ , ret
+ , start
+
+ , tally = function (finish, err, avg) {
+ ret.push(avg)
+ if (ret.length == CHILDREN) {
+ let pi = ret.reduce(function (a, b) { return a + b }) / ret.length
+ , end = +new Date()
+ console.log('π ≈', pi, '\t(' + Math.abs(pi - Math.PI), 'away from actual!)')
+ console.log('took', end - start, 'milliseconds')
+ if (finish)
+ finish()
+ }
+ }
+
+ , calc = function (method, callback) {
+ ret = []
+ start = +new Date()
+ for (let i = 0; i < CHILDREN; i++)
+ method(POINTS_PER_CHILD, tally.bind(null, callback))
+ }
+
+console.log('Doing it the slow (single-process) way...')
+calc(calcDirect, function () {
+ console.log('Doing it the fast (multi-process) way...')
+ calc(calcWorker, process.exit)
+})
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/index.d.ts b/deps/npm/node_modules/libcipm/node_modules/worker-farm/index.d.ts
new file mode 100644
index 0000000000..682c21f410
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/index.d.ts
@@ -0,0 +1,44 @@
+interface Workers {
+ (callback: WorkerCallback): void;
+ (arg1: any, callback: WorkerCallback): void;
+ (arg1: any, arg2: any, callback: WorkerCallback): void;
+ (arg1: any, arg2: any, arg3: any, callback: WorkerCallback): void;
+ (arg1: any, arg2: any, arg3: any, arg4: any, callback: WorkerCallback): void;
+}
+
+type WorkerCallback =
+ | WorkerCallback0
+ | WorkerCallback1
+ | WorkerCallback2
+ | WorkerCallback3
+ | WorkerCallback4;
+
+type WorkerCallback0 = () => void;
+type WorkerCallback1 = (arg1: any) => void;
+type WorkerCallback2 = (arg1: any, arg2: any) => void;
+type WorkerCallback3 = (arg1: any, arg2: any, arg3: any) => void;
+type WorkerCallback4 = (arg1: any, arg2: any, arg3: any, arg4: any) => void;
+
+interface FarmOptions {
+ maxCallsPerWorker?: number
+ maxConcurrentWorkers?: number
+ maxConcurrentCallsPerWorker?: number
+ maxConcurrentCalls?: number
+ maxCallTime?: number
+ maxRetries?: number
+ autoStart?: boolean
+}
+
+interface WorkerFarm {
+ (name: string): Workers;
+ (name: string, exportedMethods: string[]): Workers;
+ (options: FarmOptions, name: string): Workers;
+ (options: FarmOptions, name: string, exportedMethods: string[]): Workers;
+
+ end: (workers: Workers) => void;
+}
+
+declare module "worker-farm" {
+ const workerFarm: WorkerFarm;
+ export = workerFarm;
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/child/index.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/child/index.js
new file mode 100644
index 0000000000..f91e08433a
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/child/index.js
@@ -0,0 +1,52 @@
+'use strict'
+
+let $module
+
+/*
+ let contextProto = this.context;
+ while (contextProto = Object.getPrototypeOf(contextProto)) {
+ completionGroups.push(Object.getOwnPropertyNames(contextProto));
+ }
+*/
+
+
+function handle (data) {
+ let idx = data.idx
+ , child = data.child
+ , method = data.method
+ , args = data.args
+ , callback = function () {
+ let _args = Array.prototype.slice.call(arguments)
+ if (_args[0] instanceof Error) {
+ let e = _args[0]
+ _args[0] = {
+ '$error' : '$error'
+ , 'type' : e.constructor.name
+ , 'message' : e.message
+ , 'stack' : e.stack
+ }
+ Object.keys(e).forEach(function(key) {
+ _args[0][key] = e[key]
+ })
+ }
+ process.send({ idx: idx, child: child, args: _args })
+ }
+ , exec
+
+ if (method == null && typeof $module == 'function')
+ exec = $module
+ else if (typeof $module[method] == 'function')
+ exec = $module[method]
+
+ if (!exec)
+ return console.error('NO SUCH METHOD:', method)
+
+ exec.apply(null, args.concat([ callback ]))
+}
+
+
+process.on('message', function (data) {
+ if (!$module) return $module = require(data.module)
+ if (data == 'die') return process.exit(0)
+ handle(data)
+})
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/farm.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/farm.js
new file mode 100644
index 0000000000..c77c95d2c7
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/farm.js
@@ -0,0 +1,339 @@
+'use strict'
+
+const DEFAULT_OPTIONS = {
+ maxCallsPerWorker : Infinity
+ , maxConcurrentWorkers : (require('os').cpus() || { length: 1 }).length
+ , maxConcurrentCallsPerWorker : 10
+ , maxConcurrentCalls : Infinity
+ , maxCallTime : Infinity // exceed this and the whole worker is terminated
+ , maxRetries : Infinity
+ , forcedKillTime : 100
+ , autoStart : false
+ }
+
+const extend = require('xtend')
+ , fork = require('./fork')
+ , TimeoutError = require('errno').create('TimeoutError')
+ , ProcessTerminatedError = require('errno').create('ProcessTerminatedError')
+ , MaxConcurrentCallsError = require('errno').create('MaxConcurrentCallsError')
+
+
+function Farm (options, path) {
+ this.options = extend(DEFAULT_OPTIONS, options)
+ this.path = path
+ this.activeCalls = 0
+}
+
+
+// make a handle to pass back in the form of an external API
+Farm.prototype.mkhandle = function (method) {
+ return function () {
+ let args = Array.prototype.slice.call(arguments)
+ if (this.activeCalls >= this.options.maxConcurrentCalls) {
+ let err = new MaxConcurrentCallsError('Too many concurrent calls (' + this.activeCalls + ')')
+ if (typeof args[args.length - 1] == 'function')
+ return process.nextTick(args[args.length - 1].bind(null, err))
+ throw err
+ }
+ this.addCall({
+ method : method
+ , callback : args.pop()
+ , args : args
+ , retries : 0
+ })
+ }.bind(this)
+}
+
+
+// a constructor of sorts
+Farm.prototype.setup = function (methods) {
+ let iface
+ if (!methods) { // single-function export
+ iface = this.mkhandle()
+ } else { // multiple functions on the export
+ iface = {}
+ methods.forEach(function (m) {
+ iface[m] = this.mkhandle(m)
+ }.bind(this))
+ }
+
+ this.searchStart = -1
+ this.childId = -1
+ this.children = {}
+ this.activeChildren = 0
+ this.callQueue = []
+
+ if (this.options.autoStart) {
+ while (this.activeChildren < this.options.maxConcurrentWorkers)
+ this.startChild()
+ }
+
+ return iface
+}
+
+
+// when a child exits, check if there are any outstanding jobs and requeue them
+Farm.prototype.onExit = function (childId) {
+ // delay this to give any sends a chance to finish
+ setTimeout(function () {
+ let doQueue = false
+ if (this.children[childId] && this.children[childId].activeCalls) {
+ this.children[childId].calls.forEach(function (call, i) {
+ if (!call) return
+ else if (call.retries >= this.options.maxRetries) {
+ this.receive({
+ idx : i
+ , child : childId
+ , args : [ new ProcessTerminatedError('cancel after ' + call.retries + ' retries!') ]
+ })
+ } else {
+ call.retries++
+ this.callQueue.unshift(call)
+ doQueue = true
+ }
+ }.bind(this))
+ }
+ this.stopChild(childId)
+ doQueue && this.processQueue()
+ }.bind(this), 10)
+}
+
+
+// start a new worker
+Farm.prototype.startChild = function () {
+ this.childId++
+
+ let forked = fork(this.path)
+ , id = this.childId
+ , c = {
+ send : forked.send
+ , child : forked.child
+ , calls : []
+ , activeCalls : 0
+ , exitCode : null
+ }
+
+ forked.child.on('message', this.receive.bind(this))
+ forked.child.once('exit', function (code) {
+ c.exitCode = code
+ this.onExit(id)
+ }.bind(this))
+
+ this.activeChildren++
+ this.children[id] = c
+}
+
+
+// stop a worker, identified by id
+Farm.prototype.stopChild = function (childId) {
+ let child = this.children[childId]
+ if (child) {
+ child.send('die')
+ setTimeout(function () {
+ if (child.exitCode === null)
+ child.child.kill('SIGKILL')
+ }, this.options.forcedKillTime).unref()
+ ;delete this.children[childId]
+ this.activeChildren--
+ }
+}
+
+
+// called from a child process, the data contains information needed to
+// look up the child and the original call so we can invoke the callback
+Farm.prototype.receive = function (data) {
+ let idx = data.idx
+ , childId = data.child
+ , args = data.args
+ , child = this.children[childId]
+ , call
+
+ if (!child) {
+ return console.error(
+ 'Worker Farm: Received message for unknown child. '
+ + 'This is likely as a result of premature child death, '
+ + 'the operation will have been re-queued.'
+ )
+ }
+
+ call = child.calls[idx]
+ if (!call) {
+ return console.error(
+ 'Worker Farm: Received message for unknown index for existing child. '
+ + 'This should not happen!'
+ )
+ }
+
+ if (this.options.maxCallTime !== Infinity)
+ clearTimeout(call.timer)
+
+ if (args[0] && args[0].$error == '$error') {
+ let e = args[0]
+ switch (e.type) {
+ case 'TypeError': args[0] = new TypeError(e.message); break
+ case 'RangeError': args[0] = new RangeError(e.message); break
+ case 'EvalError': args[0] = new EvalError(e.message); break
+ case 'ReferenceError': args[0] = new ReferenceError(e.message); break
+ case 'SyntaxError': args[0] = new SyntaxError(e.message); break
+ case 'URIError': args[0] = new URIError(e.message); break
+ default: args[0] = new Error(e.message)
+ }
+ args[0].type = e.type
+ args[0].stack = e.stack
+
+ // Copy any custom properties to pass it on.
+ Object.keys(e).forEach(function(key) {
+ args[0][key] = e[key];
+ });
+ }
+
+ process.nextTick(function () {
+ call.callback.apply(null, args)
+ })
+
+ ;delete child.calls[idx]
+ child.activeCalls--
+ this.activeCalls--
+
+ if (child.calls.length >= this.options.maxCallsPerWorker
+ && !Object.keys(child.calls).length) {
+ // this child has finished its run, kill it
+ this.stopChild(childId)
+ }
+
+ // allow any outstanding calls to be processed
+ this.processQueue()
+}
+
+
+Farm.prototype.childTimeout = function (childId) {
+ let child = this.children[childId]
+ , i
+
+ if (!child)
+ return
+
+ for (i in child.calls) {
+ this.receive({
+ idx : i
+ , child : childId
+ , args : [ new TimeoutError('worker call timed out!') ]
+ })
+ }
+ this.stopChild(childId)
+}
+
+
+// send a call to a worker, identified by id
+Farm.prototype.send = function (childId, call) {
+ let child = this.children[childId]
+ , idx = child.calls.length
+
+ child.calls.push(call)
+ child.activeCalls++
+ this.activeCalls++
+
+ child.send({
+ idx : idx
+ , child : childId
+ , method : call.method
+ , args : call.args
+ })
+
+ if (this.options.maxCallTime !== Infinity) {
+ call.timer =
+ setTimeout(this.childTimeout.bind(this, childId), this.options.maxCallTime)
+ }
+}
+
+
+// a list of active worker ids, in order, but the starting offset is
+// shifted each time this method is called, so we work our way through
+// all workers when handing out jobs
+Farm.prototype.childKeys = function () {
+ let cka = Object.keys(this.children)
+ , cks
+
+ if (this.searchStart >= cka.length - 1)
+ this.searchStart = 0
+ else
+ this.searchStart++
+
+ cks = cka.splice(0, this.searchStart)
+
+ return cka.concat(cks)
+}
+
+
+// Calls are added to a queue, this processes the queue and is called
+// whenever there might be a chance to send more calls to the workers.
+// The various options all impact on when we're able to send calls,
+// they may need to be kept in a queue until a worker is ready.
+Farm.prototype.processQueue = function () {
+ let cka, i = 0, childId
+
+ if (!this.callQueue.length)
+ return this.ending && this.end()
+
+ if (this.activeChildren < this.options.maxConcurrentWorkers)
+ this.startChild()
+
+ for (cka = this.childKeys(); i < cka.length; i++) {
+ childId = +cka[i]
+ if (this.children[childId].activeCalls < this.options.maxConcurrentCallsPerWorker
+ && this.children[childId].calls.length < this.options.maxCallsPerWorker) {
+
+ this.send(childId, this.callQueue.shift())
+ if (!this.callQueue.length)
+ return this.ending && this.end()
+ } /*else {
+ console.log(
+ , this.children[childId].activeCalls < this.options.maxConcurrentCallsPerWorker
+ , this.children[childId].calls.length < this.options.maxCallsPerWorker
+ , this.children[childId].calls.length , this.options.maxCallsPerWorker)
+ }*/
+ }
+
+ if (this.ending)
+ this.end()
+}
+
+
+// add a new call to the call queue, then trigger a process of the queue
+Farm.prototype.addCall = function (call) {
+ if (this.ending)
+ return this.end() // don't add anything new to the queue
+ this.callQueue.push(call)
+ this.processQueue()
+}
+
+
+// kills child workers when they're all done
+Farm.prototype.end = function (callback) {
+ let complete = true
+ if (this.ending === false)
+ return
+ if (callback)
+ this.ending = callback
+ else if (this.ending == null)
+ this.ending = true
+ Object.keys(this.children).forEach(function (child) {
+ if (!this.children[child])
+ return
+ if (!this.children[child].activeCalls)
+ this.stopChild(child)
+ else
+ complete = false
+ }.bind(this))
+
+ if (complete && typeof this.ending == 'function') {
+ process.nextTick(function () {
+ this.ending()
+ this.ending = false
+ }.bind(this))
+ }
+}
+
+
+module.exports = Farm
+module.exports.TimeoutError = TimeoutError
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/fork.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/fork.js
new file mode 100644
index 0000000000..46cf79b73e
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/fork.js
@@ -0,0 +1,32 @@
+'use strict'
+
+const childProcess = require('child_process')
+ , childModule = require.resolve('./child/index')
+
+
+function fork (forkModule) {
+ // suppress --debug / --inspect flags while preserving others (like --harmony)
+ let filteredArgs = process.execArgv.filter(function (v) {
+ return !(/^--(debug|inspect)/).test(v)
+ })
+ , child = childProcess.fork(childModule, process.argv, {
+ execArgv: filteredArgs
+ , env: process.env
+ , cwd: process.cwd()
+ })
+
+ child.on('error', function() {
+ // this *should* be picked up by onExit and the operation requeued
+ })
+
+ child.send({ module: forkModule })
+
+ // return a send() function for this child
+ return {
+ send : child.send.bind(child)
+ , child : child
+ }
+}
+
+
+module.exports = fork
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/index.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/index.js
new file mode 100644
index 0000000000..4df0902f84
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/lib/index.js
@@ -0,0 +1,34 @@
+'use strict'
+
+const Farm = require('./farm')
+
+let farms = [] // keep record of farms so we can end() them if required
+
+
+function farm (options, path, methods) {
+ if (typeof options == 'string') {
+ methods = path
+ path = options
+ options = {}
+ }
+
+ let f = new Farm(options, path)
+ , api = f.setup(methods)
+
+ farms.push({ farm: f, api: api })
+
+ // return the public API
+ return api
+}
+
+
+function end (api, callback) {
+ for (let i = 0; i < farms.length; i++)
+ if (farms[i] && farms[i].api === api)
+ return farms[i].farm.end(callback)
+ process.nextTick(callback.bind(null, 'Worker farm not found!'))
+}
+
+
+module.exports = farm
+module.exports.end = end \ No newline at end of file
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/.travis.yml b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/.travis.yml
new file mode 100644
index 0000000000..f996821c51
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/.travis.yml
@@ -0,0 +1,11 @@
+sudo: false
+
+language: node_js
+
+node_js:
+ - 9
+ - 8
+ - 7
+ - 6
+ - 5
+ - 4
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/README.md b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/README.md
new file mode 100644
index 0000000000..a4d0fb542d
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/README.md
@@ -0,0 +1,145 @@
+# node-errno
+
+> Better [libuv](https://github.com/libuv/libuv)/[Node.js](https://nodejs.org)/[io.js](https://iojs.org) error handling & reporting. Available in npm as *errno*.
+
+[![npm](https://img.shields.io/npm/v/errno.svg)](https://www.npmjs.com/package/errno)
+[![Build Status](https://secure.travis-ci.org/rvagg/node-errno.png)](http://travis-ci.org/rvagg/node-errno)
+[![npm](https://img.shields.io/npm/dm/errno.svg)](https://www.npmjs.com/package/errno)
+
+* [errno exposed](#errnoexposed)
+* [Custom errors](#customerrors)
+
+<a name="errnoexposed"></a>
+## errno exposed
+
+Ever find yourself needing more details about Node.js errors? Me too, so *node-errno* contains the errno mappings direct from libuv so you can use them in your code.
+
+**By errno:**
+
+```js
+require('errno').errno[3]
+// → {
+// "errno": 3,
+// "code": "EACCES",
+// "description": "permission denied"
+// }
+```
+
+**By code:**
+
+```js
+require('errno').code.ENOTEMPTY
+// → {
+// "errno": 53,
+// "code": "ENOTEMPTY",
+// "description": "directory not empty"
+// }
+```
+
+**Make your errors more descriptive:**
+
+```js
+var errno = require('errno')
+
+function errmsg(err) {
+ var str = 'Error: '
+ // if it's a libuv error then get the description from errno
+ if (errno.errno[err.errno])
+ str += errno.errno[err.errno].description
+ else
+ str += err.message
+
+ // if it's a `fs` error then it'll have a 'path' property
+ if (err.path)
+ str += ' [' + err.path + ']'
+
+ return str
+}
+
+var fs = require('fs')
+
+fs.readFile('thisisnotarealfile.txt', function (err, data) {
+ if (err)
+ console.log(errmsg(err))
+})
+```
+
+**Use as a command line tool:**
+
+```
+~ $ errno 53
+{
+ "errno": 53,
+ "code": "ENOTEMPTY",
+ "description": "directory not empty"
+}
+~ $ errno EROFS
+{
+ "errno": 56,
+ "code": "EROFS",
+ "description": "read-only file system"
+}
+~ $ errno foo
+No such errno/code: "foo"
+```
+
+Supply no arguments for the full list. Error codes are processed case-insensitive.
+
+You will need to install with `npm install errno -g` if you want the `errno` command to be available without supplying a full path to the node_modules installation.
+
+<a name="customerrors"></a>
+## Custom errors
+
+Use `errno.custom.createError()` to create custom `Error` objects to throw around in your Node.js library. Create error hierarchies so `instanceof` becomes a useful tool in tracking errors. Call-stack is correctly captured at the time you create an instance of the error object, plus a `cause` property will make available the original error object if you pass one in to the constructor.
+
+```js
+var create = require('errno').custom.createError
+var MyError = create('MyError') // inherits from Error
+var SpecificError = create('SpecificError', MyError) // inherits from MyError
+var OtherError = create('OtherError', MyError)
+
+// use them!
+if (condition) throw new SpecificError('Eeek! Something bad happened')
+
+if (err) return callback(new OtherError(err))
+```
+
+Also available is a `errno.custom.FilesystemError` with in-built access to errno properties:
+
+```js
+fs.readFile('foo', function (err, data) {
+ if (err) return callback(new errno.custom.FilesystemError(err))
+ // do something else
+})
+```
+
+The resulting error object passed through the callback will have the following properties: `code`, `errno`, `path` and `message` will contain a descriptive human-readable message.
+
+## Contributors
+
+* [bahamas10](https://github.com/bahamas10) (Dave Eddy) - Added CLI
+* [ralphtheninja](https://github.com/ralphtheninja) (Lars-Magnus Skog)
+
+## Copyright & Licence
+
+*Copyright (c) 2012-2015 [Rod Vagg](https://github.com/rvagg) ([@rvagg](https://twitter.com/rvagg))*
+
+Made available under the MIT licence:
+
+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/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/build.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/build.js
new file mode 100755
index 0000000000..fce89260c1
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/build.js
@@ -0,0 +1,43 @@
+#!/usr/bin/env node
+
+var request = require('request')
+ , fs = require('fs')
+
+ , uvheadloc = 'https://raw.github.com/joyent/libuv/master/include/uv.h'
+ , defreg = /^\s*XX\(\s*([\-\d]+),\s*([A-Z]+),\s*"([^"]*)"\s*\)\s*\\?$/
+
+
+request(uvheadloc, function (err, response) {
+ if (err)
+ throw err
+
+ var data, out
+
+ data = response.body
+ .split('\n')
+ .map(function (line) { return line.match(defreg) })
+ .filter(function (match) { return match })
+ .map(function (match) { return {
+ errno: parseInt(match[1], 10)
+ , code: match[2]
+ , description: match[3]
+ }})
+
+ out = 'var all = module.exports.all = ' + JSON.stringify(data, 0, 1) + '\n\n'
+
+ out += '\nmodule.exports.errno = {\n '
+ + data.map(function (e, i) {
+ return '\'' + e.errno + '\': all[' + i + ']'
+ }).join('\n , ')
+ + '\n}\n\n'
+
+ out += '\nmodule.exports.code = {\n '
+ + data.map(function (e, i) {
+ return '\'' + e.code + '\': all[' + i + ']'
+ }).join('\n , ')
+ + '\n}\n\n'
+
+ out += '\nmodule.exports.custom = require("./custom")(module.exports)\n'
+
+ fs.writeFile('errno.js', out)
+}) \ No newline at end of file
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/cli.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/cli.js
new file mode 100755
index 0000000000..61d179bbe6
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/cli.js
@@ -0,0 +1,22 @@
+#!/usr/bin/env node
+
+var errno = require('./')
+ , arg = process.argv[2]
+ , data, code
+
+if (arg === undefined) {
+ console.log(JSON.stringify(errno.code, null, 2))
+ process.exit(0)
+}
+
+if ((code = +arg) == arg)
+ data = errno.errno[code]
+else
+ data = errno.code[arg] || errno.code[arg.toUpperCase()]
+
+if (data)
+ console.log(JSON.stringify(data, null, 2))
+else {
+ console.error('No such errno/code: "' + arg + '"')
+ process.exit(1)
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/custom.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/custom.js
new file mode 100644
index 0000000000..ca8c1d8dcd
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/custom.js
@@ -0,0 +1,57 @@
+var prr = require('prr')
+
+function init (type, message, cause) {
+ if (!!message && typeof message != 'string') {
+ message = message.message || message.name
+ }
+ prr(this, {
+ type : type
+ , name : type
+ // can be passed just a 'cause'
+ , cause : typeof message != 'string' ? message : cause
+ , message : message
+ }, 'ewr')
+}
+
+// generic prototype, not intended to be actually used - helpful for `instanceof`
+function CustomError (message, cause) {
+ Error.call(this)
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(this, this.constructor)
+ init.call(this, 'CustomError', message, cause)
+}
+
+CustomError.prototype = new Error()
+
+function createError (errno, type, proto) {
+ var err = function (message, cause) {
+ init.call(this, type, message, cause)
+ //TODO: the specificity here is stupid, errno should be available everywhere
+ if (type == 'FilesystemError') {
+ this.code = this.cause.code
+ this.path = this.cause.path
+ this.errno = this.cause.errno
+ this.message =
+ (errno.errno[this.cause.errno]
+ ? errno.errno[this.cause.errno].description
+ : this.cause.message)
+ + (this.cause.path ? ' [' + this.cause.path + ']' : '')
+ }
+ Error.call(this)
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(this, err)
+ }
+ err.prototype = !!proto ? new proto() : new CustomError()
+ return err
+}
+
+module.exports = function (errno) {
+ var ce = function (type, proto) {
+ return createError(errno, type, proto)
+ }
+ return {
+ CustomError : CustomError
+ , FilesystemError : ce('FilesystemError')
+ , createError : ce
+ }
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/errno.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/errno.js
new file mode 100644
index 0000000000..efb79d41b1
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/errno.js
@@ -0,0 +1,313 @@
+var all = module.exports.all = [
+ {
+ errno: -2,
+ code: 'ENOENT',
+ description: 'no such file or directory'
+ },
+ {
+ errno: -1,
+ code: 'UNKNOWN',
+ description: 'unknown error'
+ },
+ {
+ errno: 0,
+ code: 'OK',
+ description: 'success'
+ },
+ {
+ errno: 1,
+ code: 'EOF',
+ description: 'end of file'
+ },
+ {
+ errno: 2,
+ code: 'EADDRINFO',
+ description: 'getaddrinfo error'
+ },
+ {
+ errno: 3,
+ code: 'EACCES',
+ description: 'permission denied'
+ },
+ {
+ errno: 4,
+ code: 'EAGAIN',
+ description: 'resource temporarily unavailable'
+ },
+ {
+ errno: 5,
+ code: 'EADDRINUSE',
+ description: 'address already in use'
+ },
+ {
+ errno: 6,
+ code: 'EADDRNOTAVAIL',
+ description: 'address not available'
+ },
+ {
+ errno: 7,
+ code: 'EAFNOSUPPORT',
+ description: 'address family not supported'
+ },
+ {
+ errno: 8,
+ code: 'EALREADY',
+ description: 'connection already in progress'
+ },
+ {
+ errno: 9,
+ code: 'EBADF',
+ description: 'bad file descriptor'
+ },
+ {
+ errno: 10,
+ code: 'EBUSY',
+ description: 'resource busy or locked'
+ },
+ {
+ errno: 11,
+ code: 'ECONNABORTED',
+ description: 'software caused connection abort'
+ },
+ {
+ errno: 12,
+ code: 'ECONNREFUSED',
+ description: 'connection refused'
+ },
+ {
+ errno: 13,
+ code: 'ECONNRESET',
+ description: 'connection reset by peer'
+ },
+ {
+ errno: 14,
+ code: 'EDESTADDRREQ',
+ description: 'destination address required'
+ },
+ {
+ errno: 15,
+ code: 'EFAULT',
+ description: 'bad address in system call argument'
+ },
+ {
+ errno: 16,
+ code: 'EHOSTUNREACH',
+ description: 'host is unreachable'
+ },
+ {
+ errno: 17,
+ code: 'EINTR',
+ description: 'interrupted system call'
+ },
+ {
+ errno: 18,
+ code: 'EINVAL',
+ description: 'invalid argument'
+ },
+ {
+ errno: 19,
+ code: 'EISCONN',
+ description: 'socket is already connected'
+ },
+ {
+ errno: 20,
+ code: 'EMFILE',
+ description: 'too many open files'
+ },
+ {
+ errno: 21,
+ code: 'EMSGSIZE',
+ description: 'message too long'
+ },
+ {
+ errno: 22,
+ code: 'ENETDOWN',
+ description: 'network is down'
+ },
+ {
+ errno: 23,
+ code: 'ENETUNREACH',
+ description: 'network is unreachable'
+ },
+ {
+ errno: 24,
+ code: 'ENFILE',
+ description: 'file table overflow'
+ },
+ {
+ errno: 25,
+ code: 'ENOBUFS',
+ description: 'no buffer space available'
+ },
+ {
+ errno: 26,
+ code: 'ENOMEM',
+ description: 'not enough memory'
+ },
+ {
+ errno: 27,
+ code: 'ENOTDIR',
+ description: 'not a directory'
+ },
+ {
+ errno: 28,
+ code: 'EISDIR',
+ description: 'illegal operation on a directory'
+ },
+ {
+ errno: 29,
+ code: 'ENONET',
+ description: 'machine is not on the network'
+ },
+ {
+ errno: 31,
+ code: 'ENOTCONN',
+ description: 'socket is not connected'
+ },
+ {
+ errno: 32,
+ code: 'ENOTSOCK',
+ description: 'socket operation on non-socket'
+ },
+ {
+ errno: 33,
+ code: 'ENOTSUP',
+ description: 'operation not supported on socket'
+ },
+ {
+ errno: 34,
+ code: 'ENOENT',
+ description: 'no such file or directory'
+ },
+ {
+ errno: 35,
+ code: 'ENOSYS',
+ description: 'function not implemented'
+ },
+ {
+ errno: 36,
+ code: 'EPIPE',
+ description: 'broken pipe'
+ },
+ {
+ errno: 37,
+ code: 'EPROTO',
+ description: 'protocol error'
+ },
+ {
+ errno: 38,
+ code: 'EPROTONOSUPPORT',
+ description: 'protocol not supported'
+ },
+ {
+ errno: 39,
+ code: 'EPROTOTYPE',
+ description: 'protocol wrong type for socket'
+ },
+ {
+ errno: 40,
+ code: 'ETIMEDOUT',
+ description: 'connection timed out'
+ },
+ {
+ errno: 41,
+ code: 'ECHARSET',
+ description: 'invalid Unicode character'
+ },
+ {
+ errno: 42,
+ code: 'EAIFAMNOSUPPORT',
+ description: 'address family for hostname not supported'
+ },
+ {
+ errno: 44,
+ code: 'EAISERVICE',
+ description: 'servname not supported for ai_socktype'
+ },
+ {
+ errno: 45,
+ code: 'EAISOCKTYPE',
+ description: 'ai_socktype not supported'
+ },
+ {
+ errno: 46,
+ code: 'ESHUTDOWN',
+ description: 'cannot send after transport endpoint shutdown'
+ },
+ {
+ errno: 47,
+ code: 'EEXIST',
+ description: 'file already exists'
+ },
+ {
+ errno: 48,
+ code: 'ESRCH',
+ description: 'no such process'
+ },
+ {
+ errno: 49,
+ code: 'ENAMETOOLONG',
+ description: 'name too long'
+ },
+ {
+ errno: 50,
+ code: 'EPERM',
+ description: 'operation not permitted'
+ },
+ {
+ errno: 51,
+ code: 'ELOOP',
+ description: 'too many symbolic links encountered'
+ },
+ {
+ errno: 52,
+ code: 'EXDEV',
+ description: 'cross-device link not permitted'
+ },
+ {
+ errno: 53,
+ code: 'ENOTEMPTY',
+ description: 'directory not empty'
+ },
+ {
+ errno: 54,
+ code: 'ENOSPC',
+ description: 'no space left on device'
+ },
+ {
+ errno: 55,
+ code: 'EIO',
+ description: 'i/o error'
+ },
+ {
+ errno: 56,
+ code: 'EROFS',
+ description: 'read-only file system'
+ },
+ {
+ errno: 57,
+ code: 'ENODEV',
+ description: 'no such device'
+ },
+ {
+ errno: 58,
+ code: 'ESPIPE',
+ description: 'invalid seek'
+ },
+ {
+ errno: 59,
+ code: 'ECANCELED',
+ description: 'operation canceled'
+ }
+]
+
+module.exports.errno = {}
+module.exports.code = {}
+
+all.forEach(function (error) {
+ module.exports.errno[error.errno] = error
+ module.exports.code[error.code] = error
+})
+
+module.exports.custom = require('./custom')(module.exports)
+module.exports.create = module.exports.custom.createError
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.npmignore b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.npmignore
new file mode 100644
index 0000000000..b512c09d47
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.npmignore
@@ -0,0 +1 @@
+node_modules \ No newline at end of file
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.travis.yml b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.travis.yml
new file mode 100644
index 0000000000..33dcbc3a86
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.travis.yml
@@ -0,0 +1,10 @@
+language: node_js
+node_js:
+ - 0.8
+ - "0.10"
+branches:
+ only:
+ - master
+notifications:
+ email:
+ - rod@vagg.org \ No newline at end of file
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE.md b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE.md
new file mode 100644
index 0000000000..29b95e39a5
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE.md
@@ -0,0 +1,11 @@
+The MIT License (MIT)
+=====================
+
+Copyright (c) 2014 Rod Vagg
+---------------------------
+
+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/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/README.md b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/README.md
new file mode 100644
index 0000000000..b934048235
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/README.md
@@ -0,0 +1,47 @@
+# prr [![Build Status](https://secure.travis-ci.org/rvagg/prr.png)](http://travis-ci.org/rvagg/prr)
+
+An sensible alternative to `Object.defineProperty()`. Available in npm and Ender as **prr**.
+
+## Usage
+
+Set the property `'foo'` (`obj.foo`) to have the value `'bar'` with default options (`'enumerable'`, `'configurable'` and `'writable'` are all `false`):
+
+```js
+prr(obj, 'foo', 'bar')
+```
+
+Adjust the default options:
+
+```js
+prr(obj, 'foo', 'bar', { enumerable: true, writable: true })
+```
+
+Do the same operation for multiple properties:
+
+```js
+prr(obj, { one: 'one', two: 'two' })
+// or with options:
+prr(obj, { one: 'one', two: 'two' }, { enumerable: true, writable: true })
+```
+
+### Simplify!
+
+But obviously, having to write out the full options object makes it nearly as bad as the original `Object.defineProperty()` so we can simplify.
+
+As an alternative method we can use an options string where each character represents a option: `'e'=='enumerable'`, `'c'=='configurable'` and `'w'=='writable'`:
+
+```js
+prr(obj, 'foo', 'bar', 'ew') // enumerable and writable but not configurable
+// muliple properties:
+prr(obj, { one: 'one', two: 'two' }, 'ewc') // configurable too
+```
+
+## Where can I use it?
+
+Anywhere! For pre-ES5 environments *prr* will simply fall-back to an `object[property] = value` so you can get close to what you want.
+
+*prr* is Ender-compatible so you can include it in your Ender build and `$.prr(...)` or `var prr = require('prr'); prr(...)`.
+
+## Licence
+
+prr is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/package.json b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/package.json
new file mode 100644
index 0000000000..ea188043a6
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/package.json
@@ -0,0 +1,58 @@
+{
+ "_from": "prr@~1.0.1",
+ "_id": "prr@1.0.1",
+ "_inBundle": false,
+ "_integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
+ "_location": "/libcipm/worker-farm/errno/prr",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "prr@~1.0.1",
+ "name": "prr",
+ "escapedName": "prr",
+ "rawSpec": "~1.0.1",
+ "saveSpec": null,
+ "fetchSpec": "~1.0.1"
+ },
+ "_requiredBy": [
+ "/libcipm/worker-farm/errno"
+ ],
+ "_resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
+ "_shasum": "d3fc114ba06995a45ec6893f484ceb1d78f5f476",
+ "_spec": "prr@~1.0.1",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno",
+ "author": {
+ "name": "Rod Vagg",
+ "email": "rod@vagg.org",
+ "url": "https://github.com/rvagg"
+ },
+ "bugs": {
+ "url": "https://github.com/rvagg/prr/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {},
+ "deprecated": false,
+ "description": "A better Object.defineProperty()",
+ "devDependencies": {
+ "tap": "*"
+ },
+ "homepage": "https://github.com/rvagg/prr",
+ "keywords": [
+ "property",
+ "properties",
+ "defineProperty",
+ "ender"
+ ],
+ "license": "MIT",
+ "main": "./prr.js",
+ "name": "prr",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/rvagg/prr.git"
+ },
+ "scripts": {
+ "test": "node ./test.js"
+ },
+ "version": "1.0.1"
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/prr.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/prr.js
new file mode 100644
index 0000000000..94f58628be
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/prr.js
@@ -0,0 +1,63 @@
+/*!
+ * prr
+ * (c) 2013 Rod Vagg <rod@vagg.org>
+ * https://github.com/rvagg/prr
+ * License: MIT
+ */
+
+(function (name, context, definition) {
+ if (typeof module != 'undefined' && module.exports)
+ module.exports = definition()
+ else
+ context[name] = definition()
+})('prr', this, function() {
+
+ var setProperty = typeof Object.defineProperty == 'function'
+ ? function (obj, key, options) {
+ Object.defineProperty(obj, key, options)
+ return obj
+ }
+ : function (obj, key, options) { // < es5
+ obj[key] = options.value
+ return obj
+ }
+
+ , makeOptions = function (value, options) {
+ var oo = typeof options == 'object'
+ , os = !oo && typeof options == 'string'
+ , op = function (p) {
+ return oo
+ ? !!options[p]
+ : os
+ ? options.indexOf(p[0]) > -1
+ : false
+ }
+
+ return {
+ enumerable : op('enumerable')
+ , configurable : op('configurable')
+ , writable : op('writable')
+ , value : value
+ }
+ }
+
+ , prr = function (obj, key, value, options) {
+ var k
+
+ options = makeOptions(value, options)
+
+ if (typeof key == 'object') {
+ for (k in key) {
+ if (Object.hasOwnProperty.call(key, k)) {
+ options.value = key[k]
+ setProperty(obj, k, options)
+ }
+ }
+ return obj
+ }
+
+ return setProperty(obj, key, options)
+ }
+
+ return prr
+}) \ No newline at end of file
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/test.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/test.js
new file mode 100644
index 0000000000..5222e3073c
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/node_modules/prr/test.js
@@ -0,0 +1,169 @@
+const test = require('tap').test
+ , prr = require('./')
+
+test('test prr(o, key, value) form', function (t) {
+ t.plan(2)
+
+ var o = {}
+ prr(o, 'foo', 'bar')
+ t.equal(o.foo, 'bar', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo')
+ , {
+ enumerable : false
+ , configurable : false
+ , writable : false
+ , value : 'bar'
+ }
+ , 'correct property descriptor'
+ )
+ t.end()
+})
+
+test('test prr(o, { key: value }) form', function (t) {
+ t.plan(2)
+
+ var o = {}
+ prr(o, { foo: 'bar' })
+
+ t.equal(o.foo, 'bar', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo')
+ , {
+ enumerable : false
+ , configurable : false
+ , writable : false
+ , value : 'bar'
+ }
+ , 'correct property descriptor'
+ )
+ t.end()
+})
+
+test('test multiple key:value pairs', function (t) {
+ var o = { foo: 'bar' }
+
+ prr(o, { one: 'ONE', two: 'TWO', obj: { o: 'o' }})
+
+ t.deepEqual(o, { foo: 'bar' }, 'properties are not enumerable')
+ t.equal(o.one, 'ONE', 'correctly set property')
+ t.equal(o.two, 'TWO', 'correctly set property')
+ t.deepEqual(o.obj, { o: 'o' }, 'correctly set property')
+
+ ;[ 'one', 'two', 'obj' ].forEach(function (p) {
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, p)
+ , {
+ enumerable : false
+ , configurable : false
+ , writable : false
+ , value : p == 'obj' ? { o: 'o' } : p.toUpperCase()
+ }
+ , 'correct property descriptor'
+ )
+ })
+
+ t.end()
+})
+
+test('test descriptor options', function (t) {
+ var o = {}
+
+ prr(o, 'foo', 'bar', {
+ enumerable : true
+ , configurable : false
+ })
+ t.equal(o.foo, 'bar', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo')
+ , {
+ enumerable : true
+ , configurable : false
+ , writable : false
+ , value : 'bar'
+ }
+ , 'correct property descriptor'
+ )
+
+ prr(o, 'foo2', 'bar2', {
+ enumerable : true
+ , configurable : true
+ , writable : false
+ })
+ t.equal(o.foo2, 'bar2', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo2')
+ , {
+ enumerable : true
+ , configurable : true
+ , writable : false
+ , value : 'bar2'
+ }
+ , 'correct property descriptor'
+ )
+
+ prr(o, 'foo3', 'bar3', {
+ enumerable : true
+ , configurable : true
+ , writable : true
+ })
+ t.equal(o.foo3, 'bar3', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo3')
+ , {
+ enumerable : true
+ , configurable : true
+ , writable : true
+ , value : 'bar3'
+ }
+ , 'correct property descriptor'
+ )
+
+ t.end()
+})
+
+
+test('test descriptor options, string form', function (t) {
+ var o = {}
+
+ prr(o, 'foo', 'bar', 'e')
+ t.equal(o.foo, 'bar', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo')
+ , {
+ enumerable : true
+ , configurable : false
+ , writable : false
+ , value : 'bar'
+ }
+ , 'correct property descriptor'
+ )
+
+ prr(o, 'foo2', 'bar2', 'ec')
+ t.equal(o.foo2, 'bar2', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo2')
+ , {
+ enumerable : true
+ , configurable : true
+ , writable : false
+ , value : 'bar2'
+ }
+ , 'correct property descriptor'
+ )
+
+ prr(o, 'foo3', 'bar3', 'ecw')
+ t.equal(o.foo3, 'bar3', 'correct value')
+ t.deepEqual(
+ Object.getOwnPropertyDescriptor(o, 'foo3')
+ , {
+ enumerable : true
+ , configurable : true
+ , writable : true
+ , value : 'bar3'
+ }
+ , 'correct property descriptor'
+ )
+
+ t.end()
+})
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/package.json b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/package.json
new file mode 100644
index 0000000000..cdccb63884
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/package.json
@@ -0,0 +1,62 @@
+{
+ "_from": "errno@~0.1.7",
+ "_id": "errno@0.1.7",
+ "_inBundle": false,
+ "_integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
+ "_location": "/libcipm/worker-farm/errno",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "errno@~0.1.7",
+ "name": "errno",
+ "escapedName": "errno",
+ "rawSpec": "~0.1.7",
+ "saveSpec": null,
+ "fetchSpec": "~0.1.7"
+ },
+ "_requiredBy": [
+ "/libcipm/worker-farm"
+ ],
+ "_resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
+ "_shasum": "4684d71779ad39af177e3f007996f7c67c852618",
+ "_spec": "errno@~0.1.7",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/libcipm/node_modules/worker-farm",
+ "authors": [
+ "Rod Vagg @rvagg <rod@vagg.org> (https://github.com/rvagg)"
+ ],
+ "bin": {
+ "errno": "./cli.js"
+ },
+ "bugs": {
+ "url": "https://github.com/rvagg/node-errno/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "prr": "~1.0.1"
+ },
+ "deprecated": false,
+ "description": "libuv errno details exposed",
+ "devDependencies": {
+ "error-stack-parser": "^2.0.1",
+ "inherits": "^2.0.3",
+ "tape": "~4.8.0"
+ },
+ "homepage": "https://github.com/rvagg/node-errno#readme",
+ "keywords": [
+ "errors",
+ "errno",
+ "libuv"
+ ],
+ "license": "MIT",
+ "main": "errno.js",
+ "name": "errno",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/rvagg/node-errno.git"
+ },
+ "scripts": {
+ "test": "node --use_strict test.js"
+ },
+ "version": "0.1.7"
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/test.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/test.js
new file mode 100644
index 0000000000..1c046357bc
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/errno/test.js
@@ -0,0 +1,88 @@
+var test = require('tape')
+ , inherits = require('inherits')
+ , ErrorStackParser = require('error-stack-parser')
+ , errno = require('./')
+
+test('sanity checks', function (t) {
+ t.ok(errno.all, 'errno.all not found')
+ t.ok(errno.errno, 'errno.errno not found')
+ t.ok(errno.code, 'errno.code not found')
+
+ t.equal(errno.all.length, 60, 'found ' + errno.all.length + ', expected 60')
+ t.equal(errno.errno['-1'], errno.all[1], 'errno -1 not second element')
+
+ t.equal(errno.code['UNKNOWN'], errno.all[1], 'code UNKNOWN not second element')
+
+ t.equal(errno.errno[1], errno.all[3], 'errno 1 not fourth element')
+
+ t.equal(errno.code['EOF'], errno.all[3], 'code EOF not fourth element')
+ t.end()
+})
+
+test('custom errors', function (t) {
+ const Cust = errno.create('FooNotBarError')
+ const cust = new Cust('foo is not bar')
+
+ t.equal(cust.name, 'FooNotBarError', 'correct custom name')
+ t.equal(cust.type, 'FooNotBarError', 'correct custom type')
+ t.equal(cust.message, 'foo is not bar', 'correct custom message')
+ t.notOk(cust.cause, 'no cause')
+ t.end()
+})
+
+test('callstack', function (t) {
+ const MyError = errno.create('MyError')
+
+ function lastFunction (ErrorType, cb) {
+ process.nextTick(cb, new ErrorType('oh noes!'))
+ }
+
+ function secondLastFunction (ErrorType, cb) {
+ lastFunction(ErrorType, cb)
+ }
+
+ function testFrames (t) {
+ return function (err) {
+ const stack = ErrorStackParser.parse(err)
+ t.same(stack[0].functionName, 'lastFunction', 'last stack frame ok')
+ t.same(stack[1].functionName, 'secondLastFunction', 'second last stack frame ok')
+ t.end()
+ }
+ }
+
+ t.test('custom error, default prototype', function (t) {
+ secondLastFunction(MyError, testFrames(t))
+ })
+
+ t.test('custom error, custom prototype', function (t) {
+ const MyError2 = errno.create('MyError2', MyError)
+ secondLastFunction(MyError2, testFrames(t))
+ })
+
+ t.test('custom error, using inheritance', function (t) {
+ const CustomError = errno.custom.CustomError
+
+ function MyError3 (message, cause) {
+ CustomError.call(this, message, cause)
+ }
+
+ inherits(MyError3, CustomError)
+
+ secondLastFunction(MyError3, testFrames(t))
+ })
+})
+
+test('error without message', function (t) {
+ const Cust = errno.create('WriteError')
+ const cust = new Cust({
+ code: 22,
+ message: '',
+ name: 'QuotaExceededError'
+ })
+
+ t.equal(cust.name, 'WriteError', 'correct custom name')
+ t.equal(cust.type, 'WriteError', 'correct custom type')
+ t.equal(cust.message, 'QuotaExceededError', 'message is the name')
+ t.notOk(cust.cause, 'no cause')
+ t.end()
+})
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/.npmignore b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/.npmignore
new file mode 100644
index 0000000000..3c3629e647
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/LICENCE b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/LICENCE
new file mode 100644
index 0000000000..1a14b437e8
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/LICENCE
@@ -0,0 +1,19 @@
+Copyright (c) 2012-2014 Raynos.
+
+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/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/Makefile b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/Makefile
new file mode 100644
index 0000000000..d583fcf49d
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/Makefile
@@ -0,0 +1,4 @@
+browser:
+ node ./support/compile
+
+.PHONY: browser \ No newline at end of file
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/README.md b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/README.md
new file mode 100644
index 0000000000..093cb2978e
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/README.md
@@ -0,0 +1,32 @@
+# xtend
+
+[![browser support][3]][4]
+
+[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges)
+
+Extend like a boss
+
+xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence.
+
+## Examples
+
+```js
+var extend = require("xtend")
+
+// extend returns a new object. Does not mutate arguments
+var combination = extend({
+ a: "a",
+ b: 'c'
+}, {
+ b: "b"
+})
+// { a: "a", b: "b" }
+```
+
+## Stability status: Locked
+
+## MIT Licenced
+
+
+ [3]: http://ci.testling.com/Raynos/xtend.png
+ [4]: http://ci.testling.com/Raynos/xtend
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/immutable.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/immutable.js
new file mode 100644
index 0000000000..94889c9de1
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/immutable.js
@@ -0,0 +1,19 @@
+module.exports = extend
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function extend() {
+ var target = {}
+
+ for (var i = 0; i < arguments.length; i++) {
+ var source = arguments[i]
+
+ for (var key in source) {
+ if (hasOwnProperty.call(source, key)) {
+ target[key] = source[key]
+ }
+ }
+ }
+
+ return target
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/mutable.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/mutable.js
new file mode 100644
index 0000000000..72debede6c
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/mutable.js
@@ -0,0 +1,17 @@
+module.exports = extend
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function extend(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i]
+
+ for (var key in source) {
+ if (hasOwnProperty.call(source, key)) {
+ target[key] = source[key]
+ }
+ }
+ }
+
+ return target
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/package.json b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/package.json
new file mode 100644
index 0000000000..71b59f039e
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/package.json
@@ -0,0 +1,86 @@
+{
+ "_from": "xtend@~4.0.1",
+ "_id": "xtend@4.0.1",
+ "_inBundle": false,
+ "_integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
+ "_location": "/libcipm/worker-farm/xtend",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "xtend@~4.0.1",
+ "name": "xtend",
+ "escapedName": "xtend",
+ "rawSpec": "~4.0.1",
+ "saveSpec": null,
+ "fetchSpec": "~4.0.1"
+ },
+ "_requiredBy": [
+ "/libcipm/worker-farm"
+ ],
+ "_resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
+ "_shasum": "a5c6d532be656e23db820efb943a1f04998d63af",
+ "_spec": "xtend@~4.0.1",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/libcipm/node_modules/worker-farm",
+ "author": {
+ "name": "Raynos",
+ "email": "raynos2@gmail.com"
+ },
+ "bugs": {
+ "url": "https://github.com/Raynos/xtend/issues",
+ "email": "raynos2@gmail.com"
+ },
+ "bundleDependencies": false,
+ "contributors": [
+ {
+ "name": "Jake Verbaten"
+ },
+ {
+ "name": "Matt Esch"
+ }
+ ],
+ "dependencies": {},
+ "deprecated": false,
+ "description": "extend like a boss",
+ "devDependencies": {
+ "tape": "~1.1.0"
+ },
+ "engines": {
+ "node": ">=0.4"
+ },
+ "homepage": "https://github.com/Raynos/xtend",
+ "keywords": [
+ "extend",
+ "merge",
+ "options",
+ "opts",
+ "object",
+ "array"
+ ],
+ "license": "MIT",
+ "main": "immutable",
+ "name": "xtend",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/Raynos/xtend.git"
+ },
+ "scripts": {
+ "test": "node test"
+ },
+ "testling": {
+ "files": "test.js",
+ "browsers": [
+ "ie/7..latest",
+ "firefox/16..latest",
+ "firefox/nightly",
+ "chrome/22..latest",
+ "chrome/canary",
+ "opera/12..latest",
+ "opera/next",
+ "safari/5.1..latest",
+ "ipad/6.0..latest",
+ "iphone/6.0..latest"
+ ]
+ },
+ "version": "4.0.1"
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/test.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/test.js
new file mode 100644
index 0000000000..093a2b061e
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/node_modules/xtend/test.js
@@ -0,0 +1,83 @@
+var test = require("tape")
+var extend = require("./")
+var mutableExtend = require("./mutable")
+
+test("merge", function(assert) {
+ var a = { a: "foo" }
+ var b = { b: "bar" }
+
+ assert.deepEqual(extend(a, b), { a: "foo", b: "bar" })
+ assert.end()
+})
+
+test("replace", function(assert) {
+ var a = { a: "foo" }
+ var b = { a: "bar" }
+
+ assert.deepEqual(extend(a, b), { a: "bar" })
+ assert.end()
+})
+
+test("undefined", function(assert) {
+ var a = { a: undefined }
+ var b = { b: "foo" }
+
+ assert.deepEqual(extend(a, b), { a: undefined, b: "foo" })
+ assert.deepEqual(extend(b, a), { a: undefined, b: "foo" })
+ assert.end()
+})
+
+test("handle 0", function(assert) {
+ var a = { a: "default" }
+ var b = { a: 0 }
+
+ assert.deepEqual(extend(a, b), { a: 0 })
+ assert.deepEqual(extend(b, a), { a: "default" })
+ assert.end()
+})
+
+test("is immutable", function (assert) {
+ var record = {}
+
+ extend(record, { foo: "bar" })
+ assert.equal(record.foo, undefined)
+ assert.end()
+})
+
+test("null as argument", function (assert) {
+ var a = { foo: "bar" }
+ var b = null
+ var c = void 0
+
+ assert.deepEqual(extend(b, a, c), { foo: "bar" })
+ assert.end()
+})
+
+test("mutable", function (assert) {
+ var a = { foo: "bar" }
+
+ mutableExtend(a, { bar: "baz" })
+
+ assert.equal(a.bar, "baz")
+ assert.end()
+})
+
+test("null prototype", function(assert) {
+ var a = { a: "foo" }
+ var b = Object.create(null)
+ b.b = "bar";
+
+ assert.deepEqual(extend(a, b), { a: "foo", b: "bar" })
+ assert.end()
+})
+
+test("null prototype mutable", function (assert) {
+ var a = { foo: "bar" }
+ var b = Object.create(null)
+ b.bar = "baz";
+
+ mutableExtend(a, b)
+
+ assert.equal(a.bar, "baz")
+ assert.end()
+})
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/package.json b/deps/npm/node_modules/libcipm/node_modules/worker-farm/package.json
new file mode 100644
index 0000000000..1bbd3d0044
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/package.json
@@ -0,0 +1,60 @@
+{
+ "_from": "worker-farm@^1.5.4",
+ "_id": "worker-farm@1.5.4",
+ "_inBundle": false,
+ "_integrity": "sha512-ITyClEvcfv0ozqJl1vmWFWhvI+OIrkbInYqkEPE50wFPXj8J9Gd3FYf8+CkZJXJJsQBYe+2DvmoK9Zhx5w8W+w==",
+ "_location": "/libcipm/worker-farm",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "worker-farm@^1.5.4",
+ "name": "worker-farm",
+ "escapedName": "worker-farm",
+ "rawSpec": "^1.5.4",
+ "saveSpec": null,
+ "fetchSpec": "^1.5.4"
+ },
+ "_requiredBy": [
+ "/libcipm"
+ ],
+ "_resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.4.tgz",
+ "_shasum": "4debbe46b40edefcc717ebde74a90b1ae1e909a1",
+ "_spec": "worker-farm@^1.5.4",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/libcipm",
+ "authors": [
+ "Rod Vagg @rvagg <rod@vagg.org> (https://github.com/rvagg)"
+ ],
+ "bugs": {
+ "url": "https://github.com/rvagg/node-worker-farm/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "errno": "~0.1.7",
+ "xtend": "~4.0.1"
+ },
+ "deprecated": false,
+ "description": "Distribute processing tasks to child processes with an über-simple API and baked-in durability & custom concurrency options.",
+ "devDependencies": {
+ "tape": "~4.9.0"
+ },
+ "homepage": "https://github.com/rvagg/node-worker-farm",
+ "keywords": [
+ "worker",
+ "child",
+ "processing",
+ "farm"
+ ],
+ "license": "MIT",
+ "main": "./lib/index.js",
+ "name": "worker-farm",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/rvagg/node-worker-farm.git"
+ },
+ "scripts": {
+ "test": "node ./tests/"
+ },
+ "types": "./index.d.ts",
+ "version": "1.5.4"
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/child.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/child.js
new file mode 100644
index 0000000000..85e8f5789e
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/child.js
@@ -0,0 +1,85 @@
+'use strict'
+
+const fs = require('fs')
+const started = Date.now()
+
+
+module.exports = function (timeout, callback) {
+ callback = callback.bind(null, null, process.pid, Math.random(), timeout)
+ if (timeout)
+ return setTimeout(callback, timeout)
+ callback()
+}
+
+
+module.exports.args = function (callback) {
+ console.log(process.argv)
+ console.log(process.execArgv)
+ callback()
+}
+
+
+module.exports.run0 = function (callback) {
+ module.exports(0, callback)
+}
+
+
+module.exports.killable = function (id, callback) {
+ if (Math.random() < 0.5)
+ return process.exit(-1)
+ callback(null, id, process.pid)
+}
+
+
+module.exports.err = function (type, message, data, callback) {
+ if (typeof data == 'function') {
+ callback = data
+ data = null
+ } else {
+ let err = new Error(message)
+ Object.keys(data).forEach(function(key) {
+ err[key] = data[key]
+ })
+ callback(err)
+ return
+ }
+
+ if (type == 'TypeError')
+ return callback(new TypeError(message))
+ callback(new Error(message))
+}
+
+
+module.exports.block = function () {
+ while (true);
+}
+
+
+// use provided file path to save retries count among terminated workers
+module.exports.stubborn = function (path, callback) {
+ function isOutdated(path) {
+ return ((new Date).getTime() - fs.statSync(path).mtime.getTime()) > 2000
+ }
+
+ // file may not be properly deleted, check if modified no earler than two seconds ago
+ if (!fs.existsSync(path) || isOutdated(path)) {
+ fs.writeFileSync(path, '1')
+ process.exit(-1)
+ }
+
+ let retry = parseInt(fs.readFileSync(path, 'utf8'))
+ if (Number.isNaN(retry))
+ return callback(new Error('file contents is not a number'))
+
+ if (retry > 4) {
+ callback(null, 12)
+ } else {
+ fs.writeFileSync(path, String(retry + 1))
+ process.exit(-1)
+ }
+}
+
+
+module.exports.uptime = function (callback) {
+ callback(null, Date.now() - started)
+}
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/debug.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/debug.js
new file mode 100644
index 0000000000..6ffd446489
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/debug.js
@@ -0,0 +1,11 @@
+'use strict'
+
+const workerFarm = require('../')
+ , workers = workerFarm(require.resolve('./child'), ['args'])
+
+
+workers.args(function() {
+ workerFarm.end(workers)
+ console.log('FINISHED')
+ process.exit(0)
+})
diff --git a/deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/index.js b/deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/index.js
new file mode 100644
index 0000000000..32d200ff7b
--- /dev/null
+++ b/deps/npm/node_modules/libcipm/node_modules/worker-farm/tests/index.js
@@ -0,0 +1,541 @@
+'use strict'
+
+const tape = require('tape')
+ , child_process = require('child_process')
+ , workerFarm = require('../')
+ , childPath = require.resolve('./child')
+ , fs = require('fs')
+
+function uniq (ar) {
+ let a = [], i, j
+ o: for (i = 0; i < ar.length; ++i) {
+ for (j = 0; j < a.length; ++j) if (a[j] == ar[i]) continue o
+ a[a.length] = ar[i]
+ }
+ return a
+}
+
+
+// a child where module.exports = function ...
+tape('simple, exports=function test', function (t) {
+ t.plan(4)
+
+ let child = workerFarm(childPath)
+ child(0, function (err, pid, rnd) {
+ t.ok(pid > process.pid, 'pid makes sense')
+ t.ok(pid < process.pid + 500, 'pid makes sense')
+ t.ok(rnd >= 0 && rnd < 1, 'rnd result makes sense')
+ })
+
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+})
+
+
+// a child where we have module.exports.fn = function ...
+tape('simple, exports.fn test', function (t) {
+ t.plan(4)
+
+ let child = workerFarm(childPath, [ 'run0' ])
+ child.run0(function (err, pid, rnd) {
+ t.ok(pid > process.pid, 'pid makes sense')
+ t.ok(pid < process.pid + 500, 'pid makes sense')
+ t.ok(rnd >= 0 && rnd < 1, 'rnd result makes sense')
+ })
+
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+})
+
+
+// use the returned pids to check that we're using a single child process
+// when maxConcurrentWorkers = 1
+tape('single worker', function (t) {
+ t.plan(2)
+
+ let child = workerFarm({ maxConcurrentWorkers: 1 }, childPath)
+ , pids = []
+ , i = 10
+
+ while (i--) {
+ child(0, function (err, pid) {
+ pids.push(pid)
+ if (pids.length == 10) {
+ t.equal(1, uniq(pids).length, 'only a single process (by pid)')
+ } else if (pids.length > 10)
+ t.fail('too many callbacks!')
+ })
+ }
+
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+})
+
+
+// use the returned pids to check that we're using two child processes
+// when maxConcurrentWorkers = 2
+tape('two workers', function (t) {
+ t.plan(2)
+
+ let child = workerFarm({ maxConcurrentWorkers: 2 }, childPath)
+ , pids = []
+ , i = 10
+
+ while (i--) {
+ child(0, function (err, pid) {
+ pids.push(pid)
+ if (pids.length == 10) {
+ t.equal(2, uniq(pids).length, 'only two child processes (by pid)')
+ } else if (pids.length > 10)
+ t.fail('too many callbacks!')
+ })
+ }
+
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+})
+
+
+// use the returned pids to check that we're using a child process per
+// call when maxConcurrentWorkers = 10
+tape('many workers', function (t) {
+ t.plan(2)
+
+ let child = workerFarm({ maxConcurrentWorkers: 10 }, childPath)
+ , pids = []
+ , i = 10
+
+ while (i--) {
+ child(1, function (err, pid) {
+ pids.push(pid)
+ if (pids.length == 10) {
+ t.equal(10, uniq(pids).length, 'pids are all the same (by pid)')
+ } else if (pids.length > 10)
+ t.fail('too many callbacks!')
+ })
+ }
+
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+})
+
+
+tape('auto start workers', function (t) {
+ let child = workerFarm({ maxConcurrentWorkers: 3, autoStart: true }, childPath, ['uptime'])
+ , pids = []
+ , count = 5
+ , i = count
+ , delay = 250
+
+ t.plan(count + 1)
+
+ setTimeout(function() {
+ while (i--)
+ child.uptime(function (err, uptime) {
+ t.ok(uptime > 10, 'child has been up before the request (' + uptime + 'ms)')
+ })
+
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+ }, delay)
+})
+
+
+// use the returned pids to check that we're using a child process per
+// call when we set maxCallsPerWorker = 1 even when we have maxConcurrentWorkers = 1
+tape('single call per worker', function (t) {
+ t.plan(2)
+
+ let child = workerFarm({
+ maxConcurrentWorkers: 1
+ , maxConcurrentCallsPerWorker: Infinity
+ , maxCallsPerWorker: 1
+ , autoStart: true
+ }, childPath)
+ , pids = []
+ , count = 25
+ , i = count
+
+ while (i--) {
+ child(0, function (err, pid) {
+ pids.push(pid)
+ if (pids.length == count) {
+ t.equal(count, uniq(pids).length, 'one process for each call (by pid)')
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+ } else if (pids.length > count)
+ t.fail('too many callbacks!')
+ })
+ }
+})
+
+
+// use the returned pids to check that we're using a child process per
+// two-calls when we set maxCallsPerWorker = 2 even when we have maxConcurrentWorkers = 1
+tape('two calls per worker', function (t) {
+ t.plan(2)
+
+ let child = workerFarm({
+ maxConcurrentWorkers: 1
+ , maxConcurrentCallsPerWorker: Infinity
+ , maxCallsPerWorker: 2
+ , autoStart: true
+ }, childPath)
+ , pids = []
+ , count = 20
+ , i = count
+
+ while (i--) {
+ child(0, function (err, pid) {
+ pids.push(pid)
+ if (pids.length == count) {
+ t.equal(count / 2, uniq(pids).length, 'one process for each call (by pid)')
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+ } else if (pids.length > count)
+ t.fail('too many callbacks!')
+ })
+ }
+})
+
+
+// use timing to confirm that one worker will process calls sequentially
+tape('many concurrent calls', function (t) {
+ t.plan(2)
+
+ let child = workerFarm({
+ maxConcurrentWorkers: 1
+ , maxConcurrentCallsPerWorker: Infinity
+ , maxCallsPerWorker: Infinity
+ , autoStart: true
+ }, childPath)
+ , defer = 200
+ , count = 200
+ , i = count
+ , cbc = 0
+
+ setTimeout(function () {
+ let start = Date.now()
+
+ while (i--) {
+ child(defer, function () {
+ if (++cbc == count) {
+ let time = Date.now() - start
+ // upper-limit not tied to `count` at all
+ t.ok(time > defer && time < (defer * 2.5), 'processed tasks concurrently (' + time + 'ms)')
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+ } else if (cbc > count)
+ t.fail('too many callbacks!')
+ })
+ }
+ }, 250)
+})
+
+
+// use timing to confirm that one child processes calls sequentially with
+// maxConcurrentCallsPerWorker = 1
+tape('single concurrent call', function (t) {
+ t.plan(2)
+
+ let child = workerFarm({
+ maxConcurrentWorkers: 1
+ , maxConcurrentCallsPerWorker: 1
+ , maxCallsPerWorker: Infinity
+ , autoStart: true
+ }, childPath)
+ , defer = 20
+ , count = 100
+ , i = count
+ , cbc = 0
+
+ setTimeout(function () {
+ let start = Date.now()
+
+ while (i--) {
+ child(defer, function () {
+ if (++cbc == count) {
+ let time = Date.now() - start
+ // upper-limit tied closely to `count`, 1.3 is generous but accounts for all the timers
+ // coming back at the same time and the IPC overhead
+ t.ok(time > (defer * count) && time < (defer * count * 1.3), 'processed tasks sequentially (' + time + ')')
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+ } else if (cbc > count)
+ t.fail('too many callbacks!')
+ })
+ }
+ }, 250)
+})
+
+
+// use timing to confirm that one child processes *only* 5 calls concurrently
+tape('multiple concurrent calls', function (t) {
+ t.plan(2)
+
+ let callsPerWorker = 5
+ , child = workerFarm({
+ maxConcurrentWorkers: 1
+ , maxConcurrentCallsPerWorker: callsPerWorker
+ , maxCallsPerWorker: Infinity
+ , autoStart: true
+ }, childPath)
+ , defer = 100
+ , count = 100
+ , i = count
+ , cbc = 0
+
+ setTimeout(function () {
+ let start = Date.now()
+
+ while (i--) {
+ child(defer, function () {
+ if (++cbc == count) {
+ let time = Date.now() - start
+ // (defer * (count / callsPerWorker + 1)) - if precise it'd be count/callsPerWorker
+ // but accounting for IPC and other overhead, we need to give it a bit of extra time,
+ // hence the +1
+ t.ok(time > (defer * 1.5) && time < (defer * (count / callsPerWorker + 1)), 'processed tasks concurrently (' + time + 'ms)')
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+ } else if (cbc > count)
+ t.fail('too many callbacks!')
+ })
+ }
+ }, 250)
+})
+
+
+// call a method that will die with a probability of 0.5 but expect that
+// we'll get results for each of our calls anyway
+tape('durability', function (t) {
+ t.plan(3)
+
+ let child = workerFarm({ maxConcurrentWorkers: 2 }, childPath, [ 'killable' ])
+ , ids = []
+ , pids = []
+ , count = 20
+ , i = count
+
+ while (i--) {
+ child.killable(i, function (err, id, pid) {
+ ids.push(id)
+ pids.push(pid)
+ if (ids.length == count) {
+ t.ok(uniq(pids).length > 2, 'processed by many (' + uniq(pids).length + ') workers, but got there in the end!')
+ t.ok(uniq(ids).length == count, 'received a single result for each unique call')
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+ } else if (ids.length > count)
+ t.fail('too many callbacks!')
+ })
+ }
+})
+
+
+// a callback provided to .end() can and will be called (uses "simple, exports=function test" to create a child)
+tape('simple, end callback', function (t) {
+ t.plan(4)
+
+ let child = workerFarm(childPath)
+ child(0, function (err, pid, rnd) {
+ t.ok(pid > process.pid, 'pid makes sense ' + pid + ' vs ' + process.pid)
+ t.ok(pid < process.pid + 500, 'pid makes sense ' + pid + ' vs ' + process.pid)
+ t.ok(rnd >= 0 && rnd < 1, 'rnd result makes sense')
+ })
+
+ workerFarm.end(child, function() {
+ t.pass('an .end() callback was successfully called')
+ })
+})
+
+
+tape('call timeout test', function (t) {
+ t.plan(3 + 3 + 4 + 4 + 4 + 3 + 1)
+
+ let child = workerFarm({ maxCallTime: 250, maxConcurrentWorkers: 1 }, childPath)
+
+ // should come back ok
+ child(50, function (err, pid, rnd) {
+ t.ok(pid > process.pid, 'pid makes sense ' + pid + ' vs ' + process.pid)
+ t.ok(pid < process.pid + 500, 'pid makes sense ' + pid + ' vs ' + process.pid)
+ t.ok(rnd > 0 && rnd < 1, 'rnd result makes sense ' + rnd)
+ })
+
+ // should come back ok
+ child(50, function (err, pid, rnd) {
+ t.ok(pid > process.pid, 'pid makes sense ' + pid + ' vs ' + process.pid)
+ t.ok(pid < process.pid + 500, 'pid makes sense ' + pid + ' vs ' + process.pid)
+ t.ok(rnd > 0 && rnd < 1, 'rnd result makes sense ' + rnd)
+ })
+
+ // should die
+ child(500, function (err, pid, rnd) {
+ t.ok(err, 'got an error')
+ t.equal(err.type, 'TimeoutError', 'correct error type')
+ t.ok(pid === undefined, 'no pid')
+ t.ok(rnd === undefined, 'no rnd')
+ })
+
+ // should die
+ child(1000, function (err, pid, rnd) {
+ t.ok(err, 'got an error')
+ t.equal(err.type, 'TimeoutError', 'correct error type')
+ t.ok(pid === undefined, 'no pid')
+ t.ok(rnd === undefined, 'no rnd')
+ })
+
+ // should die even though it is only a 100ms task, it'll get caught up
+ // in a dying worker
+ setTimeout(function () {
+ child(100, function (err, pid, rnd) {
+ t.ok(err, 'got an error')
+ t.equal(err.type, 'TimeoutError', 'correct error type')
+ t.ok(pid === undefined, 'no pid')
+ t.ok(rnd === undefined, 'no rnd')
+ })
+ }, 200)
+
+ // should be ok, new worker
+ setTimeout(function () {
+ child(50, function (err, pid, rnd) {
+ t.ok(pid > process.pid, 'pid makes sense ' + pid + ' vs ' + process.pid)
+ t.ok(pid < process.pid + 500, 'pid makes sense ' + pid + ' vs ' + process.pid)
+ t.ok(rnd > 0 && rnd < 1, 'rnd result makes sense ' + rnd)
+ })
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+ }, 400)
+})
+
+
+tape('test error passing', function (t) {
+ t.plan(10)
+
+ let child = workerFarm(childPath, [ 'err' ])
+ child.err('Error', 'this is an Error', function (err) {
+ t.ok(err instanceof Error, 'is an Error object')
+ t.equal('Error', err.type, 'correct type')
+ t.equal('this is an Error', err.message, 'correct message')
+ })
+ child.err('TypeError', 'this is a TypeError', function (err) {
+ t.ok(err instanceof Error, 'is a TypeError object')
+ t.equal('TypeError', err.type, 'correct type')
+ t.equal('this is a TypeError', err.message, 'correct message')
+ })
+ child.err('Error', 'this is an Error with custom props', {foo: 'bar', 'baz': 1}, function (err) {
+ t.ok(err instanceof Error, 'is an Error object')
+ t.equal(err.foo, 'bar', 'passes data')
+ t.equal(err.baz, 1, 'passes data')
+ })
+
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+})
+
+
+tape('test maxConcurrentCalls', function (t) {
+ t.plan(10)
+
+ let child = workerFarm({ maxConcurrentCalls: 5 }, childPath)
+
+ child(50, function (err) { t.notOk(err, 'no error') })
+ child(50, function (err) { t.notOk(err, 'no error') })
+ child(50, function (err) { t.notOk(err, 'no error') })
+ child(50, function (err) { t.notOk(err, 'no error') })
+ child(50, function (err) { t.notOk(err, 'no error') })
+ child(50, function (err) {
+ t.ok(err)
+ t.equal(err.type, 'MaxConcurrentCallsError', 'correct error type')
+ })
+ child(50, function (err) {
+ t.ok(err)
+ t.equal(err.type, 'MaxConcurrentCallsError', 'correct error type')
+ })
+
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+})
+
+
+// this test should not keep the process running! if the test process
+// doesn't die then the problem is here
+tape('test timeout kill', function (t) {
+ t.plan(3)
+
+ let child = workerFarm({ maxCallTime: 250, maxConcurrentWorkers: 1 }, childPath, [ 'block' ])
+ child.block(function (err) {
+ t.ok(err, 'got an error')
+ t.equal(err.type, 'TimeoutError', 'correct error type')
+ })
+
+ workerFarm.end(child, function () {
+ t.ok(true, 'workerFarm ended')
+ })
+})
+
+
+tape('test max retries after process terminate', function (t) {
+ t.plan(7)
+
+ // temporary file is used to store the number of retries among terminating workers
+ let filepath1 = '.retries1'
+ let child1 = workerFarm({ maxConcurrentWorkers: 1, maxRetries: 5}, childPath, [ 'stubborn' ])
+ child1.stubborn(filepath1, function (err, result) {
+ t.notOk(err, 'no error')
+ t.equal(result, 12, 'correct result')
+ })
+
+ workerFarm.end(child1, function () {
+ fs.unlinkSync(filepath1)
+ t.ok(true, 'workerFarm ended')
+ })
+
+ let filepath2 = '.retries2'
+ let child2 = workerFarm({ maxConcurrentWorkers: 1, maxRetries: 3}, childPath, [ 'stubborn' ])
+ child2.stubborn(filepath2, function (err, result) {
+ t.ok(err, 'got an error')
+ t.equal(err.type, 'ProcessTerminatedError', 'correct error type')
+ t.equal(err.message, 'cancel after 3 retries!', 'correct message and number of retries')
+ })
+
+ workerFarm.end(child2, function () {
+ fs.unlinkSync(filepath2)
+ t.ok(true, 'workerFarm ended')
+ })
+})
+
+
+tape('ensure --debug/--inspect not propagated to children', function (t) {
+ t.plan(3)
+
+ let script = __dirname + '/debug.js'
+ , debugArg = process.version.replace(/^v(\d+)\..*$/, '$1') >= 8 ? '--inspect' : '--debug=8881'
+ , child = child_process.spawn(process.execPath, [ debugArg, script ])
+ , stdout = ''
+
+ child.stdout.on('data', function (data) {
+ stdout += data.toString()
+ })
+
+ child.on('close', function (code) {
+ t.equal(code, 0, 'exited without error (' + code + ')')
+ t.ok(stdout.indexOf('FINISHED') > -1, 'process finished')
+ t.ok(stdout.indexOf('--debug') === -1, 'child does not receive debug flag')
+ })
+})