diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2017-12-08 01:05:23 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-01-19 19:32:08 +0300 |
commit | d3b1c971bcf0177b17c649c3aeca1a94cbc3fff5 (patch) | |
tree | 321928c015be00cdbe11715297d2d2fc45802263 /deps | |
parent | bfe41fe88e7421f441067a79fb7512cf5935a2bb (diff) |
deps: upgrade npm to 5.6.0
PR-URL: https://github.com/nodejs/node/pull/17777
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'deps')
574 files changed, 19270 insertions, 6409 deletions
diff --git a/deps/npm/.travis.yml b/deps/npm/.travis.yml index 8d24a458c10..108ecf90591 100644 --- a/deps/npm/.travis.yml +++ b/deps/npm/.travis.yml @@ -7,7 +7,7 @@ language: node_js matrix: include: # LTS is our most important target - - node_js: "6" + - node_js: "8" # DEPLOY_VERSION is used to set the couchapp setup mode for test/tap/registry.js # only gather coverage info for LTS env: DEPLOY_VERSION=testing COVERALLS_REPO_TOKEN="$COVERALLS_OPTIONAL_TOKEN" @@ -17,10 +17,12 @@ matrix: # previous LTS is next most important - node_js: "4" env: DEPLOY_VERSION=testing + - node_js: "6" + env: DEPLOY_VERSION=testing - node_js: "7" env: DEPLOY_VERSION=testing # then master - - node_js: "8" + - node_js: "9" env: DEPLOY_VERSION=testing script: - "standard" diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index 9f3aadba0eb..014462125a9 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -526,3 +526,13 @@ Carsten Brandt <mail@cebe.cc> Marcin Szczepanski <marcin@imagichine.com.au> Josh Clow <josh@textio.com> Jakub Holy <jakubholy@jakubholy.net> +Alexandra Ulsh <alexandra.ulsh@gmail.com> +Tom MacWright <tmcw@users.noreply.github.com> +Felicio Mununga <felicio@users.noreply.github.com> +Gabor Szabo <gszabo@users.noreply.github.com> +Andreas Müller <mail@devmount.de> +Andrew Pitman <apitman@users.noreply.github.com> +Jacob Wejendorp <jacob@wejendorp.dk> +Alejandro López <a.lopez.sanchez@outlook.es> +Victor Belozyorov <hi@vbelozyorov.com> +Bradley Farias <bfarias@godaddy.com> diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index 1c650d724bd..0e42392d652 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,238 @@ +## v5.6.0 (2017-11-27): + +### Features! + +You may have noticed this is a semver-minor bump. Wondering why? This is why! + +* [`bc263c3fd`](https://github.com/npm/npm/commit/bc263c3fde6ff4b04deee132d0a9d89379e28c27) + [#19054](https://github.com/npm/npm/pull/19054) + **Fully cross-platform `package-lock.json`**. Installing a failing optional + dependency on one platform no longer removes it from the dependency tree, + meaning that `package-lock.json` should now be generated consistently across + platforms! 🎉 + ([@iarna](https://github.com/iarna)) +* [`f94fcbc50`](https://github.com/npm/npm/commit/f94fcbc50d8aec7350164df898d1e12a1e3da77f) + [#19160](https://github.com/npm/npm/pull/19160) + Add `--package-lock-only` config option. This makes it so you can generate a + target `package-lock.json` without performing a full install of + `node_modules`. + ([@alopezsanchez](https://github.com/alopezsanchez)) +* [`66d18280c`](https://github.com/npm/npm/commit/66d18280ca320f880f4377cf80a8052491bbccbe) + [#19104](https://github.com/npm/npm/pull/19104) + Add new `--node-options` config to pass through a custom `NODE_OPTIONS` for + lifecycle scripts. + ([@bmeck](https://github.com/bmeck)) +* [`114d518c7`](https://github.com/npm/npm/commit/114d518c75732c42acbef3acab36ba1d0fd724e2) + Ignore mtime when packing tarballs: This means that doing `npm pack` on the + same repository should yield two tarballs with the same checksum. This will + also help prevent cache bloat when using git dependencies. In the future, this + will allow npm to explicitly cache git dependencies. + ([@isaacs](https://github.com/isaacs)) + +### Performance + +* [`39ba4aa74`](https://github.com/npm/npm/commit/39ba4aa7479220e61573c0c1977124c2199f49d0) + `tar@4.1.0`: Reduce number of overall fs operations during packing/unpacking. + +### Node 9 + +Previously, it turns out npm broke on the latest Node, `node@9`. We went ahead +and fixed it up so y'all should be able to use the latest npm again! + +* [`4ca695819`](https://github.com/npm/npm/commit/4ca6958196ae41cef179473e3f7dbed9df9a32f1) + `minizlib@1.0.4`: `Fix node@9` incompatibility. + ([@isaacs](https://github.com/isaacs)) +* [`c851bb503`](https://github.com/npm/npm/commit/c851bb503a756b7cd48d12ef0e12f39e6f30c577) + `tar@4.0.2`: Fix `node@9` incompatibility. + ([@isaacs](https://github.com/isaacs)) +* [`6caf23096`](https://github.com/npm/npm/commit/6caf2309613d14ce77923ad3d1275cb89c6cf223) + Remove "unsupported" warning for Node 9 now that things are fixed. + ([@iarna](https://github.com/iarna)) +* [`1930b0f8c`](https://github.com/npm/npm/commit/1930b0f8c44373301edc9fb6ccdf7efcb350fa42) + Update test matrix with `node@8` LTS and `node@9`. + ([@iarna](https://github.com/iarna)) + +### Bug Fixes + +* [`b70321733`](https://github.com/npm/npm/commit/b7032173361665a12c9e4200bdc3f0eb4dee682f) + [#18881](https://github.com/npm/npm/pull/18881) + When dealing with a `node_modules` that was created with older versions of npm + (and thus older versions of npa) we need to gracefully handle older spec + entries. Failing to do so results in us treating those packages as if they + were http remote deps, which results in invalid lock files with `version` set + to tarball URLs. This should now be fixed. + ([@iarna](https://github.com/iarna)) +* [`2f9c5dd00`](https://github.com/npm/npm/commit/2f9c5dd0046a53ece3482e92a412413f5aed6955) + [#18880](https://github.com/npm/npm/pull/18880) + Stop overwriting version in package data on disk. This is another safeguard + against the version overwriting that's plagued some folks upgrading from older + package-locks. + ([@iarna](https://github.com/iarna)) + ([@joshclow](https://github.com/joshclow)) +* [`a93e0a51d`](https://github.com/npm/npm/commit/a93e0a51d3dafc31c809ca28cd7dfa71b2836f86) + [#18846](https://github.com/npm/npm/pull/18846) + Correctly save transitive dependencies when using `npm update` in + `package-lock.json`. + ([@iarna](https://github.com/iarna)) +* [`fdde7b649`](https://github.com/npm/npm/commit/fdde7b649987b2acd9a37ef203f1e263fdf6fece) + [#18825](https://github.com/npm/npm/pull/18825) + Fix typo and concatenation in error handling. + ([@alulsh](https://github.com/alulsh)) +* [`be67de7b9`](https://github.com/npm/npm/commit/be67de7b90790cef0a9f63f91c2f1a00942205ee) + [#18711](https://github.com/npm/npm/pull/18711) + Upgrade to bearer tokens from legacy auth when enabling 2FA. + ([@iarna](https://github.com/iarna)) +* [`bfdf0fd39`](https://github.com/npm/npm/commit/bfdf0fd39646b03db8e543e2bec7092da7880596) + [#19033](https://github.com/npm/npm/pull/19033) + Fix issue where files with `@` signs in their names would not get included + when packing tarballs. + ([@zkat](https://github.com/zkat)) +* [`b65b89bde`](https://github.com/npm/npm/commit/b65b89bdeaa65516f3e13afdb6e9aeb22d8508f4) + [#19048](https://github.com/npm/npm/pull/19048) + Fix problem where `npm login` was ignoring various networking-related options, + such as custom certs. + ([@wejendorp](https://github.com/wejendorp)) +* [`8c194b86e`](https://github.com/npm/npm/commit/8c194b86ec9617e2bcc31f30ee4772469a0bb440) + `npm-packlist@1.1.10`: Include `node_modules/` directories not in the root. + ([@isaacs](https://github.com/isaacs)) +* [`d7ef6a20b`](https://github.com/npm/npm/commit/d7ef6a20b44e968cb92babab1beb51f99110781d) + `libnpx@9.7.1`: Fix some *nix binary path escaping issues. + ([@zkat](https://github.com/zkat)) +* [`981828466`](https://github.com/npm/npm/commit/981828466a5936c70abcccea319b227c443e812b) + `cacache@10.0.1`: Fix fallback to `copy-concurrently` when file move fails. + This might fix permissions and such issues on platforms that were getting + weird filesystem errors during install. + ([@karolba](https://github.com/karolba)) +* [`a0be6bafb`](https://github.com/npm/npm/commit/a0be6bafb6dd7acb3e7b717c27c8575a2215bfff) + `pacote@7.0.2`: Includes a bunch of fixes, specially for issues around git + dependencies. Shasum-related errors should be way less common now, too. + ([@zkat](https://github.com/zkat)) +* [`b80d650de`](https://github.com/npm/npm/commit/b80d650def417645d2525863e9f17af57a917b42) + [#19163](https://github.com/npm/npm/pull/19163) + Fix a number of git and tarball specs and checksum errors. + ([@zkat](https://github.com/zkat)) +* [`cac225025`](https://github.com/npm/npm/commit/cac225025fa06cd055286e75541138cd95f52def) + [#19054](https://github.com/npm/npm/pull/19054) + Don't count failed optionals when summarizing installed packages. + ([@iarna](https://github.com/iarna)) + +### UX + +* [`b1ec2885c`](https://github.com/npm/npm/commit/b1ec2885c43f8038c4e05b83253041992fdfe382) + [#18326](https://github.com/npm/npm/pull/18326) + Stop truncating output of `npm view`. This means, for example, that you no + longer need to use `--json` when a package has a lot of versions, to see the + whole list. + ([@SimenB](https://github.com/SimenB)) +* [`55a124e0a`](https://github.com/npm/npm/commit/55a124e0aa6097cb46f1484f666444b2a445ba57) + [#18884](https://github.com/npm/npm/pull/18884) + Profile UX improvements: better messaging on unexpected responses, and stop + claiming we set passwords to null when resetting them. + ([@iarna](https://github.com/iarna)) +* [`635481c61`](https://github.com/npm/npm/commit/635481c6143bbe10a6f89747795bf4b83f75a7e9) + [#18844](https://github.com/npm/npm/pull/18844) + Improve error messaging for OTP/2FA. + ([@iarna](https://github.com/iarna)) +* [`52b142ed5`](https://github.com/npm/npm/commit/52b142ed5e0f13f23c99209932e8de3f7649fd47) + [#19054](https://github.com/npm/npm/pull/19054) + Stop running the same rollback multiple times. This should address issues + where Windows users saw strange failures when `fsevents` failed to install. + ([@iarna](https://github.com/iarna)) +* [`798428b0b`](https://github.com/npm/npm/commit/798428b0b7b6cfd6ce98041c45fc0a36396e170c) + [#19172](https://github.com/npm/npm/pull/19172) + `bin-links@1.1.0`: Log the fact line endings are being changed upon install. + ([@marcosscriven](https://github.com/marcosscriven)) + +### Refactors + +Usually, we don't include internal refactor stuff in our release notes, but it's +worth calling out some of them because they're part of a larger effort the CLI +team and associates are undertaking to modularize npm itself so other package +managers and associated tools can reuse all that code! + +* [`9d22c96b7`](https://github.com/npm/npm/commit/9d22c96b7160729c8126a38dcf554611b9e3ba87) + [#18500](https://github.com/npm/npm/pull/18500) + Extract bin-links and gentle-fs to a separate library. This will allow + external tools to do bin linking and certain fs operations in an + npm-compatible way! + ([@mikesherov](https://github.com/mikesherov)) +* [`015a7803b`](https://github.com/npm/npm/commit/015a7803b7b63bc8543882196d987b92b461932d) + [#18883](https://github.com/npm/npm/pull/18883) + Capture logging from log events on the process global. This allows npm to use + npmlog to report logging from external libraries like `npm-profile`. + ([@iarna](https://github.com/iarna)) +* [`c930e98ad`](https://github.com/npm/npm/commit/c930e98adc03cef357ae5716269a04d74744a852) + `npm-lifecycle@2.0.0`: Use our own `node-gyp`. This means npm no longer needs + to pull some maneuvers to make sure `node-gyp` is in the right place, and that + external packages using `npm-lifecycle` will get working native builds without + having to do their own `node-gyp` maneuvers. + ([@zkochan](https://github.com/zkochan)) +* [`876f0c8f3`](https://github.com/npm/npm/commit/876f0c8f341f8915e338b409f4b8616bb5263500) [`829893d61`](https://github.com/npm/npm/commit/829893d617bf81bba0d1ce4ea303f76ea37a2b2d) + [#19099](https://github.com/npm/npm/pull/19099) + `find-npm-prefix@1.0.1`: npm's prefix-finding logic is now a standalone + module. That is, the logic that figures out where the root of your project is + if you've `cd`'d into a subdirectory. Did you know you can run `npm install` + from these subdirectories, and it'll only affect the root? It works like git! + ([@iarna](https://github.com/iarna)) + +### Docs + +* [`7ae12b21c`](https://github.com/npm/npm/commit/7ae12b21cc841f76417d3bb13b74f177319d4deb) + [#18823](https://github.com/npm/npm/pull/18823) + Fix spelling of the word authenticator. Because English is hard. + ([@tmcw](https://github.com/tmcw)) +* [`5dfc3ab7b`](https://github.com/npm/npm/commit/5dfc3ab7bc2cb0fa7d9a8c00aa95fecdd14d7ae1) + [#18742](https://github.com/npm/npm/pull/18742) + Explicitly state 'github:foo/bar' as a valid shorthand for hosted git specs. + ([@felicio](https://github.com/felicio)) +* [`a9dc098a6`](https://github.com/npm/npm/commit/a9dc098a6eb7a87895f52a101ac0d41492da698e) + [#18679](https://github.com/npm/npm/pull/18679) + Add some documentation about the `script-shell` config. + ([@gszabo](https://github.com/gszabo)) +* [`24d7734d1`](https://github.com/npm/npm/commit/24d7734d1a1e906c83c53b6d1853af8dc758a998) + [#18571](https://github.com/npm/npm/pull/18571) + Change `verboten` to `forbidden`. + ([@devmount](https://github.com/devmount)) +* [`a8a45668f`](https://github.com/npm/npm/commit/a8a45668fb9b8eb84234fe89234bdcdf644ead58) + [#18568](https://github.com/npm/npm/pull/18568) + Improve wording for the docs for the "engines" section of package.json files. + ([@apitman](https://github.com/apitman)) +* [`dbc7e5b60`](https://github.com/npm/npm/commit/dbc7e5b602870330a8cdaf63bd303cd9050f792f) + [#19118](https://github.com/npm/npm/pull/19118) + Use valid JSON in example for bundledDependencies. + ([@charmander](https://github.com/charmander)) +* [`779339485`](https://github.com/npm/npm/commit/779339485bab5137d0fdc68d1ed6fa987aa8965a) + [#19162](https://github.com/npm/npm/pull/19162) + Remove trailing white space from `npm access` docs. + ([@WispProxy](https://github.com/WispProxy)) + +### Dependency Bumps + +* [`0e7cac941`](https://github.com/npm/npm/commit/0e7cac9413ff1104cf242cc3006f42aa1c2ab63f) + `bluebird@3.5.1` + ([@petkaantonov](https://github.com/petkaantonov)) +* [`c4d5887d9`](https://github.com/npm/npm/commit/c4d5887d978849ddbe2673630de657f141ae5bcf) + `update-notifier@2.3.0` + ([@sindresorhus](https://github.com/sindresorhus)) +* [`eb19a9691`](https://github.com/npm/npm/commit/eb19a9691cf76fbc9c5b66aa7aadb5d905af467a) + `npm-package-arg@6.0.0` + ([@zkat](https://github.com/zkat)) +* [`91d5dca96`](https://github.com/npm/npm/commit/91d5dca96772bc5c45511ddcbeeb2685c7ea68e8) + `npm-profile@2.0.5` + ([@iarna](https://github.com/iarna)) +* [`8de66c46e`](https://github.com/npm/npm/commit/8de66c46e57e4b449c9540c8ecafbc4fd58faff5) + `ssri@5.0.0` + ([@zkat](https://github.com/zkat)) +* [`cfbc3ea69`](https://github.com/npm/npm/commit/cfbc3ea69a8c62dc8e8543193c3ac472631dcef9) + `worker-farm@1.5.1` + ([@rvagg](https://github.com/rvagg)) +* [`60c228160`](https://github.com/npm/npm/commit/60c228160f22d41c2b36745166c9e8c2d84fee58) + `query-string@5.0.1` + ([@sindresorhus](https://github.com/sindresorhus)) +* [`72cad8c66`](https://github.com/npm/npm/commit/72cad8c664efd8eb1bec9a418bccd6c6ca9290de) + `copy-concurrently@1.0.5` + ([@iarna](https://github.com/iarna)) + ## v5.5.1 (2017-10-04): A very quick, record time, patch release, of a bug fix to a (sigh) last minute bug fix. diff --git a/deps/npm/doc/cli/npm-access.md b/deps/npm/doc/cli/npm-access.md index a338673c8d8..bbccfc70937 100644 --- a/deps/npm/doc/cli/npm-access.md +++ b/deps/npm/doc/cli/npm-access.md @@ -29,7 +29,6 @@ subcommand. access to a package. * ls-packages: - Show all of the packages a user or a team is able to access, along with the access level, except for read-only public packages (it won't print the whole registry listing) diff --git a/deps/npm/doc/cli/npm-install.md b/deps/npm/doc/cli/npm-install.md index 74e5e04bca4..0489ddf94e0 100644 --- a/deps/npm/doc/cli/npm-install.md +++ b/deps/npm/doc/cli/npm-install.md @@ -310,6 +310,9 @@ versions. The `--dry-run` argument will report in the usual way what the install would have done without actually installing anything. +The `--package-lock-only` argument will only update the `package-lock.json`, +instead of checking `node_modules` and downloading dependencies. + The `-f` or `--force` argument will force npm to fetch remote resources even if a local copy exists on disk. diff --git a/deps/npm/doc/cli/npm-run-script.md b/deps/npm/doc/cli/npm-run-script.md index c1ce3429537..ee907d8c730 100644 --- a/deps/npm/doc/cli/npm-run-script.md +++ b/deps/npm/doc/cli/npm-run-script.md @@ -44,6 +44,12 @@ instead of to run your tests. +The actual shell your script is run within is platform dependent. By default, +on Unix-like systems it is the `/bin/sh` command, on Windows it is the `cmd.exe`. +The actual shell referred to by `/bin/sh` also depends on the system. +As of [`npm@5.1.0`](https://github.com/npm/npm/releases/tag/v5.1.0) you can +customize the shell with the `script-shell` configuration. + Scripts are run from the root of the module, regardless of what your current working directory is when you call `npm run`. If you want your script to use different behavior based on what subdirectory you're in, you can use the @@ -69,3 +75,4 @@ You can use the `--silent` flag to prevent showing `npm ERR!` output on error. * npm-start(1) * npm-restart(1) * npm-stop(1) +* npm-config(7) diff --git a/deps/npm/doc/cli/npm-token.md b/deps/npm/doc/cli/npm-token.md index bc0d7596fe0..82ab158af67 100644 --- a/deps/npm/doc/cli/npm-token.md +++ b/deps/npm/doc/cli/npm-token.md @@ -5,11 +5,11 @@ npm-token(1) -- Manage your authentication tokens npm token list [--json|--parseable] npm token create [--read-only] [--cidr=1.1.1.1/24,2.2.2.2/16] - npm token delete <id|token> + npm token revoke <id|token> ## DESCRIPTION -This list you list, create and delete authentication tokens. +This list you list, create and revoke authentication tokens. * `npm token list`: Shows a table of all active authentication tokens. You can request this as @@ -52,7 +52,7 @@ This list you list, create and delete authentication tokens. +----------------+--------------------------------------+ ``` -* `npm token delete <token|id>`: +* `npm token revoke <token|id>`: This removes an authentication token, making it immediately unusable. This can accept both complete tokens (as you get back from `npm token create` and will find in your `.npmrc`) and ids as seen in the `npm token list` output. diff --git a/deps/npm/doc/files/package.json.md b/deps/npm/doc/files/package.json.md index 071d23a4159..d91984d1d48 100644 --- a/deps/npm/doc/files/package.json.md +++ b/deps/npm/doc/files/package.json.md @@ -373,11 +373,13 @@ shortcut syntax you use for `npm install`: "repository": "npm/npm" + "repository": "github:user/repo" + "repository": "gist:11081aaa281" - "repository": "bitbucket:example/repo" + "repository": "bitbucket:user/repo" - "repository": "gitlab:another/repo" + "repository": "gitlab:user/repo" ## scripts @@ -618,7 +620,7 @@ If we define a package.json like this: "name": "awesome-web-framework", "version": "1.0.0", "bundledDependencies": [ - 'renderized', 'super-streams' + "renderized", "super-streams" ] } ``` @@ -678,7 +680,7 @@ are capable of properly installing your program. For example: { "engines" : { "npm" : "~1.0.20" } } Unless the user has set the `engine-strict` config flag, this -field is advisory only will produce warnings when your package is installed as a dependency. +field is advisory only and will only produce warnings when your package is installed as a dependency. ## engineStrict diff --git a/deps/npm/doc/misc/npm-coding-style.md b/deps/npm/doc/misc/npm-coding-style.md index a105b1aa53b..e6837bfbf3e 100644 --- a/deps/npm/doc/misc/npm-coding-style.md +++ b/deps/npm/doc/misc/npm-coding-style.md @@ -184,7 +184,7 @@ When something is intentionally missing or removed, set it to `null`. Don't set things to `undefined`. Reserve that value to mean "not yet set to anything." -Boolean objects are verboten. +Boolean objects are forbidden. ## SEE ALSO diff --git a/deps/npm/doc/misc/npm-config.md b/deps/npm/doc/misc/npm-config.md index 3c9ec388177..0ab04189182 100644 --- a/deps/npm/doc/misc/npm-config.md +++ b/deps/npm/doc/misc/npm-config.md @@ -656,6 +656,15 @@ Any "%s" in the message will be replaced with the version number. The registry you want to send cli metrics to if `send-metrics` is true. +### node-options + +* Default: null +* Type: String + +Options to pass through to Node.js via the `NODE_OPTIONS` environment +variable. This does not impact how npm itself is executed but it does +impact how lifecycle scripts are called. + ### node-version * Default: process.version @@ -724,6 +733,14 @@ will also prevent _writing_ `package-lock.json` if `save` is true. This option is an alias for `--shrinkwrap`. +### package-lock-only + +* Default: false +* Type: Boolean + +If set to true, it will update only the `package-json`, +instead of checking `node_modules` and downloading dependencies. + ### parseable * Default: false diff --git a/deps/npm/html/doc/README.html b/deps/npm/html/doc/README.html index 296bbb0697e..48f8433f62e 100644 --- a/deps/npm/html/doc/README.html +++ b/deps/npm/html/doc/README.html @@ -127,5 +127,5 @@ doubt tell you to put the output in a gist or email.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer"><a href="../doc/README.html">README</a> — npm@5.5.1</p> +<p id="footer"><a href="../doc/README.html">README</a> — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-access.html b/deps/npm/html/doc/cli/npm-access.html index ab140aade0c..5fb7cfb0029 100644 --- a/deps/npm/html/doc/cli/npm-access.html +++ b/deps/npm/html/doc/cli/npm-access.html @@ -33,8 +33,8 @@ Set a package to be either publicly accessible or restricted.</p> Add or remove the ability of users and teams to have read-only or read-write access to a package.</p> </li> -<li><p>ls-packages:</p> -<p>Show all of the packages a user or a team is able to access, along with the +<li><p>ls-packages: +Show all of the packages a user or a team is able to access, along with the access level, except for read-only public packages (it won't print the whole registry listing)</p> </li> @@ -86,5 +86,5 @@ with an HTTP 402 status code (logically enough), unless you use <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-access — npm@5.5.1</p> +<p id="footer">npm-access — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-adduser.html b/deps/npm/html/doc/cli/npm-adduser.html index 282d6268b78..90d247f5f5e 100644 --- a/deps/npm/html/doc/cli/npm-adduser.html +++ b/deps/npm/html/doc/cli/npm-adduser.html @@ -81,5 +81,5 @@ username/password entry in legacy npm.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-adduser — npm@5.5.1</p> +<p id="footer">npm-adduser — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-bin.html b/deps/npm/html/doc/cli/npm-bin.html index 9af0c17e26a..677f621a973 100644 --- a/deps/npm/html/doc/cli/npm-bin.html +++ b/deps/npm/html/doc/cli/npm-bin.html @@ -35,5 +35,5 @@ <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-bin — npm@5.5.1</p> +<p id="footer">npm-bin — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-bugs.html b/deps/npm/html/doc/cli/npm-bugs.html index 069bcf2938b..3437dd4380b 100644 --- a/deps/npm/html/doc/cli/npm-bugs.html +++ b/deps/npm/html/doc/cli/npm-bugs.html @@ -55,5 +55,5 @@ a <code>package.json</code> in the current folder and use the <code>name</code> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-bugs — npm@5.5.1</p> +<p id="footer">npm-bugs — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-build.html b/deps/npm/html/doc/cli/npm-build.html index 091b28bb172..51544a4532b 100644 --- a/deps/npm/html/doc/cli/npm-build.html +++ b/deps/npm/html/doc/cli/npm-build.html @@ -40,5 +40,5 @@ directly, run:</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-build — npm@5.5.1</p> +<p id="footer">npm-build — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-bundle.html b/deps/npm/html/doc/cli/npm-bundle.html index 7b4e0c71936..94cf6ed12b4 100644 --- a/deps/npm/html/doc/cli/npm-bundle.html +++ b/deps/npm/html/doc/cli/npm-bundle.html @@ -31,5 +31,5 @@ install packages into the local space.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-bundle — npm@5.5.1</p> +<p id="footer">npm-bundle — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-cache.html b/deps/npm/html/doc/cli/npm-cache.html index d2394086d4f..71d5297a9cf 100644 --- a/deps/npm/html/doc/cli/npm-cache.html +++ b/deps/npm/html/doc/cli/npm-cache.html @@ -89,5 +89,5 @@ verify</code>.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-cache — npm@5.5.1</p> +<p id="footer">npm-cache — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-completion.html b/deps/npm/html/doc/cli/npm-completion.html index d9478549233..7a37048a8a7 100644 --- a/deps/npm/html/doc/cli/npm-completion.html +++ b/deps/npm/html/doc/cli/npm-completion.html @@ -43,5 +43,5 @@ completions based on the arguments.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-completion — npm@5.5.1</p> +<p id="footer">npm-completion — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-config.html b/deps/npm/html/doc/cli/npm-config.html index 9dfa27aa546..ccacfe9c39e 100644 --- a/deps/npm/html/doc/cli/npm-config.html +++ b/deps/npm/html/doc/cli/npm-config.html @@ -68,5 +68,5 @@ global config.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-config — npm@5.5.1</p> +<p id="footer">npm-config — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-dedupe.html b/deps/npm/html/doc/cli/npm-dedupe.html index 1349617d0da..e21605193f0 100644 --- a/deps/npm/html/doc/cli/npm-dedupe.html +++ b/deps/npm/html/doc/cli/npm-dedupe.html @@ -61,5 +61,5 @@ result in new modules being installed.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-dedupe — npm@5.5.1</p> +<p id="footer">npm-dedupe — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-deprecate.html b/deps/npm/html/doc/cli/npm-deprecate.html index 32433db75a0..f82a6b6d18f 100644 --- a/deps/npm/html/doc/cli/npm-deprecate.html +++ b/deps/npm/html/doc/cli/npm-deprecate.html @@ -38,5 +38,5 @@ something like this:</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-deprecate — npm@5.5.1</p> +<p id="footer">npm-deprecate — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-dist-tag.html b/deps/npm/html/doc/cli/npm-dist-tag.html index 230013c3e2f..6f8bc9744f2 100644 --- a/deps/npm/html/doc/cli/npm-dist-tag.html +++ b/deps/npm/html/doc/cli/npm-dist-tag.html @@ -88,5 +88,5 @@ begin with a number or the letter <code>v</code>.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-dist-tag — npm@5.5.1</p> +<p id="footer">npm-dist-tag — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-docs.html b/deps/npm/html/doc/cli/npm-docs.html index e3cd2accf3d..165159af15f 100644 --- a/deps/npm/html/doc/cli/npm-docs.html +++ b/deps/npm/html/doc/cli/npm-docs.html @@ -56,5 +56,5 @@ the current folder and use the <code>name</code> property.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-docs — npm@5.5.1</p> +<p id="footer">npm-docs — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-doctor.html b/deps/npm/html/doc/cli/npm-doctor.html index 4afb484fc30..8eba9f172d7 100644 --- a/deps/npm/html/doc/cli/npm-doctor.html +++ b/deps/npm/html/doc/cli/npm-doctor.html @@ -103,4 +103,4 @@ cache, you should probably run <code>npm cache clean</code> and reset the cache. <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-doctor — npm@5.5.1</p> +<p id="footer">npm-doctor — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-edit.html b/deps/npm/html/doc/cli/npm-edit.html index 5a1f979d7a0..651990084dd 100644 --- a/deps/npm/html/doc/cli/npm-edit.html +++ b/deps/npm/html/doc/cli/npm-edit.html @@ -49,5 +49,5 @@ or <code>"notepad"</code> on Windows.</li> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-edit — npm@5.5.1</p> +<p id="footer">npm-edit — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-explore.html b/deps/npm/html/doc/cli/npm-explore.html index 97f2346320a..bab3a861ec2 100644 --- a/deps/npm/html/doc/cli/npm-explore.html +++ b/deps/npm/html/doc/cli/npm-explore.html @@ -49,5 +49,5 @@ Windows</li> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-explore — npm@5.5.1</p> +<p id="footer">npm-explore — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-help-search.html b/deps/npm/html/doc/cli/npm-help-search.html index 9e69e5612af..01b1ff62d25 100644 --- a/deps/npm/html/doc/cli/npm-help-search.html +++ b/deps/npm/html/doc/cli/npm-help-search.html @@ -45,5 +45,5 @@ where the terms were found in the documentation.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-help-search — npm@5.5.1</p> +<p id="footer">npm-help-search — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-help.html b/deps/npm/html/doc/cli/npm-help.html index 3fca1c02dd7..8adf3b3843c 100644 --- a/deps/npm/html/doc/cli/npm-help.html +++ b/deps/npm/html/doc/cli/npm-help.html @@ -50,5 +50,5 @@ matches are equivalent to specifying a topic name.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-help — npm@5.5.1</p> +<p id="footer">npm-help — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-init.html b/deps/npm/html/doc/cli/npm-init.html index 53f555d8790..115c9b2185a 100644 --- a/deps/npm/html/doc/cli/npm-init.html +++ b/deps/npm/html/doc/cli/npm-init.html @@ -48,5 +48,5 @@ defaults and not prompt you for any options.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-init — npm@5.5.1</p> +<p id="footer">npm-init — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-install-test.html b/deps/npm/html/doc/cli/npm-install-test.html index 595cdd02298..71262400b3d 100644 --- a/deps/npm/html/doc/cli/npm-install-test.html +++ b/deps/npm/html/doc/cli/npm-install-test.html @@ -42,5 +42,5 @@ takes exactly the same arguments as <code>npm install</code>.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-install-test — npm@5.5.1</p> +<p id="footer">npm-install-test — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-install.html b/deps/npm/html/doc/cli/npm-install.html index 2aa508a3fac..5989cc25a10 100644 --- a/deps/npm/html/doc/cli/npm-install.html +++ b/deps/npm/html/doc/cli/npm-install.html @@ -255,6 +255,8 @@ tag with the given name exists, the tagged version is preferred over newer versions.</p> <p>The <code>--dry-run</code> argument will report in the usual way what the install would have done without actually installing anything.</p> +<p>The <code>--package-lock-only</code> argument will only update the <code>package-lock.json</code>, +instead of checking <code>node_modules</code> and downloading dependencies.</p> <p>The <code>-f</code> or <code>--force</code> argument will force npm to fetch remote resources even if a local copy exists on disk.</p> <pre><code>npm install sax --force @@ -367,5 +369,5 @@ affects a real use-case, it will be investigated.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-install — npm@5.5.1</p> +<p id="footer">npm-install — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-link.html b/deps/npm/html/doc/cli/npm-link.html index b93b23929f9..57a6ae86731 100644 --- a/deps/npm/html/doc/cli/npm-link.html +++ b/deps/npm/html/doc/cli/npm-link.html @@ -74,5 +74,5 @@ include that scope, e.g.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-link — npm@5.5.1</p> +<p id="footer">npm-link — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-logout.html b/deps/npm/html/doc/cli/npm-logout.html index 0d76cf93b39..a06341b2d2d 100644 --- a/deps/npm/html/doc/cli/npm-logout.html +++ b/deps/npm/html/doc/cli/npm-logout.html @@ -51,5 +51,5 @@ it takes precedence.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-logout — npm@5.5.1</p> +<p id="footer">npm-logout — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-ls.html b/deps/npm/html/doc/cli/npm-ls.html index 06c207de00c..4ba0917179d 100644 --- a/deps/npm/html/doc/cli/npm-ls.html +++ b/deps/npm/html/doc/cli/npm-ls.html @@ -21,7 +21,7 @@ installed, as well as their dependencies, in a tree-structure.</p> limit the results to only the paths to the packages named. Note that nested packages will <em>also</em> show the paths to the specified packages. For example, running <code>npm ls promzard</code> in npm's source tree will show:</p> -<pre><code>npm@5.5.1 /path/to/npm +<pre><code>npm@5.6.0 /path/to/npm └─┬ init-package-json@0.0.4 └── promzard@0.1.5 </code></pre><p>It will print out extraneous, missing, and invalid packages.</p> @@ -110,5 +110,5 @@ project.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-ls — npm@5.5.1</p> +<p id="footer">npm-ls — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-outdated.html b/deps/npm/html/doc/cli/npm-outdated.html index fb3e1112202..d59e0548a3e 100644 --- a/deps/npm/html/doc/cli/npm-outdated.html +++ b/deps/npm/html/doc/cli/npm-outdated.html @@ -116,5 +116,5 @@ project.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-outdated — npm@5.5.1</p> +<p id="footer">npm-outdated — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-owner.html b/deps/npm/html/doc/cli/npm-owner.html index 707ea4bf9d3..6b28ab48d15 100644 --- a/deps/npm/html/doc/cli/npm-owner.html +++ b/deps/npm/html/doc/cli/npm-owner.html @@ -54,5 +54,5 @@ with <code>--otp</code>.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-owner — npm@5.5.1</p> +<p id="footer">npm-owner — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-pack.html b/deps/npm/html/doc/cli/npm-pack.html index 73319eb3bfe..35e6670bef2 100644 --- a/deps/npm/html/doc/cli/npm-pack.html +++ b/deps/npm/html/doc/cli/npm-pack.html @@ -41,5 +41,5 @@ overwritten the second time.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-pack — npm@5.5.1</p> +<p id="footer">npm-pack — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-ping.html b/deps/npm/html/doc/cli/npm-ping.html index 9eb3be589d7..4b67c2686e9 100644 --- a/deps/npm/html/doc/cli/npm-ping.html +++ b/deps/npm/html/doc/cli/npm-ping.html @@ -36,5 +36,5 @@ If it works it will output something like:</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-ping — npm@5.5.1</p> +<p id="footer">npm-ping — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-prefix.html b/deps/npm/html/doc/cli/npm-prefix.html index 09bd66affe4..ebb2f6a3c60 100644 --- a/deps/npm/html/doc/cli/npm-prefix.html +++ b/deps/npm/html/doc/cli/npm-prefix.html @@ -38,5 +38,5 @@ to contain a package.json file unless <code>-g</code> is also specified.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-prefix — npm@5.5.1</p> +<p id="footer">npm-prefix — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-profile.html b/deps/npm/html/doc/cli/npm-profile.html index 106695ee84f..3d952205f43 100644 --- a/deps/npm/html/doc/cli/npm-profile.html +++ b/deps/npm/html/doc/cli/npm-profile.html @@ -90,4 +90,4 @@ available on non npmjs.com registries.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-profile — npm@5.5.1</p> +<p id="footer">npm-profile — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-prune.html b/deps/npm/html/doc/cli/npm-prune.html index 0e03cd52e38..f71aa0c212f 100644 --- a/deps/npm/html/doc/cli/npm-prune.html +++ b/deps/npm/html/doc/cli/npm-prune.html @@ -40,5 +40,5 @@ negate <code>NODE_ENV</code> being set to <code>production</code>.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-prune — npm@5.5.1</p> +<p id="footer">npm-prune — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-publish.html b/deps/npm/html/doc/cli/npm-publish.html index 14bac448e36..c8a0b691e13 100644 --- a/deps/npm/html/doc/cli/npm-publish.html +++ b/deps/npm/html/doc/cli/npm-publish.html @@ -85,5 +85,5 @@ packs them into a tarball to be uploaded to the registry.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-publish — npm@5.5.1</p> +<p id="footer">npm-publish — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-rebuild.html b/deps/npm/html/doc/cli/npm-rebuild.html index 021ecf7f551..136192342a4 100644 --- a/deps/npm/html/doc/cli/npm-rebuild.html +++ b/deps/npm/html/doc/cli/npm-rebuild.html @@ -35,5 +35,5 @@ the new binary.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-rebuild — npm@5.5.1</p> +<p id="footer">npm-rebuild — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-repo.html b/deps/npm/html/doc/cli/npm-repo.html index fdf446784b7..12e6b1748ef 100644 --- a/deps/npm/html/doc/cli/npm-repo.html +++ b/deps/npm/html/doc/cli/npm-repo.html @@ -41,5 +41,5 @@ a <code>package.json</code> in the current folder and use the <code>name</code> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-repo — npm@5.5.1</p> +<p id="footer">npm-repo — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-restart.html b/deps/npm/html/doc/cli/npm-restart.html index 01f57667e48..4f9aacecf1d 100644 --- a/deps/npm/html/doc/cli/npm-restart.html +++ b/deps/npm/html/doc/cli/npm-restart.html @@ -53,5 +53,5 @@ behavior will be accompanied by an increase in major version number</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-restart — npm@5.5.1</p> +<p id="footer">npm-restart — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-root.html b/deps/npm/html/doc/cli/npm-root.html index a513f8c7a44..a4e9aa9bd63 100644 --- a/deps/npm/html/doc/cli/npm-root.html +++ b/deps/npm/html/doc/cli/npm-root.html @@ -35,5 +35,5 @@ <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-root — npm@5.5.1</p> +<p id="footer">npm-root — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-run-script.html b/deps/npm/html/doc/cli/npm-run-script.html index 72b946b21e2..489fbccb093 100644 --- a/deps/npm/html/doc/cli/npm-run-script.html +++ b/deps/npm/html/doc/cli/npm-run-script.html @@ -40,6 +40,11 @@ you should write:</p> </code></pre><p>instead of</p> <pre><code>"scripts": {"test": "node_modules/.bin/tap test/\*.js"} </code></pre><p>to run your tests.</p> +<p>The actual shell your script is run within is platform dependent. By default, +on Unix-like systems it is the <code>/bin/sh</code> command, on Windows it is the <code>cmd.exe</code>. +The actual shell referred to by <code>/bin/sh</code> also depends on the system. +As of <a href="https://github.com/npm/npm/releases/tag/v5.1.0"><code>npm@5.1.0</code></a> you can +customize the shell with the <code>script-shell</code> configuration.</p> <p>Scripts are run from the root of the module, regardless of what your current working directory is when you call <code>npm run</code>. If you want your script to use different behavior based on what subdirectory you're in, you can use the @@ -61,6 +66,7 @@ you will be given a warning to run <code>npm install</code>, just in case you <li><a href="../cli/npm-start.html">npm-start(1)</a></li> <li><a href="../cli/npm-restart.html">npm-restart(1)</a></li> <li><a href="../cli/npm-stop.html">npm-stop(1)</a></li> +<li><a href="../misc/npm-config.html">npm-config(7)</a></li> </ul> </div> @@ -74,5 +80,5 @@ you will be given a warning to run <code>npm install</code>, just in case you <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-run-script — npm@5.5.1</p> +<p id="footer">npm-run-script — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-search.html b/deps/npm/html/doc/cli/npm-search.html index 413da85416b..df759928a73 100644 --- a/deps/npm/html/doc/cli/npm-search.html +++ b/deps/npm/html/doc/cli/npm-search.html @@ -109,5 +109,5 @@ setting.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-search — npm@5.5.1</p> +<p id="footer">npm-search — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-shrinkwrap.html b/deps/npm/html/doc/cli/npm-shrinkwrap.html index a8d3d7e5e95..629f5b69a7b 100644 --- a/deps/npm/html/doc/cli/npm-shrinkwrap.html +++ b/deps/npm/html/doc/cli/npm-shrinkwrap.html @@ -41,5 +41,5 @@ of package locks in npm, see <a href="../files/npm-package-locks.html">npm-packa <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-shrinkwrap — npm@5.5.1</p> +<p id="footer">npm-shrinkwrap — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-star.html b/deps/npm/html/doc/cli/npm-star.html index dd57a76118a..a957ff479f4 100644 --- a/deps/npm/html/doc/cli/npm-star.html +++ b/deps/npm/html/doc/cli/npm-star.html @@ -36,5 +36,5 @@ a vaguely positive way to show that you care.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-star — npm@5.5.1</p> +<p id="footer">npm-star — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-stars.html b/deps/npm/html/doc/cli/npm-stars.html index 060faeed4b6..ff6dbfb3143 100644 --- a/deps/npm/html/doc/cli/npm-stars.html +++ b/deps/npm/html/doc/cli/npm-stars.html @@ -36,5 +36,5 @@ you will most certainly enjoy this command.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-stars — npm@5.5.1</p> +<p id="footer">npm-stars — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-start.html b/deps/npm/html/doc/cli/npm-start.html index 6cd9df603bb..0c0dfb3ae1e 100644 --- a/deps/npm/html/doc/cli/npm-start.html +++ b/deps/npm/html/doc/cli/npm-start.html @@ -39,5 +39,5 @@ more details.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-start — npm@5.5.1</p> +<p id="footer">npm-start — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-stop.html b/deps/npm/html/doc/cli/npm-stop.html index 7e795163b86..9c04332e681 100644 --- a/deps/npm/html/doc/cli/npm-stop.html +++ b/deps/npm/html/doc/cli/npm-stop.html @@ -34,5 +34,5 @@ <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-stop — npm@5.5.1</p> +<p id="footer">npm-stop — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-team.html b/deps/npm/html/doc/cli/npm-team.html index a24bc6558ae..81d74fa0a7f 100644 --- a/deps/npm/html/doc/cli/npm-team.html +++ b/deps/npm/html/doc/cli/npm-team.html @@ -67,5 +67,5 @@ use the <code>npm access</code> command to grant or revoke the appropriate permi <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-team — npm@5.5.1</p> +<p id="footer">npm-team — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-test.html b/deps/npm/html/doc/cli/npm-test.html index 1aaa8687c1c..280e69f3a18 100644 --- a/deps/npm/html/doc/cli/npm-test.html +++ b/deps/npm/html/doc/cli/npm-test.html @@ -36,5 +36,5 @@ <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-test — npm@5.5.1</p> +<p id="footer">npm-test — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-token.html b/deps/npm/html/doc/cli/npm-token.html index a2e4ce18149..8ec2f5fbec2 100644 --- a/deps/npm/html/doc/cli/npm-token.html +++ b/deps/npm/html/doc/cli/npm-token.html @@ -13,9 +13,9 @@ <h2 id="synopsis">SYNOPSIS</h2> <pre><code>npm token list [--json|--parseable] npm token create [--read-only] [--cidr=1.1.1.1/24,2.2.2.2/16] -npm token delete <id|token> +npm token revoke <id|token> </code></pre><h2 id="description">DESCRIPTION</h2> -<p>This list you list, create and delete authentication tokens. </p> +<p>This list you list, create and revoke authentication tokens.</p> <ul> <li><p><code>npm token list</code>: Shows a table of all active authentication tokens. You can request this as @@ -55,7 +55,7 @@ two-factor authentication enabled, an otp.</p> | created | 2017-10-02T07:52:24.838Z | +----------------+--------------------------------------+ </code></pre><ul> -<li><code>npm token delete <token|id></code>: +<li><code>npm token revoke <token|id></code>: This removes an authentication token, making it immediately unusable. This can accept both complete tokens (as you get back from <code>npm token create</code> and will find in your <code>.npmrc</code>) and ids as seen in the <code>npm token list</code> output. @@ -73,4 +73,4 @@ This will NOT accept the truncated token found in <code>npm token list</code> ou <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-token — npm@5.5.1</p> +<p id="footer">npm-token — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-uninstall.html b/deps/npm/html/doc/cli/npm-uninstall.html index 454f575ce3a..dd430d07966 100644 --- a/deps/npm/html/doc/cli/npm-uninstall.html +++ b/deps/npm/html/doc/cli/npm-uninstall.html @@ -63,5 +63,5 @@ npm uninstall lodash --no-save <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-uninstall — npm@5.5.1</p> +<p id="footer">npm-uninstall — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-unpublish.html b/deps/npm/html/doc/cli/npm-unpublish.html index e278eb29efe..721de2828ff 100644 --- a/deps/npm/html/doc/cli/npm-unpublish.html +++ b/deps/npm/html/doc/cli/npm-unpublish.html @@ -51,5 +51,5 @@ contact support@npmjs.com.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-unpublish — npm@5.5.1</p> +<p id="footer">npm-unpublish — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-update.html b/deps/npm/html/doc/cli/npm-update.html index c2ee6bfe106..ddaf4104df1 100644 --- a/deps/npm/html/doc/cli/npm-update.html +++ b/deps/npm/html/doc/cli/npm-update.html @@ -118,5 +118,5 @@ be <em>downgraded</em>.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-update — npm@5.5.1</p> +<p id="footer">npm-update — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-version.html b/deps/npm/html/doc/cli/npm-version.html index 5e1d389d777..e8da71b67a0 100644 --- a/deps/npm/html/doc/cli/npm-version.html +++ b/deps/npm/html/doc/cli/npm-version.html @@ -120,5 +120,5 @@ to the same value as the current version.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-version — npm@5.5.1</p> +<p id="footer">npm-version — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-view.html b/deps/npm/html/doc/cli/npm-view.html index 691ea8ee431..a94ea56271e 100644 --- a/deps/npm/html/doc/cli/npm-view.html +++ b/deps/npm/html/doc/cli/npm-view.html @@ -86,5 +86,5 @@ the field name.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-view — npm@5.5.1</p> +<p id="footer">npm-view — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm-whoami.html b/deps/npm/html/doc/cli/npm-whoami.html index f4190a36829..5995b1e11c5 100644 --- a/deps/npm/html/doc/cli/npm-whoami.html +++ b/deps/npm/html/doc/cli/npm-whoami.html @@ -33,5 +33,5 @@ <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-whoami — npm@5.5.1</p> +<p id="footer">npm-whoami — npm@5.6.0</p> diff --git a/deps/npm/html/doc/cli/npm.html b/deps/npm/html/doc/cli/npm.html index c6a68d7652e..52f4a22544f 100644 --- a/deps/npm/html/doc/cli/npm.html +++ b/deps/npm/html/doc/cli/npm.html @@ -13,7 +13,7 @@ <h2 id="synopsis">SYNOPSIS</h2> <pre><code>npm <command> [args] </code></pre><h2 id="version">VERSION</h2> -<p>5.5.1</p> +<p>5.6.0</p> <h2 id="description">DESCRIPTION</h2> <p>npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency @@ -126,7 +126,7 @@ will no doubt tell you to put the output in a gist or email.</p> <p><a href="http://blog.izs.me/">Isaac Z. Schlueter</a> :: <a href="https://github.com/isaacs/">isaacs</a> :: <a href="http://twitter.com/izs">@izs</a> :: -<a href="mailto:i@izs.me">i@izs.me</a></p> +<a href="mailto:i@izs.me">i@izs.me</a></p> <h2 id="see-also">SEE ALSO</h2> <ul> <li><a href="../cli/npm-help.html">npm-help(1)</a></li> @@ -150,5 +150,5 @@ will no doubt tell you to put the output in a gist or email.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm — npm@5.5.1</p> +<p id="footer">npm — npm@5.6.0</p> diff --git a/deps/npm/html/doc/files/npm-folders.html b/deps/npm/html/doc/files/npm-folders.html index 295df46b520..ff8a247b5a8 100644 --- a/deps/npm/html/doc/files/npm-folders.html +++ b/deps/npm/html/doc/files/npm-folders.html @@ -181,5 +181,5 @@ cannot be found elsewhere. See <code><a href="../files/package.json.html">packa <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-folders — npm@5.5.1</p> +<p id="footer">npm-folders — npm@5.6.0</p> diff --git a/deps/npm/html/doc/files/npm-global.html b/deps/npm/html/doc/files/npm-global.html index 295df46b520..ff8a247b5a8 100644 --- a/deps/npm/html/doc/files/npm-global.html +++ b/deps/npm/html/doc/files/npm-global.html @@ -181,5 +181,5 @@ cannot be found elsewhere. See <code><a href="../files/package.json.html">packa <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-folders — npm@5.5.1</p> +<p id="footer">npm-folders — npm@5.6.0</p> diff --git a/deps/npm/html/doc/files/npm-json.html b/deps/npm/html/doc/files/npm-json.html index 6bf69dca1d3..3a6e77c9812 100644 --- a/deps/npm/html/doc/files/npm-json.html +++ b/deps/npm/html/doc/files/npm-json.html @@ -281,11 +281,13 @@ html project page that you put in your browser. It's for computers.</p> shortcut syntax you use for <code>npm install</code>:</p> <pre><code>"repository": "npm/npm" +"repository": "github:user/repo" + "repository": "gist:11081aaa281" -"repository": "bitbucket:example/repo" +"repository": "bitbucket:user/repo" -"repository": "gitlab:another/repo" +"repository": "gitlab:user/repo" </code></pre><h2 id="scripts">scripts</h2> <p>The "scripts" property is a dictionary containing script commands that are run at various times in the lifecycle of your package. The key is the lifecycle @@ -470,7 +472,7 @@ array and executing <code>npm pack</code>.</p> "name": "awesome-web-framework", "version": "1.0.0", "bundledDependencies": [ - 'renderized', 'super-streams' + "renderized", "super-streams" ] } </code></pre><p>we can obtain <code>awesome-web-framework-1.0.0.tgz</code> file by running <code>npm pack</code>. @@ -515,7 +517,7 @@ that it works on node.</p> are capable of properly installing your program. For example:</p> <pre><code>{ "engines" : { "npm" : "~1.0.20" } } </code></pre><p>Unless the user has set the <code>engine-strict</code> config flag, this -field is advisory only will produce warnings when your package is installed as a dependency.</p> +field is advisory only and will only produce warnings when your package is installed as a dependency.</p> <h2 id="enginestrict">engineStrict</h2> <p><strong>This feature was removed in npm 3.0.0</strong></p> <p>Prior to npm 3.0.0, this feature was used to treat this package as if the @@ -601,5 +603,5 @@ ignored.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">package.json — npm@5.5.1</p> +<p id="footer">package.json — npm@5.6.0</p> diff --git a/deps/npm/html/doc/files/npm-package-locks.html b/deps/npm/html/doc/files/npm-package-locks.html index 91b18778b91..775c6b4ca2a 100644 --- a/deps/npm/html/doc/files/npm-package-locks.html +++ b/deps/npm/html/doc/files/npm-package-locks.html @@ -145,4 +145,4 @@ if any transitive dependencies were updated, hoisted, etc.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-package-locks — npm@5.5.1</p> +<p id="footer">npm-package-locks — npm@5.6.0</p> diff --git a/deps/npm/html/doc/files/npm-shrinkwrap.json.html b/deps/npm/html/doc/files/npm-shrinkwrap.json.html index 76a15983c36..50718ad9fd5 100644 --- a/deps/npm/html/doc/files/npm-shrinkwrap.json.html +++ b/deps/npm/html/doc/files/npm-shrinkwrap.json.html @@ -42,4 +42,4 @@ to the manual page for <a href="../files/package-lock.json.html">package-lock.js <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-shrinkwrap.json — npm@5.5.1</p> +<p id="footer">npm-shrinkwrap.json — npm@5.6.0</p> diff --git a/deps/npm/html/doc/files/npmrc.html b/deps/npm/html/doc/files/npmrc.html index 1fbd619fb6f..7441c92b7ed 100644 --- a/deps/npm/html/doc/files/npmrc.html +++ b/deps/npm/html/doc/files/npmrc.html @@ -85,5 +85,5 @@ manner.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npmrc — npm@5.5.1</p> +<p id="footer">npmrc — npm@5.6.0</p> diff --git a/deps/npm/html/doc/files/package-lock.json.html b/deps/npm/html/doc/files/package-lock.json.html index fe2f07f4274..3f6a2e21f56 100644 --- a/deps/npm/html/doc/files/package-lock.json.html +++ b/deps/npm/html/doc/files/package-lock.json.html @@ -124,4 +124,4 @@ on the current platform.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">package-lock.json — npm@5.5.1</p> +<p id="footer">package-lock.json — npm@5.6.0</p> diff --git a/deps/npm/html/doc/files/package.json.html b/deps/npm/html/doc/files/package.json.html index 6bf69dca1d3..3a6e77c9812 100644 --- a/deps/npm/html/doc/files/package.json.html +++ b/deps/npm/html/doc/files/package.json.html @@ -281,11 +281,13 @@ html project page that you put in your browser. It's for computers.</p> shortcut syntax you use for <code>npm install</code>:</p> <pre><code>"repository": "npm/npm" +"repository": "github:user/repo" + "repository": "gist:11081aaa281" -"repository": "bitbucket:example/repo" +"repository": "bitbucket:user/repo" -"repository": "gitlab:another/repo" +"repository": "gitlab:user/repo" </code></pre><h2 id="scripts">scripts</h2> <p>The "scripts" property is a dictionary containing script commands that are run at various times in the lifecycle of your package. The key is the lifecycle @@ -470,7 +472,7 @@ array and executing <code>npm pack</code>.</p> "name": "awesome-web-framework", "version": "1.0.0", "bundledDependencies": [ - 'renderized', 'super-streams' + "renderized", "super-streams" ] } </code></pre><p>we can obtain <code>awesome-web-framework-1.0.0.tgz</code> file by running <code>npm pack</code>. @@ -515,7 +517,7 @@ that it works on node.</p> are capable of properly installing your program. For example:</p> <pre><code>{ "engines" : { "npm" : "~1.0.20" } } </code></pre><p>Unless the user has set the <code>engine-strict</code> config flag, this -field is advisory only will produce warnings when your package is installed as a dependency.</p> +field is advisory only and will only produce warnings when your package is installed as a dependency.</p> <h2 id="enginestrict">engineStrict</h2> <p><strong>This feature was removed in npm 3.0.0</strong></p> <p>Prior to npm 3.0.0, this feature was used to treat this package as if the @@ -601,5 +603,5 @@ ignored.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">package.json — npm@5.5.1</p> +<p id="footer">package.json — npm@5.6.0</p> diff --git a/deps/npm/html/doc/index.html b/deps/npm/html/doc/index.html index 998683bafd9..914307420c8 100644 --- a/deps/npm/html/doc/index.html +++ b/deps/npm/html/doc/index.html @@ -172,5 +172,5 @@ <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-index — npm@5.5.1</p> +<p id="footer">npm-index — npm@5.6.0</p> diff --git a/deps/npm/html/doc/misc/npm-coding-style.html b/deps/npm/html/doc/misc/npm-coding-style.html index 62569622aa3..f96dd270bfa 100644 --- a/deps/npm/html/doc/misc/npm-coding-style.html +++ b/deps/npm/html/doc/misc/npm-coding-style.html @@ -135,7 +135,7 @@ makes it clear that it's a "throwaway" function.</p> <p>When something is intentionally missing or removed, set it to <code>null</code>.</p> <p>Don't set things to <code>undefined</code>. Reserve that value to mean "not yet set to anything."</p> -<p>Boolean objects are verboten.</p> +<p>Boolean objects are forbidden.</p> <h2 id="see-also">SEE ALSO</h2> <ul> <li><a href="../misc/npm-developers.html">npm-developers(7)</a></li> @@ -153,5 +153,5 @@ set to anything."</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-coding-style — npm@5.5.1</p> +<p id="footer">npm-coding-style — npm@5.6.0</p> diff --git a/deps/npm/html/doc/misc/npm-config.html b/deps/npm/html/doc/misc/npm-config.html index cd989b08326..a23b10727af 100644 --- a/deps/npm/html/doc/misc/npm-config.html +++ b/deps/npm/html/doc/misc/npm-config.html @@ -564,6 +564,14 @@ combination). Passed to the <code>http</code> <code>Agent</code> used to make th <li>Type: String</li> </ul> <p>The registry you want to send cli metrics to if <code>send-metrics</code> is true.</p> +<h3 id="node-options">node-options</h3> +<ul> +<li>Default: null</li> +<li>Type: String</li> +</ul> +<p>Options to pass through to Node.js via the <code>NODE_OPTIONS</code> environment +variable. This does not impact how npm itself is executed but it does +impact how lifecycle scripts are called.</p> <h3 id="node-version">node-version</h3> <ul> <li>Default: process.version</li> @@ -621,6 +629,13 @@ when publishing or changing package permissions with <code>npm access</code>.</p <p>If set to false, then ignore <code>package-lock.json</code> files when installing. This will also prevent <em>writing</em> <code>package-lock.json</code> if <code>save</code> is true.</p> <p>This option is an alias for <code>--shrinkwrap</code>.</p> +<h3 id="package-lock-only">package-lock-only</h3> +<ul> +<li>Default: false</li> +<li>Type: Boolean</li> +</ul> +<p>If set to true, it will update only the <code>package-json</code>, +instead of checking <code>node_modules</code> and downloading dependencies.</p> <h3 id="parseable">parseable</h3> <ul> <li>Default: false</li> @@ -1009,5 +1024,5 @@ exit successfully.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-config — npm@5.5.1</p> +<p id="footer">npm-config — npm@5.6.0</p> diff --git a/deps/npm/html/doc/misc/npm-developers.html b/deps/npm/html/doc/misc/npm-developers.html index b6a570f33ae..bdf212ed4b1 100644 --- a/deps/npm/html/doc/misc/npm-developers.html +++ b/deps/npm/html/doc/misc/npm-developers.html @@ -204,5 +204,5 @@ from a fresh checkout.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-developers — npm@5.5.1</p> +<p id="footer">npm-developers — npm@5.6.0</p> diff --git a/deps/npm/html/doc/misc/npm-disputes.html b/deps/npm/html/doc/misc/npm-disputes.html index 265d7587d50..fdf53fcad0c 100644 --- a/deps/npm/html/doc/misc/npm-disputes.html +++ b/deps/npm/html/doc/misc/npm-disputes.html @@ -20,7 +20,7 @@ Conduct.</p> <h2 id="tl-dr">TL;DR</h2> <ol> <li>Get the author email with <code>npm owner ls <pkgname></code></li> -<li>Email the author, CC <a href="mailto:support@npmjs.com">support@npmjs.com</a></li> +<li>Email the author, CC <a href="mailto:support@npmjs.com">support@npmjs.com</a></li> <li>After a few weeks, if there's no resolution, we'll sort it out.</li> </ol> <p>Don't squat on package names. Publish code or move out of the way.</p> @@ -55,12 +55,12 @@ because Yusuf's <code>foo</code> is in the way.</p> </li> <li>Alice emails Yusuf, explaining the situation <strong>as respectfully as possible</strong>, and what she would like to do with the module name. She adds the npm support -staff <a href="mailto:support@npmjs.com">support@npmjs.com</a> to the CC list of the email. Mention in the email +staff <a href="mailto:support@npmjs.com">support@npmjs.com</a> to the CC list of the email. Mention in the email that Yusuf can run npm owner <code>add alice foo</code> to add Alice as an owner of the foo package.</li> <li>After a reasonable amount of time, if Yusuf has not responded, or if Yusuf and Alice can't come to any sort of resolution, email support -<a href="mailto:support@npmjs.com">support@npmjs.com</a> and we'll sort it out. ("Reasonable" is usually at least +<a href="mailto:support@npmjs.com">support@npmjs.com</a> and we'll sort it out. ("Reasonable" is usually at least 4 weeks.)</li> </ol> <h2 id="reasoning">REASONING</h2> @@ -96,12 +96,12 @@ application database or otherwise putting non-packagey things into it.</li> <a href="https://www.npmjs.com/policies/conduct">Code of Conduct</a> such as hateful language, pornographic content, or harassment.</li> </ol> -<p>If you see bad behavior like this, please report it to <a href="mailto:abuse@npmjs.com">abuse@npmjs.com</a> right +<p>If you see bad behavior like this, please report it to <a href="mailto:abuse@npmjs.com">abuse@npmjs.com</a> right away. <strong>You are never expected to resolve abusive behavior on your own. We are here to help.</strong></p> <h2 id="trademarks">TRADEMARKS</h2> <p>If you think another npm publisher is infringing your trademark, such as by -using a confusingly similar package name, email <a href="mailto:abuse@npmjs.com">abuse@npmjs.com</a> with a link to +using a confusingly similar package name, email <a href="mailto:abuse@npmjs.com">abuse@npmjs.com</a> with a link to the package or user account on <a href="https://npmjs.com">https://npmjs.com</a>. Attach a copy of your trademark registration certificate.</p> <p>If we see that the package's publisher is intentionally misleading others by @@ -134,5 +134,5 @@ License.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-disputes — npm@5.5.1</p> +<p id="footer">npm-disputes — npm@5.6.0</p> diff --git a/deps/npm/html/doc/misc/npm-index.html b/deps/npm/html/doc/misc/npm-index.html index 2dd78912097..927748e176c 100644 --- a/deps/npm/html/doc/misc/npm-index.html +++ b/deps/npm/html/doc/misc/npm-index.html @@ -172,5 +172,5 @@ <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-index — npm@5.5.1</p> +<p id="footer">npm-index — npm@5.6.0</p> diff --git a/deps/npm/html/doc/misc/npm-orgs.html b/deps/npm/html/doc/misc/npm-orgs.html index 07ab32833d5..5a11a10ca81 100644 --- a/deps/npm/html/doc/misc/npm-orgs.html +++ b/deps/npm/html/doc/misc/npm-orgs.html @@ -86,5 +86,5 @@ <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-orgs — npm@5.5.1</p> +<p id="footer">npm-orgs — npm@5.6.0</p> diff --git a/deps/npm/html/doc/misc/npm-registry.html b/deps/npm/html/doc/misc/npm-registry.html index 23d6de02a48..cfa610d0e8d 100644 --- a/deps/npm/html/doc/misc/npm-registry.html +++ b/deps/npm/html/doc/misc/npm-registry.html @@ -90,5 +90,5 @@ effectively implement the entire CouchDB API anyway.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-registry — npm@5.5.1</p> +<p id="footer">npm-registry — npm@5.6.0</p> diff --git a/deps/npm/html/doc/misc/npm-scope.html b/deps/npm/html/doc/misc/npm-scope.html index f6e107ed04a..e610f3e9e36 100644 --- a/deps/npm/html/doc/misc/npm-scope.html +++ b/deps/npm/html/doc/misc/npm-scope.html @@ -99,5 +99,5 @@ that registry instead.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-scope — npm@5.5.1</p> +<p id="footer">npm-scope — npm@5.6.0</p> diff --git a/deps/npm/html/doc/misc/npm-scripts.html b/deps/npm/html/doc/misc/npm-scripts.html index b24fb3d7472..bc43c028f10 100644 --- a/deps/npm/html/doc/misc/npm-scripts.html +++ b/deps/npm/html/doc/misc/npm-scripts.html @@ -239,5 +239,5 @@ scripts is for compilation which must be done on the target architecture.</li> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">npm-scripts — npm@5.5.1</p> +<p id="footer">npm-scripts — npm@5.6.0</p> diff --git a/deps/npm/html/doc/misc/removing-npm.html b/deps/npm/html/doc/misc/removing-npm.html index 5e50674c544..1727455c627 100644 --- a/deps/npm/html/doc/misc/removing-npm.html +++ b/deps/npm/html/doc/misc/removing-npm.html @@ -57,5 +57,5 @@ modules. To track those down, you can do the following:</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">removing-npm — npm@5.5.1</p> +<p id="footer">removing-npm — npm@5.6.0</p> diff --git a/deps/npm/html/doc/misc/semver.html b/deps/npm/html/doc/misc/semver.html index ccbedc47b7d..afe72d30999 100644 --- a/deps/npm/html/doc/misc/semver.html +++ b/deps/npm/html/doc/misc/semver.html @@ -336,5 +336,5 @@ range, use the <code>satisfies(version, range)</code> function.</p> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">semver — npm@5.5.1</p> +<p id="footer">semver — npm@5.6.0</p> diff --git a/deps/npm/lib/auth/legacy.js b/deps/npm/lib/auth/legacy.js index 4c75ca67317..92bf44c119a 100644 --- a/deps/npm/lib/auth/legacy.js +++ b/deps/npm/lib/auth/legacy.js @@ -4,6 +4,8 @@ const profile = require('npm-profile') const log = require('npmlog') const npm = require('../npm.js') const output = require('../utils/output.js') +const pacoteOpts = require('../config/pacote') +const fetchOpts = require('../config/fetch-opts') module.exports.login = function login (creds, registry, scope, cb) { let username = creds.username || '' @@ -22,10 +24,13 @@ module.exports.login = function login (creds, registry, scope, cb) { email = e return profile.login(username, password, {registry: registry, auth: auth}).catch((err) => { if (err.code === 'EOTP') throw err - return profile.adduser(username, email, password, {registry: registry}) + return profile.adduser(username, email, password, { + registry: registry, + opts: fetchOpts.fromPacote(pacoteOpts()) + }) }).catch((err) => { if (err.code === 'EOTP' && !auth.otp) { - return read.otp('Authenicator provided OTP:').then((otp) => { + return read.otp('Authenticator provided OTP:').then((otp) => { auth.otp = otp return profile.login(username, password, {registry: registry, auth: auth}) }) diff --git a/deps/npm/lib/build.js b/deps/npm/lib/build.js index 6a788bc8575..395f9437b45 100644 --- a/deps/npm/lib/build.js +++ b/deps/npm/lib/build.js @@ -10,21 +10,14 @@ var npm = require('./npm.js') var log = require('npmlog') var chain = require('slide').chain -var fs = require('graceful-fs') var path = require('path') +var fs = require('graceful-fs') var lifecycle = require('./utils/lifecycle.js') var readJson = require('read-package-json') -var link = require('./utils/link.js') -var linkIfExists = link.ifExists -var cmdShim = require('cmd-shim') -var cmdShimIfExists = cmdShim.ifExists -var isHashbangFile = require('./utils/is-hashbang-file.js') -var dos2Unix = require('./utils/convert-line-endings.js').dos2Unix -var asyncMap = require('slide').asyncMap +var binLinks = require('bin-links') +var binLinksConfig = require('./config/bin-links.js') var ini = require('ini') var writeFile = require('write-file-atomic') -var packageId = require('./utils/package-id.js') -var output = require('./utils/output.js') module.exports = build build.usage = 'npm build [<folder>]' @@ -74,7 +67,8 @@ function build_ (global, didPre, didRB) { if (er) return cb(er) chain([ !didPre && [lifecycle, pkg, 'preinstall', folder], - [linkStuff, pkg, folder, global, didRB], + [linkStuff, pkg, folder, global], + !didRB && [rebuildBundles, pkg, folder], [writeBuiltinConf, pkg, folder], didPre !== build._noLC && [lifecycle, pkg, 'install', folder], didPre !== build._noLC && [lifecycle, pkg, 'postinstall', folder] @@ -102,35 +96,13 @@ var writeBuiltinConf = build.writeBuiltinConf = function (pkg, folder, cb) { writeFile(path.resolve(folder, 'npmrc'), data, cb) } -var linkStuff = build.linkStuff = function (pkg, folder, global, didRB, cb) { +var linkStuff = build.linkStuff = function (pkg, folder, global, cb) { // allow to opt out of linking binaries. if (npm.config.get('bin-links') === false) return cb() - - // if it's global, and folder is in {prefix}/node_modules, - // then bins are in {prefix}/bin - // otherwise, then bins are in folder/../.bin - var parent = pkg.name && pkg.name[0] === '@' ? path.dirname(path.dirname(folder)) : path.dirname(folder) - var gnm = global && npm.globalDir - var gtop = parent === gnm - - log.info('linkStuff', packageId(pkg)) - log.silly('linkStuff', packageId(pkg), 'has', parent, 'as its parent node_modules') - if (global) log.silly('linkStuff', packageId(pkg), 'is part of a global install') - if (gnm) log.silly('linkStuff', packageId(pkg), 'is installed into a global node_modules') - if (gtop) log.silly('linkStuff', packageId(pkg), 'is installed into the top-level global node_modules') - - asyncMap( - [linkBins, linkMans, !didRB && rebuildBundles], - function (fn, cb) { - if (!fn) return cb() - log.verbose(fn.name, packageId(pkg)) - fn(pkg, folder, parent, gtop, cb) - }, - cb - ) + return binLinks(pkg, folder, global, binLinksConfig(pkg), cb) } -function rebuildBundles (pkg, folder, parent, gtop, cb) { +function rebuildBundles (pkg, folder, cb) { if (!npm.config.get('rebuild-bundle')) return cb() var deps = Object.keys(pkg.dependencies || {}) @@ -166,89 +138,3 @@ function rebuildBundles (pkg, folder, parent, gtop, cb) { }), cb) }) } - -function linkBins (pkg, folder, parent, gtop, cb) { - if (!pkg.bin || !gtop && path.basename(parent) !== 'node_modules') { - return cb() - } - var binRoot = gtop ? npm.globalBin - : path.resolve(parent, '.bin') - log.verbose('linkBins', [pkg.bin, binRoot, gtop]) - - asyncMap(Object.keys(pkg.bin), function (b, cb) { - linkBin( - path.resolve(folder, pkg.bin[b]), - path.resolve(binRoot, b), - gtop && folder, - function (er) { - if (er) return cb(er) - // bins should always be executable. - // XXX skip chmod on windows? - var src = path.resolve(folder, pkg.bin[b]) - fs.chmod(src, npm.modes.exec, function (er) { - if (er && er.code === 'ENOENT' && npm.config.get('ignore-scripts')) { - return cb() - } - if (er) return cb(er) - isHashbangFile(src).then((isHashbang) => { - if (isHashbang) return dos2Unix(src) - }).then(() => { - if (!gtop) return cb() - var dest = path.resolve(binRoot, b) - var out = npm.config.get('parseable') - ? dest + '::' + src + ':BINFILE' - : dest + ' -> ' + src - if (!npm.config.get('json') && !npm.config.get('parseable')) output(out) - cb() - }).catch(cb) - }) - } - ) - }, cb) -} - -function linkBin (from, to, gently, cb) { - if (process.platform !== 'win32') { - return linkIfExists(from, to, gently, cb) - } else { - return cmdShimIfExists(from, to, cb) - } -} - -function linkMans (pkg, folder, parent, gtop, cb) { - if (!pkg.man || !gtop || process.platform === 'win32') return cb() - - var manRoot = path.resolve(npm.config.get('prefix'), 'share', 'man') - log.verbose('linkMans', 'man files are', pkg.man, 'in', manRoot) - - // make sure that the mans are unique. - // otherwise, if there are dupes, it'll fail with EEXIST - var set = pkg.man.reduce(function (acc, man) { - acc[path.basename(man)] = man - return acc - }, {}) - pkg.man = pkg.man.filter(function (man) { - return set[path.basename(man)] === man - }) - - asyncMap(pkg.man, function (man, cb) { - if (typeof man !== 'string') return cb() - log.silly('linkMans', 'preparing to link', man) - var parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/) - if (!parseMan) { - return cb(new Error( - man + ' is not a valid name for a man file. ' + - 'Man files must end with a number, ' + - 'and optionally a .gz suffix if they are compressed.' - )) - } - - var stem = parseMan[1] - var sxn = parseMan[2] - var bn = path.basename(stem) - var manSrc = path.resolve(folder, man) - var manDest = path.join(manRoot, 'man' + sxn, bn) - - linkIfExists(manSrc, manDest, gtop && folder, cb) - }, cb) -} diff --git a/deps/npm/lib/cache.js b/deps/npm/lib/cache.js index af1ac57e719..8bd2d5fcb1a 100644 --- a/deps/npm/lib/cache.js +++ b/deps/npm/lib/cache.js @@ -4,6 +4,7 @@ const BB = require('bluebird') const assert = require('assert') const cacache = require('cacache') +const finished = BB.promisify(require('mississippi').finished) const log = require('npmlog') const npa = require('npm-package-arg') const npm = require('./npm.js') @@ -105,7 +106,7 @@ function add (args, where) { log.verbose('cache add', 'spec', spec) if (!spec) return BB.reject(new Error(usage)) log.silly('cache add', 'parsed spec', spec) - return pacote.prefetch(spec, pacoteOpts({where})) + return finished(pacote.tarball.stream(spec, pacoteOpts({where})).resume()) } cache.verify = verify diff --git a/deps/npm/lib/config/bin-links.js b/deps/npm/lib/config/bin-links.js new file mode 100644 index 00000000000..1ee90cc35e9 --- /dev/null +++ b/deps/npm/lib/config/bin-links.js @@ -0,0 +1,32 @@ +'use strict' + +const npm = require('../npm.js') +var packageId = require('../utils/package-id.js') +const log = require('npmlog') + +module.exports = binLinksOpts + +function binLinksOpts (pkg) { + return { + ignoreScripts: npm.config.get('ignore-scripts'), + force: npm.config.get('force'), + globalBin: npm.globalBin, + globalDir: npm.globalDir, + json: npm.config.get('json'), + log: log, + name: 'npm', + parseable: npm.config.get('parseable'), + pkgId: packageId(pkg), + prefix: npm.config.get('prefix'), + prefixes: [ + npm.prefix, + npm.globalPrefix, + npm.dir, + npm.root, + npm.globalDir, + npm.bin, + npm.globalBin + ], + umask: npm.config.get('umask') + } +} diff --git a/deps/npm/lib/config/core.js b/deps/npm/lib/config/core.js index 15a1674b3da..50cf4772e79 100644 --- a/deps/npm/lib/config/core.js +++ b/deps/npm/lib/config/core.js @@ -225,7 +225,6 @@ Conf.prototype.loadPrefix = require('./load-prefix.js') Conf.prototype.loadCAFile = require('./load-cafile.js') Conf.prototype.loadUid = require('./load-uid.js') Conf.prototype.setUser = require('./set-user.js') -Conf.prototype.findPrefix = require('./find-prefix.js') Conf.prototype.getCredentialsByURI = require('./get-credentials-by-uri.js') Conf.prototype.setCredentialsByURI = require('./set-credentials-by-uri.js') Conf.prototype.clearCredentialsByURI = require('./clear-credentials-by-uri.js') diff --git a/deps/npm/lib/config/defaults.js b/deps/npm/lib/config/defaults.js index 35617fd6381..c049f213fa7 100644 --- a/deps/npm/lib/config/defaults.js +++ b/deps/npm/lib/config/defaults.js @@ -176,6 +176,7 @@ Object.defineProperty(exports, 'defaults', {get: function () { maxsockets: 50, message: '%s', 'metrics-registry': null, + 'node-options': null, 'node-version': process.version, 'offline': false, 'onload-script': false, @@ -183,6 +184,7 @@ Object.defineProperty(exports, 'defaults', {get: function () { optional: true, otp: null, 'package-lock': true, + 'package-lock-only': false, parseable: false, 'prefer-offline': false, 'prefer-online': false, @@ -308,6 +310,7 @@ exports.types = { maxsockets: Number, message: String, 'metrics-registry': [null, String], + 'node-options': [null, String], 'node-version': [null, semver], offline: Boolean, 'onload-script': [null, String], @@ -315,6 +318,7 @@ exports.types = { optional: Boolean, 'package-lock': Boolean, otp: Number, + 'package-lock-only': Boolean, parseable: Boolean, 'prefer-offline': Boolean, 'prefer-online': Boolean, diff --git a/deps/npm/lib/config/fetch-opts.js b/deps/npm/lib/config/fetch-opts.js new file mode 100644 index 00000000000..1a030c378ea --- /dev/null +++ b/deps/npm/lib/config/fetch-opts.js @@ -0,0 +1,77 @@ +'use strict' + +const url = require('url') + +module.exports.fromPacote = fromPacote + +function fromPacote (opts) { + return { + cache: getCacheMode(opts), + cacheManager: opts.cache, + ca: opts.ca, + cert: opts.cert, + headers: getHeaders('', opts.registry, opts), + key: opts.key, + localAddress: opts.localAddress, + maxSockets: opts.maxSockets, + proxy: opts.proxy, + referer: opts.refer, + retry: opts.retry, + strictSSL: !!opts.strictSSL, + timeout: opts.timeout, + uid: opts.uid, + gid: opts.gid + } +} + +function getCacheMode (opts) { + return opts.offline + ? 'only-if-cached' + : opts.preferOffline + ? 'force-cache' + : opts.preferOnline + ? 'no-cache' + : 'default' +} + +function getHeaders (uri, registry, opts) { + const headers = Object.assign({ + 'npm-in-ci': opts.isFromCI, + 'npm-scope': opts.projectScope, + 'npm-session': opts.npmSession, + 'user-agent': opts.userAgent, + 'referer': opts.refer + }, opts.headers) + // check for auth settings specific to this registry + let auth = ( + opts.auth && + opts.auth[registryKey(registry)] + ) || opts.auth + // If a tarball is hosted on a different place than the manifest, only send + // credentials on `alwaysAuth` + const shouldAuth = auth && ( + auth.alwaysAuth || + url.parse(uri).host === url.parse(registry).host + ) + if (shouldAuth && auth.token) { + headers.authorization = `Bearer ${auth.token}` + } else if (shouldAuth && auth.username && auth.password) { + const encoded = Buffer.from( + `${auth.username}:${auth.password}`, 'utf8' + ).toString('base64') + headers.authorization = `Basic ${encoded}` + } else if (shouldAuth && auth._auth) { + headers.authorization = `Basic ${auth._auth}` + } + return headers +} + +function registryKey (registry) { + const parsed = url.parse(registry) + const formatted = url.format({ + host: parsed.host, + pathname: parsed.pathname, + slashes: parsed.slashes + }) + return url.resolve(formatted, '.') +} diff --git a/deps/npm/lib/config/find-prefix.js b/deps/npm/lib/config/find-prefix.js deleted file mode 100644 index 58f5cc8040b..00000000000 --- a/deps/npm/lib/config/find-prefix.js +++ /dev/null @@ -1,56 +0,0 @@ -// try to find the most reasonable prefix to use - -module.exports = findPrefix - -var fs = require('fs') -var path = require('path') - -function findPrefix (p, cb_) { - function cb (er, p) { - process.nextTick(function () { - cb_(er, p) - }) - } - - p = path.resolve(p) - // if there's no node_modules folder, then - // walk up until we hopefully find one. - // if none anywhere, then use cwd. - var walkedUp = false - while (path.basename(p) === 'node_modules') { - p = path.dirname(p) - walkedUp = true - } - if (walkedUp) return cb(null, p) - - findPrefix_(p, p, cb) -} - -function findPrefix_ (p, original, cb) { - if (p === '/' || - (process.platform === 'win32' && p.match(/^[a-zA-Z]:(\\|\/)?$/))) { - return cb(null, original) - } - fs.readdir(p, function (er, files) { - // an error right away is a bad sign. - // unless the prefix was simply a non - // existent directory. - if (er && p === original) { - if (er.code === 'ENOENT') return cb(null, original) - return cb(er) - } - - // walked up too high or something. - if (er) return cb(null, original) - - if (files.indexOf('node_modules') !== -1 || - files.indexOf('package.json') !== -1) { - return cb(null, p) - } - - var d = path.dirname(p) - if (d === p) return cb(null, original) - - return findPrefix_(d, original, cb) - }) -} diff --git a/deps/npm/lib/config/gentle-fs.js b/deps/npm/lib/config/gentle-fs.js new file mode 100644 index 00000000000..c4a1f9fa22d --- /dev/null +++ b/deps/npm/lib/config/gentle-fs.js @@ -0,0 +1,32 @@ +'use strict' + +const npm = require('../npm.js') +const log = require('npmlog') + +module.exports = gentleFSOpts + +function gentleFSOpts (gently, base, abs) { + return { + // never rm the root, prefix, or bin dirs + // + // globals included because of `npm link` -- as far as the package + // requesting the link is concerned, the linked package is always + // installed globally + prefixes: [ + npm.prefix, + npm.globalPrefix, + npm.dir, + npm.root, + npm.globalDir, + npm.bin, + npm.globalBin + ], + absolute: abs, + log: log, + prefix: npm.prefix, + force: npm.config.get('force'), + gently: gently, + base: base, + name: 'npm' + } +} diff --git a/deps/npm/lib/config/lifecycle.js b/deps/npm/lib/config/lifecycle.js index 5fca93939db..86941edcd8e 100644 --- a/deps/npm/lib/config/lifecycle.js +++ b/deps/npm/lib/config/lifecycle.js @@ -18,6 +18,7 @@ function lifecycleOpts (moreOpts) { ignorePrepublish: npm.config.get('ignore-prepublish'), ignoreScripts: npm.config.get('ignore-scripts'), log: log, + nodeOptions: npm.config.get('node-options'), production: npm.config.get('production'), scriptShell: npm.config.get('script-shell'), scriptsPrependNodePath: npm.config.get('scripts-prepend-node-path'), diff --git a/deps/npm/lib/config/load-prefix.js b/deps/npm/lib/config/load-prefix.js index bb5d9f3be56..c2af00c7f61 100644 --- a/deps/npm/lib/config/load-prefix.js +++ b/deps/npm/lib/config/load-prefix.js @@ -1,6 +1,6 @@ module.exports = loadPrefix -var findPrefix = require('./find-prefix.js') +var findPrefix = require('find-npm-prefix') var path = require('path') function loadPrefix (cb) { @@ -43,9 +43,9 @@ function loadPrefix (cb) { p = path.resolve(cli.prefix) process.nextTick(cb) } else { - findPrefix(process.cwd(), function (er, found) { + findPrefix(process.cwd()).then((found) => { p = found - cb(er) - }) + cb() + }, cb) } } diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index 029f806f835..42906f2394e 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -106,6 +106,8 @@ var mkdirp = require('mkdirp') var rimraf = require('rimraf') var iferr = require('iferr') var validate = require('aproba') +var uniq = require('lodash.uniq') +var Bluebird = require('bluebird') // npm internal utils var npm = require('./npm.js') @@ -132,6 +134,7 @@ var decomposeActions = require('./install/decompose-actions.js') var validateTree = require('./install/validate-tree.js') var validateArgs = require('./install/validate-args.js') var saveRequested = require('./install/save.js').saveRequested +var saveShrinkwrap = require('./install/save.js').saveShrinkwrap var getSaveType = require('./install/save.js').getSaveType var doSerialActions = require('./install/actions.js').doSerial var doReverseSerialActions = require('./install/actions.js').doReverseSerial @@ -199,8 +202,9 @@ function install (where, args, cb) { new Installer(where, dryrun, args).run(cb) } -function Installer (where, dryrun, args) { - validate('SBA', arguments) +function Installer (where, dryrun, args, opts) { + validate('SBA|SBAO', arguments) + if (!opts) opts = {} this.where = where this.dryrun = dryrun this.args = args @@ -215,23 +219,40 @@ function Installer (where, dryrun, args) { this.progress = {} this.noPackageJsonOk = !!args.length this.topLevelLifecycles = !args.length - this.dev = npm.config.get('dev') || (!/^prod(uction)?$/.test(npm.config.get('only')) && !npm.config.get('production')) || /^dev(elopment)?$/.test(npm.config.get('only')) - this.prod = !/^dev(elopment)?$/.test(npm.config.get('only')) - this.rollback = npm.config.get('rollback') - this.link = npm.config.get('link') - this.global = this.where === path.resolve(npm.globalDir, '..') + + const dev = npm.config.get('dev') + const only = npm.config.get('only') + const onlyProd = /^prod(uction)?$/.test(only) + const onlyDev = /^dev(elopment)?$/.test(only) + const prod = npm.config.get('production') + this.dev = opts.dev != null ? opts.dev : dev || (!onlyProd && !prod) || onlyDev + this.prod = opts.prod != null ? opts.prod : !onlyDev + + this.packageLockOnly = opts.packageLockOnly != null + ? opts.packageLockOnly : npm.config.get('package-lock-only') + this.rollback = opts.rollback != null ? opts.rollback : npm.config.get('rollback') + this.link = opts.link != null ? opts.link : npm.config.get('link') + this.saveOnlyLock = opts.saveOnlyLock + this.global = opts.global != null ? opts.global : this.where === path.resolve(npm.globalDir, '..') this.started = Date.now() } Installer.prototype = {} Installer.prototype.run = function (_cb) { - validate('F', arguments) - - var cb = function (err) { - saveMetrics(!err) - return _cb.apply(this, arguments) + validate('F|', arguments) + + var result + var cb + if (_cb) { + cb = function (err) { + saveMetrics(!err) + return _cb.apply(this, arguments) + } + } else { + result = new Promise((resolve, reject) => { + cb = (err, value) => err ? reject(err) : resolve(value) + }) } - // FIXME: This is bad and I should feel bad. // lib/install needs to have some way of sharing _limited_ // state with the things it calls. Passing the object is too @@ -274,7 +295,11 @@ Installer.prototype.run = function (_cb) { [this, this.debugActions, 'diffTrees', 'differences'], [this, this.debugActions, 'decomposeActions', 'todo']) - if (!this.dryrun) { + + if (this.packageLockOnly) { + postInstallSteps.push( + [this, this.saveToDependencies]) + } else if (!this.dryrun) { installSteps.push( [this.newTracker(log, 'executeActions', 8)], [this, this.executeActions], @@ -296,6 +321,7 @@ Installer.prototype.run = function (_cb) { // until after we extract them [this, (next) => { computeMetadata(this.idealTree); next() }], [this, this.pruneIdealTree], + [this, this.debugLogicalTree, 'saveTree', 'idealTree'], [this, this.saveToDependencies]) } } @@ -319,6 +345,7 @@ Installer.prototype.run = function (_cb) { cb(installEr || postInstallEr, self.getInstalledModules(), self.idealTree) }) }) + return result } Installer.prototype.loadArgMetadata = function (next) { @@ -544,17 +571,15 @@ Installer.prototype.executeActions = function (cb) { Installer.prototype.rollbackFailedOptional = function (staging, actionsToRun, cb) { if (!this.rollback) return cb() - var failed = actionsToRun.map(function (action) { + var failed = uniq(actionsToRun.map(function (action) { return action[1] }).filter(function (pkg) { return pkg.failed && pkg.rollback - }) + })) var top = this.currentTree && this.currentTree.path - asyncMap(failed, function (pkg, next) { - asyncMap(pkg.rollback, function (rollback, done) { - rollback(top, staging, pkg, done) - }, next) - }, cb) + Bluebird.map(failed, (pkg) => { + return Bluebird.map(pkg.rollback, (rollback) => rollback(top, staging, pkg)) + }).asCallback(cb) } Installer.prototype.commit = function (staging, actionsToRun, cb) { @@ -609,7 +634,11 @@ Installer.prototype.saveToDependencies = function (cb) { validate('F', arguments) if (this.failing) return cb() log.silly('install', 'saveToDependencies') - saveRequested(this.idealTree, cb) + if (this.saveOnlyLock) { + saveShrinkwrap(this.idealTree, cb) + } else { + saveRequested(this.idealTree, cb) + } } Installer.prototype.readGlobalPackageData = function (cb) { @@ -747,6 +776,8 @@ Installer.prototype.printInstalledForHuman = function (diffs, cb) { var moved = 0 diffs.forEach(function (action) { var mutation = action[0] + var pkg = action[1] + if (pkg.failed) return if (mutation === 'remove') { ++removed } else if (mutation === 'move') { @@ -885,11 +916,33 @@ Installer.prototype.debugActions = function (name, actionListName, cb) { // to define the arguments for use by chain before the property exists yet. Installer.prototype.debugTree = function (name, treeName, cb) { validate('SSF', arguments) - log.silly(name, this.prettify(this[treeName]).trim()) + log.silly(name, this.archyDebugTree(this[treeName]).trim()) + cb() +} + +Installer.prototype.archyDebugTree = function (tree) { + validate('O', arguments) + var seen = new Set() + function byName (aa, bb) { + return packageId(aa).localeCompare(packageId(bb)) + } + function expandTree (tree) { + seen.add(tree) + return { + label: packageId(tree), + nodes: tree.children.filter((tree) => { return !seen.has(tree) && !tree.removed }).sort(byName).map(expandTree) + } + } + return archy(expandTree(tree), '', { unicode: npm.config.get('unicode') }) +} + +Installer.prototype.debugLogicalTree = function (name, treeName, cb) { + validate('SSF', arguments) + this[treeName] && log.silly(name, this.archyDebugLogicalTree(this[treeName]).trim()) cb() } -Installer.prototype.prettify = function (tree) { +Installer.prototype.archyDebugLogicalTree = function (tree) { validate('O', arguments) var seen = new Set() function byName (aa, bb) { @@ -899,7 +952,7 @@ Installer.prototype.prettify = function (tree) { seen.add(tree) return { label: packageId(tree), - nodes: tree.children.filter((tree) => { return !seen.has(tree) && !tree.removed && !tree.failed }).sort(byName).map(expandTree) + nodes: tree.requires.filter((tree) => { return !seen.has(tree) && !tree.removed }).sort(byName).map(expandTree) } } return archy(expandTree(tree), '', { unicode: npm.config.get('unicode') }) diff --git a/deps/npm/lib/install/action/build.js b/deps/npm/lib/install/action/build.js index f59b852e848..be2c141f0dc 100644 --- a/deps/npm/lib/install/action/build.js +++ b/deps/npm/lib/install/action/build.js @@ -7,7 +7,7 @@ var packageId = require('../../utils/package-id.js') module.exports = function (staging, pkg, log, next) { log.silly('build', packageId(pkg)) chain([ - [build.linkStuff, pkg.package, pkg.path, npm.config.get('global'), true], + [build.linkStuff, pkg.package, pkg.path, npm.config.get('global')], [build.writeBuiltinConf, pkg.package, pkg.path] ], next) } diff --git a/deps/npm/lib/install/action/extract.js b/deps/npm/lib/install/action/extract.js index 8e80d4adda3..6b827f36ea9 100644 --- a/deps/npm/lib/install/action/extract.js +++ b/deps/npm/lib/install/action/extract.js @@ -16,6 +16,7 @@ let pacoteOpts const path = require('path') const localWorker = require('./extract-worker.js') const workerFarm = require('worker-farm') +const isRegistry = require('../../utils/is-registry.js') const WORKER_PATH = require.resolve('./extract-worker.js') let workers @@ -72,7 +73,7 @@ function extract (staging, pkg, log) { let msg = args const spec = typeof args[0] === 'string' ? npa(args[0]) : args[0] args[0] = spec.raw - if (ENABLE_WORKERS && (spec.registry || spec.type === 'remote')) { + if (ENABLE_WORKERS && (isRegistry(spec) || spec.type === 'remote')) { // We can't serialize these options opts.loglevel = opts.log.level opts.log = null diff --git a/deps/npm/lib/install/action/fetch.js b/deps/npm/lib/install/action/fetch.js index 474e00b05c9..a4d760fe829 100644 --- a/deps/npm/lib/install/action/fetch.js +++ b/deps/npm/lib/install/action/fetch.js @@ -1,5 +1,8 @@ 'use strict' +const BB = require('bluebird') + +const finished = BB.promisify(require('mississippi').finished) const packageId = require('../../utils/package-id.js') const pacote = require('pacote') const pacoteOpts = require('../../config/pacote') @@ -8,5 +11,6 @@ module.exports = fetch function fetch (staging, pkg, log, next) { log.silly('fetch', packageId(pkg)) const opts = pacoteOpts({integrity: pkg.package._integrity}) - pacote.prefetch(pkg.package._requested, opts).then(() => next(), next) + return finished(pacote.tarball.stream(pkg.package._requested, opts)) + .then(() => next(), next) } diff --git a/deps/npm/lib/install/action/finalize.js b/deps/npm/lib/install/action/finalize.js index a50ec8a6bdb..e46f1b9d833 100644 --- a/deps/npm/lib/install/action/finalize.js +++ b/deps/npm/lib/install/action/finalize.js @@ -7,11 +7,13 @@ const mkdirp = Bluebird.promisify(require('mkdirp')) const lstat = Bluebird.promisify(fs.lstat) const readdir = Bluebird.promisify(fs.readdir) const symlink = Bluebird.promisify(fs.symlink) -const gentlyRm = require('../../utils/gently-rm') +const gentlyRm = Bluebird.promisify(require('../../utils/gently-rm')) const moduleStagingPath = require('../module-staging-path.js') const move = require('move-concurrently') const moveOpts = {fs: fs, Promise: Bluebird, maxConcurrency: 4} const getRequested = require('../get-requested.js') +const log = require('npmlog') +const packageId = require('../../utils/package-id.js') module.exports = function (staging, pkg, log) { log.silly('finalize', pkg.realpath) @@ -88,8 +90,17 @@ module.exports = function (staging, pkg, log) { } } -module.exports.rollback = function (top, staging, pkg, next) { - const requested = pkg.package._requested || getRequested(pkg) - if (requested && requested.type === 'directory') return next() - gentlyRm(pkg.path, false, top, next) +module.exports.rollback = function (top, staging, pkg) { + return Bluebird.try(() => { + const requested = pkg.package._requested || getRequested(pkg) + if (requested && requested.type === 'directory') return Promise.resolve() + // strictly speaking rolling back a finalize should ONLY remove module that + // was being finalized, not any of the things under it. But currently + // those modules are guaranteed to be useless so we may as well remove them too. + // When/if we separate `commit` step and can rollback to previous versions + // of upgraded modules then we'll need to revisit this… + return gentlyRm(pkg.path, false, top).catch((err) => { + log.warn('rollback', `Rolling back ${packageId(pkg)} failed (this is probably harmless): ${err.message ? err.message : err}`) + }) + }) } diff --git a/deps/npm/lib/install/action/refresh-package-json.js b/deps/npm/lib/install/action/refresh-package-json.js index 42f80121006..32e64444445 100644 --- a/deps/npm/lib/install/action/refresh-package-json.js +++ b/deps/npm/lib/install/action/refresh-package-json.js @@ -14,7 +14,7 @@ module.exports = function (staging, pkg, log) { return readJson(path.join(pkg.path, 'package.json'), false).then((metadata) => { Object.keys(pkg.package).forEach(function (key) { - if (key !== 'dependencies' && !isEmpty(pkg.package[key])) { + if (key !== 'version' && key !== 'dependencies' && !isEmpty(pkg.package[key])) { metadata[key] = pkg.package[key] } }) diff --git a/deps/npm/lib/install/actions.js b/deps/npm/lib/install/actions.js index 9f0dcfa5dc2..9608a943a5a 100644 --- a/deps/npm/lib/install/actions.js +++ b/deps/npm/lib/install/actions.js @@ -83,10 +83,8 @@ function markAsFailed (pkg) { if (pkg.failed) return pkg.failed = true pkg.requires.forEach((req) => { - req.requiredBy = req.requiredBy.filter((reqReqBy) => { - return reqReqBy !== pkg - }) - if (req.requiredBy.length === 0 && !req.userRequired) { + var requiredBy = req.requiredBy.filter((reqReqBy) => !reqReqBy.failed) + if (requiredBy.length === 0 && !req.userRequired) { markAsFailed(req) } }) @@ -94,12 +92,7 @@ function markAsFailed (pkg) { function handleOptionalDepErrors (pkg, err) { markAsFailed(pkg) - var anyFatal = pkg.userRequired || pkg.isTop - for (var ii = 0; ii < pkg.requiredBy.length; ++ii) { - var parent = pkg.requiredBy[ii] - var isFatal = failedDependency(parent, pkg) - if (isFatal) anyFatal = true - } + var anyFatal = failedDependency(pkg) if (anyFatal) { throw err } else { diff --git a/deps/npm/lib/install/deps.js b/deps/npm/lib/install/deps.js index c93907a4163..93c4adffd7e 100644 --- a/deps/npm/lib/install/deps.js +++ b/deps/npm/lib/install/deps.js @@ -32,6 +32,7 @@ var reportOptionalFailure = require('./report-optional-failure.js') var getSaveType = require('./save.js').getSaveType var unixFormatPath = require('../utils/unix-format-path.js') var isExtraneous = require('./is-extraneous.js') +var isRegistry = require('../utils/is-registry.js') // The export functions in this module mutate a dependency tree, adding // items to them. @@ -121,7 +122,7 @@ function computeMetadata (tree, seen) { } } - tree.children.filter((child) => !child.removed && !child.failed).forEach((child) => computeMetadata(child, seen)) + tree.children.filter((child) => !child.removed).forEach((child) => computeMetadata(child, seen)) return tree } @@ -276,7 +277,7 @@ function isNotEmpty (value) { return value != null && value !== '' } -module.exports.computeVersionSpec = computeVersionSpec +exports.computeVersionSpec = computeVersionSpec function computeVersionSpec (tree, child) { validate('OO', arguments) var requested @@ -288,7 +289,7 @@ function computeVersionSpec (tree, child) { } else { requested = npa.resolve(child.package.name, child.package.version) } - if (requested.registry) { + if (isRegistry(requested)) { var version = child.package.version var rangeDescriptor = '' if (semver.valid(version, true) && @@ -308,10 +309,6 @@ function moduleNameMatches (name) { return function (child) { return moduleName(child) === name } } -function noModuleNameMatches (name) { - return function (child) { return moduleName(child) !== name } -} - // while this implementation does not require async calling, doing so // gives this a consistent interface with loadDeps et al exports.removeDeps = function (args, tree, saveToDependencies, next) { @@ -377,19 +374,12 @@ function isDepOptional (tree, name, pkg) { return false } -var failedDependency = exports.failedDependency = function (tree, name_pkg) { - var name - var pkg = {} - if (typeof name_pkg === 'string') { - name = name_pkg - } else { - pkg = name_pkg - name = moduleName(pkg) - } - tree.children = tree.children.filter(noModuleNameMatches(name)) - - if (isDepOptional(tree, name, pkg)) { - return false +exports.failedDependency = failedDependency +function failedDependency (tree, name, pkg) { + if (name) { + if (isDepOptional(tree, name, pkg || {})) { + return false + } } tree.failed = true @@ -398,17 +388,16 @@ var failedDependency = exports.failedDependency = function (tree, name_pkg) { if (tree.userRequired) return true - removeObsoleteDep(tree) - if (!tree.requiredBy) return false + let anyFailed = false for (var ii = 0; ii < tree.requiredBy.length; ++ii) { var requireParent = tree.requiredBy[ii] - if (failedDependency(requireParent, tree.package)) { - return true + if (failedDependency(requireParent, moduleName(tree), tree)) { + anyFailed = true } } - return false + return anyFailed } function andHandleOptionalErrors (log, tree, name, done) { @@ -418,7 +407,6 @@ function andHandleOptionalErrors (log, tree, name, done) { if (!er) return done(er, child, childLog) var isFatal = failedDependency(tree, name) if (er && !isFatal) { - tree.children = tree.children.filter(noModuleNameMatches(name)) reportOptionalFailure(tree, name, er) return done() } else { @@ -443,7 +431,7 @@ function prefetchDeps (tree, deps, log, next) { var allDependencies = Object.keys(deps).map((dep) => { return npa.resolve(dep, deps[dep]) }).filter((dep) => { - return dep.registry && + return isRegistry(dep) && !seen.has(dep.toString()) && !findRequirement(tree, dep.name, dep) }) @@ -601,8 +589,9 @@ function resolveWithNewModule (pkg, tree, log, next) { validate('OOOF', arguments) log.silly('resolveWithNewModule', packageId(pkg), 'checking installable status') - return isInstallable(pkg, iferr(next, function () { - addBundled(pkg, iferr(next, function () { + return isInstallable(pkg, (err) => { + let installable = !err + addBundled(pkg, (bundleErr) => { var parent = earliestInstallable(tree, tree, pkg) || tree var isLink = pkg._requested.type === 'directory' var child = createChild({ @@ -613,8 +602,9 @@ function resolveWithNewModule (pkg, tree, log, next) { children: pkg._bundled || [], isLink: isLink, isInLink: parent.isLink, - knownInstallable: true + knownInstallable: installable }) + if (!installable || bundleErr) child.failed = true delete pkg._bundled var hasBundled = child.children.length @@ -630,13 +620,14 @@ function resolveWithNewModule (pkg, tree, log, next) { } if (pkg._shrinkwrap && pkg._shrinkwrap.dependencies) { - return inflateShrinkwrap(child, pkg._shrinkwrap, function (er) { - next(er, child, log) + return inflateShrinkwrap(child, pkg._shrinkwrap, (swErr) => { + if (swErr) child.failed = true + next(err || bundleErr || swErr, child, log) }) } - next(null, child, log) - })) - })) + next(err || bundleErr, child, log) + }) + }) } var validatePeerDeps = exports.validatePeerDeps = function (tree, onInvalid) { @@ -669,7 +660,7 @@ var findRequirement = exports.findRequirement = function (tree, name, requested, validate('OSO', [tree, name, requested]) if (!requestor) requestor = tree var nameMatch = function (child) { - return moduleName(child) === name && child.parent && !child.removed && !child.failed + return moduleName(child) === name && child.parent && !child.removed } var versionMatch = function (child) { return doesChildVersionMatch(child, requested, requestor) diff --git a/deps/npm/lib/install/diff-trees.js b/deps/npm/lib/install/diff-trees.js index ac4f421a501..4316f351cc6 100644 --- a/deps/npm/lib/install/diff-trees.js +++ b/deps/npm/lib/install/diff-trees.js @@ -6,41 +6,98 @@ var flattenTree = require('./flatten-tree.js') var isOnlyDev = require('./is-only-dev.js') var log = require('npmlog') var path = require('path') +var ssri = require('ssri') +var moduleName = require('../utils/module-name.js') -function nonRegistrySource (pkg) { - validate('O', arguments) - var requested = pkg._requested || (pkg._from && npa(pkg._from)) - if (!requested) return false +// we don't use get-requested because we're operating on files on disk, and +// we don't want to extropolate from what _should_ be there. +function pkgRequested (pkg) { + return pkg._requested || (pkg._resolved && npa(pkg._resolved)) || (pkg._from && npa(pkg._from)) +} - if (requested.type === 'hosted') return true - if (requested.type === 'file' || requested.type === 'directory') return true +function nonRegistrySource (requested) { + if (fromGit(requested)) return true + if (fromLocal(requested)) return true + if (fromRemote(requested)) return true return false } -function pkgAreEquiv (aa, bb) { - var aaSha = (aa.dist && aa.dist.integrity) || aa._integrity - var bbSha = (bb.dist && bb.dist.integrity) || bb._integrity - if (aaSha === bbSha) return true - if (aaSha || bbSha) return false - if (nonRegistrySource(aa) || nonRegistrySource(bb)) return false - if (aa.version === bb.version) return true +function fromRemote (requested) { + if (requested.type === 'remote') return true +} + +function fromLocal (requested) { + // local is an npm@3 type that meant "file" + if (requested.type === 'file' || requested.type === 'directory' || requested.type === 'local') return true + return false +} + +function fromGit (requested) { + if (requested.type === 'hosted' || requested.type === 'git') return true return false } -function getUniqueId (pkg) { - var versionspec = pkg._integrity +function pkgIntegrity (pkg) { + try { + // dist is provided by the registry + var sri = (pkg.dist && pkg.dist.integrity) || + // _integrity is provided by pacote + pkg._integrity || + // _shasum is legacy + (pkg._shasum && ssri.fromHex(pkg._shasum, 'sha1').toString()) + if (!sri) return + var integrity = ssri.parse(sri) + if (Object.keys(integrity).length === 0) return + return integrity + } catch (ex) { + return + } +} - if (!versionspec && nonRegistrySource(pkg)) { - if (pkg._requested) { - versionspec = pkg._requested.fetchSpec - } else if (pkg._from) { - versionspec = npa(pkg._from).fetchSpec +function sriMatch (aa, bb) { + if (!aa || !bb) return false + for (let algo of Object.keys(aa)) { + if (!bb[algo]) continue + for (let aaHash of aa[algo]) { + for (let bbHash of bb[algo]) { + return aaHash.digest === bbHash.digest + } } } - if (!versionspec) { - versionspec = pkg.version + return false +} + +function pkgAreEquiv (aa, bb) { + // coming in we know they share a path… + + // if they share package metadata _identity_, they're the same thing + if (aa.package === bb.package) return true + // if they share integrity information, they're the same thing + var aaIntegrity = pkgIntegrity(aa.package) + var bbIntegrity = pkgIntegrity(bb.package) + if (aaIntegrity || bbIntegrity) return sriMatch(aaIntegrity, bbIntegrity) + + // if they're links and they share the same target, they're the same thing + if (aa.isLink && bb.isLink) return aa.realpath === bb.realpath + + // if we can't determine both their sources then we have no way to know + // if they're the same thing, so we have to assume they aren't + var aaReq = pkgRequested(aa.package) + var bbReq = pkgRequested(bb.package) + if (!aaReq || !bbReq) return false + + if (fromGit(aaReq) && fromGit(bbReq)) { + // if both are git and share a _resolved specifier (one with the + // comittish replaced by a commit hash) then they're the same + return aa.package._resolved && bb.package._resolved && + aa.package._resolved === bb.package._resolved } - return pkg.name + '@' + versionspec + + // we have to give up trying to find matches for non-registry sources at this point… + if (nonRegistrySource(aaReq) || nonRegistrySource(bbReq)) return false + + // finally, if they ARE a registry source then version matching counts + return aa.package.version === bb.package.version } function pushAll (aa, bb) { @@ -118,41 +175,56 @@ var diffTrees = module.exports._diffTrees = function (oldTree, newTree) { var flatOldTree = flattenTree(oldTree) var flatNewTree = flattenTree(newTree) var toRemove = {} - var toRemoveByUniqueId = {} - // find differences + var toRemoveByName = {} + + // Build our tentative remove list. We don't add remove actions yet + // because we might resuse them as part of a move. Object.keys(flatOldTree).forEach(function (flatname) { + if (flatname === '/') return if (flatNewTree[flatname]) return var pkg = flatOldTree[flatname] if (pkg.isInLink && /^[.][.][/\\]/.test(path.relative(newTree.realpath, pkg.realpath))) return toRemove[flatname] = pkg - var pkgunique = getUniqueId(pkg.package) - if (!toRemoveByUniqueId[pkgunique]) toRemoveByUniqueId[pkgunique] = [] - toRemoveByUniqueId[pkgunique].push(flatname) + var name = moduleName(pkg) + if (!toRemoveByName[name]) toRemoveByName[name] = [] + toRemoveByName[name].push({flatname: flatname, pkg: pkg}) }) - Object.keys(flatNewTree).forEach(function (path) { - var pkg = flatNewTree[path] - pkg.oldPkg = flatOldTree[path] - if (pkg.oldPkg) { - if (!pkg.userRequired && pkgAreEquiv(pkg.oldPkg.package, pkg.package)) return + + // generate our add/update/move actions + Object.keys(flatNewTree).forEach(function (flatname) { + if (flatname === '/') return + var pkg = flatNewTree[flatname] + var oldPkg = pkg.oldPkg = flatOldTree[flatname] + if (oldPkg) { + // if the versions are equivalent then we don't need to update… unless + // the user explicitly asked us to. + if (!pkg.userRequired && pkgAreEquiv(oldPkg, pkg)) return setAction(differences, 'update', pkg) } else { - var vername = getUniqueId(pkg.package) - var removing = toRemoveByUniqueId[vername] && toRemoveByUniqueId[vername].length + var name = moduleName(pkg) + // find any packages we're removing that share the same name and are equivalent + var removing = (toRemoveByName[name] || []).filter((rm) => pkgAreEquiv(rm.pkg, pkg)) var bundlesOrFromBundle = pkg.fromBundle || pkg.package.bundleDependencies - if (removing && !bundlesOrFromBundle) { - var flatname = toRemoveByUniqueId[vername].shift() - pkg.fromPath = toRemove[flatname].path + // if we have any removes that match AND we're not working with a bundle then upgrade to a move + if (removing.length && !bundlesOrFromBundle) { + var toMv = removing.shift() + toRemoveByName[name] = toRemoveByName[name].filter((rm) => rm !== toMv) + pkg.fromPath = toMv.pkg.path setAction(differences, 'move', pkg) - delete toRemove[flatname] + delete toRemove[toMv.flatname] + // we don't generate add actions for things found in links (which already exist on disk) or + // for bundled modules (which will be installed when we install their parent) } else if (!(pkg.isInLink && pkg.fromBundle)) { setAction(differences, 'add', pkg) } } }) + + // finally generate our remove actions from any not consumed by moves Object .keys(toRemove) - .map((path) => toRemove[path]) + .map((flatname) => toRemove[flatname]) .forEach((pkg) => setAction(differences, 'remove', pkg)) const includeDev = npm.config.get('dev') || diff --git a/deps/npm/lib/install/inflate-shrinkwrap.js b/deps/npm/lib/install/inflate-shrinkwrap.js index 48be93d0952..43ac9136f01 100644 --- a/deps/npm/lib/install/inflate-shrinkwrap.js +++ b/deps/npm/lib/install/inflate-shrinkwrap.js @@ -13,6 +13,7 @@ const npm = require('../npm.js') const realizeShrinkwrapSpecifier = require('./realize-shrinkwrap-specifier.js') const validate = require('aproba') const path = require('path') +const isRegistry = require('../utils/is-registry.js') module.exports = function (tree, sw, opts, finishInflating) { if (!fetchPackageMetadata) { @@ -147,7 +148,7 @@ function adaptResolved (requested, resolved) { const registry = requested.scope ? npm.config.get(`${requested.scope}:registry`) || npm.config.get('registry') : npm.config.get('registry') - if (!requested.registry || (resolved && resolved.indexOf(registry) === 0)) { + if (!isRegistry(requested) || (resolved && resolved.indexOf(registry) === 0)) { // Nothing to worry about here. Pass it through. return resolved } else { @@ -199,7 +200,7 @@ function childIsEquivalent (sw, requested, child) { if (child.isLink && requested.type === 'directory') return path.relative(child.realpath, requested.fetchSpec) === '' if (sw.resolved) return child.package._resolved === sw.resolved - if (!requested.registry && sw.from) return child.package._from === sw.from - if (!requested.registry && child.package._resolved) return sw.version === child.package._resolved + if (!isRegistry(requested) && sw.from) return child.package._from === sw.from + if (!isRegistry(requested) && child.package._resolved) return sw.version === child.package._resolved return child.package.version === sw.version } diff --git a/deps/npm/lib/install/realize-shrinkwrap-specifier.js b/deps/npm/lib/install/realize-shrinkwrap-specifier.js index ac700278fff..e4b14b1f0d9 100644 --- a/deps/npm/lib/install/realize-shrinkwrap-specifier.js +++ b/deps/npm/lib/install/realize-shrinkwrap-specifier.js @@ -1,5 +1,6 @@ 'use strict' var npa = require('npm-package-arg') +const isRegistry = require('../utils/is-registry.js') module.exports = function (name, sw, where) { try { @@ -7,7 +8,7 @@ module.exports = function (name, sw, where) { return npa.resolve(name, sw.version, where) } else if (sw.from) { const spec = npa(sw.from, where) - if (spec.registry && sw.version) { + if (isRegistry(spec) && sw.version) { return npa.resolve(name, sw.version, where) } else if (!sw.resolved) { return spec diff --git a/deps/npm/lib/install/save.js b/deps/npm/lib/install/save.js index e1a94fcff7a..f0c61f555d6 100644 --- a/deps/npm/lib/install/save.js +++ b/deps/npm/lib/install/save.js @@ -39,6 +39,8 @@ function andWarnErrors (cb) { } } +exports.saveShrinkwrap = saveShrinkwrap + function saveShrinkwrap (tree, next) { validate('OF', arguments) if (!npm.config.get('shrinkwrap') || !npm.config.get('package-lock')) { diff --git a/deps/npm/lib/link.js b/deps/npm/lib/link.js index 54b8dcac7a4..158d9b06456 100644 --- a/deps/npm/lib/link.js +++ b/deps/npm/lib/link.js @@ -122,7 +122,7 @@ function linkInstall (pkgs, cb) { log.verbose('link', 'symlinking %s to %s', pp, target) cb() } ], - [symlink, pp, target], + [symlink, pp, target, false, false], // do not run any scripts rp && [build, [target], npm.config.get('global'), build._noLC, true], [resultPrinter, pkg, pp, target, rp] diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index 3a84947f79f..e58712603bf 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -24,6 +24,16 @@ var npm = module.exports = new EventEmitter() var npmconf = require('./config/core.js') var log = require('npmlog') + var inspect = require('util').inspect + + // capture global logging + process.on('log', function (level) { + try { + return log[level].apply(log, [].slice.call(arguments, 1)) + } catch (ex) { + log.verbose('attempt to log ' + inspect(arguments) + ' crashed: ' + ex.message) + } + }) var path = require('path') var abbrev = require('abbrev') diff --git a/deps/npm/lib/pack.js b/deps/npm/lib/pack.js index c428482035c..f6a0eff805f 100644 --- a/deps/npm/lib/pack.js +++ b/deps/npm/lib/pack.js @@ -6,7 +6,6 @@ const BB = require('bluebird') -const cache = require('./cache') const cacache = require('cacache') const cp = require('child_process') const deprCheck = require('./utils/depr-check') @@ -18,6 +17,7 @@ const log = require('npmlog') const move = require('move-concurrently') const npm = require('./npm') const output = require('./utils/output') +const pacote = require('pacote') const pacoteOpts = require('./config/pacote') const path = require('path') const PassThrough = require('stream').PassThrough @@ -26,7 +26,6 @@ const pipe = BB.promisify(require('mississippi').pipe) const prepublishWarning = require('./utils/warn-deprecated')('prepublish-on-install') const pinflight = require('promise-inflight') const readJson = BB.promisify(require('read-package-json')) -const writeStreamAtomic = require('fs-write-stream-atomic') const tar = require('tar') const packlist = require('npm-packlist') @@ -69,12 +68,8 @@ function pack_ (pkg, dir) { return packDirectory(mani, mani._resolved, target) }) } else { - return cache.add(pkg).then((info) => { - return pipe( - cacache.get.stream.byDigest(pacoteOpts().cache, info.integrity || mani._integrity), - writeStreamAtomic(target) - ) - }).then(() => target) + return pacote.tarball.toFile(pkg, target, pacoteOpts()) + .then(() => target) } }) }) @@ -125,11 +120,15 @@ function packDirectory (mani, dir, target) { cwd: dir, prefix: 'package/', portable: true, + noMtime: true, gzip: true } return packlist({ path: dir }) - .then((files) => tar.create(tarOpt, files)) + // NOTE: node-tar does some Magic Stuff depending on prefixes for files + // specifically with @ signs, so we just neutralize that one + // and any such future "features" by prepending `./` + .then((files) => tar.create(tarOpt, files.map((f) => `./${f}`))) .then(() => move(tmpTarget, target, {Promise: BB, fs})) .then(() => lifecycle(pkg, 'postpack', dir)) .then(() => target) diff --git a/deps/npm/lib/profile.js b/deps/npm/lib/profile.js index 4238e142760..587a26ca8b5 100644 --- a/deps/npm/lib/profile.js +++ b/deps/npm/lib/profile.js @@ -12,6 +12,7 @@ const qrcodeTerminal = require('qrcode-terminal') const url = require('url') const queryString = require('query-string') const pulseTillDone = require('./utils/pulse-till-done.js') +const inspect = require('util').inspect module.exports = profileCmd @@ -87,11 +88,11 @@ function config () { } const knownProfileKeys = qw` - name email ${'two factor auth'} fullname homepage + name email ${'two-factor auth'} fullname homepage freenode twitter github created updated` function get (args) { - const tfa = 'two factor auth' + const tfa = 'two-factor auth' const conf = config() return pulseTillDone.withPromise(profile.get(conf)).then((info) => { if (!info.cidr_whitelist) delete info.cidr_whitelist @@ -188,8 +189,10 @@ function set (args) { output(JSON.stringify({[prop]: result[prop]}, null, 2)) } else if (conf.parseable) { output(prop + '\t' + result[prop]) - } else { + } else if (result[prop] != null) { output('Set', prop, 'to', result[prop]) + } else { + output('Set', prop) } }) })) @@ -202,7 +205,7 @@ function enable2fa (args) { } const mode = args[0] || 'auth-and-writes' if (mode !== 'auth-only' && mode !== 'auth-and-writes') { - return Promise.reject(new Error(`Invalid two factor authentication mode "${mode}".\n` + + return Promise.reject(new Error(`Invalid two-factor authentication mode "${mode}".\n` + 'Valid modes are:\n' + ' auth-only - Require two-factor authentication only when logging in\n' + ' auth-and-writes - Require two-factor authentication when logging in AND when publishing')) @@ -210,16 +213,31 @@ function enable2fa (args) { const conf = config() if (conf.json || conf.parseable) { return Promise.reject(new Error( - 'Enabling two-factor authentication is an interactive opperation and ' + - (conf.json ? 'JSON' : 'parseable') + 'output mode is not available')) + 'Enabling two-factor authentication is an interactive operation and ' + + (conf.json ? 'JSON' : 'parseable') + ' output mode is not available')) } - log.notice('profile', 'Enabling two factor authentication for ' + mode) + const info = { tfa: { mode: mode } } - return readUserInfo.password().then((password) => { + + return Bluebird.try(() => { + // if they're using legacy auth currently then we have to update them to a + // bearer token before continuing. + if (conf.auth.basic) { + log.info('profile', 'Updating authentication to bearer token') + return profile.login(conf.auth.basic.username, conf.auth.basic.password, conf).then((result) => { + if (!result.token) throw new Error('Your registry ' + conf.registry + 'does not seem to support bearer tokens. Bearer tokens are required for two-factor authentication') + npm.config.setCredentialsByURI(conf.registry, {token: result.token}) + return Bluebird.fromNode((cb) => npm.config.save('user', cb)) + }) + } + }).then(() => { + log.notice('profile', 'Enabling two factor authentication for ' + mode) + return readUserInfo.password() + }).then((password) => { info.tfa.password = password log.info('profile', 'Determine if tfa is pending') return pulseTillDone.withPromise(profile.get(conf)).then((info) => { @@ -235,7 +253,7 @@ function enable2fa (args) { } }) }).then(() => { - log.info('profile', 'Setting two factor authentication to ' + mode) + log.info('profile', 'Setting two-factor authentication to ' + mode) return pulseTillDone.withPromise(profile.set(info, conf)) }).then((challenge) => { if (challenge.tfa === null) { @@ -243,7 +261,7 @@ function enable2fa (args) { return } if (typeof challenge.tfa !== 'string' || !/^otpauth:[/][/]/.test(challenge.tfa)) { - throw new Error('Unknown error enabling two-factor authentication. Expected otpauth URL, got: ' + challenge.tfa) + throw new Error('Unknown error enabling two-factor authentication. Expected otpauth URL, got: ' + inspect(challenge.tfa)) } const otpauth = url.parse(challenge.tfa) const opts = queryString.parse(otpauth.query) @@ -252,10 +270,10 @@ function enable2fa (args) { }).then((code) => { return readUserInfo.otp('And an OTP code from your authenticator: ') }).then((otp1) => { - log.info('profile', 'Finalizing two factor authentication') + log.info('profile', 'Finalizing two-factor authentication') return profile.set({tfa: [otp1]}, conf) }).then((result) => { - output('TFA successfully enabled. Below are your recovery codes, please print these out.') + output('2FA successfully enabled. Below are your recovery codes, please print these out.') output('You will need these to recover access to your account if you lose your authentication device.') result.tfa.forEach((c) => output('\t' + c)) }) diff --git a/deps/npm/lib/publish.js b/deps/npm/lib/publish.js index bf60e1d5a69..20bd2603e6f 100644 --- a/deps/npm/lib/publish.js +++ b/deps/npm/lib/publish.js @@ -3,7 +3,6 @@ const BB = require('bluebird') const cacache = require('cacache') -const cache = require('./cache') const createReadStream = require('graceful-fs').createReadStream const getPublishConfig = require('./utils/get-publish-config.js') const lifecycle = BB.promisify(require('./utils/lifecycle.js')) @@ -16,11 +15,9 @@ const pack = require('./pack') const pacote = require('pacote') const pacoteOpts = require('./config/pacote') const path = require('path') -const pipe = BB.promisify(require('mississippi').pipe) const readJson = BB.promisify(require('read-package-json')) const semver = require('semver') const statAsync = BB.promisify(require('graceful-fs').stat) -const writeStreamAtomic = require('fs-write-stream-atomic') const readUserInfo = require('./utils/read-user-info.js') publish.usage = 'npm publish [<tarball>|<folder>] [--tag <tag>] [--access <public|restricted>]' + @@ -105,20 +102,11 @@ function publishFromPackage (arg) { return cacache.tmp.withTmp(npm.tmp, {tmpPrefix: 'fromPackage'}, (tmp) => { const extracted = path.join(tmp, 'package') const target = path.join(tmp, 'package.json') - return cache.add(arg).then((info) => { - const opts = pacoteOpts({integrity: info.integrity}) - return BB.all([ - pipe( - cacache.get.stream.byDigest(opts.cache, info.integrity), - writeStreamAtomic(target) - ).then(() => target), - pacote.extract(arg, extracted, opts).then(() => { - return readJson(path.join(extracted, 'package.json')) - }) - ]).spread((target, pkg) => { - return upload(arg, pkg, false, target) - }) - }) + const opts = pacoteOpts() + return pacote.tarball.toFile(arg, target, opts) + .then(() => pacote.extract(arg, extracted, opts)) + .then(() => readJson(path.join(extracted, 'package.json'))) + .tap((pkg) => upload(arg, pkg, false, target)) }) } diff --git a/deps/npm/lib/shrinkwrap.js b/deps/npm/lib/shrinkwrap.js index 956a6936468..ddfff2c6816 100644 --- a/deps/npm/lib/shrinkwrap.js +++ b/deps/npm/lib/shrinkwrap.js @@ -21,6 +21,7 @@ const ssri = require('ssri') const validate = require('aproba') const writeFileAtomic = require('write-file-atomic') const unixFormatPath = require('./utils/unix-format-path.js') +const isRegistry = require('./utils/is-registry.js') const PKGLOCK = 'package-lock.json' const SHRINKWRAP = 'npm-shrinkwrap.json' @@ -113,7 +114,7 @@ function shrinkwrapDeps (deps, top, tree, seen) { if (child.fromBundle || child.isInLink) { pkginfo.bundled = true } else { - if (requested.registry) { + if (isRegistry(requested)) { pkginfo.resolved = child.package._resolved } // no integrity for git deps as integirty hashes are based on the @@ -153,7 +154,7 @@ function sortModules (modules) { function childVersion (top, child, req) { if (req.type === 'directory' || req.type === 'file') { return 'file:' + unixFormatPath(path.relative(top.path, child.package._resolved || req.fetchSpec)) - } else if (!req.registry && !child.fromBundle) { + } else if (!isRegistry(req) && !child.fromBundle) { return child.package._resolved || req.saveSpec || req.rawSpec } else { return child.package.version diff --git a/deps/npm/lib/token.js b/deps/npm/lib/token.js index a182b633d20..2a3b65e6ad7 100644 --- a/deps/npm/lib/token.js +++ b/deps/npm/lib/token.js @@ -15,17 +15,17 @@ module.exports = token token.usage = 'npm token list\n' + - 'npm token delete <tokenKey>\n' + + 'npm token revoke <tokenKey>\n' + 'npm token create [--read-only] [--cidr=list]\n' -token.subcommands = ['list', 'delete', 'create'] +token.subcommands = ['list', 'revoke', 'create'] token.completion = function (opts, cb) { var argv = opts.conf.argv.remain switch (argv[2]) { case 'list': - case 'delete': + case 'revoke': case 'create': return cb(null, []) default: @@ -46,7 +46,7 @@ function token (args, cb) { withCb(list(), cb) break case 'delete': - case 'rel': + case 'revoke': case 'remove': case 'rm': withCb(rm(args.slice(1)), cb) @@ -127,7 +127,7 @@ function list (args) { function rm (args) { if (args.length === 0) { - throw new Error('npm token delete <tokenKey>') + throw new Error('npm token revoke <tokenKey>') } const conf = config() const toRemove = [] diff --git a/deps/npm/lib/update.js b/deps/npm/lib/update.js index 2c1d1e82a81..efb56f5e415 100644 --- a/deps/npm/lib/update.js +++ b/deps/npm/lib/update.js @@ -1,11 +1,13 @@ +'use strict' module.exports = update -var url = require('url') -var log = require('npmlog') -var chain = require('slide').chain -var npm = require('./npm.js') -var Installer = require('./install.js').Installer -var usage = require('./utils/usage') +const url = require('url') +const log = require('npmlog') +const Bluebird = require('bluebird') +const npm = require('./npm.js') +const Installer = require('./install.js').Installer +const usage = require('./utils/usage') +const outdated = Bluebird.promisify(npm.commands.outdated) update.usage = usage( 'update', @@ -15,12 +17,16 @@ update.usage = usage( update.completion = npm.commands.outdated.completion function update (args, cb) { - var dryrun = false + return update_(args).asCallback(cb) +} + +function update_ (args) { + let dryrun = false if (npm.config.get('dry-run')) dryrun = true - npm.commands.outdated(args, true, function (er, rawOutdated) { - if (er) return cb(er) - var outdated = rawOutdated.map(function (ww) { + log.verbose('update', 'computing outdated modules to update') + return outdated(args, true).then((rawOutdated) => { + const outdated = rawOutdated.map(function (ww) { return { dep: ww[0], depname: ww[1], @@ -32,7 +38,7 @@ function update (args, cb) { } }) - var wanted = outdated.filter(function (ww) { + const wanted = outdated.filter(function (ww) { if (ww.current === ww.wanted && ww.wanted !== ww.latest) { log.verbose( 'outdated', @@ -42,23 +48,25 @@ function update (args, cb) { } return ww.current !== ww.wanted && ww.latest !== 'linked' }) - if (wanted.length === 0) return cb() + if (wanted.length === 0) return log.info('outdated', 'updating', wanted) - var toInstall = {} + const toInstall = {} + wanted.forEach(function (ww) { // use the initial installation method (repo, tar, git) for updating if (url.parse(ww.req).protocol) ww.what = ww.req - var where = ww.dep.parent && ww.dep.parent.path || ww.dep.path - if (toInstall[where]) { - toInstall[where].push(ww.what) - } else { - toInstall[where] = [ww.what] - } + const where = ww.dep.parent && ww.dep.parent.path || ww.dep.path + const isTransitive = !(ww.dep.requiredBy || []).some((p) => p.isTop) + const key = where + ':' + String(isTransitive) + if (!toInstall[key]) toInstall[key] = {where: where, opts: {saveOnlyLock: isTransitive}, what: []} + if (toInstall[key].what.indexOf(ww.what) === -1) toInstall[key].what.push(ww.what) + }) + return Bluebird.each(Object.keys(toInstall), (key) => { + const deps = toInstall[key] + const inst = new Installer(deps.where, dryrun, deps.what, deps.opts) + return inst.run() }) - chain(Object.keys(toInstall).map(function (where) { - return [new Installer(where, dryrun, toInstall[where]), 'run'] - }), cb) }) } diff --git a/deps/npm/lib/utils/convert-line-endings.js b/deps/npm/lib/utils/convert-line-endings.js deleted file mode 100644 index b05d328aacd..00000000000 --- a/deps/npm/lib/utils/convert-line-endings.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict' - -const Transform = require('stream').Transform -const Bluebird = require('bluebird') -const fs = require('graceful-fs') -const stat = Bluebird.promisify(fs.stat) -const chmod = Bluebird.promisify(fs.chmod) -const fsWriteStreamAtomic = require('fs-write-stream-atomic') - -module.exports.dos2Unix = dos2Unix - -function dos2Unix (file) { - return stat(file).then((stats) => { - let previousChunkEndedInCR = false - return new Bluebird((resolve, reject) => { - fs.createReadStream(file) - .on('error', reject) - .pipe(new Transform({ - transform: function (chunk, encoding, done) { - let data = chunk.toString() - if (previousChunkEndedInCR) { - data = '\r' + data - } - if (data[data.length - 1] === '\r') { - data = data.slice(0, -1) - previousChunkEndedInCR = true - } else { - previousChunkEndedInCR = false - } - done(null, data.replace(/\r\n/g, '\n')) - }, - flush: function (done) { - if (previousChunkEndedInCR) { - this.push('\r') - } - done() - } - })) - .on('error', reject) - .pipe(fsWriteStreamAtomic(file)) - .on('error', reject) - .on('finish', function () { - resolve(chmod(file, stats.mode)) - }) - }) - }) -} - -// could add unix2Dos and legacy Mac functions if need be diff --git a/deps/npm/lib/utils/error-message.js b/deps/npm/lib/utils/error-message.js index 028a18bbb6b..85504f5edc5 100644 --- a/deps/npm/lib/utils/error-message.js +++ b/deps/npm/lib/utils/error-message.js @@ -67,49 +67,53 @@ function errorMessage (er) { break case 'EOTP': - short.push(['', 'This operation requires a one-time password from your authenticator.']) - detail.push([ - '', - [ - 'You can provide a one-time password by passing --otp=<code> to the command you ran.', - 'If you already provided a one-time password then it is likely that you either typoed', - 'it, or it timed out. Please try again.' - ].join('\n') - ]) - break - case 'E401': - // npm ERR! code E401 - // npm ERR! Unable to authenticate, need: Basic - if (er.headers && er.headers['www-authenticate']) { - const auth = er.headers['www-authenticate'] - if (auth.indexOf('Bearer') !== -1) { - short.push(['', 'Unable to authenticate, your authentication token seems to be invalid.']) - detail.push([ - '', - [ - 'To correct this please trying logging in again with:', - ' npm login' - ].join('\n') - ]) - break - } else if (auth.indexOf('Basic') !== -1) { - short.push(['', 'Incorrect or missing password.']) - detail.push([ - '', - [ - 'If you were trying to login, change your password, create an', - 'authentication token or enable two-factor authentication then', - 'that means you likely typed your password in incorectly.', - 'Please try again, or recover your password at:', - ' https://www.npmjs.com/forgot', + // the E401 message checking is a hack till we replace npm-registry-client with something + // OTP aware. + if (er.code === 'EOTP' || (er.code === 'E401' && /one-time pass/.test(er.message))) { + short.push(['', 'This operation requires a one-time password from your authenticator.']) + detail.push([ + '', + [ + 'You can provide a one-time password by passing --otp=<code> to the command you ran.', + 'If you already provided a one-time password then it is likely that you either typoed', + 'it, or it timed out. Please try again.' + ].join('\n') + ]) + break + } else { + // npm ERR! code E401 + // npm ERR! Unable to authenticate, need: Basic + if (er.headers && er.headers['www-authenticate']) { + const auth = er.headers['www-authenticate'].map((au) => au.split(/,\s*/))[0] || [] + if (auth.indexOf('Bearer') !== -1) { + short.push(['', 'Unable to authenticate, your authentication token seems to be invalid.']) + detail.push([ + '', + [ + 'To correct this please trying logging in again with:', + ' npm login' + ].join('\n') + ]) + break + } else if (auth.indexOf('Basic') !== -1) { + short.push(['', 'Incorrect or missing password.']) + detail.push([ '', - 'If you were doing some other operation then your saved credentials are', - 'probably out of date. To correct this please try logging in again with:', - ' npm login' - ].join('\n') - ]) - break + [ + 'If you were trying to login, change your password, create an', + 'authentication token or enable two-factor authentication then', + 'that means you likely typed your password in incorrectly.', + 'Please try again, or recover your password at:', + ' https://www.npmjs.com/forgot', + '', + 'If you were doing some other operation then your saved credentials are', + 'probably out of date. To correct this please try logging in again with:', + ' npm login' + ].join('\n') + ]) + break + } } } diff --git a/deps/npm/lib/utils/gently-rm.js b/deps/npm/lib/utils/gently-rm.js index 7253e873c62..16d0aa9bd7f 100644 --- a/deps/npm/lib/utils/gently-rm.js +++ b/deps/npm/lib/utils/gently-rm.js @@ -3,20 +3,8 @@ exports = module.exports = gentlyRm -var resolve = require('path').resolve -var dirname = require('path').dirname -var normalize = require('path').normalize -var validate = require('aproba') -var log = require('npmlog') -var lstat = require('graceful-fs').lstat -var readlink = require('graceful-fs').readlink -var isInside = require('path-is-inside') -var vacuum = require('fs-vacuum') -var chain = require('slide').chain -var asyncMap = require('slide').asyncMap -var readCmdShim = require('read-cmd-shim') -var iferr = require('iferr') -var npm = require('../npm.js') +var gentleFS = require('gentle-fs') +var gentleFSOpts = require('../config/gentle-fs.js') function gentlyRm (target, gently, base, cb) { if (!cb) { @@ -29,258 +17,5 @@ function gentlyRm (target, gently, base, cb) { gently = false } - // never rm the root, prefix, or bin dirs - // - // globals included because of `npm link` -- as far as the package - // requesting the link is concerned, the linked package is always - // installed globally - var prefixes = [ - npm.prefix, - npm.globalPrefix, - npm.dir, - npm.root, - npm.globalDir, - npm.bin, - npm.globalBin - ] - - var targetPath = normalize(resolve(npm.prefix, target)) - if (prefixes.indexOf(targetPath) !== -1) { - return cb(new Error('May not delete: ' + targetPath)) - } - var options = { } - if (npm.config.get('force') || !gently) options.purge = true - if (base) options.base = normalize(resolve(npm.prefix, base)) - - if (!gently) { - return vacuum(targetPath, options, cb) - } - - var parent = options.base = options.base || normalize(npm.prefix) - - // Do all the async work we'll need to do in order to tell if this is a - // safe operation - chain([ - [isEverInside, parent, prefixes], - [readLinkOrShim, targetPath], - [isEverInside, targetPath, prefixes], - [isEverInside, targetPath, [parent]] - ], function (er, results) { - if (er) { - if (er.code === 'ENOENT') return cb() - return cb(er) - } - var parentInfo = { - path: parent, - managed: results[0] - } - var targetInfo = { - path: targetPath, - symlink: results[1], - managed: results[2], - inParent: results[3] - } - - isSafeToRm(parentInfo, targetInfo, iferr(cb, thenRemove)) - - function thenRemove (toRemove, removeBase) { - if (!toRemove) return cb() - if (removeBase) options.base = removeBase - return vacuum(toRemove, options, cb) - } - }) -} - -exports._isSafeToRm = isSafeToRm -function isSafeToRm (parent, target, cb) { - log.silly('gentlyRm', 'parent.path =', parent.path) - log.silly('gentlyRm', 'parent.managed =', - parent.managed && parent.managed.target + ' is in ' + parent.managed.path) - log.silly('gentlyRm', 'target.path = ', target.path) - log.silly('gentlyRm', 'target.symlink =', target.symlink) - log.silly('gentlyRm', 'target.managed =', - target.managed && target.managed.target + ' is in ' + target.managed.path) - log.silly('gentlyRm', 'target.inParent = ', target.inParent) - - // The parent directory or something it symlinks to must eventually be in - // a folder that npm maintains. - if (!parent.managed) { - log.info('gentlyRm', parent.path, - 'is not contained in any diretory npm is known to control or ' + - 'any place they link to') - return cb(clobberFail(target.path, 'containing path ' + parent.path + - " isn't under npm's control")) - } - - // The target or something it symlinks to must eventually be in the parent - // or something the parent symlinks to - if (target.inParent) { - var actualTarget = target.inParent.target - var targetsParent = target.inParent.path - // if the target.path was what we found in some version of parent, remove - // using that parent as the base - if (target.path === actualTarget) { - return cb(null, target.path, targetsParent) - } else { - // If something the target.path links to was what was found, just - // remove target.path in the location it was found. - return cb(null, target.path, dirname(target.path)) - } - } - - // If the target is in a managed directory and is in a symlink, but was - // not in our parent that usually means someone else installed a bin file - // with the same name as one of our bin files. - if (target.managed && target.symlink) { - log.warn('gentlyRm', 'not removing', target.path, - "as it wasn't installed by", parent.path) - return cb() - } - - if (target.symlink) { - return cb(clobberFail(target.path, target.symlink + - ' symlink target is not controlled by npm ' + parent.path)) - } else { - return cb(clobberFail(target.path, 'is outside ' + parent.path + - ' and not a link')) - } -} - -function clobberFail (target, msg) { - validate('SS', arguments) - var er = new Error('Refusing to delete ' + target + ': ' + msg) - er.code = 'EEXIST' - er.path = target - return er -} - -function isENOENT (err) { - return err && err.code === 'ENOENT' -} - -function notENOENT (err) { - return !isENOENT(err) -} - -function skipENOENT (cb) { - return function (err, value) { - if (isENOENT(err)) { - return cb(null, false) - } else { - return cb(err, value) - } - } -} - -function errorsToValues (fn) { - return function () { - var args = Array.prototype.slice.call(arguments) - var cb = args.pop() - args.push(function (err, value) { - if (err) { - return cb(null, err) - } else { - return cb(null, value) - } - }) - fn.apply(null, args) - } -} - -function isNotError (value) { - return !(value instanceof Error) -} - -exports._isEverInside = isEverInside -// return the first of path, where target (or anything it symlinks to) -// isInside the path (or anything it symlinks to) -function isEverInside (target, paths, cb) { - validate('SAF', arguments) - asyncMap(paths, errorsToValues(readAllLinks), iferr(cb, function (resolvedPaths) { - var errorFree = resolvedPaths.filter(isNotError) - if (errorFree.length === 0) { - var badErrors = resolvedPaths.filter(notENOENT) - if (badErrors.length === 0) { - return cb(null, false) - } else { - return cb(badErrors[0]) - } - } - readAllLinks(target, iferr(skipENOENT(cb), function (targets) { - cb(null, areAnyInsideAny(targets, errorFree)) - })) - })) -} - -exports._areAnyInsideAny = areAnyInsideAny -// Return the first path found that any target is inside -function areAnyInsideAny (targets, paths) { - validate('AA', arguments) - var toCheck = [] - paths.forEach(function (path) { - targets.forEach(function (target) { - toCheck.push([target, path]) - }) - }) - for (var ii = 0; ii < toCheck.length; ++ii) { - var target = toCheck[ii][0] - var path = toCheck[ii][1] - var inside = isInside(target, path) - if (!inside) log.silly('isEverInside', target, 'is not inside', path) - if (inside && path) return inside && path && {target: target, path: path} - } - return false -} - -exports._readAllLinks = readAllLinks -// resolves chains of symlinks of unlimited depth, returning a list of paths -// it's seen in the process when it hits either a symlink cycle or a -// non-symlink -function readAllLinks (path, cb) { - validate('SF', arguments) - var seen = {} - _readAllLinks(path) - - function _readAllLinks (path) { - if (seen[path]) return cb(null, Object.keys(seen)) - seen[path] = true - resolveSymlink(path, iferr(cb, _readAllLinks)) - } -} - -exports._resolveSymlink = resolveSymlink -var resolvedPaths = {} -function resolveSymlink (symlink, cb) { - validate('SF', arguments) - var cached = resolvedPaths[symlink] - if (cached) return cb(null, cached) - - readLinkOrShim(symlink, iferr(cb, function (symlinkTarget) { - if (symlinkTarget) { - resolvedPaths[symlink] = resolve(dirname(symlink), symlinkTarget) - } else { - resolvedPaths[symlink] = symlink - } - return cb(null, resolvedPaths[symlink]) - })) -} - -exports._readLinkOrShim = readLinkOrShim -function readLinkOrShim (path, cb) { - validate('SF', arguments) - lstat(path, iferr(cb, function (stat) { - if (stat.isSymbolicLink()) { - readlink(path, cb) - } else { - readCmdShim(path, function (er, source) { - if (!er) return cb(null, source) - // lstat wouldn't return an error on these, so we don't either. - if (er.code === 'ENOTASHIM' || er.code === 'EISDIR') { - return cb(null, null) - } else { - return cb(er) - } - }) - } - })) + return gentleFS.rm(target, gentleFSOpts(gently, base), cb) } diff --git a/deps/npm/lib/utils/is-hashbang-file.js b/deps/npm/lib/utils/is-hashbang-file.js deleted file mode 100644 index f1677381fa1..00000000000 --- a/deps/npm/lib/utils/is-hashbang-file.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict' -const Bluebird = require('bluebird') -const fs = require('graceful-fs') -const open = Bluebird.promisify(fs.open) -const close = Bluebird.promisify(fs.close) - -module.exports = isHashbangFile - -function isHashbangFile (file) { - return open(file, 'r').then((fileHandle) => { - return new Bluebird((resolve, reject) => { - fs.read(fileHandle, new Buffer(new Array(2)), 0, 2, 0, function (err, bytesRead, buffer) { - close(fileHandle).then(() => { - resolve(!err && buffer.toString() === '#!') - }).catch(reject) - }) - }) - }) -} diff --git a/deps/npm/lib/utils/is-registry.js b/deps/npm/lib/utils/is-registry.js new file mode 100644 index 00000000000..e5f08e16a0b --- /dev/null +++ b/deps/npm/lib/utils/is-registry.js @@ -0,0 +1,11 @@ +'use strict' +module.exports = isRegistry + +function isRegistry (req) { + if (req == null) return false + // modern metadata + if ('registry' in req) return req.registry + // legacy metadata + if (req.type === 'range' || req.type === 'version' || req.type === 'tag') return true + return false +} diff --git a/deps/npm/lib/utils/link.js b/deps/npm/lib/utils/link.js index 15331740a45..c2642481444 100644 --- a/deps/npm/lib/utils/link.js +++ b/deps/npm/lib/utils/link.js @@ -1,73 +1,8 @@ module.exports = link -link.ifExists = linkIfExists -var fs = require('graceful-fs') -var chain = require('slide').chain -var mkdir = require('mkdirp') -var rm = require('./gently-rm.js') -var path = require('path') -var npm = require('../npm.js') - -function linkIfExists (from, to, gently, cb) { - fs.stat(from, function (er) { - if (er) return cb() - fs.readlink(to, function (er, fromOnDisk) { - // if the link already exists and matches what we would do, - // we don't need to do anything - if (!er) { - var toDir = path.dirname(to) - var absoluteFrom = path.resolve(toDir, from) - var absoluteFromOnDisk = path.resolve(toDir, fromOnDisk) - if (absoluteFrom === absoluteFromOnDisk) return cb() - } - link(from, to, gently, cb) - }) - }) -} - -function resolveIfSymlink (maybeSymlinkPath, cb) { - fs.lstat(maybeSymlinkPath, function (err, stat) { - if (err) return cb.apply(this, arguments) - if (!stat.isSymbolicLink()) return cb(null, maybeSymlinkPath) - fs.readlink(maybeSymlinkPath, cb) - }) -} - -function ensureFromIsNotSource (from, to, cb) { - resolveIfSymlink(from, function (err, fromDestination) { - if (err) return cb.apply(this, arguments) - if (path.resolve(path.dirname(from), fromDestination) === path.resolve(to)) { - return cb(new Error('Link target resolves to the same directory as link source: ' + to)) - } - cb.apply(this, arguments) - }) -} +var gentleFS = require('gentle-fs') +var gentleFSOpts = require('../config/gentle-fs.js') function link (from, to, gently, abs, cb) { - if (typeof cb !== 'function') { - cb = abs - abs = false - } - if (typeof cb !== 'function') { - cb = gently - gently = null - } - if (npm.config.get('force')) gently = false - - to = path.resolve(to) - var toDir = path.dirname(to) - var absTarget = path.resolve(toDir, from) - var relativeTarget = path.relative(toDir, absTarget) - var target = abs ? absTarget : relativeTarget - - chain( - [ - [ensureFromIsNotSource, absTarget, to], - [fs, 'stat', absTarget], - [rm, to, gently, path.dirname(to)], - [mkdir, path.dirname(to)], - [fs, 'symlink', target, to, 'junction'] - ], - cb - ) + return gentleFS.link(from, to, gentleFSOpts(gently, undefined, abs), cb) } diff --git a/deps/npm/lib/view.js b/deps/npm/lib/view.js index 2f06aea624d..e0904048df8 100644 --- a/deps/npm/lib/view.js +++ b/deps/npm/lib/view.js @@ -264,7 +264,7 @@ function printData (data, name, cb) { if (npm.config.get('json')) { msgJson[msgJson.length - 1][f] = d } else { - d = util.inspect(d, false, 5, npm.color) + d = util.inspect(d, { showHidden: false, depth: 5, colors: npm.color, maxArrayLength: null }) } } else if (typeof d === 'string' && npm.config.get('json')) { d = JSON.stringify(d) diff --git a/deps/npm/man/man1/npm-README.1 b/deps/npm/man/man1/npm-README.1 index b3822ede6c2..a878813f91a 100644 --- a/deps/npm/man/man1/npm-README.1 +++ b/deps/npm/man/man1/npm-README.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "October 2017" "" "" +.TH "NPM" "1" "December 2017" "" "" .SH "NAME" \fBnpm\fR \- a JavaScript package manager .P diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index 0501df5268a..124fb542efd 100644 --- a/deps/npm/man/man1/npm-access.1 +++ b/deps/npm/man/man1/npm-access.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ACCESS" "1" "October 2017" "" "" +.TH "NPM\-ACCESS" "1" "December 2017" "" "" .SH "NAME" \fBnpm-access\fR \- Set access level on published packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index b49cd008136..1d0dc7d63f2 100644 --- a/deps/npm/man/man1/npm-adduser.1 +++ b/deps/npm/man/man1/npm-adduser.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ADDUSER" "1" "October 2017" "" "" +.TH "NPM\-ADDUSER" "1" "December 2017" "" "" .SH "NAME" \fBnpm-adduser\fR \- Add a registry user account .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bin.1 b/deps/npm/man/man1/npm-bin.1 index 7f6a47eb60d..a146ed8ce2e 100644 --- a/deps/npm/man/man1/npm-bin.1 +++ b/deps/npm/man/man1/npm-bin.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BIN" "1" "October 2017" "" "" +.TH "NPM\-BIN" "1" "December 2017" "" "" .SH "NAME" \fBnpm-bin\fR \- Display npm bin folder .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index ab89fd618bb..e4a74891780 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUGS" "1" "October 2017" "" "" +.TH "NPM\-BUGS" "1" "December 2017" "" "" .SH "NAME" \fBnpm-bugs\fR \- Bugs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-build.1 b/deps/npm/man/man1/npm-build.1 index fa27f24e90a..6ea78934f15 100644 --- a/deps/npm/man/man1/npm-build.1 +++ b/deps/npm/man/man1/npm-build.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUILD" "1" "October 2017" "" "" +.TH "NPM\-BUILD" "1" "December 2017" "" "" .SH "NAME" \fBnpm-build\fR \- Build a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bundle.1 b/deps/npm/man/man1/npm-bundle.1 index 982a48844d1..6eb57d7c102 100644 --- a/deps/npm/man/man1/npm-bundle.1 +++ b/deps/npm/man/man1/npm-bundle.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUNDLE" "1" "October 2017" "" "" +.TH "NPM\-BUNDLE" "1" "December 2017" "" "" .SH "NAME" \fBnpm-bundle\fR \- REMOVED .SH DESCRIPTION diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1 index 47c7b779cad..133b61730f7 100644 --- a/deps/npm/man/man1/npm-cache.1 +++ b/deps/npm/man/man1/npm-cache.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CACHE" "1" "October 2017" "" "" +.TH "NPM\-CACHE" "1" "December 2017" "" "" .SH "NAME" \fBnpm-cache\fR \- Manipulates packages cache .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index 809c97d6636..131cd3f0d60 100644 --- a/deps/npm/man/man1/npm-completion.1 +++ b/deps/npm/man/man1/npm-completion.1 @@ -1,4 +1,4 @@ -.TH "NPM\-COMPLETION" "1" "October 2017" "" "" +.TH "NPM\-COMPLETION" "1" "December 2017" "" "" .SH "NAME" \fBnpm-completion\fR \- Tab Completion for npm .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1 index 22bd768f94b..c284370d3f0 100644 --- a/deps/npm/man/man1/npm-config.1 +++ b/deps/npm/man/man1/npm-config.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "1" "October 2017" "" "" +.TH "NPM\-CONFIG" "1" "December 2017" "" "" .SH "NAME" \fBnpm-config\fR \- Manage the npm configuration files .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1 index 6f6365224b8..c1ccfc6bf2d 100644 --- a/deps/npm/man/man1/npm-dedupe.1 +++ b/deps/npm/man/man1/npm-dedupe.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEDUPE" "1" "October 2017" "" "" +.TH "NPM\-DEDUPE" "1" "December 2017" "" "" .SH "NAME" \fBnpm-dedupe\fR \- Reduce duplication .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index 32df69bf309..d50b3eb39a8 100644 --- a/deps/npm/man/man1/npm-deprecate.1 +++ b/deps/npm/man/man1/npm-deprecate.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEPRECATE" "1" "October 2017" "" "" +.TH "NPM\-DEPRECATE" "1" "December 2017" "" "" .SH "NAME" \fBnpm-deprecate\fR \- Deprecate a version of a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 index 3e77ec58edf..ba49d77fa83 100644 --- a/deps/npm/man/man1/npm-dist-tag.1 +++ b/deps/npm/man/man1/npm-dist-tag.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DIST\-TAG" "1" "October 2017" "" "" +.TH "NPM\-DIST\-TAG" "1" "December 2017" "" "" .SH "NAME" \fBnpm-dist-tag\fR \- Modify package distribution tags .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index a2cec0fe66f..f913d4ee51e 100644 --- a/deps/npm/man/man1/npm-docs.1 +++ b/deps/npm/man/man1/npm-docs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCS" "1" "October 2017" "" "" +.TH "NPM\-DOCS" "1" "December 2017" "" "" .SH "NAME" \fBnpm-docs\fR \- Docs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-doctor.1 b/deps/npm/man/man1/npm-doctor.1 index 58bc8239bf5..649b81f2e7f 100644 --- a/deps/npm/man/man1/npm-doctor.1 +++ b/deps/npm/man/man1/npm-doctor.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCTOR" "1" "October 2017" "" "" +.TH "NPM\-DOCTOR" "1" "December 2017" "" "" .SH "NAME" \fBnpm-doctor\fR \- Check your environments .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index 51e952d3876..96275a8d9a1 100644 --- a/deps/npm/man/man1/npm-edit.1 +++ b/deps/npm/man/man1/npm-edit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EDIT" "1" "October 2017" "" "" +.TH "NPM\-EDIT" "1" "December 2017" "" "" .SH "NAME" \fBnpm-edit\fR \- Edit an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1 index 5788365fc53..9ed823aeef3 100644 --- a/deps/npm/man/man1/npm-explore.1 +++ b/deps/npm/man/man1/npm-explore.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EXPLORE" "1" "October 2017" "" "" +.TH "NPM\-EXPLORE" "1" "December 2017" "" "" .SH "NAME" \fBnpm-explore\fR \- Browse an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1 index dec9f7811fb..4252dff6987 100644 --- a/deps/npm/man/man1/npm-help-search.1 +++ b/deps/npm/man/man1/npm-help-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP\-SEARCH" "1" "October 2017" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "December 2017" "" "" .SH "NAME" \fBnpm-help-search\fR \- Search npm help documentation .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1 index 1f1efc0241c..dea51fb5dc8 100644 --- a/deps/npm/man/man1/npm-help.1 +++ b/deps/npm/man/man1/npm-help.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP" "1" "October 2017" "" "" +.TH "NPM\-HELP" "1" "December 2017" "" "" .SH "NAME" \fBnpm-help\fR \- Get help on npm .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index 88942c34735..3395281ac75 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INIT" "1" "October 2017" "" "" +.TH "NPM\-INIT" "1" "December 2017" "" "" .SH "NAME" \fBnpm-init\fR \- Interactively create a package\.json file .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1 index d89fc1fbb91..34a306b520b 100644 --- a/deps/npm/man/man1/npm-install-test.1 +++ b/deps/npm/man/man1/npm-install-test.1 @@ -1,4 +1,4 @@ -.TH "NPM" "" "October 2017" "" "" +.TH "NPM" "" "December 2017" "" "" .SH "NAME" \fBnpm\fR .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index 5327cdd9116..bdbc6794c9b 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL" "1" "October 2017" "" "" +.TH "NPM\-INSTALL" "1" "December 2017" "" "" .SH "NAME" \fBnpm-install\fR \- Install a package .SH SYNOPSIS @@ -356,6 +356,9 @@ versions\. The \fB\-\-dry\-run\fP argument will report in the usual way what the install would have done without actually installing anything\. .P +The \fB\-\-package\-lock\-only\fP argument will only update the \fBpackage\-lock\.json\fP, +instead of checking \fBnode_modules\fP and downloading dependencies\. +.P The \fB\-f\fP or \fB\-\-force\fP argument will force npm to fetch remote resources even if a local copy exists on disk\. .P diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index 5776f241ba8..471db86d33e 100644 --- a/deps/npm/man/man1/npm-link.1 +++ b/deps/npm/man/man1/npm-link.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LINK" "1" "October 2017" "" "" +.TH "NPM\-LINK" "1" "December 2017" "" "" .SH "NAME" \fBnpm-link\fR \- Symlink a package folder .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 index d596d4e55e9..fab4c6c1357 100644 --- a/deps/npm/man/man1/npm-logout.1 +++ b/deps/npm/man/man1/npm-logout.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LOGOUT" "1" "October 2017" "" "" +.TH "NPM\-LOGOUT" "1" "December 2017" "" "" .SH "NAME" \fBnpm-logout\fR \- Log out of the registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 1d0ffbd059b..c28056f2d07 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LS" "1" "October 2017" "" "" +.TH "NPM\-LS" "1" "December 2017" "" "" .SH "NAME" \fBnpm-ls\fR \- List installed packages .SH SYNOPSIS @@ -22,7 +22,7 @@ For example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf -npm@5.5.1 /path/to/npm +npm@5.6.0 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1 index 96503516552..e301f08e44b 100644 --- a/deps/npm/man/man1/npm-outdated.1 +++ b/deps/npm/man/man1/npm-outdated.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OUTDATED" "1" "October 2017" "" "" +.TH "NPM\-OUTDATED" "1" "December 2017" "" "" .SH "NAME" \fBnpm-outdated\fR \- Check for outdated packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1 index bc0b952ad2c..8e0617d6e79 100644 --- a/deps/npm/man/man1/npm-owner.1 +++ b/deps/npm/man/man1/npm-owner.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OWNER" "1" "October 2017" "" "" +.TH "NPM\-OWNER" "1" "December 2017" "" "" .SH "NAME" \fBnpm-owner\fR \- Manage package owners .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1 index 0dc0fe8d6ba..633ceac020d 100644 --- a/deps/npm/man/man1/npm-pack.1 +++ b/deps/npm/man/man1/npm-pack.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PACK" "1" "October 2017" "" "" +.TH "NPM\-PACK" "1" "December 2017" "" "" .SH "NAME" \fBnpm-pack\fR \- Create a tarball from a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1 index f541b907e22..3c5a3ed9997 100644 --- a/deps/npm/man/man1/npm-ping.1 +++ b/deps/npm/man/man1/npm-ping.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PING" "1" "October 2017" "" "" +.TH "NPM\-PING" "1" "December 2017" "" "" .SH "NAME" \fBnpm-ping\fR \- Ping npm registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index 78df65f4193..f69b65b9cac 100644 --- a/deps/npm/man/man1/npm-prefix.1 +++ b/deps/npm/man/man1/npm-prefix.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PREFIX" "1" "October 2017" "" "" +.TH "NPM\-PREFIX" "1" "December 2017" "" "" .SH "NAME" \fBnpm-prefix\fR \- Display prefix .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-profile.1 b/deps/npm/man/man1/npm-profile.1 index 1df97a4af6b..37252a530e1 100644 --- a/deps/npm/man/man1/npm-profile.1 +++ b/deps/npm/man/man1/npm-profile.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PROFILE" "1" "October 2017" "" "" +.TH "NPM\-PROFILE" "1" "December 2017" "" "" .SH "NAME" \fBnpm-profile\fR \- Change settings on your registry profile .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index c4e531d38dc..f84d2e41ec7 100644 --- a/deps/npm/man/man1/npm-prune.1 +++ b/deps/npm/man/man1/npm-prune.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PRUNE" "1" "October 2017" "" "" +.TH "NPM\-PRUNE" "1" "December 2017" "" "" .SH "NAME" \fBnpm-prune\fR \- Remove extraneous packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index e4a91f68c5c..2764e9e4c49 100644 --- a/deps/npm/man/man1/npm-publish.1 +++ b/deps/npm/man/man1/npm-publish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PUBLISH" "1" "October 2017" "" "" +.TH "NPM\-PUBLISH" "1" "December 2017" "" "" .SH "NAME" \fBnpm-publish\fR \- Publish a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index f16b8533256..ab2b80391a8 100644 --- a/deps/npm/man/man1/npm-rebuild.1 +++ b/deps/npm/man/man1/npm-rebuild.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REBUILD" "1" "October 2017" "" "" +.TH "NPM\-REBUILD" "1" "December 2017" "" "" .SH "NAME" \fBnpm-rebuild\fR \- Rebuild a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index 37e33975a2c..85b22ead2d0 100644 --- a/deps/npm/man/man1/npm-repo.1 +++ b/deps/npm/man/man1/npm-repo.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REPO" "1" "October 2017" "" "" +.TH "NPM\-REPO" "1" "December 2017" "" "" .SH "NAME" \fBnpm-repo\fR \- Open package repository page in the browser .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index 0c5ffab3edd..b269a5fb75b 100644 --- a/deps/npm/man/man1/npm-restart.1 +++ b/deps/npm/man/man1/npm-restart.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RESTART" "1" "October 2017" "" "" +.TH "NPM\-RESTART" "1" "December 2017" "" "" .SH "NAME" \fBnpm-restart\fR \- Restart a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 index 90a8d751c7e..63901eef3c5 100644 --- a/deps/npm/man/man1/npm-root.1 +++ b/deps/npm/man/man1/npm-root.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ROOT" "1" "October 2017" "" "" +.TH "NPM\-ROOT" "1" "December 2017" "" "" .SH "NAME" \fBnpm-root\fR \- Display npm root .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index 08c746453cd..2cdde2a46cd 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RUN\-SCRIPT" "1" "October 2017" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "December 2017" "" "" .SH "NAME" \fBnpm-run-script\fR \- Run arbitrary package scripts .SH SYNOPSIS @@ -59,6 +59,12 @@ instead of .P to run your tests\. .P +The actual shell your script is run within is platform dependent\. By default, +on Unix\-like systems it is the \fB/bin/sh\fP command, on Windows it is the \fBcmd\.exe\fP\|\. +The actual shell referred to by \fB/bin/sh\fP also depends on the system\. +As of \fBnpm@5\.1\.0\fP \fIhttps://github\.com/npm/npm/releases/tag/v5\.1\.0\fR you can +customize the shell with the \fBscript\-shell\fP configuration\. +.P Scripts are run from the root of the module, regardless of what your current working directory is when you call \fBnpm run\fP\|\. If you want your script to use different behavior based on what subdirectory you're in, you can use the @@ -88,6 +94,8 @@ npm help start npm help restart .IP \(bu 2 npm help stop +.IP \(bu 2 +npm help 7 config .RE diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index 482faf5a55d..f175c8628cb 100644 --- a/deps/npm/man/man1/npm-search.1 +++ b/deps/npm/man/man1/npm-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SEARCH" "1" "October 2017" "" "" +.TH "NPM\-SEARCH" "1" "December 2017" "" "" .SH "NAME" \fBnpm-search\fR \- Search for packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index 656592987e8..00347defa6d 100644 --- a/deps/npm/man/man1/npm-shrinkwrap.1 +++ b/deps/npm/man/man1/npm-shrinkwrap.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP" "1" "October 2017" "" "" +.TH "NPM\-SHRINKWRAP" "1" "December 2017" "" "" .SH "NAME" \fBnpm-shrinkwrap\fR \- Lock down dependency versions for publication .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index 0eef6465192..44e51472051 100644 --- a/deps/npm/man/man1/npm-star.1 +++ b/deps/npm/man/man1/npm-star.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STAR" "1" "October 2017" "" "" +.TH "NPM\-STAR" "1" "December 2017" "" "" .SH "NAME" \fBnpm-star\fR \- Mark your favorite packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1 index af8cad012dd..c5a7de3cc3e 100644 --- a/deps/npm/man/man1/npm-stars.1 +++ b/deps/npm/man/man1/npm-stars.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STARS" "1" "October 2017" "" "" +.TH "NPM\-STARS" "1" "December 2017" "" "" .SH "NAME" \fBnpm-stars\fR \- View packages marked as favorites .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1 index decb160d3a2..57b75de5b8e 100644 --- a/deps/npm/man/man1/npm-start.1 +++ b/deps/npm/man/man1/npm-start.1 @@ -1,4 +1,4 @@ -.TH "NPM\-START" "1" "October 2017" "" "" +.TH "NPM\-START" "1" "December 2017" "" "" .SH "NAME" \fBnpm-start\fR \- Start a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1 index c95dcffeb55..674ed9a530d 100644 --- a/deps/npm/man/man1/npm-stop.1 +++ b/deps/npm/man/man1/npm-stop.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STOP" "1" "October 2017" "" "" +.TH "NPM\-STOP" "1" "December 2017" "" "" .SH "NAME" \fBnpm-stop\fR \- Stop a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-team.1 b/deps/npm/man/man1/npm-team.1 index 2779ef40725..cb75eeeec92 100644 --- a/deps/npm/man/man1/npm-team.1 +++ b/deps/npm/man/man1/npm-team.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEAM" "1" "October 2017" "" "" +.TH "NPM\-TEAM" "1" "December 2017" "" "" .SH "NAME" \fBnpm-team\fR \- Manage organization teams and team memberships .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1 index 3efbe88127a..2b03620434d 100644 --- a/deps/npm/man/man1/npm-test.1 +++ b/deps/npm/man/man1/npm-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEST" "1" "October 2017" "" "" +.TH "NPM\-TEST" "1" "December 2017" "" "" .SH "NAME" \fBnpm-test\fR \- Test a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-token.1 b/deps/npm/man/man1/npm-token.1 index 4a587202c99..8eb645e9fa4 100644 --- a/deps/npm/man/man1/npm-token.1 +++ b/deps/npm/man/man1/npm-token.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TOKEN" "1" "October 2017" "" "" +.TH "NPM\-TOKEN" "1" "December 2017" "" "" .SH "NAME" \fBnpm-token\fR \- Manage your authentication tokens .SH SYNOPSIS @@ -7,12 +7,12 @@ .nf npm token list [\-\-json|\-\-parseable] npm token create [\-\-read\-only] [\-\-cidr=1\.1\.1\.1/24,2\.2\.2\.2/16] -npm token delete <id|token> +npm token revoke <id|token> .fi .RE .SH DESCRIPTION .P -This list you list, create and delete authentication tokens\. +This list you list, create and revoke authentication tokens\. .RS 0 .IP \(bu 2 \fBnpm token list\fP: @@ -64,7 +64,7 @@ two\-factor authentication enabled, an otp\. .RE .RS 0 .IP \(bu 2 -\fBnpm token delete <token|id>\fP: +\fBnpm token revoke <token|id>\fP: This removes an authentication token, making it immediately unusable\. This can accept both complete tokens (as you get back from \fBnpm token create\fP and will find in your \fB\|\.npmrc\fP) and ids as seen in the \fBnpm token list\fP output\. diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1 index 8cd5f3bddae..be83b3f7a8d 100644 --- a/deps/npm/man/man1/npm-uninstall.1 +++ b/deps/npm/man/man1/npm-uninstall.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNINSTALL" "1" "October 2017" "" "" +.TH "NPM\-UNINSTALL" "1" "December 2017" "" "" .SH "NAME" \fBnpm-uninstall\fR \- Remove a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index 41326205ecc..224e04f1bb2 100644 --- a/deps/npm/man/man1/npm-unpublish.1 +++ b/deps/npm/man/man1/npm-unpublish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNPUBLISH" "1" "October 2017" "" "" +.TH "NPM\-UNPUBLISH" "1" "December 2017" "" "" .SH "NAME" \fBnpm-unpublish\fR \- Remove a package from the registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index 125fe133a58..d8ae500df08 100644 --- a/deps/npm/man/man1/npm-update.1 +++ b/deps/npm/man/man1/npm-update.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UPDATE" "1" "October 2017" "" "" +.TH "NPM\-UPDATE" "1" "December 2017" "" "" .SH "NAME" \fBnpm-update\fR \- Update a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index 9454f269e11..9601e4f1883 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VERSION" "1" "October 2017" "" "" +.TH "NPM\-VERSION" "1" "December 2017" "" "" .SH "NAME" \fBnpm-version\fR \- Bump a package version .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index 6b76a4afd2e..2c18268271a 100644 --- a/deps/npm/man/man1/npm-view.1 +++ b/deps/npm/man/man1/npm-view.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VIEW" "1" "October 2017" "" "" +.TH "NPM\-VIEW" "1" "December 2017" "" "" .SH "NAME" \fBnpm-view\fR \- View registry info .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index 6f7646bd843..2f096ac2a0c 100644 --- a/deps/npm/man/man1/npm-whoami.1 +++ b/deps/npm/man/man1/npm-whoami.1 @@ -1,4 +1,4 @@ -.TH "NPM\-WHOAMI" "1" "October 2017" "" "" +.TH "NPM\-WHOAMI" "1" "December 2017" "" "" .SH "NAME" \fBnpm-whoami\fR \- Display npm username .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 39de90d4c24..42eb2962500 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "October 2017" "" "" +.TH "NPM" "1" "December 2017" "" "" .SH "NAME" \fBnpm\fR \- javascript package manager .SH SYNOPSIS @@ -10,7 +10,7 @@ npm <command> [args] .RE .SH VERSION .P -5.5.1 +5.6.0 .SH DESCRIPTION .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man1/npx.1 b/deps/npm/man/man1/npx.1 index aeb74cf012e..912effdc3bd 100644 --- a/deps/npm/man/man1/npx.1 +++ b/deps/npm/man/man1/npx.1 @@ -1,4 +1,4 @@ -.TH "NPX" "1" "August 2017" "npx@9.5.0" "User Commands" +.TH "NPX" "1" "October 2017" "npx@9.7.0" "User Commands" .SH "NAME" \fBnpx\fR \- execute npm package binaries .SH SYNOPSIS diff --git a/deps/npm/man/man5/npm-folders.5 b/deps/npm/man/man5/npm-folders.5 index 909cdac38be..a252685bd0e 100644 --- a/deps/npm/man/man5/npm-folders.5 +++ b/deps/npm/man/man5/npm-folders.5 @@ -1,4 +1,4 @@ -.TH "NPM\-FOLDERS" "5" "October 2017" "" "" +.TH "NPM\-FOLDERS" "5" "December 2017" "" "" .SH "NAME" \fBnpm-folders\fR \- Folder Structures Used by npm .SH DESCRIPTION diff --git a/deps/npm/man/man5/npm-global.5 b/deps/npm/man/man5/npm-global.5 index 909cdac38be..a252685bd0e 100644 --- a/deps/npm/man/man5/npm-global.5 +++ b/deps/npm/man/man5/npm-global.5 @@ -1,4 +1,4 @@ -.TH "NPM\-FOLDERS" "5" "October 2017" "" "" +.TH "NPM\-FOLDERS" "5" "December 2017" "" "" .SH "NAME" \fBnpm-folders\fR \- Folder Structures Used by npm .SH DESCRIPTION diff --git a/deps/npm/man/man5/npm-json.5 b/deps/npm/man/man5/npm-json.5 index 625f7987fe7..0a4328f73fd 100644 --- a/deps/npm/man/man5/npm-json.5 +++ b/deps/npm/man/man5/npm-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "October 2017" "" "" +.TH "PACKAGE\.JSON" "5" "December 2017" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SH DESCRIPTION @@ -455,11 +455,13 @@ shortcut syntax you use for \fBnpm install\fP: .nf "repository": "npm/npm" +"repository": "github:user/repo" + "repository": "gist:11081aaa281" -"repository": "bitbucket:example/repo" +"repository": "bitbucket:user/repo" -"repository": "gitlab:another/repo" +"repository": "gitlab:user/repo" .fi .RE .SH scripts @@ -752,7 +754,7 @@ If we define a package\.json like this: "name": "awesome\-web\-framework", "version": "1\.0\.0", "bundledDependencies": [ - 'renderized', 'super\-streams' + "renderized", "super\-streams" ] } .fi @@ -824,7 +826,7 @@ are capable of properly installing your program\. For example: .RE .P Unless the user has set the \fBengine\-strict\fP config flag, this -field is advisory only will produce warnings when your package is installed as a dependency\. +field is advisory only and will only produce warnings when your package is installed as a dependency\. .SH engineStrict .P \fBThis feature was removed in npm 3\.0\.0\fR diff --git a/deps/npm/man/man5/npm-package-locks.5 b/deps/npm/man/man5/npm-package-locks.5 index 9795226f7a0..241a45d9bb9 100644 --- a/deps/npm/man/man5/npm-package-locks.5 +++ b/deps/npm/man/man5/npm-package-locks.5 @@ -1,4 +1,4 @@ -.TH "NPM\-PACKAGE\-LOCKS" "5" "October 2017" "" "" +.TH "NPM\-PACKAGE\-LOCKS" "5" "December 2017" "" "" .SH "NAME" \fBnpm-package-locks\fR \- An explanation of npm lockfiles .SH DESCRIPTION diff --git a/deps/npm/man/man5/npm-shrinkwrap.json.5 b/deps/npm/man/man5/npm-shrinkwrap.json.5 index 9ef40bfd9ac..a832963dc63 100644 --- a/deps/npm/man/man5/npm-shrinkwrap.json.5 +++ b/deps/npm/man/man5/npm-shrinkwrap.json.5 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP\.JSON" "5" "October 2017" "" "" +.TH "NPM\-SHRINKWRAP\.JSON" "5" "December 2017" "" "" .SH "NAME" \fBnpm-shrinkwrap.json\fR \- A publishable lockfile .SH DESCRIPTION diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5 index ef6ad56f1a8..26d65c2598d 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "October 2017" "" "" +.TH "NPMRC" "5" "December 2017" "" "" .SH "NAME" \fBnpmrc\fR \- The npm config files .SH DESCRIPTION diff --git a/deps/npm/man/man5/package-lock.json.5 b/deps/npm/man/man5/package-lock.json.5 index 6e161e69d43..0196cc87e6f 100644 --- a/deps/npm/man/man5/package-lock.json.5 +++ b/deps/npm/man/man5/package-lock.json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\-LOCK\.JSON" "5" "October 2017" "" "" +.TH "PACKAGE\-LOCK\.JSON" "5" "December 2017" "" "" .SH "NAME" \fBpackage-lock.json\fR \- A manifestation of the manifest .SH DESCRIPTION diff --git a/deps/npm/man/man5/package.json.5 b/deps/npm/man/man5/package.json.5 index 625f7987fe7..0a4328f73fd 100644 --- a/deps/npm/man/man5/package.json.5 +++ b/deps/npm/man/man5/package.json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "October 2017" "" "" +.TH "PACKAGE\.JSON" "5" "December 2017" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SH DESCRIPTION @@ -455,11 +455,13 @@ shortcut syntax you use for \fBnpm install\fP: .nf "repository": "npm/npm" +"repository": "github:user/repo" + "repository": "gist:11081aaa281" -"repository": "bitbucket:example/repo" +"repository": "bitbucket:user/repo" -"repository": "gitlab:another/repo" +"repository": "gitlab:user/repo" .fi .RE .SH scripts @@ -752,7 +754,7 @@ If we define a package\.json like this: "name": "awesome\-web\-framework", "version": "1\.0\.0", "bundledDependencies": [ - 'renderized', 'super\-streams' + "renderized", "super\-streams" ] } .fi @@ -824,7 +826,7 @@ are capable of properly installing your program\. For example: .RE .P Unless the user has set the \fBengine\-strict\fP config flag, this -field is advisory only will produce warnings when your package is installed as a dependency\. +field is advisory only and will only produce warnings when your package is installed as a dependency\. .SH engineStrict .P \fBThis feature was removed in npm 3\.0\.0\fR diff --git a/deps/npm/man/man7/npm-coding-style.7 b/deps/npm/man/man7/npm-coding-style.7 index 8a2a6bbdd32..508198722df 100644 --- a/deps/npm/man/man7/npm-coding-style.7 +++ b/deps/npm/man/man7/npm-coding-style.7 @@ -1,4 +1,4 @@ -.TH "NPM\-CODING\-STYLE" "7" "October 2017" "" "" +.TH "NPM\-CODING\-STYLE" "7" "December 2017" "" "" .SH "NAME" \fBnpm-coding-style\fR \- npm's "funny" coding style .SH DESCRIPTION @@ -210,7 +210,7 @@ When something is intentionally missing or removed, set it to \fBnull\fP\|\. Don't set things to \fBundefined\fP\|\. Reserve that value to mean "not yet set to anything\." .P -Boolean objects are verboten\. +Boolean objects are forbidden\. .SH SEE ALSO .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man7/npm-config.7 b/deps/npm/man/man7/npm-config.7 index 7fc80370ca4..aec6d8014ca 100644 --- a/deps/npm/man/man7/npm-config.7 +++ b/deps/npm/man/man7/npm-config.7 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "7" "October 2017" "" "" +.TH "NPM\-CONFIG" "7" "December 2017" "" "" .SH "NAME" \fBnpm-config\fR \- More than you probably want to know about npm configuration .SH DESCRIPTION @@ -909,6 +909,18 @@ Type: String .RE .P The registry you want to send cli metrics to if \fBsend\-metrics\fP is true\. +.SS node\-options +.RS 0 +.IP \(bu 2 +Default: null +.IP \(bu 2 +Type: String + +.RE +.P +Options to pass through to Node\.js via the \fBNODE_OPTIONS\fP environment +variable\. This does not impact how npm itself is executed but it does +impact how lifecycle scripts are called\. .SS node\-version .RS 0 .IP \(bu 2 @@ -998,6 +1010,17 @@ If set to false, then ignore \fBpackage\-lock\.json\fP files when installing\. T will also prevent \fIwriting\fR \fBpackage\-lock\.json\fP if \fBsave\fP is true\. .P This option is an alias for \fB\-\-shrinkwrap\fP\|\. +.SS package\-lock\-only +.RS 0 +.IP \(bu 2 +Default: false +.IP \(bu 2 +Type: Boolean + +.RE +.P +If set to true, it will update only the \fBpackage\-json\fP, +instead of checking \fBnode_modules\fP and downloading dependencies\. .SS parseable .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man7/npm-developers.7 b/deps/npm/man/man7/npm-developers.7 index 08712ef9a97..d9e483206a4 100644 --- a/deps/npm/man/man7/npm-developers.7 +++ b/deps/npm/man/man7/npm-developers.7 @@ -1,4 +1,4 @@ -.TH "NPM\-DEVELOPERS" "7" "October 2017" "" "" +.TH "NPM\-DEVELOPERS" "7" "December 2017" "" "" .SH "NAME" \fBnpm-developers\fR \- Developer Guide .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-disputes.7 b/deps/npm/man/man7/npm-disputes.7 index 36dfcf57a42..642abcf1783 100644 --- a/deps/npm/man/man7/npm-disputes.7 +++ b/deps/npm/man/man7/npm-disputes.7 @@ -1,4 +1,4 @@ -.TH "NPM\-DISPUTES" "7" "October 2017" "" "" +.TH "NPM\-DISPUTES" "7" "December 2017" "" "" .SH "NAME" \fBnpm-disputes\fR \- Handling Module Name Disputes .P diff --git a/deps/npm/man/man7/npm-index.7 b/deps/npm/man/man7/npm-index.7 index eaa989cba4e..77a70e6cc62 100644 --- a/deps/npm/man/man7/npm-index.7 +++ b/deps/npm/man/man7/npm-index.7 @@ -1,4 +1,4 @@ -.TH "NPM\-INDEX" "7" "October 2017" "" "" +.TH "NPM\-INDEX" "7" "December 2017" "" "" .SH "NAME" \fBnpm-index\fR \- Index of all npm documentation .SS npm help README diff --git a/deps/npm/man/man7/npm-orgs.7 b/deps/npm/man/man7/npm-orgs.7 index 4c0d0420b00..d1c3588ad8e 100644 --- a/deps/npm/man/man7/npm-orgs.7 +++ b/deps/npm/man/man7/npm-orgs.7 @@ -1,4 +1,4 @@ -.TH "NPM\-ORGS" "7" "October 2017" "" "" +.TH "NPM\-ORGS" "7" "December 2017" "" "" .SH "NAME" \fBnpm-orgs\fR \- Working with Teams & Orgs .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-registry.7 b/deps/npm/man/man7/npm-registry.7 index 4831cdb4807..a51170a387b 100644 --- a/deps/npm/man/man7/npm-registry.7 +++ b/deps/npm/man/man7/npm-registry.7 @@ -1,4 +1,4 @@ -.TH "NPM\-REGISTRY" "7" "October 2017" "" "" +.TH "NPM\-REGISTRY" "7" "December 2017" "" "" .SH "NAME" \fBnpm-registry\fR \- The JavaScript Package Registry .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-scope.7 b/deps/npm/man/man7/npm-scope.7 index 0f396cf6873..16e42f4bf0d 100644 --- a/deps/npm/man/man7/npm-scope.7 +++ b/deps/npm/man/man7/npm-scope.7 @@ -1,4 +1,4 @@ -.TH "NPM\-SCOPE" "7" "October 2017" "" "" +.TH "NPM\-SCOPE" "7" "December 2017" "" "" .SH "NAME" \fBnpm-scope\fR \- Scoped packages .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-scripts.7 b/deps/npm/man/man7/npm-scripts.7 index 84181d682d0..bd0383116b7 100644 --- a/deps/npm/man/man7/npm-scripts.7 +++ b/deps/npm/man/man7/npm-scripts.7 @@ -1,4 +1,4 @@ -.TH "NPM\-SCRIPTS" "7" "October 2017" "" "" +.TH "NPM\-SCRIPTS" "7" "December 2017" "" "" .SH "NAME" \fBnpm-scripts\fR \- How npm handles the "scripts" field .SH DESCRIPTION diff --git a/deps/npm/man/man7/removing-npm.7 b/deps/npm/man/man7/removing-npm.7 index e639fd96779..62c5ae42615 100644 --- a/deps/npm/man/man7/removing-npm.7 +++ b/deps/npm/man/man7/removing-npm.7 @@ -1,4 +1,4 @@ -.TH "NPM\-REMOVAL" "1" "October 2017" "" "" +.TH "NPM\-REMOVAL" "1" "December 2017" "" "" .SH "NAME" \fBnpm-removal\fR \- Cleaning the Slate .SH SYNOPSIS diff --git a/deps/npm/man/man7/semver.7 b/deps/npm/man/man7/semver.7 index 58d3b8fc160..23c1e018d53 100644 --- a/deps/npm/man/man7/semver.7 +++ b/deps/npm/man/man7/semver.7 @@ -1,4 +1,4 @@ -.TH "SEMVER" "7" "October 2017" "" "" +.TH "SEMVER" "7" "December 2017" "" "" .SH "NAME" \fBsemver\fR \- The semantic versioner for npm .SH Install diff --git a/deps/npm/node_modules/bin-links/CHANGELOG.md b/deps/npm/node_modules/bin-links/CHANGELOG.md new file mode 100644 index 00000000000..c21734b67dc --- /dev/null +++ b/deps/npm/node_modules/bin-links/CHANGELOG.md @@ -0,0 +1,22 @@ +# 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.1.0"></a> +# [1.1.0](https://github.com/npm/bin-links/compare/v1.0.0...v1.1.0) (2017-11-20) + + +### Features + +* **dos2unix:** Log the fact line endings are being changed upon install. ([e9f8a6f](https://github.com/npm/bin-links/commit/e9f8a6f)) + + + +<a name="1.0.0"></a> +# 1.0.0 (2017-10-07) + + +### Features + +* **import:** initial extraction from npm ([6ed0bfb](https://github.com/npm/bin-links/commit/6ed0bfb)) +* **initial commit:** README ([3fc9cf0](https://github.com/npm/bin-links/commit/3fc9cf0)) diff --git a/deps/npm/node_modules/bin-links/LICENSE b/deps/npm/node_modules/bin-links/LICENSE new file mode 100644 index 00000000000..0b6c2287459 --- /dev/null +++ b/deps/npm/node_modules/bin-links/LICENSE @@ -0,0 +1,235 @@ +The npm application +Copyright (c) npm, Inc. and Contributors +Licensed on the terms of The Artistic License 2.0 + +Node package dependencies of the npm application +Copyright (c) their respective copyright owners +Licensed on their respective license terms + +The npm public registry at https://registry.npmjs.org +and the npm website at https://www.npmjs.com +Operated by npm, Inc. +Use governed by terms published on https://www.npmjs.com + +"Node.js" +Trademark Joyent, Inc., https://joyent.com +Neither npm nor npm, Inc. are affiliated with Joyent, Inc. + +The Node.js application +Project of Node Foundation, https://nodejs.org + +The npm Logo +Copyright (c) Mathias Pettersson and Brian Hammond + +"Gubblebum Blocky" typeface +Copyright (c) Tjarda Koster, https://jelloween.deviantart.com +Used with permission + + +-------- + + +The Artistic License 2.0 + +Copyright (c) 2000-2006, The Perl Foundation. + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +This license establishes the terms under which a given free software +Package may be copied, modified, distributed, and/or redistributed. +The intent is that the Copyright Holder maintains some artistic +control over the development of that Package while still keeping the +Package available as open source and free software. + +You are always permitted to make arrangements wholly outside of this +license directly with the Copyright Holder of a given Package. If the +terms of this license do not permit the full use that you propose to +make of the Package, you should contact the Copyright Holder and seek +a different licensing arrangement. + +Definitions + + "Copyright Holder" means the individual(s) or organization(s) + named in the copyright notice for the entire Package. + + "Contributor" means any party that has contributed code or other + material to the Package, in accordance with the Copyright Holder's + procedures. + + "You" and "your" means any person who would like to copy, + distribute, or modify the Package. + + "Package" means the collection of files distributed by the + Copyright Holder, and derivatives of that collection and/or of + those files. A given Package may consist of either the Standard + Version, or a Modified Version. + + "Distribute" means providing a copy of the Package or making it + accessible to anyone else, or in the case of a company or + organization, to others outside of your company or organization. + + "Distributor Fee" means any fee that you charge for Distributing + this Package or providing support for this Package to another + party. It does not mean licensing fees. + + "Standard Version" refers to the Package if it has not been + modified, or has been modified only in ways explicitly requested + by the Copyright Holder. + + "Modified Version" means the Package, if it has been changed, and + such changes were not explicitly requested by the Copyright + Holder. + + "Original License" means this Artistic License as Distributed with + the Standard Version of the Package, in its current version or as + it may be modified by The Perl Foundation in the future. + + "Source" form means the source code, documentation source, and + configuration files for the Package. + + "Compiled" form means the compiled bytecode, object code, binary, + or any other form resulting from mechanical transformation or + translation of the Source form. + + +Permission for Use and Modification Without Distribution + +(1) You are permitted to use the Standard Version and create and use +Modified Versions for any purpose without restriction, provided that +you do not Distribute the Modified Version. + + +Permissions for Redistribution of the Standard Version + +(2) You may Distribute verbatim copies of the Source form of the +Standard Version of this Package in any medium without restriction, +either gratis or for a Distributor Fee, provided that you duplicate +all of the original copyright notices and associated disclaimers. At +your discretion, such verbatim copies may or may not include a +Compiled form of the Package. + +(3) You may apply any bug fixes, portability changes, and other +modifications made available from the Copyright Holder. The resulting +Package will still be considered the Standard Version, and as such +will be subject to the Original License. + + +Distribution of Modified Versions of the Package as Source + +(4) You may Distribute your Modified Version as Source (either gratis +or for a Distributor Fee, and with or without a Compiled form of the +Modified Version) provided that you clearly document how it differs +from the Standard Version, including, but not limited to, documenting +any non-standard features, executables, or modules, and provided that +you do at least ONE of the following: + + (a) make the Modified Version available to the Copyright Holder + of the Standard Version, under the Original License, so that the + Copyright Holder may include your modifications in the Standard + Version. + + (b) ensure that installation of your Modified Version does not + prevent the user installing or running the Standard Version. In + addition, the Modified Version must bear a name that is different + from the name of the Standard Version. + + (c) allow anyone who receives a copy of the Modified Version to + make the Source form of the Modified Version available to others + under + + (i) the Original License or + + (ii) a license that permits the licensee to freely copy, + modify and redistribute the Modified Version using the same + licensing terms that apply to the copy that the licensee + received, and requires that the Source form of the Modified + Version, and of any works derived from it, be made freely + available in that license fees are prohibited but Distributor + Fees are allowed. + + +Distribution of Compiled Forms of the Standard Version +or Modified Versions without the Source + +(5) You may Distribute Compiled forms of the Standard Version without +the Source, provided that you include complete instructions on how to +get the Source of the Standard Version. Such instructions must be +valid at the time of your distribution. If these instructions, at any +time while you are carrying out such distribution, become invalid, you +must provide new instructions on demand or cease further distribution. +If you provide valid instructions or cease distribution within thirty +days after you become aware that the instructions are invalid, then +you do not forfeit any of your rights under this license. + +(6) You may Distribute a Modified Version in Compiled form without +the Source, provided that you comply with Section 4 with respect to +the Source of the Modified Version. + + +Aggregating or Linking the Package + +(7) You may aggregate the Package (either the Standard Version or +Modified Version) with other packages and Distribute the resulting +aggregation provided that you do not charge a licensing fee for the +Package. Distributor Fees are permitted, and licensing fees for other +components in the aggregation are permitted. The terms of this license +apply to the use and Distribution of the Standard or Modified Versions +as included in the aggregation. + +(8) You are permitted to link Modified and Standard Versions with +other works, to embed the Package in a larger work of your own, or to +build stand-alone binary or bytecode versions of applications that +include the Package, and Distribute the result without restriction, +provided the result does not expose a direct interface to the Package. + + +Items That are Not Considered Part of a Modified Version + +(9) Works (including, but not limited to, modules and scripts) that +merely extend or make use of the Package, do not, by themselves, cause +the Package to be a Modified Version. In addition, such works are not +considered parts of the Package itself, and are not subject to the +terms of this license. + + +General Provisions + +(10) Any use, modification, and distribution of the Standard or +Modified Versions is governed by this Artistic License. By using, +modifying or distributing the Package, you accept this license. Do not +use, modify, or distribute the Package, if you do not accept this +license. + +(11) If your Modified Version has been derived from a Modified +Version made by someone other than you, you are nevertheless required +to ensure that your Modified Version complies with the requirements of +this license. + +(12) This license does not grant you the right to use any trademark, +service mark, tradename, or logo of the Copyright Holder. + +(13) This license includes the non-exclusive, worldwide, +free-of-charge patent license to make, have made, use, offer to sell, +sell, import and otherwise transfer the Package with respect to any +patent claims licensable by the Copyright Holder that are necessarily +infringed by the Package. If you institute patent litigation +(including a cross-claim or counterclaim) against any party alleging +that the Package constitutes direct or contributory patent +infringement, then this Artistic License to you shall terminate on the +date that such litigation is filed. + +(14) Disclaimer of Warranty: +THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS +IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR +NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL +LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +-------- diff --git a/deps/npm/node_modules/bin-links/README.md b/deps/npm/node_modules/bin-links/README.md new file mode 100644 index 00000000000..558d5c74b29 --- /dev/null +++ b/deps/npm/node_modules/bin-links/README.md @@ -0,0 +1,47 @@ +# bin-links [![npm version](https://img.shields.io/npm/v/bin-links.svg)](https://npm.im/bin-links) [![license](https://img.shields.io/npm/l/bin-links.svg)](https://npm.im/bin-links) [![Travis](https://img.shields.io/travis/npm/bin-links.svg)](https://travis-ci.org/npm/bin-links) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/npm/bin-links?svg=true)](https://ci.appveyor.com/project/npm/bin-links) [![Coverage Status](https://coveralls.io/repos/github/npm/bin-links/badge.svg?branch=latest)](https://coveralls.io/github/npm/bin-links?branch=latest) + +[`bin-links`](https://github.com/npm/bin-links) is a standalone library that links +binaries and man pages for Javascript packages + +## Install + +`$ npm install bin-links` + +## Table of Contents + +* [Example](#example) +* [Features](#features) +* [Contributing](#contributing) +* [API](#api) + * [`binLinks`](#binLinks) + +### Example + +```javascript +// todo +``` + +### Features + +* Links bin files listed under the `bin` property of pkg to the node_modules/.bin +directory of the installing environment. +* Links man files listed under the `man` property of pkg to the share/man directory +of the provided optional directory prefix. + +### 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. + +### API + +#### <a name="binLinks"></a> `> binLinks(pkg, folder, global, opts, cb)` + +##### Example + +```javascript +binLinks(pkg, folder, global, opts, cb) +```
\ No newline at end of file diff --git a/deps/npm/node_modules/bin-links/index.js b/deps/npm/node_modules/bin-links/index.js new file mode 100644 index 00000000000..e6370acad54 --- /dev/null +++ b/deps/npm/node_modules/bin-links/index.js @@ -0,0 +1,187 @@ +'use strict' + +const path = require('path') +const fs = require('graceful-fs') +const linkIfExists = require('gentle-fs').linkIfExists +const cmdShimIfExists = require('cmd-shim').ifExists +const asyncMap = require('slide').asyncMap +const BB = require('bluebird') +const open = BB.promisify(fs.open) +const close = BB.promisify(fs.close) +const stat = BB.promisify(fs.stat) +const chmod = BB.promisify(fs.chmod) +const Transform = require('stream').Transform +const fsWriteStreamAtomic = require('fs-write-stream-atomic') + +module.exports = BB.promisify(binLinks) + +function binLinks (pkg, folder, global, opts, cb) { + // if it's global, and folder is in {prefix}/node_modules, + // then bins are in {prefix}/bin + // otherwise, then bins are in folder/../.bin + var parent = pkg.name && pkg.name[0] === '@' ? path.dirname(path.dirname(folder)) : path.dirname(folder) + var gnm = global && opts.globalDir + var gtop = parent === gnm + + opts.log.info('linkStuff', opts.pkgId) + opts.log.silly('linkStuff', opts.pkgId, 'has', parent, 'as its parent node_modules') + if (global) opts.log.silly('linkStuff', opts.pkgId, 'is part of a global install') + if (gnm) opts.log.silly('linkStuff', opts.pkgId, 'is installed into a global node_modules') + if (gtop) opts.log.silly('linkStuff', opts.pkgId, 'is installed into the top-level global node_modules') + + asyncMap( + [linkBins, linkMans], + function (fn, cb) { + if (!fn) return cb() + opts.log.verbose(fn.name, opts.pkgId) + fn(pkg, folder, parent, gtop, opts, cb) + }, + cb + ) +} + +function isHashbangFile (file) { + return open(file, 'r').then((fileHandle) => { + return new BB((resolve, reject) => { + fs.read(fileHandle, Buffer.from(new Array(2)), 0, 2, 0, function (err, bytesRead, buffer) { + close(fileHandle).then(() => { + resolve(!err && buffer.toString() === '#!') + }).catch(reject) + }) + }) + }) +} + +function dos2Unix (file) { + return stat(file).then((stats) => { + let previousChunkEndedInCR = false + return new BB((resolve, reject) => { + fs.createReadStream(file) + .on('error', reject) + .pipe(new Transform({ + transform: function (chunk, encoding, done) { + let data = chunk.toString() + if (previousChunkEndedInCR) { + data = '\r' + data + } + if (data[data.length - 1] === '\r') { + data = data.slice(0, -1) + previousChunkEndedInCR = true + } else { + previousChunkEndedInCR = false + } + done(null, data.replace(/\r\n/g, '\n')) + }, + flush: function (done) { + if (previousChunkEndedInCR) { + this.push('\r') + } + done() + } + })) + .on('error', reject) + .pipe(fsWriteStreamAtomic(file)) + .on('error', reject) + .on('finish', function () { + resolve(chmod(file, stats.mode)) + }) + }) + }) +} + +function getLinkOpts (opts, gently) { + return Object.assign({}, opts, { gently: gently }) +} + +function linkBins (pkg, folder, parent, gtop, opts, cb) { + if (!pkg.bin || (!gtop && path.basename(parent) !== 'node_modules')) { + return cb() + } + var linkOpts = getLinkOpts(opts, gtop && folder) + var execMode = parseInt('0777', 8) & (~opts.umask) + var binRoot = gtop ? opts.globalBin + : path.resolve(parent, '.bin') + opts.log.verbose('linkBins', [pkg.bin, binRoot, gtop]) + + asyncMap(Object.keys(pkg.bin), function (bin, cb) { + var dest = path.resolve(binRoot, bin) + var src = path.resolve(folder, pkg.bin[bin]) + + linkBin(src, dest, linkOpts, function (er) { + if (er) return cb(er) + // bins should always be executable. + // XXX skip chmod on windows? + fs.chmod(src, execMode, function (er) { + if (er && er.code === 'ENOENT' && opts.ignoreScripts) { + return cb() + } + if (er) return cb(er) + isHashbangFile(src).then((isHashbang) => { + if (isHashbang) { + opts.log.silly('linkBins', 'Converting line endings of hashbang file:', src) + return dos2Unix(src) + } + }).then(() => { + if (!gtop) return cb() + var dest = path.resolve(binRoot, bin) + var out = opts.parseable + ? dest + '::' + src + ':BINFILE' + : dest + ' -> ' + src + + if (!opts.json && !opts.parseable) { + opts.log.clearProgress() + console.log(out) + opts.log.showProgress() + } + cb() + }).catch(cb) + }) + }) + }, cb) +} + +function linkBin (from, to, opts, cb) { + if (process.platform !== 'win32') { + return linkIfExists(from, to, opts, cb) + } else { + return cmdShimIfExists(from, to, cb) + } +} + +function linkMans (pkg, folder, parent, gtop, opts, cb) { + if (!pkg.man || !gtop || process.platform === 'win32') return cb() + + var manRoot = path.resolve(opts.prefix, 'share', 'man') + opts.log.verbose('linkMans', 'man files are', pkg.man, 'in', manRoot) + + // make sure that the mans are unique. + // otherwise, if there are dupes, it'll fail with EEXIST + var set = pkg.man.reduce(function (acc, man) { + acc[path.basename(man)] = man + return acc + }, {}) + pkg.man = pkg.man.filter(function (man) { + return set[path.basename(man)] === man + }) + + asyncMap(pkg.man, function (man, cb) { + if (typeof man !== 'string') return cb() + opts.log.silly('linkMans', 'preparing to link', man) + var parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/) + if (!parseMan) { + return cb(new Error( + man + ' is not a valid name for a man file. ' + + 'Man files must end with a number, ' + + 'and optionally a .gz suffix if they are compressed.' + )) + } + + var stem = parseMan[1] + var sxn = parseMan[2] + var bn = path.basename(stem) + var manSrc = path.resolve(folder, man) + var manDest = path.join(manRoot, 'man' + sxn, bn) + + linkIfExists(manSrc, manDest, getLinkOpts(opts, gtop && folder), cb) + }, cb) +} diff --git a/deps/npm/node_modules/bin-links/package.json b/deps/npm/node_modules/bin-links/package.json new file mode 100644 index 00000000000..318e84e5ce9 --- /dev/null +++ b/deps/npm/node_modules/bin-links/package.json @@ -0,0 +1,77 @@ +{ + "_from": "bin-links@latest", + "_id": "bin-links@1.1.0", + "_inBundle": false, + "_integrity": "sha512-3desjIEoSt86s+BRZlkLpBPPcHhr4vyUPL/+X1cQuE96NIlkELqnb4Yq+I5gZe47gHsZztA6cm38uMrT9+FWpA==", + "_location": "/bin-links", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "bin-links@latest", + "name": "bin-links", + "escapedName": "bin-links", + "rawSpec": "latest", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/bin-links/-/bin-links-1.1.0.tgz", + "_shasum": "e0a92cb57f01c4dc1088bca2bae6be110b9f64f9", + "_spec": "bin-links@latest", + "_where": "/Users/rebecca/code/npm", + "author": { + "name": "Mike Sherov" + }, + "bugs": { + "url": "https://github.com/npm/bin-links/issues" + }, + "bundleDependencies": false, + "dependencies": { + "bluebird": "^3.5.0", + "cmd-shim": "^2.0.2", + "fs-write-stream-atomic": "^1.0.10", + "gentle-fs": "^2.0.0", + "graceful-fs": "^4.1.11", + "slide": "^1.1.6" + }, + "deprecated": false, + "description": "JavaScript package binary linker", + "devDependencies": { + "nyc": "^11.1.0", + "standard": "^10.0.3", + "standard-version": "^4.2.0", + "tap": "^10.7.2", + "weallbehave": "^1.2.0", + "weallcontribute": "^1.0.8" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/npm/bin-links#readme", + "keywords": [ + "npm", + "gentle", + "fs" + ], + "license": "Artistic-2.0", + "main": "index.js", + "name": "bin-links", + "repository": { + "type": "git", + "url": "git://github.com/npm/bin-links.git" + }, + "scripts": { + "postrelease": "npm publish && git push --follow-tags", + "prerelease": "npm t", + "pretest": "standard", + "release": "standard-version -s", + "test": "tap -J --nyc-arg=--all --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": "1.1.0" +} diff --git a/deps/npm/node_modules/bluebird/README.md b/deps/npm/node_modules/bluebird/README.md index 538b182ef16..19a63f40ea9 100644 --- a/deps/npm/node_modules/bluebird/README.md +++ b/deps/npm/node_modules/bluebird/README.md @@ -2,8 +2,9 @@ <img src="http://promisesaplus.com/assets/logo-small.png" alt="Promises/A+ logo" title="Promises/A+ 1.1 compliant" align="right" /> </a> + [![Build Status](https://travis-ci.org/petkaantonov/bluebird.svg?branch=master)](https://travis-ci.org/petkaantonov/bluebird) -[![coverage-98%](http://img.shields.io/badge/coverage-98%-brightgreen.svg?style=flat)](http://petkaantonov.github.io/bluebird/coverage/debug/index.html) +[![coverage-98%](https://img.shields.io/badge/coverage-98%25-brightgreen.svg?style=flat)](http://petkaantonov.github.io/bluebird/coverage/debug/index.html) **Got a question?** Join us on [stackoverflow](http://stackoverflow.com/questions/tagged/bluebird), the [mailing list](https://groups.google.com/forum/#!forum/bluebird-js) or chat on [IRC](https://webchat.freenode.net/?channels=#promises) diff --git a/deps/npm/node_modules/bluebird/js/browser/bluebird.core.js b/deps/npm/node_modules/bluebird/js/browser/bluebird.core.js index 3ed2f6a689f..6adcea1d6d0 100644 --- a/deps/npm/node_modules/bluebird/js/browser/bluebird.core.js +++ b/deps/npm/node_modules/bluebird/js/browser/bluebird.core.js @@ -23,7 +23,7 @@ * */ /** - * bluebird build version 3.5.0 + * bluebird build version 3.5.1 * Features enabled: core * Features disabled: race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each */ @@ -559,7 +559,10 @@ Promise.prototype.suppressUnhandledRejections = function() { Promise.prototype._ensurePossibleRejectionHandled = function () { if ((this._bitField & 524288) !== 0) return; this._setRejectionIsUnhandled(); - async.invokeLater(this._notifyUnhandledRejection, this, undefined); + var self = this; + setTimeout(function() { + self._notifyUnhandledRejection(); + }, 1); }; Promise.prototype._notifyUnhandledRejectionIsHandled = function () { @@ -2848,7 +2851,7 @@ _dereq_("./synchronous_inspection")(Promise); _dereq_("./join")( Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); Promise.Promise = Promise; -Promise.version = "3.5.0"; +Promise.version = "3.5.1"; util.toFastProperties(Promise); util.toFastProperties(Promise.prototype); @@ -3618,10 +3621,11 @@ function safeToString(obj) { } function isError(obj) { - return obj !== null && + return obj instanceof Error || + (obj !== null && typeof obj === "object" && typeof obj.message === "string" && - typeof obj.name === "string"; + typeof obj.name === "string"); } function markAsOriginatingFromRejection(e) { diff --git a/deps/npm/node_modules/bluebird/js/browser/bluebird.core.min.js b/deps/npm/node_modules/bluebird/js/browser/bluebird.core.min.js index a556a428d9d..84268e7c4fb 100644 --- a/deps/npm/node_modules/bluebird/js/browser/bluebird.core.min.js +++ b/deps/npm/node_modules/bluebird/js/browser/bluebird.core.min.js @@ -23,9 +23,9 @@ * */ /** - * bluebird build version 3.5.0 + * bluebird build version 3.5.1 * Features enabled: core * Features disabled: race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,n;return function r(t,e,n){function i(a,s){if(!e[a]){if(!t[a]){var c="function"==typeof _dereq_&&_dereq_;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=e[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return i(n?n:e)},u,u.exports,r,t,e,n)}return e[a].exports}for(var o="function"==typeof _dereq_&&_dereq_,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,n){"use strict";function r(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new u(16),this._normalQueue=new u(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=l}function i(t,e,n){this._lateQueue.push(t,e,n),this._queueTick()}function o(t,e,n){this._normalQueue.push(t,e,n),this._queueTick()}function a(t){this._normalQueue._pushOne(t),this._queueTick()}var s;try{throw new Error}catch(c){s=c}var l=t("./schedule"),u=t("./queue"),p=t("./util");r.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},r.prototype.hasCustomScheduler=function(){return this._customScheduler},r.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},r.prototype.disableTrampolineIfNecessary=function(){p.hasDevTools&&(this._trampolineEnabled=!1)},r.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},r.prototype.fatalError=function(t,e){e?(process.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),process.exit(2)):this.throwLater(t)},r.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},p.hasDevTools?(r.prototype.invokeLater=function(t,e,n){this._trampolineEnabled?i.call(this,t,e,n):this._schedule(function(){setTimeout(function(){t.call(e,n)},100)})},r.prototype.invoke=function(t,e,n){this._trampolineEnabled?o.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},r.prototype.settlePromises=function(t){this._trampolineEnabled?a.call(this,t):this._schedule(function(){t._settlePromises()})}):(r.prototype.invokeLater=i,r.prototype.invoke=o,r.prototype.settlePromises=a),r.prototype._drainQueue=function(t){for(;t.length()>0;){var e=t.shift();if("function"==typeof e){var n=t.shift(),r=t.shift();e.call(n,r)}else e._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=r,e.exports.firstLineError=s},{"./queue":17,"./schedule":18,"./util":21}],2:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,o=function(t,e){this._reject(e)},a=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},s=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var l=n(o),u=new t(e);u._propagateFrom(this,1);var p=this._target();if(u._setBoundTo(l),l instanceof t){var f={promiseRejectionQueued:!1,promise:u,target:p,bindingPromise:l};p._then(e,a,void 0,u,f),l._then(s,c,void 0,u,f),u._setOnCancel(l)}else u._resolveCallback(p);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],3:[function(t,e,n){"use strict";function r(){try{Promise===o&&(Promise=i)}catch(t){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=t("./promise")();o.noConflict=r,e.exports=o},{"./promise":15}],4:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var o=t("./util"),a=o.tryCatch,s=o.errorObj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n<t.length;++n)this._doInvokeOnCancel(t[n],e);else if(void 0!==t)if("function"==typeof t){if(!e){var r=a(t).call(this._boundValue());r===s&&(this._attachExtraTrace(r.e),c.throwLater(r.e))}}else t._resultCancelled(this)},e.prototype._invokeOnCancel=function(){var t=this._onCancel();this._unsetOnCancel(),c.invoke(this._doInvokeOnCancel,this,t)},e.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},e.prototype._resultCancelled=function(){this.cancel()}}},{"./util":21}],5:[function(t,e,n){"use strict";e.exports=function(e){function n(t,n,s){return function(c){var l=s._boundValue();t:for(var u=0;u<t.length;++u){var p=t[u];if(p===Error||null!=p&&p.prototype instanceof Error){if(c instanceof p)return o(n).call(l,c)}else if("function"==typeof p){var f=o(p).call(l,c);if(f===a)return f;if(f)return o(n).call(l,c)}else if(r.isObject(c)){for(var h=i(p),_=0;_<h.length;++_){var d=h[_];if(p[d]!=c[d])continue t}return o(n).call(l,c)}}return e}}var r=t("./util"),i=t("./es5").keys,o=r.tryCatch,a=r.errorObj;return n}},{"./es5":10,"./util":21}],6:[function(t,e,n){"use strict";e.exports=function(t){function e(){this._trace=new e.CapturedTrace(r())}function n(){return i?new e:void 0}function r(){var t=o.length-1;return t>=0?o[t]:void 0}var i=!1,o=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=o.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,o=t.prototype._popContext,a=t._peekContext,s=t.prototype._peekContext,c=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=o,t._peekContext=a,t.prototype._peekContext=s,t.prototype._promiseCreated=c,i=!1},i=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],7:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,e){return{promise:e}}function i(){return!1}function o(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+I.toString(t));r._attachCancellationCallback(t)})}catch(i){return i}}function a(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?I.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function s(){return this._onCancelField}function c(t){this._onCancelField=t}function l(){this._cancellationParent=void 0,this._onCancelField=void 0}function u(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function p(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function f(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function h(){this._trace=new x(this._peekContext())}function _(t,e){if(H(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=E(t);I.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),I.notEnumerableProp(t,"__stackCleaned__",!0)}}}function d(t,e,n,r,i){if(void 0===t&&null!==e&&X){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var o="",a="";if(e._trace){for(var s=e._trace.stack.split("\n"),c=C(s),l=c.length-1;l>=0;--l){var u=c[l];if(!V.test(u)){var p=u.match(Q);p&&(o="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(c.length>0)for(var f=c[0],l=0;l<s.length;++l)if(s[l]===f){l>0&&(a="\n"+s[l-1]);break}}var h="a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+a;r._warn(h,!0,e)}}function v(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),y(n)}function y(t,n,r){if(ot.warnings){var i,o=new U(t);if(n)r._attachExtraTrace(o);else if(ot.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var a=E(o);o.stack=a.message+"\n"+a.stack.join("\n")}tt("warning",o)||k(o,"",!0)}}function g(t,e){for(var n=0;n<e.length-1;++n)e[n].push("From previous event:"),e[n]=e[n].join("\n");return n<e.length&&(e[n]=e[n].join("\n")),t+"\n"+e.join("\n")}function m(t){for(var e=0;e<t.length;++e)(0===t[e].length||e+1<t.length&&t[e][0]===t[e+1][0])&&(t.splice(e,1),e--)}function b(t){for(var e=t[0],n=1;n<t.length;++n){for(var r=t[n],i=e.length-1,o=e[i],a=-1,s=r.length-1;s>=0;--s)if(r[s]===o){a=s;break}for(var s=a;s>=0;--s){var c=r[s];if(e[i]!==c)break;e.pop(),i--}e=r}}function C(t){for(var e=[],n=0;n<t.length;++n){var r=t[n],i=" (No stack trace)"===r||q.test(r),o=i&&nt(r);i&&!o&&(M&&" "!==r.charAt(0)&&(r=" "+r),e.push(r))}return e}function w(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n<e.length;++n){var r=e[n];if(" (No stack trace)"===r||q.test(r))break}return n>0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function E(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?w(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:C(e)}}function k(t,e,n){if("undefined"!=typeof console){var r;if(I.isObject(t)){var i=t.stack;r=e+G(i,t)}else r=e+String(t);"function"==typeof L?L(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function j(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(o){B.throwLater(o)}"unhandledRejection"===t?tt(t,n,r)||i||k(n,"Unhandled rejection "):tt(t,r)}function F(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():I.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+T(e)+">, no stack trace)"}function T(t){var e=41;return t.length<e?t:t.substr(0,e-3)+"..."}function P(){return"function"==typeof it}function R(t){var e=t.match(rt);return e?{fileName:e[1],line:parseInt(e[2],10)}:void 0}function S(t,e){if(P()){for(var n,r,i=t.stack.split("\n"),o=e.stack.split("\n"),a=-1,s=-1,c=0;c<i.length;++c){var l=R(i[c]);if(l){n=l.fileName,a=l.line;break}}for(var c=0;c<o.length;++c){var l=R(o[c]);if(l){r=l.fileName,s=l.line;break}}0>a||0>s||!n||!r||n!==r||a>=s||(nt=function(t){if(D.test(t))return!0;var e=R(t);return e&&e.fileName===n&&a<=e.line&&e.line<=s?!0:!1})}}function x(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);it(this,x),e>32&&this.uncycle()}var O,A,L,N=e._getDomain,B=e._async,U=t("./errors").Warning,I=t("./util"),H=I.canAttachTrace,D=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,V=/\((?:timers\.js):\d+:\d+\)/,Q=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,q=null,G=null,M=!1,W=!(0==I.env("BLUEBIRD_DEBUG")||!I.env("BLUEBIRD_DEBUG")&&"development"!==I.env("NODE_ENV")),$=!(0==I.env("BLUEBIRD_WARNINGS")||!W&&!I.env("BLUEBIRD_WARNINGS")),z=!(0==I.env("BLUEBIRD_LONG_STACK_TRACES")||!W&&!I.env("BLUEBIRD_LONG_STACK_TRACES")),X=0!=I.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&($||!!I.env("BLUEBIRD_W_FORGOTTEN_RETURN"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),B.invokeLater(this._notifyUnhandledRejection,this,void 0))},e.prototype._notifyUnhandledRejectionIsHandled=function(){j("rejectionHandled",O,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),j("unhandledRejection",A,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return y(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var e=N();A="function"==typeof t?null===e?t:I.domainBind(e,t):void 0},e.onUnhandledRejectionHandled=function(t){var e=N();O="function"==typeof t?null===e?t:I.domainBind(e,t):void 0};var K=function(){};e.longStackTraces=function(){if(B.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ot.longStackTraces&&P()){var t=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace;ot.longStackTraces=!0,K=function(){if(B.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=r,n.deactivateLongStackTraces(),B.enableTrampoline(),ot.longStackTraces=!1},e.prototype._captureStackTrace=h,e.prototype._attachExtraTrace=_,n.activateLongStackTraces(),B.disableTrampolineIfNecessary()}},e.hasLongStackTraces=function(){return ot.longStackTraces&&P()};var J=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return I.global.dispatchEvent(t),function(t,e){var n=new CustomEvent(t.toLowerCase(),{detail:e,cancelable:!0});return!I.global.dispatchEvent(n)}}if("function"==typeof Event){var t=new Event("CustomEvent");return I.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,!I.global.dispatchEvent(n)}}var t=document.createEvent("CustomEvent");return t.initCustomEvent("testingtheevent",!1,!0,{}),I.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!I.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),Y=function(){return I.isNode?function(){return process.emit.apply(process,arguments)}:I.global?function(t){var e="on"+t.toLowerCase(),n=I.global[e];return n?(n.apply(I.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),Z={promiseCreated:r,promiseFulfilled:r,promiseRejected:r,promiseResolved:r,promiseCancelled:r,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:r},tt=function(t){var e=!1;try{e=Y.apply(null,arguments)}catch(n){B.throwLater(n),e=!0}var r=!1;try{r=J(t,Z[t].apply(null,arguments))}catch(n){B.throwLater(n),r=!0}return r||e};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&K()),"warnings"in t){var n=t.warnings;ot.warnings=!!n,X=ot.warnings,I.isObject(n)&&"wForgottenReturn"in n&&(X=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!ot.cancellation){if(B.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=l,e.prototype._propagateFrom=u,e.prototype._onCancel=s,e.prototype._setOnCancel=c,e.prototype._attachCancellationCallback=a,e.prototype._execute=o,et=u,ot.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!ot.monitoring?(ot.monitoring=!0,e.prototype._fireEvent=tt):!t.monitoring&&ot.monitoring&&(ot.monitoring=!1,e.prototype._fireEvent=i)),e},e.prototype._fireEvent=i,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var et=p,nt=function(){return!1},rt=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;I.inherits(x,Error),n.CapturedTrace=x,x.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;t>r;++r){var a=e[r].stack,s=n[a];if(void 0!==s&&s!==r){s>0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>s?(c._parent=e[s+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var l=c._length+1,u=r-2;u>=0;--u)e[u]._length=l,l++;return}}}},x.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=E(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(C(i.stack.split("\n"))),i=i._parent;b(r),m(r),I.notEnumerableProp(t,"stack",g(n,r)),I.notEnumerableProp(t,"__stackCleaned__",!0)}};var it=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():F(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,q=t,G=e;var n=Error.captureStackTrace;return nt=function(t){return D.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return q=/@/,G=e,M=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(G=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?F(e):e.toString()},null):(q=t,G=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(L=function(t){console.warn(t)},I.isNode&&process.stderr.isTTY?L=function(t,e){var n=e?"[33m":"[31m";console.warn(n+t+"[0m\n")}:I.isNode||"string"!=typeof(new Error).stack||(L=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var ot={warnings:$,longStackTraces:!1,cancellation:!1,monitoring:!1};return z&&e.longStackTraces(),{longStackTraces:function(){return ot.longStackTraces},warnings:function(){return ot.warnings},cancellation:function(){return ot.cancellation},monitoring:function(){return ot.monitoring},propagateFromFunction:function(){return et},boundValueFunction:function(){return f},checkForgottenReturns:d,setBounds:S,warn:y,deprecated:v,CapturedTrace:x,fireDomEvent:J,fireGlobalEvent:Y}}},{"./errors":9,"./util":21}],8:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var i=function(){return r};return this.caught(n,i)}}},{}],9:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(p(this,"message","string"==typeof r?r:e),p(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return u(n,Error),n}function i(t){return this instanceof i?(p(this,"name","OperationalError"),p(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(p(this,"message",t.message),p(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(t)}var o,a,s=t("./es5"),c=s.freeze,l=t("./util"),u=l.inherits,p=l.notEnumerableProp,f=r("Warning","warning"),h=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),d=r("AggregateError","aggregate error");try{o=TypeError,a=RangeError}catch(v){o=r("TypeError","type error"),a=r("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),g=0;g<y.length;++g)"function"==typeof Array.prototype[y[g]]&&(d.prototype[y[g]]=Array.prototype[y[g]]);s.defineProperty(d.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),d.prototype.isOperational=!0;var m=0;d.prototype.toString=function(){var t=Array(4*m+1).join(" "),e="\n"+t+"AggregateError of:\n";m++,t=Array(4*m+1).join(" ");for(var n=0;n<this.length;++n){for(var r=this[n]===this?"[Circular AggregateError]":this[n]+"",i=r.split("\n"),o=0;o<i.length;++o)i[o]=t+i[o];r=i.join("\n"),e+=r+"\n"}return m--,e},u(i,Error);var b=Error.__BluebirdErrorTypes__;b||(b=c({CancellationError:h,TimeoutError:_,OperationalError:i,RejectionError:i,AggregateError:d}),s.defineProperty(Error,"__BluebirdErrorTypes__",{value:b,writable:!1,enumerable:!1,configurable:!1})),e.exports={Error:Error,TypeError:o,RangeError:a,CancellationError:b.CancellationError,OperationalError:b.OperationalError,TimeoutError:b.TimeoutError,AggregateError:b.AggregateError,Warning:f}},{"./es5":10,"./util":21}],10:[function(t,e,n){var r=function(){"use strict";return void 0===this}();if(r)e.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:r,propertyIsWritable:function(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return!(n&&!n.writable&&!n.set)}};else{var i={}.hasOwnProperty,o={}.toString,a={}.constructor.prototype,s=function(t){var e=[];for(var n in t)i.call(t,n)&&e.push(n);return e},c=function(t,e){return{value:t[e]}},l=function(t,e,n){return t[e]=n.value,t},u=function(t){return t},p=function(t){try{return Object(t).constructor.prototype}catch(e){return a}},f=function(t){try{return"[object Array]"===o.call(t)}catch(e){return!1}};e.exports={isArray:f,keys:s,names:s,defineProperty:l,getDescriptor:c,freeze:u,getPrototypeOf:p,isES5:r,propertyIsWritable:function(){return!0}}}},{}],11:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t,e,n){this.promise=t,this.type=e,this.handler=n,this.called=!1,this.cancelPromise=null}function o(t){this.finallyHandler=t}function a(t,e){return null!=t.cancelPromise?(arguments.length>1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function s(){return l.call(this,this.promise._target()._settledValue())}function c(t){return a(this,t)?void 0:(f.e=t,f)}function l(t){var i=this.promise,l=this.handler;if(!this.called){this.called=!0;var u=this.isFinallyHandler()?l.call(i._boundValue()):l.call(i._boundValue(),t);if(u===r)return u;if(void 0!==u){i._setReturnedNonUndefined();var h=n(u,i);if(h instanceof e){if(null!=this.cancelPromise){if(h._isCancelled()){var _=new p("late cancellation observer");return i._attachExtraTrace(_),f.e=_,f}h.isPending()&&h._attachCancellationCallback(new o(this))}return h._then(s,c,void 0,this,void 0)}}}return i.isRejected()?(a(this),f.e=t,f):(a(this),t)}var u=t("./util"),p=e.CancellationError,f=u.errorObj,h=t("./catch_filter")(r);return i.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){a(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new i(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,l,l)},e.prototype.tap=function(t){return this._passThrough(t,1,l)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,l);var r,i=new Array(n-1),o=0;for(r=0;n-1>r;++r){var a=arguments[r];if(!u.isObject(a))return e.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+u.classString(a)));i[o++]=a}i.length=o;var s=arguments[r];return this._passThrough(h(i,s,this),1,void 0,l)},i}},{"./catch_filter":5,"./util":21}],12:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,a){var s=t("./util");s.canEvaluate,s.tryCatch,s.errorObj;e.join=function(){var t,e=arguments.length-1;if(e>0&&"function"==typeof arguments[e]){t=arguments[e];var r}var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":21}],13:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var a=t("./util"),s=a.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("expecting a function but got "+a.classString(t));return function(){var r=new e(n);r._captureStackTrace(),r._pushContext();var i=s(t).apply(this,arguments),a=r._popContext();return o.checkForgottenReturns(i,a,"Promise.method",r),r._resolveFromSyncValue(i),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return i("expecting a function but got "+a.classString(t));var r=new e(n);r._captureStackTrace(),r._pushContext();var c;if(arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];c=a.isArray(l)?s(t).apply(u,l):s(t).call(u,l)}else c=s(t)();var p=r._popContext();return o.checkForgottenReturns(c,p,"Promise.try",r),r._resolveFromSyncValue(c),r},e.prototype._resolveFromSyncValue=function(t){t===a.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":21}],14:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&u.getPrototypeOf(t)===Error.prototype}function i(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=u.keys(t),i=0;i<n.length;++i){var o=n[i];p.test(o)||(e[o]=t[o])}return e}return a.markAsOriginatingFromRejection(t),t}function o(t,e){return function(n,r){if(null!==t){if(n){var o=i(s(n));t._attachExtraTrace(o),t._reject(o)}else if(e){var a=[].slice.call(arguments,1);t._fulfill(a)}else t._fulfill(r);t=null}}}var a=t("./util"),s=a.maybeWrapAsError,c=t("./errors"),l=c.OperationalError,u=t("./es5"),p=/^(?:name|message|stack|cause)$/;e.exports=o},{"./errors":9,"./es5":10,"./util":21}],15:[function(t,e,n){"use strict";e.exports=function(){function n(){}function r(t,e){if(null==t||t.constructor!==i)throw new g("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof e)throw new g("expecting a function but got "+h.classString(e))}function i(t){t!==b&&r(this,t),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(t),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function o(t){this.promise._resolveCallback(t)}function a(t){this.promise._rejectCallback(t,!1)}function s(t){var e=new i(b);e._fulfillmentHandler0=t,e._rejectionHandler0=t,e._promise0=t,e._receiver0=t}var c,l=function(){return new g("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},u=function(){return new i.PromiseInspection(this._target())},p=function(t){return i.reject(new g(t))},f={},h=t("./util");c=h.isNode?function(){var t=process.domain;return void 0===t&&(t=null),t}:function(){return null},h.notEnumerableProp(i,"_getDomain",c);var _=t("./es5"),d=t("./async"),v=new d;_.defineProperty(i,"_async",{value:v});var y=t("./errors"),g=i.TypeError=y.TypeError;i.RangeError=y.RangeError;var m=i.CancellationError=y.CancellationError;i.TimeoutError=y.TimeoutError,i.OperationalError=y.OperationalError,i.RejectionError=y.OperationalError,i.AggregateError=y.AggregateError;var b=function(){},C={},w={},E=t("./thenables")(i,b),k=t("./promise_array")(i,b,E,p,n),j=t("./context")(i),F=(j.create,t("./debuggability")(i,j)),T=(F.CapturedTrace,t("./finally")(i,E,w)),P=t("./catch_filter")(w),R=t("./nodeback"),S=h.errorObj,x=h.tryCatch;return i.prototype.toString=function(){return"[object Promise]"},i.prototype.caught=i.prototype["catch"]=function(t){var e=arguments.length;if(e>1){var n,r=new Array(e-1),i=0;for(n=0;e-1>n;++n){var o=arguments[n];if(!h.isObject(o))return p("Catch statement predicate: expecting an object but got "+h.classString(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,P(r,t,this))}return this.then(void 0,t)},i.prototype.reflect=function(){return this._then(u,u,void 0,this,void 0)},i.prototype.then=function(t,e){if(F.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+h.classString(t);arguments.length>1&&(n+=", "+h.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},i.prototype.spread=function(t){return"function"!=typeof t?p("expecting a function but got "+h.classString(t)):this.all()._then(t,void 0,void 0,C,void 0); -},i.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new k(this).promise()},i.prototype.error=function(t){return this.caught(h.originatesFromRejection,t)},i.getNewLibraryCopy=e.exports,i.is=function(t){return t instanceof i},i.fromNode=i.fromCallback=function(t){var e=new i(b);e._captureStackTrace();var n=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=x(t)(R(e,n));return r===S&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},i.all=function(t){return new k(t).promise()},i.cast=function(t){var e=E(t);return e instanceof i||(e=new i(b),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(b);return e._captureStackTrace(),e._rejectCallback(t,!0),e},i.setScheduler=function(t){if("function"!=typeof t)throw new g("expecting a function but got "+h.classString(t));return v.setScheduler(t)},i.prototype._then=function(t,e,n,r,o){var a=void 0!==o,s=a?o:new i(b),l=this._target(),u=l._bitField;a||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var p=c();if(0!==(50397184&u)){var f,_,d=l._settlePromiseCtx;0!==(33554432&u)?(_=l._rejectionHandler0,f=t):0!==(16777216&u)?(_=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,_=new m("late cancellation observer"),l._attachExtraTrace(_),f=e),v.invoke(d,l,{handler:null===p?f:"function"==typeof f&&h.domainBind(p,f),promise:s,receiver:r,value:_})}else l._addCallbacks(t,e,s,r,p);return s},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},i.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){v.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===f?void 0:void 0===e&&this._isBound()?this._boundValue():e},i.prototype._promiseAt=function(t){return this[4*t-4+2]},i.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},i.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,i=t._receiverAt(0);void 0===i&&(i=f),this._addCallbacks(e,n,r,i,null)},i.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=f),this._addCallbacks(n,r,i,o,null)},i.prototype._addCallbacks=function(t,e,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:h.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:h.domainBind(i,e));else{var a=4*o-4;this[a+2]=n,this[a+3]=r,"function"==typeof t&&(this[a+0]=null===i?t:h.domainBind(i,t)),"function"==typeof e&&(this[a+1]=null===i?e:h.domainBind(i,e))}return this._setLength(o+1),o},i.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},i.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(l(),!1);var n=E(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(l());var o=r._bitField;if(0===(50397184&o)){var a=this._length();a>0&&r._migrateCallback0(this);for(var s=1;a>s;++s)r._migrateCallbackAt(this,s);this._setFollowing(),this._setLength(0),this._setFollowee(r)}else if(0!==(33554432&o))this._fulfill(r._value());else if(0!==(16777216&o))this._reject(r._reason());else{var c=new m("late cancellation observer");r._attachExtraTrace(c),this._reject(c)}}},i.prototype._rejectCallback=function(t,e,n){var r=h.ensureErrorObject(t),i=r===t;if(!i&&!n&&F.warnings()){var o="a promise was rejected with a non-error: "+h.classString(t);this._warn(o,!0)}this._attachExtraTrace(r,e?i:!1),this._reject(t)},i.prototype._resolveFromExecutor=function(t){if(t!==b){var e=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)});n=!1,this._popContext(),void 0!==r&&e._rejectCallback(r,!0)}},i.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0===(65536&i)){r._pushContext();var o;e===C?n&&"number"==typeof n.length?o=x(t).apply(this._boundValue(),n):(o=S,o.e=new g("cannot .spread() a non-array: "+h.classString(n))):o=x(t).call(e,n);var a=r._popContext();i=r._bitField,0===(65536&i)&&(o===w?r._reject(n):o===S?r._rejectCallback(o.e,!1):(F.checkForgottenReturns(o,a,"",r,this),r._resolveCallback(o)))}},i.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},i.prototype._followee=function(){return this._rejectionHandler0},i.prototype._setFollowee=function(t){this._rejectionHandler0=t},i.prototype._settlePromise=function(t,e,r,o){var a=t instanceof i,s=this._bitField,c=0!==(134217728&s);0!==(65536&s)?(a&&t._invokeInternalOnCancel(),r instanceof T&&r.isFinallyHandler()?(r.cancelPromise=t,x(e).call(r,o)===S&&t._reject(S.e)):e===u?t._fulfill(u.call(r)):r instanceof n?r._promiseCancelled(t):a||t instanceof k?t._cancel():r.cancel()):"function"==typeof e?a?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,o,t)):e.call(r,o,t):r instanceof n?r._isResolved()||(0!==(33554432&s)?r._promiseFulfilled(o,t):r._promiseRejected(o,t)):a&&(c&&t._setAsyncGuaranteed(),0!==(33554432&s)?t._fulfill(o):t._reject(o))},i.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,o=t.value;"function"==typeof e?n instanceof i?this._settlePromiseFromHandler(e,r,o,n):e.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},i.prototype._settlePromise0=function(t,e,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,i,e)},i.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},i.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=l();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():v.settlePromises(this))}},i.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?v.fatalError(t,h.isNode):void((65535&e)>0?v.settlePromises(this):this._ensurePossibleRejectionHandled())},i.prototype._fulfillPromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._rejectPromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},i.defer=i.pending=function(){F.deprecated("Promise.defer","new Promise");var t=new i(b);return{promise:t,resolve:o,reject:a}},h.notEnumerableProp(i,"_makeSelfResolutionError",l),t("./method")(i,b,E,p,F),t("./bind")(i,b,E,F),t("./cancel")(i,k,p,F),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,k,E,b,v,c),i.Promise=i,i.version="3.5.0",h.toFastProperties(i),h.toFastProperties(i.prototype),s({a:1}),s({b:2}),s({c:3}),s(1),s(function(){}),s(void 0),s(!1),s(new i(b)),F.setBounds(d.firstLineError,h.lastLineError),i}},{"./async":1,"./bind":2,"./cancel":4,"./catch_filter":5,"./context":6,"./debuggability":7,"./direct_resolve":8,"./errors":9,"./es5":10,"./finally":11,"./join":12,"./method":13,"./nodeback":14,"./promise_array":16,"./synchronous_inspection":19,"./thenables":20,"./util":21}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){function a(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function s(t){var r=this._promise=new e(n);t instanceof e&&r._propagateFrom(t,3),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var c=t("./util");c.isArray;return c.inherits(s,o),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function l(t,n){var o=r(this._values,this._promise);if(o instanceof e){o=o._target();var s=o._bitField;if(this._values=o,0===(50397184&s))return this._promise._setAsyncGuaranteed(),o._then(l,this._reject,void 0,this,n);if(0===(33554432&s))return 0!==(16777216&s)?this._reject(o._reason()):this._cancel();o=o._value()}if(o=c.asArray(o),null===o){var u=i("expecting an array or an iterable object but got "+c.classString(o)).reason();return void this._promise._rejectCallback(u,!1)}return 0===o.length?void(-5===n?this._resolveEmptyArray():this._resolve(a(n))):void this._iterate(o)},s.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,a=null,s=0;n>s;++s){var c=r(t[s],i);c instanceof e?(c=c._target(),a=c._bitField):a=null,o?null!==a&&c.suppressUnhandledRejections():null!==a?0===(50397184&a)?(c._proxy(this,s),this._values[s]=c):o=0!==(33554432&a)?this._promiseFulfilled(c._value(),s):0!==(16777216&a)?this._promiseRejected(c._reason(),s):this._promiseCancelled(s):o=this._promiseFulfilled(c,s)}o||i._setAsyncGuaranteed()},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},s.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n<t.length;++n)t[n]instanceof e&&t[n].cancel()}},s.prototype.shouldCopyValues=function(){return!0},s.prototype.getActualLength=function(t){return t},s}},{"./util":21}],17:[function(t,e,n){"use strict";function r(t,e,n,r,i){for(var o=0;i>o;++o)n[o+r]=t[o+e],t[o+e]=void 0}function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacity<t},i.prototype._pushOne=function(t){var e=this.length();this._checkCapacity(e+1);var n=this._front+e&this._capacity-1;this[n]=t,this._length=e+1},i.prototype.push=function(t,e,n){var r=this.length()+3;if(this._willBeOverCapacity(r))return this._pushOne(t),this._pushOne(e),void this._pushOne(n);var i=this._front+r-3;this._checkCapacity(r);var o=this._capacity-1;this[i+0&o]=t,this[i+1&o]=e,this[i+2&o]=n,this._length=r},i.prototype.shift=function(){var t=this._front,e=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,e},i.prototype.length=function(){return this._length},i.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},i.prototype._resizeTo=function(t){var e=this._capacity;this._capacity=t;var n=this._front,i=this._length,o=n+i&e-1;r(this,0,this,e,o)},e.exports=i},{}],18:[function(t,e,n){"use strict";var r,i=t("./util"),o=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")},a=i.getNativePromise();if(i.isNode&&"undefined"==typeof MutationObserver){var s=global.setImmediate,c=process.nextTick;r=i.isRecentNode?function(t){s.call(global,t)}:function(t){c.call(process,t)}}else if("function"==typeof a&&"function"==typeof a.resolve){var l=a.resolve();r=function(t){l.then(t)}}else r="undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)?"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:o:function(){var t=document.createElement("div"),e={attributes:!0},n=!1,r=document.createElement("div"),i=new MutationObserver(function(){t.classList.toggle("foo"),n=!1});i.observe(r,e);var o=function(){n||(n=!0,r.classList.toggle("foo"))};return function(n){var r=new MutationObserver(function(){r.disconnect(),n()});r.observe(t,e),o()}}();e.exports=r},{"./util":21}],19:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},a=e.prototype.isPending=function(){return 0===(50397184&this._bitField)},s=e.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!==(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536===(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!==(8454144&this._target()._bitField)},t.prototype.isPending=function(){return a.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return s.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],20:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,r){if(u(t)){if(t instanceof e)return t;var i=o(t);if(i===l){r&&r._pushContext();var c=e.reject(i.e);return r&&r._popContext(),c}if("function"==typeof i){if(a(t)){var c=new e(n);return t._then(c._fulfill,c._reject,void 0,c,null),c}return s(t,i,r)}}return t}function i(t){return t.then}function o(t){try{return i(t)}catch(e){return l.e=e,l}}function a(t){try{return p.call(t,"_promise0")}catch(e){return!1}}function s(t,r,i){function o(t){s&&(s._resolveCallback(t),s=null)}function a(t){s&&(s._rejectCallback(t,p,!0),s=null)}var s=new e(n),u=s;i&&i._pushContext(),s._captureStackTrace(),i&&i._popContext();var p=!0,f=c.tryCatch(r).call(t,o,a);return p=!1,s&&f===l&&(s._rejectCallback(f.e,!0,!0),s=null),u}var c=t("./util"),l=c.errorObj,u=c.isObject,p={}.hasOwnProperty;return r}},{"./util":21}],21:[function(t,e,n){"use strict";function r(){try{var t=R;return R=null,t.apply(this,arguments)}catch(e){return P.e=e,P}}function i(t){return R=t,r}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function a(t){return"function"==typeof t||"object"==typeof t&&null!==t}function s(t){return o(t)?new Error(v(t)):t}function c(t,e){var n,r=t.length,i=new Array(r+1);for(n=0;r>n;++n)i[n]=t[n];return i[n]=e,i}function l(t,e,n){if(!F.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function u(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return F.defineProperty(t,e,r),t}function p(t){throw t}function f(t){try{if("function"==typeof t){var e=F.names(t.prototype),n=F.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=A.test(t+"")&&F.names(t).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function h(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t}function _(t){return L.test(t)}function d(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function g(t){try{u(t,"isOperational",!0)}catch(e){}}function m(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function b(t){return y(t)&&F.propertyIsWritable(t,"stack")}function C(t){return{}.toString.call(t)}function w(t,e,n){for(var r=F.names(t),i=0;i<r.length;++i){var o=r[i];if(n(o))try{F.defineProperty(e,o,F.getDescriptor(t,o))}catch(a){}}}function E(t){return H?process.env[t]:void 0}function k(){if("function"==typeof Promise)try{var t=new Promise(function(){});if("[object Promise]"==={}.toString.call(t))return Promise}catch(e){}}function j(t,e){return t.bind(e)}var F=t("./es5"),T="undefined"==typeof navigator,P={e:{}},R,S="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0!==this?this:null,x=function(t,e){function n(){this.constructor=t,this.constructor$=e;for(var n in e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}var r={}.hasOwnProperty;return n.prototype=e.prototype,t.prototype=new n,t.prototype},O=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var n=0;n<t.length;++n)if(t[n]===e)return!0;return!1};if(F.isES5){var n=Object.getOwnPropertyNames;return function(t){for(var r=[],i=Object.create(null);null!=t&&!e(t);){var o;try{o=n(t)}catch(a){return r}for(var s=0;s<o.length;++s){var c=o[s];if(!i[c]){i[c]=!0;var l=Object.getOwnPropertyDescriptor(t,c);null!=l&&null==l.get&&null==l.set&&r.push(c)}}t=F.getPrototypeOf(t)}return r}}var r={}.hasOwnProperty;return function(n){if(e(n))return[];var i=[];t:for(var o in n)if(r.call(n,o))i.push(o);else{for(var a=0;a<t.length;++a)if(r.call(t[a],o))continue t;i.push(o)}return i}}(),A=/this\s*\.\s*\S+\s*=/,L=/^[a-z$_][a-z$_0-9]*$/i,N=function(){return"stack"in new Error?function(t){return b(t)?t:new Error(v(t))}:function(t){if(b(t))return t;try{throw new Error(v(t))}catch(e){return e}}}(),B=function(t){return F.isArray(t)?t:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var U="function"==typeof Array.from?function(t){return Array.from(t)}:function(t){for(var e,n=[],r=t[Symbol.iterator]();!(e=r.next()).done;)n.push(e.value);return n};B=function(t){return F.isArray(t)?t:null!=t&&"function"==typeof t[Symbol.iterator]?U(t):null}}var I="undefined"!=typeof process&&"[object process]"===C(process).toLowerCase(),H="undefined"!=typeof process&&"undefined"!=typeof process.env,D={isClass:f,isIdentifier:_,inheritedDataKeys:O,getDataPropertyOrDefault:l,thrower:p,isArray:F.isArray,asArray:B,notEnumerableProp:u,isPrimitive:o,isObject:a,isError:y,canEvaluate:T,errorObj:P,tryCatch:i,inherits:x,withAppended:c,maybeWrapAsError:s,toFastProperties:h,filledRange:d,toString:v,canAttachTrace:b,ensureErrorObject:N,originatesFromRejection:m,markAsOriginatingFromRejection:g,classString:C,copyDescriptors:w,hasDevTools:"undefined"!=typeof chrome&&chrome&&"function"==typeof chrome.loadTimes,isNode:I,hasEnvVariables:H,env:E,global:S,getNativePromise:k,domainBind:j};D.isRecentNode=D.isNode&&function(){var t=process.versions.node.split(".").map(Number);return 0===t[0]&&t[1]>10||t[0]>0}(),D.isNode&&D.toFastProperties(process);try{throw new Error}catch(V){D.lastLineError=V}e.exports=D},{"./es5":10}]},{},[3])(3)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise);
\ No newline at end of file +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,n;return function r(t,e,n){function i(a,s){if(!e[a]){if(!t[a]){var c="function"==typeof _dereq_&&_dereq_;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=e[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return i(n?n:e)},u,u.exports,r,t,e,n)}return e[a].exports}for(var o="function"==typeof _dereq_&&_dereq_,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,n){"use strict";function r(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new u(16),this._normalQueue=new u(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=l}function i(t,e,n){this._lateQueue.push(t,e,n),this._queueTick()}function o(t,e,n){this._normalQueue.push(t,e,n),this._queueTick()}function a(t){this._normalQueue._pushOne(t),this._queueTick()}var s;try{throw new Error}catch(c){s=c}var l=t("./schedule"),u=t("./queue"),p=t("./util");r.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},r.prototype.hasCustomScheduler=function(){return this._customScheduler},r.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},r.prototype.disableTrampolineIfNecessary=function(){p.hasDevTools&&(this._trampolineEnabled=!1)},r.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},r.prototype.fatalError=function(t,e){e?(process.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),process.exit(2)):this.throwLater(t)},r.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},p.hasDevTools?(r.prototype.invokeLater=function(t,e,n){this._trampolineEnabled?i.call(this,t,e,n):this._schedule(function(){setTimeout(function(){t.call(e,n)},100)})},r.prototype.invoke=function(t,e,n){this._trampolineEnabled?o.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},r.prototype.settlePromises=function(t){this._trampolineEnabled?a.call(this,t):this._schedule(function(){t._settlePromises()})}):(r.prototype.invokeLater=i,r.prototype.invoke=o,r.prototype.settlePromises=a),r.prototype._drainQueue=function(t){for(;t.length()>0;){var e=t.shift();if("function"==typeof e){var n=t.shift(),r=t.shift();e.call(n,r)}else e._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=r,e.exports.firstLineError=s},{"./queue":17,"./schedule":18,"./util":21}],2:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,o=function(t,e){this._reject(e)},a=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},s=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var l=n(o),u=new t(e);u._propagateFrom(this,1);var p=this._target();if(u._setBoundTo(l),l instanceof t){var f={promiseRejectionQueued:!1,promise:u,target:p,bindingPromise:l};p._then(e,a,void 0,u,f),l._then(s,c,void 0,u,f),u._setOnCancel(l)}else u._resolveCallback(p);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],3:[function(t,e,n){"use strict";function r(){try{Promise===o&&(Promise=i)}catch(t){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=t("./promise")();o.noConflict=r,e.exports=o},{"./promise":15}],4:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var o=t("./util"),a=o.tryCatch,s=o.errorObj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n<t.length;++n)this._doInvokeOnCancel(t[n],e);else if(void 0!==t)if("function"==typeof t){if(!e){var r=a(t).call(this._boundValue());r===s&&(this._attachExtraTrace(r.e),c.throwLater(r.e))}}else t._resultCancelled(this)},e.prototype._invokeOnCancel=function(){var t=this._onCancel();this._unsetOnCancel(),c.invoke(this._doInvokeOnCancel,this,t)},e.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},e.prototype._resultCancelled=function(){this.cancel()}}},{"./util":21}],5:[function(t,e,n){"use strict";e.exports=function(e){function n(t,n,s){return function(c){var l=s._boundValue();t:for(var u=0;u<t.length;++u){var p=t[u];if(p===Error||null!=p&&p.prototype instanceof Error){if(c instanceof p)return o(n).call(l,c)}else if("function"==typeof p){var f=o(p).call(l,c);if(f===a)return f;if(f)return o(n).call(l,c)}else if(r.isObject(c)){for(var h=i(p),_=0;_<h.length;++_){var d=h[_];if(p[d]!=c[d])continue t}return o(n).call(l,c)}}return e}}var r=t("./util"),i=t("./es5").keys,o=r.tryCatch,a=r.errorObj;return n}},{"./es5":10,"./util":21}],6:[function(t,e,n){"use strict";e.exports=function(t){function e(){this._trace=new e.CapturedTrace(r())}function n(){return i?new e:void 0}function r(){var t=o.length-1;return t>=0?o[t]:void 0}var i=!1,o=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=o.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,o=t.prototype._popContext,a=t._peekContext,s=t.prototype._peekContext,c=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=o,t._peekContext=a,t.prototype._peekContext=s,t.prototype._promiseCreated=c,i=!1},i=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],7:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,e){return{promise:e}}function i(){return!1}function o(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+I.toString(t));r._attachCancellationCallback(t)})}catch(i){return i}}function a(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?I.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function s(){return this._onCancelField}function c(t){this._onCancelField=t}function l(){this._cancellationParent=void 0,this._onCancelField=void 0}function u(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function p(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function f(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function h(){this._trace=new x(this._peekContext())}function _(t,e){if(H(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=E(t);I.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),I.notEnumerableProp(t,"__stackCleaned__",!0)}}}function d(t,e,n,r,i){if(void 0===t&&null!==e&&X){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var o="",a="";if(e._trace){for(var s=e._trace.stack.split("\n"),c=C(s),l=c.length-1;l>=0;--l){var u=c[l];if(!V.test(u)){var p=u.match(Q);p&&(o="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(c.length>0)for(var f=c[0],l=0;l<s.length;++l)if(s[l]===f){l>0&&(a="\n"+s[l-1]);break}}var h="a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+a;r._warn(h,!0,e)}}function v(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),y(n)}function y(t,n,r){if(ot.warnings){var i,o=new U(t);if(n)r._attachExtraTrace(o);else if(ot.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var a=E(o);o.stack=a.message+"\n"+a.stack.join("\n")}tt("warning",o)||k(o,"",!0)}}function g(t,e){for(var n=0;n<e.length-1;++n)e[n].push("From previous event:"),e[n]=e[n].join("\n");return n<e.length&&(e[n]=e[n].join("\n")),t+"\n"+e.join("\n")}function m(t){for(var e=0;e<t.length;++e)(0===t[e].length||e+1<t.length&&t[e][0]===t[e+1][0])&&(t.splice(e,1),e--)}function b(t){for(var e=t[0],n=1;n<t.length;++n){for(var r=t[n],i=e.length-1,o=e[i],a=-1,s=r.length-1;s>=0;--s)if(r[s]===o){a=s;break}for(var s=a;s>=0;--s){var c=r[s];if(e[i]!==c)break;e.pop(),i--}e=r}}function C(t){for(var e=[],n=0;n<t.length;++n){var r=t[n],i=" (No stack trace)"===r||q.test(r),o=i&&nt(r);i&&!o&&(M&&" "!==r.charAt(0)&&(r=" "+r),e.push(r))}return e}function w(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n<e.length;++n){var r=e[n];if(" (No stack trace)"===r||q.test(r))break}return n>0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function E(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?w(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:C(e)}}function k(t,e,n){if("undefined"!=typeof console){var r;if(I.isObject(t)){var i=t.stack;r=e+G(i,t)}else r=e+String(t);"function"==typeof N?N(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function j(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(o){B.throwLater(o)}"unhandledRejection"===t?tt(t,n,r)||i||k(n,"Unhandled rejection "):tt(t,r)}function F(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():I.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+T(e)+">, no stack trace)"}function T(t){var e=41;return t.length<e?t:t.substr(0,e-3)+"..."}function P(){return"function"==typeof it}function R(t){var e=t.match(rt);return e?{fileName:e[1],line:parseInt(e[2],10)}:void 0}function S(t,e){if(P()){for(var n,r,i=t.stack.split("\n"),o=e.stack.split("\n"),a=-1,s=-1,c=0;c<i.length;++c){var l=R(i[c]);if(l){n=l.fileName,a=l.line;break}}for(var c=0;c<o.length;++c){var l=R(o[c]);if(l){r=l.fileName,s=l.line;break}}0>a||0>s||!n||!r||n!==r||a>=s||(nt=function(t){if(D.test(t))return!0;var e=R(t);return e&&e.fileName===n&&a<=e.line&&e.line<=s?!0:!1})}}function x(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);it(this,x),e>32&&this.uncycle()}var O,A,N,L=e._getDomain,B=e._async,U=t("./errors").Warning,I=t("./util"),H=I.canAttachTrace,D=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,V=/\((?:timers\.js):\d+:\d+\)/,Q=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,q=null,G=null,M=!1,W=!(0==I.env("BLUEBIRD_DEBUG")||!I.env("BLUEBIRD_DEBUG")&&"development"!==I.env("NODE_ENV")),$=!(0==I.env("BLUEBIRD_WARNINGS")||!W&&!I.env("BLUEBIRD_WARNINGS")),z=!(0==I.env("BLUEBIRD_LONG_STACK_TRACES")||!W&&!I.env("BLUEBIRD_LONG_STACK_TRACES")),X=0!=I.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&($||!!I.env("BLUEBIRD_W_FORGOTTEN_RETURN"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){if(0===(524288&this._bitField)){this._setRejectionIsUnhandled();var t=this;setTimeout(function(){t._notifyUnhandledRejection()},1)}},e.prototype._notifyUnhandledRejectionIsHandled=function(){j("rejectionHandled",O,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),j("unhandledRejection",A,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return y(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var e=L();A="function"==typeof t?null===e?t:I.domainBind(e,t):void 0},e.onUnhandledRejectionHandled=function(t){var e=L();O="function"==typeof t?null===e?t:I.domainBind(e,t):void 0};var K=function(){};e.longStackTraces=function(){if(B.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ot.longStackTraces&&P()){var t=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace;ot.longStackTraces=!0,K=function(){if(B.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=r,n.deactivateLongStackTraces(),B.enableTrampoline(),ot.longStackTraces=!1},e.prototype._captureStackTrace=h,e.prototype._attachExtraTrace=_,n.activateLongStackTraces(),B.disableTrampolineIfNecessary()}},e.hasLongStackTraces=function(){return ot.longStackTraces&&P()};var J=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return I.global.dispatchEvent(t),function(t,e){var n=new CustomEvent(t.toLowerCase(),{detail:e,cancelable:!0});return!I.global.dispatchEvent(n)}}if("function"==typeof Event){var t=new Event("CustomEvent");return I.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,!I.global.dispatchEvent(n)}}var t=document.createEvent("CustomEvent");return t.initCustomEvent("testingtheevent",!1,!0,{}),I.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!I.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),Y=function(){return I.isNode?function(){return process.emit.apply(process,arguments)}:I.global?function(t){var e="on"+t.toLowerCase(),n=I.global[e];return n?(n.apply(I.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),Z={promiseCreated:r,promiseFulfilled:r,promiseRejected:r,promiseResolved:r,promiseCancelled:r,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:r},tt=function(t){var e=!1;try{e=Y.apply(null,arguments)}catch(n){B.throwLater(n),e=!0}var r=!1;try{r=J(t,Z[t].apply(null,arguments))}catch(n){B.throwLater(n),r=!0}return r||e};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&K()),"warnings"in t){var n=t.warnings;ot.warnings=!!n,X=ot.warnings,I.isObject(n)&&"wForgottenReturn"in n&&(X=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!ot.cancellation){if(B.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=l,e.prototype._propagateFrom=u,e.prototype._onCancel=s,e.prototype._setOnCancel=c,e.prototype._attachCancellationCallback=a,e.prototype._execute=o,et=u,ot.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!ot.monitoring?(ot.monitoring=!0,e.prototype._fireEvent=tt):!t.monitoring&&ot.monitoring&&(ot.monitoring=!1,e.prototype._fireEvent=i)),e},e.prototype._fireEvent=i,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var et=p,nt=function(){return!1},rt=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;I.inherits(x,Error),n.CapturedTrace=x,x.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;t>r;++r){var a=e[r].stack,s=n[a];if(void 0!==s&&s!==r){s>0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>s?(c._parent=e[s+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var l=c._length+1,u=r-2;u>=0;--u)e[u]._length=l,l++;return}}}},x.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=E(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(C(i.stack.split("\n"))),i=i._parent;b(r),m(r),I.notEnumerableProp(t,"stack",g(n,r)),I.notEnumerableProp(t,"__stackCleaned__",!0)}};var it=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():F(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,q=t,G=e;var n=Error.captureStackTrace;return nt=function(t){return D.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return q=/@/,G=e,M=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(G=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?F(e):e.toString()},null):(q=t,G=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(N=function(t){console.warn(t)},I.isNode&&process.stderr.isTTY?N=function(t,e){var n=e?"[33m":"[31m";console.warn(n+t+"[0m\n")}:I.isNode||"string"!=typeof(new Error).stack||(N=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var ot={warnings:$,longStackTraces:!1,cancellation:!1,monitoring:!1};return z&&e.longStackTraces(),{longStackTraces:function(){return ot.longStackTraces},warnings:function(){return ot.warnings},cancellation:function(){return ot.cancellation},monitoring:function(){return ot.monitoring},propagateFromFunction:function(){return et},boundValueFunction:function(){return f},checkForgottenReturns:d,setBounds:S,warn:y,deprecated:v,CapturedTrace:x,fireDomEvent:J,fireGlobalEvent:Y}}},{"./errors":9,"./util":21}],8:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var i=function(){return r};return this.caught(n,i)}}},{}],9:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(p(this,"message","string"==typeof r?r:e),p(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return u(n,Error),n}function i(t){return this instanceof i?(p(this,"name","OperationalError"),p(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(p(this,"message",t.message),p(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(t)}var o,a,s=t("./es5"),c=s.freeze,l=t("./util"),u=l.inherits,p=l.notEnumerableProp,f=r("Warning","warning"),h=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),d=r("AggregateError","aggregate error");try{o=TypeError,a=RangeError}catch(v){o=r("TypeError","type error"),a=r("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),g=0;g<y.length;++g)"function"==typeof Array.prototype[y[g]]&&(d.prototype[y[g]]=Array.prototype[y[g]]);s.defineProperty(d.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),d.prototype.isOperational=!0;var m=0;d.prototype.toString=function(){var t=Array(4*m+1).join(" "),e="\n"+t+"AggregateError of:\n";m++,t=Array(4*m+1).join(" ");for(var n=0;n<this.length;++n){for(var r=this[n]===this?"[Circular AggregateError]":this[n]+"",i=r.split("\n"),o=0;o<i.length;++o)i[o]=t+i[o];r=i.join("\n"),e+=r+"\n"}return m--,e},u(i,Error);var b=Error.__BluebirdErrorTypes__;b||(b=c({CancellationError:h,TimeoutError:_,OperationalError:i,RejectionError:i,AggregateError:d}),s.defineProperty(Error,"__BluebirdErrorTypes__",{value:b,writable:!1,enumerable:!1,configurable:!1})),e.exports={Error:Error,TypeError:o,RangeError:a,CancellationError:b.CancellationError,OperationalError:b.OperationalError,TimeoutError:b.TimeoutError,AggregateError:b.AggregateError,Warning:f}},{"./es5":10,"./util":21}],10:[function(t,e,n){var r=function(){"use strict";return void 0===this}();if(r)e.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:r,propertyIsWritable:function(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return!(n&&!n.writable&&!n.set)}};else{var i={}.hasOwnProperty,o={}.toString,a={}.constructor.prototype,s=function(t){var e=[];for(var n in t)i.call(t,n)&&e.push(n);return e},c=function(t,e){return{value:t[e]}},l=function(t,e,n){return t[e]=n.value,t},u=function(t){return t},p=function(t){try{return Object(t).constructor.prototype}catch(e){return a}},f=function(t){try{return"[object Array]"===o.call(t)}catch(e){return!1}};e.exports={isArray:f,keys:s,names:s,defineProperty:l,getDescriptor:c,freeze:u,getPrototypeOf:p,isES5:r,propertyIsWritable:function(){return!0}}}},{}],11:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t,e,n){this.promise=t,this.type=e,this.handler=n,this.called=!1,this.cancelPromise=null}function o(t){this.finallyHandler=t}function a(t,e){return null!=t.cancelPromise?(arguments.length>1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function s(){return l.call(this,this.promise._target()._settledValue())}function c(t){return a(this,t)?void 0:(f.e=t,f)}function l(t){var i=this.promise,l=this.handler;if(!this.called){this.called=!0;var u=this.isFinallyHandler()?l.call(i._boundValue()):l.call(i._boundValue(),t);if(u===r)return u;if(void 0!==u){i._setReturnedNonUndefined();var h=n(u,i);if(h instanceof e){if(null!=this.cancelPromise){if(h._isCancelled()){var _=new p("late cancellation observer");return i._attachExtraTrace(_),f.e=_,f}h.isPending()&&h._attachCancellationCallback(new o(this))}return h._then(s,c,void 0,this,void 0)}}}return i.isRejected()?(a(this),f.e=t,f):(a(this),t)}var u=t("./util"),p=e.CancellationError,f=u.errorObj,h=t("./catch_filter")(r);return i.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){a(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new i(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,l,l)},e.prototype.tap=function(t){return this._passThrough(t,1,l)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,l);var r,i=new Array(n-1),o=0;for(r=0;n-1>r;++r){var a=arguments[r];if(!u.isObject(a))return e.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+u.classString(a)));i[o++]=a}i.length=o;var s=arguments[r];return this._passThrough(h(i,s,this),1,void 0,l)},i}},{"./catch_filter":5,"./util":21}],12:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,a){var s=t("./util");s.canEvaluate,s.tryCatch,s.errorObj;e.join=function(){var t,e=arguments.length-1;if(e>0&&"function"==typeof arguments[e]){t=arguments[e];var r}var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":21}],13:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var a=t("./util"),s=a.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("expecting a function but got "+a.classString(t));return function(){var r=new e(n);r._captureStackTrace(),r._pushContext();var i=s(t).apply(this,arguments),a=r._popContext();return o.checkForgottenReturns(i,a,"Promise.method",r),r._resolveFromSyncValue(i),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return i("expecting a function but got "+a.classString(t));var r=new e(n);r._captureStackTrace(),r._pushContext();var c;if(arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];c=a.isArray(l)?s(t).apply(u,l):s(t).call(u,l)}else c=s(t)();var p=r._popContext();return o.checkForgottenReturns(c,p,"Promise.try",r),r._resolveFromSyncValue(c),r},e.prototype._resolveFromSyncValue=function(t){t===a.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":21}],14:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&u.getPrototypeOf(t)===Error.prototype}function i(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=u.keys(t),i=0;i<n.length;++i){var o=n[i];p.test(o)||(e[o]=t[o])}return e}return a.markAsOriginatingFromRejection(t),t}function o(t,e){return function(n,r){if(null!==t){if(n){var o=i(s(n));t._attachExtraTrace(o),t._reject(o)}else if(e){var a=[].slice.call(arguments,1);t._fulfill(a)}else t._fulfill(r);t=null}}}var a=t("./util"),s=a.maybeWrapAsError,c=t("./errors"),l=c.OperationalError,u=t("./es5"),p=/^(?:name|message|stack|cause)$/;e.exports=o},{"./errors":9,"./es5":10,"./util":21}],15:[function(t,e,n){"use strict";e.exports=function(){function n(){}function r(t,e){if(null==t||t.constructor!==i)throw new g("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof e)throw new g("expecting a function but got "+h.classString(e))}function i(t){t!==b&&r(this,t),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(t),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function o(t){this.promise._resolveCallback(t)}function a(t){this.promise._rejectCallback(t,!1)}function s(t){var e=new i(b);e._fulfillmentHandler0=t,e._rejectionHandler0=t,e._promise0=t,e._receiver0=t}var c,l=function(){return new g("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},u=function(){return new i.PromiseInspection(this._target())},p=function(t){return i.reject(new g(t))},f={},h=t("./util");c=h.isNode?function(){var t=process.domain;return void 0===t&&(t=null),t}:function(){return null},h.notEnumerableProp(i,"_getDomain",c);var _=t("./es5"),d=t("./async"),v=new d;_.defineProperty(i,"_async",{value:v});var y=t("./errors"),g=i.TypeError=y.TypeError;i.RangeError=y.RangeError;var m=i.CancellationError=y.CancellationError;i.TimeoutError=y.TimeoutError,i.OperationalError=y.OperationalError,i.RejectionError=y.OperationalError,i.AggregateError=y.AggregateError;var b=function(){},C={},w={},E=t("./thenables")(i,b),k=t("./promise_array")(i,b,E,p,n),j=t("./context")(i),F=(j.create,t("./debuggability")(i,j)),T=(F.CapturedTrace,t("./finally")(i,E,w)),P=t("./catch_filter")(w),R=t("./nodeback"),S=h.errorObj,x=h.tryCatch;return i.prototype.toString=function(){return"[object Promise]"},i.prototype.caught=i.prototype["catch"]=function(t){var e=arguments.length;if(e>1){var n,r=new Array(e-1),i=0;for(n=0;e-1>n;++n){var o=arguments[n];if(!h.isObject(o))return p("Catch statement predicate: expecting an object but got "+h.classString(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,P(r,t,this))}return this.then(void 0,t)},i.prototype.reflect=function(){return this._then(u,u,void 0,this,void 0)},i.prototype.then=function(t,e){if(F.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+h.classString(t);arguments.length>1&&(n+=", "+h.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},i.prototype.spread=function(t){return"function"!=typeof t?p("expecting a function but got "+h.classString(t)):this.all()._then(t,void 0,void 0,C,void 0); +},i.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new k(this).promise()},i.prototype.error=function(t){return this.caught(h.originatesFromRejection,t)},i.getNewLibraryCopy=e.exports,i.is=function(t){return t instanceof i},i.fromNode=i.fromCallback=function(t){var e=new i(b);e._captureStackTrace();var n=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=x(t)(R(e,n));return r===S&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},i.all=function(t){return new k(t).promise()},i.cast=function(t){var e=E(t);return e instanceof i||(e=new i(b),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(b);return e._captureStackTrace(),e._rejectCallback(t,!0),e},i.setScheduler=function(t){if("function"!=typeof t)throw new g("expecting a function but got "+h.classString(t));return v.setScheduler(t)},i.prototype._then=function(t,e,n,r,o){var a=void 0!==o,s=a?o:new i(b),l=this._target(),u=l._bitField;a||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var p=c();if(0!==(50397184&u)){var f,_,d=l._settlePromiseCtx;0!==(33554432&u)?(_=l._rejectionHandler0,f=t):0!==(16777216&u)?(_=l._fulfillmentHandler0,f=e,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,_=new m("late cancellation observer"),l._attachExtraTrace(_),f=e),v.invoke(d,l,{handler:null===p?f:"function"==typeof f&&h.domainBind(p,f),promise:s,receiver:r,value:_})}else l._addCallbacks(t,e,s,r,p);return s},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},i.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){v.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===f?void 0:void 0===e&&this._isBound()?this._boundValue():e},i.prototype._promiseAt=function(t){return this[4*t-4+2]},i.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},i.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,i=t._receiverAt(0);void 0===i&&(i=f),this._addCallbacks(e,n,r,i,null)},i.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=f),this._addCallbacks(n,r,i,o,null)},i.prototype._addCallbacks=function(t,e,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:h.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:h.domainBind(i,e));else{var a=4*o-4;this[a+2]=n,this[a+3]=r,"function"==typeof t&&(this[a+0]=null===i?t:h.domainBind(i,t)),"function"==typeof e&&(this[a+1]=null===i?e:h.domainBind(i,e))}return this._setLength(o+1),o},i.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},i.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(l(),!1);var n=E(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(l());var o=r._bitField;if(0===(50397184&o)){var a=this._length();a>0&&r._migrateCallback0(this);for(var s=1;a>s;++s)r._migrateCallbackAt(this,s);this._setFollowing(),this._setLength(0),this._setFollowee(r)}else if(0!==(33554432&o))this._fulfill(r._value());else if(0!==(16777216&o))this._reject(r._reason());else{var c=new m("late cancellation observer");r._attachExtraTrace(c),this._reject(c)}}},i.prototype._rejectCallback=function(t,e,n){var r=h.ensureErrorObject(t),i=r===t;if(!i&&!n&&F.warnings()){var o="a promise was rejected with a non-error: "+h.classString(t);this._warn(o,!0)}this._attachExtraTrace(r,e?i:!1),this._reject(t)},i.prototype._resolveFromExecutor=function(t){if(t!==b){var e=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)});n=!1,this._popContext(),void 0!==r&&e._rejectCallback(r,!0)}},i.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0===(65536&i)){r._pushContext();var o;e===C?n&&"number"==typeof n.length?o=x(t).apply(this._boundValue(),n):(o=S,o.e=new g("cannot .spread() a non-array: "+h.classString(n))):o=x(t).call(e,n);var a=r._popContext();i=r._bitField,0===(65536&i)&&(o===w?r._reject(n):o===S?r._rejectCallback(o.e,!1):(F.checkForgottenReturns(o,a,"",r,this),r._resolveCallback(o)))}},i.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},i.prototype._followee=function(){return this._rejectionHandler0},i.prototype._setFollowee=function(t){this._rejectionHandler0=t},i.prototype._settlePromise=function(t,e,r,o){var a=t instanceof i,s=this._bitField,c=0!==(134217728&s);0!==(65536&s)?(a&&t._invokeInternalOnCancel(),r instanceof T&&r.isFinallyHandler()?(r.cancelPromise=t,x(e).call(r,o)===S&&t._reject(S.e)):e===u?t._fulfill(u.call(r)):r instanceof n?r._promiseCancelled(t):a||t instanceof k?t._cancel():r.cancel()):"function"==typeof e?a?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,o,t)):e.call(r,o,t):r instanceof n?r._isResolved()||(0!==(33554432&s)?r._promiseFulfilled(o,t):r._promiseRejected(o,t)):a&&(c&&t._setAsyncGuaranteed(),0!==(33554432&s)?t._fulfill(o):t._reject(o))},i.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,o=t.value;"function"==typeof e?n instanceof i?this._settlePromiseFromHandler(e,r,o,n):e.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},i.prototype._settlePromise0=function(t,e,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,i,e)},i.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},i.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=l();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():v.settlePromises(this))}},i.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?v.fatalError(t,h.isNode):void((65535&e)>0?v.settlePromises(this):this._ensurePossibleRejectionHandled())},i.prototype._fulfillPromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._rejectPromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},i.defer=i.pending=function(){F.deprecated("Promise.defer","new Promise");var t=new i(b);return{promise:t,resolve:o,reject:a}},h.notEnumerableProp(i,"_makeSelfResolutionError",l),t("./method")(i,b,E,p,F),t("./bind")(i,b,E,F),t("./cancel")(i,k,p,F),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,k,E,b,v,c),i.Promise=i,i.version="3.5.1",h.toFastProperties(i),h.toFastProperties(i.prototype),s({a:1}),s({b:2}),s({c:3}),s(1),s(function(){}),s(void 0),s(!1),s(new i(b)),F.setBounds(d.firstLineError,h.lastLineError),i}},{"./async":1,"./bind":2,"./cancel":4,"./catch_filter":5,"./context":6,"./debuggability":7,"./direct_resolve":8,"./errors":9,"./es5":10,"./finally":11,"./join":12,"./method":13,"./nodeback":14,"./promise_array":16,"./synchronous_inspection":19,"./thenables":20,"./util":21}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){function a(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function s(t){var r=this._promise=new e(n);t instanceof e&&r._propagateFrom(t,3),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var c=t("./util");c.isArray;return c.inherits(s,o),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function l(t,n){var o=r(this._values,this._promise);if(o instanceof e){o=o._target();var s=o._bitField;if(this._values=o,0===(50397184&s))return this._promise._setAsyncGuaranteed(),o._then(l,this._reject,void 0,this,n);if(0===(33554432&s))return 0!==(16777216&s)?this._reject(o._reason()):this._cancel();o=o._value()}if(o=c.asArray(o),null===o){var u=i("expecting an array or an iterable object but got "+c.classString(o)).reason();return void this._promise._rejectCallback(u,!1)}return 0===o.length?void(-5===n?this._resolveEmptyArray():this._resolve(a(n))):void this._iterate(o)},s.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,a=null,s=0;n>s;++s){var c=r(t[s],i);c instanceof e?(c=c._target(),a=c._bitField):a=null,o?null!==a&&c.suppressUnhandledRejections():null!==a?0===(50397184&a)?(c._proxy(this,s),this._values[s]=c):o=0!==(33554432&a)?this._promiseFulfilled(c._value(),s):0!==(16777216&a)?this._promiseRejected(c._reason(),s):this._promiseCancelled(s):o=this._promiseFulfilled(c,s)}o||i._setAsyncGuaranteed()},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},s.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n<t.length;++n)t[n]instanceof e&&t[n].cancel()}},s.prototype.shouldCopyValues=function(){return!0},s.prototype.getActualLength=function(t){return t},s}},{"./util":21}],17:[function(t,e,n){"use strict";function r(t,e,n,r,i){for(var o=0;i>o;++o)n[o+r]=t[o+e],t[o+e]=void 0}function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacity<t},i.prototype._pushOne=function(t){var e=this.length();this._checkCapacity(e+1);var n=this._front+e&this._capacity-1;this[n]=t,this._length=e+1},i.prototype.push=function(t,e,n){var r=this.length()+3;if(this._willBeOverCapacity(r))return this._pushOne(t),this._pushOne(e),void this._pushOne(n);var i=this._front+r-3;this._checkCapacity(r);var o=this._capacity-1;this[i+0&o]=t,this[i+1&o]=e,this[i+2&o]=n,this._length=r},i.prototype.shift=function(){var t=this._front,e=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,e},i.prototype.length=function(){return this._length},i.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},i.prototype._resizeTo=function(t){var e=this._capacity;this._capacity=t;var n=this._front,i=this._length,o=n+i&e-1;r(this,0,this,e,o)},e.exports=i},{}],18:[function(t,e,n){"use strict";var r,i=t("./util"),o=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")},a=i.getNativePromise();if(i.isNode&&"undefined"==typeof MutationObserver){var s=global.setImmediate,c=process.nextTick;r=i.isRecentNode?function(t){s.call(global,t)}:function(t){c.call(process,t)}}else if("function"==typeof a&&"function"==typeof a.resolve){var l=a.resolve();r=function(t){l.then(t)}}else r="undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)?"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:o:function(){var t=document.createElement("div"),e={attributes:!0},n=!1,r=document.createElement("div"),i=new MutationObserver(function(){t.classList.toggle("foo"),n=!1});i.observe(r,e);var o=function(){n||(n=!0,r.classList.toggle("foo"))};return function(n){var r=new MutationObserver(function(){r.disconnect(),n()});r.observe(t,e),o()}}();e.exports=r},{"./util":21}],19:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},a=e.prototype.isPending=function(){return 0===(50397184&this._bitField)},s=e.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!==(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536===(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!==(8454144&this._target()._bitField)},t.prototype.isPending=function(){return a.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return s.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],20:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,r){if(u(t)){if(t instanceof e)return t;var i=o(t);if(i===l){r&&r._pushContext();var c=e.reject(i.e);return r&&r._popContext(),c}if("function"==typeof i){if(a(t)){var c=new e(n);return t._then(c._fulfill,c._reject,void 0,c,null),c}return s(t,i,r)}}return t}function i(t){return t.then}function o(t){try{return i(t)}catch(e){return l.e=e,l}}function a(t){try{return p.call(t,"_promise0")}catch(e){return!1}}function s(t,r,i){function o(t){s&&(s._resolveCallback(t),s=null)}function a(t){s&&(s._rejectCallback(t,p,!0),s=null)}var s=new e(n),u=s;i&&i._pushContext(),s._captureStackTrace(),i&&i._popContext();var p=!0,f=c.tryCatch(r).call(t,o,a);return p=!1,s&&f===l&&(s._rejectCallback(f.e,!0,!0),s=null),u}var c=t("./util"),l=c.errorObj,u=c.isObject,p={}.hasOwnProperty;return r}},{"./util":21}],21:[function(t,e,n){"use strict";function r(){try{var t=R;return R=null,t.apply(this,arguments)}catch(e){return P.e=e,P}}function i(t){return R=t,r}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function a(t){return"function"==typeof t||"object"==typeof t&&null!==t}function s(t){return o(t)?new Error(v(t)):t}function c(t,e){var n,r=t.length,i=new Array(r+1);for(n=0;r>n;++n)i[n]=t[n];return i[n]=e,i}function l(t,e,n){if(!F.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function u(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return F.defineProperty(t,e,r),t}function p(t){throw t}function f(t){try{if("function"==typeof t){var e=F.names(t.prototype),n=F.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=A.test(t+"")&&F.names(t).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function h(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t}function _(t){return N.test(t)}function d(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return t instanceof Error||null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function g(t){try{u(t,"isOperational",!0)}catch(e){}}function m(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function b(t){return y(t)&&F.propertyIsWritable(t,"stack")}function C(t){return{}.toString.call(t)}function w(t,e,n){for(var r=F.names(t),i=0;i<r.length;++i){var o=r[i];if(n(o))try{F.defineProperty(e,o,F.getDescriptor(t,o))}catch(a){}}}function E(t){return H?process.env[t]:void 0}function k(){if("function"==typeof Promise)try{var t=new Promise(function(){});if("[object Promise]"==={}.toString.call(t))return Promise}catch(e){}}function j(t,e){return t.bind(e)}var F=t("./es5"),T="undefined"==typeof navigator,P={e:{}},R,S="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0!==this?this:null,x=function(t,e){function n(){this.constructor=t,this.constructor$=e;for(var n in e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}var r={}.hasOwnProperty;return n.prototype=e.prototype,t.prototype=new n,t.prototype},O=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var n=0;n<t.length;++n)if(t[n]===e)return!0;return!1};if(F.isES5){var n=Object.getOwnPropertyNames;return function(t){for(var r=[],i=Object.create(null);null!=t&&!e(t);){var o;try{o=n(t)}catch(a){return r}for(var s=0;s<o.length;++s){var c=o[s];if(!i[c]){i[c]=!0;var l=Object.getOwnPropertyDescriptor(t,c);null!=l&&null==l.get&&null==l.set&&r.push(c)}}t=F.getPrototypeOf(t)}return r}}var r={}.hasOwnProperty;return function(n){if(e(n))return[];var i=[];t:for(var o in n)if(r.call(n,o))i.push(o);else{for(var a=0;a<t.length;++a)if(r.call(t[a],o))continue t;i.push(o)}return i}}(),A=/this\s*\.\s*\S+\s*=/,N=/^[a-z$_][a-z$_0-9]*$/i,L=function(){return"stack"in new Error?function(t){return b(t)?t:new Error(v(t))}:function(t){if(b(t))return t;try{throw new Error(v(t))}catch(e){return e}}}(),B=function(t){return F.isArray(t)?t:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var U="function"==typeof Array.from?function(t){return Array.from(t)}:function(t){for(var e,n=[],r=t[Symbol.iterator]();!(e=r.next()).done;)n.push(e.value);return n};B=function(t){return F.isArray(t)?t:null!=t&&"function"==typeof t[Symbol.iterator]?U(t):null}}var I="undefined"!=typeof process&&"[object process]"===C(process).toLowerCase(),H="undefined"!=typeof process&&"undefined"!=typeof process.env,D={isClass:f,isIdentifier:_,inheritedDataKeys:O,getDataPropertyOrDefault:l,thrower:p,isArray:F.isArray,asArray:B,notEnumerableProp:u,isPrimitive:o,isObject:a,isError:y,canEvaluate:T,errorObj:P,tryCatch:i,inherits:x,withAppended:c,maybeWrapAsError:s,toFastProperties:h,filledRange:d,toString:v,canAttachTrace:b,ensureErrorObject:L,originatesFromRejection:m,markAsOriginatingFromRejection:g,classString:C,copyDescriptors:w,hasDevTools:"undefined"!=typeof chrome&&chrome&&"function"==typeof chrome.loadTimes,isNode:I,hasEnvVariables:H,env:E,global:S,getNativePromise:k,domainBind:j};D.isRecentNode=D.isNode&&function(){var t=process.versions.node.split(".").map(Number);return 0===t[0]&&t[1]>10||t[0]>0}(),D.isNode&&D.toFastProperties(process);try{throw new Error}catch(V){D.lastLineError=V}e.exports=D},{"./es5":10}]},{},[3])(3)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise);
\ No newline at end of file diff --git a/deps/npm/node_modules/bluebird/js/browser/bluebird.js b/deps/npm/node_modules/bluebird/js/browser/bluebird.js index 8dd65f28706..df2041448f7 100644 --- a/deps/npm/node_modules/bluebird/js/browser/bluebird.js +++ b/deps/npm/node_modules/bluebird/js/browser/bluebird.js @@ -23,7 +23,7 @@ * */ /** - * bluebird build version 3.5.0 + * bluebird build version 3.5.1 * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each */ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ @@ -706,7 +706,10 @@ Promise.prototype.suppressUnhandledRejections = function() { Promise.prototype._ensurePossibleRejectionHandled = function () { if ((this._bitField & 524288) !== 0) return; this._setRejectionIsUnhandled(); - async.invokeLater(this._notifyUnhandledRejection, this, undefined); + var self = this; + setTimeout(function() { + self._notifyUnhandledRejection(); + }, 1); }; Promise.prototype._notifyUnhandledRejectionIsHandled = function () { @@ -3496,7 +3499,7 @@ _dereq_("./synchronous_inspection")(Promise); _dereq_("./join")( Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); Promise.Promise = Promise; -Promise.version = "3.5.0"; +Promise.version = "3.5.1"; _dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); _dereq_('./call_get.js')(Promise); _dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); @@ -5460,10 +5463,11 @@ function safeToString(obj) { } function isError(obj) { - return obj !== null && + return obj instanceof Error || + (obj !== null && typeof obj === "object" && typeof obj.message === "string" && - typeof obj.name === "string"; + typeof obj.name === "string"); } function markAsOriginatingFromRejection(e) { diff --git a/deps/npm/node_modules/bluebird/js/browser/bluebird.min.js b/deps/npm/node_modules/bluebird/js/browser/bluebird.min.js index 5d0bac8f891..67df4c06444 100644 --- a/deps/npm/node_modules/bluebird/js/browser/bluebird.min.js +++ b/deps/npm/node_modules/bluebird/js/browser/bluebird.min.js @@ -23,9 +23,9 @@ * */ /** - * bluebird build version 3.5.0 + * bluebird build version 3.5.1 * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,n;return function r(t,e,n){function i(s,a){if(!e[s]){if(!t[s]){var c="function"==typeof _dereq_&&_dereq_;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=e[s]={exports:{}};t[s][0].call(u.exports,function(e){var n=t[s][1][e];return i(n?n:e)},u,u.exports,r,t,e,n)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,n){"use strict";e.exports=function(t){function e(t){var e=new n(t),r=e.promise();return e.setHowMany(1),e.setUnwrap(),e.init(),r}var n=t._SomePromiseArray;t.any=function(t){return e(t)},t.prototype.any=function(){return e(this)}}},{}],2:[function(t,e,n){"use strict";function r(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new u(16),this._normalQueue=new u(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=l}function i(t,e,n){this._lateQueue.push(t,e,n),this._queueTick()}function o(t,e,n){this._normalQueue.push(t,e,n),this._queueTick()}function s(t){this._normalQueue._pushOne(t),this._queueTick()}var a;try{throw new Error}catch(c){a=c}var l=t("./schedule"),u=t("./queue"),p=t("./util");r.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},r.prototype.hasCustomScheduler=function(){return this._customScheduler},r.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},r.prototype.disableTrampolineIfNecessary=function(){p.hasDevTools&&(this._trampolineEnabled=!1)},r.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},r.prototype.fatalError=function(t,e){e?(process.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),process.exit(2)):this.throwLater(t)},r.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},p.hasDevTools?(r.prototype.invokeLater=function(t,e,n){this._trampolineEnabled?i.call(this,t,e,n):this._schedule(function(){setTimeout(function(){t.call(e,n)},100)})},r.prototype.invoke=function(t,e,n){this._trampolineEnabled?o.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},r.prototype.settlePromises=function(t){this._trampolineEnabled?s.call(this,t):this._schedule(function(){t._settlePromises()})}):(r.prototype.invokeLater=i,r.prototype.invoke=o,r.prototype.settlePromises=s),r.prototype._drainQueue=function(t){for(;t.length()>0;){var e=t.shift();if("function"==typeof e){var n=t.shift(),r=t.shift();e.call(n,r)}else e._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=r,e.exports.firstLineError=a},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var l=n(o),u=new t(e);u._propagateFrom(this,1);var p=this._target();if(u._setBoundTo(l),l instanceof t){var h={promiseRejectionQueued:!1,promise:u,target:p,bindingPromise:l};p._then(e,s,void 0,u,h),l._then(a,c,void 0,u,h),u._setOnCancel(l)}else u._resolveCallback(p);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";function r(){try{Promise===o&&(Promise=i)}catch(t){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=t("./promise")();o.noConflict=r,e.exports=o},{"./promise":22}],5:[function(t,e,n){"use strict";var r=Object.create;if(r){var i=r(null),o=r(null);i[" size"]=o[" size"]=0}e.exports=function(e){function n(t,n){var r;if(null!=t&&(r=t[n]),"function"!=typeof r){var i="Object "+a.classString(t)+" has no method '"+a.toString(n)+"'";throw new e.TypeError(i)}return r}function r(t){var e=this.pop(),r=n(t,e);return r.apply(t,this)}function i(t){return t[this]}function o(t){var e=+this;return 0>e&&(e=Math.max(0,e+t.length)),t[e]}var s,a=t("./util"),c=a.canEvaluate;a.isIdentifier;e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e,n="number"==typeof t;if(n)e=o;else if(c){var r=s(t);e=null!==r?r:i}else e=i;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var o=t("./util"),s=o.tryCatch,a=o.errorObj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n<t.length;++n)this._doInvokeOnCancel(t[n],e);else if(void 0!==t)if("function"==typeof t){if(!e){var r=s(t).call(this._boundValue());r===a&&(this._attachExtraTrace(r.e),c.throwLater(r.e))}}else t._resultCancelled(this)},e.prototype._invokeOnCancel=function(){var t=this._onCancel();this._unsetOnCancel(),c.invoke(this._doInvokeOnCancel,this,t)},e.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},e.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(t,e,n){"use strict";e.exports=function(e){function n(t,n,a){return function(c){var l=a._boundValue();t:for(var u=0;u<t.length;++u){var p=t[u];if(p===Error||null!=p&&p.prototype instanceof Error){if(c instanceof p)return o(n).call(l,c)}else if("function"==typeof p){var h=o(p).call(l,c);if(h===s)return h;if(h)return o(n).call(l,c)}else if(r.isObject(c)){for(var f=i(p),_=0;_<f.length;++_){var d=f[_];if(p[d]!=c[d])continue t}return o(n).call(l,c)}}return e}}var r=t("./util"),i=t("./es5").keys,o=r.tryCatch,s=r.errorObj;return n}},{"./es5":13,"./util":36}],8:[function(t,e,n){"use strict";e.exports=function(t){function e(){this._trace=new e.CapturedTrace(r())}function n(){return i?new e:void 0}function r(){var t=o.length-1;return t>=0?o[t]:void 0}var i=!1,o=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=o.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,c=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=c,i=!1},i=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],9:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,e){return{promise:e}}function i(){return!1}function o(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+H.toString(t));r._attachCancellationCallback(t)})}catch(i){return i}}function s(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?H.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function a(){return this._onCancelField}function c(t){this._onCancelField=t}function l(){this._cancellationParent=void 0,this._onCancelField=void 0}function u(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function p(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function h(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function f(){this._trace=new S(this._peekContext())}function _(t,e){if(N(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=j(t);H.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),H.notEnumerableProp(t,"__stackCleaned__",!0)}}}function d(t,e,n,r,i){if(void 0===t&&null!==e&&W){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),c=w(a),l=c.length-1;l>=0;--l){var u=c[l];if(!U.test(u)){var p=u.match(M);p&&(o="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(c.length>0)for(var h=c[0],l=0;l<a.length;++l)if(a[l]===h){l>0&&(s="\n"+a[l-1]);break}}var f="a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;r._warn(f,!0,e)}}function v(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),y(n)}function y(t,n,r){if(ot.warnings){var i,o=new L(t);if(n)r._attachExtraTrace(o);else if(ot.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var s=j(o);o.stack=s.message+"\n"+s.stack.join("\n")}tt("warning",o)||E(o,"",!0)}}function m(t,e){for(var n=0;n<e.length-1;++n)e[n].push("From previous event:"),e[n]=e[n].join("\n");return n<e.length&&(e[n]=e[n].join("\n")),t+"\n"+e.join("\n")}function g(t){for(var e=0;e<t.length;++e)(0===t[e].length||e+1<t.length&&t[e][0]===t[e+1][0])&&(t.splice(e,1),e--)}function b(t){for(var e=t[0],n=1;n<t.length;++n){for(var r=t[n],i=e.length-1,o=e[i],s=-1,a=r.length-1;a>=0;--a)if(r[a]===o){s=a;break}for(var a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}}function w(t){for(var e=[],n=0;n<t.length;++n){var r=t[n],i=" (No stack trace)"===r||q.test(r),o=i&&nt(r);i&&!o&&($&&" "!==r.charAt(0)&&(r=" "+r),e.push(r))}return e}function C(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n<e.length;++n){var r=e[n];if(" (No stack trace)"===r||q.test(r))break}return n>0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function j(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?C(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:w(e)}}function E(t,e,n){if("undefined"!=typeof console){var r;if(H.isObject(t)){var i=t.stack;r=e+Q(i,t)}else r=e+String(t);"function"==typeof D?D(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function k(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(o){I.throwLater(o)}"unhandledRejection"===t?tt(t,n,r)||i||E(n,"Unhandled rejection "):tt(t,r)}function F(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():H.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+x(e)+">, no stack trace)"}function x(t){var e=41;return t.length<e?t:t.substr(0,e-3)+"..."}function T(){return"function"==typeof it}function P(t){var e=t.match(rt);return e?{fileName:e[1],line:parseInt(e[2],10)}:void 0}function R(t,e){if(T()){for(var n,r,i=t.stack.split("\n"),o=e.stack.split("\n"),s=-1,a=-1,c=0;c<i.length;++c){var l=P(i[c]);if(l){n=l.fileName,s=l.line;break}}for(var c=0;c<o.length;++c){var l=P(o[c]);if(l){r=l.fileName,a=l.line;break}}0>s||0>a||!n||!r||n!==r||s>=a||(nt=function(t){if(B.test(t))return!0;var e=P(t);return e&&e.fileName===n&&s<=e.line&&e.line<=a?!0:!1})}}function S(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);it(this,S),e>32&&this.uncycle()}var O,A,D,V=e._getDomain,I=e._async,L=t("./errors").Warning,H=t("./util"),N=H.canAttachTrace,B=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,U=/\((?:timers\.js):\d+:\d+\)/,M=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,q=null,Q=null,$=!1,G=!(0==H.env("BLUEBIRD_DEBUG")||!H.env("BLUEBIRD_DEBUG")&&"development"!==H.env("NODE_ENV")),z=!(0==H.env("BLUEBIRD_WARNINGS")||!G&&!H.env("BLUEBIRD_WARNINGS")),X=!(0==H.env("BLUEBIRD_LONG_STACK_TRACES")||!G&&!H.env("BLUEBIRD_LONG_STACK_TRACES")),W=0!=H.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(z||!!H.env("BLUEBIRD_W_FORGOTTEN_RETURN"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),I.invokeLater(this._notifyUnhandledRejection,this,void 0))},e.prototype._notifyUnhandledRejectionIsHandled=function(){k("rejectionHandled",O,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),k("unhandledRejection",A,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return y(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var e=V();A="function"==typeof t?null===e?t:H.domainBind(e,t):void 0},e.onUnhandledRejectionHandled=function(t){var e=V();O="function"==typeof t?null===e?t:H.domainBind(e,t):void 0};var K=function(){};e.longStackTraces=function(){if(I.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ot.longStackTraces&&T()){var t=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace;ot.longStackTraces=!0,K=function(){if(I.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=r,n.deactivateLongStackTraces(),I.enableTrampoline(),ot.longStackTraces=!1},e.prototype._captureStackTrace=f,e.prototype._attachExtraTrace=_,n.activateLongStackTraces(),I.disableTrampolineIfNecessary()}},e.hasLongStackTraces=function(){return ot.longStackTraces&&T()};var J=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return H.global.dispatchEvent(t),function(t,e){var n=new CustomEvent(t.toLowerCase(),{detail:e,cancelable:!0});return!H.global.dispatchEvent(n)}}if("function"==typeof Event){var t=new Event("CustomEvent");return H.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,!H.global.dispatchEvent(n)}}var t=document.createEvent("CustomEvent");return t.initCustomEvent("testingtheevent",!1,!0,{}),H.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!H.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),Y=function(){return H.isNode?function(){return process.emit.apply(process,arguments)}:H.global?function(t){var e="on"+t.toLowerCase(),n=H.global[e];return n?(n.apply(H.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),Z={promiseCreated:r,promiseFulfilled:r,promiseRejected:r,promiseResolved:r,promiseCancelled:r,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:r},tt=function(t){var e=!1;try{e=Y.apply(null,arguments)}catch(n){I.throwLater(n),e=!0}var r=!1;try{r=J(t,Z[t].apply(null,arguments))}catch(n){I.throwLater(n),r=!0}return r||e};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&K()),"warnings"in t){var n=t.warnings;ot.warnings=!!n,W=ot.warnings,H.isObject(n)&&"wForgottenReturn"in n&&(W=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!ot.cancellation){if(I.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=l,e.prototype._propagateFrom=u,e.prototype._onCancel=a,e.prototype._setOnCancel=c,e.prototype._attachCancellationCallback=s,e.prototype._execute=o,et=u,ot.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!ot.monitoring?(ot.monitoring=!0,e.prototype._fireEvent=tt):!t.monitoring&&ot.monitoring&&(ot.monitoring=!1,e.prototype._fireEvent=i)),e},e.prototype._fireEvent=i,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var et=p,nt=function(){return!1},rt=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;H.inherits(S,Error),n.CapturedTrace=S,S.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;t>r;++r){var s=e[r].stack,a=n[s];if(void 0!==a&&a!==r){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>a?(c._parent=e[a+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var l=c._length+1,u=r-2;u>=0;--u)e[u]._length=l,l++;return}}}},S.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=j(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(w(i.stack.split("\n"))),i=i._parent;b(r),g(r),H.notEnumerableProp(t,"stack",m(n,r)),H.notEnumerableProp(t,"__stackCleaned__",!0)}};var it=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():F(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,q=t,Q=e;var n=Error.captureStackTrace;return nt=function(t){return B.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return q=/@/,Q=e,$=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(Q=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?F(e):e.toString()},null):(q=t,Q=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(D=function(t){console.warn(t)},H.isNode&&process.stderr.isTTY?D=function(t,e){var n=e?"[33m":"[31m";console.warn(n+t+"[0m\n")}:H.isNode||"string"!=typeof(new Error).stack||(D=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var ot={warnings:z,longStackTraces:!1,cancellation:!1,monitoring:!1};return X&&e.longStackTraces(),{longStackTraces:function(){return ot.longStackTraces},warnings:function(){return ot.warnings},cancellation:function(){return ot.cancellation},monitoring:function(){return ot.monitoring},propagateFromFunction:function(){return et},boundValueFunction:function(){return h},checkForgottenReturns:d,setBounds:R,warn:y,deprecated:v,CapturedTrace:S,fireDomEvent:J,fireGlobalEvent:Y}}},{"./errors":12,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var i=function(){return r};return this.caught(n,i)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){function n(){return o(this)}function r(t,n){return i(t,n,e,e)}var i=t.reduce,o=t.all;t.prototype.each=function(t){return i(this,t,e,0)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,r){return i(t,r,e,0)._then(n,void 0,void 0,t,void 0)},t.mapSeries=r}},{}],12:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(p(this,"message","string"==typeof r?r:e),p(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return u(n,Error),n}function i(t){return this instanceof i?(p(this,"name","OperationalError"),p(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(p(this,"message",t.message),p(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(t)}var o,s,a=t("./es5"),c=a.freeze,l=t("./util"),u=l.inherits,p=l.notEnumerableProp,h=r("Warning","warning"),f=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),d=r("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(v){o=r("TypeError","type error"),s=r("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),m=0;m<y.length;++m)"function"==typeof Array.prototype[y[m]]&&(d.prototype[y[m]]=Array.prototype[y[m]]);a.defineProperty(d.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),d.prototype.isOperational=!0;var g=0;d.prototype.toString=function(){var t=Array(4*g+1).join(" "),e="\n"+t+"AggregateError of:\n";g++,t=Array(4*g+1).join(" ");for(var n=0;n<this.length;++n){for(var r=this[n]===this?"[Circular AggregateError]":this[n]+"",i=r.split("\n"),o=0;o<i.length;++o)i[o]=t+i[o];r=i.join("\n"),e+=r+"\n"}return g--,e},u(i,Error);var b=Error.__BluebirdErrorTypes__;b||(b=c({CancellationError:f,TimeoutError:_,OperationalError:i,RejectionError:i,AggregateError:d}),a.defineProperty(Error,"__BluebirdErrorTypes__",{value:b,writable:!1,enumerable:!1,configurable:!1})),e.exports={Error:Error,TypeError:o,RangeError:s,CancellationError:b.CancellationError,OperationalError:b.OperationalError,TimeoutError:b.TimeoutError,AggregateError:b.AggregateError,Warning:h}},{"./es5":13,"./util":36}],13:[function(t,e,n){var r=function(){"use strict";return void 0===this}();if(r)e.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:r,propertyIsWritable:function(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return!(n&&!n.writable&&!n.set)}};else{var i={}.hasOwnProperty,o={}.toString,s={}.constructor.prototype,a=function(t){var e=[];for(var n in t)i.call(t,n)&&e.push(n);return e},c=function(t,e){return{value:t[e]}},l=function(t,e,n){return t[e]=n.value,t},u=function(t){return t},p=function(t){try{return Object(t).constructor.prototype}catch(e){return s}},h=function(t){try{return"[object Array]"===o.call(t)}catch(e){return!1}};e.exports={isArray:h,keys:a,names:a,defineProperty:l,getDescriptor:c,freeze:u,getPrototypeOf:p,isES5:r,propertyIsWritable:function(){return!0}}}},{}],14:[function(t,e,n){"use strict";e.exports=function(t,e){var n=t.map;t.prototype.filter=function(t,r){return n(this,t,r,e)},t.filter=function(t,r,i){return n(t,r,i,e)}}},{}],15:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t,e,n){this.promise=t,this.type=e,this.handler=n,this.called=!1,this.cancelPromise=null}function o(t){this.finallyHandler=t}function s(t,e){return null!=t.cancelPromise?(arguments.length>1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function a(){return l.call(this,this.promise._target()._settledValue())}function c(t){return s(this,t)?void 0:(h.e=t,h)}function l(t){var i=this.promise,l=this.handler;if(!this.called){this.called=!0;var u=this.isFinallyHandler()?l.call(i._boundValue()):l.call(i._boundValue(),t);if(u===r)return u;if(void 0!==u){i._setReturnedNonUndefined();var f=n(u,i);if(f instanceof e){if(null!=this.cancelPromise){if(f._isCancelled()){var _=new p("late cancellation observer");return i._attachExtraTrace(_),h.e=_,h}f.isPending()&&f._attachCancellationCallback(new o(this))}return f._then(a,c,void 0,this,void 0)}}}return i.isRejected()?(s(this),h.e=t,h):(s(this),t)}var u=t("./util"),p=e.CancellationError,h=u.errorObj,f=t("./catch_filter")(r);return i.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){s(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new i(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,l,l)},e.prototype.tap=function(t){return this._passThrough(t,1,l)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,l);var r,i=new Array(n-1),o=0;for(r=0;n-1>r;++r){var s=arguments[r];if(!u.isObject(s))return e.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+u.classString(s)));i[o++]=s}i.length=o;var a=arguments[r];return this._passThrough(f(i,a,this),1,void 0,l)},i}},{"./catch_filter":7,"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r){for(var o=0;o<n.length;++o){r._pushContext();var s=f(n[o])(t);if(r._popContext(),s===h){r._pushContext();var a=e.reject(h.e);return r._popContext(),a}var c=i(s,r);if(c instanceof e)return c}return null}function c(t,n,i,o){if(s.cancellation()){var a=new e(r),c=this._finallyPromise=new e(r);this._promise=a.lastly(function(){return c}),a._captureStackTrace(),a._setOnCancel(this)}else{var l=this._promise=new e(r);l._captureStackTrace()}this._stack=o,this._generatorFunction=t,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(_):_,this._yieldedPromise=null,this._cancellationPhase=!1}var l=t("./errors"),u=l.TypeError,p=t("./util"),h=p.errorObj,f=p.tryCatch,_=[];p.inherits(c,o),c.prototype._isResolved=function(){return null===this._promise},c.prototype._cleanup=function(){this._promise=this._generator=null,s.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},c.prototype._promiseCancelled=function(){if(!this._isResolved()){var t,n="undefined"!=typeof this._generator["return"];if(n)this._promise._pushContext(),t=f(this._generator["return"]).call(this._generator,void 0),this._promise._popContext();else{var r=new e.CancellationError("generator .return() sentinel");e.coroutine.returnSentinel=r,this._promise._attachExtraTrace(r),this._promise._pushContext(),t=f(this._generator["throw"]).call(this._generator,r),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(t)}},c.prototype._promiseFulfilled=function(t){this._yieldedPromise=null,this._promise._pushContext();var e=f(this._generator.next).call(this._generator,t);this._promise._popContext(),this._continue(e)},c.prototype._promiseRejected=function(t){this._yieldedPromise=null,this._promise._attachExtraTrace(t),this._promise._pushContext();var e=f(this._generator["throw"]).call(this._generator,t);this._promise._popContext(),this._continue(e)},c.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof e){var t=this._yieldedPromise;this._yieldedPromise=null,t.cancel()}},c.prototype.promise=function(){return this._promise},c.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},c.prototype._continue=function(t){var n=this._promise;if(t===h)return this._cleanup(),this._cancellationPhase?n.cancel():n._rejectCallback(t.e,!1);var r=t.value;if(t.done===!0)return this._cleanup(),this._cancellationPhase?n.cancel():n._resolveCallback(r);var o=i(r,this._promise);if(!(o instanceof e)&&(o=a(o,this._yieldHandlers,this._promise),null===o))return void this._promiseRejected(new u("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s",String(r))+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")));o=o._target();var s=o._bitField;0===(50397184&s)?(this._yieldedPromise=o,o._proxy(this,null)):0!==(33554432&s)?e._async.invoke(this._promiseFulfilled,this,o._value()):0!==(16777216&s)?e._async.invoke(this._promiseRejected,this,o._reason()):this._promiseCancelled(); -},e.coroutine=function(t,e){if("function"!=typeof t)throw new u("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var n=Object(e).yieldHandler,r=c,i=(new Error).stack;return function(){var e=t.apply(this,arguments),o=new r(void 0,void 0,n,i),s=o.promise();return o._generator=e,o._promiseFulfilled(void 0),s}},e.coroutine.addYieldHandler=function(t){if("function"!=typeof t)throw new u("expecting a function but got "+p.classString(t));_.push(t)},e.spawn=function(t){if(s.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof t)return n("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var r=new c(t,this),i=r.promise();return r._run(e.spawn),i}}},{"./errors":12,"./util":36}],17:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){var a=t("./util");a.canEvaluate,a.tryCatch,a.errorObj;e.join=function(){var t,e=arguments.length-1;if(e>0&&"function"==typeof arguments[e]){t=arguments[e];var r}var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,e,n,r){this.constructor$(t),this._promise._captureStackTrace();var i=l();this._callback=null===i?e:u.domainBind(i,e),this._preservedValues=r===o?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0)}function c(t,n,i,o){if("function"!=typeof n)return r("expecting a function but got "+u.classString(n));var s=0;if(void 0!==i){if("object"!=typeof i||null===i)return e.reject(new TypeError("options argument must be an object but it is "+u.classString(i)));if("number"!=typeof i.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+u.classString(i.concurrency)));s=i.concurrency}return s="number"==typeof s&&isFinite(s)&&s>=1?s:0,new a(t,n,s,o).promise()}var l=e._getDomain,u=t("./util"),p=u.tryCatch,h=u.errorObj,f=e._async;u.inherits(a,n),a.prototype._asyncInit=function(){this._init$(void 0,-2)},a.prototype._init=function(){},a.prototype._promiseFulfilled=function(t,n){var r=this._values,o=this.length(),a=this._preservedValues,c=this._limit;if(0>n){if(n=-1*n-1,r[n]=t,c>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(c>=1&&this._inFlight>=c)return r[n]=t,this._queue.push(n),!1;null!==a&&(a[n]=t);var l=this._promise,u=this._callback,f=l._boundValue();l._pushContext();var _=p(u).call(f,t,n,o),d=l._popContext();if(s.checkForgottenReturns(_,d,null!==a?"Promise.filter":"Promise.map",l),_===h)return this._reject(_.e),!0;var v=i(_,this._promise);if(v instanceof e){v=v._target();var y=v._bitField;if(0===(50397184&y))return c>=1&&this._inFlight++,r[n]=v,v._proxy(this,-1*(n+1)),!1;if(0===(33554432&y))return 0!==(16777216&y)?(this._reject(v._reason()),!0):(this._cancel(),!0);_=v._value()}r[n]=_}var m=++this._totalResolved;return m>=o?(null!==a?this._filter(r,a):this._resolve(r),!0):!1},a.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlight<e;){if(this._isResolved())return;var r=t.pop();this._promiseFulfilled(n[r],r)}},a.prototype._filter=function(t,e){for(var n=e.length,r=new Array(n),i=0,o=0;n>o;++o)t[o]&&(r[i++]=e[o]);r.length=i,this._resolve(r)},a.prototype.preservedValues=function(){return this._preservedValues},e.prototype.map=function(t,e){return c(this,t,e,null)},e.map=function(t,e,n,r){return c(t,e,n,r)}}},{"./util":36}],19:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var s=t("./util"),a=s.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("expecting a function but got "+s.classString(t));return function(){var r=new e(n);r._captureStackTrace(),r._pushContext();var i=a(t).apply(this,arguments),s=r._popContext();return o.checkForgottenReturns(i,s,"Promise.method",r),r._resolveFromSyncValue(i),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return i("expecting a function but got "+s.classString(t));var r=new e(n);r._captureStackTrace(),r._pushContext();var c;if(arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];c=s.isArray(l)?a(t).apply(u,l):a(t).call(u,l)}else c=a(t)();var p=r._popContext();return o.checkForgottenReturns(c,p,"Promise.try",r),r._resolveFromSyncValue(c),r},e.prototype._resolveFromSyncValue=function(t){t===s.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&u.getPrototypeOf(t)===Error.prototype}function i(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=u.keys(t),i=0;i<n.length;++i){var o=n[i];p.test(o)||(e[o]=t[o])}return e}return s.markAsOriginatingFromRejection(t),t}function o(t,e){return function(n,r){if(null!==t){if(n){var o=i(a(n));t._attachExtraTrace(o),t._reject(o)}else if(e){var s=[].slice.call(arguments,1);t._fulfill(s)}else t._fulfill(r);t=null}}}var s=t("./util"),a=s.maybeWrapAsError,c=t("./errors"),l=c.OperationalError,u=t("./es5"),p=/^(?:name|message|stack|cause)$/;e.exports=o},{"./errors":12,"./es5":13,"./util":36}],21:[function(t,e,n){"use strict";e.exports=function(e){function n(t,e){var n=this;if(!o.isArray(t))return r.call(n,t,e);var i=a(e).apply(n._boundValue(),[null].concat(t));i===c&&s.throwLater(i.e)}function r(t,e){var n=this,r=n._boundValue(),i=void 0===t?a(e).call(r,null):a(e).call(r,null,t);i===c&&s.throwLater(i.e)}function i(t,e){var n=this;if(!t){var r=new Error(t+"");r.cause=t,t=r}var i=a(e).call(n._boundValue(),t);i===c&&s.throwLater(i.e)}var o=t("./util"),s=e._async,a=o.tryCatch,c=o.errorObj;e.prototype.asCallback=e.prototype.nodeify=function(t,e){if("function"==typeof t){var o=r;void 0!==e&&Object(e).spread&&(o=n),this._then(o,i,void 0,this,t)}return this}}},{"./util":36}],22:[function(t,e,n){"use strict";e.exports=function(){function n(){}function r(t,e){if(null==t||t.constructor!==i)throw new m("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof e)throw new m("expecting a function but got "+f.classString(e))}function i(t){t!==b&&r(this,t),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(t),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function o(t){this.promise._resolveCallback(t)}function s(t){this.promise._rejectCallback(t,!1)}function a(t){var e=new i(b);e._fulfillmentHandler0=t,e._rejectionHandler0=t,e._promise0=t,e._receiver0=t}var c,l=function(){return new m("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},u=function(){return new i.PromiseInspection(this._target())},p=function(t){return i.reject(new m(t))},h={},f=t("./util");c=f.isNode?function(){var t=process.domain;return void 0===t&&(t=null),t}:function(){return null},f.notEnumerableProp(i,"_getDomain",c);var _=t("./es5"),d=t("./async"),v=new d;_.defineProperty(i,"_async",{value:v});var y=t("./errors"),m=i.TypeError=y.TypeError;i.RangeError=y.RangeError;var g=i.CancellationError=y.CancellationError;i.TimeoutError=y.TimeoutError,i.OperationalError=y.OperationalError,i.RejectionError=y.OperationalError,i.AggregateError=y.AggregateError;var b=function(){},w={},C={},j=t("./thenables")(i,b),E=t("./promise_array")(i,b,j,p,n),k=t("./context")(i),F=k.create,x=t("./debuggability")(i,k),T=(x.CapturedTrace,t("./finally")(i,j,C)),P=t("./catch_filter")(C),R=t("./nodeback"),S=f.errorObj,O=f.tryCatch;return i.prototype.toString=function(){return"[object Promise]"},i.prototype.caught=i.prototype["catch"]=function(t){var e=arguments.length;if(e>1){var n,r=new Array(e-1),i=0;for(n=0;e-1>n;++n){var o=arguments[n];if(!f.isObject(o))return p("Catch statement predicate: expecting an object but got "+f.classString(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,P(r,t,this))}return this.then(void 0,t)},i.prototype.reflect=function(){return this._then(u,u,void 0,this,void 0)},i.prototype.then=function(t,e){if(x.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+f.classString(t);arguments.length>1&&(n+=", "+f.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},i.prototype.spread=function(t){return"function"!=typeof t?p("expecting a function but got "+f.classString(t)):this.all()._then(t,void 0,void 0,w,void 0)},i.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new E(this).promise()},i.prototype.error=function(t){return this.caught(f.originatesFromRejection,t)},i.getNewLibraryCopy=e.exports,i.is=function(t){return t instanceof i},i.fromNode=i.fromCallback=function(t){var e=new i(b);e._captureStackTrace();var n=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=O(t)(R(e,n));return r===S&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},i.all=function(t){return new E(t).promise()},i.cast=function(t){var e=j(t);return e instanceof i||(e=new i(b),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(b);return e._captureStackTrace(),e._rejectCallback(t,!0),e},i.setScheduler=function(t){if("function"!=typeof t)throw new m("expecting a function but got "+f.classString(t));return v.setScheduler(t)},i.prototype._then=function(t,e,n,r,o){var s=void 0!==o,a=s?o:new i(b),l=this._target(),u=l._bitField;s||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var p=c();if(0!==(50397184&u)){var h,_,d=l._settlePromiseCtx;0!==(33554432&u)?(_=l._rejectionHandler0,h=t):0!==(16777216&u)?(_=l._fulfillmentHandler0,h=e,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,_=new g("late cancellation observer"),l._attachExtraTrace(_),h=e),v.invoke(d,l,{handler:null===p?h:"function"==typeof h&&f.domainBind(p,h),promise:a,receiver:r,value:_})}else l._addCallbacks(t,e,a,r,p);return a},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},i.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){v.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===h?void 0:void 0===e&&this._isBound()?this._boundValue():e},i.prototype._promiseAt=function(t){return this[4*t-4+2]},i.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},i.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,i=t._receiverAt(0);void 0===i&&(i=h),this._addCallbacks(e,n,r,i,null)},i.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=h),this._addCallbacks(n,r,i,o,null)},i.prototype._addCallbacks=function(t,e,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:f.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:f.domainBind(i,e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=null===i?t:f.domainBind(i,t)),"function"==typeof e&&(this[s+1]=null===i?e:f.domainBind(i,e))}return this._setLength(o+1),o},i.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},i.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(l(),!1);var n=j(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(l());var o=r._bitField;if(0===(50397184&o)){var s=this._length();s>0&&r._migrateCallback0(this);for(var a=1;s>a;++a)r._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(r)}else if(0!==(33554432&o))this._fulfill(r._value());else if(0!==(16777216&o))this._reject(r._reason());else{var c=new g("late cancellation observer");r._attachExtraTrace(c),this._reject(c)}}},i.prototype._rejectCallback=function(t,e,n){var r=f.ensureErrorObject(t),i=r===t;if(!i&&!n&&x.warnings()){var o="a promise was rejected with a non-error: "+f.classString(t);this._warn(o,!0)}this._attachExtraTrace(r,e?i:!1),this._reject(t)},i.prototype._resolveFromExecutor=function(t){if(t!==b){var e=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)});n=!1,this._popContext(),void 0!==r&&e._rejectCallback(r,!0)}},i.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0===(65536&i)){r._pushContext();var o;e===w?n&&"number"==typeof n.length?o=O(t).apply(this._boundValue(),n):(o=S,o.e=new m("cannot .spread() a non-array: "+f.classString(n))):o=O(t).call(e,n);var s=r._popContext();i=r._bitField,0===(65536&i)&&(o===C?r._reject(n):o===S?r._rejectCallback(o.e,!1):(x.checkForgottenReturns(o,s,"",r,this),r._resolveCallback(o)))}},i.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},i.prototype._followee=function(){return this._rejectionHandler0},i.prototype._setFollowee=function(t){this._rejectionHandler0=t},i.prototype._settlePromise=function(t,e,r,o){var s=t instanceof i,a=this._bitField,c=0!==(134217728&a);0!==(65536&a)?(s&&t._invokeInternalOnCancel(),r instanceof T&&r.isFinallyHandler()?(r.cancelPromise=t,O(e).call(r,o)===S&&t._reject(S.e)):e===u?t._fulfill(u.call(r)):r instanceof n?r._promiseCancelled(t):s||t instanceof E?t._cancel():r.cancel()):"function"==typeof e?s?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,o,t)):e.call(r,o,t):r instanceof n?r._isResolved()||(0!==(33554432&a)?r._promiseFulfilled(o,t):r._promiseRejected(o,t)):s&&(c&&t._setAsyncGuaranteed(),0!==(33554432&a)?t._fulfill(o):t._reject(o))},i.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,o=t.value;"function"==typeof e?n instanceof i?this._settlePromiseFromHandler(e,r,o,n):e.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},i.prototype._settlePromise0=function(t,e,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,i,e)},i.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},i.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=l();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():v.settlePromises(this))}},i.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?v.fatalError(t,f.isNode):void((65535&e)>0?v.settlePromises(this):this._ensurePossibleRejectionHandled())},i.prototype._fulfillPromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._rejectPromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},i.defer=i.pending=function(){x.deprecated("Promise.defer","new Promise");var t=new i(b);return{promise:t,resolve:o,reject:s}},f.notEnumerableProp(i,"_makeSelfResolutionError",l),t("./method")(i,b,j,p,x),t("./bind")(i,b,j,x),t("./cancel")(i,E,p,x),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,E,j,b,v,c),i.Promise=i,i.version="3.5.0",t("./map.js")(i,E,p,j,b,x),t("./call_get.js")(i),t("./using.js")(i,p,j,F,b,x),t("./timers.js")(i,b,x),t("./generators.js")(i,p,b,j,n,x),t("./nodeify.js")(i),t("./promisify.js")(i,b),t("./props.js")(i,E,j,p),t("./race.js")(i,b,j,p),t("./reduce.js")(i,E,p,j,b,x),t("./settle.js")(i,E,x),t("./some.js")(i,E,p),t("./filter.js")(i,b),t("./each.js")(i,b),t("./any.js")(i),f.toFastProperties(i),f.toFastProperties(i.prototype),a({a:1}),a({b:2}),a({c:3}),a(1),a(function(){}),a(void 0),a(!1),a(new i(b)),x.setBounds(d.firstLineError,f.lastLineError),i}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){function s(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function a(t){var r=this._promise=new e(n);t instanceof e&&r._propagateFrom(t,3),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var c=t("./util");c.isArray;return c.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function l(t,n){var o=r(this._values,this._promise);if(o instanceof e){o=o._target();var a=o._bitField;if(this._values=o,0===(50397184&a))return this._promise._setAsyncGuaranteed(),o._then(l,this._reject,void 0,this,n);if(0===(33554432&a))return 0!==(16777216&a)?this._reject(o._reason()):this._cancel();o=o._value()}if(o=c.asArray(o),null===o){var u=i("expecting an array or an iterable object but got "+c.classString(o)).reason();return void this._promise._rejectCallback(u,!1)}return 0===o.length?void(-5===n?this._resolveEmptyArray():this._resolve(s(n))):void this._iterate(o)},a.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,s=null,a=0;n>a;++a){var c=r(t[a],i);c instanceof e?(c=c._target(),s=c._bitField):s=null,o?null!==s&&c.suppressUnhandledRejections():null!==s?0===(50397184&s)?(c._proxy(this,a),this._values[a]=c):o=0!==(33554432&s)?this._promiseFulfilled(c._value(),a):0!==(16777216&s)?this._promiseRejected(c._reason(),a):this._promiseCancelled(a):o=this._promiseFulfilled(c,a)}o||i._setAsyncGuaranteed()},a.prototype._isResolved=function(){return null===this._values},a.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},a.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},a.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},a.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n<t.length;++n)t[n]instanceof e&&t[n].cancel()}},a.prototype.shouldCopyValues=function(){return!0},a.prototype.getActualLength=function(t){return t},a}},{"./util":36}],24:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t){return!C.test(t)}function i(t){try{return t.__isPromisified__===!0}catch(e){return!1}}function o(t,e,n){var r=f.getDataPropertyOrDefault(t,e+n,b);return r?i(r):!1}function s(t,e,n){for(var r=0;r<t.length;r+=2){var i=t[r];if(n.test(i))for(var o=i.replace(n,""),s=0;s<t.length;s+=2)if(t[s]===o)throw new m("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s",e))}}function a(t,e,n,r){for(var a=f.inheritedDataKeys(t),c=[],l=0;l<a.length;++l){var u=a[l],p=t[u],h=r===j?!0:j(u,p,t);"function"!=typeof p||i(p)||o(t,u,e)||!r(u,p,t,h)||c.push(u,p)}return s(c,e,n),c}function c(t,r,i,o,s,a){function c(){var i=r;r===h&&(i=this);var o=new e(n);o._captureStackTrace();var s="string"==typeof u&&this!==l?this[u]:t,c=_(o,a);try{s.apply(i,d(arguments,c))}catch(p){o._rejectCallback(v(p),!0,!0)}return o._isFateSealed()||o._setAsyncGuaranteed(),o}var l=function(){return this}(),u=t;return"string"==typeof u&&(t=o),f.notEnumerableProp(c,"__isPromisified__",!0),c}function l(t,e,n,r,i){for(var o=new RegExp(E(e)+"$"),s=a(t,e,o,n),c=0,l=s.length;l>c;c+=2){var u=s[c],p=s[c+1],_=u+e;if(r===k)t[_]=k(u,h,u,p,e,i);else{var d=r(p,function(){return k(u,h,u,p,e,i)});f.notEnumerableProp(d,"__isPromisified__",!0),t[_]=d}}return f.toFastProperties(t),t}function u(t,e,n){return k(t,e,void 0,t,null,n)}var p,h={},f=t("./util"),_=t("./nodeback"),d=f.withAppended,v=f.maybeWrapAsError,y=f.canEvaluate,m=t("./errors").TypeError,g="Async",b={__isPromisified__:!0},w=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],C=new RegExp("^(?:"+w.join("|")+")$"),j=function(t){return f.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t},E=function(t){return t.replace(/([$])/,"\\$")},k=y?p:c;e.promisify=function(t,e){if("function"!=typeof t)throw new m("expecting a function but got "+f.classString(t));if(i(t))return t;e=Object(e);var n=void 0===e.context?h:e.context,o=!!e.multiArgs,s=u(t,n,o);return f.copyDescriptors(t,s,r),s},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new m("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");e=Object(e);var n=!!e.multiArgs,r=e.suffix;"string"!=typeof r&&(r=g);var i=e.filter;"function"!=typeof i&&(i=j);var o=e.promisifier;if("function"!=typeof o&&(o=k),!f.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=f.inheritedDataKeys(t),a=0;a<s.length;++a){var c=t[s[a]];"constructor"!==s[a]&&f.isClass(c)&&(l(c.prototype,r,i,o,n),l(c,r,i,o,n))}return l(t,r,i,o,n)}}},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t){var e,n=!1;if(void 0!==a&&t instanceof a)e=p(t),n=!0;else{var r=u.keys(t),i=r.length;e=new Array(2*i);for(var o=0;i>o;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._isMap=n,this._init$(void 0,n?-6:-3)}function s(t){var n,s=r(t);return l(s)?(n=s instanceof e?s._then(e.props,void 0,void 0,void 0,void 0):new o(s).promise(),s instanceof e&&n._propagateFrom(s,2),n):i("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}var a,c=t("./util"),l=c.isObject,u=t("./es5");"function"==typeof Map&&(a=Map);var p=function(){function t(t,r){this[e]=t,this[e+n]=r,e++}var e=0,n=0;return function(r){n=r.size,e=0;var i=new Array(2*r.size);return r.forEach(t,i),i}}(),h=function(t){for(var e=new a,n=t.length/2|0,r=0;n>r;++r){var i=t[n+r],o=t[r];e.set(i,o)}return e};c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;if(n>=this._length){var r;if(this._isMap)r=h(this._values);else{r={};for(var i=this.length(),o=0,s=this.length();s>o;++o)r[this._values[o+i]]=this._values[o]}return this._resolve(r),!0}return!1},o.prototype.shouldCopyValues=function(){return!1},o.prototype.getActualLength=function(t){return t>>1},e.prototype.props=function(){return s(this)},e.props=function(t){return s(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function r(t,e,n,r,i){for(var o=0;i>o;++o)n[o+r]=t[o+e],t[o+e]=void 0}function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacity<t},i.prototype._pushOne=function(t){var e=this.length();this._checkCapacity(e+1);var n=this._front+e&this._capacity-1;this[n]=t,this._length=e+1},i.prototype.push=function(t,e,n){var r=this.length()+3;if(this._willBeOverCapacity(r))return this._pushOne(t),this._pushOne(e),void this._pushOne(n);var i=this._front+r-3;this._checkCapacity(r);var o=this._capacity-1;this[i+0&o]=t,this[i+1&o]=e,this[i+2&o]=n,this._length=r},i.prototype.shift=function(){var t=this._front,e=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,e},i.prototype.length=function(){return this._length},i.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},i.prototype._resizeTo=function(t){var e=this._capacity;this._capacity=t;var n=this._front,i=this._length,o=n+i&e-1;r(this,0,this,e,o)},e.exports=i},{}],27:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t,o){var c=r(t);if(c instanceof e)return a(c);if(t=s.asArray(t),null===t)return i("expecting an array or an iterable object but got "+s.classString(t));var l=new e(n);void 0!==o&&l._propagateFrom(o,3);for(var u=l._fulfill,p=l._reject,h=0,f=t.length;f>h;++h){var _=t[h];(void 0!==_||h in t)&&e.cast(_)._then(u,p,void 0,l,null)}return l}var s=t("./util"),a=function(t){return t.then(function(e){return o(e,t)})};e.race=function(t){return o(t,void 0)},e.prototype.race=function(){return o(this,void 0)}}},{"./util":36}],28:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r,i){this.constructor$(t);var s=h();this._fn=null===s?n:f.domainBind(s,n),void 0!==r&&(r=e.resolve(r),r._attachCancellationCallback(this)),this._initialValue=r,this._currentCancellable=null,i===o?this._eachValues=Array(this._length):0===i?this._eachValues=null:this._eachValues=void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function c(t,e){this.isFulfilled()?e._resolve(t):e._reject(t)}function l(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+f.classString(e));var o=new a(t,e,n,i);return o.promise()}function u(t){this.accum=t,this.array._gotAccum(t);var n=i(this.value,this.array._promise);return n instanceof e?(this.array._currentCancellable=n,n._then(p,void 0,void 0,this,void 0)):p.call(this,n)}function p(t){var n=this.array,r=n._promise,i=_(n._fn);r._pushContext();var o;o=void 0!==n._eachValues?i.call(r._boundValue(),t,this.index,this.length):i.call(r._boundValue(),this.accum,t,this.index,this.length),o instanceof e&&(n._currentCancellable=o);var a=r._popContext();return s.checkForgottenReturns(o,a,void 0!==n._eachValues?"Promise.each":"Promise.reduce",r),o}var h=e._getDomain,f=t("./util"),_=f.tryCatch;f.inherits(a,n),a.prototype._gotAccum=function(t){void 0!==this._eachValues&&null!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){return null!==this._eachValues&&this._eachValues.push(t),this._eachValues},a.prototype._init=function(){},a.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},a.prototype.shouldCopyValues=function(){return!1},a.prototype._resolve=function(t){this._promise._resolveCallback(t),this._values=null},a.prototype._resultCancelled=function(t){return t===this._initialValue?this._cancel():void(this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof e&&this._currentCancellable.cancel(),this._initialValue instanceof e&&this._initialValue.cancel()))},a.prototype._iterate=function(t){this._values=t;var n,r,i=t.length;if(void 0!==this._initialValue?(n=this._initialValue,r=0):(n=e.resolve(t[0]),r=1),this._currentCancellable=n,!n.isRejected())for(;i>r;++r){var o={accum:null,value:t[r],index:r,length:i,array:this};n=n._then(u,void 0,void 0,o,void 0)}void 0!==this._eachValues&&(n=n._then(this._eachComplete,void 0,void 0,this,void 0)),n._then(c,c,void 0,n,this)},e.prototype.reduce=function(t,e){return l(this,t,e,null)},e.reduce=function(t,e,n,r){return l(t,e,n,r)}}},{"./util":36}],29:[function(t,e,n){"use strict";var r,i=t("./util"),o=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")},s=i.getNativePromise();if(i.isNode&&"undefined"==typeof MutationObserver){var a=global.setImmediate,c=process.nextTick;r=i.isRecentNode?function(t){a.call(global,t)}:function(t){c.call(process,t)}}else if("function"==typeof s&&"function"==typeof s.resolve){var l=s.resolve();r=function(t){l.then(t)}}else r="undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)?"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:o:function(){var t=document.createElement("div"),e={attributes:!0},n=!1,r=document.createElement("div"),i=new MutationObserver(function(){t.classList.toggle("foo"),n=!1});i.observe(r,e);var o=function(){n||(n=!0,r.classList.toggle("foo"))};return function(n){var r=new MutationObserver(function(){r.disconnect(),n()});r.observe(t,e),o()}}();e.exports=r},{"./util":36}],30:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t)}var o=e.PromiseInspection,s=t("./util");s.inherits(i,n),i.prototype._promiseResolved=function(t,e){this._values[t]=e;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},i.prototype._promiseFulfilled=function(t,e){var n=new o;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},i.prototype._promiseRejected=function(t,e){var n=new o;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return r.deprecated(".settle()",".reflect()"),new i(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t), -this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(t,e){if((0|e)!==e||0>e)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new i(t),o=n.promise();return n.setHowMany(e),n.init(),o}var s=t("./util"),a=t("./errors").RangeError,c=t("./errors").AggregateError,l=s.isArray,u={};s.inherits(i,n),i.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var t=l(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(t){this._howMany=t},i.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()?(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0):!1},i.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},i.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(u),this._checkOutcome())},i.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new c,e=this.length();e<this._values.length;++e)this._values[e]!==u&&t.push(this._values[e]);return t.length>0?this._reject(t):this._cancel(),!0}return!1},i.prototype._fulfilled=function(){return this._totalResolved},i.prototype._rejected=function(){return this._values.length-this.length()},i.prototype._addRejected=function(t){this._values.push(t)},i.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},i.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},i.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new a(e)},i.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return o(t,e)},e.prototype.some=function(t){return o(this,t)},e._SomePromiseArray=i}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},s=e.prototype.isPending=function(){return 0===(50397184&this._bitField)},a=e.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!==(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536===(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!==(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,r){if(u(t)){if(t instanceof e)return t;var i=o(t);if(i===l){r&&r._pushContext();var c=e.reject(i.e);return r&&r._popContext(),c}if("function"==typeof i){if(s(t)){var c=new e(n);return t._then(c._fulfill,c._reject,void 0,c,null),c}return a(t,i,r)}}return t}function i(t){return t.then}function o(t){try{return i(t)}catch(e){return l.e=e,l}}function s(t){try{return p.call(t,"_promise0")}catch(e){return!1}}function a(t,r,i){function o(t){a&&(a._resolveCallback(t),a=null)}function s(t){a&&(a._rejectCallback(t,p,!0),a=null)}var a=new e(n),u=a;i&&i._pushContext(),a._captureStackTrace(),i&&i._popContext();var p=!0,h=c.tryCatch(r).call(t,o,s);return p=!1,a&&h===l&&(a._rejectCallback(h.e,!0,!0),a=null),u}var c=t("./util"),l=c.errorObj,u=c.isObject,p={}.hasOwnProperty;return r}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.handle=t}function o(t){return clearTimeout(this.handle),t}function s(t){throw clearTimeout(this.handle),t}var a=t("./util"),c=e.TimeoutError;i.prototype._resultCancelled=function(){clearTimeout(this.handle)};var l=function(t){return u(+this).thenReturn(t)},u=e.delay=function(t,o){var s,a;return void 0!==o?(s=e.resolve(o)._then(l,null,null,t,void 0),r.cancellation()&&o instanceof e&&s._setOnCancel(o)):(s=new e(n),a=setTimeout(function(){s._fulfill()},+t),r.cancellation()&&s._setOnCancel(new i(a)),s._captureStackTrace()),s._setAsyncGuaranteed(),s};e.prototype.delay=function(t){return u(t,this)};var p=function(t,e,n){var r;r="string"!=typeof e?e instanceof Error?e:new c("operation timed out"):new c(e),a.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._reject(r),null!=n&&n.cancel()};e.prototype.timeout=function(t,e){t=+t;var n,a,c=new i(setTimeout(function(){n.isPending()&&p(n,e,a)},t));return r.cancellation()?(a=this.then(),n=a._then(o,s,void 0,c,void 0),n._setOnCancel(c)):n=this._then(o,s,void 0,c,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t){setTimeout(function(){throw t},0)}function c(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}function l(t,n){function i(){if(s>=l)return u._fulfill();var o=c(t[s++]);if(o instanceof e&&o._isDisposable()){try{o=r(o._getDisposer().tryDispose(n),t.promise)}catch(p){return a(p)}if(o instanceof e)return o._then(i,a,null,null,null)}i()}var s=0,l=t.length,u=new e(o);return i(),u}function u(t,e,n){this._data=t,this._promise=e,this._context=n}function p(t,e,n){this.constructor$(t,e,n)}function h(t){return u.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function f(t){this.length=t,this.promise=null,this[t-1]=null}var _=t("./util"),d=t("./errors").TypeError,v=t("./util").inherits,y=_.errorObj,m=_.tryCatch,g={};u.prototype.data=function(){return this._data},u.prototype.promise=function(){return this._promise},u.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():g},u.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=e!==g?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},u.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},v(p,u),p.prototype.doDispose=function(t,e){var n=this.data();return n.call(t,t,e)},f.prototype._resultCancelled=function(){for(var t=this.length,n=0;t>n;++n){var r=this[n];r instanceof e&&r.cancel()}},e.using=function(){var t=arguments.length;if(2>t)return n("you must pass at least 2 arguments to Promise.using");var i=arguments[t-1];if("function"!=typeof i)return n("expecting a function but got "+_.classString(i));var o,a=!0;2===t&&Array.isArray(arguments[0])?(o=arguments[0],t=o.length,a=!1):(o=arguments,t--);for(var c=new f(t),p=0;t>p;++p){var d=o[p];if(u.isDisposer(d)){var v=d;d=d.promise(),d._setDisposable(v)}else{var g=r(d);g instanceof e&&(d=g._then(h,null,null,{resources:c,index:p},void 0))}c[p]=d}for(var b=new Array(c.length),p=0;p<b.length;++p)b[p]=e.resolve(c[p]).reflect();var w=e.all(b).then(function(t){for(var e=0;e<t.length;++e){var n=t[e];if(n.isRejected())return y.e=n.error(),y;if(!n.isFulfilled())return void w.cancel();t[e]=n.value()}C._pushContext(),i=m(i);var r=a?i.apply(void 0,t):i(t),o=C._popContext();return s.checkForgottenReturns(r,o,"Promise.using",C),r}),C=w.lastly(function(){var t=new e.PromiseInspection(w);return l(c,t)});return c.promise=C,C._setOnCancel(c),C},e.prototype._setDisposable=function(t){this._bitField=131072|this._bitField,this._disposer=t},e.prototype._isDisposable=function(){return(131072&this._bitField)>0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,n){"use strict";function r(){try{var t=P;return P=null,t.apply(this,arguments)}catch(e){return T.e=e,T}}function i(t){return P=t,r}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return o(t)?new Error(v(t)):t}function c(t,e){var n,r=t.length,i=new Array(r+1);for(n=0;r>n;++n)i[n]=t[n];return i[n]=e,i}function l(t,e,n){if(!F.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function u(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return F.defineProperty(t,e,r),t}function p(t){throw t}function h(t){try{if("function"==typeof t){var e=F.names(t.prototype),n=F.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=A.test(t+"")&&F.names(t).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function f(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t}function _(t){return D.test(t)}function d(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function m(t){try{u(t,"isOperational",!0)}catch(e){}}function g(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function b(t){return y(t)&&F.propertyIsWritable(t,"stack")}function w(t){return{}.toString.call(t)}function C(t,e,n){for(var r=F.names(t),i=0;i<r.length;++i){var o=r[i];if(n(o))try{F.defineProperty(e,o,F.getDescriptor(t,o))}catch(s){}}}function j(t){return N?process.env[t]:void 0}function E(){if("function"==typeof Promise)try{var t=new Promise(function(){});if("[object Promise]"==={}.toString.call(t))return Promise}catch(e){}}function k(t,e){return t.bind(e)}var F=t("./es5"),x="undefined"==typeof navigator,T={e:{}},P,R="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0!==this?this:null,S=function(t,e){function n(){this.constructor=t,this.constructor$=e;for(var n in e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}var r={}.hasOwnProperty;return n.prototype=e.prototype,t.prototype=new n,t.prototype},O=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var n=0;n<t.length;++n)if(t[n]===e)return!0;return!1};if(F.isES5){var n=Object.getOwnPropertyNames;return function(t){for(var r=[],i=Object.create(null);null!=t&&!e(t);){var o;try{o=n(t)}catch(s){return r}for(var a=0;a<o.length;++a){var c=o[a];if(!i[c]){i[c]=!0;var l=Object.getOwnPropertyDescriptor(t,c);null!=l&&null==l.get&&null==l.set&&r.push(c)}}t=F.getPrototypeOf(t)}return r}}var r={}.hasOwnProperty;return function(n){if(e(n))return[];var i=[];t:for(var o in n)if(r.call(n,o))i.push(o);else{for(var s=0;s<t.length;++s)if(r.call(t[s],o))continue t;i.push(o)}return i}}(),A=/this\s*\.\s*\S+\s*=/,D=/^[a-z$_][a-z$_0-9]*$/i,V=function(){return"stack"in new Error?function(t){return b(t)?t:new Error(v(t))}:function(t){if(b(t))return t;try{throw new Error(v(t))}catch(e){return e}}}(),I=function(t){return F.isArray(t)?t:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var L="function"==typeof Array.from?function(t){return Array.from(t)}:function(t){for(var e,n=[],r=t[Symbol.iterator]();!(e=r.next()).done;)n.push(e.value);return n};I=function(t){return F.isArray(t)?t:null!=t&&"function"==typeof t[Symbol.iterator]?L(t):null}}var H="undefined"!=typeof process&&"[object process]"===w(process).toLowerCase(),N="undefined"!=typeof process&&"undefined"!=typeof process.env,B={isClass:h,isIdentifier:_,inheritedDataKeys:O,getDataPropertyOrDefault:l,thrower:p,isArray:F.isArray,asArray:I,notEnumerableProp:u,isPrimitive:o,isObject:s,isError:y,canEvaluate:x,errorObj:T,tryCatch:i,inherits:S,withAppended:c,maybeWrapAsError:a,toFastProperties:f,filledRange:d,toString:v,canAttachTrace:b,ensureErrorObject:V,originatesFromRejection:g,markAsOriginatingFromRejection:m,classString:w,copyDescriptors:C,hasDevTools:"undefined"!=typeof chrome&&chrome&&"function"==typeof chrome.loadTimes,isNode:H,hasEnvVariables:N,env:j,global:R,getNativePromise:E,domainBind:k};B.isRecentNode=B.isNode&&function(){var t=process.versions.node.split(".").map(Number);return 0===t[0]&&t[1]>10||t[0]>0}(),B.isNode&&B.toFastProperties(process);try{throw new Error}catch(U){B.lastLineError=U}e.exports=B},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise);
\ No newline at end of file +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,n;return function r(t,e,n){function i(s,a){if(!e[s]){if(!t[s]){var c="function"==typeof _dereq_&&_dereq_;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=e[s]={exports:{}};t[s][0].call(u.exports,function(e){var n=t[s][1][e];return i(n?n:e)},u,u.exports,r,t,e,n)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,n){"use strict";e.exports=function(t){function e(t){var e=new n(t),r=e.promise();return e.setHowMany(1),e.setUnwrap(),e.init(),r}var n=t._SomePromiseArray;t.any=function(t){return e(t)},t.prototype.any=function(){return e(this)}}},{}],2:[function(t,e,n){"use strict";function r(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new u(16),this._normalQueue=new u(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=l}function i(t,e,n){this._lateQueue.push(t,e,n),this._queueTick()}function o(t,e,n){this._normalQueue.push(t,e,n),this._queueTick()}function s(t){this._normalQueue._pushOne(t),this._queueTick()}var a;try{throw new Error}catch(c){a=c}var l=t("./schedule"),u=t("./queue"),p=t("./util");r.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},r.prototype.hasCustomScheduler=function(){return this._customScheduler},r.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},r.prototype.disableTrampolineIfNecessary=function(){p.hasDevTools&&(this._trampolineEnabled=!1)},r.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},r.prototype.fatalError=function(t,e){e?(process.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),process.exit(2)):this.throwLater(t)},r.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},p.hasDevTools?(r.prototype.invokeLater=function(t,e,n){this._trampolineEnabled?i.call(this,t,e,n):this._schedule(function(){setTimeout(function(){t.call(e,n)},100)})},r.prototype.invoke=function(t,e,n){this._trampolineEnabled?o.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},r.prototype.settlePromises=function(t){this._trampolineEnabled?s.call(this,t):this._schedule(function(){t._settlePromises()})}):(r.prototype.invokeLater=i,r.prototype.invoke=o,r.prototype.settlePromises=s),r.prototype._drainQueue=function(t){for(;t.length()>0;){var e=t.shift();if("function"==typeof e){var n=t.shift(),r=t.shift();e.call(n,r)}else e._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=r,e.exports.firstLineError=a},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var l=n(o),u=new t(e);u._propagateFrom(this,1);var p=this._target();if(u._setBoundTo(l),l instanceof t){var h={promiseRejectionQueued:!1,promise:u,target:p,bindingPromise:l};p._then(e,s,void 0,u,h),l._then(a,c,void 0,u,h),u._setOnCancel(l)}else u._resolveCallback(p);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";function r(){try{Promise===o&&(Promise=i)}catch(t){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=t("./promise")();o.noConflict=r,e.exports=o},{"./promise":22}],5:[function(t,e,n){"use strict";var r=Object.create;if(r){var i=r(null),o=r(null);i[" size"]=o[" size"]=0}e.exports=function(e){function n(t,n){var r;if(null!=t&&(r=t[n]),"function"!=typeof r){var i="Object "+a.classString(t)+" has no method '"+a.toString(n)+"'";throw new e.TypeError(i)}return r}function r(t){var e=this.pop(),r=n(t,e);return r.apply(t,this)}function i(t){return t[this]}function o(t){var e=+this;return 0>e&&(e=Math.max(0,e+t.length)),t[e]}var s,a=t("./util"),c=a.canEvaluate;a.isIdentifier;e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e,n="number"==typeof t;if(n)e=o;else if(c){var r=s(t);e=null!==r?r:i}else e=i;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var o=t("./util"),s=o.tryCatch,a=o.errorObj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n<t.length;++n)this._doInvokeOnCancel(t[n],e);else if(void 0!==t)if("function"==typeof t){if(!e){var r=s(t).call(this._boundValue());r===a&&(this._attachExtraTrace(r.e),c.throwLater(r.e))}}else t._resultCancelled(this)},e.prototype._invokeOnCancel=function(){var t=this._onCancel();this._unsetOnCancel(),c.invoke(this._doInvokeOnCancel,this,t)},e.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},e.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(t,e,n){"use strict";e.exports=function(e){function n(t,n,a){return function(c){var l=a._boundValue();t:for(var u=0;u<t.length;++u){var p=t[u];if(p===Error||null!=p&&p.prototype instanceof Error){if(c instanceof p)return o(n).call(l,c)}else if("function"==typeof p){var h=o(p).call(l,c);if(h===s)return h;if(h)return o(n).call(l,c)}else if(r.isObject(c)){for(var f=i(p),_=0;_<f.length;++_){var d=f[_];if(p[d]!=c[d])continue t}return o(n).call(l,c)}}return e}}var r=t("./util"),i=t("./es5").keys,o=r.tryCatch,s=r.errorObj;return n}},{"./es5":13,"./util":36}],8:[function(t,e,n){"use strict";e.exports=function(t){function e(){this._trace=new e.CapturedTrace(r())}function n(){return i?new e:void 0}function r(){var t=o.length-1;return t>=0?o[t]:void 0}var i=!1,o=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=o.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,c=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=c,i=!1},i=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],9:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,e){return{promise:e}}function i(){return!1}function o(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+H.toString(t));r._attachCancellationCallback(t)})}catch(i){return i}}function s(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?H.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function a(){return this._onCancelField}function c(t){this._onCancelField=t}function l(){this._cancellationParent=void 0,this._onCancelField=void 0}function u(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function p(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function h(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function f(){this._trace=new S(this._peekContext())}function _(t,e){if(N(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=j(t);H.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),H.notEnumerableProp(t,"__stackCleaned__",!0)}}}function d(t,e,n,r,i){if(void 0===t&&null!==e&&W){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),c=w(a),l=c.length-1;l>=0;--l){var u=c[l];if(!U.test(u)){var p=u.match(M);p&&(o="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(c.length>0)for(var h=c[0],l=0;l<a.length;++l)if(a[l]===h){l>0&&(s="\n"+a[l-1]);break}}var f="a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;r._warn(f,!0,e)}}function v(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),y(n)}function y(t,n,r){if(ot.warnings){var i,o=new L(t);if(n)r._attachExtraTrace(o);else if(ot.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var s=j(o);o.stack=s.message+"\n"+s.stack.join("\n")}tt("warning",o)||E(o,"",!0)}}function m(t,e){for(var n=0;n<e.length-1;++n)e[n].push("From previous event:"),e[n]=e[n].join("\n");return n<e.length&&(e[n]=e[n].join("\n")),t+"\n"+e.join("\n")}function g(t){for(var e=0;e<t.length;++e)(0===t[e].length||e+1<t.length&&t[e][0]===t[e+1][0])&&(t.splice(e,1),e--)}function b(t){for(var e=t[0],n=1;n<t.length;++n){for(var r=t[n],i=e.length-1,o=e[i],s=-1,a=r.length-1;a>=0;--a)if(r[a]===o){s=a;break}for(var a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}}function w(t){for(var e=[],n=0;n<t.length;++n){var r=t[n],i=" (No stack trace)"===r||q.test(r),o=i&&nt(r);i&&!o&&($&&" "!==r.charAt(0)&&(r=" "+r),e.push(r))}return e}function C(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n<e.length;++n){var r=e[n];if(" (No stack trace)"===r||q.test(r))break}return n>0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function j(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?C(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:w(e)}}function E(t,e,n){if("undefined"!=typeof console){var r;if(H.isObject(t)){var i=t.stack;r=e+Q(i,t)}else r=e+String(t);"function"==typeof D?D(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function k(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(o){I.throwLater(o)}"unhandledRejection"===t?tt(t,n,r)||i||E(n,"Unhandled rejection "):tt(t,r)}function F(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():H.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+x(e)+">, no stack trace)"}function x(t){var e=41;return t.length<e?t:t.substr(0,e-3)+"..."}function T(){return"function"==typeof it}function P(t){var e=t.match(rt);return e?{fileName:e[1],line:parseInt(e[2],10)}:void 0}function R(t,e){if(T()){for(var n,r,i=t.stack.split("\n"),o=e.stack.split("\n"),s=-1,a=-1,c=0;c<i.length;++c){var l=P(i[c]);if(l){n=l.fileName,s=l.line;break}}for(var c=0;c<o.length;++c){var l=P(o[c]);if(l){r=l.fileName,a=l.line;break}}0>s||0>a||!n||!r||n!==r||s>=a||(nt=function(t){if(B.test(t))return!0;var e=P(t);return e&&e.fileName===n&&s<=e.line&&e.line<=a?!0:!1})}}function S(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);it(this,S),e>32&&this.uncycle()}var O,A,D,V=e._getDomain,I=e._async,L=t("./errors").Warning,H=t("./util"),N=H.canAttachTrace,B=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,U=/\((?:timers\.js):\d+:\d+\)/,M=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,q=null,Q=null,$=!1,G=!(0==H.env("BLUEBIRD_DEBUG")||!H.env("BLUEBIRD_DEBUG")&&"development"!==H.env("NODE_ENV")),z=!(0==H.env("BLUEBIRD_WARNINGS")||!G&&!H.env("BLUEBIRD_WARNINGS")),X=!(0==H.env("BLUEBIRD_LONG_STACK_TRACES")||!G&&!H.env("BLUEBIRD_LONG_STACK_TRACES")),W=0!=H.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(z||!!H.env("BLUEBIRD_W_FORGOTTEN_RETURN"));e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){if(0===(524288&this._bitField)){this._setRejectionIsUnhandled();var t=this;setTimeout(function(){t._notifyUnhandledRejection()},1)}},e.prototype._notifyUnhandledRejectionIsHandled=function(){k("rejectionHandled",O,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),k("unhandledRejection",A,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return y(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var e=V();A="function"==typeof t?null===e?t:H.domainBind(e,t):void 0},e.onUnhandledRejectionHandled=function(t){var e=V();O="function"==typeof t?null===e?t:H.domainBind(e,t):void 0};var K=function(){};e.longStackTraces=function(){if(I.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ot.longStackTraces&&T()){var t=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace;ot.longStackTraces=!0,K=function(){if(I.haveItemsQueued()&&!ot.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=r,n.deactivateLongStackTraces(),I.enableTrampoline(),ot.longStackTraces=!1},e.prototype._captureStackTrace=f,e.prototype._attachExtraTrace=_,n.activateLongStackTraces(),I.disableTrampolineIfNecessary()}},e.hasLongStackTraces=function(){return ot.longStackTraces&&T()};var J=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return H.global.dispatchEvent(t),function(t,e){var n=new CustomEvent(t.toLowerCase(),{detail:e,cancelable:!0});return!H.global.dispatchEvent(n)}}if("function"==typeof Event){var t=new Event("CustomEvent");return H.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,!H.global.dispatchEvent(n)}}var t=document.createEvent("CustomEvent");return t.initCustomEvent("testingtheevent",!1,!0,{}),H.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!H.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),Y=function(){return H.isNode?function(){return process.emit.apply(process,arguments)}:H.global?function(t){var e="on"+t.toLowerCase(),n=H.global[e];return n?(n.apply(H.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),Z={promiseCreated:r,promiseFulfilled:r,promiseRejected:r,promiseResolved:r,promiseCancelled:r,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:r},tt=function(t){var e=!1;try{e=Y.apply(null,arguments)}catch(n){I.throwLater(n),e=!0}var r=!1;try{r=J(t,Z[t].apply(null,arguments))}catch(n){I.throwLater(n),r=!0}return r||e};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&K()),"warnings"in t){var n=t.warnings;ot.warnings=!!n,W=ot.warnings,H.isObject(n)&&"wForgottenReturn"in n&&(W=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!ot.cancellation){if(I.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=l,e.prototype._propagateFrom=u,e.prototype._onCancel=a,e.prototype._setOnCancel=c,e.prototype._attachCancellationCallback=s,e.prototype._execute=o,et=u,ot.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!ot.monitoring?(ot.monitoring=!0,e.prototype._fireEvent=tt):!t.monitoring&&ot.monitoring&&(ot.monitoring=!1,e.prototype._fireEvent=i)),e},e.prototype._fireEvent=i,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var et=p,nt=function(){return!1},rt=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;H.inherits(S,Error),n.CapturedTrace=S,S.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;t>r;++r){var s=e[r].stack,a=n[s];if(void 0!==a&&a!==r){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>a?(c._parent=e[a+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var l=c._length+1,u=r-2;u>=0;--u)e[u]._length=l,l++;return}}}},S.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=j(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(w(i.stack.split("\n"))),i=i._parent;b(r),g(r),H.notEnumerableProp(t,"stack",m(n,r)),H.notEnumerableProp(t,"__stackCleaned__",!0)}};var it=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():F(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,q=t,Q=e;var n=Error.captureStackTrace;return nt=function(t){return B.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return q=/@/,Q=e,$=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(Q=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?F(e):e.toString()},null):(q=t,Q=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(D=function(t){console.warn(t)},H.isNode&&process.stderr.isTTY?D=function(t,e){var n=e?"[33m":"[31m";console.warn(n+t+"[0m\n")}:H.isNode||"string"!=typeof(new Error).stack||(D=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var ot={warnings:z,longStackTraces:!1,cancellation:!1,monitoring:!1};return X&&e.longStackTraces(),{longStackTraces:function(){return ot.longStackTraces},warnings:function(){return ot.warnings},cancellation:function(){return ot.cancellation},monitoring:function(){return ot.monitoring},propagateFromFunction:function(){return et},boundValueFunction:function(){return h},checkForgottenReturns:d,setBounds:R,warn:y,deprecated:v,CapturedTrace:S,fireDomEvent:J,fireGlobalEvent:Y}}},{"./errors":12,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var i=function(){return r};return this.caught(n,i)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){function n(){return o(this)}function r(t,n){return i(t,n,e,e)}var i=t.reduce,o=t.all;t.prototype.each=function(t){return i(this,t,e,0)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,r){return i(t,r,e,0)._then(n,void 0,void 0,t,void 0)},t.mapSeries=r}},{}],12:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(p(this,"message","string"==typeof r?r:e),p(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return u(n,Error),n}function i(t){return this instanceof i?(p(this,"name","OperationalError"),p(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(p(this,"message",t.message),p(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(t)}var o,s,a=t("./es5"),c=a.freeze,l=t("./util"),u=l.inherits,p=l.notEnumerableProp,h=r("Warning","warning"),f=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),d=r("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(v){o=r("TypeError","type error"),s=r("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),m=0;m<y.length;++m)"function"==typeof Array.prototype[y[m]]&&(d.prototype[y[m]]=Array.prototype[y[m]]);a.defineProperty(d.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),d.prototype.isOperational=!0;var g=0;d.prototype.toString=function(){var t=Array(4*g+1).join(" "),e="\n"+t+"AggregateError of:\n";g++,t=Array(4*g+1).join(" ");for(var n=0;n<this.length;++n){for(var r=this[n]===this?"[Circular AggregateError]":this[n]+"",i=r.split("\n"),o=0;o<i.length;++o)i[o]=t+i[o];r=i.join("\n"),e+=r+"\n"}return g--,e},u(i,Error);var b=Error.__BluebirdErrorTypes__;b||(b=c({CancellationError:f,TimeoutError:_,OperationalError:i,RejectionError:i,AggregateError:d}),a.defineProperty(Error,"__BluebirdErrorTypes__",{value:b,writable:!1,enumerable:!1,configurable:!1})),e.exports={Error:Error,TypeError:o,RangeError:s,CancellationError:b.CancellationError,OperationalError:b.OperationalError,TimeoutError:b.TimeoutError,AggregateError:b.AggregateError,Warning:h}},{"./es5":13,"./util":36}],13:[function(t,e,n){var r=function(){"use strict";return void 0===this}();if(r)e.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:r,propertyIsWritable:function(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return!(n&&!n.writable&&!n.set)}};else{var i={}.hasOwnProperty,o={}.toString,s={}.constructor.prototype,a=function(t){var e=[];for(var n in t)i.call(t,n)&&e.push(n);return e},c=function(t,e){return{value:t[e]}},l=function(t,e,n){return t[e]=n.value,t},u=function(t){return t},p=function(t){try{return Object(t).constructor.prototype}catch(e){return s}},h=function(t){try{return"[object Array]"===o.call(t)}catch(e){return!1}};e.exports={isArray:h,keys:a,names:a,defineProperty:l,getDescriptor:c,freeze:u,getPrototypeOf:p,isES5:r,propertyIsWritable:function(){return!0}}}},{}],14:[function(t,e,n){"use strict";e.exports=function(t,e){var n=t.map;t.prototype.filter=function(t,r){return n(this,t,r,e)},t.filter=function(t,r,i){return n(t,r,i,e)}}},{}],15:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t,e,n){this.promise=t,this.type=e,this.handler=n,this.called=!1,this.cancelPromise=null}function o(t){this.finallyHandler=t}function s(t,e){return null!=t.cancelPromise?(arguments.length>1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function a(){return l.call(this,this.promise._target()._settledValue())}function c(t){return s(this,t)?void 0:(h.e=t,h)}function l(t){var i=this.promise,l=this.handler;if(!this.called){this.called=!0;var u=this.isFinallyHandler()?l.call(i._boundValue()):l.call(i._boundValue(),t);if(u===r)return u;if(void 0!==u){i._setReturnedNonUndefined();var f=n(u,i);if(f instanceof e){if(null!=this.cancelPromise){if(f._isCancelled()){var _=new p("late cancellation observer");return i._attachExtraTrace(_),h.e=_,h}f.isPending()&&f._attachCancellationCallback(new o(this))}return f._then(a,c,void 0,this,void 0)}}}return i.isRejected()?(s(this),h.e=t,h):(s(this),t)}var u=t("./util"),p=e.CancellationError,h=u.errorObj,f=t("./catch_filter")(r);return i.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){s(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new i(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,l,l)},e.prototype.tap=function(t){return this._passThrough(t,1,l)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,l);var r,i=new Array(n-1),o=0;for(r=0;n-1>r;++r){var s=arguments[r];if(!u.isObject(s))return e.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+u.classString(s)));i[o++]=s}i.length=o;var a=arguments[r];return this._passThrough(f(i,a,this),1,void 0,l)},i}},{"./catch_filter":7,"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r){for(var o=0;o<n.length;++o){r._pushContext();var s=f(n[o])(t);if(r._popContext(),s===h){r._pushContext();var a=e.reject(h.e);return r._popContext(),a}var c=i(s,r);if(c instanceof e)return c}return null}function c(t,n,i,o){if(s.cancellation()){var a=new e(r),c=this._finallyPromise=new e(r);this._promise=a.lastly(function(){return c}),a._captureStackTrace(),a._setOnCancel(this)}else{var l=this._promise=new e(r);l._captureStackTrace()}this._stack=o,this._generatorFunction=t,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(_):_,this._yieldedPromise=null,this._cancellationPhase=!1}var l=t("./errors"),u=l.TypeError,p=t("./util"),h=p.errorObj,f=p.tryCatch,_=[];p.inherits(c,o),c.prototype._isResolved=function(){return null===this._promise},c.prototype._cleanup=function(){this._promise=this._generator=null,s.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},c.prototype._promiseCancelled=function(){if(!this._isResolved()){var t,n="undefined"!=typeof this._generator["return"];if(n)this._promise._pushContext(),t=f(this._generator["return"]).call(this._generator,void 0),this._promise._popContext();else{var r=new e.CancellationError("generator .return() sentinel");e.coroutine.returnSentinel=r,this._promise._attachExtraTrace(r),this._promise._pushContext(),t=f(this._generator["throw"]).call(this._generator,r),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(t)}},c.prototype._promiseFulfilled=function(t){this._yieldedPromise=null,this._promise._pushContext();var e=f(this._generator.next).call(this._generator,t);this._promise._popContext(),this._continue(e)},c.prototype._promiseRejected=function(t){this._yieldedPromise=null,this._promise._attachExtraTrace(t),this._promise._pushContext();var e=f(this._generator["throw"]).call(this._generator,t);this._promise._popContext(),this._continue(e)},c.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof e){var t=this._yieldedPromise;this._yieldedPromise=null,t.cancel()}},c.prototype.promise=function(){return this._promise},c.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},c.prototype._continue=function(t){var n=this._promise;if(t===h)return this._cleanup(),this._cancellationPhase?n.cancel():n._rejectCallback(t.e,!1);var r=t.value;if(t.done===!0)return this._cleanup(),this._cancellationPhase?n.cancel():n._resolveCallback(r);var o=i(r,this._promise);if(!(o instanceof e)&&(o=a(o,this._yieldHandlers,this._promise),null===o))return void this._promiseRejected(new u("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s",String(r))+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")));o=o._target();var s=o._bitField;0===(50397184&s)?(this._yieldedPromise=o,o._proxy(this,null)):0!==(33554432&s)?e._async.invoke(this._promiseFulfilled,this,o._value()):0!==(16777216&s)?e._async.invoke(this._promiseRejected,this,o._reason()):this._promiseCancelled(); +},e.coroutine=function(t,e){if("function"!=typeof t)throw new u("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var n=Object(e).yieldHandler,r=c,i=(new Error).stack;return function(){var e=t.apply(this,arguments),o=new r(void 0,void 0,n,i),s=o.promise();return o._generator=e,o._promiseFulfilled(void 0),s}},e.coroutine.addYieldHandler=function(t){if("function"!=typeof t)throw new u("expecting a function but got "+p.classString(t));_.push(t)},e.spawn=function(t){if(s.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof t)return n("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var r=new c(t,this),i=r.promise();return r._run(e.spawn),i}}},{"./errors":12,"./util":36}],17:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){var a=t("./util");a.canEvaluate,a.tryCatch,a.errorObj;e.join=function(){var t,e=arguments.length-1;if(e>0&&"function"==typeof arguments[e]){t=arguments[e];var r}var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,e,n,r){this.constructor$(t),this._promise._captureStackTrace();var i=l();this._callback=null===i?e:u.domainBind(i,e),this._preservedValues=r===o?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0)}function c(t,n,i,o){if("function"!=typeof n)return r("expecting a function but got "+u.classString(n));var s=0;if(void 0!==i){if("object"!=typeof i||null===i)return e.reject(new TypeError("options argument must be an object but it is "+u.classString(i)));if("number"!=typeof i.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+u.classString(i.concurrency)));s=i.concurrency}return s="number"==typeof s&&isFinite(s)&&s>=1?s:0,new a(t,n,s,o).promise()}var l=e._getDomain,u=t("./util"),p=u.tryCatch,h=u.errorObj,f=e._async;u.inherits(a,n),a.prototype._asyncInit=function(){this._init$(void 0,-2)},a.prototype._init=function(){},a.prototype._promiseFulfilled=function(t,n){var r=this._values,o=this.length(),a=this._preservedValues,c=this._limit;if(0>n){if(n=-1*n-1,r[n]=t,c>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(c>=1&&this._inFlight>=c)return r[n]=t,this._queue.push(n),!1;null!==a&&(a[n]=t);var l=this._promise,u=this._callback,f=l._boundValue();l._pushContext();var _=p(u).call(f,t,n,o),d=l._popContext();if(s.checkForgottenReturns(_,d,null!==a?"Promise.filter":"Promise.map",l),_===h)return this._reject(_.e),!0;var v=i(_,this._promise);if(v instanceof e){v=v._target();var y=v._bitField;if(0===(50397184&y))return c>=1&&this._inFlight++,r[n]=v,v._proxy(this,-1*(n+1)),!1;if(0===(33554432&y))return 0!==(16777216&y)?(this._reject(v._reason()),!0):(this._cancel(),!0);_=v._value()}r[n]=_}var m=++this._totalResolved;return m>=o?(null!==a?this._filter(r,a):this._resolve(r),!0):!1},a.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlight<e;){if(this._isResolved())return;var r=t.pop();this._promiseFulfilled(n[r],r)}},a.prototype._filter=function(t,e){for(var n=e.length,r=new Array(n),i=0,o=0;n>o;++o)t[o]&&(r[i++]=e[o]);r.length=i,this._resolve(r)},a.prototype.preservedValues=function(){return this._preservedValues},e.prototype.map=function(t,e){return c(this,t,e,null)},e.map=function(t,e,n,r){return c(t,e,n,r)}}},{"./util":36}],19:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var s=t("./util"),a=s.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("expecting a function but got "+s.classString(t));return function(){var r=new e(n);r._captureStackTrace(),r._pushContext();var i=a(t).apply(this,arguments),s=r._popContext();return o.checkForgottenReturns(i,s,"Promise.method",r),r._resolveFromSyncValue(i),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return i("expecting a function but got "+s.classString(t));var r=new e(n);r._captureStackTrace(),r._pushContext();var c;if(arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],u=arguments[2];c=s.isArray(l)?a(t).apply(u,l):a(t).call(u,l)}else c=a(t)();var p=r._popContext();return o.checkForgottenReturns(c,p,"Promise.try",r),r._resolveFromSyncValue(c),r},e.prototype._resolveFromSyncValue=function(t){t===s.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&u.getPrototypeOf(t)===Error.prototype}function i(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=u.keys(t),i=0;i<n.length;++i){var o=n[i];p.test(o)||(e[o]=t[o])}return e}return s.markAsOriginatingFromRejection(t),t}function o(t,e){return function(n,r){if(null!==t){if(n){var o=i(a(n));t._attachExtraTrace(o),t._reject(o)}else if(e){var s=[].slice.call(arguments,1);t._fulfill(s)}else t._fulfill(r);t=null}}}var s=t("./util"),a=s.maybeWrapAsError,c=t("./errors"),l=c.OperationalError,u=t("./es5"),p=/^(?:name|message|stack|cause)$/;e.exports=o},{"./errors":12,"./es5":13,"./util":36}],21:[function(t,e,n){"use strict";e.exports=function(e){function n(t,e){var n=this;if(!o.isArray(t))return r.call(n,t,e);var i=a(e).apply(n._boundValue(),[null].concat(t));i===c&&s.throwLater(i.e)}function r(t,e){var n=this,r=n._boundValue(),i=void 0===t?a(e).call(r,null):a(e).call(r,null,t);i===c&&s.throwLater(i.e)}function i(t,e){var n=this;if(!t){var r=new Error(t+"");r.cause=t,t=r}var i=a(e).call(n._boundValue(),t);i===c&&s.throwLater(i.e)}var o=t("./util"),s=e._async,a=o.tryCatch,c=o.errorObj;e.prototype.asCallback=e.prototype.nodeify=function(t,e){if("function"==typeof t){var o=r;void 0!==e&&Object(e).spread&&(o=n),this._then(o,i,void 0,this,t)}return this}}},{"./util":36}],22:[function(t,e,n){"use strict";e.exports=function(){function n(){}function r(t,e){if(null==t||t.constructor!==i)throw new m("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof e)throw new m("expecting a function but got "+f.classString(e))}function i(t){t!==b&&r(this,t),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(t),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function o(t){this.promise._resolveCallback(t)}function s(t){this.promise._rejectCallback(t,!1)}function a(t){var e=new i(b);e._fulfillmentHandler0=t,e._rejectionHandler0=t,e._promise0=t,e._receiver0=t}var c,l=function(){return new m("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},u=function(){return new i.PromiseInspection(this._target())},p=function(t){return i.reject(new m(t))},h={},f=t("./util");c=f.isNode?function(){var t=process.domain;return void 0===t&&(t=null),t}:function(){return null},f.notEnumerableProp(i,"_getDomain",c);var _=t("./es5"),d=t("./async"),v=new d;_.defineProperty(i,"_async",{value:v});var y=t("./errors"),m=i.TypeError=y.TypeError;i.RangeError=y.RangeError;var g=i.CancellationError=y.CancellationError;i.TimeoutError=y.TimeoutError,i.OperationalError=y.OperationalError,i.RejectionError=y.OperationalError,i.AggregateError=y.AggregateError;var b=function(){},w={},C={},j=t("./thenables")(i,b),E=t("./promise_array")(i,b,j,p,n),k=t("./context")(i),F=k.create,x=t("./debuggability")(i,k),T=(x.CapturedTrace,t("./finally")(i,j,C)),P=t("./catch_filter")(C),R=t("./nodeback"),S=f.errorObj,O=f.tryCatch;return i.prototype.toString=function(){return"[object Promise]"},i.prototype.caught=i.prototype["catch"]=function(t){var e=arguments.length;if(e>1){var n,r=new Array(e-1),i=0;for(n=0;e-1>n;++n){var o=arguments[n];if(!f.isObject(o))return p("Catch statement predicate: expecting an object but got "+f.classString(o));r[i++]=o}return r.length=i,t=arguments[n],this.then(void 0,P(r,t,this))}return this.then(void 0,t)},i.prototype.reflect=function(){return this._then(u,u,void 0,this,void 0)},i.prototype.then=function(t,e){if(x.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+f.classString(t);arguments.length>1&&(n+=", "+f.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},i.prototype.spread=function(t){return"function"!=typeof t?p("expecting a function but got "+f.classString(t)):this.all()._then(t,void 0,void 0,w,void 0)},i.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new E(this).promise()},i.prototype.error=function(t){return this.caught(f.originatesFromRejection,t)},i.getNewLibraryCopy=e.exports,i.is=function(t){return t instanceof i},i.fromNode=i.fromCallback=function(t){var e=new i(b);e._captureStackTrace();var n=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=O(t)(R(e,n));return r===S&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},i.all=function(t){return new E(t).promise()},i.cast=function(t){var e=j(t);return e instanceof i||(e=new i(b),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(b);return e._captureStackTrace(),e._rejectCallback(t,!0),e},i.setScheduler=function(t){if("function"!=typeof t)throw new m("expecting a function but got "+f.classString(t));return v.setScheduler(t)},i.prototype._then=function(t,e,n,r,o){var s=void 0!==o,a=s?o:new i(b),l=this._target(),u=l._bitField;s||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var p=c();if(0!==(50397184&u)){var h,_,d=l._settlePromiseCtx;0!==(33554432&u)?(_=l._rejectionHandler0,h=t):0!==(16777216&u)?(_=l._fulfillmentHandler0,h=e,l._unsetRejectionIsUnhandled()):(d=l._settlePromiseLateCancellationObserver,_=new g("late cancellation observer"),l._attachExtraTrace(_),h=e),v.invoke(d,l,{handler:null===p?h:"function"==typeof h&&f.domainBind(p,h),promise:a,receiver:r,value:_})}else l._addCallbacks(t,e,a,r,p);return a},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},i.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){v.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===h?void 0:void 0===e&&this._isBound()?this._boundValue():e},i.prototype._promiseAt=function(t){return this[4*t-4+2]},i.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},i.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,i=t._receiverAt(0);void 0===i&&(i=h),this._addCallbacks(e,n,r,i,null)},i.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=h),this._addCallbacks(n,r,i,o,null)},i.prototype._addCallbacks=function(t,e,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:f.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:f.domainBind(i,e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=null===i?t:f.domainBind(i,t)),"function"==typeof e&&(this[s+1]=null===i?e:f.domainBind(i,e))}return this._setLength(o+1),o},i.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},i.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(l(),!1);var n=j(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(l());var o=r._bitField;if(0===(50397184&o)){var s=this._length();s>0&&r._migrateCallback0(this);for(var a=1;s>a;++a)r._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(r)}else if(0!==(33554432&o))this._fulfill(r._value());else if(0!==(16777216&o))this._reject(r._reason());else{var c=new g("late cancellation observer");r._attachExtraTrace(c),this._reject(c)}}},i.prototype._rejectCallback=function(t,e,n){var r=f.ensureErrorObject(t),i=r===t;if(!i&&!n&&x.warnings()){var o="a promise was rejected with a non-error: "+f.classString(t);this._warn(o,!0)}this._attachExtraTrace(r,e?i:!1),this._reject(t)},i.prototype._resolveFromExecutor=function(t){if(t!==b){var e=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)});n=!1,this._popContext(),void 0!==r&&e._rejectCallback(r,!0)}},i.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0===(65536&i)){r._pushContext();var o;e===w?n&&"number"==typeof n.length?o=O(t).apply(this._boundValue(),n):(o=S,o.e=new m("cannot .spread() a non-array: "+f.classString(n))):o=O(t).call(e,n);var s=r._popContext();i=r._bitField,0===(65536&i)&&(o===C?r._reject(n):o===S?r._rejectCallback(o.e,!1):(x.checkForgottenReturns(o,s,"",r,this),r._resolveCallback(o)))}},i.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},i.prototype._followee=function(){return this._rejectionHandler0},i.prototype._setFollowee=function(t){this._rejectionHandler0=t},i.prototype._settlePromise=function(t,e,r,o){var s=t instanceof i,a=this._bitField,c=0!==(134217728&a);0!==(65536&a)?(s&&t._invokeInternalOnCancel(),r instanceof T&&r.isFinallyHandler()?(r.cancelPromise=t,O(e).call(r,o)===S&&t._reject(S.e)):e===u?t._fulfill(u.call(r)):r instanceof n?r._promiseCancelled(t):s||t instanceof E?t._cancel():r.cancel()):"function"==typeof e?s?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,o,t)):e.call(r,o,t):r instanceof n?r._isResolved()||(0!==(33554432&a)?r._promiseFulfilled(o,t):r._promiseRejected(o,t)):s&&(c&&t._setAsyncGuaranteed(),0!==(33554432&a)?t._fulfill(o):t._reject(o))},i.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,o=t.value;"function"==typeof e?n instanceof i?this._settlePromiseFromHandler(e,r,o,n):e.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},i.prototype._settlePromise0=function(t,e,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,i,e)},i.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},i.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=l();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():v.settlePromises(this))}},i.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?v.fatalError(t,f.isNode):void((65535&e)>0?v.settlePromises(this):this._ensurePossibleRejectionHandled())},i.prototype._fulfillPromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._rejectPromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},i.defer=i.pending=function(){x.deprecated("Promise.defer","new Promise");var t=new i(b);return{promise:t,resolve:o,reject:s}},f.notEnumerableProp(i,"_makeSelfResolutionError",l),t("./method")(i,b,j,p,x),t("./bind")(i,b,j,x),t("./cancel")(i,E,p,x),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,E,j,b,v,c),i.Promise=i,i.version="3.5.1",t("./map.js")(i,E,p,j,b,x),t("./call_get.js")(i),t("./using.js")(i,p,j,F,b,x),t("./timers.js")(i,b,x),t("./generators.js")(i,p,b,j,n,x),t("./nodeify.js")(i),t("./promisify.js")(i,b),t("./props.js")(i,E,j,p),t("./race.js")(i,b,j,p),t("./reduce.js")(i,E,p,j,b,x),t("./settle.js")(i,E,x),t("./some.js")(i,E,p),t("./filter.js")(i,b),t("./each.js")(i,b),t("./any.js")(i),f.toFastProperties(i),f.toFastProperties(i.prototype),a({a:1}),a({b:2}),a({c:3}),a(1),a(function(){}),a(void 0),a(!1),a(new i(b)),x.setBounds(d.firstLineError,f.lastLineError),i}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){function s(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function a(t){var r=this._promise=new e(n);t instanceof e&&r._propagateFrom(t,3),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var c=t("./util");c.isArray;return c.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function l(t,n){var o=r(this._values,this._promise);if(o instanceof e){o=o._target();var a=o._bitField;if(this._values=o,0===(50397184&a))return this._promise._setAsyncGuaranteed(),o._then(l,this._reject,void 0,this,n);if(0===(33554432&a))return 0!==(16777216&a)?this._reject(o._reason()):this._cancel();o=o._value()}if(o=c.asArray(o),null===o){var u=i("expecting an array or an iterable object but got "+c.classString(o)).reason();return void this._promise._rejectCallback(u,!1)}return 0===o.length?void(-5===n?this._resolveEmptyArray():this._resolve(s(n))):void this._iterate(o)},a.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,s=null,a=0;n>a;++a){var c=r(t[a],i);c instanceof e?(c=c._target(),s=c._bitField):s=null,o?null!==s&&c.suppressUnhandledRejections():null!==s?0===(50397184&s)?(c._proxy(this,a),this._values[a]=c):o=0!==(33554432&s)?this._promiseFulfilled(c._value(),a):0!==(16777216&s)?this._promiseRejected(c._reason(),a):this._promiseCancelled(a):o=this._promiseFulfilled(c,a)}o||i._setAsyncGuaranteed()},a.prototype._isResolved=function(){return null===this._values},a.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},a.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},a.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},a.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n<t.length;++n)t[n]instanceof e&&t[n].cancel()}},a.prototype.shouldCopyValues=function(){return!0},a.prototype.getActualLength=function(t){return t},a}},{"./util":36}],24:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t){return!C.test(t)}function i(t){try{return t.__isPromisified__===!0}catch(e){return!1}}function o(t,e,n){var r=f.getDataPropertyOrDefault(t,e+n,b);return r?i(r):!1}function s(t,e,n){for(var r=0;r<t.length;r+=2){var i=t[r];if(n.test(i))for(var o=i.replace(n,""),s=0;s<t.length;s+=2)if(t[s]===o)throw new m("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s",e))}}function a(t,e,n,r){for(var a=f.inheritedDataKeys(t),c=[],l=0;l<a.length;++l){var u=a[l],p=t[u],h=r===j?!0:j(u,p,t);"function"!=typeof p||i(p)||o(t,u,e)||!r(u,p,t,h)||c.push(u,p)}return s(c,e,n),c}function c(t,r,i,o,s,a){function c(){var i=r;r===h&&(i=this);var o=new e(n);o._captureStackTrace();var s="string"==typeof u&&this!==l?this[u]:t,c=_(o,a);try{s.apply(i,d(arguments,c))}catch(p){o._rejectCallback(v(p),!0,!0)}return o._isFateSealed()||o._setAsyncGuaranteed(),o}var l=function(){return this}(),u=t;return"string"==typeof u&&(t=o),f.notEnumerableProp(c,"__isPromisified__",!0),c}function l(t,e,n,r,i){for(var o=new RegExp(E(e)+"$"),s=a(t,e,o,n),c=0,l=s.length;l>c;c+=2){var u=s[c],p=s[c+1],_=u+e;if(r===k)t[_]=k(u,h,u,p,e,i);else{var d=r(p,function(){return k(u,h,u,p,e,i)});f.notEnumerableProp(d,"__isPromisified__",!0),t[_]=d}}return f.toFastProperties(t),t}function u(t,e,n){return k(t,e,void 0,t,null,n)}var p,h={},f=t("./util"),_=t("./nodeback"),d=f.withAppended,v=f.maybeWrapAsError,y=f.canEvaluate,m=t("./errors").TypeError,g="Async",b={__isPromisified__:!0},w=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],C=new RegExp("^(?:"+w.join("|")+")$"),j=function(t){return f.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t},E=function(t){return t.replace(/([$])/,"\\$")},k=y?p:c;e.promisify=function(t,e){if("function"!=typeof t)throw new m("expecting a function but got "+f.classString(t));if(i(t))return t;e=Object(e);var n=void 0===e.context?h:e.context,o=!!e.multiArgs,s=u(t,n,o);return f.copyDescriptors(t,s,r),s},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new m("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");e=Object(e);var n=!!e.multiArgs,r=e.suffix;"string"!=typeof r&&(r=g);var i=e.filter;"function"!=typeof i&&(i=j);var o=e.promisifier;if("function"!=typeof o&&(o=k),!f.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=f.inheritedDataKeys(t),a=0;a<s.length;++a){var c=t[s[a]];"constructor"!==s[a]&&f.isClass(c)&&(l(c.prototype,r,i,o,n),l(c,r,i,o,n))}return l(t,r,i,o,n)}}},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t){var e,n=!1;if(void 0!==a&&t instanceof a)e=p(t),n=!0;else{var r=u.keys(t),i=r.length;e=new Array(2*i);for(var o=0;i>o;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._isMap=n,this._init$(void 0,n?-6:-3)}function s(t){var n,s=r(t);return l(s)?(n=s instanceof e?s._then(e.props,void 0,void 0,void 0,void 0):new o(s).promise(),s instanceof e&&n._propagateFrom(s,2),n):i("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}var a,c=t("./util"),l=c.isObject,u=t("./es5");"function"==typeof Map&&(a=Map);var p=function(){function t(t,r){this[e]=t,this[e+n]=r,e++}var e=0,n=0;return function(r){n=r.size,e=0;var i=new Array(2*r.size);return r.forEach(t,i),i}}(),h=function(t){for(var e=new a,n=t.length/2|0,r=0;n>r;++r){var i=t[n+r],o=t[r];e.set(i,o)}return e};c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;if(n>=this._length){var r;if(this._isMap)r=h(this._values);else{r={};for(var i=this.length(),o=0,s=this.length();s>o;++o)r[this._values[o+i]]=this._values[o]}return this._resolve(r),!0}return!1},o.prototype.shouldCopyValues=function(){return!1},o.prototype.getActualLength=function(t){return t>>1},e.prototype.props=function(){return s(this)},e.props=function(t){return s(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function r(t,e,n,r,i){for(var o=0;i>o;++o)n[o+r]=t[o+e],t[o+e]=void 0}function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacity<t},i.prototype._pushOne=function(t){var e=this.length();this._checkCapacity(e+1);var n=this._front+e&this._capacity-1;this[n]=t,this._length=e+1},i.prototype.push=function(t,e,n){var r=this.length()+3;if(this._willBeOverCapacity(r))return this._pushOne(t),this._pushOne(e),void this._pushOne(n);var i=this._front+r-3;this._checkCapacity(r);var o=this._capacity-1;this[i+0&o]=t,this[i+1&o]=e,this[i+2&o]=n,this._length=r},i.prototype.shift=function(){var t=this._front,e=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,e},i.prototype.length=function(){return this._length},i.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},i.prototype._resizeTo=function(t){var e=this._capacity;this._capacity=t;var n=this._front,i=this._length,o=n+i&e-1;r(this,0,this,e,o)},e.exports=i},{}],27:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t,o){var c=r(t);if(c instanceof e)return a(c);if(t=s.asArray(t),null===t)return i("expecting an array or an iterable object but got "+s.classString(t));var l=new e(n);void 0!==o&&l._propagateFrom(o,3);for(var u=l._fulfill,p=l._reject,h=0,f=t.length;f>h;++h){var _=t[h];(void 0!==_||h in t)&&e.cast(_)._then(u,p,void 0,l,null)}return l}var s=t("./util"),a=function(t){return t.then(function(e){return o(e,t)})};e.race=function(t){return o(t,void 0)},e.prototype.race=function(){return o(this,void 0)}}},{"./util":36}],28:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r,i){this.constructor$(t);var s=h();this._fn=null===s?n:f.domainBind(s,n),void 0!==r&&(r=e.resolve(r),r._attachCancellationCallback(this)),this._initialValue=r,this._currentCancellable=null,i===o?this._eachValues=Array(this._length):0===i?this._eachValues=null:this._eachValues=void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function c(t,e){this.isFulfilled()?e._resolve(t):e._reject(t)}function l(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+f.classString(e));var o=new a(t,e,n,i);return o.promise()}function u(t){this.accum=t,this.array._gotAccum(t);var n=i(this.value,this.array._promise);return n instanceof e?(this.array._currentCancellable=n,n._then(p,void 0,void 0,this,void 0)):p.call(this,n)}function p(t){var n=this.array,r=n._promise,i=_(n._fn);r._pushContext();var o;o=void 0!==n._eachValues?i.call(r._boundValue(),t,this.index,this.length):i.call(r._boundValue(),this.accum,t,this.index,this.length),o instanceof e&&(n._currentCancellable=o);var a=r._popContext();return s.checkForgottenReturns(o,a,void 0!==n._eachValues?"Promise.each":"Promise.reduce",r),o}var h=e._getDomain,f=t("./util"),_=f.tryCatch;f.inherits(a,n),a.prototype._gotAccum=function(t){void 0!==this._eachValues&&null!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){return null!==this._eachValues&&this._eachValues.push(t),this._eachValues},a.prototype._init=function(){},a.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},a.prototype.shouldCopyValues=function(){return!1},a.prototype._resolve=function(t){this._promise._resolveCallback(t),this._values=null},a.prototype._resultCancelled=function(t){return t===this._initialValue?this._cancel():void(this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof e&&this._currentCancellable.cancel(),this._initialValue instanceof e&&this._initialValue.cancel()))},a.prototype._iterate=function(t){this._values=t;var n,r,i=t.length;if(void 0!==this._initialValue?(n=this._initialValue,r=0):(n=e.resolve(t[0]),r=1),this._currentCancellable=n,!n.isRejected())for(;i>r;++r){var o={accum:null,value:t[r],index:r,length:i,array:this};n=n._then(u,void 0,void 0,o,void 0)}void 0!==this._eachValues&&(n=n._then(this._eachComplete,void 0,void 0,this,void 0)),n._then(c,c,void 0,n,this)},e.prototype.reduce=function(t,e){return l(this,t,e,null)},e.reduce=function(t,e,n,r){return l(t,e,n,r)}}},{"./util":36}],29:[function(t,e,n){"use strict";var r,i=t("./util"),o=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")},s=i.getNativePromise();if(i.isNode&&"undefined"==typeof MutationObserver){var a=global.setImmediate,c=process.nextTick;r=i.isRecentNode?function(t){a.call(global,t)}:function(t){c.call(process,t)}}else if("function"==typeof s&&"function"==typeof s.resolve){var l=s.resolve();r=function(t){l.then(t)}}else r="undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)?"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:o:function(){var t=document.createElement("div"),e={attributes:!0},n=!1,r=document.createElement("div"),i=new MutationObserver(function(){t.classList.toggle("foo"),n=!1});i.observe(r,e);var o=function(){n||(n=!0,r.classList.toggle("foo"))};return function(n){var r=new MutationObserver(function(){r.disconnect(),n()});r.observe(t,e),o()}}();e.exports=r},{"./util":36}],30:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t)}var o=e.PromiseInspection,s=t("./util");s.inherits(i,n),i.prototype._promiseResolved=function(t,e){this._values[t]=e;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},i.prototype._promiseFulfilled=function(t,e){var n=new o;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},i.prototype._promiseRejected=function(t,e){var n=new o;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return r.deprecated(".settle()",".reflect()"),new i(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t), +this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(t,e){if((0|e)!==e||0>e)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new i(t),o=n.promise();return n.setHowMany(e),n.init(),o}var s=t("./util"),a=t("./errors").RangeError,c=t("./errors").AggregateError,l=s.isArray,u={};s.inherits(i,n),i.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var t=l(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(t){this._howMany=t},i.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()?(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0):!1},i.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},i.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(u),this._checkOutcome())},i.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new c,e=this.length();e<this._values.length;++e)this._values[e]!==u&&t.push(this._values[e]);return t.length>0?this._reject(t):this._cancel(),!0}return!1},i.prototype._fulfilled=function(){return this._totalResolved},i.prototype._rejected=function(){return this._values.length-this.length()},i.prototype._addRejected=function(t){this._values.push(t)},i.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},i.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},i.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new a(e)},i.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return o(t,e)},e.prototype.some=function(t){return o(this,t)},e._SomePromiseArray=i}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},s=e.prototype.isPending=function(){return 0===(50397184&this._bitField)},a=e.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!==(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536===(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!==(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,r){if(u(t)){if(t instanceof e)return t;var i=o(t);if(i===l){r&&r._pushContext();var c=e.reject(i.e);return r&&r._popContext(),c}if("function"==typeof i){if(s(t)){var c=new e(n);return t._then(c._fulfill,c._reject,void 0,c,null),c}return a(t,i,r)}}return t}function i(t){return t.then}function o(t){try{return i(t)}catch(e){return l.e=e,l}}function s(t){try{return p.call(t,"_promise0")}catch(e){return!1}}function a(t,r,i){function o(t){a&&(a._resolveCallback(t),a=null)}function s(t){a&&(a._rejectCallback(t,p,!0),a=null)}var a=new e(n),u=a;i&&i._pushContext(),a._captureStackTrace(),i&&i._popContext();var p=!0,h=c.tryCatch(r).call(t,o,s);return p=!1,a&&h===l&&(a._rejectCallback(h.e,!0,!0),a=null),u}var c=t("./util"),l=c.errorObj,u=c.isObject,p={}.hasOwnProperty;return r}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.handle=t}function o(t){return clearTimeout(this.handle),t}function s(t){throw clearTimeout(this.handle),t}var a=t("./util"),c=e.TimeoutError;i.prototype._resultCancelled=function(){clearTimeout(this.handle)};var l=function(t){return u(+this).thenReturn(t)},u=e.delay=function(t,o){var s,a;return void 0!==o?(s=e.resolve(o)._then(l,null,null,t,void 0),r.cancellation()&&o instanceof e&&s._setOnCancel(o)):(s=new e(n),a=setTimeout(function(){s._fulfill()},+t),r.cancellation()&&s._setOnCancel(new i(a)),s._captureStackTrace()),s._setAsyncGuaranteed(),s};e.prototype.delay=function(t){return u(t,this)};var p=function(t,e,n){var r;r="string"!=typeof e?e instanceof Error?e:new c("operation timed out"):new c(e),a.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._reject(r),null!=n&&n.cancel()};e.prototype.timeout=function(t,e){t=+t;var n,a,c=new i(setTimeout(function(){n.isPending()&&p(n,e,a)},t));return r.cancellation()?(a=this.then(),n=a._then(o,s,void 0,c,void 0),n._setOnCancel(c)):n=this._then(o,s,void 0,c,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t){setTimeout(function(){throw t},0)}function c(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}function l(t,n){function i(){if(s>=l)return u._fulfill();var o=c(t[s++]);if(o instanceof e&&o._isDisposable()){try{o=r(o._getDisposer().tryDispose(n),t.promise)}catch(p){return a(p)}if(o instanceof e)return o._then(i,a,null,null,null)}i()}var s=0,l=t.length,u=new e(o);return i(),u}function u(t,e,n){this._data=t,this._promise=e,this._context=n}function p(t,e,n){this.constructor$(t,e,n)}function h(t){return u.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function f(t){this.length=t,this.promise=null,this[t-1]=null}var _=t("./util"),d=t("./errors").TypeError,v=t("./util").inherits,y=_.errorObj,m=_.tryCatch,g={};u.prototype.data=function(){return this._data},u.prototype.promise=function(){return this._promise},u.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():g},u.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=e!==g?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},u.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},v(p,u),p.prototype.doDispose=function(t,e){var n=this.data();return n.call(t,t,e)},f.prototype._resultCancelled=function(){for(var t=this.length,n=0;t>n;++n){var r=this[n];r instanceof e&&r.cancel()}},e.using=function(){var t=arguments.length;if(2>t)return n("you must pass at least 2 arguments to Promise.using");var i=arguments[t-1];if("function"!=typeof i)return n("expecting a function but got "+_.classString(i));var o,a=!0;2===t&&Array.isArray(arguments[0])?(o=arguments[0],t=o.length,a=!1):(o=arguments,t--);for(var c=new f(t),p=0;t>p;++p){var d=o[p];if(u.isDisposer(d)){var v=d;d=d.promise(),d._setDisposable(v)}else{var g=r(d);g instanceof e&&(d=g._then(h,null,null,{resources:c,index:p},void 0))}c[p]=d}for(var b=new Array(c.length),p=0;p<b.length;++p)b[p]=e.resolve(c[p]).reflect();var w=e.all(b).then(function(t){for(var e=0;e<t.length;++e){var n=t[e];if(n.isRejected())return y.e=n.error(),y;if(!n.isFulfilled())return void w.cancel();t[e]=n.value()}C._pushContext(),i=m(i);var r=a?i.apply(void 0,t):i(t),o=C._popContext();return s.checkForgottenReturns(r,o,"Promise.using",C),r}),C=w.lastly(function(){var t=new e.PromiseInspection(w);return l(c,t)});return c.promise=C,C._setOnCancel(c),C},e.prototype._setDisposable=function(t){this._bitField=131072|this._bitField,this._disposer=t},e.prototype._isDisposable=function(){return(131072&this._bitField)>0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,n){"use strict";function r(){try{var t=P;return P=null,t.apply(this,arguments)}catch(e){return T.e=e,T}}function i(t){return P=t,r}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return o(t)?new Error(v(t)):t}function c(t,e){var n,r=t.length,i=new Array(r+1);for(n=0;r>n;++n)i[n]=t[n];return i[n]=e,i}function l(t,e,n){if(!F.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function u(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return F.defineProperty(t,e,r),t}function p(t){throw t}function h(t){try{if("function"==typeof t){var e=F.names(t.prototype),n=F.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=A.test(t+"")&&F.names(t).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function f(t){function e(){}e.prototype=t;for(var n=8;n--;)new e;return t}function _(t){return D.test(t)}function d(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return t instanceof Error||null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function m(t){try{u(t,"isOperational",!0)}catch(e){}}function g(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function b(t){return y(t)&&F.propertyIsWritable(t,"stack")}function w(t){return{}.toString.call(t)}function C(t,e,n){for(var r=F.names(t),i=0;i<r.length;++i){var o=r[i];if(n(o))try{F.defineProperty(e,o,F.getDescriptor(t,o))}catch(s){}}}function j(t){return N?process.env[t]:void 0}function E(){if("function"==typeof Promise)try{var t=new Promise(function(){});if("[object Promise]"==={}.toString.call(t))return Promise}catch(e){}}function k(t,e){return t.bind(e)}var F=t("./es5"),x="undefined"==typeof navigator,T={e:{}},P,R="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0!==this?this:null,S=function(t,e){function n(){this.constructor=t,this.constructor$=e;for(var n in e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}var r={}.hasOwnProperty;return n.prototype=e.prototype,t.prototype=new n,t.prototype},O=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var n=0;n<t.length;++n)if(t[n]===e)return!0;return!1};if(F.isES5){var n=Object.getOwnPropertyNames;return function(t){for(var r=[],i=Object.create(null);null!=t&&!e(t);){var o;try{o=n(t)}catch(s){return r}for(var a=0;a<o.length;++a){var c=o[a];if(!i[c]){i[c]=!0;var l=Object.getOwnPropertyDescriptor(t,c);null!=l&&null==l.get&&null==l.set&&r.push(c)}}t=F.getPrototypeOf(t)}return r}}var r={}.hasOwnProperty;return function(n){if(e(n))return[];var i=[];t:for(var o in n)if(r.call(n,o))i.push(o);else{for(var s=0;s<t.length;++s)if(r.call(t[s],o))continue t;i.push(o)}return i}}(),A=/this\s*\.\s*\S+\s*=/,D=/^[a-z$_][a-z$_0-9]*$/i,V=function(){return"stack"in new Error?function(t){return b(t)?t:new Error(v(t))}:function(t){if(b(t))return t;try{throw new Error(v(t))}catch(e){return e}}}(),I=function(t){return F.isArray(t)?t:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var L="function"==typeof Array.from?function(t){return Array.from(t)}:function(t){for(var e,n=[],r=t[Symbol.iterator]();!(e=r.next()).done;)n.push(e.value);return n};I=function(t){return F.isArray(t)?t:null!=t&&"function"==typeof t[Symbol.iterator]?L(t):null}}var H="undefined"!=typeof process&&"[object process]"===w(process).toLowerCase(),N="undefined"!=typeof process&&"undefined"!=typeof process.env,B={isClass:h,isIdentifier:_,inheritedDataKeys:O,getDataPropertyOrDefault:l,thrower:p,isArray:F.isArray,asArray:I,notEnumerableProp:u,isPrimitive:o,isObject:s,isError:y,canEvaluate:x,errorObj:T,tryCatch:i,inherits:S,withAppended:c,maybeWrapAsError:a,toFastProperties:f,filledRange:d,toString:v,canAttachTrace:b,ensureErrorObject:V,originatesFromRejection:g,markAsOriginatingFromRejection:m,classString:w,copyDescriptors:C,hasDevTools:"undefined"!=typeof chrome&&chrome&&"function"==typeof chrome.loadTimes,isNode:H,hasEnvVariables:N,env:j,global:R,getNativePromise:E,domainBind:k};B.isRecentNode=B.isNode&&function(){var t=process.versions.node.split(".").map(Number);return 0===t[0]&&t[1]>10||t[0]>0}(),B.isNode&&B.toFastProperties(process);try{throw new Error}catch(U){B.lastLineError=U}e.exports=B},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise);
\ No newline at end of file diff --git a/deps/npm/node_modules/bluebird/js/release/debuggability.js b/deps/npm/node_modules/bluebird/js/release/debuggability.js index bf0587ce7d4..69568041311 100644 --- a/deps/npm/node_modules/bluebird/js/release/debuggability.js +++ b/deps/npm/node_modules/bluebird/js/release/debuggability.js @@ -38,7 +38,10 @@ Promise.prototype.suppressUnhandledRejections = function() { Promise.prototype._ensurePossibleRejectionHandled = function () { if ((this._bitField & 524288) !== 0) return; this._setRejectionIsUnhandled(); - async.invokeLater(this._notifyUnhandledRejection, this, undefined); + var self = this; + setTimeout(function() { + self._notifyUnhandledRejection(); + }, 1); }; Promise.prototype._notifyUnhandledRejectionIsHandled = function () { diff --git a/deps/npm/node_modules/bluebird/js/release/promise.js b/deps/npm/node_modules/bluebird/js/release/promise.js index 2a1d002adfb..6ef173ef60c 100644 --- a/deps/npm/node_modules/bluebird/js/release/promise.js +++ b/deps/npm/node_modules/bluebird/js/release/promise.js @@ -733,7 +733,7 @@ require("./synchronous_inspection")(Promise); require("./join")( Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); Promise.Promise = Promise; -Promise.version = "3.5.0"; +Promise.version = "3.5.1"; require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); require('./call_get.js')(Promise); require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); diff --git a/deps/npm/node_modules/bluebird/js/release/util.js b/deps/npm/node_modules/bluebird/js/release/util.js index 84c28ec4759..7ac0e2fa198 100644 --- a/deps/npm/node_modules/bluebird/js/release/util.js +++ b/deps/npm/node_modules/bluebird/js/release/util.js @@ -223,10 +223,11 @@ function safeToString(obj) { } function isError(obj) { - return obj !== null && + return obj instanceof Error || + (obj !== null && typeof obj === "object" && typeof obj.message === "string" && - typeof obj.name === "string"; + typeof obj.name === "string"); } function markAsOriginatingFromRejection(e) { diff --git a/deps/npm/node_modules/bluebird/package.json b/deps/npm/node_modules/bluebird/package.json index 34a878be3cb..524230df6d9 100644 --- a/deps/npm/node_modules/bluebird/package.json +++ b/deps/npm/node_modules/bluebird/package.json @@ -1,42 +1,42 @@ { - "_from": "bluebird@~3.5.0", - "_id": "bluebird@3.5.0", - "_integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw=", + "_from": "bluebird@latest", + "_id": "bluebird@3.5.1", + "_inBundle": false, + "_integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", "_location": "/bluebird", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "tag", "registry": true, - "raw": "bluebird@~3.5.0", + "raw": "bluebird@latest", "name": "bluebird", "escapedName": "bluebird", - "rawSpec": "~3.5.0", + "rawSpec": "latest", "saveSpec": null, - "fetchSpec": "~3.5.0" + "fetchSpec": "latest" }, "_requiredBy": [ + "#USER", "/", + "/bin-links", "/cacache", "/pacote", "/tap" ], - "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz", - "_shasum": "791420d7f551eea2897453a8a77653f96606d67c", - "_shrinkwrap": null, - "_spec": "bluebird@~3.5.0", + "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", + "_shasum": "d9551f9de98f1fcda1e683d17ee91a0602ee2eb9", + "_spec": "bluebird@latest", "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Petka Antonov", "email": "petka_antonov@hotmail.com", "url": "http://github.com/petkaantonov/" }, - "bin": null, "browser": "./js/browser/bluebird.js", "bugs": { "url": "http://github.com/petkaantonov/bluebird/issues" }, "bundleDependencies": false, - "dependencies": {}, "deprecated": false, "description": "Full featured Promises/A+ implementation with exceptionally good performance", "devDependencies": { @@ -89,8 +89,6 @@ "license": "MIT", "main": "./js/release/bluebird.js", "name": "bluebird", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git://github.com/petkaantonov/bluebird.git" @@ -103,6 +101,6 @@ "prepublish": "npm run generate-browser-core && npm run generate-browser-full", "test": "node tools/test.js" }, - "version": "3.5.0", + "version": "3.5.1", "webpack": "./js/release/bluebird.js" } diff --git a/deps/npm/node_modules/cacache/CHANGELOG.md b/deps/npm/node_modules/cacache/CHANGELOG.md index 9e8f8d6ddde..0903d1d5780 100644 --- a/deps/npm/node_modules/cacache/CHANGELOG.md +++ b/deps/npm/node_modules/cacache/CHANGELOG.md @@ -2,6 +2,46 @@ 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="10.0.1"></a> +## [10.0.1](https://github.com/zkat/cacache/compare/v10.0.0...v10.0.1) (2017-11-15) + + +### Bug Fixes + +* **move-file:** actually use the fallback to `move-concurrently` (#110) ([073fbe1](https://github.com/zkat/cacache/commit/073fbe1)) + + + +<a name="10.0.0"></a> +# [10.0.0](https://github.com/zkat/cacache/compare/v9.3.0...v10.0.0) (2017-10-23) + + +### Features + +* **license:** relicense to ISC (#111) ([fdbb4e5](https://github.com/zkat/cacache/commit/fdbb4e5)) + + +### Performance Improvements + +* more copyFile benchmarks ([63787bb](https://github.com/zkat/cacache/commit/63787bb)) + + +### BREAKING CHANGES + +* **license:** the license has been changed from CC0-1.0 to ISC. + + + +<a name="9.3.0"></a> +# [9.3.0](https://github.com/zkat/cacache/compare/v9.2.9...v9.3.0) (2017-10-07) + + +### Features + +* **copy:** added cacache.get.copy api for fast copies (#107) ([067b5f6](https://github.com/zkat/cacache/commit/067b5f6)) + + + <a name="9.2.9"></a> ## [9.2.9](https://github.com/zkat/cacache/compare/v9.2.8...v9.2.9) (2017-06-17) diff --git a/deps/npm/node_modules/cacache/LICENSE.md b/deps/npm/node_modules/cacache/LICENSE.md index c05cb09586f..8d28acf866d 100644 --- a/deps/npm/node_modules/cacache/LICENSE.md +++ b/deps/npm/node_modules/cacache/LICENSE.md @@ -1,3 +1,16 @@ -To the extent possible under law, maintainers for this project have waived all copyright and related or neighboring rights to this project. +ISC License -For more information on this waiver, see: https://creativecommons.org/publicdomain/zero/1.0/ +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/cacache/README.es.md b/deps/npm/node_modules/cacache/README.es.md new file mode 100644 index 00000000000..783a0a19b01 --- /dev/null +++ b/deps/npm/node_modules/cacache/README.es.md @@ -0,0 +1,628 @@ +# cacache [![npm version](https://img.shields.io/npm/v/cacache.svg)](https://npm.im/cacache) [![license](https://img.shields.io/npm/l/cacache.svg)](https://npm.im/cacache) [![Travis](https://img.shields.io/travis/zkat/cacache.svg)](https://travis-ci.org/zkat/cacache) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/cacache?svg=true)](https://ci.appveyor.com/project/zkat/cacache) [![Coverage Status](https://coveralls.io/repos/github/zkat/cacache/badge.svg?branch=latest)](https://coveralls.io/github/zkat/cacache?branch=latest) + +[`cacache`](https://github.com/zkat/cacache) es una librería de Node.js para +manejar caches locales en disco, con acceso tanto con claves únicas como +direcciones de contenido (hashes/hacheos). Es súper rápida, excelente con el +acceso concurrente, y jamás te dará datos incorrectos, aún si se corrompen o +manipulan directamente los ficheros del cache. + +El propósito original era reemplazar el caché local de +[npm](https://npm.im/npm), pero se puede usar por su propia cuenta. + +_Traducciones: [English](README.md)_ + +## Instalación + +`$ npm install --save cacache` + +## Índice + +* [Ejemplo](#ejemplo) +* [Características](#características) +* [Cómo Contribuir](#cómo-contribuir) +* [API](#api) + * [Usando el API en español](#localized-api) + * Leer + * [`ls`](#ls) + * [`ls.flujo`](#ls-stream) + * [`saca`](#get-data) + * [`saca.flujo`](#get-stream) + * [`saca.info`](#get-info) + * [`saca.tieneDatos`](#get-hasContent) + * Escribir + * [`mete`](#put-data) + * [`mete.flujo`](#put-stream) + * [opciones para `mete*`](#put-options) + * [`rm.todo`](#rm-all) + * [`rm.entrada`](#rm-entry) + * [`rm.datos`](#rm-content) + * Utilidades + * [`ponLenguaje`](#set-locale) + * [`limpiaMemoizado`](#clear-memoized) + * [`tmp.hazdir`](#tmp-mkdir) + * [`tmp.conTmp`](#with-tmp) + * Integridad + * [Subresource Integrity](#integrity) + * [`verifica`](#verify) + * [`verifica.ultimaVez`](#verify-last-run) + +### Ejemplo + +```javascript +const cacache = require('cacache/es') +const fs = require('fs') + +const tarbol = '/ruta/a/mi-tar.tgz' +const rutaCache = '/tmp/my-toy-cache' +const clave = 'mi-clave-única-1234' + +// ¡Añádelo al caché! Usa `rutaCache` como raíz del caché. +cacache.mete(rutaCache, clave, '10293801983029384').then(integrity => { + console.log(`Saved content to ${rutaCache}.`) +}) + +const destino = '/tmp/mytar.tgz' + +// Copia el contenido del caché a otro fichero, pero esta vez con flujos. +cacache.saca.flujo( + rutaCache, clave +).pipe( + fs.createWriteStream(destino) +).on('finish', () => { + console.log('extracción completada') +}) + +// La misma cosa, pero accesando el contenido directamente, sin tocar el índice. +cacache.saca.porHacheo(rutaCache, integridad).then(datos => { + fs.writeFile(destino, datos, err => { + console.log('datos del tarbol sacados basado en su sha512, y escrito a otro fichero') + }) +}) +``` + +### Características + +* Extracción por clave o por dirección de contenido (shasum, etc) +* Usa el estándard de web, [Subresource Integrity](#integrity) +* Compatible con multiples algoritmos - usa sha1, sha512, etc, en el mismo caché sin problema +* Entradas con contenido idéntico comparten ficheros +* Tolerancia de fallas (inmune a corrupción, ficheros parciales, carreras de proceso, etc) +* Verificación completa de datos cuando (escribiendo y leyendo) +* Concurrencia rápida, segura y "lockless" +* Compatible con `stream`s (flujos) +* Compatible con `Promise`s (promesas) +* Bastante rápida -- acceso, incluyendo verificación, en microsegundos +* Almacenaje de metadatos arbitrarios +* Colección de basura y verificación adicional fuera de banda +* Cobertura rigurosa de pruebas +* Probablente hay un "Bloom filter" por ahí en algún lado. Eso le mola a la gente, ¿Verdad? 🤔 + +### Cómo Contribuir + +El equipo de cacache felizmente acepta contribuciones de código y otras maneras de participación. ¡Hay muchas formas diferentes de contribuir! La [Guía de Colaboradores](CONTRIBUTING.md) (en inglés) tiene toda la información que necesitas para cualquier tipo de contribución: todo desde cómo reportar errores hasta cómo someter parches con nuevas características. Con todo y eso, no se preocupe por si lo que haces está exáctamente correcto: no hay ningún problema en hacer preguntas si algo no está claro, o no lo encuentras. + +El equipo de cacache tiene miembros hispanohablantes: es completamente aceptable crear `issues` y `pull requests` en español/castellano. + +Todos los participantes en este proyecto deben obedecer el [Código de Conducta](CODE_OF_CONDUCT.md) (en inglés), y en general actuar de forma amable y respetuosa mientras participan en esta comunidad. + +Por favor refiérase al [Historial de Cambios](CHANGELOG.md) (en inglés) para detalles sobre cambios importantes incluídos en cada versión. + +Finalmente, cacache tiene un sistema de localización de lenguaje. Si te interesa añadir lenguajes o mejorar los que existen, mira en el directorio `./locales` para comenzar. + +Happy hacking! + +### API + +#### <a name="localized-api"></a> Usando el API en español + +cacache incluye una traducción completa de su API al castellano, con las mismas +características. Para usar el API como está documentado en este documento, usa +`require('cacache/es')` + +cacache también tiene otros lenguajes: encuéntralos bajo `./locales`, y podrás +usar el API en ese lenguaje con `require('cacache/<lenguaje>')` + +#### <a name="ls"></a> `> cacache.ls(cache) -> Promise<Object>` + +Enumera todas las entradas en el caché, dentro de un solo objeto. Cada entrada +en el objeto tendrá como clave la clave única usada para el índice, el valor +siendo un objeto de [`saca.info`](#get-info). + +##### Ejemplo + +```javascript +cacache.ls(rutaCache).then(console.log) +// Salida +{ + 'my-thing': { + key: 'my-thing', + integrity: 'sha512-BaSe64/EnCoDED+HAsh==' + path: '.testcache/content/deadbeef', // unido con `rutaCache` + time: 12345698490, + size: 4023948, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } + }, + 'other-thing': { + key: 'other-thing', + integrity: 'sha1-ANothER+hasH=', + path: '.testcache/content/bada55', + time: 11992309289, + size: 111112 + } +} +``` + +#### <a name="ls-stream"></a> `> cacache.ls.flujo(cache) -> Readable` + +Enumera todas las entradas en el caché, emitiendo un objeto de +[`saca.info`](#get-info) por cada evento de `data` en el flujo. + +##### Ejemplo + +```javascript +cacache.ls.flujo(rutaCache).on('data', console.log) +// Salida +{ + key: 'my-thing', + integrity: 'sha512-BaSe64HaSh', + path: '.testcache/content/deadbeef', // unido con `rutaCache` + time: 12345698490, + size: 13423, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } +} + +{ + key: 'other-thing', + integrity: 'whirlpool-WoWSoMuchSupport', + path: '.testcache/content/bada55', + time: 11992309289, + size: 498023984029 +} + +{ + ... +} +``` + +#### <a name="get-data"></a> `> cacache.saca(cache, clave, [ops]) -> Promise({data, metadata, integrity})` + +Devuelve un objeto con los datos, hacheo de integridad y metadatos identificados +por la `clave`. La propiedad `data` de este objeto será una instancia de +`Buffer` con los datos almacenados en el caché. to do with it! cacache just +won't care. + +`integrity` es un `string` de [Subresource Integrity](#integrity). Dígase, un +`string` que puede ser usado para verificar a la `data`, que tiene como formato +`<algoritmo>-<hacheo-integridad-base64>`. + +So no existe ninguna entrada identificada por `clave`, o se los datos +almacenados localmente fallan verificación, el `Promise` fallará. + +Una sub-función, `saca.porHacheo`, tiene casi el mismo comportamiento, excepto +que busca entradas usando el hacheo de integridad, sin tocar el índice general. +Esta versión *sólo* devuelve `data`, sin ningún objeto conteniéndola. + +##### Nota + +Esta función lee la entrada completa a la memoria antes de devolverla. Si estás +almacenando datos Muy Grandes, es posible que [`saca.flujo`](#get-stream) sea +una mejor solución. + +##### Ejemplo + +```javascript +// Busca por clave +cache.saca(rutaCache, 'my-thing').then(console.log) +// Salida: +{ + metadata: { + thingName: 'my' + }, + integrity: 'sha512-BaSe64HaSh', + data: Buffer#<deadbeef>, + size: 9320 +} + +// Busca por hacheo +cache.saca.porHacheo(rutaCache, 'sha512-BaSe64HaSh').then(console.log) +// Salida: +Buffer#<deadbeef> +``` + +#### <a name="get-stream"></a> `> cacache.saca.flujo(cache, clave, [ops]) -> Readable` + +Devuelve un [Readable +Stream](https://nodejs.org/api/stream.html#stream_readable_streams) de los datos +almacenados bajo `clave`. + +So no existe ninguna entrada identificada por `clave`, o se los datos +almacenados localmente fallan verificación, el `Promise` fallará. + +`metadata` y `integrity` serán emitidos como eventos antes de que el flujo +cierre. + +Una sub-función, `saca.flujo.porHacheo`, tiene casi el mismo comportamiento, +excepto que busca entradas usando el hacheo de integridad, sin tocar el índice +general. Esta versión no emite eventos de `metadata` o `integrity`. + +##### Ejemplo + +```javascript +// Busca por clave +cache.saca.flujo( + rutaCache, 'my-thing' +).on('metadata', metadata => { + console.log('metadata:', metadata) +}).on('integrity', integrity => { + console.log('integrity:', integrity) +}).pipe( + fs.createWriteStream('./x.tgz') +) +// Salidas: +metadata: { ... } +integrity: 'sha512-SoMeDIGest+64==' + +// Busca por hacheo +cache.saca.flujo.porHacheo( + rutaCache, 'sha512-SoMeDIGest+64==' +).pipe( + fs.createWriteStream('./x.tgz') +) +``` + +#### <a name="get-info"></a> `> cacache.saca.info(cache, clave) -> Promise` + +Busca la `clave` en el índice del caché, devolviendo información sobre la +entrada si existe. + +##### Campos + +* `key` - Clave de la entrada. Igual al argumento `clave`. +* `integrity` - [hacheo de Subresource Integrity](#integrity) del contenido al que se refiere esta entrada. +* `path` - Dirección del fichero de datos almacenados, relativa al argumento `cache`. +* `time` - Hora de creación de la entrada +* `metadata` - Metadatos asignados a esta entrada por el usuario + +##### Ejemplo + +```javascript +cacache.saca.info(rutaCache, 'my-thing').then(console.log) + +// Salida +{ + key: 'my-thing', + integrity: 'sha256-MUSTVERIFY+ALL/THINGS==' + path: '.testcache/content/deadbeef', + time: 12345698490, + size: 849234, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } +} +``` + +#### <a name="get-hasContent"></a> `> cacache.saca.tieneDatos(cache, integrity) -> Promise` + +Busca un [hacheo Subresource Integrity](#integrity) en el caché. Si existe el +contenido asociado con `integrity`, devuelve un objeto con dos campos: el hacheo +_específico_ que se usó para la búsqueda, `sri`, y el tamaño total del +contenido, `size`. Si no existe ningún contenido asociado con `integrity`, +devuelve `false`. + +##### Ejemplo + +```javascript +cacache.saca.tieneDatos(rutaCache, 'sha256-MUSTVERIFY+ALL/THINGS==').then(console.log) + +// Salida +{ + sri: { + source: 'sha256-MUSTVERIFY+ALL/THINGS==', + algorithm: 'sha256', + digest: 'MUSTVERIFY+ALL/THINGS==', + options: [] + }, + size: 9001 +} + +cacache.saca.tieneDatos(rutaCache, 'sha521-NOT+IN/CACHE==').then(console.log) + +// Salida +false +``` + +#### <a name="put-data"></a> `> cacache.mete(cache, clave, datos, [ops]) -> Promise` + +Inserta `datos` en el caché. El `Promise` devuelto se resuelve con un hacheo +(generado conforme a [`ops.algorithms`](#optsalgorithms)) después que la entrada +haya sido escrita en completo. + +##### Ejemplo + +```javascript +fetch( + 'https://registry.npmjs.org/cacache/-/cacache-1.0.0.tgz' +).then(datos => { + return cacache.mete(rutaCache, 'registry.npmjs.org|cacache@1.0.0', datos) +}).then(integridad => { + console.log('el hacheo de integridad es', integridad) +}) +``` + +#### <a name="put-stream"></a> `> cacache.mete.flujo(cache, clave, [ops]) -> Writable` + +Devuelve un [Writable +Stream](https://nodejs.org/api/stream.html#stream_writable_streams) que inserta +al caché los datos escritos a él. Emite un evento `integrity` con el hacheo del +contenido escrito, cuando completa. + +##### Ejemplo + +```javascript +request.get( + 'https://registry.npmjs.org/cacache/-/cacache-1.0.0.tgz' +).pipe( + cacache.mete.flujo( + rutaCache, 'registry.npmjs.org|cacache@1.0.0' + ).on('integrity', d => console.log(`integrity digest is ${d}`)) +) +``` + +#### <a name="put-options"></a> `> opciones para cacache.mete` + +La funciones `cacache.mete` tienen un número de opciones en común. + +##### `ops.metadata` + +Metadatos del usuario que se almacenarán con la entrada. + +##### `ops.size` + +El tamaño declarado de los datos que se van a insertar. Si es proveído, cacache +verificará que los datos escritos sean de ese tamaño, o si no, fallará con un +error con código `EBADSIZE`. + +##### `ops.integrity` + +El hacheo de integridad de los datos siendo escritos. + +Si es proveído, y los datos escritos no le corresponden, la operación fallará +con un error con código `EINTEGRITY`. + +`ops.algorithms` no tiene ningún efecto si esta opción está presente. + +##### `ops.algorithms` + +Por Defecto: `['sha512']` + +Algoritmos que se deben usar cuando se calcule el hacheo de [subresource +integrity](#integrity) para los datos insertados. Puede usar cualquier algoritmo +enumerado en `crypto.getHashes()`. + +Por el momento, sólo se acepta un algoritmo (dígase, un array con exáctamente un +valor). No tiene ningún efecto si `ops.integrity` también ha sido proveido. + +##### `ops.uid`/`ops.gid` + +Si están presentes, cacache hará todo lo posible para asegurarse que todos los +ficheros creados en el proceso de sus operaciones en el caché usen esta +combinación en particular. + +##### `ops.memoize` + +Por Defecto: `null` + +Si es verdad, cacache tratará de memoizar los datos de la entrada en memoria. La +próxima vez que el proceso corriente trate de accesar los datos o entrada, +cacache buscará en memoria antes de buscar en disco. + +Si `ops.memoize` es un objeto regular o un objeto como `Map` (es decir, un +objeto con métodos `get()` y `set()`), este objeto en sí sera usado en vez del +caché de memoria global. Esto permite tener lógica específica a tu aplicación +encuanto al almacenaje en memoria de tus datos. + +Si quieres asegurarte que los datos se lean del disco en vez de memoria, usa +`memoize: false` cuando uses funciones de `cacache.saca`. + +#### <a name="rm-all"></a> `> cacache.rm.todo(cache) -> Promise` + +Borra el caché completo, incluyendo ficheros temporeros, ficheros de datos, y el +índice del caché. + +##### Ejemplo + +```javascript +cacache.rm.todo(rutaCache).then(() => { + console.log('THE APOCALYPSE IS UPON US 😱') +}) +``` + +#### <a name="rm-entry"></a> `> cacache.rm.entrada(cache, clave) -> Promise` + +Alias: `cacache.rm` + +Borra la entrada `clave` del índuce. El contenido asociado con esta entrada +seguirá siendo accesible por hacheo usando +[`saca.flujo.porHacheo`](#get-stream). + +Para borrar el contenido en sí, usa [`rm.datos`](#rm-content). Si quieres hacer +esto de manera más segura (pues ficheros de contenido pueden ser usados por +multiples entradas), usa [`verifica`](#verify) para borrar huérfanos. + +##### Ejemplo + +```javascript +cacache.rm.entrada(rutaCache, 'my-thing').then(() => { + console.log('I did not like it anyway') +}) +``` + +#### <a name="rm-content"></a> `> cacache.rm.datos(cache, integrity) -> Promise` + +Borra el contenido identificado por `integrity`. Cualquier entrada que se +refiera a este contenido quedarán huérfanas y se invalidarán si se tratan de +accesar, al menos que contenido idéntico sea añadido bajo `integrity`. + +##### Ejemplo + +```javascript +cacache.rm.datos(rutaCache, 'sha512-SoMeDIGest/IN+BaSE64==').then(() => { + console.log('los datos para `mi-cosa` se borraron') +}) +``` + +#### <a name="set-locale"></a> `> cacache.ponLenguaje(locale)` + +Configura el lenguaje usado para mensajes y errores de cacache. La lista de +lenguajes disponibles está en el directorio `./locales` del proyecto. + +_Te interesa añadir más lenguajes? [Somete un PR](CONTRIBUTING.md)!_ + +#### <a name="clear-memoized"></a> `> cacache.limpiaMemoizado()` + +Completamente reinicializa el caché de memoria interno. Si estás usando tu +propio objecto con `ops.memoize`, debes hacer esto de manera específica a él. + +#### <a name="tmp-mkdir"></a> `> tmp.hazdir(cache, ops) -> Promise<Path>` + +Alias: `tmp.mkdir` + +Devuelve un directorio único dentro del directorio `tmp` del caché. + +Una vez tengas el directorio, es responsabilidad tuya asegurarte que todos los +ficheros escrito a él sean creados usando los permisos y `uid`/`gid` concordante +con el caché. Si no, puedes pedirle a cacache que lo haga llamando a +[`cacache.tmp.fix()`](#tmp-fix). Esta función arreglará todos los permisos en el +directorio tmp. + +Si quieres que cacache limpie el directorio automáticamente cuando termines, usa +[`cacache.tmp.conTmp()`](#with-tpm). + +##### Ejemplo + +```javascript +cacache.tmp.mkdir(cache).then(dir => { + fs.writeFile(path.join(dir, 'blablabla'), Buffer#<1234>, ...) +}) +``` + +#### <a name="with-tmp"></a> `> tmp.conTmp(cache, ops, cb) -> Promise` + +Crea un directorio temporero con [`tmp.mkdir()`](#tmp-mkdir) y ejecuta `cb` con +él como primer argumento. El directorio creado será removido automáticamente +cuando el valor devolvido por `cb()` se resuelva. + +Las mismas advertencias aplican en cuanto a manejando permisos para los ficheros +dentro del directorio. + +##### Ejemplo + +```javascript +cacache.tmp.conTmp(cache, dir => { + return fs.writeFileAsync(path.join(dir, 'blablabla'), Buffer#<1234>, ...) +}).then(() => { + // `dir` no longer exists +}) +``` + +#### <a name="integrity"></a> Hacheos de Subresource Integrity + +cacache usa strings que siguen la especificación de [Subresource Integrity +spec](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity). + +Es decir, donde quiera cacache espera un argumento o opción `integrity`, ese +string debería usar el formato `<algoritmo>-<hacheo-base64>`. + +Una variación importante sobre los hacheos que cacache acepta es que acepta el +nombre de cualquier algoritmo aceptado por el proceso de Node.js donde se usa. +Puedes usar `crypto.getHashes()` para ver cuales están disponibles. + +##### Generando tus propios hacheos + +Si tienes un `shasum`, en general va a estar en formato de string hexadecimal +(es decir, un `sha1` se vería como algo así: +`5f5513f8822fdbe5145af33b64d8d970dcf95c6e`). + +Para ser compatible con cacache, necesitas convertir esto a su equivalente en +subresource integrity. Por ejemplo, el hacheo correspondiente al ejemplo +anterior sería: `sha1-X1UT+IIv2+UUWvM7ZNjZcNz5XG4=`. + +Puedes usar código así para generarlo por tu cuenta: + +```javascript +const crypto = require('crypto') +const algoritmo = 'sha512' +const datos = 'foobarbaz' + +const integrity = ( + algorithm + + '-' + + crypto.createHash(algoritmo).update(datos).digest('base64') +) +``` + +También puedes usar [`ssri`](https://npm.im/ssri) para deferir el trabajo a otra +librería que garantiza que todo esté correcto, pues maneja probablemente todas +las operaciones que tendrías que hacer con SRIs, incluyendo convirtiendo entre +hexadecimal y el formato SRI. + +#### <a name="verify"></a> `> cacache.verifica(cache, ops) -> Promise` + +Examina y arregla tu caché: + +* Limpia entradas inválidas, huérfanas y corrompidas +* Te deja filtrar cuales entradas retener, con tu propio filtro +* Reclama cualquier ficheros de contenido sin referencias en el índice +* Verifica integridad de todos los ficheros de contenido y remueve los malos +* Arregla permisos del caché +* Remieve el directorio `tmp` en el caché, y todo su contenido. + +Cuando termine, devuelve un objeto con varias estadísticas sobre el proceso de +verificación, por ejemplo la cantidad de espacio de disco reclamado, el número +de entradas válidas, número de entradas removidas, etc. + +##### Opciones + +* `ops.uid` - uid para asignarle al caché y su contenido +* `ops.gid` - gid para asignarle al caché y su contenido +* `ops.filter` - recibe una entrada como argumento. Devuelve falso para removerla. Nota: es posible que esta función sea invocada con la misma entrada más de una vez. + +##### Example + +```sh +echo somegarbage >> $RUTACACHE/content/deadbeef +``` + +```javascript +cacache.verifica(rutaCache).then(stats => { + // deadbeef collected, because of invalid checksum. + console.log('cache is much nicer now! stats:', stats) +}) +``` + +#### <a name="verify-last-run"></a> `> cacache.verifica.ultimaVez(cache) -> Promise` + +Alias: `últimaVez` + +Devuelve un `Date` que representa la última vez que `cacache.verifica` fue +ejecutada en `cache`. + +##### Example + +```javascript +cacache.verifica(rutaCache).then(() => { + cacache.verifica.ultimaVez(rutaCache).then(última => { + console.log('La última vez que se usó cacache.verifica() fue ' + última) + }) +}) +``` diff --git a/deps/npm/node_modules/cacache/get.js b/deps/npm/node_modules/cacache/get.js index 58adb8e9f60..2bb3afa5281 100644 --- a/deps/npm/node_modules/cacache/get.js +++ b/deps/npm/node_modules/cacache/get.js @@ -2,6 +2,7 @@ const BB = require('bluebird') +const fs = require('fs') const index = require('./lib/entry-index') const memo = require('./lib/memoization') const pipe = require('mississippi').pipe @@ -152,3 +153,38 @@ function info (cache, key, opts) { } module.exports.hasContent = read.hasContent + +module.exports.copy = function cp (cache, key, dest, opts) { + return copy(false, cache, key, dest, opts) +} +module.exports.copy.byDigest = function cpDigest (cache, digest, dest, opts) { + return copy(true, cache, digest, dest, opts) +} +function copy (byDigest, cache, key, dest, opts) { + opts = opts || {} + if (read.copy) { + return ( + byDigest ? BB.resolve(null) : index.find(cache, key, opts) + ).then(entry => { + if (!entry && !byDigest) { + throw new index.NotFoundError(cache, key) + } + return read.copy( + cache, byDigest ? key : entry.integrity, dest, opts + ).then(() => byDigest ? key : { + metadata: entry.metadata, + size: entry.size, + integrity: entry.integrity + }) + }) + } else { + return getData(byDigest, cache, key, opts).then(res => { + return fs.writeFileAsync(dest, byDigest ? res : res.data) + .then(() => byDigest ? key : { + metadata: res.metadata, + size: res.size, + integrity: res.integrity + }) + }) + } +} diff --git a/deps/npm/node_modules/cacache/lib/content/read.js b/deps/npm/node_modules/cacache/lib/content/read.js index 14ca7d905df..b09ad5cb409 100644 --- a/deps/npm/node_modules/cacache/lib/content/read.js +++ b/deps/npm/node_modules/cacache/lib/content/read.js @@ -52,6 +52,18 @@ function readStream (cache, integrity, opts) { return stream } +if (fs.copyFile) { + module.exports.copy = copy +} +function copy (cache, integrity, dest, opts) { + opts = opts || {} + return pickContentSri(cache, integrity).then(content => { + const sri = content.sri + const cpath = contentPath(cache, sri) + return fs.copyFileAsync(cpath, dest).then(() => content.size) + }) +} + module.exports.hasContent = hasContent function hasContent (cache, integrity) { if (!integrity) { return BB.resolve(false) } diff --git a/deps/npm/node_modules/cacache/lib/util/move-file.js b/deps/npm/node_modules/cacache/lib/util/move-file.js index e12e98188c4..b43744b3da8 100644 --- a/deps/npm/node_modules/cacache/lib/util/move-file.js +++ b/deps/npm/node_modules/cacache/lib/util/move-file.js @@ -34,22 +34,18 @@ function moveFile (src, dest) { }).then(() => { // content should never change for any reason, so make it read-only return BB.join(unlink(src), process.platform !== 'win32' && chmod(dest, '0444')) - }).catch(err => { - if (process.platform !== 'win32') { - throw err - } else { - if (!pinflight) { pinflight = require('promise-inflight') } - return pinflight('cacache-move-file:' + dest, () => { - return BB.promisify(fs.stat)(dest).catch(err => { - if (err !== 'ENOENT') { - // Something else is wrong here. Bail bail bail - throw err - } - // file doesn't already exist! let's try a rename -> copy fallback - if (!move) { move = require('move-concurrently') } - return move(src, dest, { BB, fs }) - }) + }).catch(() => { + if (!pinflight) { pinflight = require('promise-inflight') } + return pinflight('cacache-move-file:' + dest, () => { + return BB.promisify(fs.stat)(dest).catch(err => { + if (err.code !== 'ENOENT') { + // Something else is wrong here. Bail bail bail + throw err + } + // file doesn't already exist! let's try a rename -> copy fallback + if (!move) { move = require('move-concurrently') } + return move(src, dest, { BB, fs }) }) - } + }) }) } diff --git a/deps/npm/node_modules/cacache/locales/en.js b/deps/npm/node_modules/cacache/locales/en.js index 22382c96b38..22025cf0e89 100644 --- a/deps/npm/node_modules/cacache/locales/en.js +++ b/deps/npm/node_modules/cacache/locales/en.js @@ -20,6 +20,8 @@ x.get = (cache, key, opts) => get(cache, key, opts) x.get.byDigest = (cache, hash, opts) => get.byDigest(cache, hash, opts) x.get.stream = (cache, key, opts) => get.stream(cache, key, opts) x.get.stream.byDigest = (cache, hash, opts) => get.stream.byDigest(cache, hash, opts) +x.get.copy = (cache, key, dest, opts) => get.copy(cache, key, dest, opts) +x.get.copy.byDigest = (cache, hash, dest, opts) => get.copy.byDigest(cache, hash, dest, opts) x.get.info = (cache, key) => get.info(cache, key) x.get.hasContent = (cache, hash) => get.hasContent(cache, hash) diff --git a/deps/npm/node_modules/cacache/locales/es.js b/deps/npm/node_modules/cacache/locales/es.js index 6cb9d0c0d28..9a27de6585a 100644 --- a/deps/npm/node_modules/cacache/locales/es.js +++ b/deps/npm/node_modules/cacache/locales/es.js @@ -20,6 +20,8 @@ x.saca = (cache, clave, ops) => get(cache, clave, ops) x.saca.porHacheo = (cache, hacheo, ops) => get.byDigest(cache, hacheo, ops) x.saca.flujo = (cache, clave, ops) => get.stream(cache, clave, ops) x.saca.flujo.porHacheo = (cache, hacheo, ops) => get.stream.byDigest(cache, hacheo, ops) +x.sava.copia = (cache, clave, destino, opts) => get.copy(cache, clave, destino, opts) +x.sava.copia.porHacheo = (cache, hacheo, destino, opts) => get.copy.byDigest(cache, hacheo, destino, opts) x.saca.info = (cache, clave) => get.info(cache, clave) x.saca.tieneDatos = (cache, hacheo) => get.hasContent(cache, hacheo) diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/README.md b/deps/npm/node_modules/cacache/node_modules/lru-cache/README.md deleted file mode 100644 index f646c1cb8e5..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/README.md +++ /dev/null @@ -1,152 +0,0 @@ -# lru cache - -A cache object that deletes the least-recently-used items. - -[![Build Status](https://travis-ci.org/isaacs/node-lru-cache.svg?branch=master)](https://travis-ci.org/isaacs/node-lru-cache) [![Coverage Status](https://coveralls.io/repos/isaacs/node-lru-cache/badge.svg?service=github)](https://coveralls.io/github/isaacs/node-lru-cache) - -## Installation: - -```javascript -npm install lru-cache --save -``` - -## Usage: - -```javascript -var LRU = require("lru-cache") - , options = { max: 500 - , length: function (n, key) { return n * 2 + key.length } - , dispose: function (key, n) { n.close() } - , maxAge: 1000 * 60 * 60 } - , cache = LRU(options) - , otherCache = LRU(50) // sets just the max size - -cache.set("key", "value") -cache.get("key") // "value" - -// non-string keys ARE fully supported -var someObject = {} -cache.set(someObject, 'a value') -cache.set('[object Object]', 'a different value') -assert.equal(cache.get(someObject), 'a value') - -cache.reset() // empty the cache -``` - -If you put more stuff in it, then items will fall out. - -If you try to put an oversized thing in it, then it'll fall out right -away. - -## Options - -* `max` The maximum size of the cache, checked by applying the length - function to all values in the cache. Not setting this is kind of - silly, since that's the whole purpose of this lib, but it defaults - to `Infinity`. -* `maxAge` Maximum age in ms. Items are not pro-actively pruned out - as they age, but if you try to get an item that is too old, it'll - drop it and return undefined instead of giving it to you. -* `length` Function that is used to calculate the length of stored - items. If you're storing strings or buffers, then you probably want - to do something like `function(n, key){return n.length}`. The default is - `function(){return 1}`, which is fine if you want to store `max` - like-sized things. The item is passed as the first argument, and - the key is passed as the second argumnet. -* `dispose` Function that is called on items when they are dropped - from the cache. This can be handy if you want to close file - descriptors or do other cleanup tasks when items are no longer - accessible. Called with `key, value`. It's called *before* - actually removing the item from the internal cache, so if you want - to immediately put it back in, you'll have to do that in a - `nextTick` or `setTimeout` callback or it won't do anything. -* `stale` By default, if you set a `maxAge`, it'll only actually pull - stale items out of the cache when you `get(key)`. (That is, it's - not pre-emptively doing a `setTimeout` or anything.) If you set - `stale:true`, it'll return the stale value before deleting it. If - you don't set this, then it'll return `undefined` when you try to - get a stale entry, as if it had already been deleted. -* `noDisposeOnSet` By default, if you set a `dispose()` method, then - it'll be called whenever a `set()` operation overwrites an existing - key. If you set this option, `dispose()` will only be called when a - key falls out of the cache, not when it is overwritten. - -## API - -* `set(key, value, maxAge)` -* `get(key) => value` - - Both of these will update the "recently used"-ness of the key. - They do what you think. `maxAge` is optional and overrides the - cache `maxAge` option if provided. - - If the key is not found, `get()` will return `undefined`. - - The key and val can be any value. - -* `peek(key)` - - Returns the key value (or `undefined` if not found) without - updating the "recently used"-ness of the key. - - (If you find yourself using this a lot, you *might* be using the - wrong sort of data structure, but there are some use cases where - it's handy.) - -* `del(key)` - - Deletes a key out of the cache. - -* `reset()` - - Clear the cache entirely, throwing away all values. - -* `has(key)` - - Check if a key is in the cache, without updating the recent-ness - or deleting it for being stale. - -* `forEach(function(value,key,cache), [thisp])` - - Just like `Array.prototype.forEach`. Iterates over all the keys - in the cache, in order of recent-ness. (Ie, more recently used - items are iterated over first.) - -* `rforEach(function(value,key,cache), [thisp])` - - The same as `cache.forEach(...)` but items are iterated over in - reverse order. (ie, less recently used items are iterated over - first.) - -* `keys()` - - Return an array of the keys in the cache. - -* `values()` - - Return an array of the values in the cache. - -* `length` - - Return total length of objects in cache taking into account - `length` options function. - -* `itemCount` - - Return total quantity of objects currently in cache. Note, that - `stale` (see options) items are returned as part of this item - count. - -* `dump()` - - Return an array of the cache entries ready for serialization and usage - with 'destinationCache.load(arr)`. - -* `load(cacheEntriesArray)` - - Loads another cache entries array, obtained with `sourceCache.dump()`, - into the cache. The destination cache is reset before loading new entries - -* `prune()` - - Manually iterates over the entire cache proactively pruning old entries diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/index.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/index.js deleted file mode 100644 index 460462aadc9..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/index.js +++ /dev/null @@ -1,467 +0,0 @@ -'use strict' - -module.exports = LRUCache - -// This will be a proper iterable 'Map' in engines that support it, -// or a fakey-fake PseudoMap in older versions. -var Map = require('pseudomap') -var util = require('util') - -// A linked list to keep track of recently-used-ness -var Yallist = require('yallist') - -// use symbols if possible, otherwise just _props -var hasSymbol = typeof Symbol === 'function' -var makeSymbol -if (hasSymbol) { - makeSymbol = function (key) { - return Symbol.for(key) - } -} else { - makeSymbol = function (key) { - return '_' + key - } -} - -var MAX = makeSymbol('max') -var LENGTH = makeSymbol('length') -var LENGTH_CALCULATOR = makeSymbol('lengthCalculator') -var ALLOW_STALE = makeSymbol('allowStale') -var MAX_AGE = makeSymbol('maxAge') -var DISPOSE = makeSymbol('dispose') -var NO_DISPOSE_ON_SET = makeSymbol('noDisposeOnSet') -var LRU_LIST = makeSymbol('lruList') -var CACHE = makeSymbol('cache') - -function naiveLength () { return 1 } - -// lruList is a yallist where the head is the youngest -// item, and the tail is the oldest. the list contains the Hit -// objects as the entries. -// Each Hit object has a reference to its Yallist.Node. This -// never changes. -// -// cache is a Map (or PseudoMap) that matches the keys to -// the Yallist.Node object. -function LRUCache (options) { - if (!(this instanceof LRUCache)) { - return new LRUCache(options) - } - - if (typeof options === 'number') { - options = { max: options } - } - - if (!options) { - options = {} - } - - var max = this[MAX] = options.max - // Kind of weird to have a default max of Infinity, but oh well. - if (!max || - !(typeof max === 'number') || - max <= 0) { - this[MAX] = Infinity - } - - var lc = options.length || naiveLength - if (typeof lc !== 'function') { - lc = naiveLength - } - this[LENGTH_CALCULATOR] = lc - - this[ALLOW_STALE] = options.stale || false - this[MAX_AGE] = options.maxAge || 0 - this[DISPOSE] = options.dispose - this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false - this.reset() -} - -// resize the cache when the max changes. -Object.defineProperty(LRUCache.prototype, 'max', { - set: function (mL) { - if (!mL || !(typeof mL === 'number') || mL <= 0) { - mL = Infinity - } - this[MAX] = mL - trim(this) - }, - get: function () { - return this[MAX] - }, - enumerable: true -}) - -Object.defineProperty(LRUCache.prototype, 'allowStale', { - set: function (allowStale) { - this[ALLOW_STALE] = !!allowStale - }, - get: function () { - return this[ALLOW_STALE] - }, - enumerable: true -}) - -Object.defineProperty(LRUCache.prototype, 'maxAge', { - set: function (mA) { - if (!mA || !(typeof mA === 'number') || mA < 0) { - mA = 0 - } - this[MAX_AGE] = mA - trim(this) - }, - get: function () { - return this[MAX_AGE] - }, - enumerable: true -}) - -// resize the cache when the lengthCalculator changes. -Object.defineProperty(LRUCache.prototype, 'lengthCalculator', { - set: function (lC) { - if (typeof lC !== 'function') { - lC = naiveLength - } - if (lC !== this[LENGTH_CALCULATOR]) { - this[LENGTH_CALCULATOR] = lC - this[LENGTH] = 0 - this[LRU_LIST].forEach(function (hit) { - hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key) - this[LENGTH] += hit.length - }, this) - } - trim(this) - }, - get: function () { return this[LENGTH_CALCULATOR] }, - enumerable: true -}) - -Object.defineProperty(LRUCache.prototype, 'length', { - get: function () { return this[LENGTH] }, - enumerable: true -}) - -Object.defineProperty(LRUCache.prototype, 'itemCount', { - get: function () { return this[LRU_LIST].length }, - enumerable: true -}) - -LRUCache.prototype.rforEach = function (fn, thisp) { - thisp = thisp || this - for (var walker = this[LRU_LIST].tail; walker !== null;) { - var prev = walker.prev - forEachStep(this, fn, walker, thisp) - walker = prev - } -} - -function forEachStep (self, fn, node, thisp) { - var hit = node.value - if (isStale(self, hit)) { - del(self, node) - if (!self[ALLOW_STALE]) { - hit = undefined - } - } - if (hit) { - fn.call(thisp, hit.value, hit.key, self) - } -} - -LRUCache.prototype.forEach = function (fn, thisp) { - thisp = thisp || this - for (var walker = this[LRU_LIST].head; walker !== null;) { - var next = walker.next - forEachStep(this, fn, walker, thisp) - walker = next - } -} - -LRUCache.prototype.keys = function () { - return this[LRU_LIST].toArray().map(function (k) { - return k.key - }, this) -} - -LRUCache.prototype.values = function () { - return this[LRU_LIST].toArray().map(function (k) { - return k.value - }, this) -} - -LRUCache.prototype.reset = function () { - if (this[DISPOSE] && - this[LRU_LIST] && - this[LRU_LIST].length) { - this[LRU_LIST].forEach(function (hit) { - this[DISPOSE](hit.key, hit.value) - }, this) - } - - this[CACHE] = new Map() // hash of items by key - this[LRU_LIST] = new Yallist() // list of items in order of use recency - this[LENGTH] = 0 // length of items in the list -} - -LRUCache.prototype.dump = function () { - return this[LRU_LIST].map(function (hit) { - if (!isStale(this, hit)) { - return { - k: hit.key, - v: hit.value, - e: hit.now + (hit.maxAge || 0) - } - } - }, this).toArray().filter(function (h) { - return h - }) -} - -LRUCache.prototype.dumpLru = function () { - return this[LRU_LIST] -} - -LRUCache.prototype.inspect = function (n, opts) { - var str = 'LRUCache {' - var extras = false - - var as = this[ALLOW_STALE] - if (as) { - str += '\n allowStale: true' - extras = true - } - - var max = this[MAX] - if (max && max !== Infinity) { - if (extras) { - str += ',' - } - str += '\n max: ' + util.inspect(max, opts) - extras = true - } - - var maxAge = this[MAX_AGE] - if (maxAge) { - if (extras) { - str += ',' - } - str += '\n maxAge: ' + util.inspect(maxAge, opts) - extras = true - } - - var lc = this[LENGTH_CALCULATOR] - if (lc && lc !== naiveLength) { - if (extras) { - str += ',' - } - str += '\n length: ' + util.inspect(this[LENGTH], opts) - extras = true - } - - var didFirst = false - this[LRU_LIST].forEach(function (item) { - if (didFirst) { - str += ',\n ' - } else { - if (extras) { - str += ',\n' - } - didFirst = true - str += '\n ' - } - var key = util.inspect(item.key).split('\n').join('\n ') - var val = { value: item.value } - if (item.maxAge !== maxAge) { - val.maxAge = item.maxAge - } - if (lc !== naiveLength) { - val.length = item.length - } - if (isStale(this, item)) { - val.stale = true - } - - val = util.inspect(val, opts).split('\n').join('\n ') - str += key + ' => ' + val - }) - - if (didFirst || extras) { - str += '\n' - } - str += '}' - - return str -} - -LRUCache.prototype.set = function (key, value, maxAge) { - maxAge = maxAge || this[MAX_AGE] - - var now = maxAge ? Date.now() : 0 - var len = this[LENGTH_CALCULATOR](value, key) - - if (this[CACHE].has(key)) { - if (len > this[MAX]) { - del(this, this[CACHE].get(key)) - return false - } - - var node = this[CACHE].get(key) - var item = node.value - - // dispose of the old one before overwriting - // split out into 2 ifs for better coverage tracking - if (this[DISPOSE]) { - if (!this[NO_DISPOSE_ON_SET]) { - this[DISPOSE](key, item.value) - } - } - - item.now = now - item.maxAge = maxAge - item.value = value - this[LENGTH] += len - item.length - item.length = len - this.get(key) - trim(this) - return true - } - - var hit = new Entry(key, value, len, now, maxAge) - - // oversized objects fall out of cache automatically. - if (hit.length > this[MAX]) { - if (this[DISPOSE]) { - this[DISPOSE](key, value) - } - return false - } - - this[LENGTH] += hit.length - this[LRU_LIST].unshift(hit) - this[CACHE].set(key, this[LRU_LIST].head) - trim(this) - return true -} - -LRUCache.prototype.has = function (key) { - if (!this[CACHE].has(key)) return false - var hit = this[CACHE].get(key).value - if (isStale(this, hit)) { - return false - } - return true -} - -LRUCache.prototype.get = function (key) { - return get(this, key, true) -} - -LRUCache.prototype.peek = function (key) { - return get(this, key, false) -} - -LRUCache.prototype.pop = function () { - var node = this[LRU_LIST].tail - if (!node) return null - del(this, node) - return node.value -} - -LRUCache.prototype.del = function (key) { - del(this, this[CACHE].get(key)) -} - -LRUCache.prototype.load = function (arr) { - // reset the cache - this.reset() - - var now = Date.now() - // A previous serialized cache has the most recent items first - for (var l = arr.length - 1; l >= 0; l--) { - var hit = arr[l] - var expiresAt = hit.e || 0 - if (expiresAt === 0) { - // the item was created without expiration in a non aged cache - this.set(hit.k, hit.v) - } else { - var maxAge = expiresAt - now - // dont add already expired items - if (maxAge > 0) { - this.set(hit.k, hit.v, maxAge) - } - } - } -} - -LRUCache.prototype.prune = function () { - var self = this - this[CACHE].forEach(function (value, key) { - get(self, key, false) - }) -} - -function get (self, key, doUse) { - var node = self[CACHE].get(key) - if (node) { - var hit = node.value - if (isStale(self, hit)) { - del(self, node) - if (!self[ALLOW_STALE]) hit = undefined - } else { - if (doUse) { - self[LRU_LIST].unshiftNode(node) - } - } - if (hit) hit = hit.value - } - return hit -} - -function isStale (self, hit) { - if (!hit || (!hit.maxAge && !self[MAX_AGE])) { - return false - } - var stale = false - var diff = Date.now() - hit.now - if (hit.maxAge) { - stale = diff > hit.maxAge - } else { - stale = self[MAX_AGE] && (diff > self[MAX_AGE]) - } - return stale -} - -function trim (self) { - if (self[LENGTH] > self[MAX]) { - for (var walker = self[LRU_LIST].tail; - self[LENGTH] > self[MAX] && walker !== null;) { - // We know that we're about to delete this one, and also - // what the next least recently used key will be, so just - // go ahead and set it now. - var prev = walker.prev - del(self, walker) - walker = prev - } - } -} - -function del (self, node) { - if (node) { - var hit = node.value - if (self[DISPOSE]) { - self[DISPOSE](hit.key, hit.value) - } - self[LENGTH] -= hit.length - self[CACHE].delete(hit.key) - self[LRU_LIST].removeNode(node) - } -} - -// classy, since V8 prefers predictable objects. -function Entry (key, value, length, now, maxAge) { - this.key = key - this.value = value - this.length = length - this.now = now - this.maxAge = maxAge || 0 -} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/README.md b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/README.md deleted file mode 100644 index 778bf01dfaa..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# pseudomap - -A thing that is a lot like ES6 `Map`, but without iterators, for use -in environments where `for..of` syntax and `Map` are not available. - -If you need iterators, or just in general a more faithful polyfill to -ES6 Maps, check out [es6-map](http://npm.im/es6-map). - -If you are in an environment where `Map` is supported, then that will -be returned instead, unless `process.env.TEST_PSEUDOMAP` is set. - -You can use any value as keys, and any value as data. Setting again -with the identical key will overwrite the previous value. - -Internally, data is stored on an `Object.create(null)` style object. -The key is coerced to a string to generate the key on the internal -data-bag object. The original key used is stored along with the data. - -In the event of a stringified-key collision, a new key is generated by -appending an increasing number to the stringified-key until finding -either the intended key or an empty spot. - -Note that because object traversal order of plain objects is not -guaranteed to be identical to insertion order, the insertion order -guarantee of `Map.prototype.forEach` is not guaranteed in this -implementation. However, in all versions of Node.js and V8 where this -module works, `forEach` does traverse data in insertion order. - -## API - -Most of the [Map -API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), -with the following exceptions: - -1. A `Map` object is not an iterator. -2. `values`, `keys`, and `entries` methods are not implemented, - because they return iterators. -3. The argument to the constructor can be an Array of `[key, value]` - pairs, or a `Map` or `PseudoMap` object. But, since iterators - aren't used, passing any plain-old iterator won't initialize the - map properly. - -## USAGE - -Use just like a regular ES6 Map. - -```javascript -var PseudoMap = require('pseudomap') - -// optionally provide a pseudomap, or an array of [key,value] pairs -// as the argument to initialize the map with -var myMap = new PseudoMap() - -myMap.set(1, 'number 1') -myMap.set('1', 'string 1') -var akey = {} -var bkey = {} -myMap.set(akey, { some: 'data' }) -myMap.set(bkey, { some: 'other data' }) -``` diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/map.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/map.js deleted file mode 100644 index 7db15994612..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/map.js +++ /dev/null @@ -1,9 +0,0 @@ -if (process.env.npm_package_name === 'pseudomap' && - process.env.npm_lifecycle_script === 'test') - process.env.TEST_PSEUDOMAP = 'true' - -if (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) { - module.exports = Map -} else { - module.exports = require('./pseudomap') -} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/package.json b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/package.json deleted file mode 100644 index 3b5bd1e0eef..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "_from": "pseudomap@^1.0.2", - "_id": "pseudomap@1.0.2", - "_inBundle": false, - "_integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "_location": "/cacache/lru-cache/pseudomap", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "pseudomap@^1.0.2", - "name": "pseudomap", - "escapedName": "pseudomap", - "rawSpec": "^1.0.2", - "saveSpec": null, - "fetchSpec": "^1.0.2" - }, - "_requiredBy": [ - "/cacache/lru-cache" - ], - "_resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "_shasum": "f052a28da70e618917ef0a8ac34c1ae5a68286b3", - "_spec": "pseudomap@^1.0.2", - "_where": "/Users/rebecca/code/npm/node_modules/cacache/node_modules/lru-cache", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/pseudomap/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A thing that is a lot like ES6 `Map`, but without iterators, for use in environments where `for..of` syntax and `Map` are not available.", - "devDependencies": { - "tap": "^2.3.1" - }, - "directories": { - "test": "test" - }, - "homepage": "https://github.com/isaacs/pseudomap#readme", - "license": "ISC", - "main": "map.js", - "name": "pseudomap", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/pseudomap.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "version": "1.0.2" -} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/pseudomap.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/pseudomap.js deleted file mode 100644 index 25a21d829e8..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/pseudomap.js +++ /dev/null @@ -1,113 +0,0 @@ -var hasOwnProperty = Object.prototype.hasOwnProperty - -module.exports = PseudoMap - -function PseudoMap (set) { - if (!(this instanceof PseudoMap)) // whyyyyyyy - throw new TypeError("Constructor PseudoMap requires 'new'") - - this.clear() - - if (set) { - if ((set instanceof PseudoMap) || - (typeof Map === 'function' && set instanceof Map)) - set.forEach(function (value, key) { - this.set(key, value) - }, this) - else if (Array.isArray(set)) - set.forEach(function (kv) { - this.set(kv[0], kv[1]) - }, this) - else - throw new TypeError('invalid argument') - } -} - -PseudoMap.prototype.forEach = function (fn, thisp) { - thisp = thisp || this - Object.keys(this._data).forEach(function (k) { - if (k !== 'size') - fn.call(thisp, this._data[k].value, this._data[k].key) - }, this) -} - -PseudoMap.prototype.has = function (k) { - return !!find(this._data, k) -} - -PseudoMap.prototype.get = function (k) { - var res = find(this._data, k) - return res && res.value -} - -PseudoMap.prototype.set = function (k, v) { - set(this._data, k, v) -} - -PseudoMap.prototype.delete = function (k) { - var res = find(this._data, k) - if (res) { - delete this._data[res._index] - this._data.size-- - } -} - -PseudoMap.prototype.clear = function () { - var data = Object.create(null) - data.size = 0 - - Object.defineProperty(this, '_data', { - value: data, - enumerable: false, - configurable: true, - writable: false - }) -} - -Object.defineProperty(PseudoMap.prototype, 'size', { - get: function () { - return this._data.size - }, - set: function (n) {}, - enumerable: true, - configurable: true -}) - -PseudoMap.prototype.values = -PseudoMap.prototype.keys = -PseudoMap.prototype.entries = function () { - throw new Error('iterators are not implemented in this version') -} - -// Either identical, or both NaN -function same (a, b) { - return a === b || a !== a && b !== b -} - -function Entry (k, v, i) { - this.key = k - this.value = v - this._index = i -} - -function find (data, k) { - for (var i = 0, s = '_' + k, key = s; - hasOwnProperty.call(data, key); - key = s + i++) { - if (same(data[key].key, k)) - return data[key] - } -} - -function set (data, k, v) { - for (var i = 0, s = '_' + k, key = s; - hasOwnProperty.call(data, key); - key = s + i++) { - if (same(data[key].key, k)) { - data[key].value = v - return - } - } - data.size++ - data[key] = new Entry(k, v, key) -} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/test/basic.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/test/basic.js deleted file mode 100644 index 4378e4541e9..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/test/basic.js +++ /dev/null @@ -1,86 +0,0 @@ -var t = require('tap') - -process.env.TEST_PSEUDOMAP = 'true' - -var PM = require('../') -runTests(PM) - -// if possible, verify that Map also behaves the same way -if (typeof Map === 'function') - runTests(Map) - - -function runTests (Map) { - t.throws(Map) - - var m = new Map() - - t.equal(m.size, 0) - - m.set(1, '1 string') - t.equal(m.get(1), '1 string') - t.equal(m.size, 1) - m.size = 1000 - t.equal(m.size, 1) - m.size = 0 - t.equal(m.size, 1) - - m = new Map([[1, 'number 1'], ['1', 'string 1']]) - t.equal(m.get(1), 'number 1') - t.equal(m.get('1'), 'string 1') - t.equal(m.size, 2) - - m = new Map(m) - t.equal(m.get(1), 'number 1') - t.equal(m.get('1'), 'string 1') - t.equal(m.size, 2) - - var akey = {} - var bkey = {} - m.set(akey, { some: 'data' }) - m.set(bkey, { some: 'other data' }) - t.same(m.get(akey), { some: 'data' }) - t.same(m.get(bkey), { some: 'other data' }) - t.equal(m.size, 4) - - var x = /x/ - var y = /x/ - m.set(x, 'x regex') - m.set(y, 'y regex') - t.equal(m.get(x), 'x regex') - m.set(x, 'x again') - t.equal(m.get(x), 'x again') - t.equal(m.size, 6) - - m.set(NaN, 'not a number') - t.equal(m.get(NaN), 'not a number') - m.set(NaN, 'it is a ' + typeof NaN) - t.equal(m.get(NaN), 'it is a number') - m.set('NaN', 'stringie nan') - t.equal(m.get(NaN), 'it is a number') - t.equal(m.get('NaN'), 'stringie nan') - t.equal(m.size, 8) - - m.delete(NaN) - t.equal(m.get(NaN), undefined) - t.equal(m.size, 7) - - var expect = [ - { value: 'number 1', key: 1 }, - { value: 'string 1', key: '1' }, - { value: { some: 'data' }, key: {} }, - { value: { some: 'other data' }, key: {} }, - { value: 'x again', key: /x/ }, - { value: 'y regex', key: /x/ }, - { value: 'stringie nan', key: 'NaN' } - ] - var actual = [] - - m.forEach(function (value, key) { - actual.push({ value: value, key: key }) - }) - t.same(actual, expect) - - m.clear() - t.equal(m.size, 0) -} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/README.md b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/README.md deleted file mode 100644 index f5861018696..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/README.md +++ /dev/null @@ -1,204 +0,0 @@ -# yallist - -Yet Another Linked List - -There are many doubly-linked list implementations like it, but this -one is mine. - -For when an array would be too big, and a Map can't be iterated in -reverse order. - - -[![Build Status](https://travis-ci.org/isaacs/yallist.svg?branch=master)](https://travis-ci.org/isaacs/yallist) [![Coverage Status](https://coveralls.io/repos/isaacs/yallist/badge.svg?service=github)](https://coveralls.io/github/isaacs/yallist) - -## basic usage - -```javascript -var yallist = require('yallist') -var myList = yallist.create([1, 2, 3]) -myList.push('foo') -myList.unshift('bar') -// of course pop() and shift() are there, too -console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo'] -myList.forEach(function (k) { - // walk the list head to tail -}) -myList.forEachReverse(function (k, index, list) { - // walk the list tail to head -}) -var myDoubledList = myList.map(function (k) { - return k + k -}) -// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo'] -// mapReverse is also a thing -var myDoubledListReverse = myList.mapReverse(function (k) { - return k + k -}) // ['foofoo', 6, 4, 2, 'barbar'] - -var reduced = myList.reduce(function (set, entry) { - set += entry - return set -}, 'start') -console.log(reduced) // 'startfoo123bar' -``` - -## api - -The whole API is considered "public". - -Functions with the same name as an Array method work more or less the -same way. - -There's reverse versions of most things because that's the point. - -### Yallist - -Default export, the class that holds and manages a list. - -Call it with either a forEach-able (like an array) or a set of -arguments, to initialize the list. - -The Array-ish methods all act like you'd expect. No magic length, -though, so if you change that it won't automatically prune or add -empty spots. - -### Yallist.create(..) - -Alias for Yallist function. Some people like factories. - -#### yallist.head - -The first node in the list - -#### yallist.tail - -The last node in the list - -#### yallist.length - -The number of nodes in the list. (Change this at your peril. It is -not magic like Array length.) - -#### yallist.toArray() - -Convert the list to an array. - -#### yallist.forEach(fn, [thisp]) - -Call a function on each item in the list. - -#### yallist.forEachReverse(fn, [thisp]) - -Call a function on each item in the list, in reverse order. - -#### yallist.get(n) - -Get the data at position `n` in the list. If you use this a lot, -probably better off just using an Array. - -#### yallist.getReverse(n) - -Get the data at position `n`, counting from the tail. - -#### yallist.map(fn, thisp) - -Create a new Yallist with the result of calling the function on each -item. - -#### yallist.mapReverse(fn, thisp) - -Same as `map`, but in reverse. - -#### yallist.pop() - -Get the data from the list tail, and remove the tail from the list. - -#### yallist.push(item, ...) - -Insert one or more items to the tail of the list. - -#### yallist.reduce(fn, initialValue) - -Like Array.reduce. - -#### yallist.reduceReverse - -Like Array.reduce, but in reverse. - -#### yallist.reverse - -Reverse the list in place. - -#### yallist.shift() - -Get the data from the list head, and remove the head from the list. - -#### yallist.slice([from], [to]) - -Just like Array.slice, but returns a new Yallist. - -#### yallist.sliceReverse([from], [to]) - -Just like yallist.slice, but the result is returned in reverse. - -#### yallist.toArray() - -Create an array representation of the list. - -#### yallist.toArrayReverse() - -Create a reversed array representation of the list. - -#### yallist.unshift(item, ...) - -Insert one or more items to the head of the list. - -#### yallist.unshiftNode(node) - -Move a Node object to the front of the list. (That is, pull it out of -wherever it lives, and make it the new head.) - -If the node belongs to a different list, then that list will remove it -first. - -#### yallist.pushNode(node) - -Move a Node object to the end of the list. (That is, pull it out of -wherever it lives, and make it the new tail.) - -If the node belongs to a list already, then that list will remove it -first. - -#### yallist.removeNode(node) - -Remove a node from the list, preserving referential integrity of head -and tail and other nodes. - -Will throw an error if you try to have a list remove a node that -doesn't belong to it. - -### Yallist.Node - -The class that holds the data and is actually the list. - -Call with `var n = new Node(value, previousNode, nextNode)` - -Note that if you do direct operations on Nodes themselves, it's very -easy to get into weird states where the list is broken. Be careful :) - -#### node.next - -The next node in the list. - -#### node.prev - -The previous node in the list. - -#### node.value - -The data the node contains. - -#### node.list - -The list to which this node belongs. (Null if it does not belong to -any list.) diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/iterator.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/iterator.js deleted file mode 100644 index 4a15bf22c40..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/iterator.js +++ /dev/null @@ -1,7 +0,0 @@ -var Yallist = require('./yallist.js') - -Yallist.prototype[Symbol.iterator] = function* () { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value - } -} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/package.json b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/package.json deleted file mode 100644 index b0fdf0d0a6f..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "yallist@^2.1.2", - "_id": "yallist@2.1.2", - "_inBundle": false, - "_integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "_location": "/cacache/lru-cache/yallist", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "yallist@^2.1.2", - "name": "yallist", - "escapedName": "yallist", - "rawSpec": "^2.1.2", - "saveSpec": null, - "fetchSpec": "^2.1.2" - }, - "_requiredBy": [ - "/cacache/lru-cache" - ], - "_resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "_shasum": "1c11f9218f076089a47dd512f93c6699a6a81d52", - "_spec": "yallist@^2.1.2", - "_where": "/Users/rebecca/code/npm/node_modules/cacache/node_modules/lru-cache", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/yallist/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Yet Another Linked List", - "devDependencies": { - "tap": "^10.3.0" - }, - "directories": { - "test": "test" - }, - "files": [ - "yallist.js", - "iterator.js" - ], - "homepage": "https://github.com/isaacs/yallist#readme", - "license": "ISC", - "main": "yallist.js", - "name": "yallist", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/yallist.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js --100" - }, - "version": "2.1.2" -} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/yallist.js b/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/yallist.js deleted file mode 100644 index 518d23330b9..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/yallist.js +++ /dev/null @@ -1,370 +0,0 @@ -module.exports = Yallist - -Yallist.Node = Node -Yallist.create = Yallist - -function Yallist (list) { - var self = this - if (!(self instanceof Yallist)) { - self = new Yallist() - } - - self.tail = null - self.head = null - self.length = 0 - - if (list && typeof list.forEach === 'function') { - list.forEach(function (item) { - self.push(item) - }) - } else if (arguments.length > 0) { - for (var i = 0, l = arguments.length; i < l; i++) { - self.push(arguments[i]) - } - } - - return self -} - -Yallist.prototype.removeNode = function (node) { - if (node.list !== this) { - throw new Error('removing node which does not belong to this list') - } - - var next = node.next - var prev = node.prev - - if (next) { - next.prev = prev - } - - if (prev) { - prev.next = next - } - - if (node === this.head) { - this.head = next - } - if (node === this.tail) { - this.tail = prev - } - - node.list.length-- - node.next = null - node.prev = null - node.list = null -} - -Yallist.prototype.unshiftNode = function (node) { - if (node === this.head) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var head = this.head - node.list = this - node.next = head - if (head) { - head.prev = node - } - - this.head = node - if (!this.tail) { - this.tail = node - } - this.length++ -} - -Yallist.prototype.pushNode = function (node) { - if (node === this.tail) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var tail = this.tail - node.list = this - node.prev = tail - if (tail) { - tail.next = node - } - - this.tail = node - if (!this.head) { - this.head = node - } - this.length++ -} - -Yallist.prototype.push = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - push(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.unshift = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - unshift(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.pop = function () { - if (!this.tail) { - return undefined - } - - var res = this.tail.value - this.tail = this.tail.prev - if (this.tail) { - this.tail.next = null - } else { - this.head = null - } - this.length-- - return res -} - -Yallist.prototype.shift = function () { - if (!this.head) { - return undefined - } - - var res = this.head.value - this.head = this.head.next - if (this.head) { - this.head.prev = null - } else { - this.tail = null - } - this.length-- - return res -} - -Yallist.prototype.forEach = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.head, i = 0; walker !== null; i++) { - fn.call(thisp, walker.value, i, this) - walker = walker.next - } -} - -Yallist.prototype.forEachReverse = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { - fn.call(thisp, walker.value, i, this) - walker = walker.prev - } -} - -Yallist.prototype.get = function (n) { - for (var i = 0, walker = this.head; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.next - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.getReverse = function (n) { - for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.prev - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.map = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.head; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.next - } - return res -} - -Yallist.prototype.mapReverse = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.tail; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.prev - } - return res -} - -Yallist.prototype.reduce = function (fn, initial) { - var acc - var walker = this.head - if (arguments.length > 1) { - acc = initial - } else if (this.head) { - walker = this.head.next - acc = this.head.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = 0; walker !== null; i++) { - acc = fn(acc, walker.value, i) - walker = walker.next - } - - return acc -} - -Yallist.prototype.reduceReverse = function (fn, initial) { - var acc - var walker = this.tail - if (arguments.length > 1) { - acc = initial - } else if (this.tail) { - walker = this.tail.prev - acc = this.tail.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = this.length - 1; walker !== null; i--) { - acc = fn(acc, walker.value, i) - walker = walker.prev - } - - return acc -} - -Yallist.prototype.toArray = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.head; walker !== null; i++) { - arr[i] = walker.value - walker = walker.next - } - return arr -} - -Yallist.prototype.toArrayReverse = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.tail; walker !== null; i++) { - arr[i] = walker.value - walker = walker.prev - } - return arr -} - -Yallist.prototype.slice = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = 0, walker = this.head; walker !== null && i < from; i++) { - walker = walker.next - } - for (; walker !== null && i < to; i++, walker = walker.next) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.sliceReverse = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { - walker = walker.prev - } - for (; walker !== null && i > from; i--, walker = walker.prev) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.reverse = function () { - var head = this.head - var tail = this.tail - for (var walker = head; walker !== null; walker = walker.prev) { - var p = walker.prev - walker.prev = walker.next - walker.next = p - } - this.head = tail - this.tail = head - return this -} - -function push (self, item) { - self.tail = new Node(item, self.tail, null, self) - if (!self.head) { - self.head = self.tail - } - self.length++ -} - -function unshift (self, item) { - self.head = new Node(item, null, self.head, self) - if (!self.tail) { - self.tail = self.head - } - self.length++ -} - -function Node (value, prev, next, list) { - if (!(this instanceof Node)) { - return new Node(value, prev, next, list) - } - - this.list = list - this.value = value - - if (prev) { - prev.next = this - this.prev = prev - } else { - this.prev = null - } - - if (next) { - next.prev = this - this.next = next - } else { - this.next = null - } -} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/package.json b/deps/npm/node_modules/cacache/node_modules/lru-cache/package.json deleted file mode 100644 index b0b037c1287..00000000000 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "_from": "lru-cache@^4.1.1", - "_id": "lru-cache@4.1.1", - "_inBundle": false, - "_integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", - "_location": "/cacache/lru-cache", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "lru-cache@^4.1.1", - "name": "lru-cache", - "escapedName": "lru-cache", - "rawSpec": "^4.1.1", - "saveSpec": null, - "fetchSpec": "^4.1.1" - }, - "_requiredBy": [ - "/cacache" - ], - "_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "_shasum": "622e32e82488b49279114a4f9ecf45e7cd6bba55", - "_spec": "lru-cache@^4.1.1", - "_where": "/Users/rebecca/code/npm/node_modules/cacache", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me" - }, - "bugs": { - "url": "https://github.com/isaacs/node-lru-cache/issues" - }, - "bundleDependencies": false, - "dependencies": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - }, - "deprecated": false, - "description": "A cache object that deletes the least-recently-used items.", - "devDependencies": { - "benchmark": "^2.1.4", - "standard": "^5.4.1", - "tap": "^10.3.3" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/isaacs/node-lru-cache#readme", - "keywords": [ - "mru", - "lru", - "cache" - ], - "license": "ISC", - "main": "index.js", - "name": "lru-cache", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/node-lru-cache.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "posttest": "standard test/*.js index.js", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js --100 -J" - }, - "version": "4.1.1" -} diff --git a/deps/npm/node_modules/cacache/node_modules/ssri/CHANGELOG.md b/deps/npm/node_modules/cacache/node_modules/ssri/CHANGELOG.md new file mode 100644 index 00000000000..7ae2b000dce --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/ssri/CHANGELOG.md @@ -0,0 +1,190 @@ +# 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/ssri/compare/v4.1.6...v5.0.0) (2017-10-23) + + +### Features + +* **license:** relicense to ISC (#9) ([c82983a](https://github.com/zkat/ssri/commit/c82983a)) + + +### BREAKING CHANGES + +* **license:** the license has been changed from CC0-1.0 to ISC. + + + +<a name="4.1.6"></a> +## [4.1.6](https://github.com/zkat/ssri/compare/v4.1.5...v4.1.6) (2017-06-07) + + +### Bug Fixes + +* **checkStream:** make sure to pass all opts through ([0b1bcbe](https://github.com/zkat/ssri/commit/0b1bcbe)) + + + +<a name="4.1.5"></a> +## [4.1.5](https://github.com/zkat/ssri/compare/v4.1.4...v4.1.5) (2017-06-05) + + +### Bug Fixes + +* **integrityStream:** stop crashing if opts.algorithms and opts.integrity have an algo mismatch ([fb1293e](https://github.com/zkat/ssri/commit/fb1293e)) + + + +<a name="4.1.4"></a> +## [4.1.4](https://github.com/zkat/ssri/compare/v4.1.3...v4.1.4) (2017-05-31) + + +### Bug Fixes + +* **node:** older versions of node[@4](https://github.com/4) do not support base64buffer string parsing ([513df4e](https://github.com/zkat/ssri/commit/513df4e)) + + + +<a name="4.1.3"></a> +## [4.1.3](https://github.com/zkat/ssri/compare/v4.1.2...v4.1.3) (2017-05-24) + + +### Bug Fixes + +* **check:** handle various bad hash corner cases better ([c2c262b](https://github.com/zkat/ssri/commit/c2c262b)) + + + +<a name="4.1.2"></a> +## [4.1.2](https://github.com/zkat/ssri/compare/v4.1.1...v4.1.2) (2017-04-18) + + +### Bug Fixes + +* **stream:** _flush can be called multiple times. use on("end") ([b1c4805](https://github.com/zkat/ssri/commit/b1c4805)) + + + +<a name="4.1.1"></a> +## [4.1.1](https://github.com/zkat/ssri/compare/v4.1.0...v4.1.1) (2017-04-12) + + +### Bug Fixes + +* **pickAlgorithm:** error if pickAlgorithm() is used in an empty Integrity ([fab470e](https://github.com/zkat/ssri/commit/fab470e)) + + + +<a name="4.1.0"></a> +# [4.1.0](https://github.com/zkat/ssri/compare/v4.0.0...v4.1.0) (2017-04-07) + + +### Features + +* adding ssri.create for a crypto style interface (#2) ([96f52ad](https://github.com/zkat/ssri/commit/96f52ad)) + + + +<a name="4.0.0"></a> +# [4.0.0](https://github.com/zkat/ssri/compare/v3.0.2...v4.0.0) (2017-04-03) + + +### Bug Fixes + +* **integrity:** should have changed the error code before. oops ([8381afa](https://github.com/zkat/ssri/commit/8381afa)) + + +### BREAKING CHANGES + +* **integrity:** EBADCHECKSUM -> EINTEGRITY for verification errors + + + +<a name="3.0.2"></a> +## [3.0.2](https://github.com/zkat/ssri/compare/v3.0.1...v3.0.2) (2017-04-03) + + + +<a name="3.0.1"></a> +## [3.0.1](https://github.com/zkat/ssri/compare/v3.0.0...v3.0.1) (2017-04-03) + + +### Bug Fixes + +* **package.json:** really should have these in the keywords because search ([a6ac6d0](https://github.com/zkat/ssri/commit/a6ac6d0)) + + + +<a name="3.0.0"></a> +# [3.0.0](https://github.com/zkat/ssri/compare/v2.0.0...v3.0.0) (2017-04-03) + + +### Bug Fixes + +* **hashes:** IntegrityMetadata -> Hash ([d04aa1f](https://github.com/zkat/ssri/commit/d04aa1f)) + + +### Features + +* **check:** return IntegrityMetadata on check success ([2301e74](https://github.com/zkat/ssri/commit/2301e74)) +* **fromHex:** ssri.fromHex to make it easier to generate them from hex valus ([049b89e](https://github.com/zkat/ssri/commit/049b89e)) +* **hex:** utility function for getting hex version of digest ([a9f021c](https://github.com/zkat/ssri/commit/a9f021c)) +* **hexDigest:** added hexDigest method to Integrity objects too ([85208ba](https://github.com/zkat/ssri/commit/85208ba)) +* **integrity:** add .isIntegrity and .isIntegrityMetadata ([1b29e6f](https://github.com/zkat/ssri/commit/1b29e6f)) +* **integrityStream:** new stream that can both generate and check streamed data ([fd23e1b](https://github.com/zkat/ssri/commit/fd23e1b)) +* **parse:** allow parsing straight into a single IntegrityMetadata object ([c8ddf48](https://github.com/zkat/ssri/commit/c8ddf48)) +* **pickAlgorithm:** Intergrity#pickAlgorithm() added ([b97a796](https://github.com/zkat/ssri/commit/b97a796)) +* **size:** calculate and update stream sizes ([02ed1ad](https://github.com/zkat/ssri/commit/02ed1ad)) + + +### BREAKING CHANGES + +* **hashes:** `.isIntegrityMetadata` is now `.isHash`. Also, any references to `IntegrityMetadata` now refer to `Hash`. +* **integrityStream:** createCheckerStream has been removed and replaced with a general-purpose integrityStream. + +To convert existing createCheckerStream code, move the `sri` argument into `opts.integrity` in integrityStream. All other options should be the same. +* **check:** `checkData`, `checkStream`, and `createCheckerStream` now yield a whole IntegrityMetadata instance representing the first successful hash match. + + + +<a name="2.0.0"></a> +# [2.0.0](https://github.com/zkat/ssri/compare/v1.0.0...v2.0.0) (2017-03-24) + + +### Bug Fixes + +* **strict-mode:** make regexes more rigid ([122a32c](https://github.com/zkat/ssri/commit/122a32c)) + + +### Features + +* **api:** added serialize alias for unparse ([999b421](https://github.com/zkat/ssri/commit/999b421)) +* **concat:** add Integrity#concat() ([cae12c7](https://github.com/zkat/ssri/commit/cae12c7)) +* **pickAlgo:** pick the strongest algorithm provided, by default ([58c18f7](https://github.com/zkat/ssri/commit/58c18f7)) +* **strict-mode:** strict SRI support ([3f0b64c](https://github.com/zkat/ssri/commit/3f0b64c)) +* **stringify:** replaced unparse/serialize with stringify ([4acad30](https://github.com/zkat/ssri/commit/4acad30)) +* **verification:** add opts.pickAlgorithm ([f72e658](https://github.com/zkat/ssri/commit/f72e658)) + + +### BREAKING CHANGES + +* **pickAlgo:** ssri will prioritize specific hashes now +* **stringify:** serialize and unparse have been removed. Use ssri.stringify instead. +* **strict-mode:** functions that accepted an optional `sep` argument now expect `opts.sep`. + + + +<a name="1.0.0"></a> +# 1.0.0 (2017-03-23) + + +### Features + +* **api:** implemented initial api ([4fbb16b](https://github.com/zkat/ssri/commit/4fbb16b)) + + +### BREAKING CHANGES + +* **api:** Initial API established. diff --git a/deps/npm/node_modules/cacache/node_modules/ssri/LICENSE.md b/deps/npm/node_modules/cacache/node_modules/ssri/LICENSE.md new file mode 100644 index 00000000000..8d28acf866d --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/ssri/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/cacache/node_modules/ssri/README.md b/deps/npm/node_modules/cacache/node_modules/ssri/README.md new file mode 100644 index 00000000000..f2fc035da52 --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/ssri/README.md @@ -0,0 +1,462 @@ +# ssri [![npm version](https://img.shields.io/npm/v/ssri.svg)](https://npm.im/ssri) [![license](https://img.shields.io/npm/l/ssri.svg)](https://npm.im/ssri) [![Travis](https://img.shields.io/travis/zkat/ssri.svg)](https://travis-ci.org/zkat/ssri) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/ssri?svg=true)](https://ci.appveyor.com/project/zkat/ssri) [![Coverage Status](https://coveralls.io/repos/github/zkat/ssri/badge.svg?branch=latest)](https://coveralls.io/github/zkat/ssri?branch=latest) + +[`ssri`](https://github.com/zkat/ssri), short for Standard Subresource +Integrity, is a Node.js utility for parsing, manipulating, serializing, +generating, and verifying [Subresource +Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) hashes. + +## Install + +`$ npm install --save ssri` + +## Table of Contents + +* [Example](#example) +* [Features](#features) +* [Contributing](#contributing) +* [API](#api) + * Parsing & Serializing + * [`parse`](#parse) + * [`stringify`](#stringify) + * [`Integrity#concat`](#integrity-concat) + * [`Integrity#toString`](#integrity-to-string) + * [`Integrity#toJSON`](#integrity-to-json) + * [`Integrity#pickAlgorithm`](#integrity-pick-algorithm) + * [`Integrity#hexDigest`](#integrity-hex-digest) + * Integrity Generation + * [`fromHex`](#from-hex) + * [`fromData`](#from-data) + * [`fromStream`](#from-stream) + * [`create`](#create) + * Integrity Verification + * [`checkData`](#check-data) + * [`checkStream`](#check-stream) + * [`integrityStream`](#integrity-stream) + +### Example + +```javascript +const ssri = require('ssri') + +const integrity = 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' + +// Parsing and serializing +const parsed = ssri.parse(integrity) +ssri.stringify(parsed) // === integrity (works on non-Integrity objects) +parsed.toString() // === integrity + +// Async stream functions +ssri.checkStream(fs.createReadStream('./my-file'), integrity).then(...) +ssri.fromStream(fs.createReadStream('./my-file')).then(sri => { + sri.toString() === integrity +}) +fs.createReadStream('./my-file').pipe(ssri.createCheckerStream(sri)) + +// Sync data functions +ssri.fromData(fs.readFileSync('./my-file')) // === parsed +ssri.checkData(fs.readFileSync('./my-file'), integrity) // => 'sha512' +``` + +### Features + +* Parses and stringifies SRI strings. +* Generates SRI strings from raw data or Streams. +* Strict standard compliance. +* `?foo` metadata option support. +* Multiple entries for the same algorithm. +* Object-based integrity hash manipulation. +* Small footprint: no dependencies, concise implementation. +* Full test coverage. +* Customizable algorithm picker. + +### Contributing + +The ssri 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. + +### API + +#### <a name="parse"></a> `> ssri.parse(sri, [opts]) -> Integrity` + +Parses `sri` into an `Integrity` data structure. `sri` can be an integrity +string, an `Hash`-like with `digest` and `algorithm` fields and an optional +`options` field, or an `Integrity`-like object. The resulting object will be an +`Integrity` instance that has this shape: + +```javascript +{ + 'sha1': [{algorithm: 'sha1', digest: 'deadbeef', options: []}], + 'sha512': [ + {algorithm: 'sha512', digest: 'c0ffee', options: []}, + {algorithm: 'sha512', digest: 'bad1dea', options: ['foo']} + ], +} +``` + +If `opts.single` is truthy, a single `Hash` object will be returned. That is, a +single object that looks like `{algorithm, digest, options}`, as opposed to a +larger object with multiple of these. + +If `opts.strict` is truthy, the resulting object will be filtered such that +it strictly follows the Subresource Integrity spec, throwing away any entries +with any invalid components. This also means a restricted set of algorithms +will be used -- the spec limits them to `sha256`, `sha384`, and `sha512`. + +Strict mode is recommended if the integrity strings are intended for use in +browsers, or in other situations where strict adherence to the spec is needed. + +##### Example + +```javascript +ssri.parse('sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo') // -> Integrity object +``` + +#### <a name="stringify"></a> `> ssri.stringify(sri, [opts]) -> String` + +This function is identical to [`Integrity#toString()`](#integrity-to-string), +except it can be used on _any_ object that [`parse`](#parse) can handle -- that +is, a string, an `Hash`-like, or an `Integrity`-like. + +The `opts.sep` option defines the string to use when joining multiple entries +together. To be spec-compliant, this _must_ be whitespace. The default is a +single space (`' '`). + +If `opts.strict` is true, the integrity string will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +// Useful for cleaning up input SRI strings: +ssri.stringify('\n\rsha512-foo\n\t\tsha384-bar') +// -> 'sha512-foo sha384-bar' + +// Hash-like: only a single entry. +ssri.stringify({ + algorithm: 'sha512', + digest:'9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==', + options: ['foo'] +}) +// -> +// 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' + +// Integrity-like: full multi-entry syntax. Similar to output of `ssri.parse` +ssri.stringify({ + 'sha512': [ + { + algorithm: 'sha512', + digest:'9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==', + options: ['foo'] + } + ] +}) +// -> +// 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' +``` + +#### <a name="integrity-concat"></a> `> Integrity#concat(otherIntegrity, [opts]) -> Integrity` + +Concatenates an `Integrity` object with another IntegrityLike, or an integrity +string. + +This is functionally equivalent to concatenating the string format of both +integrity arguments, and calling [`ssri.parse`](#ssri-parse) on the new string. + +If `opts.strict` is true, the new `Integrity` will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +// This will combine the integrity checks for two different versions of +// your index.js file so you can use a single integrity string and serve +// either of these to clients, from a single `<script>` tag. +const desktopIntegrity = ssri.fromData(fs.readFileSync('./index.desktop.js')) +const mobileIntegrity = ssri.fromData(fs.readFileSync('./index.mobile.js')) + +// Note that browsers (and ssri) will succeed as long as ONE of the entries +// for the *prioritized* algorithm succeeds. That is, in order for this fallback +// to work, both desktop and mobile *must* use the same `algorithm` values. +desktopIntegrity.concat(mobileIntegrity) +``` + +#### <a name="integrity-to-string"></a> `> Integrity#toString([opts]) -> String` + +Returns the string representation of an `Integrity` object. All hash entries +will be concatenated in the string by `opts.sep`, which defaults to `' '`. + +If you want to serialize an object that didn't from from an `ssri` function, +use [`ssri.stringify()`](#stringify). + +If `opts.strict` is true, the integrity string will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +const integrity = 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' + +ssri.parse(integrity).toString() === integrity +``` + +#### <a name="integrity-to-json"></a> `> Integrity#toJSON() -> String` + +Returns the string representation of an `Integrity` object. All hash entries +will be concatenated in the string by `' '`. + +This is a convenience method so you can pass an `Integrity` object directly to `JSON.stringify`. +For more info check out [toJSON() behavior on mdn](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON%28%29_behavior). + +##### Example + +```javascript +const integrity = '"sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo"' + +JSON.stringify(ssri.parse(integrity)) === integrity +``` + +#### <a name="integrity-pick-algorithm"></a> `> Integrity#pickAlgorithm([opts]) -> String` + +Returns the "best" algorithm from those available in the integrity object. + +If `opts.pickAlgorithm` is provided, it will be passed two algorithms as +arguments. ssri will prioritize whichever of the two algorithms is returned by +this function. Note that the function may be called multiple times, and it +**must** return one of the two algorithms provided. By default, ssri will make +a best-effort to pick the strongest/most reliable of the given algorithms. It +may intentionally deprioritize algorithms with known vulnerabilities. + +##### Example + +```javascript +ssri.parse('sha1-WEakDigEST sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1').pickAlgorithm() // sha512 +``` + +#### <a name="integrity-hex-digest"></a> `> Integrity#hexDigest() -> String` + +`Integrity` is assumed to be either a single-hash `Integrity` instance, or a +`Hash` instance. Returns its `digest`, converted to a hex representation of the +base64 data. + +##### Example + +```javascript +ssri.parse('sha1-deadbeef').hexDigest() // '75e69d6de79f' +``` + +#### <a name="from-hex"></a> `> ssri.fromHex(hexDigest, algorithm, [opts]) -> Integrity` + +Creates an `Integrity` object with a single entry, based on a hex-formatted +hash. This is a utility function to help convert existing shasums to the +Integrity format, and is roughly equivalent to something like: + +```javascript +algorithm + '-' + Buffer.from(hexDigest, 'hex').toString('base64') +``` + +`opts.options` may optionally be passed in: it must be an array of option +strings that will be added to all generated integrity hashes generated by +`fromData`. This is a loosely-specified feature of SRIs, and currently has no +specified semantics besides being `?`-separated. Use at your own risk, and +probably avoid if your integrity strings are meant to be used with browsers. + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +If `opts.single` is true, a single `Hash` object will be returned. + +##### Example + +```javascript +ssri.fromHex('75e69d6de79f', 'sha1').toString() // 'sha1-deadbeef' +``` + +#### <a name="from-data"></a> `> ssri.fromData(data, [opts]) -> Integrity` + +Creates an `Integrity` object from either string or `Buffer` data, calculating +all the requested hashes and adding any specified options to the object. + +`opts.algorithms` determines which algorithms to generate hashes for. All +results will be included in a single `Integrity` object. The default value for +`opts.algorithms` is `['sha512']`. All algorithm strings must be hashes listed +in `crypto.getHashes()` for the host Node.js platform. + +`opts.options` may optionally be passed in: it must be an array of option +strings that will be added to all generated integrity hashes generated by +`fromData`. This is a loosely-specified feature of SRIs, and currently has no +specified semantics besides being `?`-separated. Use at your own risk, and +probably avoid if your integrity strings are meant to be used with browsers. + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +const integrityObj = ssri.fromData('foobarbaz', { + algorithms: ['sha256', 'sha384', 'sha512'] +}) +integrity.toString('\n') +// -> +// sha256-l981iLWj8kurw4UbNy8Lpxqdzd7UOxS50Glhv8FwfZ0= +// sha384-irnCxQ0CfQhYGlVAUdwTPC9bF3+YWLxlaDGM4xbYminxpbXEq+D+2GCEBTxcjES9 +// sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1+9vBnypkYWg== +``` + +#### <a name="from-stream"></a> `> ssri.fromStream(stream, [opts]) -> Promise<Integrity>` + +Returns a Promise of an Integrity object calculated by reading data from +a given `stream`. + +It accepts both `opts.algorithms` and `opts.options`, which are documented as +part of [`ssri.fromData`](#from-data). + +Additionally, `opts.Promise` may be passed in to inject a Promise library of +choice. By default, ssri will use Node's built-in Promises. + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +ssri.fromStream(fs.createReadStream('index.js'), { + algorithms: ['sha1', 'sha512'] +}).then(integrity => { + return ssri.checkStream(fs.createReadStream('index.js'), integrity) +}) // succeeds +``` + +#### <a name="create"></a> `> ssri.create([opts]) -> <Hash>` + +Returns a Hash object with `update(<Buffer or string>[,enc])` and `digest()` methods. + + +The Hash object provides the same methods as [crypto class Hash](https://nodejs.org/dist/latest-v6.x/docs/api/crypto.html#crypto_class_hash). +`digest()` accepts no arguments and returns an Integrity object calculated by reading data from +calls to update. + +It accepts both `opts.algorithms` and `opts.options`, which are documented as +part of [`ssri.fromData`](#from-data). + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +const integrity = ssri.create().update('foobarbaz').digest() +integrity.toString() +// -> +// sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1+9vBnypkYWg== +``` + +#### <a name="check-data"></a> `> ssri.checkData(data, sri, [opts]) -> Hash|false` + +Verifies `data` integrity against an `sri` argument. `data` may be either a +`String` or a `Buffer`, and `sri` can be any subresource integrity +representation that [`ssri.parse`](#parse) can handle. + +If verification succeeds, `checkData` will return the name of the algorithm that +was used for verification (a truthy value). Otherwise, it will return `false`. + +If `opts.pickAlgorithm` is provided, it will be used by +[`Integrity#pickAlgorithm`](#integrity-pick-algorithm) when deciding which of +the available digests to match against. + +##### Example + +```javascript +const data = fs.readFileSync('index.js') +ssri.checkData(data, ssri.fromData(data)) // -> 'sha512' +ssri.checkData(data, 'sha256-l981iLWj8kurw4UbNy8Lpxqdzd7UOxS50Glhv8FwfZ0') +ssri.checkData(data, 'sha1-BaDDigEST') // -> false +``` + +#### <a name="check-stream"></a> `> ssri.checkStream(stream, sri, [opts]) -> Promise<Hash>` + +Verifies the contents of `stream` against an `sri` argument. `stream` will be +consumed in its entirety by this process. `sri` can be any subresource integrity +representation that [`ssri.parse`](#parse) can handle. + +`checkStream` will return a Promise that either resolves to the +`Hash` that succeeded verification, or, if the verification fails +or an error happens with `stream`, the Promise will be rejected. + +If the Promise is rejected because verification failed, the returned error will +have `err.code` as `EINTEGRITY`. + +If `opts.size` is given, it will be matched against the stream size. An error +with `err.code` `EBADSIZE` will be returned by a rejection if the expected size +and actual size fail to match. + +If `opts.pickAlgorithm` is provided, it will be used by +[`Integrity#pickAlgorithm`](#integrity-pick-algorithm) when deciding which of +the available digests to match against. + +##### Example + +```javascript +const integrity = ssri.fromData(fs.readFileSync('index.js')) + +ssri.checkStream( + fs.createReadStream('index.js'), + integrity +) +// -> +// Promise<{ +// algorithm: 'sha512', +// digest: 'sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1' +// }> + +ssri.checkStream( + fs.createReadStream('index.js'), + 'sha256-l981iLWj8kurw4UbNy8Lpxqdzd7UOxS50Glhv8FwfZ0' +) // -> Promise<Hash> + +ssri.checkStream( + fs.createReadStream('index.js'), + 'sha1-BaDDigEST' +) // -> Promise<Error<{code: 'EINTEGRITY'}>> +``` + +#### <a name="integrity-stream"></a> `> integrityStream(sri, [opts]) -> IntegrityStream` + +Returns a `Transform` stream that data can be piped through in order to generate +and optionally check data integrity for piped data. When the stream completes +successfully, it emits `size` and `integrity` events, containing the total +number of bytes processed and a calculated `Integrity` instance based on stream +data, respectively. + +If `opts.algorithms` is passed in, the listed algorithms will be calculated when +generating the final `Integrity` instance. The default is `['sha512']`. + +If `opts.single` is passed in, a single `Hash` instance will be returned. + +If `opts.integrity` is passed in, it should be an `integrity` value understood +by [`parse`](#parse) that the stream will check the data against. If +verification succeeds, the integrity stream will emit a `verified` event whose +value is a single `Hash` object that is the one that succeeded verification. If +verification fails, the stream will error with an `EINTEGRITY` error code. + +If `opts.size` is given, it will be matched against the stream size. An error +with `err.code` `EBADSIZE` will be emitted by the stream if the expected size +and actual size fail to match. + +If `opts.pickAlgorithm` is provided, it will be passed two algorithms as +arguments. ssri will prioritize whichever of the two algorithms is returned by +this function. Note that the function may be called multiple times, and it +**must** return one of the two algorithms provided. By default, ssri will make +a best-effort to pick the strongest/most reliable of the given algorithms. It +may intentionally deprioritize algorithms with known vulnerabilities. + +##### Example + +```javascript +const integrity = ssri.fromData(fs.readFileSync('index.js')) +fs.createReadStream('index.js') +.pipe(ssri.checkStream(integrity)) +``` diff --git a/deps/npm/node_modules/cacache/node_modules/ssri/index.js b/deps/npm/node_modules/cacache/node_modules/ssri/index.js new file mode 100644 index 00000000000..8ece662ba65 --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/ssri/index.js @@ -0,0 +1,334 @@ +'use strict' + +const Buffer = require('safe-buffer').Buffer + +const crypto = require('crypto') +const Transform = require('stream').Transform + +const SPEC_ALGORITHMS = ['sha256', 'sha384', 'sha512'] + +const BASE64_REGEX = /^[a-z0-9+/]+(?:=?=?)$/i +const SRI_REGEX = /^([^-]+)-([^?]+)([?\S*]*)$/ +const STRICT_SRI_REGEX = /^([^-]+)-([A-Za-z0-9+/]+(?:=?=?))([?\x21-\x7E]*)$/ +const VCHAR_REGEX = /^[\x21-\x7E]+$/ + +class Hash { + get isHash () { return true } + constructor (hash, opts) { + const strict = !!(opts && opts.strict) + this.source = hash.trim() + // 3.1. Integrity metadata (called "Hash" by ssri) + // https://w3c.github.io/webappsec-subresource-integrity/#integrity-metadata-description + const match = this.source.match( + strict + ? STRICT_SRI_REGEX + : SRI_REGEX + ) + if (!match) { return } + if (strict && !SPEC_ALGORITHMS.some(a => a === match[1])) { return } + this.algorithm = match[1] + this.digest = match[2] + + const rawOpts = match[3] + this.options = rawOpts ? rawOpts.slice(1).split('?') : [] + } + hexDigest () { + return this.digest && Buffer.from(this.digest, 'base64').toString('hex') + } + toJSON () { + return this.toString() + } + toString (opts) { + if (opts && opts.strict) { + // Strict mode enforces the standard as close to the foot of the + // letter as it can. + if (!( + // The spec has very restricted productions for algorithms. + // https://www.w3.org/TR/CSP2/#source-list-syntax + SPEC_ALGORITHMS.some(x => x === this.algorithm) && + // Usually, if someone insists on using a "different" base64, we + // leave it as-is, since there's multiple standards, and the + // specified is not a URL-safe variant. + // https://www.w3.org/TR/CSP2/#base64_value + this.digest.match(BASE64_REGEX) && + // Option syntax is strictly visual chars. + // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-option-expression + // https://tools.ietf.org/html/rfc5234#appendix-B.1 + (this.options || []).every(opt => opt.match(VCHAR_REGEX)) + )) { + return '' + } + } + const options = this.options && this.options.length + ? `?${this.options.join('?')}` + : '' + return `${this.algorithm}-${this.digest}${options}` + } +} + +class Integrity { + get isIntegrity () { return true } + toJSON () { + return this.toString() + } + toString (opts) { + opts = opts || {} + let sep = opts.sep || ' ' + if (opts.strict) { + // Entries must be separated by whitespace, according to spec. + sep = sep.replace(/\S+/g, ' ') + } + return Object.keys(this).map(k => { + return this[k].map(hash => { + return Hash.prototype.toString.call(hash, opts) + }).filter(x => x.length).join(sep) + }).filter(x => x.length).join(sep) + } + concat (integrity, opts) { + const other = typeof integrity === 'string' + ? integrity + : stringify(integrity, opts) + return parse(`${this.toString(opts)} ${other}`, opts) + } + hexDigest () { + return parse(this, {single: true}).hexDigest() + } + pickAlgorithm (opts) { + const pickAlgorithm = (opts && opts.pickAlgorithm) || getPrioritizedHash + const keys = Object.keys(this) + if (!keys.length) { + throw new Error(`No algorithms available for ${ + JSON.stringify(this.toString()) + }`) + } + return keys.reduce((acc, algo) => { + return pickAlgorithm(acc, algo) || acc + }) + } +} + +module.exports.parse = parse +function parse (sri, opts) { + opts = opts || {} + if (typeof sri === 'string') { + return _parse(sri, opts) + } else if (sri.algorithm && sri.digest) { + const fullSri = new Integrity() + fullSri[sri.algorithm] = [sri] + return _parse(stringify(fullSri, opts), opts) + } else { + return _parse(stringify(sri, opts), opts) + } +} + +function _parse (integrity, opts) { + // 3.4.3. Parse metadata + // https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata + if (opts.single) { + return new Hash(integrity, opts) + } + return integrity.trim().split(/\s+/).reduce((acc, string) => { + const hash = new Hash(string, opts) + if (hash.algorithm && hash.digest) { + const algo = hash.algorithm + if (!acc[algo]) { acc[algo] = [] } + acc[algo].push(hash) + } + return acc + }, new Integrity()) +} + +module.exports.stringify = stringify +function stringify (obj, opts) { + if (obj.algorithm && obj.digest) { + return Hash.prototype.toString.call(obj, opts) + } else if (typeof obj === 'string') { + return stringify(parse(obj, opts), opts) + } else { + return Integrity.prototype.toString.call(obj, opts) + } +} + +module.exports.fromHex = fromHex +function fromHex (hexDigest, algorithm, opts) { + const optString = (opts && opts.options && opts.options.length) + ? `?${opts.options.join('?')}` + : '' + return parse( + `${algorithm}-${ + Buffer.from(hexDigest, 'hex').toString('base64') + }${optString}`, opts + ) +} + +module.exports.fromData = fromData +function fromData (data, opts) { + opts = opts || {} + const algorithms = opts.algorithms || ['sha512'] + const optString = opts.options && opts.options.length + ? `?${opts.options.join('?')}` + : '' + return algorithms.reduce((acc, algo) => { + const digest = crypto.createHash(algo).update(data).digest('base64') + const hash = new Hash( + `${algo}-${digest}${optString}`, + opts + ) + if (hash.algorithm && hash.digest) { + const algo = hash.algorithm + if (!acc[algo]) { acc[algo] = [] } + acc[algo].push(hash) + } + return acc + }, new Integrity()) +} + +module.exports.fromStream = fromStream +function fromStream (stream, opts) { + opts = opts || {} + const P = opts.Promise || Promise + const istream = integrityStream(opts) + return new P((resolve, reject) => { + stream.pipe(istream) + stream.on('error', reject) + istream.on('error', reject) + let sri + istream.on('integrity', s => { sri = s }) + istream.on('end', () => resolve(sri)) + istream.on('data', () => {}) + }) +} + +module.exports.checkData = checkData +function checkData (data, sri, opts) { + opts = opts || {} + sri = parse(sri, opts) + if (!Object.keys(sri).length) { return false } + const algorithm = sri.pickAlgorithm(opts) + const digests = sri[algorithm] || [] + const digest = crypto.createHash(algorithm).update(data).digest('base64') + return digests.find(hash => hash.digest === digest) || false +} + +module.exports.checkStream = checkStream +function checkStream (stream, sri, opts) { + opts = opts || {} + const P = opts.Promise || Promise + const checker = integrityStream(Object.assign({}, opts, { + integrity: sri + })) + return new P((resolve, reject) => { + stream.pipe(checker) + stream.on('error', reject) + checker.on('error', reject) + let sri + checker.on('verified', s => { sri = s }) + checker.on('end', () => resolve(sri)) + checker.on('data', () => {}) + }) +} + +module.exports.integrityStream = integrityStream +function integrityStream (opts) { + opts = opts || {} + // For verification + const sri = opts.integrity && parse(opts.integrity, opts) + const goodSri = sri && Object.keys(sri).length + const algorithm = goodSri && sri.pickAlgorithm(opts) + const digests = goodSri && sri[algorithm] + // Calculating stream + const algorithms = opts.algorithms || [algorithm || 'sha512'] + const hashes = algorithms.map(crypto.createHash) + let streamSize = 0 + const stream = new Transform({ + transform (chunk, enc, cb) { + streamSize += chunk.length + hashes.forEach(h => h.update(chunk, enc)) + cb(null, chunk, enc) + } + }).on('end', () => { + const optString = (opts.options && opts.options.length) + ? `?${opts.options.join('?')}` + : '' + const newSri = parse(hashes.map((h, i) => { + return `${algorithms[i]}-${h.digest('base64')}${optString}` + }).join(' '), opts) + const match = ( + // Integrity verification mode + opts.integrity && + newSri[algorithm] && + digests && + digests.find(hash => { + return newSri[algorithm].find(newhash => { + return hash.digest === newhash.digest + }) + }) + ) + if (typeof opts.size === 'number' && streamSize !== opts.size) { + const err = new Error(`stream size mismatch when checking ${sri}.\n Wanted: ${opts.size}\n Found: ${streamSize}`) + err.code = 'EBADSIZE' + err.found = streamSize + err.expected = opts.size + err.sri = sri + stream.emit('error', err) + } else if (opts.integrity && !match) { + const err = new Error(`${sri} integrity checksum failed when using ${algorithm}: wanted ${digests} but got ${newSri}. (${streamSize} bytes)`) + err.code = 'EINTEGRITY' + err.found = newSri + err.expected = digests + err.algorithm = algorithm + err.sri = sri + stream.emit('error', err) + } else { + stream.emit('size', streamSize) + stream.emit('integrity', newSri) + match && stream.emit('verified', match) + } + }) + return stream +} + +module.exports.create = createIntegrity +function createIntegrity (opts) { + opts = opts || {} + const algorithms = opts.algorithms || ['sha512'] + const optString = opts.options && opts.options.length + ? `?${opts.options.join('?')}` + : '' + + const hashes = algorithms.map(crypto.createHash) + + return { + update: function (chunk, enc) { + hashes.forEach(h => h.update(chunk, enc)) + return this + }, + digest: function (enc) { + const integrity = algorithms.reduce((acc, algo) => { + const digest = hashes.shift().digest('base64') + const hash = new Hash( + `${algo}-${digest}${optString}`, + opts + ) + if (hash.algorithm && hash.digest) { + const algo = hash.algorithm + if (!acc[algo]) { acc[algo] = [] } + acc[algo].push(hash) + } + return acc + }, new Integrity()) + + return integrity + } + } +} + +// This is a Best Effort™ at a reasonable priority for hash algos +const DEFAULT_PRIORITY = [ + 'md5', 'whirlpool', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512' +] +function getPrioritizedHash (algo1, algo2) { + return DEFAULT_PRIORITY.indexOf(algo1.toLowerCase()) >= DEFAULT_PRIORITY.indexOf(algo2.toLowerCase()) + ? algo1 + : algo2 +} diff --git a/deps/npm/node_modules/cacache/node_modules/ssri/package.json b/deps/npm/node_modules/cacache/node_modules/ssri/package.json new file mode 100644 index 00000000000..15b3b5648ae --- /dev/null +++ b/deps/npm/node_modules/cacache/node_modules/ssri/package.json @@ -0,0 +1,89 @@ +{ + "_from": "ssri@^5.0.0", + "_id": "ssri@5.0.0", + "_inBundle": false, + "_integrity": "sha512-728D4yoQcQm1ooZvSbywLkV1RjfITZXh0oWrhM/lnsx3nAHx7LsRGJWB/YyvoceAYRq98xqbstiN4JBv1/wNHg==", + "_location": "/cacache/ssri", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ssri@^5.0.0", + "name": "ssri", + "escapedName": "ssri", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/cacache" + ], + "_resolved": "https://registry.npmjs.org/ssri/-/ssri-5.0.0.tgz", + "_shasum": "13c19390b606c821f2a10d02b351c1729b94d8cf", + "_spec": "ssri@^5.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/cacache", + "author": { + "name": "Kat Marchán", + "email": "kzm@sykosomatic.org" + }, + "bugs": { + "url": "https://github.com/zkat/ssri/issues" + }, + "bundleDependencies": false, + "config": { + "nyc": { + "exclude": [ + "node_modules/**", + "test/**" + ] + } + }, + "dependencies": { + "safe-buffer": "^5.1.0" + }, + "deprecated": false, + "description": "Standard Subresource Integrity library -- parses, serializes, generates, and verifies integrity metadata according to the SRI spec.", + "devDependencies": { + "nyc": "^10.3.2", + "standard": "^9.0.2", + "standard-version": "^4.1.0", + "tap": "^10.3.3", + "weallbehave": "^1.2.0", + "weallcontribute": "^1.0.8" + }, + "files": [ + "*.js" + ], + "homepage": "https://github.com/zkat/ssri#readme", + "keywords": [ + "w3c", + "web", + "security", + "integrity", + "checksum", + "hashing", + "subresource integrity", + "sri", + "sri hash", + "sri string", + "sri generator", + "html" + ], + "license": "ISC", + "main": "index.js", + "name": "ssri", + "repository": { + "type": "git", + "url": "git+https://github.com/zkat/ssri.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/cacache/package.json b/deps/npm/node_modules/cacache/package.json index 3290274a429..221c6051096 100644 --- a/deps/npm/node_modules/cacache/package.json +++ b/deps/npm/node_modules/cacache/package.json @@ -1,10 +1,12 @@ { "_from": "cacache@latest", - "_id": "cacache@9.2.9", + "_id": "cacache@10.0.1", "_inBundle": false, - "_integrity": "sha512-ghg1j5OyTJ6qsrqU++dN23QiTDxb5AZCFGsF3oB+v9v/gY+F4X8L/0gdQMEjd+8Ot3D29M2etX5PKozHRn2JQw==", + "_integrity": "sha512-dRHYcs9LvG9cHgdPzjiI+/eS7e1xRhULrcyOx04RZQsszNJXU2SL9CyG60yLnge282Qq5nwTv+ieK2fH+WPZmA==", "_location": "/cacache", - "_phantomChildren": {}, + "_phantomChildren": { + "safe-buffer": "5.1.1" + }, "_requested": { "type": "tag", "registry": true, @@ -17,14 +19,12 @@ }, "_requiredBy": [ "#USER", - "/", - "/pacote", - "/pacote/make-fetch-happen" + "/" ], - "_resolved": "https://registry.npmjs.org/cacache/-/cacache-9.2.9.tgz", - "_shasum": "f9d7ffe039851ec94c28290662afa4dd4bb9e8dd", + "_resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.1.tgz", + "_shasum": "3e05f6e616117d9b54665b1b20c8aeb93ea5d36f", "_spec": "cacache@latest", - "_where": "/Users/rebecca/code/npm", + "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Kat Marchán", "email": "kzm@sykosomatic.org" @@ -66,7 +66,7 @@ "move-concurrently": "^1.0.1", "promise-inflight": "^1.0.1", "rimraf": "^2.6.1", - "ssri": "^4.1.6", + "ssri": "^5.0.0", "unique-filename": "^1.1.0", "y18n": "^3.2.1" }, @@ -74,15 +74,15 @@ "description": "Fast, fault-tolerant, cross-platform, disk-based, data-agnostic, content-addressable cache.", "devDependencies": { "benchmark": "^2.1.4", - "chalk": "^1.1.3", + "chalk": "^2.0.1", "cross-env": "^5.0.1", - "nyc": "^11.0.2", - "require-inject": "^1.4.0", - "safe-buffer": "^5.1.0", + "nyc": "^11.1.0", + "require-inject": "^1.4.2", + "safe-buffer": "^5.1.1", "standard": "^10.0.2", "standard-version": "^4.2.0", "tacks": "^1.2.2", - "tap": "^10.3.4", + "tap": "^10.7.0", "weallbehave": "^1.2.0", "weallcontribute": "^1.0.8" }, @@ -107,7 +107,7 @@ "disk cache", "disk storage" ], - "license": "CC0-1.0", + "license": "ISC", "main": "index.js", "name": "cacache", "repository": { @@ -125,5 +125,5 @@ "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": "9.2.9" + "version": "10.0.1" } diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/LICENSE b/deps/npm/node_modules/find-npm-prefix/LICENSE index 19129e315fe..7953647e776 100644 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/yallist/LICENSE +++ b/deps/npm/node_modules/find-npm-prefix/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter and Contributors +Copyright 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 diff --git a/deps/npm/node_modules/find-npm-prefix/README.md b/deps/npm/node_modules/find-npm-prefix/README.md new file mode 100644 index 00000000000..77bf4b72427 --- /dev/null +++ b/deps/npm/node_modules/find-npm-prefix/README.md @@ -0,0 +1,28 @@ +# find-npm-prefix + +Find the npm project directory associated with for a given directory + +## USAGE + +``` +const findPrefix = require('find-npm-prefix') + +findPrefix(process.cwd).then(prefix => { + … +}) +``` + +## findPrefix(dir) → Promise(prefix) + +This computes the npm prefix, that is, the directory that npm adds and +removes modules from for a given path. + +It takes a directory as an argument and returns a promise of the associated +prefix directory. + +## Algorithm + +1. If the directory is a `node_modules` folder, scan up the tree till you find a non-`node_modules` directory and return that. +2. Else, look for the first parent directory that contains a `node_modules` or a `package.json` + 1. If one is found, that's the prefix. + 2. If none are found, return the original directory we were given diff --git a/deps/npm/node_modules/find-npm-prefix/find-prefix.js b/deps/npm/node_modules/find-npm-prefix/find-prefix.js new file mode 100644 index 00000000000..089572ec110 --- /dev/null +++ b/deps/npm/node_modules/find-npm-prefix/find-prefix.js @@ -0,0 +1,54 @@ +'use strict' +// try to find the most reasonable prefix to use + +module.exports = findPrefix + +const fs = require('fs') +const path = require('path') +const Bluebird = require('bluebird') +const readdir = Bluebird.promisify(fs.readdir) + +function findPrefix (dir) { + return Bluebird.try(() => { + dir = path.resolve(dir) + + // this is a weird special case where an infinite recurse of + // node_modules folders resolves to the level that contains the + // very first node_modules folder + let walkedUp = false + while (path.basename(dir) === 'node_modules') { + dir = path.dirname(dir) + walkedUp = true + } + if (walkedUp) return dir + + return findPrefix_(dir) + }) +} + +function findPrefix_ (dir, original) { + if (!original) original = dir + + const parent = path.dirname(dir) + // this is a platform independent way of checking if we're in the root + // directory + if (parent === dir) return original + + return readdir(dir).then(files => { + if (files.indexOf('node_modules') !== -1 || + files.indexOf('package.json') !== -1) { + return dir + } + + return findPrefix_(parent, original) + }, er => { + // an error right away is a bad sign. + // unless the prefix was simply a non + // existent directory. + if (er && dir === original && er.code !== 'ENOENT') { + throw er + } else { + return original + } + }) +} diff --git a/deps/npm/node_modules/find-npm-prefix/package.json b/deps/npm/node_modules/find-npm-prefix/package.json new file mode 100644 index 00000000000..4007b90c3cb --- /dev/null +++ b/deps/npm/node_modules/find-npm-prefix/package.json @@ -0,0 +1,59 @@ +{ + "_from": "find-npm-prefix@latest", + "_id": "find-npm-prefix@1.0.1", + "_inBundle": false, + "_integrity": "sha512-I9R7ZnsjlKRvXBJjA1PE4wAkSc24YChoomWdEPTZgeB4DHxf87OutNGV5McFj6WwPghH97nZRejH58XvY6ga6Q==", + "_location": "/find-npm-prefix", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "find-npm-prefix@latest", + "name": "find-npm-prefix", + "escapedName": "find-npm-prefix", + "rawSpec": "latest", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/find-npm-prefix/-/find-npm-prefix-1.0.1.tgz", + "_shasum": "af0faa74e19294b3c8634bae0e91017bb5adfac2", + "_spec": "find-npm-prefix@latest", + "_where": "/Users/rebecca/code/npm", + "author": { + "name": "Rebecca Turner", + "email": "me@re-becca.org", + "url": "http://re-becca.org/" + }, + "bugs": { + "url": "https://github.com/npm/find-npm-prefix/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Find the npm project directory associated with for a given directory", + "devDependencies": { + "require-inject": "^1.4.2", + "standard": "^10.0.3", + "tap": "^10.7.3" + }, + "directories": { + "test": "test" + }, + "homepage": "https://github.com/npm/find-npm-prefix#readme", + "keywords": [], + "license": "ISC", + "main": "find-prefix.js", + "name": "find-npm-prefix", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/find-npm-prefix.git" + }, + "scripts": { + "test": "standard && tap --100 test" + }, + "version": "1.0.1" +} diff --git a/deps/npm/node_modules/find-npm-prefix/test/find-prefix.js b/deps/npm/node_modules/find-npm-prefix/test/find-prefix.js new file mode 100644 index 00000000000..de2ab41cb9d --- /dev/null +++ b/deps/npm/node_modules/find-npm-prefix/test/find-prefix.js @@ -0,0 +1,79 @@ +'use strict' +const Bluebird = require('bluebird') +const test = require('tap').test +const requireInject = require('require-inject') +const findPrefix = requireInject('../find-prefix.js', { + fs: { + readdir: mockReaddir + } +}) + +test('find-prefix', t => { + const tests = { + '/Users/example/code/test1/node_modules': '/Users/example/code/test1', + '/Users/example/code/test1/node_modules/node_modules': '/Users/example/code/test1', + '/Users/example/code/test1/sub1': '/Users/example/code/test1', + '/Users/example/code/test1/sub1/sub1a': '/Users/example/code/test1', + '/Users/example/code/test2': '/Users/example/code/test2', + '/Users/example/code/test2/sub2': '/Users/example/code/test2', + '/Users/example/code': '/Users/example/code', + '/Users/example': '/Users/example', + '/does/not/exist': '/does/not/exist' + } + t.plan(Object.keys(tests).length) + return Bluebird.map(Object.keys(tests), dir => { + return findPrefix(dir).then(pre => { + t.is(pre, tests[dir], dir) + }) + }) +}) + +test('fail-prefix', t => { + return findPrefix('/Users/example/eperm').then(pre => { + t.fail('no eperm') + }).catch(err => { + t.is(err.code, 'EPERM', 'got perm error') + }) +}) + +const fixture = { + 'Users': { + 'example': { + 'code': { + 'test1': { + 'node_modules': { + 'node_modules': {} + }, + 'sub1': { + 'sub1a': {} + } + }, + 'test2': { + 'package.json': {}, + 'sub2': {} + } + } + } + } +} + +function mockReaddir (dir, cb) { + if (/eperm/.test(dir)) { + const err = new Error('Can not read: ' + dir) + err.code = 'EPERM' + return cb(err) + } + const parts = dir.split(/\//).slice(1) + let cwd = fixture + let part + while ((part = parts.shift())) { + if (part in cwd) { + cwd = cwd[part] + } else { + const err = new Error('Does not exist: ' + dir + ' * ' + part) + err.code = 'ENOENT' + return cb(err) + } + } + return cb(null, Object.keys(cwd)) +} diff --git a/deps/npm/node_modules/gentle-fs/CHANGELOG.md b/deps/npm/node_modules/gentle-fs/CHANGELOG.md new file mode 100644 index 00000000000..e9bb23d98b8 --- /dev/null +++ b/deps/npm/node_modules/gentle-fs/CHANGELOG.md @@ -0,0 +1,63 @@ +# 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="2.0.1"></a> +## [2.0.1](https://github.com/npm/gentle-fs/compare/v2.0.0...v2.0.1) (2017-11-28) + + +### Bug Fixes + +* **pkglock:** regenerate lock to fix version issues ([a41cbd0](https://github.com/npm/gentle-fs/commit/a41cbd0)) +* **rm:** make sure logic for vacuuming matches original npm ([673e82c](https://github.com/npm/gentle-fs/commit/673e82c)) + + + +<a name="2.0.0"></a> +# [2.0.0](https://github.com/npm/gentle-fs/compare/v1.0.2...v2.0.0) (2017-10-07) + + +### Features + +* **api:** switch to callbacks for now. ([236e886](https://github.com/npm/gentle-fs/commit/236e886)) + + +### BREAKING CHANGES + +* **api:** switches from Promises to callbacks for async control flow. + + + +<a name="1.0.2"></a> +## [1.0.2](https://github.com/npm/gentle-fs/compare/v1.0.1...v1.0.2) (2017-10-07) + + +### Bug Fixes + +* **link:** properly resolve linkIfExists promise ([f06acf2](https://github.com/npm/gentle-fs/commit/f06acf2)) + + + +<a name="1.0.1"></a> +## [1.0.1](https://github.com/npm/gentle-fs/compare/v1.0.0...v1.0.1) (2017-09-25) + + +### Bug Fixes + +* **files:** include required lib files in tarball ([e0be6a8](https://github.com/npm/gentle-fs/commit/e0be6a8)) + + + +<a name="1.0.0"></a> +# 1.0.0 (2017-09-15) + + +### Bug Fixes + +* **docs:** Flesh out API descriptions. ([b056a34](https://github.com/npm/gentle-fs/commit/b056a34)) +* **docs:** update usage examples ([5517ff5](https://github.com/npm/gentle-fs/commit/5517ff5)) + + +### BREAKING CHANGES + +* **docs:** api docs added diff --git a/deps/npm/node_modules/gentle-fs/LICENSE b/deps/npm/node_modules/gentle-fs/LICENSE new file mode 100644 index 00000000000..0b6c2287459 --- /dev/null +++ b/deps/npm/node_modules/gentle-fs/LICENSE @@ -0,0 +1,235 @@ +The npm application +Copyright (c) npm, Inc. and Contributors +Licensed on the terms of The Artistic License 2.0 + +Node package dependencies of the npm application +Copyright (c) their respective copyright owners +Licensed on their respective license terms + +The npm public registry at https://registry.npmjs.org +and the npm website at https://www.npmjs.com +Operated by npm, Inc. +Use governed by terms published on https://www.npmjs.com + +"Node.js" +Trademark Joyent, Inc., https://joyent.com +Neither npm nor npm, Inc. are affiliated with Joyent, Inc. + +The Node.js application +Project of Node Foundation, https://nodejs.org + +The npm Logo +Copyright (c) Mathias Pettersson and Brian Hammond + +"Gubblebum Blocky" typeface +Copyright (c) Tjarda Koster, https://jelloween.deviantart.com +Used with permission + + +-------- + + +The Artistic License 2.0 + +Copyright (c) 2000-2006, The Perl Foundation. + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +This license establishes the terms under which a given free software +Package may be copied, modified, distributed, and/or redistributed. +The intent is that the Copyright Holder maintains some artistic +control over the development of that Package while still keeping the +Package available as open source and free software. + +You are always permitted to make arrangements wholly outside of this +license directly with the Copyright Holder of a given Package. If the +terms of this license do not permit the full use that you propose to +make of the Package, you should contact the Copyright Holder and seek +a different licensing arrangement. + +Definitions + + "Copyright Holder" means the individual(s) or organization(s) + named in the copyright notice for the entire Package. + + "Contributor" means any party that has contributed code or other + material to the Package, in accordance with the Copyright Holder's + procedures. + + "You" and "your" means any person who would like to copy, + distribute, or modify the Package. + + "Package" means the collection of files distributed by the + Copyright Holder, and derivatives of that collection and/or of + those files. A given Package may consist of either the Standard + Version, or a Modified Version. + + "Distribute" means providing a copy of the Package or making it + accessible to anyone else, or in the case of a company or + organization, to others outside of your company or organization. + + "Distributor Fee" means any fee that you charge for Distributing + this Package or providing support for this Package to another + party. It does not mean licensing fees. + + "Standard Version" refers to the Package if it has not been + modified, or has been modified only in ways explicitly requested + by the Copyright Holder. + + "Modified Version" means the Package, if it has been changed, and + such changes were not explicitly requested by the Copyright + Holder. + + "Original License" means this Artistic License as Distributed with + the Standard Version of the Package, in its current version or as + it may be modified by The Perl Foundation in the future. + + "Source" form means the source code, documentation source, and + configuration files for the Package. + + "Compiled" form means the compiled bytecode, object code, binary, + or any other form resulting from mechanical transformation or + translation of the Source form. + + +Permission for Use and Modification Without Distribution + +(1) You are permitted to use the Standard Version and create and use +Modified Versions for any purpose without restriction, provided that +you do not Distribute the Modified Version. + + +Permissions for Redistribution of the Standard Version + +(2) You may Distribute verbatim copies of the Source form of the +Standard Version of this Package in any medium without restriction, +either gratis or for a Distributor Fee, provided that you duplicate +all of the original copyright notices and associated disclaimers. At +your discretion, such verbatim copies may or may not include a +Compiled form of the Package. + +(3) You may apply any bug fixes, portability changes, and other +modifications made available from the Copyright Holder. The resulting +Package will still be considered the Standard Version, and as such +will be subject to the Original License. + + +Distribution of Modified Versions of the Package as Source + +(4) You may Distribute your Modified Version as Source (either gratis +or for a Distributor Fee, and with or without a Compiled form of the +Modified Version) provided that you clearly document how it differs +from the Standard Version, including, but not limited to, documenting +any non-standard features, executables, or modules, and provided that +you do at least ONE of the following: + + (a) make the Modified Version available to the Copyright Holder + of the Standard Version, under the Original License, so that the + Copyright Holder may include your modifications in the Standard + Version. + + (b) ensure that installation of your Modified Version does not + prevent the user installing or running the Standard Version. In + addition, the Modified Version must bear a name that is different + from the name of the Standard Version. + + (c) allow anyone who receives a copy of the Modified Version to + make the Source form of the Modified Version available to others + under + + (i) the Original License or + + (ii) a license that permits the licensee to freely copy, + modify and redistribute the Modified Version using the same + licensing terms that apply to the copy that the licensee + received, and requires that the Source form of the Modified + Version, and of any works derived from it, be made freely + available in that license fees are prohibited but Distributor + Fees are allowed. + + +Distribution of Compiled Forms of the Standard Version +or Modified Versions without the Source + +(5) You may Distribute Compiled forms of the Standard Version without +the Source, provided that you include complete instructions on how to +get the Source of the Standard Version. Such instructions must be +valid at the time of your distribution. If these instructions, at any +time while you are carrying out such distribution, become invalid, you +must provide new instructions on demand or cease further distribution. +If you provide valid instructions or cease distribution within thirty +days after you become aware that the instructions are invalid, then +you do not forfeit any of your rights under this license. + +(6) You may Distribute a Modified Version in Compiled form without +the Source, provided that you comply with Section 4 with respect to +the Source of the Modified Version. + + +Aggregating or Linking the Package + +(7) You may aggregate the Package (either the Standard Version or +Modified Version) with other packages and Distribute the resulting +aggregation provided that you do not charge a licensing fee for the +Package. Distributor Fees are permitted, and licensing fees for other +components in the aggregation are permitted. The terms of this license +apply to the use and Distribution of the Standard or Modified Versions +as included in the aggregation. + +(8) You are permitted to link Modified and Standard Versions with +other works, to embed the Package in a larger work of your own, or to +build stand-alone binary or bytecode versions of applications that +include the Package, and Distribute the result without restriction, +provided the result does not expose a direct interface to the Package. + + +Items That are Not Considered Part of a Modified Version + +(9) Works (including, but not limited to, modules and scripts) that +merely extend or make use of the Package, do not, by themselves, cause +the Package to be a Modified Version. In addition, such works are not +considered parts of the Package itself, and are not subject to the +terms of this license. + + +General Provisions + +(10) Any use, modification, and distribution of the Standard or +Modified Versions is governed by this Artistic License. By using, +modifying or distributing the Package, you accept this license. Do not +use, modify, or distribute the Package, if you do not accept this +license. + +(11) If your Modified Version has been derived from a Modified +Version made by someone other than you, you are nevertheless required +to ensure that your Modified Version complies with the requirements of +this license. + +(12) This license does not grant you the right to use any trademark, +service mark, tradename, or logo of the Copyright Holder. + +(13) This license includes the non-exclusive, worldwide, +free-of-charge patent license to make, have made, use, offer to sell, +sell, import and otherwise transfer the Package with respect to any +patent claims licensable by the Copyright Holder that are necessarily +infringed by the Package. If you institute patent litigation +(including a cross-claim or counterclaim) against any party alleging +that the Package constitutes direct or contributory patent +infringement, then this Artistic License to you shall terminate on the +date that such litigation is filed. + +(14) Disclaimer of Warranty: +THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS +IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR +NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL +LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +-------- diff --git a/deps/npm/node_modules/gentle-fs/README.md b/deps/npm/node_modules/gentle-fs/README.md new file mode 100644 index 00000000000..54af51cf992 --- /dev/null +++ b/deps/npm/node_modules/gentle-fs/README.md @@ -0,0 +1,74 @@ +# gentle-fs [![npm version](https://img.shields.io/npm/v/gentle-fs.svg)](https://npm.im/gentle-fs) [![license](https://img.shields.io/npm/l/gentle-fs.svg)](https://npm.im/gentle-fs) [![Travis](https://img.shields.io/travis/npm/gentle-fs.svg)](https://travis-ci.org/npm/gentle-fs) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/npm/gentle-fs?svg=true)](https://ci.appveyor.com/project/npm/gentle-fs) [![Coverage Status](https://coveralls.io/repos/github/npm/gentle-fs/badge.svg?branch=latest)](https://coveralls.io/github/npm/gentle-fs?branch=latest) + +[`gentle-fs`](https://github.com/npm/gentle-fs) is a standalone library for +"gently" remove or link directories. + +## Install + +`$ npm install gentle-fs` + +## Table of Contents + +* [Example](#example) +* [Features](#features) +* [Contributing](#contributing) +* [API](#api) + * [`rm`](#rm) + * [`link`](#link) + * [`linkIfExists`](#linkIfExists) + +### Example + +```javascript +// todo +``` + +### Features + +* Performs filesystem operations "gently". Please see details in the API specs below +for a more precise definition of "gently". + +### 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. + +### API + +#### <a name="rm"></a> `> rm(target, opts, cb)` + +Will delete all directories between `target` and `opts.base`, as long as they are empty. +That is, if `target` is `/a/b/c/d/e` and `base` is `/a/b`, but `/a/b/c` has other files +besides the `d` directory inside of it, `/a/b/c` will remain. + +##### Example + +```javascript +rm(target, opts, cb) +``` + +#### <a name="link"></a> `> link(from, to, opts, cb)` + +If `from` is a real directory, and `from` is not the same directory as `to`, will +symlink `from` to `to`, while also gently [`rm`](#rm)ing the `to` directory, +and then call the callback. Otherwise, will call callback with an `Error`. + +##### Example + +```javascript +link(from, to, opts, cb) +``` + +#### <a name="linkIfExists"></a> `> linkIfExists(from, to, opts, cb)` + +Performs the same operation as [`link`](#link), except does nothing when `from` is the +same as `to`, and calls the callback. + +##### Example + +```javascript +linkIfExists(from, to, opts, cb) +``` diff --git a/deps/npm/node_modules/gentle-fs/index.js b/deps/npm/node_modules/gentle-fs/index.js new file mode 100644 index 00000000000..2828fdb2bd3 --- /dev/null +++ b/deps/npm/node_modules/gentle-fs/index.js @@ -0,0 +1,10 @@ +'use strict' + +const rm = require('./lib/rm.js') +const link = require('./lib/link.js') + +exports = module.exports = { + rm: rm, + link: link.link, + linkIfExists: link.linkIfExists +} diff --git a/deps/npm/node_modules/gentle-fs/lib/link.js b/deps/npm/node_modules/gentle-fs/lib/link.js new file mode 100644 index 00000000000..246d801479a --- /dev/null +++ b/deps/npm/node_modules/gentle-fs/lib/link.js @@ -0,0 +1,66 @@ +'use strict' + +const path = require('path') +const fs = require('graceful-fs') +const chain = require('slide').chain +const mkdir = require('mkdirp') +const rm = require('./rm.js') + +exports = module.exports = { + link: link, + linkIfExists: linkIfExists +} + +function linkIfExists (from, to, opts, cb) { + fs.stat(from, function (er) { + if (er) return cb() + fs.readlink(to, function (er, fromOnDisk) { + // if the link already exists and matches what we would do, + // we don't need to do anything + if (!er) { + var toDir = path.dirname(to) + var absoluteFrom = path.resolve(toDir, from) + var absoluteFromOnDisk = path.resolve(toDir, fromOnDisk) + if (absoluteFrom === absoluteFromOnDisk) return cb() + } + link(from, to, opts, cb) + }) + }) +} + +function resolveIfSymlink (maybeSymlinkPath, cb) { + fs.lstat(maybeSymlinkPath, function (err, stat) { + if (err) return cb.apply(this, arguments) + if (!stat.isSymbolicLink()) return cb(null, maybeSymlinkPath) + fs.readlink(maybeSymlinkPath, cb) + }) +} + +function ensureFromIsNotSource (from, to, cb) { + resolveIfSymlink(from, function (err, fromDestination) { + if (err) return cb.apply(this, arguments) + if (path.resolve(path.dirname(from), fromDestination) === path.resolve(to)) { + return cb(new Error('Link target resolves to the same directory as link source: ' + to)) + } + cb.apply(this, arguments) + }) +} + +function link (from, to, opts, cb) { + to = path.resolve(to) + opts.base = path.dirname(to) + var absTarget = path.resolve(opts.base, from) + var relativeTarget = path.relative(opts.base, absTarget) + var target = opts.absolute ? absTarget : relativeTarget + + chain( + [ + [ensureFromIsNotSource, absTarget, to], + [fs, 'stat', absTarget], + [rm, to, opts], + [mkdir, path.dirname(to)], + [fs, 'symlink', target, to, 'junction'] + ], + cb + ) +} diff --git a/deps/npm/node_modules/gentle-fs/lib/rm.js b/deps/npm/node_modules/gentle-fs/lib/rm.js new file mode 100644 index 00000000000..00760c66f23 --- /dev/null +++ b/deps/npm/node_modules/gentle-fs/lib/rm.js @@ -0,0 +1,256 @@ +'use strict' + +const path = require('path') +const validate = require('aproba') +const fs = require('graceful-fs') +const isInside = require('path-is-inside') +const vacuum = require('fs-vacuum') +const chain = require('slide').chain +const asyncMap = require('slide').asyncMap +const readCmdShim = require('read-cmd-shim') +const iferr = require('iferr') + +exports = module.exports = rm + +function rm (target, opts, cb) { + var targetPath = path.normalize(path.resolve(opts.prefix, target)) + if (opts.prefixes.indexOf(targetPath) !== -1) { + return cb(new Error('May not delete: ' + targetPath)) + } + var options = {} + if (opts.force) { options.purge = true } + if (opts.base) options.base = path.normalize(path.resolve(opts.prefix, opts.base)) + + if (!opts.gently) { + options.purge = true + return vacuum(targetPath, options, cb) + } + + var parent = options.base = options.base || path.normalize(opts.prefix) + + // Do all the async work we'll need to do in order to tell if this is a + // safe operation + chain([ + [isEverInside, parent, opts.prefixes, opts.log], + [readLinkOrShim, targetPath], + [isEverInside, targetPath, opts.prefixes, opts.log], + [isEverInside, targetPath, [parent], opts.log] + ], function (er, results) { + if (er) { + if (er.code === 'ENOENT') return cb() + return cb(er) + } + var parentInfo = { + path: parent, + managed: results[0] + } + var targetInfo = { + path: targetPath, + symlink: results[1], + managed: results[2], + inParent: results[3] + } + + isSafeToRm(parentInfo, targetInfo, opts.name, opts.log, iferr(cb, thenRemove)) + + function thenRemove (toRemove, removeBase) { + if (!toRemove) return cb() + if (removeBase) options.base = removeBase + return vacuum(toRemove, options, cb) + } + }) +} + +exports._isSafeToRm = isSafeToRm +function isSafeToRm (parent, target, pkgName, log, cb) { + log.silly('gentlyRm', 'parent.path =', parent.path) + log.silly('gentlyRm', 'parent.managed =', + parent.managed && parent.managed.target + ' is in ' + parent.managed.path) + log.silly('gentlyRm', 'target.path = ', target.path) + log.silly('gentlyRm', 'target.symlink =', target.symlink) + log.silly('gentlyRm', 'target.managed =', + target.managed && target.managed.target + ' is in ' + target.managed.path) + log.silly('gentlyRm', 'target.inParent = ', target.inParent) + + // The parent directory or something it symlinks to must eventually be in + // a folder that we maintain. + if (!parent.managed) { + log.info('gentlyRm', parent.path, + 'is not contained in any directory ' + pkgName + ' is known to control or ' + + 'any place they link to') + return cb(clobberFail(target.path, 'containing path ' + parent.path + + " isn't under " + pkgName + "'s control")) + } + + // The target or something it symlinks to must eventually be in the parent + // or something the parent symlinks to + if (target.inParent) { + var actualTarget = target.inParent.target + var targetsParent = target.inParent.path + // if the target.path was what we found in some version of parent, remove + // using that parent as the base + if (target.path === actualTarget) { + return cb(null, target.path, targetsParent) + } else { + // If something the target.path links to was what was found, just + // remove target.path in the location it was found. + return cb(null, target.path, path.dirname(target.path)) + } + } + + // If the target is in a managed directory and is in a symlink, but was + // not in our parent that usually means someone else installed a bin file + // with the same name as one of our bin files. + if (target.managed && target.symlink) { + log.warn('rm', 'not removing', target.path, + "as it wasn't installed by", parent.path) + return cb() + } + + if (target.symlink) { + return cb(clobberFail(target.path, target.symlink + + ' symlink target is not controlled by ' + pkgName + ' ' + parent.path)) + } else { + return cb(clobberFail(target.path, 'is outside ' + parent.path + + ' and not a link')) + } +} + +function clobberFail (target, msg) { + validate('SS', arguments) + var er = new Error('Refusing to delete ' + target + ': ' + msg) + er.code = 'EEXIST' + er.path = target + return er +} + +function isENOENT (err) { + return err && err.code === 'ENOENT' +} + +function notENOENT (err) { + return !isENOENT(err) +} + +function skipENOENT (cb) { + return function (err, value) { + if (isENOENT(err)) { + return cb(null, false) + } else { + return cb(err, value) + } + } +} + +function errorsToValues (fn) { + return function () { + var args = Array.prototype.slice.call(arguments) + var cb = args.pop() + args.push(function (err, value) { + if (err) { + return cb(null, err) + } else { + return cb(null, value) + } + }) + fn.apply(null, args) + } +} + +function isNotError (value) { + return !(value instanceof Error) +} + +exports._isEverInside = isEverInside +// return the first of path, where target (or anything it symlinks to) +// isInside the path (or anything it symlinks to) +function isEverInside (target, paths, log, cb) { + validate('SAOF', arguments) + asyncMap(paths, errorsToValues(readAllLinks), iferr(cb, function (resolvedPaths) { + var errorFree = resolvedPaths.filter(isNotError) + if (errorFree.length === 0) { + var badErrors = resolvedPaths.filter(notENOENT) + if (badErrors.length === 0) { + return cb(null, false) + } else { + return cb(badErrors[0]) + } + } + readAllLinks(target, iferr(skipENOENT(cb), function (targets) { + cb(null, areAnyInsideAny(targets, errorFree, log)) + })) + })) +} + +exports._areAnyInsideAny = areAnyInsideAny +// Return the first path found that any target is inside +function areAnyInsideAny (targets, paths, log) { + validate('AAO', arguments) + var toCheck = [] + paths.forEach(function (path) { + targets.forEach(function (target) { + toCheck.push([target, path]) + }) + }) + for (var ii = 0; ii < toCheck.length; ++ii) { + var target = toCheck[ii][0] + var path = toCheck[ii][1] + var inside = isInside(target, path) + if (!inside) log.silly('isEverInside', target, 'is not inside', path) + if (inside && path) return inside && path && {target: target, path: path} + } + return false +} + +exports._readAllLinks = readAllLinks +// resolves chains of symlinks of unlimited depth, returning a list of paths +// it's seen in the process when it hits either a symlink cycle or a +// non-symlink +function readAllLinks (path, cb) { + validate('SF', arguments) + var seen = {} + _readAllLinks(path) + + function _readAllLinks (path) { + if (seen[path]) return cb(null, Object.keys(seen)) + seen[path] = true + resolveSymlink(path, iferr(cb, _readAllLinks)) + } +} + +exports._resolveSymlink = resolveSymlink +var resolvedPaths = {} +function resolveSymlink (symlink, cb) { + validate('SF', arguments) + var cached = resolvedPaths[symlink] + if (cached) return cb(null, cached) + + readLinkOrShim(symlink, iferr(cb, function (symlinkTarget) { + if (symlinkTarget) { + resolvedPaths[symlink] = path.resolve(path.dirname(symlink), symlinkTarget) + } else { + resolvedPaths[symlink] = symlink + } + return cb(null, resolvedPaths[symlink]) + })) +} + +exports._readLinkOrShim = readLinkOrShim +function readLinkOrShim (path, cb) { + validate('SF', arguments) + fs.lstat(path, iferr(cb, function (stat) { + if (stat.isSymbolicLink()) { + fs.readlink(path, cb) + } else { + readCmdShim(path, function (er, source) { + if (!er) return cb(null, source) + // lstat wouldn't return an error on these, so we don't either. + if (er.code === 'ENOTASHIM' || er.code === 'EISDIR') { + return cb(null, null) + } else { + return cb(er) + } + }) + } + })) +} diff --git a/deps/npm/node_modules/gentle-fs/package.json b/deps/npm/node_modules/gentle-fs/package.json new file mode 100644 index 00000000000..ea08e40c430 --- /dev/null +++ b/deps/npm/node_modules/gentle-fs/package.json @@ -0,0 +1,83 @@ +{ + "_from": "gentle-fs@latest", + "_id": "gentle-fs@2.0.1", + "_inBundle": false, + "_integrity": "sha512-cEng5+3fuARewXktTEGbwsktcldA+YsnUEaXZwcK/3pjSE1X9ObnTs+/8rYf8s+RnIcQm2D5x3rwpN7Zom8Bew==", + "_location": "/gentle-fs", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "gentle-fs@latest", + "name": "gentle-fs", + "escapedName": "gentle-fs", + "rawSpec": "latest", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/", + "/bin-links" + ], + "_resolved": "https://registry.npmjs.org/gentle-fs/-/gentle-fs-2.0.1.tgz", + "_shasum": "585cfd612bfc5cd52471fdb42537f016a5ce3687", + "_spec": "gentle-fs@latest", + "_where": "/Users/zkat/Documents/code/npm", + "author": { + "name": "Mike Sherov" + }, + "bugs": { + "url": "https://github.com/npm/gentle-fs/issues" + }, + "bundleDependencies": false, + "dependencies": { + "aproba": "^1.1.2", + "fs-vacuum": "^1.2.10", + "graceful-fs": "^4.1.11", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "path-is-inside": "^1.0.2", + "read-cmd-shim": "^1.0.1", + "slide": "^1.1.6" + }, + "deprecated": false, + "description": "Gentle Filesystem operations", + "devDependencies": { + "dezalgo": "^1.0.3", + "nyc": "^11.1.0", + "require-inject": "^1.4.2", + "standard": "^10.0.3", + "standard-version": "^4.2.0", + "tap": "^10.7.2", + "weallbehave": "^1.2.0", + "weallcontribute": "^1.0.8" + }, + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/npm/gentle-fs#readme", + "keywords": [ + "npm", + "gentle", + "fs" + ], + "license": "Artistic-2.0", + "main": "index.js", + "name": "gentle-fs", + "repository": { + "type": "git", + "url": "git://github.com/npm/gentle-fs.git" + }, + "scripts": { + "postrelease": "npm publish && git push --follow-tags", + "prerelease": "npm t", + "pretest": "standard", + "release": "standard-version -s", + "test": "tap -J --nyc-arg=--all --coverage test/*.js 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": "2.0.1" +} diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/LICENSE b/deps/npm/node_modules/init-package-json/node_modules/npm-package-arg/LICENSE index 19129e315fe..05eeeb88c2e 100644 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/node_modules/pseudomap/LICENSE +++ b/deps/npm/node_modules/init-package-json/node_modules/npm-package-arg/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter and Contributors +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 diff --git a/deps/npm/node_modules/init-package-json/node_modules/npm-package-arg/README.md b/deps/npm/node_modules/init-package-json/node_modules/npm-package-arg/README.md new file mode 100644 index 00000000000..d45032dc74a --- /dev/null +++ b/deps/npm/node_modules/init-package-json/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/init-package-json/node_modules/npm-package-arg/npa.js b/deps/npm/node_modules/init-package-json/node_modules/npm-package-arg/npa.js new file mode 100644 index 00000000000..a61c0574298 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/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/init-package-json/node_modules/npm-package-arg/package.json b/deps/npm/node_modules/init-package-json/node_modules/npm-package-arg/package.json new file mode 100644 index 00000000000..61a2c444aa6 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/npm-package-arg/package.json @@ -0,0 +1,64 @@ +{ + "_from": "npm-package-arg@^4.0.0 || ^5.0.0", + "_id": "npm-package-arg@5.1.2", + "_inBundle": false, + "_integrity": "sha512-wJBsrf0qpypPT7A0LART18hCdyhpCMxeTtcb0X4IZO2jsP6Om7EHN1d9KSKiqD+KVH030RVNpWS9thk+pb7wzA==", + "_location": "/init-package-json/npm-package-arg", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "npm-package-arg@^4.0.0 || ^5.0.0", + "name": "npm-package-arg", + "escapedName": "npm-package-arg", + "rawSpec": "^4.0.0 || ^5.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0 || ^5.0.0" + }, + "_requiredBy": [ + "/init-package-json" + ], + "_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-5.1.2.tgz", + "_shasum": "fb18d17bb61e60900d6312619919bd753755ab37", + "_spec": "npm-package-arg@^4.0.0 || ^5.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/init-package-json", + "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/libnpx/CHANGELOG.md b/deps/npm/node_modules/libnpx/CHANGELOG.md index c5de9f16c54..802f8406898 100644 --- a/deps/npm/node_modules/libnpx/CHANGELOG.md +++ b/deps/npm/node_modules/libnpx/CHANGELOG.md @@ -2,6 +2,31 @@ 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="9.7.1"></a> +## [9.7.1](https://github.com/zkat/npx/compare/v9.7.0...v9.7.1) (2017-10-19) + + +### Bug Fixes + +* **main:** err... oops? ([f24b4e3](https://github.com/zkat/npx/commit/f24b4e3)) + + + +<a name="9.7.0"></a> +# [9.7.0](https://github.com/zkat/npx/compare/v9.6.0...v9.7.0) (2017-10-19) + + +### Bug Fixes + +* **exec:** fixed unix binary pathing issues (#120) ([f80a970](https://github.com/zkat/npx/commit/f80a970)), closes [#120](https://github.com/zkat/npx/issues/120) + + +### Features + +* **child:** add opts.installerStdio (#126) ([ade03f7](https://github.com/zkat/npx/commit/ade03f7)) + + + <a name="9.6.0"></a> # [9.6.0](https://github.com/zkat/npx/compare/v9.5.0...v9.6.0) (2017-08-17) diff --git a/deps/npm/node_modules/libnpx/index.js b/deps/npm/node_modules/libnpx/index.js index 097d67cd02b..3033e9cd06a 100644 --- a/deps/npm/node_modules/libnpx/index.js +++ b/deps/npm/node_modules/libnpx/index.js @@ -232,10 +232,12 @@ function installPackages (specs, prefix, opts) { return opts.npm } }).then(npmPath => { - return child.escapeArg(npmPath, true) + return process.platform === 'win32' ? child.escapeArg(npmPath, true) : npmPath }).then(npmPath => { return child.spawn(npmPath, args, { - stdio: [0, 'pipe', opts.q ? 'ignore' : 2] + stdio: opts.installerStdio + ? opts.installerStdio + : [0, 'pipe', opts.q ? 'ignore' : 2] }).then(deets => { try { return deets.stdout ? JSON.parse(deets.stdout) : null diff --git a/deps/npm/node_modules/libnpx/libnpx.1 b/deps/npm/node_modules/libnpx/libnpx.1 index b8010b632a7..e8049194bcf 100644 --- a/deps/npm/node_modules/libnpx/libnpx.1 +++ b/deps/npm/node_modules/libnpx/libnpx.1 @@ -1,4 +1,4 @@ -.TH "NPX" "1" "August 2017" "libnpx@9.5.0" "User Commands" +.TH "NPX" "1" "October 2017" "libnpx@9.7.0" "User Commands" .SH "NAME" \fBnpx\fR \- execute npm package binaries .SH SYNOPSIS diff --git a/deps/npm/node_modules/cacache/node_modules/lru-cache/LICENSE b/deps/npm/node_modules/libnpx/node_modules/npm-package-arg/LICENSE index 19129e315fe..05eeeb88c2e 100644 --- a/deps/npm/node_modules/cacache/node_modules/lru-cache/LICENSE +++ b/deps/npm/node_modules/libnpx/node_modules/npm-package-arg/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter and Contributors +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 diff --git a/deps/npm/node_modules/libnpx/node_modules/npm-package-arg/README.md b/deps/npm/node_modules/libnpx/node_modules/npm-package-arg/README.md new file mode 100644 index 00000000000..d45032dc74a --- /dev/null +++ b/deps/npm/node_modules/libnpx/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/libnpx/node_modules/npm-package-arg/npa.js b/deps/npm/node_modules/libnpx/node_modules/npm-package-arg/npa.js new file mode 100644 index 00000000000..a61c0574298 --- /dev/null +++ b/deps/npm/node_modules/libnpx/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/libnpx/node_modules/npm-package-arg/package.json b/deps/npm/node_modules/libnpx/node_modules/npm-package-arg/package.json new file mode 100644 index 00000000000..550a575a9fe --- /dev/null +++ b/deps/npm/node_modules/libnpx/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": "/libnpx/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": [ + "/libnpx" + ], + "_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/libnpx", + "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/libnpx/package.json b/deps/npm/node_modules/libnpx/package.json index 57fdb89e237..243543fd55e 100644 --- a/deps/npm/node_modules/libnpx/package.json +++ b/deps/npm/node_modules/libnpx/package.json @@ -1,34 +1,38 @@ { - "_from": "libnpx@9.6.0", - "_id": "libnpx@9.6.0", + "_from": "libnpx@latest", + "_id": "libnpx@9.7.1", "_inBundle": false, - "_integrity": "sha512-XyfUHtcxQPuQ/KEjdDzA8IHu/l26u5HuaZa41Y8zvk8IjT7ZkpGE2jFXQ5ozpOPFpUoip7lE9iJJzJpITS+zkQ==", + "_integrity": "sha512-OktT775uhfL93SoUfERj4ilM3D7c0hyUyALX9oJ2D/yO4Msm5hbkOKHcrOVHXRcEX9ytstviYQAEygFIiDj2bQ==", "_location": "/libnpx", "_phantomChildren": { "graceful-fs": "4.1.11", + "hosted-git-info": "2.5.0", "lru-cache": "4.1.1", "normalize-package-data": "2.4.0", + "osenv": "0.1.4", + "semver": "5.4.1", "strip-ansi": "4.0.0", + "validate-npm-package-name": "3.0.0", "which": "1.3.0" }, "_requested": { - "type": "version", + "type": "tag", "registry": true, - "raw": "libnpx@9.6.0", + "raw": "libnpx@latest", "name": "libnpx", "escapedName": "libnpx", - "rawSpec": "9.6.0", + "rawSpec": "latest", "saveSpec": null, - "fetchSpec": "9.6.0" + "fetchSpec": "latest" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/libnpx/-/libnpx-9.6.0.tgz", - "_shasum": "c441ddd698b043bd8e8dc78384fa8eb7d77991e5", - "_spec": "libnpx@9.6.0", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/libnpx/-/libnpx-9.7.1.tgz", + "_shasum": "55300b5e119bd47b714be9704ca0696ffb18b025", + "_spec": "libnpx@latest", + "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Kat Marchán", "email": "kzm@sykosomatic.org" @@ -87,7 +91,7 @@ "cli" ], "license": "CC0-1.0", - "main": "test/util/npx-bin.js", + "main": "index.js", "man": [ "./libnpx.1" ], @@ -109,5 +113,5 @@ "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": "9.6.0" + "version": "9.7.1" } diff --git a/deps/npm/node_modules/move-concurrently/node_modules/copy-concurrently/copy.js b/deps/npm/node_modules/move-concurrently/node_modules/copy-concurrently/copy.js index 7455928a98c..36ce9f46fbd 100644 --- a/deps/npm/node_modules/move-concurrently/node_modules/copy-concurrently/copy.js +++ b/deps/npm/node_modules/move-concurrently/node_modules/copy-concurrently/copy.js @@ -126,8 +126,9 @@ function recurseDir (from, to, opts) { var fs = opts.fs || nodeFs var chown = opts.chown || promisify(Promise, fs.chown) var readdir = opts.readdir || promisify(Promise, fs.readdir) + var mkdirpAsync = opts.mkdirpAsync || promisify(Promise, mkdirp) - return opts.mkdirpAsync(to, {fs: fs, mode: opts.mode}).then(function () { + return mkdirpAsync(to, {fs: fs, mode: opts.mode}).then(function () { var getuid = opts.getuid || process.getuid if (getuid && opts.uid != null && getuid() === 0) { return chown(to, opts.uid, opts.gid) diff --git a/deps/npm/node_modules/move-concurrently/node_modules/copy-concurrently/package.json b/deps/npm/node_modules/move-concurrently/node_modules/copy-concurrently/package.json index 4e843e52a4b..f327746a8a7 100644 --- a/deps/npm/node_modules/move-concurrently/node_modules/copy-concurrently/package.json +++ b/deps/npm/node_modules/move-concurrently/node_modules/copy-concurrently/package.json @@ -1,7 +1,8 @@ { "_from": "copy-concurrently@^1.0.0", - "_id": "copy-concurrently@1.0.3", - "_integrity": "sha1-Rft4ZiSaHKiJqlcI5svSc+dbslA=", + "_id": "copy-concurrently@1.0.5", + "_inBundle": false, + "_integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", "_location": "/move-concurrently/copy-concurrently", "_phantomChildren": {}, "_requested": { @@ -17,17 +18,15 @@ "_requiredBy": [ "/move-concurrently" ], - "_resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.3.tgz", - "_shasum": "45fb7866249a1ca889aa5708e6cbd273e75bb250", - "_shrinkwrap": null, + "_resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "_shasum": "92297398cae34937fcafd6ec8139c18051f0b5e0", "_spec": "copy-concurrently@^1.0.0", - "_where": "/Users/zkat/Documents/code/npm/node_modules/move-concurrently", + "_where": "/Users/rebecca/code/npm/node_modules/move-concurrently", "author": { "name": "Rebecca Turner", "email": "me@re-becca.org", "url": "http://re-becca.org/" }, - "bin": null, "bugs": { "url": "https://github.com/npm/copy-concurrently/issues" }, @@ -62,8 +61,6 @@ "license": "ISC", "main": "copy.js", "name": "copy-concurrently", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/npm/copy-concurrently.git" @@ -71,5 +68,5 @@ "scripts": { "test": "standard && tap --coverage test" }, - "version": "1.0.3" + "version": "1.0.5" } diff --git a/deps/npm/node_modules/move-concurrently/package.json b/deps/npm/node_modules/move-concurrently/package.json index d0ba3e68900..f4cb89151ad 100644 --- a/deps/npm/node_modules/move-concurrently/package.json +++ b/deps/npm/node_modules/move-concurrently/package.json @@ -1,14 +1,15 @@ { "_from": "move-concurrently@~1.0.1", "_id": "move-concurrently@1.0.1", + "_inBundle": false, "_integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", "_location": "/move-concurrently", "_phantomChildren": { - "aproba": "1.1.1", + "aproba": "1.2.0", "fs-write-stream-atomic": "1.0.10", "iferr": "0.1.5", "mkdirp": "0.5.1", - "rimraf": "2.6.1" + "rimraf": "2.6.2" }, "_requested": { "type": "range", @@ -21,20 +22,21 @@ "fetchSpec": "~1.0.1" }, "_requiredBy": [ + "#USER", "/", - "/cacache" + "/cacache", + "/npm-profile/make-fetch-happen/cacache", + "/pacote/cacache" ], "_resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", "_shasum": "be2c005fda32e0b29af1f05d7c4b33214c701f92", - "_shrinkwrap": null, "_spec": "move-concurrently@~1.0.1", - "_where": "/Users/zkat/Documents/code/npm", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Rebecca Turner", "email": "me@re-becca.org", "url": "http://re-becca.org/" }, - "bin": null, "bugs": { "url": "https://github.com/npm/move-concurrently/issues" }, @@ -68,8 +70,6 @@ "license": "ISC", "main": "move.js", "name": "move-concurrently", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/npm/move-concurrently.git" diff --git a/deps/npm/node_modules/npm-lifecycle/CHANGELOG.md b/deps/npm/node_modules/npm-lifecycle/CHANGELOG.md index 6d1ee859ff9..84effd0a30a 100644 --- a/deps/npm/node_modules/npm-lifecycle/CHANGELOG.md +++ b/deps/npm/node_modules/npm-lifecycle/CHANGELOG.md @@ -2,6 +2,27 @@ 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="2.0.0"></a> +# [2.0.0](https://github.com/npm/lifecycle/compare/v1.0.3...v2.0.0) (2017-11-17) + + +### Features + +* **node-gyp:** use own node-gyp ([ae94ed2](https://github.com/npm/lifecycle/commit/ae94ed2)) +* **nodeOptions:** add "nodeOptions" option to set NODE_OPTIONS for child ([#7](https://github.com/npm/lifecycle/issues/7)) ([2eb7a38](https://github.com/npm/lifecycle/commit/2eb7a38)) +* **stdio:** add child process io options and default logging of piped stdout/err ([#3](https://github.com/npm/lifecycle/issues/3)) ([7b8281a](https://github.com/npm/lifecycle/commit/7b8281a)) + + +### BREAKING CHANGES + +* **node-gyp:** Previously you had to bring your own node-gyp AND you had +to provide access the way npm does, by having a `bin` dir with a +`node-gyp-bin` in it. + +Fixes: #4 + + + <a name="1.0.3"></a> ## [1.0.3](https://github.com/npm/lifecycle/compare/v1.0.2...v1.0.3) (2017-09-01) diff --git a/deps/npm/node_modules/npm-lifecycle/README.md b/deps/npm/node_modules/npm-lifecycle/README.md index e864593bffe..d0d515c5326 100644 --- a/deps/npm/node_modules/npm-lifecycle/README.md +++ b/deps/npm/node_modules/npm-lifecycle/README.md @@ -38,6 +38,11 @@ jump in if you'd like to, or even ask us questions if something isn't clear. #### <a name="lifecycle"></a> `> lifecycle(name, pkg, wd, [opts]) -> Promise` +##### Arguments + +* `opts.stdio` - the [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) +passed to the child process. `[0, 1, 2]` by default. + ##### Example ```javascript diff --git a/deps/npm/node_modules/npm-lifecycle/index.js b/deps/npm/node_modules/npm-lifecycle/index.js index be5eadb3e8c..040269be40a 100644 --- a/deps/npm/node_modules/npm-lifecycle/index.js +++ b/deps/npm/node_modules/npm-lifecycle/index.js @@ -12,6 +12,10 @@ const chain = require('slide').chain const uidNumber = require('uid-number') const umask = require('umask') const which = require('which') +const byline = require('byline') +const resolveFrom = require('resolve-from') + +const DEFAULT_NODE_GYP_PATH = resolveFrom(__dirname, 'node-gyp/bin/node-gyp') let PATH = 'PATH' @@ -61,6 +65,7 @@ function lifecycle (pkg, stage, wd, opts) { env.npm_node_execpath = env.NODE = env.NODE || process.execPath env.npm_execpath = require.main.filename env.INIT_CWD = process.cwd() + env.npm_config_node_gyp = env.npm_config_node_gyp || DEFAULT_NODE_GYP_PATH // 'nobody' typically doesn't have permission to write to /tmp // even if it's never used, sh freaks out. @@ -91,7 +96,7 @@ function lifecycle_ (pkg, stage, wd, opts, env, cb) { // we also unshift the bundled node-gyp-bin folder so that // the bundled one will be used for installing things. - pathArr.unshift(path.join(__dirname, '..', '..', 'bin', 'node-gyp-bin')) + pathArr.unshift(path.join(__dirname, 'node-gyp-bin')) if (shouldPrependCurrentNodeDirToPATH(opts)) { // prefer current node interpreter in child scripts @@ -244,7 +249,7 @@ function runCmd_ (cmd, pkg, env, wd, opts, stage, unsafe, uid, gid, cb_) { var conf = { cwd: wd, env: env, - stdio: [ 0, 1, 2 ] + stdio: opts.stdio || [ 0, 1, 2 ] } if (!unsafe) { @@ -282,6 +287,12 @@ function runCmd_ (cmd, pkg, env, wd, opts, stage, unsafe, uid, gid, cb_) { } procError(er) }) + byline(proc.stdout).on('data', function (data) { + opts.log.verbose('lifecycle', logid(pkg, stage), 'stdout', data.toString()) + }) + byline(proc.stderr).on('data', function (data) { + opts.log.verbose('lifecycle', logid(pkg, stage), 'stderr', data.toString()) + }) process.once('SIGTERM', procKill) process.once('SIGINT', procInterupt) @@ -355,6 +366,8 @@ function makeEnv (data, opts, prefix, env) { ) } + if (opts.nodeOptions) env.NODE_OPTIONS = opts.nodeOptions + for (i in data) { if (i.charAt(0) !== '_') { var envKey = (prefix + i).replace(/[^a-zA-Z0-9_]/g, '_') diff --git a/deps/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp b/deps/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp new file mode 100755 index 00000000000..70efb6f339f --- /dev/null +++ b/deps/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +if [ "x$npm_config_node_gyp" = "x" ]; then + node "`dirname "$0"`/../../node_modules/node-gyp/bin/node-gyp.js" "$@" +else + "$npm_config_node_gyp" "$@" +fi diff --git a/deps/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp.cmd b/deps/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp.cmd new file mode 100755 index 00000000000..083c9c58a50 --- /dev/null +++ b/deps/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp.cmd @@ -0,0 +1,5 @@ +if not defined npm_config_node_gyp ( + node "%~dp0\..\..\node_modules\node-gyp\bin\node-gyp.js" %* +) else ( + node "%npm_config_node_gyp%" %* +) diff --git a/deps/npm/node_modules/npm-lifecycle/node_modules/byline/LICENSE b/deps/npm/node_modules/npm-lifecycle/node_modules/byline/LICENSE new file mode 100644 index 00000000000..68094b94af5 --- /dev/null +++ b/deps/npm/node_modules/npm-lifecycle/node_modules/byline/LICENSE @@ -0,0 +1,19 @@ +node-byline (C) 2011-2015 John Hewson + +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.
\ No newline at end of file diff --git a/deps/npm/node_modules/npm-lifecycle/node_modules/byline/README.md b/deps/npm/node_modules/npm-lifecycle/node_modules/byline/README.md new file mode 100644 index 00000000000..f5a06440955 --- /dev/null +++ b/deps/npm/node_modules/npm-lifecycle/node_modules/byline/README.md @@ -0,0 +1,147 @@ +# byline — buffered stream for reading lines + +![npm package](https://nodei.co/npm/byline.png?downloads=true&downloadRank=true) + +`byline` is a simple module providing a `LineStream`. + +- node v0.10 `streams2` (transform stream) +- supports `pipe` +- supports both UNIX and Windows line endings +- supports [Unicode UTS #18 line boundaries](http://www.unicode.org/reports/tr18/#Line_Boundaries) +- can wrap any readable stream +- can be used as a readable-writable "through-stream" (transform stream) +- super-simple: `stream = byline(stream);` + +## Install + + npm install byline + +or from source: + + git clone git://github.com/jahewson/node-byline.git + cd node-byline + npm link + +# Convenience API + +The `byline` module can be used as a function to quickly wrap a readable stream: + +```javascript +var fs = require('fs'), + byline = require('byline'); + +var stream = byline(fs.createReadStream('sample.txt', { encoding: 'utf8' })); +``` + +The `data` event then emits lines: + +```javascript +stream.on('data', function(line) { + console.log(line); +}); +``` + +# Standard API + +You just need to add one line to wrap your readable `Stream` with a `LineStream`. + +```javascript +var fs = require('fs'), + byline = require('byline'); + +var stream = fs.createReadStream('sample.txt'); +stream = byline.createStream(stream); + +stream.on('data', function(line) { + console.log(line); +}); +``` + +# Piping + +`byline` supports `pipe` (though it strips the line endings, of course). + +```javascript +var stream = fs.createReadStream('sample.txt'); +stream = byline.createStream(stream); +stream.pipe(fs.createWriteStream('nolines.txt')); +``` + +Alternatively, you can create a readable/writable "through-stream" which doesn't wrap any specific +stream: + +```javascript +var stream = fs.createReadStream('sample.txt'); +stream = byline.createStream(stream); +stream.pipe(fs.createWriteStream('nolines.txt')); + +var input = fs.createReadStream('LICENSE'); +var lineStream = byline.createStream(); +input.pipe(lineStream); + +var output = fs.createWriteStream('test.txt'); +lineStream.pipe(output); +``` + +# Streams2 API + +Node v0.10 added a new streams2 API. This allows the stream to be used in non-flowing mode and is +preferred over the legacy pause() and resume() methods. + +```javascript +var stream = fs.createReadStream('sample.txt'); +stream = byline.createStream(stream); + +stream.on('readable', function() { + var line; + while (null !== (line = stream.read())) { + console.log(line); + } +}); +``` + +# Transform Stream + +The `byline` transform stream can be directly manipulated like so: + +```javascript +var LineStream = require('byline').LineStream; + +var input = fs.createReadStream('sample.txt'); +var output = fs.createWriteStream('nolines.txt'); + +var lineStream = new LineStream(); +input.pipe(lineStream); +lineStream.pipe(output); + +``` + +# Empty Lines + +By default byline skips empty lines, if you want to keep them, pass the `keepEmptyLines` option in +the call to `byline.createStream(stream, options)` or `byline(stream, options)`. + +# Tests + + npm test + +# v0.8 + +If you want to use `node-byline` with node v0.8 then you can use the 2.1.x series. Simply use the +following in your `package.json`: + +```javascript + "dependencies": { + "byline": ">=2.1.0 <3.0.0" +}, +``` + +# Simple +Unlike other modules (of which there are many), `byline` contains no: + +- monkeypatching +- dependencies +- non-standard 'line' events which break `pipe` +- limitations to only file streams +- CoffeeScript +- unnecessary code diff --git a/deps/npm/node_modules/npm-lifecycle/node_modules/byline/lib/byline.js b/deps/npm/node_modules/npm-lifecycle/node_modules/byline/lib/byline.js new file mode 100644 index 00000000000..7612632048f --- /dev/null +++ b/deps/npm/node_modules/npm-lifecycle/node_modules/byline/lib/byline.js @@ -0,0 +1,155 @@ +// Copyright (C) 2011-2015 John Hewson +// +// 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. + +var stream = require('stream'), + util = require('util'), + timers = require('timers'); + +// convinience API +module.exports = function(readStream, options) { + return module.exports.createStream(readStream, options); +}; + +// basic API +module.exports.createStream = function(readStream, options) { + if (readStream) { + return createLineStream(readStream, options); + } else { + return new LineStream(options); + } +}; + +// deprecated API +module.exports.createLineStream = function(readStream) { + console.log('WARNING: byline#createLineStream is deprecated and will be removed soon'); + return createLineStream(readStream); +}; + +function createLineStream(readStream, options) { + if (!readStream) { + throw new Error('expected readStream'); + } + if (!readStream.readable) { + throw new Error('readStream must be readable'); + } + var ls = new LineStream(options); + readStream.pipe(ls); + return ls; +} + +// +// using the new node v0.10 "streams2" API +// + +module.exports.LineStream = LineStream; + +function LineStream(options) { + stream.Transform.call(this, options); + options = options || {}; + + // use objectMode to stop the output from being buffered + // which re-concatanates the lines, just without newlines. + this._readableState.objectMode = true; + this._lineBuffer = []; + this._keepEmptyLines = options.keepEmptyLines || false; + this._lastChunkEndedWithCR = false; + + // take the source's encoding if we don't have one + var self = this; + this.on('pipe', function(src) { + if (!self.encoding) { + // but we can't do this for old-style streams + if (src instanceof stream.Readable) { + self.encoding = src._readableState.encoding; + } + } + }); +} +util.inherits(LineStream, stream.Transform); + +LineStream.prototype._transform = function(chunk, encoding, done) { + // decode binary chunks as UTF-8 + encoding = encoding || 'utf8'; + + if (Buffer.isBuffer(chunk)) { + if (encoding == 'buffer') { + chunk = chunk.toString(); // utf8 + encoding = 'utf8'; + } + else { + chunk = chunk.toString(encoding); + } + } + this._chunkEncoding = encoding; + + // see: http://www.unicode.org/reports/tr18/#Line_Boundaries + var lines = chunk.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g); + + // don't split CRLF which spans chunks + if (this._lastChunkEndedWithCR && chunk[0] == '\n') { + lines.shift(); + } + + if (this._lineBuffer.length > 0) { + this._lineBuffer[this._lineBuffer.length - 1] += lines[0]; + lines.shift(); + } + + this._lastChunkEndedWithCR = chunk[chunk.length - 1] == '\r'; + this._lineBuffer = this._lineBuffer.concat(lines); + this._pushBuffer(encoding, 1, done); +}; + +LineStream.prototype._pushBuffer = function(encoding, keep, done) { + // always buffer the last (possibly partial) line + while (this._lineBuffer.length > keep) { + var line = this._lineBuffer.shift(); + // skip empty lines + if (this._keepEmptyLines || line.length > 0 ) { + if (!this.push(this._reencode(line, encoding))) { + // when the high-water mark is reached, defer pushes until the next tick + var self = this; + timers.setImmediate(function() { + self._pushBuffer(encoding, keep, done); + }); + return; + } + } + } + done(); +}; + +LineStream.prototype._flush = function(done) { + this._pushBuffer(this._chunkEncoding, 0, done); +}; + +// see Readable::push +LineStream.prototype._reencode = function(line, chunkEncoding) { + if (this.encoding && this.encoding != chunkEncoding) { + return new Buffer(line, chunkEncoding).toString(this.encoding); + } + else if (this.encoding) { + // this should be the most common case, i.e. we're using an encoded source stream + return line; + } + else { + return new Buffer(line, chunkEncoding); + } +}; diff --git a/deps/npm/node_modules/npm-lifecycle/node_modules/byline/package.json b/deps/npm/node_modules/npm-lifecycle/node_modules/byline/package.json new file mode 100644 index 00000000000..172953c5a5e --- /dev/null +++ b/deps/npm/node_modules/npm-lifecycle/node_modules/byline/package.json @@ -0,0 +1,56 @@ +{ + "_from": "byline@^5.0.0", + "_id": "byline@5.0.0", + "_inBundle": false, + "_integrity": "sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE=", + "_location": "/npm-lifecycle/byline", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "byline@^5.0.0", + "name": "byline", + "escapedName": "byline", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/npm-lifecycle" + ], + "_resolved": "https://registry.npmjs.org/byline/-/byline-5.0.0.tgz", + "_shasum": "741c5216468eadc457b03410118ad77de8c1ddb1", + "_spec": "byline@^5.0.0", + "_where": "/Users/rebecca/code/npm/node_modules/npm-lifecycle", + "author": { + "name": "John Hewson" + }, + "bugs": { + "url": "https://github.com/jahewson/node-byline/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "simple line-by-line stream reader", + "devDependencies": { + "mocha": "~2.1.0", + "request": "~2.27.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "lib" + ], + "homepage": "https://github.com/jahewson/node-byline", + "license": "MIT", + "main": "./lib/byline.js", + "name": "byline", + "repository": { + "type": "git", + "url": "git+https://github.com/jahewson/node-byline.git" + }, + "scripts": { + "test": "mocha -R spec --timeout 60000" + }, + "version": "5.0.0" +} diff --git a/deps/npm/node_modules/npm-lifecycle/node_modules/resolve-from/index.js b/deps/npm/node_modules/npm-lifecycle/node_modules/resolve-from/index.js new file mode 100644 index 00000000000..d092447e994 --- /dev/null +++ b/deps/npm/node_modules/npm-lifecycle/node_modules/resolve-from/index.js @@ -0,0 +1,47 @@ +'use strict'; +const path = require('path'); +const Module = require('module'); +const fs = require('fs'); + +const resolveFrom = (fromDir, moduleId, silent) => { + if (typeof fromDir !== 'string') { + throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``); + } + + if (typeof moduleId !== 'string') { + throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); + } + + try { + fromDir = fs.realpathSync(fromDir); + } catch (err) { + if (err.code === 'ENOENT') { + fromDir = path.resolve(fromDir); + } else if (silent) { + return null; + } else { + throw err; + } + } + + const fromFile = path.join(fromDir, 'noop.js'); + + const resolveFileName = () => Module._resolveFilename(moduleId, { + id: fromFile, + filename: fromFile, + paths: Module._nodeModulePaths(fromDir) + }); + + if (silent) { + try { + return resolveFileName(); + } catch (err) { + return null; + } + } + + return resolveFileName(); +}; + +module.exports = (fromDir, moduleId) => resolveFrom(fromDir, moduleId); +module.exports.silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true); diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/node_modules/strip-ansi/license b/deps/npm/node_modules/npm-lifecycle/node_modules/resolve-from/license index e7af2f77107..e7af2f77107 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/node_modules/strip-ansi/license +++ b/deps/npm/node_modules/npm-lifecycle/node_modules/resolve-from/license diff --git a/deps/npm/node_modules/npm-lifecycle/node_modules/resolve-from/package.json b/deps/npm/node_modules/npm-lifecycle/node_modules/resolve-from/package.json new file mode 100644 index 00000000000..15b258d6a30 --- /dev/null +++ b/deps/npm/node_modules/npm-lifecycle/node_modules/resolve-from/package.json @@ -0,0 +1,66 @@ +{ + "_from": "resolve-from@^4.0.0", + "_id": "resolve-from@4.0.0", + "_inBundle": false, + "_integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "_location": "/npm-lifecycle/resolve-from", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "resolve-from@^4.0.0", + "name": "resolve-from", + "escapedName": "resolve-from", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/npm-lifecycle" + ], + "_resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "_shasum": "4abcd852ad32dd7baabfe9b40e00a36db5f392e6", + "_spec": "resolve-from@^4.0.0", + "_where": "/Users/rebecca/code/npm/node_modules/npm-lifecycle", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/resolve-from/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Resolve the path of a module like `require.resolve()` but from a given path", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/resolve-from#readme", + "keywords": [ + "require", + "resolve", + "path", + "module", + "from", + "like", + "import" + ], + "license": "MIT", + "name": "resolve-from", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/resolve-from.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "4.0.0" +} diff --git a/deps/npm/node_modules/npm-lifecycle/node_modules/resolve-from/readme.md b/deps/npm/node_modules/npm-lifecycle/node_modules/resolve-from/readme.md new file mode 100644 index 00000000000..e539f858ef4 --- /dev/null +++ b/deps/npm/node_modules/npm-lifecycle/node_modules/resolve-from/readme.md @@ -0,0 +1,72 @@ +# resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from) + +> Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path + + +## Install + +``` +$ npm install resolve-from +``` + + +## Usage + +```js +const resolveFrom = require('resolve-from'); + +// There is a file at `./foo/bar.js` + +resolveFrom('foo', './bar'); +//=> '/Users/sindresorhus/dev/test/foo/bar.js' +``` + + +## API + +### resolveFrom(fromDir, moduleId) + +Like `require()`, throws when the module can't be found. + +### resolveFrom.silent(fromDir, moduleId) + +Returns `null` instead of throwing when the module can't be found. + +#### fromDir + +Type: `string` + +Directory to resolve from. + +#### moduleId + +Type: `string` + +What you would use in `require()`. + + +## Tip + +Create a partial using a bound function if you want to resolve from the same `fromDir` multiple times: + +```js +const resolveFromFoo = resolveFrom.bind(null, 'foo'); + +resolveFromFoo('./bar'); +resolveFromFoo('./baz'); +``` + + +## Related + +- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory +- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path +- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory +- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point +- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily +- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/deps/npm/node_modules/npm-lifecycle/package.json b/deps/npm/node_modules/npm-lifecycle/package.json index 4a5992b1a7d..ffd5f2952fe 100644 --- a/deps/npm/node_modules/npm-lifecycle/package.json +++ b/deps/npm/node_modules/npm-lifecycle/package.json @@ -1,28 +1,28 @@ { - "_from": "npm-lifecycle@~1.0.2", - "_id": "npm-lifecycle@1.0.3", + "_from": "npm-lifecycle@latest", + "_id": "npm-lifecycle@2.0.0", "_inBundle": false, - "_integrity": "sha512-CsdargNux7vbv2oeJg7Jb3AH6LPydR06s051A/6tNBGtHo4USlCzfbRn6mSaJELA0sZpaWfqVUNFQ1arOb6rIg==", + "_integrity": "sha512-aE7H012O01GKXT9BWnsGMLVci+MOgkhpSwq02ok20aXcNHxFs7enfampNMkiOV1DJEU0LynzemwdjbtXahXKcw==", "_location": "/npm-lifecycle", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "tag", "registry": true, - "raw": "npm-lifecycle@~1.0.2", + "raw": "npm-lifecycle@latest", "name": "npm-lifecycle", "escapedName": "npm-lifecycle", - "rawSpec": "~1.0.2", + "rawSpec": "latest", "saveSpec": null, - "fetchSpec": "~1.0.2" + "fetchSpec": "latest" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/npm-lifecycle/-/npm-lifecycle-1.0.3.tgz", - "_shasum": "4cd60543247dbba631281e48ce665ffd52380cce", - "_spec": "npm-lifecycle@~1.0.2", - "_where": "/Users/zkat/Documents/code/npm", + "_resolved": "https://registry.npmjs.org/npm-lifecycle/-/npm-lifecycle-2.0.0.tgz", + "_shasum": "d66fba59e7098dbb5862df66c0d81ed75108f1c6", + "_spec": "npm-lifecycle@latest", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Mike Sherov" }, @@ -31,7 +31,10 @@ }, "bundleDependencies": false, "dependencies": { + "byline": "^5.0.0", "graceful-fs": "^4.1.11", + "node-gyp": "^3.6.2", + "resolve-from": "^4.0.0", "slide": "^1.1.6", "uid-number": "0.0.6", "umask": "^1.1.0", @@ -41,6 +44,7 @@ "description": "JavaScript package lifecycle hook runner", "devDependencies": { "nyc": "^11.1.0", + "sinon": "^4.0.1", "standard": "^10.0.3", "standard-version": "^4.2.0", "tap": "^10.7.2", @@ -49,7 +53,8 @@ }, "files": [ "index.js", - "lib/spawn.js" + "lib/spawn.js", + "node-gyp-bin" ], "homepage": "https://github.com/npm/lifecycle#readme", "keywords": [ @@ -74,5 +79,5 @@ "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.0.3" + "version": "2.0.0" } diff --git a/deps/npm/node_modules/npm-package-arg/README.md b/deps/npm/node_modules/npm-package-arg/README.md index d45032dc74a..847341b21a3 100644 --- a/deps/npm/node_modules/npm-package-arg/README.md +++ b/deps/npm/node_modules/npm-package-arg/README.md @@ -1,5 +1,7 @@ # npm-package-arg +[![Build Status](https://travis-ci.org/npm/npm-package-arg.svg?branch=master)](https://travis-ci.org/npm/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. diff --git a/deps/npm/node_modules/npm-package-arg/npa.js b/deps/npm/node_modules/npm-package-arg/npa.js index a61c0574298..dc885b1ff1c 100644 --- a/deps/npm/node_modules/npm-package-arg/npa.js +++ b/deps/npm/node_modules/npm-package-arg/npa.js @@ -18,6 +18,15 @@ const isFilename = /[.](?:tgz|tar.gz|tar)$/i function npa (arg, where) { let name let spec + if (typeof arg === 'object') { + if (arg instanceof Result && (!where || where === arg.where)) { + return arg + } else if (arg.name && arg.rawSpec) { + return npa.resolve(arg.name, arg.rawSpec, where || arg.where) + } else { + return npa(arg.raw, where || arg.where) + } + } const nameEndsAt = arg[0] === '@' ? arg.slice(1).indexOf('@') + 1 : arg.indexOf('@') const namePart = nameEndsAt > 0 ? arg.slice(0, nameEndsAt) : arg if (isURL.test(arg)) { @@ -131,10 +140,8 @@ 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 + res.gitCommittish = committish === '' ? null : committish } return res } @@ -204,7 +211,7 @@ function matchGitScp (spec) { const matched = spec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i) return matched && !matched[1].match(/:[0-9]+\/?.*$/i) && { fetchSpec: matched[1], - gitCommittish: matched[2] || 'master' + gitCommittish: matched[2] == null ? null : matched[2] } } diff --git a/deps/npm/node_modules/npm-package-arg/package.json b/deps/npm/node_modules/npm-package-arg/package.json index 7e83e1e68c5..38368851448 100644 --- a/deps/npm/node_modules/npm-package-arg/package.json +++ b/deps/npm/node_modules/npm-package-arg/package.json @@ -1,31 +1,27 @@ { - "_from": "npm-package-arg@5.1.2", - "_id": "npm-package-arg@5.1.2", + "_from": "npm-package-arg@latest", + "_id": "npm-package-arg@6.0.0", "_inBundle": false, - "_integrity": "sha512-wJBsrf0qpypPT7A0LART18hCdyhpCMxeTtcb0X4IZO2jsP6Om7EHN1d9KSKiqD+KVH030RVNpWS9thk+pb7wzA==", + "_integrity": "sha512-hwC7g81KLgRmchv9ol6f3Fx4Yyc9ARX5X5niDHVILgpuvf08JRIgOZcEfpFXli3BgESoTrkauqorXm6UbvSgSg==", "_location": "/npm-package-arg", "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "tag", "registry": true, - "raw": "npm-package-arg@5.1.2", + "raw": "npm-package-arg@latest", "name": "npm-package-arg", "escapedName": "npm-package-arg", - "rawSpec": "5.1.2", + "rawSpec": "latest", "saveSpec": null, - "fetchSpec": "5.1.2" + "fetchSpec": "latest" }, "_requiredBy": [ "#USER", - "/", - "/init-package-json", - "/npm-registry-client", - "/pacote", - "/pacote/npm-pick-manifest" + "/" ], - "_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-5.1.2.tgz", - "_shasum": "fb18d17bb61e60900d6312619919bd753755ab37", - "_spec": "npm-package-arg@5.1.2", + "_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.0.0.tgz", + "_shasum": "8cce04b49d3f9faec3f56b0fe5f4391aeb9d2fac", + "_spec": "npm-package-arg@latest", "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Isaac Z. Schlueter", @@ -37,9 +33,9 @@ }, "bundleDependencies": false, "dependencies": { - "hosted-git-info": "^2.4.2", + "hosted-git-info": "^2.5.0", "osenv": "^0.1.4", - "semver": "^5.1.0", + "semver": "^5.4.1", "validate-npm-package-name": "^3.0.0" }, "deprecated": false, @@ -65,5 +61,5 @@ "scripts": { "test": "standard && tap -J --coverage test/*.js" }, - "version": "5.1.2" + "version": "6.0.0" } diff --git a/deps/npm/node_modules/npm-packlist/index.js b/deps/npm/node_modules/npm-packlist/index.js index 25105eed00c..c1b87835963 100644 --- a/deps/npm/node_modules/npm-packlist/index.js +++ b/deps/npm/node_modules/npm-packlist/index.js @@ -76,7 +76,11 @@ const npmWalker = Class => class Walker extends Class { // get the partial path from the root of the walk const p = this.path.substr(this.root.length + 1) const pkgre = /^node_modules\/(@[^\/]+\/?[^\/]+|[^\/]+)(\/.*)?$/ - const pkg = pkgre.test(entry) ? entry.replace(pkgre, '$1') : null + const isRoot = !this.parent + const pkg = isRoot && pkgre.test(entry) ? + entry.replace(pkgre, '$1') : null + const rootNM = isRoot && entry === 'node_modules' + const rootPJ = isRoot && entry === 'package.json' return ( // if we're in a bundled package, check with the parent. @@ -86,14 +90,17 @@ const npmWalker = Class => class Walker extends Class { // if package is bundled, all files included // also include @scope dirs for bundled scoped deps // they'll be ignored if no files end up in them. + // However, this only matters if we're in the root. + // node_modules folders elsewhere, like lib/node_modules, + // should be included normally unless ignored. : pkg ? -1 !== this.bundled.indexOf(pkg) || -1 !== this.bundledScopes.indexOf(pkg) // only walk top node_modules if we want to bundle something - : entry === 'node_modules' && !this.parent ? !!this.bundled.length + : rootNM ? !!this.bundled.length // always include package.json at the root. - : entry === 'package.json' && !this.parent ? true + : rootPJ ? true // otherwise, follow ignore-walk's logic : super.filterEntry(entry, partial) diff --git a/deps/npm/node_modules/npm-packlist/node_modules/ignore-walk/index.js b/deps/npm/node_modules/npm-packlist/node_modules/ignore-walk/index.js index 22517fb0e68..abfd9ece57f 100644 --- a/deps/npm/node_modules/npm-packlist/node_modules/ignore-walk/index.js +++ b/deps/npm/node_modules/npm-packlist/node_modules/ignore-walk/index.js @@ -100,8 +100,7 @@ class Walker extends EE { .filter(line => !/^#|^$/.test(line.trim())) .map(r => new Minimatch(r, mmopt)) - if (rules.length) - this.ignoreRules[file] = rules + this.ignoreRules[file] = rules then() } diff --git a/deps/npm/node_modules/npm-packlist/node_modules/ignore-walk/package.json b/deps/npm/node_modules/npm-packlist/node_modules/ignore-walk/package.json index 2411f58f59f..890635b26b8 100644 --- a/deps/npm/node_modules/npm-packlist/node_modules/ignore-walk/package.json +++ b/deps/npm/node_modules/npm-packlist/node_modules/ignore-walk/package.json @@ -1,27 +1,27 @@ { - "_from": "ignore-walk@^3.0.0", - "_id": "ignore-walk@3.0.0", + "_from": "ignore-walk@^3.0.1", + "_id": "ignore-walk@3.0.1", "_inBundle": false, - "_integrity": "sha512-tKHrQ70YReq6IFyAs/XAQy91mgLVpLExNh3HrjExr6vqg8FLq/vd27D4eAN0K2PodhLjiQu5Xc2Q+AkW/T7hKQ==", + "_integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", "_location": "/npm-packlist/ignore-walk", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "ignore-walk@^3.0.0", + "raw": "ignore-walk@^3.0.1", "name": "ignore-walk", "escapedName": "ignore-walk", - "rawSpec": "^3.0.0", + "rawSpec": "^3.0.1", "saveSpec": null, - "fetchSpec": "^3.0.0" + "fetchSpec": "^3.0.1" }, "_requiredBy": [ "/npm-packlist" ], - "_resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.0.tgz", - "_shasum": "e407919edee5c47c63473b319bfe3ea4a771a57e", - "_spec": "ignore-walk@^3.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/npm-packlist", + "_resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", + "_shasum": "a83e62e7d272ac0e3b551aaa82831a19b69f82f8", + "_spec": "ignore-walk@^3.0.1", + "_where": "/Users/zkat/Documents/code/npm/node_modules/npm-packlist", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -40,7 +40,7 @@ "mkdirp": "^0.5.1", "mutate-fs": "^1.1.0", "rimraf": "^2.6.1", - "tap": "^10.3.2" + "tap": "^10.7.2" }, "files": [ "index.js" @@ -67,5 +67,5 @@ "preversion": "npm test", "test": "tap test/*.js --100" }, - "version": "3.0.0" + "version": "3.0.1" } diff --git a/deps/npm/node_modules/npm-packlist/package.json b/deps/npm/node_modules/npm-packlist/package.json index 7a27ba6d460..f5d2e9a7071 100644 --- a/deps/npm/node_modules/npm-packlist/package.json +++ b/deps/npm/node_modules/npm-packlist/package.json @@ -1,28 +1,28 @@ { - "_from": "npm-packlist@1.1.9", - "_id": "npm-packlist@1.1.9", + "_from": "npm-packlist@1.1.10", + "_id": "npm-packlist@1.1.10", "_inBundle": false, - "_integrity": "sha512-9YECSMmx4grAK0dClDr3vGgo1c8O03DLrA4DCOlJMrtnwP2eLHC+JyH7YCM8qO8HgyWjILY4e5/BY7jVChYaWg==", + "_integrity": "sha512-AQC0Dyhzn4EiYEfIUjCdMl0JJ61I2ER9ukf/sLxJUcZHfo+VyEfz2rMJgLZSS1v30OxPQe1cN0LZA1xbcaVfWA==", "_location": "/npm-packlist", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "npm-packlist@1.1.9", + "raw": "npm-packlist@1.1.10", "name": "npm-packlist", "escapedName": "npm-packlist", - "rawSpec": "1.1.9", + "rawSpec": "1.1.10", "saveSpec": null, - "fetchSpec": "1.1.9" + "fetchSpec": "1.1.10" }, "_requiredBy": [ "#USER", "/", "/pacote" ], - "_resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.1.9.tgz", - "_shasum": "bd24a0b7a31a307315b07c2e54f4888f10577548", - "_spec": "npm-packlist@1.1.9", + "_resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.1.10.tgz", + "_shasum": "1039db9e985727e464df066f4cf0ab6ef85c398a", + "_spec": "npm-packlist@1.1.10", "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Isaac Z. Schlueter", @@ -34,7 +34,7 @@ }, "bundleDependencies": false, "dependencies": { - "ignore-walk": "^3.0.0", + "ignore-walk": "^3.0.1", "npm-bundled": "^1.0.1" }, "deprecated": false, @@ -42,7 +42,7 @@ "devDependencies": { "mkdirp": "^0.5.1", "rimraf": "^2.6.1", - "tap": "^10.3.2" + "tap": "^10.7.2" }, "directories": { "test": "test" @@ -64,5 +64,5 @@ "preversion": "npm test", "test": "tap test/*.js --100 -J" }, - "version": "1.1.9" + "version": "1.1.10" } diff --git a/deps/npm/node_modules/npm-profile/README.md b/deps/npm/node_modules/npm-profile/README.md index e1c13ef3876..001c551cf48 100644 --- a/deps/npm/node_modules/npm-profile/README.md +++ b/deps/npm/node_modules/npm-profile/README.md @@ -50,12 +50,13 @@ An error object indicating what went wrong. The `headers` property will contain the HTTP headers of the response. If the action was denied because an OTP is required then `code` will be set -to `otp`. +to `EOTP`. If the action was denied because it came from an IP address that this action -on this account isn't allowed from then the `code` will be set to `ipaddress`. +on this account isn't allowed from then the `code` will be set to `EAUTHIP`. -Otherwise the code will be the HTTP response code. +Otherwise the code will be `'E'` followed by the HTTP response code, for +example a Forbidden response would be `E403`. ### profile.login(username, password, config) → Promise @@ -93,11 +94,11 @@ An object with a `token` property that can be passed into future authentication An error object indicating what went wrong. -If the object has a `code` property set to `otp` then that indicates that +If the object has a `code` property set to `EOTP` then that indicates that this account must use two-factor authentication to login. Try again with a one-time password. -If the object has a `code` property set to `ip` then that indicates that +If the object has a `code` property set to `EAUTHIP` then that indicates that this account is only allowed to login from certain networks and this ip is not on one of those networks. @@ -157,10 +158,10 @@ An error object indicating what went wrong. The `headers` property will contain the HTTP headers of the response. If the action was denied because an OTP is required then `code` will be set -to `otp`. +to `EOTP`. If the action was denied because it came from an IP address that this action -on this account isn't allowed from then the `code` will be set to `ipaddress`. +on this account isn't allowed from then the `code` will be set to `EAUTHIP`. Otherwise the code will be the HTTP response code. @@ -256,10 +257,10 @@ An error object indicating what went wrong. The `headers` property will contain the HTTP headers of the response. If the action was denied because an OTP is required then `code` will be set -to `otp`. +to `EOTP`. If the action was denied because it came from an IP address that this action -on this account isn't allowed from then the `code` will be set to `ipaddress`. +on this account isn't allowed from then the `code` will be set to `EAUTHIP`. Otherwise the code will be the HTTP response code. @@ -300,10 +301,10 @@ An error object indicating what went wrong. The `headers` property will contain the HTTP headers of the response. If the action was denied because an OTP is required then `code` will be set -to `otp`. +to `EOTP`. If the action was denied because it came from an IP address that this action -on this account isn't allowed from then the `code` will be set to `ipaddress`. +on this account isn't allowed from then the `code` will be set to `EAUTHIP`. Otherwise the code will be the HTTP response code. @@ -338,10 +339,10 @@ An error object indicating what went wrong. The `headers` property will contain the HTTP headers of the response. If the action was denied because an OTP is required then `code` will be set -to `otp`. +to `EOTP`. If the action was denied because it came from an IP address that this action -on this account isn't allowed from then the `code` will be set to `ipaddress`. +on this account isn't allowed from then the `code` will be set to `EAUTHIP`. Otherwise the code will be the HTTP response code. @@ -389,9 +390,39 @@ An error object indicating what went wrong. The `headers` property will contain the HTTP headers of the response. If the action was denied because an OTP is required then `code` will be set -to `otp`. +to `EOTP`. If the action was denied because it came from an IP address that this action -on this account isn't allowed from then the `code` will be set to `ipaddress`. +on this account isn't allowed from then the `code` will be set to `EAUTHIP`. Otherwise the code will be the HTTP response code. + +## Logging + +This modules logs by emitting `log` events on the global `process` object. +These events look like this: + +``` +process.emit('log', 'loglevel', 'feature', 'message part 1', 'part 2', 'part 3', 'etc') +``` + +`loglevel` can be one of: `error`, `warn`, `notice`, `http`, `timing`, `info`, `verbose`, and `silly`. + +`feature` is any brief string that describes the component doing the logging. + +The remaining arguments are evaluated like `console.log` and joined together with spaces. + +A real world example of this is: + +``` + process.emit('log', 'http', 'request', '→',conf.method || 'GET', conf.target) +``` + +To handle the log events, you would do something like this: + +``` +const log = require('npmlog') +process.on('log', function (level) { + return log[level].apply(log, [].slice.call(arguments, 1)) +}) +``` diff --git a/deps/npm/node_modules/npm-profile/index.js b/deps/npm/node_modules/npm-profile/index.js index 838bb12af31..611200c5f8e 100644 --- a/deps/npm/node_modules/npm-profile/index.js +++ b/deps/npm/node_modules/npm-profile/index.js @@ -126,32 +126,58 @@ function createToken (password, readonly, cidrs, conf) { return fetchJSON(Object.assign({target: target, method: 'POST', body: props}, conf)) } -function AuthOTP (res) { - Error.call(this) - this.message = 'OTP required for authentication' - Error.captureStackTrace(this, AuthOTP) - this.headers = res.headers.raw() - this.code = 'EOTP' +function FetchError (err, method, target) { + err.method = method + err.href = target + return err } -AuthOTP.prototype = Error.prototype - -function AuthIPAddress (res) { - Error.call(this) - this.message = 'Login is not allowed from your IP address' - Error.captureStackTrace(this, AuthIPAddress) - this.headers = res.headers.raw() - this.code = 'EAUTHIP' + +class HttpErrorBase extends Error { + constructor (method, target, res, body) { + super() + this.headers = res.headers.raw() + this.statusCode = res.status + this.code = 'E' + res.status + this.method = method + this.target = target + this.body = body + this.pkgid = packageName(target) + } } -AuthIPAddress.prototype = Error.prototype - -function AuthUnknown (res) { - Error.call(this) - this.message = 'Unable to authenticate, need: ' + res.headers.get('www-authenticate') - Error.captureStackTrace(this, AuthUnknown) - this.headers = res.headers.raw() - this.code = 'E401' + +class General extends HttpErrorBase { + constructor (method, target, res, body) { + super(method, target, res, body) + this.message = `Registry returned ${this.statusCode} for ${this.method} on ${this.href}` + } +} + +class AuthOTP extends HttpErrorBase { + constructor (method, target, res, body) { + super(method, target, res, body) + this.message = 'OTP required for authentication' + this.code = 'EOTP' + Error.captureStackTrace(this, AuthOTP) + } +} + +class AuthIPAddress extends HttpErrorBase { + constructor (res, body) { + super(method, target, res, body) + this.message = 'Login is not allowed from your IP address' + this.code = 'EAUTHIP' + Error.captureStackTrace(this, AuthIPAddress) + } +} + +class AuthUnknown extends HttpErrorBase { + constructor (method, target, res, body) { + super(method, target, res, body) + this.message = 'Unable to authenticate, need: ' + res.headers.get('www-authenticate') + this.code = 'EAUTHIP' + Error.captureStackTrace(this, AuthIPAddress) + } } -AuthUnknown.prototype = Error.prototype function authHeaders (auth) { const headers = {} @@ -175,7 +201,10 @@ function fetchJSON (conf) { fetchOpts.headers['Content-Type'] = 'application/json' fetchOpts.body = JSON.stringify(conf.body) } - return fetch.defaults(conf.opts || {})(conf.target, fetchOpts).then(res => { + process.emit('log', 'http', 'request', '→',conf.method || 'GET', conf.target) + return fetch.defaults(conf.opts || {})(conf.target, fetchOpts).catch(err => { + throw new FetchError(err, conf.method, conf.target) + }).then(res => { if (res.headers.get('content-type') === 'application/json') { return res.json().then(content => [res, content]) } else { @@ -190,21 +219,42 @@ function fetchJSON (conf) { }).then(result => { const res = result[0] const content = result[1] + process.emit('log', 'http', res.status, `← ${res.statusText} (${conf.target})`) if (res.status === 401 && res.headers.get('www-authenticate')) { const auth = res.headers.get('www-authenticate').split(/,\s*/).map(s => s.toLowerCase()) if (auth.indexOf('ipaddress') !== -1) { - throw new AuthIPAddress(res) + throw new AuthIPAddress(conf.method, conf.target, res, content) } else if (auth.indexOf('otp') !== -1) { - throw new AuthOTP(res) + throw new AuthOTP(conf.method, conf.target, res, content) } else { - throw new AuthUnknown(res) + throw new AuthUnknown(conf.method, conf.target, res, content) } } else if (res.status < 200 || res.status >= 300) { - const err = new Error(res.statusText) - err.code = 'E' + res.status - err.headers = res.headers.raw() - throw err + if (typeof content === 'object' && content.error) { + return content + } else { + throw new General(conf.method, conf.target, res, content) + } + } else { + return content } - return content }) } + +function packageName (href) { + try { + let basePath = url.parse(href).pathname.substr(1) + if (!basePath.match(/^-/)) { + basePath = basePath.split('/') + var index = basePath.indexOf('_rewrite') + if (index === -1) { + index = basePath.length - 1 + } else { + index++ + } + return decodeURIComponent(basePath[index]) + } + } catch (_) { + // this is ok + } +}
\ No newline at end of file diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/CHANGELOG.md b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/CHANGELOG.md new file mode 100644 index 00000000000..8edd5486b75 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/CHANGELOG.md @@ -0,0 +1,423 @@ +# 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="9.3.0"></a> +# [9.3.0](https://github.com/zkat/cacache/compare/v9.2.9...v9.3.0) (2017-10-07) + + +### Features + +* **copy:** added cacache.get.copy api for fast copies (#107) ([067b5f6](https://github.com/zkat/cacache/commit/067b5f6)) + + + +<a name="9.2.9"></a> +## [9.2.9](https://github.com/zkat/cacache/compare/v9.2.8...v9.2.9) (2017-06-17) + + + +<a name="9.2.8"></a> +## [9.2.8](https://github.com/zkat/cacache/compare/v9.2.7...v9.2.8) (2017-06-05) + + +### Bug Fixes + +* **ssri:** bump ssri for bugfix ([c3232ea](https://github.com/zkat/cacache/commit/c3232ea)) + + + +<a name="9.2.7"></a> +## [9.2.7](https://github.com/zkat/cacache/compare/v9.2.6...v9.2.7) (2017-06-05) + + +### Bug Fixes + +* **content:** make verified content completely read-only (#96) ([4131196](https://github.com/zkat/cacache/commit/4131196)) + + + +<a name="9.2.6"></a> +## [9.2.6](https://github.com/zkat/cacache/compare/v9.2.5...v9.2.6) (2017-05-31) + + +### Bug Fixes + +* **node:** update ssri to prevent old node 4 crash ([5209ffe](https://github.com/zkat/cacache/commit/5209ffe)) + + + +<a name="9.2.5"></a> +## [9.2.5](https://github.com/zkat/cacache/compare/v9.2.4...v9.2.5) (2017-05-25) + + +### Bug Fixes + +* **deps:** fix lockfile issues and bump ssri ([84e1d7e](https://github.com/zkat/cacache/commit/84e1d7e)) + + + +<a name="9.2.4"></a> +## [9.2.4](https://github.com/zkat/cacache/compare/v9.2.3...v9.2.4) (2017-05-24) + + +### Bug Fixes + +* **deps:** bumping deps ([bbccb12](https://github.com/zkat/cacache/commit/bbccb12)) + + + +<a name="9.2.3"></a> +## [9.2.3](https://github.com/zkat/cacache/compare/v9.2.2...v9.2.3) (2017-05-24) + + +### Bug Fixes + +* **rm:** stop crashing if content is missing on rm ([ac90bc0](https://github.com/zkat/cacache/commit/ac90bc0)) + + + +<a name="9.2.2"></a> +## [9.2.2](https://github.com/zkat/cacache/compare/v9.2.1...v9.2.2) (2017-05-14) + + +### Bug Fixes + +* **i18n:** lets pretend this didn't happen ([519b4ee](https://github.com/zkat/cacache/commit/519b4ee)) + + + +<a name="9.2.1"></a> +## [9.2.1](https://github.com/zkat/cacache/compare/v9.2.0...v9.2.1) (2017-05-14) + + +### Bug Fixes + +* **docs:** fixing translation messup ([bb9e4f9](https://github.com/zkat/cacache/commit/bb9e4f9)) + + + +<a name="9.2.0"></a> +# [9.2.0](https://github.com/zkat/cacache/compare/v9.1.0...v9.2.0) (2017-05-14) + + +### Features + +* **i18n:** add Spanish translation for API ([531f9a4](https://github.com/zkat/cacache/commit/531f9a4)) + + + +<a name="9.1.0"></a> +# [9.1.0](https://github.com/zkat/cacache/compare/v9.0.0...v9.1.0) (2017-05-14) + + +### Features + +* **i18n:** Add Spanish translation and i18n setup (#91) ([323b90c](https://github.com/zkat/cacache/commit/323b90c)) + + + +<a name="9.0.0"></a> +# [9.0.0](https://github.com/zkat/cacache/compare/v8.0.0...v9.0.0) (2017-04-28) + + +### Bug Fixes + +* **memoization:** actually use the LRU ([0e55dc9](https://github.com/zkat/cacache/commit/0e55dc9)) + + +### Features + +* **memoization:** memoizers can be injected through opts.memoize (#90) ([e5614c7](https://github.com/zkat/cacache/commit/e5614c7)) + + +### BREAKING CHANGES + +* **memoization:** If you were passing an object to opts.memoize, it will now be used as an injected memoization object. If you were only passing booleans and other non-objects through that option, no changes are needed. + + + +<a name="8.0.0"></a> +# [8.0.0](https://github.com/zkat/cacache/compare/v7.1.0...v8.0.0) (2017-04-22) + + +### Features + +* **read:** change hasContent to return {sri, size} (#88) ([bad6c49](https://github.com/zkat/cacache/commit/bad6c49)), closes [#87](https://github.com/zkat/cacache/issues/87) + + +### BREAKING CHANGES + +* **read:** hasContent now returns an object with `{sri, size}` instead of `sri`. Use `result.sri` anywhere that needed the old return value. + + + +<a name="7.1.0"></a> +# [7.1.0](https://github.com/zkat/cacache/compare/v7.0.5...v7.1.0) (2017-04-20) + + +### Features + +* **size:** handle content size info (#49) ([91230af](https://github.com/zkat/cacache/commit/91230af)) + + + +<a name="7.0.5"></a> +## [7.0.5](https://github.com/zkat/cacache/compare/v7.0.4...v7.0.5) (2017-04-18) + + +### Bug Fixes + +* **integrity:** new ssri with fixed integrity stream ([6d13e8e](https://github.com/zkat/cacache/commit/6d13e8e)) +* **write:** wrap stuff in promises to improve errors ([3624fc5](https://github.com/zkat/cacache/commit/3624fc5)) + + + +<a name="7.0.4"></a> +## [7.0.4](https://github.com/zkat/cacache/compare/v7.0.3...v7.0.4) (2017-04-15) + + +### Bug Fixes + +* **fix-owner:** throw away ENOENTs on chownr ([d49bbcd](https://github.com/zkat/cacache/commit/d49bbcd)) + + + +<a name="7.0.3"></a> +## [7.0.3](https://github.com/zkat/cacache/compare/v7.0.2...v7.0.3) (2017-04-05) + + +### Bug Fixes + +* **read:** fixing error message for integrity verification failures ([9d4f0a5](https://github.com/zkat/cacache/commit/9d4f0a5)) + + + +<a name="7.0.2"></a> +## [7.0.2](https://github.com/zkat/cacache/compare/v7.0.1...v7.0.2) (2017-04-03) + + +### Bug Fixes + +* **integrity:** use EINTEGRITY error code and update ssri ([8dc2e62](https://github.com/zkat/cacache/commit/8dc2e62)) + + + +<a name="7.0.1"></a> +## [7.0.1](https://github.com/zkat/cacache/compare/v7.0.0...v7.0.1) (2017-04-03) + + +### Bug Fixes + +* **docs:** fix header name conflict in readme ([afcd456](https://github.com/zkat/cacache/commit/afcd456)) + + + +<a name="7.0.0"></a> +# [7.0.0](https://github.com/zkat/cacache/compare/v6.3.0...v7.0.0) (2017-04-03) + + +### Bug Fixes + +* **test:** fix content.write tests when running in docker ([d2e9b6a](https://github.com/zkat/cacache/commit/d2e9b6a)) + + +### Features + +* **integrity:** subresource integrity support (#78) ([b1e731f](https://github.com/zkat/cacache/commit/b1e731f)) + + +### BREAKING CHANGES + +* **integrity:** The entire API has been overhauled to use SRI hashes instead of digest/hashAlgorithm pairs. SRI hashes follow the Subresource Integrity standard and support strings and objects compatible with [`ssri`](https://npm.im/ssri). + +* This change bumps the index version, which will invalidate all previous index entries. Content entries will remain intact, and existing caches will automatically reuse any content from before this breaking change. + +* `cacache.get.info()`, `cacache.ls()`, and `cacache.ls.stream()` will now return objects that looks like this: + +``` +{ + key: String, + integrity: '<algorithm>-<base64hash>', + path: ContentPath, + time: Date<ms>, + metadata: Any +} +``` + +* `opts.digest` and `opts.hashAlgorithm` are obsolete for any API calls that used them. + +* Anywhere `opts.digest` was accepted, `opts.integrity` is now an option. Any valid SRI hash is accepted here -- multiple hash entries will be resolved according to the standard: first, the "strongest" hash algorithm will be picked, and then each of the entries for that algorithm will be matched against the content. Content will be validated if *any* of the entries match (so, a single integrity string can be used for multiple "versions" of the same document/data). + +* `put.byDigest()`, `put.stream.byDigest`, `get.byDigest()` and `get.stream.byDigest()` now expect an SRI instead of a `digest` + `opts.hashAlgorithm` pairing. + +* `get.hasContent()` now expects an integrity hash instead of a digest. If content exists, it will return the specific single integrity hash that was found in the cache. + +* `verify()` has learned to handle integrity-based caches, and forgotten how to handle old-style cache indices due to the format change. + +* `cacache.rm.content()` now expects an integrity hash instead of a hex digest. + + + +<a name="6.3.0"></a> +# [6.3.0](https://github.com/zkat/cacache/compare/v6.2.0...v6.3.0) (2017-04-01) + + +### Bug Fixes + +* **fixOwner:** ignore EEXIST race condition from mkdirp ([4670e9b](https://github.com/zkat/cacache/commit/4670e9b)) +* **index:** ignore index removal races when inserting ([b9d2fa2](https://github.com/zkat/cacache/commit/b9d2fa2)) +* **memo:** use lru-cache for better mem management (#75) ([d8ac5aa](https://github.com/zkat/cacache/commit/d8ac5aa)) + + +### Features + +* **dependencies:** Switch to move-concurrently (#77) ([dc6482d](https://github.com/zkat/cacache/commit/dc6482d)) + + + +<a name="6.2.0"></a> +# [6.2.0](https://github.com/zkat/cacache/compare/v6.1.2...v6.2.0) (2017-03-15) + + +### Bug Fixes + +* **index:** additional bucket entry verification with checksum (#72) ([f8e0f25](https://github.com/zkat/cacache/commit/f8e0f25)) +* **verify:** return fixOwner.chownr promise ([6818521](https://github.com/zkat/cacache/commit/6818521)) + + +### Features + +* **tmp:** safe tmp dir creation/management util (#73) ([c42da71](https://github.com/zkat/cacache/commit/c42da71)) + + + +<a name="6.1.2"></a> +## [6.1.2](https://github.com/zkat/cacache/compare/v6.1.1...v6.1.2) (2017-03-13) + + +### Bug Fixes + +* **index:** set default hashAlgorithm ([d6eb2f0](https://github.com/zkat/cacache/commit/d6eb2f0)) + + + +<a name="6.1.1"></a> +## [6.1.1](https://github.com/zkat/cacache/compare/v6.1.0...v6.1.1) (2017-03-13) + + +### Bug Fixes + +* **coverage:** bumping coverage for verify (#71) ([0b7faf6](https://github.com/zkat/cacache/commit/0b7faf6)) +* **deps:** glob should have been a regular dep :< ([0640bc4](https://github.com/zkat/cacache/commit/0640bc4)) + + + +<a name="6.1.0"></a> +# [6.1.0](https://github.com/zkat/cacache/compare/v6.0.2...v6.1.0) (2017-03-12) + + +### Bug Fixes + +* **coverage:** more coverage for content reads (#70) ([ef4f70a](https://github.com/zkat/cacache/commit/ef4f70a)) +* **tests:** use safe-buffer because omfg (#69) ([6ab8132](https://github.com/zkat/cacache/commit/6ab8132)) + + +### Features + +* **rm:** limited rm.all and fixed bugs (#66) ([d5d25ba](https://github.com/zkat/cacache/commit/d5d25ba)), closes [#66](https://github.com/zkat/cacache/issues/66) +* **verify:** tested, working cache verifier/gc (#68) ([45ad77a](https://github.com/zkat/cacache/commit/45ad77a)) + + + +<a name="6.0.2"></a> +## [6.0.2](https://github.com/zkat/cacache/compare/v6.0.1...v6.0.2) (2017-03-11) + + +### Bug Fixes + +* **index:** segment cache items with another subbucket (#64) ([c3644e5](https://github.com/zkat/cacache/commit/c3644e5)) + + + +<a name="6.0.1"></a> +## [6.0.1](https://github.com/zkat/cacache/compare/v6.0.0...v6.0.1) (2017-03-05) + + +### Bug Fixes + +* **docs:** Missed spots in README ([8ffb7fa](https://github.com/zkat/cacache/commit/8ffb7fa)) + + + +<a name="6.0.0"></a> +# [6.0.0](https://github.com/zkat/cacache/compare/v5.0.3...v6.0.0) (2017-03-05) + + +### Bug Fixes + +* **api:** keep memo cache mostly-internal ([2f72d0a](https://github.com/zkat/cacache/commit/2f72d0a)) +* **content:** use the rest of the string, not the whole string ([fa8f3c3](https://github.com/zkat/cacache/commit/fa8f3c3)) +* **deps:** removed `format-number[@2](https://github.com/2).0.2` ([1187791](https://github.com/zkat/cacache/commit/1187791)) +* **deps:** removed inflight[@1](https://github.com/1).0.6 ([0d1819c](https://github.com/zkat/cacache/commit/0d1819c)) +* **deps:** rimraf[@2](https://github.com/2).6.1 ([9efab6b](https://github.com/zkat/cacache/commit/9efab6b)) +* **deps:** standard[@9](https://github.com/9).0.0 ([4202cba](https://github.com/zkat/cacache/commit/4202cba)) +* **deps:** tap[@10](https://github.com/10).3.0 ([aa03088](https://github.com/zkat/cacache/commit/aa03088)) +* **deps:** weallcontribute[@1](https://github.com/1).0.8 ([ad4f4dc](https://github.com/zkat/cacache/commit/ad4f4dc)) +* **docs:** add security note to hashKey ([03f81ba](https://github.com/zkat/cacache/commit/03f81ba)) +* **hashes:** change default hashAlgorithm to sha512 ([ea00ba6](https://github.com/zkat/cacache/commit/ea00ba6)) +* **hashes:** missed a spot for hashAlgorithm defaults ([45997d8](https://github.com/zkat/cacache/commit/45997d8)) +* **index:** add length header before JSON for verification ([fb8cb4d](https://github.com/zkat/cacache/commit/fb8cb4d)) +* **index:** change index filenames to sha1s of keys ([bbc5fca](https://github.com/zkat/cacache/commit/bbc5fca)) +* **index:** who cares about race conditions anyway ([b1d3888](https://github.com/zkat/cacache/commit/b1d3888)) +* **perf:** bulk-read get+read for massive speed ([d26cdf9](https://github.com/zkat/cacache/commit/d26cdf9)) +* **perf:** use bulk file reads for index reads ([79a8891](https://github.com/zkat/cacache/commit/79a8891)) +* **put-stream:** remove tmp file on stream insert error ([65f6632](https://github.com/zkat/cacache/commit/65f6632)) +* **put-stream:** robustified and predictibilized ([daf9e08](https://github.com/zkat/cacache/commit/daf9e08)) +* **put-stream:** use new promise API for moves ([1d36013](https://github.com/zkat/cacache/commit/1d36013)) +* **readme:** updated to reflect new default hashAlgo ([c60a2fa](https://github.com/zkat/cacache/commit/c60a2fa)) +* **verify:** tiny typo fix ([db22d05](https://github.com/zkat/cacache/commit/db22d05)) + + +### Features + +* **api:** converted external api ([7bf032f](https://github.com/zkat/cacache/commit/7bf032f)) +* **cacache:** exported clearMemoized() utility ([8d2c5b6](https://github.com/zkat/cacache/commit/8d2c5b6)) +* **cache:** add versioning to content and index ([31bc549](https://github.com/zkat/cacache/commit/31bc549)) +* **content:** collate content files into subdirs ([c094d9f](https://github.com/zkat/cacache/commit/c094d9f)) +* **deps:** [@npmcorp](https://github.com/npmcorp)/move[@1](https://github.com/1).0.0 ([bdd00bf](https://github.com/zkat/cacache/commit/bdd00bf)) +* **deps:** bluebird[@3](https://github.com/3).4.7 ([3a17aff](https://github.com/zkat/cacache/commit/3a17aff)) +* **deps:** promise-inflight[@1](https://github.com/1).0.1 ([a004fe6](https://github.com/zkat/cacache/commit/a004fe6)) +* **get:** added memoization support for get ([c77d794](https://github.com/zkat/cacache/commit/c77d794)) +* **get:** export hasContent ([2956ec3](https://github.com/zkat/cacache/commit/2956ec3)) +* **index:** add hashAlgorithm and format insert ret val ([b639746](https://github.com/zkat/cacache/commit/b639746)) +* **index:** collate index files into subdirs ([e8402a5](https://github.com/zkat/cacache/commit/e8402a5)) +* **index:** promisify entry index ([cda3335](https://github.com/zkat/cacache/commit/cda3335)) +* **memo:** added memoization lib ([da07b92](https://github.com/zkat/cacache/commit/da07b92)) +* **memo:** export memoization api ([954b1b3](https://github.com/zkat/cacache/commit/954b1b3)) +* **move-file:** add move fallback for weird errors ([5cf4616](https://github.com/zkat/cacache/commit/5cf4616)) +* **perf:** bulk content write api ([51b536e](https://github.com/zkat/cacache/commit/51b536e)) +* **put:** added memoization support to put ([b613a70](https://github.com/zkat/cacache/commit/b613a70)) +* **read:** switched to promises ([a869362](https://github.com/zkat/cacache/commit/a869362)) +* **rm:** added memoization support to rm ([4205cf0](https://github.com/zkat/cacache/commit/4205cf0)) +* **rm:** switched to promises ([a000d24](https://github.com/zkat/cacache/commit/a000d24)) +* **util:** promise-inflight ownership fix requests ([9517cd7](https://github.com/zkat/cacache/commit/9517cd7)) +* **util:** use promises for api ([ae204bb](https://github.com/zkat/cacache/commit/ae204bb)) +* **verify:** converted to Promises ([f0b3974](https://github.com/zkat/cacache/commit/f0b3974)) + + +### BREAKING CHANGES + +* cache: index/content directories are now versioned. Previous caches are no longer compatible and cannot be migrated. +* util: fix-owner now uses Promises instead of callbacks +* index: Previously-generated index entries are no longer compatible and the index must be regenerated. +* index: The index format has changed and previous caches are no longer compatible. Existing caches will need to be regenerated. +* hashes: Default hashAlgorithm changed from sha1 to sha512. If you +rely on the prior setting, pass `opts.hashAlgorithm` in explicitly. +* content: Previously-generated content directories are no longer compatible +and must be regenerated. +* verify: API is now promise-based +* read: Switches to a Promise-based API and removes callback stuff +* rm: Switches to a Promise-based API and removes callback stuff +* index: this changes the API to work off promises instead of callbacks +* api: this means we are going all in on promises now diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/LICENSE.md b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/LICENSE.md new file mode 100644 index 00000000000..c05cb09586f --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/LICENSE.md @@ -0,0 +1,3 @@ +To the extent possible under law, maintainers for this project have waived all copyright and related or neighboring rights to this project. + +For more information on this waiver, see: https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/README.es.md b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/README.es.md new file mode 100644 index 00000000000..783a0a19b01 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/README.es.md @@ -0,0 +1,628 @@ +# cacache [![npm version](https://img.shields.io/npm/v/cacache.svg)](https://npm.im/cacache) [![license](https://img.shields.io/npm/l/cacache.svg)](https://npm.im/cacache) [![Travis](https://img.shields.io/travis/zkat/cacache.svg)](https://travis-ci.org/zkat/cacache) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/cacache?svg=true)](https://ci.appveyor.com/project/zkat/cacache) [![Coverage Status](https://coveralls.io/repos/github/zkat/cacache/badge.svg?branch=latest)](https://coveralls.io/github/zkat/cacache?branch=latest) + +[`cacache`](https://github.com/zkat/cacache) es una librería de Node.js para +manejar caches locales en disco, con acceso tanto con claves únicas como +direcciones de contenido (hashes/hacheos). Es súper rápida, excelente con el +acceso concurrente, y jamás te dará datos incorrectos, aún si se corrompen o +manipulan directamente los ficheros del cache. + +El propósito original era reemplazar el caché local de +[npm](https://npm.im/npm), pero se puede usar por su propia cuenta. + +_Traducciones: [English](README.md)_ + +## Instalación + +`$ npm install --save cacache` + +## Índice + +* [Ejemplo](#ejemplo) +* [Características](#características) +* [Cómo Contribuir](#cómo-contribuir) +* [API](#api) + * [Usando el API en español](#localized-api) + * Leer + * [`ls`](#ls) + * [`ls.flujo`](#ls-stream) + * [`saca`](#get-data) + * [`saca.flujo`](#get-stream) + * [`saca.info`](#get-info) + * [`saca.tieneDatos`](#get-hasContent) + * Escribir + * [`mete`](#put-data) + * [`mete.flujo`](#put-stream) + * [opciones para `mete*`](#put-options) + * [`rm.todo`](#rm-all) + * [`rm.entrada`](#rm-entry) + * [`rm.datos`](#rm-content) + * Utilidades + * [`ponLenguaje`](#set-locale) + * [`limpiaMemoizado`](#clear-memoized) + * [`tmp.hazdir`](#tmp-mkdir) + * [`tmp.conTmp`](#with-tmp) + * Integridad + * [Subresource Integrity](#integrity) + * [`verifica`](#verify) + * [`verifica.ultimaVez`](#verify-last-run) + +### Ejemplo + +```javascript +const cacache = require('cacache/es') +const fs = require('fs') + +const tarbol = '/ruta/a/mi-tar.tgz' +const rutaCache = '/tmp/my-toy-cache' +const clave = 'mi-clave-única-1234' + +// ¡Añádelo al caché! Usa `rutaCache` como raíz del caché. +cacache.mete(rutaCache, clave, '10293801983029384').then(integrity => { + console.log(`Saved content to ${rutaCache}.`) +}) + +const destino = '/tmp/mytar.tgz' + +// Copia el contenido del caché a otro fichero, pero esta vez con flujos. +cacache.saca.flujo( + rutaCache, clave +).pipe( + fs.createWriteStream(destino) +).on('finish', () => { + console.log('extracción completada') +}) + +// La misma cosa, pero accesando el contenido directamente, sin tocar el índice. +cacache.saca.porHacheo(rutaCache, integridad).then(datos => { + fs.writeFile(destino, datos, err => { + console.log('datos del tarbol sacados basado en su sha512, y escrito a otro fichero') + }) +}) +``` + +### Características + +* Extracción por clave o por dirección de contenido (shasum, etc) +* Usa el estándard de web, [Subresource Integrity](#integrity) +* Compatible con multiples algoritmos - usa sha1, sha512, etc, en el mismo caché sin problema +* Entradas con contenido idéntico comparten ficheros +* Tolerancia de fallas (inmune a corrupción, ficheros parciales, carreras de proceso, etc) +* Verificación completa de datos cuando (escribiendo y leyendo) +* Concurrencia rápida, segura y "lockless" +* Compatible con `stream`s (flujos) +* Compatible con `Promise`s (promesas) +* Bastante rápida -- acceso, incluyendo verificación, en microsegundos +* Almacenaje de metadatos arbitrarios +* Colección de basura y verificación adicional fuera de banda +* Cobertura rigurosa de pruebas +* Probablente hay un "Bloom filter" por ahí en algún lado. Eso le mola a la gente, ¿Verdad? 🤔 + +### Cómo Contribuir + +El equipo de cacache felizmente acepta contribuciones de código y otras maneras de participación. ¡Hay muchas formas diferentes de contribuir! La [Guía de Colaboradores](CONTRIBUTING.md) (en inglés) tiene toda la información que necesitas para cualquier tipo de contribución: todo desde cómo reportar errores hasta cómo someter parches con nuevas características. Con todo y eso, no se preocupe por si lo que haces está exáctamente correcto: no hay ningún problema en hacer preguntas si algo no está claro, o no lo encuentras. + +El equipo de cacache tiene miembros hispanohablantes: es completamente aceptable crear `issues` y `pull requests` en español/castellano. + +Todos los participantes en este proyecto deben obedecer el [Código de Conducta](CODE_OF_CONDUCT.md) (en inglés), y en general actuar de forma amable y respetuosa mientras participan en esta comunidad. + +Por favor refiérase al [Historial de Cambios](CHANGELOG.md) (en inglés) para detalles sobre cambios importantes incluídos en cada versión. + +Finalmente, cacache tiene un sistema de localización de lenguaje. Si te interesa añadir lenguajes o mejorar los que existen, mira en el directorio `./locales` para comenzar. + +Happy hacking! + +### API + +#### <a name="localized-api"></a> Usando el API en español + +cacache incluye una traducción completa de su API al castellano, con las mismas +características. Para usar el API como está documentado en este documento, usa +`require('cacache/es')` + +cacache también tiene otros lenguajes: encuéntralos bajo `./locales`, y podrás +usar el API en ese lenguaje con `require('cacache/<lenguaje>')` + +#### <a name="ls"></a> `> cacache.ls(cache) -> Promise<Object>` + +Enumera todas las entradas en el caché, dentro de un solo objeto. Cada entrada +en el objeto tendrá como clave la clave única usada para el índice, el valor +siendo un objeto de [`saca.info`](#get-info). + +##### Ejemplo + +```javascript +cacache.ls(rutaCache).then(console.log) +// Salida +{ + 'my-thing': { + key: 'my-thing', + integrity: 'sha512-BaSe64/EnCoDED+HAsh==' + path: '.testcache/content/deadbeef', // unido con `rutaCache` + time: 12345698490, + size: 4023948, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } + }, + 'other-thing': { + key: 'other-thing', + integrity: 'sha1-ANothER+hasH=', + path: '.testcache/content/bada55', + time: 11992309289, + size: 111112 + } +} +``` + +#### <a name="ls-stream"></a> `> cacache.ls.flujo(cache) -> Readable` + +Enumera todas las entradas en el caché, emitiendo un objeto de +[`saca.info`](#get-info) por cada evento de `data` en el flujo. + +##### Ejemplo + +```javascript +cacache.ls.flujo(rutaCache).on('data', console.log) +// Salida +{ + key: 'my-thing', + integrity: 'sha512-BaSe64HaSh', + path: '.testcache/content/deadbeef', // unido con `rutaCache` + time: 12345698490, + size: 13423, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } +} + +{ + key: 'other-thing', + integrity: 'whirlpool-WoWSoMuchSupport', + path: '.testcache/content/bada55', + time: 11992309289, + size: 498023984029 +} + +{ + ... +} +``` + +#### <a name="get-data"></a> `> cacache.saca(cache, clave, [ops]) -> Promise({data, metadata, integrity})` + +Devuelve un objeto con los datos, hacheo de integridad y metadatos identificados +por la `clave`. La propiedad `data` de este objeto será una instancia de +`Buffer` con los datos almacenados en el caché. to do with it! cacache just +won't care. + +`integrity` es un `string` de [Subresource Integrity](#integrity). Dígase, un +`string` que puede ser usado para verificar a la `data`, que tiene como formato +`<algoritmo>-<hacheo-integridad-base64>`. + +So no existe ninguna entrada identificada por `clave`, o se los datos +almacenados localmente fallan verificación, el `Promise` fallará. + +Una sub-función, `saca.porHacheo`, tiene casi el mismo comportamiento, excepto +que busca entradas usando el hacheo de integridad, sin tocar el índice general. +Esta versión *sólo* devuelve `data`, sin ningún objeto conteniéndola. + +##### Nota + +Esta función lee la entrada completa a la memoria antes de devolverla. Si estás +almacenando datos Muy Grandes, es posible que [`saca.flujo`](#get-stream) sea +una mejor solución. + +##### Ejemplo + +```javascript +// Busca por clave +cache.saca(rutaCache, 'my-thing').then(console.log) +// Salida: +{ + metadata: { + thingName: 'my' + }, + integrity: 'sha512-BaSe64HaSh', + data: Buffer#<deadbeef>, + size: 9320 +} + +// Busca por hacheo +cache.saca.porHacheo(rutaCache, 'sha512-BaSe64HaSh').then(console.log) +// Salida: +Buffer#<deadbeef> +``` + +#### <a name="get-stream"></a> `> cacache.saca.flujo(cache, clave, [ops]) -> Readable` + +Devuelve un [Readable +Stream](https://nodejs.org/api/stream.html#stream_readable_streams) de los datos +almacenados bajo `clave`. + +So no existe ninguna entrada identificada por `clave`, o se los datos +almacenados localmente fallan verificación, el `Promise` fallará. + +`metadata` y `integrity` serán emitidos como eventos antes de que el flujo +cierre. + +Una sub-función, `saca.flujo.porHacheo`, tiene casi el mismo comportamiento, +excepto que busca entradas usando el hacheo de integridad, sin tocar el índice +general. Esta versión no emite eventos de `metadata` o `integrity`. + +##### Ejemplo + +```javascript +// Busca por clave +cache.saca.flujo( + rutaCache, 'my-thing' +).on('metadata', metadata => { + console.log('metadata:', metadata) +}).on('integrity', integrity => { + console.log('integrity:', integrity) +}).pipe( + fs.createWriteStream('./x.tgz') +) +// Salidas: +metadata: { ... } +integrity: 'sha512-SoMeDIGest+64==' + +// Busca por hacheo +cache.saca.flujo.porHacheo( + rutaCache, 'sha512-SoMeDIGest+64==' +).pipe( + fs.createWriteStream('./x.tgz') +) +``` + +#### <a name="get-info"></a> `> cacache.saca.info(cache, clave) -> Promise` + +Busca la `clave` en el índice del caché, devolviendo información sobre la +entrada si existe. + +##### Campos + +* `key` - Clave de la entrada. Igual al argumento `clave`. +* `integrity` - [hacheo de Subresource Integrity](#integrity) del contenido al que se refiere esta entrada. +* `path` - Dirección del fichero de datos almacenados, relativa al argumento `cache`. +* `time` - Hora de creación de la entrada +* `metadata` - Metadatos asignados a esta entrada por el usuario + +##### Ejemplo + +```javascript +cacache.saca.info(rutaCache, 'my-thing').then(console.log) + +// Salida +{ + key: 'my-thing', + integrity: 'sha256-MUSTVERIFY+ALL/THINGS==' + path: '.testcache/content/deadbeef', + time: 12345698490, + size: 849234, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } +} +``` + +#### <a name="get-hasContent"></a> `> cacache.saca.tieneDatos(cache, integrity) -> Promise` + +Busca un [hacheo Subresource Integrity](#integrity) en el caché. Si existe el +contenido asociado con `integrity`, devuelve un objeto con dos campos: el hacheo +_específico_ que se usó para la búsqueda, `sri`, y el tamaño total del +contenido, `size`. Si no existe ningún contenido asociado con `integrity`, +devuelve `false`. + +##### Ejemplo + +```javascript +cacache.saca.tieneDatos(rutaCache, 'sha256-MUSTVERIFY+ALL/THINGS==').then(console.log) + +// Salida +{ + sri: { + source: 'sha256-MUSTVERIFY+ALL/THINGS==', + algorithm: 'sha256', + digest: 'MUSTVERIFY+ALL/THINGS==', + options: [] + }, + size: 9001 +} + +cacache.saca.tieneDatos(rutaCache, 'sha521-NOT+IN/CACHE==').then(console.log) + +// Salida +false +``` + +#### <a name="put-data"></a> `> cacache.mete(cache, clave, datos, [ops]) -> Promise` + +Inserta `datos` en el caché. El `Promise` devuelto se resuelve con un hacheo +(generado conforme a [`ops.algorithms`](#optsalgorithms)) después que la entrada +haya sido escrita en completo. + +##### Ejemplo + +```javascript +fetch( + 'https://registry.npmjs.org/cacache/-/cacache-1.0.0.tgz' +).then(datos => { + return cacache.mete(rutaCache, 'registry.npmjs.org|cacache@1.0.0', datos) +}).then(integridad => { + console.log('el hacheo de integridad es', integridad) +}) +``` + +#### <a name="put-stream"></a> `> cacache.mete.flujo(cache, clave, [ops]) -> Writable` + +Devuelve un [Writable +Stream](https://nodejs.org/api/stream.html#stream_writable_streams) que inserta +al caché los datos escritos a él. Emite un evento `integrity` con el hacheo del +contenido escrito, cuando completa. + +##### Ejemplo + +```javascript +request.get( + 'https://registry.npmjs.org/cacache/-/cacache-1.0.0.tgz' +).pipe( + cacache.mete.flujo( + rutaCache, 'registry.npmjs.org|cacache@1.0.0' + ).on('integrity', d => console.log(`integrity digest is ${d}`)) +) +``` + +#### <a name="put-options"></a> `> opciones para cacache.mete` + +La funciones `cacache.mete` tienen un número de opciones en común. + +##### `ops.metadata` + +Metadatos del usuario que se almacenarán con la entrada. + +##### `ops.size` + +El tamaño declarado de los datos que se van a insertar. Si es proveído, cacache +verificará que los datos escritos sean de ese tamaño, o si no, fallará con un +error con código `EBADSIZE`. + +##### `ops.integrity` + +El hacheo de integridad de los datos siendo escritos. + +Si es proveído, y los datos escritos no le corresponden, la operación fallará +con un error con código `EINTEGRITY`. + +`ops.algorithms` no tiene ningún efecto si esta opción está presente. + +##### `ops.algorithms` + +Por Defecto: `['sha512']` + +Algoritmos que se deben usar cuando se calcule el hacheo de [subresource +integrity](#integrity) para los datos insertados. Puede usar cualquier algoritmo +enumerado en `crypto.getHashes()`. + +Por el momento, sólo se acepta un algoritmo (dígase, un array con exáctamente un +valor). No tiene ningún efecto si `ops.integrity` también ha sido proveido. + +##### `ops.uid`/`ops.gid` + +Si están presentes, cacache hará todo lo posible para asegurarse que todos los +ficheros creados en el proceso de sus operaciones en el caché usen esta +combinación en particular. + +##### `ops.memoize` + +Por Defecto: `null` + +Si es verdad, cacache tratará de memoizar los datos de la entrada en memoria. La +próxima vez que el proceso corriente trate de accesar los datos o entrada, +cacache buscará en memoria antes de buscar en disco. + +Si `ops.memoize` es un objeto regular o un objeto como `Map` (es decir, un +objeto con métodos `get()` y `set()`), este objeto en sí sera usado en vez del +caché de memoria global. Esto permite tener lógica específica a tu aplicación +encuanto al almacenaje en memoria de tus datos. + +Si quieres asegurarte que los datos se lean del disco en vez de memoria, usa +`memoize: false` cuando uses funciones de `cacache.saca`. + +#### <a name="rm-all"></a> `> cacache.rm.todo(cache) -> Promise` + +Borra el caché completo, incluyendo ficheros temporeros, ficheros de datos, y el +índice del caché. + +##### Ejemplo + +```javascript +cacache.rm.todo(rutaCache).then(() => { + console.log('THE APOCALYPSE IS UPON US 😱') +}) +``` + +#### <a name="rm-entry"></a> `> cacache.rm.entrada(cache, clave) -> Promise` + +Alias: `cacache.rm` + +Borra la entrada `clave` del índuce. El contenido asociado con esta entrada +seguirá siendo accesible por hacheo usando +[`saca.flujo.porHacheo`](#get-stream). + +Para borrar el contenido en sí, usa [`rm.datos`](#rm-content). Si quieres hacer +esto de manera más segura (pues ficheros de contenido pueden ser usados por +multiples entradas), usa [`verifica`](#verify) para borrar huérfanos. + +##### Ejemplo + +```javascript +cacache.rm.entrada(rutaCache, 'my-thing').then(() => { + console.log('I did not like it anyway') +}) +``` + +#### <a name="rm-content"></a> `> cacache.rm.datos(cache, integrity) -> Promise` + +Borra el contenido identificado por `integrity`. Cualquier entrada que se +refiera a este contenido quedarán huérfanas y se invalidarán si se tratan de +accesar, al menos que contenido idéntico sea añadido bajo `integrity`. + +##### Ejemplo + +```javascript +cacache.rm.datos(rutaCache, 'sha512-SoMeDIGest/IN+BaSE64==').then(() => { + console.log('los datos para `mi-cosa` se borraron') +}) +``` + +#### <a name="set-locale"></a> `> cacache.ponLenguaje(locale)` + +Configura el lenguaje usado para mensajes y errores de cacache. La lista de +lenguajes disponibles está en el directorio `./locales` del proyecto. + +_Te interesa añadir más lenguajes? [Somete un PR](CONTRIBUTING.md)!_ + +#### <a name="clear-memoized"></a> `> cacache.limpiaMemoizado()` + +Completamente reinicializa el caché de memoria interno. Si estás usando tu +propio objecto con `ops.memoize`, debes hacer esto de manera específica a él. + +#### <a name="tmp-mkdir"></a> `> tmp.hazdir(cache, ops) -> Promise<Path>` + +Alias: `tmp.mkdir` + +Devuelve un directorio único dentro del directorio `tmp` del caché. + +Una vez tengas el directorio, es responsabilidad tuya asegurarte que todos los +ficheros escrito a él sean creados usando los permisos y `uid`/`gid` concordante +con el caché. Si no, puedes pedirle a cacache que lo haga llamando a +[`cacache.tmp.fix()`](#tmp-fix). Esta función arreglará todos los permisos en el +directorio tmp. + +Si quieres que cacache limpie el directorio automáticamente cuando termines, usa +[`cacache.tmp.conTmp()`](#with-tpm). + +##### Ejemplo + +```javascript +cacache.tmp.mkdir(cache).then(dir => { + fs.writeFile(path.join(dir, 'blablabla'), Buffer#<1234>, ...) +}) +``` + +#### <a name="with-tmp"></a> `> tmp.conTmp(cache, ops, cb) -> Promise` + +Crea un directorio temporero con [`tmp.mkdir()`](#tmp-mkdir) y ejecuta `cb` con +él como primer argumento. El directorio creado será removido automáticamente +cuando el valor devolvido por `cb()` se resuelva. + +Las mismas advertencias aplican en cuanto a manejando permisos para los ficheros +dentro del directorio. + +##### Ejemplo + +```javascript +cacache.tmp.conTmp(cache, dir => { + return fs.writeFileAsync(path.join(dir, 'blablabla'), Buffer#<1234>, ...) +}).then(() => { + // `dir` no longer exists +}) +``` + +#### <a name="integrity"></a> Hacheos de Subresource Integrity + +cacache usa strings que siguen la especificación de [Subresource Integrity +spec](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity). + +Es decir, donde quiera cacache espera un argumento o opción `integrity`, ese +string debería usar el formato `<algoritmo>-<hacheo-base64>`. + +Una variación importante sobre los hacheos que cacache acepta es que acepta el +nombre de cualquier algoritmo aceptado por el proceso de Node.js donde se usa. +Puedes usar `crypto.getHashes()` para ver cuales están disponibles. + +##### Generando tus propios hacheos + +Si tienes un `shasum`, en general va a estar en formato de string hexadecimal +(es decir, un `sha1` se vería como algo así: +`5f5513f8822fdbe5145af33b64d8d970dcf95c6e`). + +Para ser compatible con cacache, necesitas convertir esto a su equivalente en +subresource integrity. Por ejemplo, el hacheo correspondiente al ejemplo +anterior sería: `sha1-X1UT+IIv2+UUWvM7ZNjZcNz5XG4=`. + +Puedes usar código así para generarlo por tu cuenta: + +```javascript +const crypto = require('crypto') +const algoritmo = 'sha512' +const datos = 'foobarbaz' + +const integrity = ( + algorithm + + '-' + + crypto.createHash(algoritmo).update(datos).digest('base64') +) +``` + +También puedes usar [`ssri`](https://npm.im/ssri) para deferir el trabajo a otra +librería que garantiza que todo esté correcto, pues maneja probablemente todas +las operaciones que tendrías que hacer con SRIs, incluyendo convirtiendo entre +hexadecimal y el formato SRI. + +#### <a name="verify"></a> `> cacache.verifica(cache, ops) -> Promise` + +Examina y arregla tu caché: + +* Limpia entradas inválidas, huérfanas y corrompidas +* Te deja filtrar cuales entradas retener, con tu propio filtro +* Reclama cualquier ficheros de contenido sin referencias en el índice +* Verifica integridad de todos los ficheros de contenido y remueve los malos +* Arregla permisos del caché +* Remieve el directorio `tmp` en el caché, y todo su contenido. + +Cuando termine, devuelve un objeto con varias estadísticas sobre el proceso de +verificación, por ejemplo la cantidad de espacio de disco reclamado, el número +de entradas válidas, número de entradas removidas, etc. + +##### Opciones + +* `ops.uid` - uid para asignarle al caché y su contenido +* `ops.gid` - gid para asignarle al caché y su contenido +* `ops.filter` - recibe una entrada como argumento. Devuelve falso para removerla. Nota: es posible que esta función sea invocada con la misma entrada más de una vez. + +##### Example + +```sh +echo somegarbage >> $RUTACACHE/content/deadbeef +``` + +```javascript +cacache.verifica(rutaCache).then(stats => { + // deadbeef collected, because of invalid checksum. + console.log('cache is much nicer now! stats:', stats) +}) +``` + +#### <a name="verify-last-run"></a> `> cacache.verifica.ultimaVez(cache) -> Promise` + +Alias: `últimaVez` + +Devuelve un `Date` que representa la última vez que `cacache.verifica` fue +ejecutada en `cache`. + +##### Example + +```javascript +cacache.verifica(rutaCache).then(() => { + cacache.verifica.ultimaVez(rutaCache).then(última => { + console.log('La última vez que se usó cacache.verifica() fue ' + última) + }) +}) +``` diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/README.md b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/README.md new file mode 100644 index 00000000000..ea69b8f540f --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/README.md @@ -0,0 +1,624 @@ +# cacache [![npm version](https://img.shields.io/npm/v/cacache.svg)](https://npm.im/cacache) [![license](https://img.shields.io/npm/l/cacache.svg)](https://npm.im/cacache) [![Travis](https://img.shields.io/travis/zkat/cacache.svg)](https://travis-ci.org/zkat/cacache) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/cacache?svg=true)](https://ci.appveyor.com/project/zkat/cacache) [![Coverage Status](https://coveralls.io/repos/github/zkat/cacache/badge.svg?branch=latest)](https://coveralls.io/github/zkat/cacache?branch=latest) + +[`cacache`](https://github.com/zkat/cacache) is a Node.js library for managing +local key and content address caches. It's really fast, really good at +concurrency, and it will never give you corrupted data, even if cache files +get corrupted or manipulated. + +It was originally written to be used as [npm](https://npm.im)'s local cache, but +can just as easily be used on its own + +_Translations: [español](README.es.md)_ + +## Install + +`$ npm install --save cacache` + +## Table of Contents + +* [Example](#example) +* [Features](#features) +* [Contributing](#contributing) +* [API](#api) + * [Using localized APIs](#localized-api) + * Reading + * [`ls`](#ls) + * [`ls.stream`](#ls-stream) + * [`get`](#get-data) + * [`get.stream`](#get-stream) + * [`get.info`](#get-info) + * [`get.hasContent`](#get-hasContent) + * Writing + * [`put`](#put-data) + * [`put.stream`](#put-stream) + * [`put*` opts](#put-options) + * [`rm.all`](#rm-all) + * [`rm.entry`](#rm-entry) + * [`rm.content`](#rm-content) + * Utilities + * [`setLocale`](#set-locale) + * [`clearMemoized`](#clear-memoized) + * [`tmp.mkdir`](#tmp-mkdir) + * [`tmp.withTmp`](#with-tmp) + * Integrity + * [Subresource Integrity](#integrity) + * [`verify`](#verify) + * [`verify.lastRun`](#verify-last-run) + +### Example + +```javascript +const cacache = require('cacache/en') +const fs = require('fs') + +const tarball = '/path/to/mytar.tgz' +const cachePath = '/tmp/my-toy-cache' +const key = 'my-unique-key-1234' + +// Cache it! Use `cachePath` as the root of the content cache +cacache.put(cachePath, key, '10293801983029384').then(integrity => { + console.log(`Saved content to ${cachePath}.`) +}) + +const destination = '/tmp/mytar.tgz' + +// Copy the contents out of the cache and into their destination! +// But this time, use stream instead! +cacache.get.stream( + cachePath, key +).pipe( + fs.createWriteStream(destination) +).on('finish', () => { + console.log('done extracting!') +}) + +// The same thing, but skip the key index. +cacache.get.byDigest(cachePath, integrityHash).then(data => { + fs.writeFile(destination, data, err => { + console.log('tarball data fetched based on its sha512sum and written out!') + }) +}) +``` + +### Features + +* Extraction by key or by content address (shasum, etc) +* [Subresource Integrity](#integrity) web standard support +* Multi-hash support - safely host sha1, sha512, etc, in a single cache +* Automatic content deduplication +* Fault tolerance (immune to corruption, partial writes, process races, etc) +* Consistency guarantees on read and write (full data verification) +* Lockless, high-concurrency cache access +* Streaming support +* Promise support +* Pretty darn fast -- sub-millisecond reads and writes including verification +* Arbitrary metadata storage +* Garbage collection and additional offline verification +* Thorough test coverage +* There's probably a bloom filter in there somewhere. Those are cool, right? 🤔 + +### Contributing + +The cacache 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="localized-api"></a> Using localized APIs + +cacache includes a complete API in English, with the same features as other +translations. To use the English API as documented in this README, use +`require('cacache/en')`. This is also currently the default if you do +`require('cacache')`, but may change in the future. + +cacache also supports other languages! You can find the list of currently +supported ones my looking in `./locales` in the source directory. You can use +the API in that language with `require('cacache/<lang>')`. + +Want to add support for a new language? Please go ahead! You should be able to +copy `./locales/en.js` and `./locales/en.json` and fill them in. Translating the +`README.md` is a bit more work, but also appreciated if you get around to it. 👍🏼 + +#### <a name="ls"></a> `> cacache.ls(cache) -> Promise<Object>` + +Lists info for all entries currently in the cache as a single large object. Each +entry in the object will be keyed by the unique index key, with corresponding +[`get.info`](#get-info) objects as the values. + +##### Example + +```javascript +cacache.ls(cachePath).then(console.log) +// Output +{ + 'my-thing': { + key: 'my-thing', + integrity: 'sha512-BaSe64/EnCoDED+HAsh==' + path: '.testcache/content/deadbeef', // joined with `cachePath` + time: 12345698490, + size: 4023948, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } + }, + 'other-thing': { + key: 'other-thing', + integrity: 'sha1-ANothER+hasH=', + path: '.testcache/content/bada55', + time: 11992309289, + size: 111112 + } +} +``` + +#### <a name="ls-stream"></a> `> cacache.ls.stream(cache) -> Readable` + +Lists info for all entries currently in the cache as a single large object. + +This works just like [`ls`](#ls), except [`get.info`](#get-info) entries are +returned as `'data'` events on the returned stream. + +##### Example + +```javascript +cacache.ls.stream(cachePath).on('data', console.log) +// Output +{ + key: 'my-thing', + integrity: 'sha512-BaSe64HaSh', + path: '.testcache/content/deadbeef', // joined with `cachePath` + time: 12345698490, + size: 13423, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } +} + +{ + key: 'other-thing', + integrity: 'whirlpool-WoWSoMuchSupport', + path: '.testcache/content/bada55', + time: 11992309289, + size: 498023984029 +} + +{ + ... +} +``` + +#### <a name="get-data"></a> `> cacache.get(cache, key, [opts]) -> Promise({data, metadata, integrity})` + +Returns an object with the cached data, digest, and metadata identified by +`key`. The `data` property of this object will be a `Buffer` instance that +presumably holds some data that means something to you. I'm sure you know what +to do with it! cacache just won't care. + +`integrity` is a [Subresource +Integrity](#integrity) +string. That is, a string that can be used to verify `data`, which looks like +`<hash-algorithm>-<base64-integrity-hash>`. + +If there is no content identified by `key`, or if the locally-stored data does +not pass the validity checksum, the promise will be rejected. + +A sub-function, `get.byDigest` may be used for identical behavior, except lookup +will happen by integrity hash, bypassing the index entirely. This version of the +function *only* returns `data` itself, without any wrapper. + +##### Note + +This function loads the entire cache entry into memory before returning it. If +you're dealing with Very Large data, consider using [`get.stream`](#get-stream) +instead. + +##### Example + +```javascript +// Look up by key +cache.get(cachePath, 'my-thing').then(console.log) +// Output: +{ + metadata: { + thingName: 'my' + }, + integrity: 'sha512-BaSe64HaSh', + data: Buffer#<deadbeef>, + size: 9320 +} + +// Look up by digest +cache.get.byDigest(cachePath, 'sha512-BaSe64HaSh').then(console.log) +// Output: +Buffer#<deadbeef> +``` + +#### <a name="get-stream"></a> `> cacache.get.stream(cache, key, [opts]) -> Readable` + +Returns a [Readable Stream](https://nodejs.org/api/stream.html#stream_readable_streams) of the cached data identified by `key`. + +If there is no content identified by `key`, or if the locally-stored data does +not pass the validity checksum, an error will be emitted. + +`metadata` and `integrity` events will be emitted before the stream closes, if +you need to collect that extra data about the cached entry. + +A sub-function, `get.stream.byDigest` may be used for identical behavior, +except lookup will happen by integrity hash, bypassing the index entirely. This +version does not emit the `metadata` and `integrity` events at all. + +##### Example + +```javascript +// Look up by key +cache.get.stream( + cachePath, 'my-thing' +).on('metadata', metadata => { + console.log('metadata:', metadata) +}).on('integrity', integrity => { + console.log('integrity:', integrity) +}).pipe( + fs.createWriteStream('./x.tgz') +) +// Outputs: +metadata: { ... } +integrity: 'sha512-SoMeDIGest+64==' + +// Look up by digest +cache.get.stream.byDigest( + cachePath, 'sha512-SoMeDIGest+64==' +).pipe( + fs.createWriteStream('./x.tgz') +) +``` + +#### <a name="get-info"></a> `> cacache.get.info(cache, key) -> Promise` + +Looks up `key` in the cache index, returning information about the entry if +one exists. + +##### Fields + +* `key` - Key the entry was looked up under. Matches the `key` argument. +* `integrity` - [Subresource Integrity hash](#integrity) for the content this entry refers to. +* `path` - Filesystem path relative to `cache` argument where content is stored. +* `time` - Timestamp the entry was first added on. +* `metadata` - User-assigned metadata associated with the entry/content. + +##### Example + +```javascript +cacache.get.info(cachePath, 'my-thing').then(console.log) + +// Output +{ + key: 'my-thing', + integrity: 'sha256-MUSTVERIFY+ALL/THINGS==' + path: '.testcache/content/deadbeef', + time: 12345698490, + size: 849234, + metadata: { + name: 'blah', + version: '1.2.3', + description: 'this was once a package but now it is my-thing' + } +} +``` + +#### <a name="get-hasContent"></a> `> cacache.get.hasContent(cache, integrity) -> Promise` + +Looks up a [Subresource Integrity hash](#integrity) in the cache. If content +exists for this `integrity`, it will return an object, with the specific single integrity hash +that was found in `sri` key, and the size of the found content as `size`. If no content exists for this integrity, it will return `false`. + +##### Example + +```javascript +cacache.get.hasContent(cachePath, 'sha256-MUSTVERIFY+ALL/THINGS==').then(console.log) + +// Output +{ + sri: { + source: 'sha256-MUSTVERIFY+ALL/THINGS==', + algorithm: 'sha256', + digest: 'MUSTVERIFY+ALL/THINGS==', + options: [] + }, + size: 9001 +} + +cacache.get.hasContent(cachePath, 'sha521-NOT+IN/CACHE==').then(console.log) + +// Output +false +``` + +#### <a name="put-data"></a> `> cacache.put(cache, key, data, [opts]) -> Promise` + +Inserts data passed to it into the cache. The returned Promise resolves with a +digest (generated according to [`opts.algorithms`](#optsalgorithms)) after the +cache entry has been successfully written. + +##### Example + +```javascript +fetch( + 'https://registry.npmjs.org/cacache/-/cacache-1.0.0.tgz' +).then(data => { + return cacache.put(cachePath, 'registry.npmjs.org|cacache@1.0.0', data) +}).then(integrity => { + console.log('integrity hash is', integrity) +}) +``` + +#### <a name="put-stream"></a> `> cacache.put.stream(cache, key, [opts]) -> Writable` + +Returns a [Writable +Stream](https://nodejs.org/api/stream.html#stream_writable_streams) that inserts +data written to it into the cache. Emits an `integrity` event with the digest of +written contents when it succeeds. + +##### Example + +```javascript +request.get( + 'https://registry.npmjs.org/cacache/-/cacache-1.0.0.tgz' +).pipe( + cacache.put.stream( + cachePath, 'registry.npmjs.org|cacache@1.0.0' + ).on('integrity', d => console.log(`integrity digest is ${d}`)) +) +``` + +#### <a name="put-options"></a> `> cacache.put options` + +`cacache.put` functions have a number of options in common. + +##### `opts.metadata` + +Arbitrary metadata to be attached to the inserted key. + +##### `opts.size` + +If provided, the data stream will be verified to check that enough data was +passed through. If there's more or less data than expected, insertion will fail +with an `EBADSIZE` error. + +##### `opts.integrity` + +If present, the pre-calculated digest for the inserted content. If this option +if provided and does not match the post-insertion digest, insertion will fail +with an `EINTEGRITY` error. + +`algorithms` has no effect if this option is present. + +##### `opts.algorithms` + +Default: ['sha512'] + +Hashing algorithms to use when calculating the [subresource integrity +digest](#integrity) +for inserted data. Can use any algorithm listed in `crypto.getHashes()` or +`'omakase'`/`'お任せします'` to pick a random hash algorithm on each insertion. You +may also use any anagram of `'modnar'` to use this feature. + +Currently only supports one algorithm at a time (i.e., an array length of +exactly `1`). Has no effect if `opts.integrity` is present. + +##### `opts.uid`/`opts.gid` + +If provided, cacache will do its best to make sure any new files added to the +cache use this particular `uid`/`gid` combination. This can be used, +for example, to drop permissions when someone uses `sudo`, but cacache makes +no assumptions about your needs here. + +##### `opts.memoize` + +Default: null + +If provided, cacache will memoize the given cache insertion in memory, bypassing +any filesystem checks for that key or digest in future cache fetches. Nothing +will be written to the in-memory cache unless this option is explicitly truthy. + +If `opts.memoize` is an object or a `Map`-like (that is, an object with `get` +and `set` methods), it will be written to instead of the global memoization +cache. + +Reading from disk data can be forced by explicitly passing `memoize: false` to +the reader functions, but their default will be to read from memory. + +#### <a name="rm-all"></a> `> cacache.rm.all(cache) -> Promise` + +Clears the entire cache. Mainly by blowing away the cache directory itself. + +##### Example + +```javascript +cacache.rm.all(cachePath).then(() => { + console.log('THE APOCALYPSE IS UPON US 😱') +}) +``` + +#### <a name="rm-entry"></a> `> cacache.rm.entry(cache, key) -> Promise` + +Alias: `cacache.rm` + +Removes the index entry for `key`. Content will still be accessible if +requested directly by content address ([`get.stream.byDigest`](#get-stream)). + +To remove the content itself (which might still be used by other entries), use +[`rm.content`](#rm-content). Or, to safely vacuum any unused content, use +[`verify`](#verify). + +##### Example + +```javascript +cacache.rm.entry(cachePath, 'my-thing').then(() => { + console.log('I did not like it anyway') +}) +``` + +#### <a name="rm-content"></a> `> cacache.rm.content(cache, integrity) -> Promise` + +Removes the content identified by `integrity`. Any index entries referring to it +will not be usable again until the content is re-added to the cache with an +identical digest. + +##### Example + +```javascript +cacache.rm.content(cachePath, 'sha512-SoMeDIGest/IN+BaSE64==').then(() => { + console.log('data for my-thing is gone!') +}) +``` + +#### <a name="set-locale"></a> `> cacache.setLocale(locale)` + +Configure the language/locale used for messages and errors coming from cacache. +The list of available locales is in the `./locales` directory in the project +root. + +_Interested in contributing more languages! [Submit a PR](CONTRIBUTING.md)!_ + +#### <a name="clear-memoized"></a> `> cacache.clearMemoized()` + +Completely resets the in-memory entry cache. + +#### <a name="tmp-mkdir"></a> `> tmp.mkdir(cache, opts) -> Promise<Path>` + +Returns a unique temporary directory inside the cache's `tmp` dir. This +directory will use the same safe user assignment that all the other stuff use. + +Once the directory is made, it's the user's responsibility that all files within +are made according to the same `opts.gid`/`opts.uid` settings that would be +passed in. If not, you can ask cacache to do it for you by calling +[`tmp.fix()`](#tmp-fix), which will fix all tmp directory permissions. + +If you want automatic cleanup of this directory, use +[`tmp.withTmp()`](#with-tpm) + +##### Example + +```javascript +cacache.tmp.mkdir(cache).then(dir => { + fs.writeFile(path.join(dir, 'blablabla'), Buffer#<1234>, ...) +}) +``` + +#### <a name="with-tmp"></a> `> tmp.withTmp(cache, opts, cb) -> Promise` + +Creates a temporary directory with [`tmp.mkdir()`](#tmp-mkdir) and calls `cb` +with it. The created temporary directory will be removed when the return value +of `cb()` resolves -- that is, if you return a Promise from `cb()`, the tmp +directory will be automatically deleted once that promise completes. + +The same caveats apply when it comes to managing permissions for the tmp dir's +contents. + +##### Example + +```javascript +cacache.tmp.withTmp(cache, dir => { + return fs.writeFileAsync(path.join(dir, 'blablabla'), Buffer#<1234>, ...) +}).then(() => { + // `dir` no longer exists +}) +``` + +#### <a name="integrity"></a> Subresource Integrity Digests + +For content verification and addressing, cacache uses strings following the +[Subresource +Integrity spec](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity). +That is, any time cacache expects an `integrity` argument or option, it +should be in the format `<hashAlgorithm>-<base64-hash>`. + +One deviation from the current spec is that cacache will support any hash +algorithms supported by the underlying Node.js process. You can use +`crypto.getHashes()` to see which ones you can use. + +##### Generating Digests Yourself + +If you have an existing content shasum, they are generally formatted as a +hexadecimal string (that is, a sha1 would look like: +`5f5513f8822fdbe5145af33b64d8d970dcf95c6e`). In order to be compatible with +cacache, you'll need to convert this to an equivalent subresource integrity +string. For this example, the corresponding hash would be: +`sha1-X1UT+IIv2+UUWvM7ZNjZcNz5XG4=`. + +If you want to generate an integrity string yourself for existing data, you can +use something like this: + +```javascript +const crypto = require('crypto') +const hashAlgorithm = 'sha512' +const data = 'foobarbaz' + +const integrity = ( + hashAlgorithm + + '-' + + crypto.createHash(hashAlgorithm).update(data).digest('base64') +) +``` + +You can also use [`ssri`](https://npm.im/ssri) to have a richer set of functionality +around SRI strings, including generation, parsing, and translating from existing +hex-formatted strings. + +#### <a name="verify"></a> `> cacache.verify(cache, opts) -> Promise` + +Checks out and fixes up your cache: + +* Cleans up corrupted or invalid index entries. +* Custom entry filtering options. +* Garbage collects any content entries not referenced by the index. +* Checks integrity for all content entries and removes invalid content. +* Fixes cache ownership. +* Removes the `tmp` directory in the cache and all its contents. + +When it's done, it'll return an object with various stats about the verification +process, including amount of storage reclaimed, number of valid entries, number +of entries removed, etc. + +##### Options + +* `opts.uid` - uid to assign to cache and its contents +* `opts.gid` - gid to assign to cache and its contents +* `opts.filter` - receives a formatted entry. Return false to remove it. + Note: might be called more than once on the same entry. + +##### Example + +```sh +echo somegarbage >> $CACHEPATH/content/deadbeef +``` + +```javascript +cacache.verify(cachePath).then(stats => { + // deadbeef collected, because of invalid checksum. + console.log('cache is much nicer now! stats:', stats) +}) +``` + +#### <a name="verify-last-run"></a> `> cacache.verify.lastRun(cache) -> Promise` + +Returns a `Date` representing the last time `cacache.verify` was run on `cache`. + +##### Example + +```javascript +cacache.verify(cachePath).then(() => { + cacache.verify.lastRun(cachePath).then(lastTime => { + console.log('cacache.verify was last called on' + lastTime) + }) +}) +``` diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/en.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/en.js new file mode 100644 index 00000000000..a3db581c9f1 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/en.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = require('./locales/en.js') diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/es.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/es.js new file mode 100644 index 00000000000..6282363c3bd --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/es.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = require('./locales/es.js') diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/get.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/get.js new file mode 100644 index 00000000000..2bb3afa5281 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/get.js @@ -0,0 +1,190 @@ +'use strict' + +const BB = require('bluebird') + +const fs = require('fs') +const index = require('./lib/entry-index') +const memo = require('./lib/memoization') +const pipe = require('mississippi').pipe +const pipeline = require('mississippi').pipeline +const read = require('./lib/content/read') +const through = require('mississippi').through + +module.exports = function get (cache, key, opts) { + return getData(false, cache, key, opts) +} +module.exports.byDigest = function getByDigest (cache, digest, opts) { + return getData(true, cache, digest, opts) +} +function getData (byDigest, cache, key, opts) { + opts = opts || {} + const memoized = ( + byDigest + ? memo.get.byDigest(cache, key, opts) + : memo.get(cache, key, opts) + ) + if (memoized && opts.memoize !== false) { + return BB.resolve(byDigest ? memoized : { + metadata: memoized.entry.metadata, + data: memoized.data, + integrity: memoized.entry.integrity, + size: memoized.entry.size + }) + } + return ( + byDigest ? BB.resolve(null) : index.find(cache, key, opts) + ).then(entry => { + if (!entry && !byDigest) { + throw new index.NotFoundError(cache, key) + } + return read(cache, byDigest ? key : entry.integrity, { + integrity: opts.integrity, + size: opts.size + }).then(data => byDigest ? data : { + metadata: entry.metadata, + data: data, + size: entry.size, + integrity: entry.integrity + }).then(res => { + if (opts.memoize && byDigest) { + memo.put.byDigest(cache, key, res, opts) + } else if (opts.memoize) { + memo.put(cache, entry, res.data, opts) + } + return res + }) + }) +} + +module.exports.stream = getStream +function getStream (cache, key, opts) { + opts = opts || {} + let stream = through() + const memoized = memo.get(cache, key, opts) + if (memoized && opts.memoize !== false) { + stream.on('newListener', function (ev, cb) { + ev === 'metadata' && cb(memoized.entry.metadata) + ev === 'integrity' && cb(memoized.entry.integrity) + ev === 'size' && cb(memoized.entry.size) + }) + stream.write(memoized.data, () => stream.end()) + return stream + } + index.find(cache, key).then(entry => { + if (!entry) { + return stream.emit( + 'error', new index.NotFoundError(cache, key) + ) + } + let memoStream + if (opts.memoize) { + let memoData = [] + let memoLength = 0 + memoStream = through((c, en, cb) => { + memoData && memoData.push(c) + memoLength += c.length + cb(null, c, en) + }, cb => { + memoData && memo.put(cache, entry, Buffer.concat(memoData, memoLength), opts) + cb() + }) + } else { + memoStream = through() + } + opts.size = opts.size == null ? entry.size : opts.size + stream.emit('metadata', entry.metadata) + stream.emit('integrity', entry.integrity) + stream.emit('size', entry.size) + stream.on('newListener', function (ev, cb) { + ev === 'metadata' && cb(entry.metadata) + ev === 'integrity' && cb(entry.integrity) + ev === 'size' && cb(entry.size) + }) + pipe( + read.readStream(cache, entry.integrity, opts), + memoStream, + stream + ) + }, err => stream.emit('error', err)) + return stream +} + +module.exports.stream.byDigest = getStreamDigest +function getStreamDigest (cache, integrity, opts) { + opts = opts || {} + const memoized = memo.get.byDigest(cache, integrity, opts) + if (memoized && opts.memoize !== false) { + const stream = through() + stream.write(memoized, () => stream.end()) + return stream + } else { + let stream = read.readStream(cache, integrity, opts) + if (opts.memoize) { + let memoData = [] + let memoLength = 0 + const memoStream = through((c, en, cb) => { + memoData && memoData.push(c) + memoLength += c.length + cb(null, c, en) + }, cb => { + memoData && memo.put.byDigest( + cache, + integrity, + Buffer.concat(memoData, memoLength), + opts + ) + cb() + }) + stream = pipeline(stream, memoStream) + } + return stream + } +} + +module.exports.info = info +function info (cache, key, opts) { + opts = opts || {} + const memoized = memo.get(cache, key, opts) + if (memoized && opts.memoize !== false) { + return BB.resolve(memoized.entry) + } else { + return index.find(cache, key) + } +} + +module.exports.hasContent = read.hasContent + +module.exports.copy = function cp (cache, key, dest, opts) { + return copy(false, cache, key, dest, opts) +} +module.exports.copy.byDigest = function cpDigest (cache, digest, dest, opts) { + return copy(true, cache, digest, dest, opts) +} +function copy (byDigest, cache, key, dest, opts) { + opts = opts || {} + if (read.copy) { + return ( + byDigest ? BB.resolve(null) : index.find(cache, key, opts) + ).then(entry => { + if (!entry && !byDigest) { + throw new index.NotFoundError(cache, key) + } + return read.copy( + cache, byDigest ? key : entry.integrity, dest, opts + ).then(() => byDigest ? key : { + metadata: entry.metadata, + size: entry.size, + integrity: entry.integrity + }) + }) + } else { + return getData(byDigest, cache, key, opts).then(res => { + return fs.writeFileAsync(dest, byDigest ? res : res.data) + .then(() => byDigest ? key : { + metadata: res.metadata, + size: res.size, + integrity: res.integrity + }) + }) + } +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/index.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/index.js new file mode 100644 index 00000000000..a3db581c9f1 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/index.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = require('./locales/en.js') diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/path.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/path.js new file mode 100644 index 00000000000..fa6491ba6f8 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/path.js @@ -0,0 +1,26 @@ +'use strict' + +const contentVer = require('../../package.json')['cache-version'].content +const hashToSegments = require('../util/hash-to-segments') +const path = require('path') +const ssri = require('ssri') + +// Current format of content file path: +// +// sha512-BaSE64Hex= -> +// ~/.my-cache/content-v2/sha512/ba/da/55deadbeefc0ffee +// +module.exports = contentPath +function contentPath (cache, integrity) { + const sri = ssri.parse(integrity, {single: true}) + // contentPath is the *strongest* algo given + return path.join.apply(path, [ + contentDir(cache), + sri.algorithm + ].concat(hashToSegments(sri.hexDigest()))) +} + +module.exports._contentDir = contentDir +function contentDir (cache) { + return path.join(cache, `content-v${contentVer}`) +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/read.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/read.js new file mode 100644 index 00000000000..b09ad5cb409 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/read.js @@ -0,0 +1,115 @@ +'use strict' + +const BB = require('bluebird') + +const contentPath = require('./path') +const fs = require('graceful-fs') +const PassThrough = require('stream').PassThrough +const pipe = BB.promisify(require('mississippi').pipe) +const ssri = require('ssri') +const Y = require('../util/y.js') + +BB.promisifyAll(fs) + +module.exports = read +function read (cache, integrity, opts) { + opts = opts || {} + return pickContentSri(cache, integrity).then(content => { + const sri = content.sri + const cpath = contentPath(cache, sri) + return fs.readFileAsync(cpath, null).then(data => { + if (typeof opts.size === 'number' && opts.size !== data.length) { + throw sizeError(opts.size, data.length) + } else if (ssri.checkData(data, sri)) { + return data + } else { + throw integrityError(sri, cpath) + } + }) + }) +} + +module.exports.stream = readStream +module.exports.readStream = readStream +function readStream (cache, integrity, opts) { + opts = opts || {} + const stream = new PassThrough() + pickContentSri( + cache, integrity + ).then(content => { + const sri = content.sri + return pipe( + fs.createReadStream(contentPath(cache, sri)), + ssri.integrityStream({ + integrity: sri, + size: opts.size + }), + stream + ) + }).catch(err => { + stream.emit('error', err) + }) + return stream +} + +if (fs.copyFile) { + module.exports.copy = copy +} +function copy (cache, integrity, dest, opts) { + opts = opts || {} + return pickContentSri(cache, integrity).then(content => { + const sri = content.sri + const cpath = contentPath(cache, sri) + return fs.copyFileAsync(cpath, dest).then(() => content.size) + }) +} + +module.exports.hasContent = hasContent +function hasContent (cache, integrity) { + if (!integrity) { return BB.resolve(false) } + return pickContentSri(cache, integrity) + .catch({code: 'ENOENT'}, () => false) + .catch({code: 'EPERM'}, err => { + if (process.platform !== 'win32') { + throw err + } else { + return false + } + }).then(content => { + if (!content.sri) return false + return ({ sri: content.sri, size: content.stat.size }) + }) +} + +module.exports._pickContentSri = pickContentSri +function pickContentSri (cache, integrity) { + const sri = ssri.parse(integrity) + // If `integrity` has multiple entries, pick the first digest + // with available local data. + const algo = sri.pickAlgorithm() + const digests = sri[algo] + if (digests.length <= 1) { + const cpath = contentPath(cache, digests[0]) + return fs.lstatAsync(cpath).then(stat => ({ sri: digests[0], stat })) + } else { + return BB.any(sri[sri.pickAlgorithm()].map(meta => { + return pickContentSri(cache, meta) + })) + } +} + +function sizeError (expected, found) { + var err = new Error(Y`Bad data size: expected inserted data to be ${expected} bytes, but got ${found} instead`) + err.expected = expected + err.found = found + err.code = 'EBADSIZE' + return err +} + +function integrityError (sri, path) { + var err = new Error(Y`Integrity verification failed for ${sri} (${path})`) + err.code = 'EINTEGRITY' + err.sri = sri + err.path = path + return err +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/rm.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/rm.js new file mode 100644 index 00000000000..12cf1582358 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/rm.js @@ -0,0 +1,21 @@ +'use strict' + +const BB = require('bluebird') + +const contentPath = require('./path') +const hasContent = require('./read').hasContent +const rimraf = BB.promisify(require('rimraf')) + +module.exports = rm +function rm (cache, integrity) { + return hasContent(cache, integrity).then(content => { + if (content) { + const sri = content.sri + if (sri) { + return rimraf(contentPath(cache, sri)).then(() => true) + } + } else { + return false + } + }) +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/write.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/write.js new file mode 100644 index 00000000000..a79ae929021 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/content/write.js @@ -0,0 +1,162 @@ +'use strict' + +const BB = require('bluebird') + +const contentPath = require('./path') +const fixOwner = require('../util/fix-owner') +const fs = require('graceful-fs') +const moveFile = require('../util/move-file') +const PassThrough = require('stream').PassThrough +const path = require('path') +const pipe = BB.promisify(require('mississippi').pipe) +const rimraf = BB.promisify(require('rimraf')) +const ssri = require('ssri') +const to = require('mississippi').to +const uniqueFilename = require('unique-filename') +const Y = require('../util/y.js') + +const writeFileAsync = BB.promisify(fs.writeFile) + +module.exports = write +function write (cache, data, opts) { + opts = opts || {} + if (opts.algorithms && opts.algorithms.length > 1) { + throw new Error( + Y`opts.algorithms only supports a single algorithm for now` + ) + } + if (typeof opts.size === 'number' && data.length !== opts.size) { + return BB.reject(sizeError(opts.size, data.length)) + } + const sri = ssri.fromData(data, opts) + if (opts.integrity && !ssri.checkData(data, opts.integrity, opts)) { + return BB.reject(checksumError(opts.integrity, sri)) + } + return BB.using(makeTmp(cache, opts), tmp => ( + writeFileAsync( + tmp.target, data, {flag: 'wx'} + ).then(() => ( + moveToDestination(tmp, cache, sri, opts) + )) + )).then(() => ({integrity: sri, size: data.length})) +} + +module.exports.stream = writeStream +function writeStream (cache, opts) { + opts = opts || {} + const inputStream = new PassThrough() + let inputErr = false + function errCheck () { + if (inputErr) { throw inputErr } + } + + let allDone + const ret = to((c, n, cb) => { + if (!allDone) { + allDone = handleContent(inputStream, cache, opts, errCheck) + } + inputStream.write(c, n, cb) + }, cb => { + inputStream.end(() => { + if (!allDone) { + const e = new Error(Y`Cache input stream was empty`) + e.code = 'ENODATA' + return ret.emit('error', e) + } + allDone.then(res => { + res.integrity && ret.emit('integrity', res.integrity) + res.size !== null && ret.emit('size', res.size) + cb() + }, e => { + ret.emit('error', e) + }) + }) + }) + ret.once('error', e => { + inputErr = e + }) + return ret +} + +function handleContent (inputStream, cache, opts, errCheck) { + return BB.using(makeTmp(cache, opts), tmp => { + errCheck() + return pipeToTmp( + inputStream, cache, tmp.target, opts, errCheck + ).then(res => { + return moveToDestination( + tmp, cache, res.integrity, opts, errCheck + ).then(() => res) + }) + }) +} + +function pipeToTmp (inputStream, cache, tmpTarget, opts, errCheck) { + return BB.resolve().then(() => { + let integrity + let size + const hashStream = ssri.integrityStream({ + integrity: opts.integrity, + algorithms: opts.algorithms, + size: opts.size + }).on('integrity', s => { + integrity = s + }).on('size', s => { + size = s + }) + const outStream = fs.createWriteStream(tmpTarget, { + flags: 'wx' + }) + errCheck() + return pipe(inputStream, hashStream, outStream).then(() => { + return {integrity, size} + }, err => { + return rimraf(tmpTarget).then(() => { throw err }) + }) + }) +} + +function makeTmp (cache, opts) { + const tmpTarget = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix) + return fixOwner.mkdirfix( + path.dirname(tmpTarget), opts.uid, opts.gid + ).then(() => ({ + target: tmpTarget, + moved: false + })).disposer(tmp => (!tmp.moved && rimraf(tmp.target))) +} + +function moveToDestination (tmp, cache, sri, opts, errCheck) { + errCheck && errCheck() + const destination = contentPath(cache, sri) + const destDir = path.dirname(destination) + + return fixOwner.mkdirfix( + destDir, opts.uid, opts.gid + ).then(() => { + errCheck && errCheck() + return moveFile(tmp.target, destination) + }).then(() => { + errCheck && errCheck() + tmp.moved = true + return fixOwner.chownr(destination, opts.uid, opts.gid) + }) +} + +function sizeError (expected, found) { + var err = new Error(Y`Bad data size: expected inserted data to be ${expected} bytes, but got ${found} instead`) + err.expected = expected + err.found = found + err.code = 'EBADSIZE' + return err +} + +function checksumError (expected, found) { + var err = new Error(Y`Integrity check failed: + Wanted: ${expected} + Found: ${found}`) + err.code = 'EINTEGRITY' + err.expected = expected + err.found = found + return err +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/entry-index.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/entry-index.js new file mode 100644 index 00000000000..face0fe79c4 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/entry-index.js @@ -0,0 +1,224 @@ +'use strict' + +const BB = require('bluebird') + +const contentPath = require('./content/path') +const crypto = require('crypto') +const fixOwner = require('./util/fix-owner') +const fs = require('graceful-fs') +const hashToSegments = require('./util/hash-to-segments') +const ms = require('mississippi') +const path = require('path') +const ssri = require('ssri') +const Y = require('./util/y.js') + +const indexV = require('../package.json')['cache-version'].index + +const appendFileAsync = BB.promisify(fs.appendFile) +const readFileAsync = BB.promisify(fs.readFile) +const readdirAsync = BB.promisify(fs.readdir) +const concat = ms.concat +const from = ms.from + +module.exports.NotFoundError = class NotFoundError extends Error { + constructor (cache, key) { + super(Y`No cache entry for \`${key}\` found in \`${cache}\``) + this.code = 'ENOENT' + this.cache = cache + this.key = key + } +} + +module.exports.insert = insert +function insert (cache, key, integrity, opts) { + opts = opts || {} + const bucket = bucketPath(cache, key) + const entry = { + key, + integrity: integrity && ssri.stringify(integrity), + time: Date.now(), + size: opts.size, + metadata: opts.metadata + } + return fixOwner.mkdirfix( + path.dirname(bucket), opts.uid, opts.gid + ).then(() => { + const stringified = JSON.stringify(entry) + // NOTE - Cleverness ahoy! + // + // This works because it's tremendously unlikely for an entry to corrupt + // another while still preserving the string length of the JSON in + // question. So, we just slap the length in there and verify it on read. + // + // Thanks to @isaacs for the whiteboarding session that ended up with this. + return appendFileAsync( + bucket, `\n${hashEntry(stringified)}\t${stringified}` + ) + }).then( + () => fixOwner.chownr(bucket, opts.uid, opts.gid) + ).catch({code: 'ENOENT'}, () => { + // There's a class of race conditions that happen when things get deleted + // during fixOwner, or between the two mkdirfix/chownr calls. + // + // It's perfectly fine to just not bother in those cases and lie + // that the index entry was written. Because it's a cache. + }).then(() => { + return formatEntry(cache, entry) + }) +} + +module.exports.find = find +function find (cache, key) { + const bucket = bucketPath(cache, key) + return bucketEntries(cache, bucket).then(entries => { + return entries.reduce((latest, next) => { + if (next && next.key === key) { + return formatEntry(cache, next) + } else { + return latest + } + }, null) + }).catch(err => { + if (err.code === 'ENOENT') { + return null + } else { + throw err + } + }) +} + +module.exports.delete = del +function del (cache, key, opts) { + return insert(cache, key, null, opts) +} + +module.exports.lsStream = lsStream +function lsStream (cache) { + const indexDir = bucketDir(cache) + const stream = from.obj() + + // "/cachename/*" + readdirOrEmpty(indexDir).map(bucket => { + const bucketPath = path.join(indexDir, bucket) + + // "/cachename/<bucket 0xFF>/*" + return readdirOrEmpty(bucketPath).map(subbucket => { + const subbucketPath = path.join(bucketPath, subbucket) + + // "/cachename/<bucket 0xFF>/<bucket 0xFF>/*" + return readdirOrEmpty(subbucketPath).map(entry => { + const getKeyToEntry = bucketEntries( + cache, + path.join(subbucketPath, entry) + ).reduce((acc, entry) => { + acc.set(entry.key, entry) + return acc + }, new Map()) + + return getKeyToEntry.then(reduced => { + return Array.from(reduced.values()).map( + entry => stream.push(formatEntry(cache, entry)) + ) + }).catch({code: 'ENOENT'}, nop) + }) + }) + }).then(() => { + stream.push(null) + }, err => { + stream.emit('error', err) + }) + + return stream +} + +module.exports.ls = ls +function ls (cache) { + return BB.fromNode(cb => { + lsStream(cache).on('error', cb).pipe(concat(entries => { + cb(null, entries.reduce((acc, xs) => { + acc[xs.key] = xs + return acc + }, {})) + })) + }) +} + +function bucketEntries (cache, bucket, filter) { + return readFileAsync( + bucket, 'utf8' + ).then(data => { + let entries = [] + data.split('\n').forEach(entry => { + if (!entry) { return } + const pieces = entry.split('\t') + if (!pieces[1] || hashEntry(pieces[1]) !== pieces[0]) { + // Hash is no good! Corruption or malice? Doesn't matter! + // EJECT EJECT + return + } + let obj + try { + obj = JSON.parse(pieces[1]) + } catch (e) { + // Entry is corrupted! + return + } + if (obj) { + entries.push(obj) + } + }) + return entries + }) +} + +module.exports._bucketDir = bucketDir +function bucketDir (cache) { + return path.join(cache, `index-v${indexV}`) +} + +module.exports._bucketPath = bucketPath +function bucketPath (cache, key) { + const hashed = hashKey(key) + return path.join.apply(path, [bucketDir(cache)].concat( + hashToSegments(hashed) + )) +} + +module.exports._hashKey = hashKey +function hashKey (key) { + return hash(key, 'sha256') +} + +module.exports._hashEntry = hashEntry +function hashEntry (str) { + return hash(str, 'sha1') +} + +function hash (str, digest) { + return crypto + .createHash(digest) + .update(str) + .digest('hex') +} + +function formatEntry (cache, entry) { + // Treat null digests as deletions. They'll shadow any previous entries. + if (!entry.integrity) { return null } + return { + key: entry.key, + integrity: entry.integrity, + path: contentPath(cache, entry.integrity), + size: entry.size, + time: entry.time, + metadata: entry.metadata + } +} + +function readdirOrEmpty (dir) { + return readdirAsync(dir) + .catch({code: 'ENOENT'}, () => []) + .catch({code: 'ENOTDIR'}, () => []) +} + +function nop () { +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/memoization.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/memoization.js new file mode 100644 index 00000000000..92179c7ac6a --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/memoization.js @@ -0,0 +1,69 @@ +'use strict' + +const LRU = require('lru-cache') + +const MAX_SIZE = 50 * 1024 * 1024 // 50MB +const MAX_AGE = 3 * 60 * 1000 + +let MEMOIZED = new LRU({ + max: MAX_SIZE, + maxAge: MAX_AGE, + length: (entry, key) => { + if (key.startsWith('key:')) { + return entry.data.length + } else if (key.startsWith('digest:')) { + return entry.length + } + } +}) + +module.exports.clearMemoized = clearMemoized +function clearMemoized () { + const old = {} + MEMOIZED.forEach((v, k) => { + old[k] = v + }) + MEMOIZED.reset() + return old +} + +module.exports.put = put +function put (cache, entry, data, opts) { + pickMem(opts).set(`key:${cache}:${entry.key}`, { entry, data }) + putDigest(cache, entry.integrity, data, opts) +} + +module.exports.put.byDigest = putDigest +function putDigest (cache, integrity, data, opts) { + pickMem(opts).set(`digest:${cache}:${integrity}`, data) +} + +module.exports.get = get +function get (cache, key, opts) { + return pickMem(opts).get(`key:${cache}:${key}`) +} + +module.exports.get.byDigest = getDigest +function getDigest (cache, integrity, opts) { + return pickMem(opts).get(`digest:${cache}:${integrity}`) +} + +class ObjProxy { + constructor (obj) { + this.obj = obj + } + get (key) { return this.obj[key] } + set (key, val) { this.obj[key] = val } +} + +function pickMem (opts) { + if (!opts || !opts.memoize) { + return MEMOIZED + } else if (opts.memoize.get && opts.memoize.set) { + return opts.memoize + } else if (typeof opts.memoize === 'object') { + return new ObjProxy(opts.memoize) + } else { + return MEMOIZED + } +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/fix-owner.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/fix-owner.js new file mode 100644 index 00000000000..7000bff0480 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/fix-owner.js @@ -0,0 +1,44 @@ +'use strict' + +const BB = require('bluebird') + +const chownr = BB.promisify(require('chownr')) +const mkdirp = BB.promisify(require('mkdirp')) +const inflight = require('promise-inflight') + +module.exports.chownr = fixOwner +function fixOwner (filepath, uid, gid) { + if (!process.getuid) { + // This platform doesn't need ownership fixing + return BB.resolve() + } + if (typeof uid !== 'number' && typeof gid !== 'number') { + // There's no permissions override. Nothing to do here. + return BB.resolve() + } + if ((typeof uid === 'number' && process.getuid() === uid) && + (typeof gid === 'number' && process.getgid() === gid)) { + // No need to override if it's already what we used. + return BB.resolve() + } + return inflight( + 'fixOwner: fixing ownership on ' + filepath, + () => chownr( + filepath, + typeof uid === 'number' ? uid : process.getuid(), + typeof gid === 'number' ? gid : process.getgid() + ).catch({code: 'ENOENT'}, () => null) + ) +} + +module.exports.mkdirfix = mkdirfix +function mkdirfix (p, uid, gid, cb) { + return mkdirp(p).then(made => { + if (made) { + return fixOwner(made, uid, gid).then(() => made) + } + }).catch({code: 'EEXIST'}, () => { + // There's a race in mkdirp! + return fixOwner(p, uid, gid).then(() => null) + }) +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/hash-to-segments.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/hash-to-segments.js new file mode 100644 index 00000000000..192be2a6d65 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/hash-to-segments.js @@ -0,0 +1,11 @@ +'use strict' + +module.exports = hashToSegments + +function hashToSegments (hash) { + return [ + hash.slice(0, 2), + hash.slice(2, 4), + hash.slice(4) + ] +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/move-file.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/move-file.js new file mode 100644 index 00000000000..e12e98188c4 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/move-file.js @@ -0,0 +1,55 @@ +'use strict' + +const fs = require('graceful-fs') +const BB = require('bluebird') +const chmod = BB.promisify(fs.chmod) +const unlink = BB.promisify(fs.unlink) +let move +let pinflight + +module.exports = moveFile +function moveFile (src, dest) { + // This isn't quite an fs.rename -- the assumption is that + // if `dest` already exists, and we get certain errors while + // trying to move it, we should just not bother. + // + // In the case of cache corruption, users will receive an + // EINTEGRITY error elsewhere, and can remove the offending + // content their own way. + // + // Note that, as the name suggests, this strictly only supports file moves. + return BB.fromNode(cb => { + fs.link(src, dest, err => { + if (err) { + if (err.code === 'EEXIST' || err.code === 'EBUSY') { + // file already exists, so whatever + } else if (err.code === 'EPERM' && process.platform === 'win32') { + // file handle stayed open even past graceful-fs limits + } else { + return cb(err) + } + } + return cb() + }) + }).then(() => { + // content should never change for any reason, so make it read-only + return BB.join(unlink(src), process.platform !== 'win32' && chmod(dest, '0444')) + }).catch(err => { + if (process.platform !== 'win32') { + throw err + } else { + if (!pinflight) { pinflight = require('promise-inflight') } + return pinflight('cacache-move-file:' + dest, () => { + return BB.promisify(fs.stat)(dest).catch(err => { + if (err !== 'ENOENT') { + // Something else is wrong here. Bail bail bail + throw err + } + // file doesn't already exist! let's try a rename -> copy fallback + if (!move) { move = require('move-concurrently') } + return move(src, dest, { BB, fs }) + }) + }) + } + }) +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/tmp.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/tmp.js new file mode 100644 index 00000000000..4fc4512cc85 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/tmp.js @@ -0,0 +1,32 @@ +'use strict' + +const BB = require('bluebird') + +const fixOwner = require('./fix-owner') +const path = require('path') +const rimraf = BB.promisify(require('rimraf')) +const uniqueFilename = require('unique-filename') + +module.exports.mkdir = mktmpdir +function mktmpdir (cache, opts) { + opts = opts || {} + const tmpTarget = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix) + return fixOwner.mkdirfix(tmpTarget, opts.uid, opts.gid).then(() => { + return tmpTarget + }) +} + +module.exports.withTmp = withTmp +function withTmp (cache, opts, cb) { + if (!cb) { + cb = opts + opts = null + } + opts = opts || {} + return BB.using(mktmpdir(cache, opts).disposer(rimraf), cb) +} + +module.exports.fix = fixtmpdir +function fixtmpdir (cache, opts) { + return fixOwner(path.join(cache, 'tmp'), opts.uid, opts.gid) +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/y.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/y.js new file mode 100644 index 00000000000..d62bedacb32 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/util/y.js @@ -0,0 +1,25 @@ +'use strict' + +const path = require('path') +const y18n = require('y18n')({ + directory: path.join(__dirname, '../../locales'), + locale: 'en', + updateFiles: process.env.CACACHE_UPDATE_LOCALE_FILES === 'true' +}) + +module.exports = yTag +function yTag (parts) { + let str = '' + parts.forEach((part, i) => { + const arg = arguments[i + 1] + str += part + if (arg) { + str += '%s' + } + }) + return y18n.__.apply(null, [str].concat([].slice.call(arguments, 1))) +} + +module.exports.setLocale = locale => { + y18n.setLocale(locale) +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/verify.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/verify.js new file mode 100644 index 00000000000..6a01004c97c --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/lib/verify.js @@ -0,0 +1,213 @@ +'use strict' + +const BB = require('bluebird') + +const contentPath = require('./content/path') +const finished = BB.promisify(require('mississippi').finished) +const fixOwner = require('./util/fix-owner') +const fs = require('graceful-fs') +const glob = BB.promisify(require('glob')) +const index = require('./entry-index') +const path = require('path') +const rimraf = BB.promisify(require('rimraf')) +const ssri = require('ssri') + +BB.promisifyAll(fs) + +module.exports = verify +function verify (cache, opts) { + opts = opts || {} + opts.log && opts.log.silly('verify', 'verifying cache at', cache) + return BB.reduce([ + markStartTime, + fixPerms, + garbageCollect, + rebuildIndex, + cleanTmp, + writeVerifile, + markEndTime + ], (stats, step, i) => { + const label = step.name || `step #${i}` + const start = new Date() + return BB.resolve(step(cache, opts)).then(s => { + s && Object.keys(s).forEach(k => { + stats[k] = s[k] + }) + const end = new Date() + if (!stats.runTime) { stats.runTime = {} } + stats.runTime[label] = end - start + return stats + }) + }, {}).tap(stats => { + stats.runTime.total = stats.endTime - stats.startTime + opts.log && opts.log.silly('verify', 'verification finished for', cache, 'in', `${stats.runTime.total}ms`) + }) +} + +function markStartTime (cache, opts) { + return { startTime: new Date() } +} + +function markEndTime (cache, opts) { + return { endTime: new Date() } +} + +function fixPerms (cache, opts) { + opts.log && opts.log.silly('verify', 'fixing cache permissions') + return fixOwner.mkdirfix(cache, opts.uid, opts.gid).then(() => { + // TODO - fix file permissions too + return fixOwner.chownr(cache, opts.uid, opts.gid) + }).then(() => null) +} + +// Implements a naive mark-and-sweep tracing garbage collector. +// +// The algorithm is basically as follows: +// 1. Read (and filter) all index entries ("pointers") +// 2. Mark each integrity value as "live" +// 3. Read entire filesystem tree in `content-vX/` dir +// 4. If content is live, verify its checksum and delete it if it fails +// 5. If content is not marked as live, rimraf it. +// +function garbageCollect (cache, opts) { + opts.log && opts.log.silly('verify', 'garbage collecting content') + const indexStream = index.lsStream(cache) + const liveContent = new Set() + indexStream.on('data', entry => { + if (opts && opts.filter && !opts.filter(entry)) { return } + liveContent.add(entry.integrity.toString()) + }) + return finished(indexStream).then(() => { + const contentDir = contentPath._contentDir(cache) + return glob(path.join(contentDir, '**'), { + follow: false, + nodir: true, + nosort: true + }).then(files => { + return BB.resolve({ + verifiedContent: 0, + reclaimedCount: 0, + reclaimedSize: 0, + badContentCount: 0, + keptSize: 0 + }).tap((stats) => BB.map(files, (f) => { + const split = f.split(/[/\\]/) + const digest = split.slice(split.length - 3).join('') + const algo = split[split.length - 4] + const integrity = ssri.fromHex(digest, algo) + if (liveContent.has(integrity.toString())) { + return verifyContent(f, integrity).then(info => { + if (!info.valid) { + stats.reclaimedCount++ + stats.badContentCount++ + stats.reclaimedSize += info.size + } else { + stats.verifiedContent++ + stats.keptSize += info.size + } + return stats + }) + } else { + // No entries refer to this content. We can delete. + stats.reclaimedCount++ + return fs.statAsync(f).then(s => { + return rimraf(f).then(() => { + stats.reclaimedSize += s.size + return stats + }) + }) + } + }, {concurrency: opts.concurrency || 20})) + }) + }) +} + +function verifyContent (filepath, sri) { + return fs.statAsync(filepath).then(stat => { + const contentInfo = { + size: stat.size, + valid: true + } + return ssri.checkStream( + fs.createReadStream(filepath), + sri + ).catch(err => { + if (err.code !== 'EINTEGRITY') { throw err } + return rimraf(filepath).then(() => { + contentInfo.valid = false + }) + }).then(() => contentInfo) + }).catch({code: 'ENOENT'}, () => ({size: 0, valid: false})) +} + +function rebuildIndex (cache, opts) { + opts.log && opts.log.silly('verify', 'rebuilding index') + return index.ls(cache).then(entries => { + const stats = { + missingContent: 0, + rejectedEntries: 0, + totalEntries: 0 + } + const buckets = {} + for (let k in entries) { + if (entries.hasOwnProperty(k)) { + const hashed = index._hashKey(k) + const entry = entries[k] + const excluded = opts && opts.filter && !opts.filter(entry) + excluded && stats.rejectedEntries++ + if (buckets[hashed] && !excluded) { + buckets[hashed].push(entry) + } else if (buckets[hashed] && excluded) { + // skip + } else if (excluded) { + buckets[hashed] = [] + buckets[hashed]._path = index._bucketPath(cache, k) + } else { + buckets[hashed] = [entry] + buckets[hashed]._path = index._bucketPath(cache, k) + } + } + } + return BB.map(Object.keys(buckets), key => { + return rebuildBucket(cache, buckets[key], stats, opts) + }, {concurrency: opts.concurrency || 20}).then(() => stats) + }) +} + +function rebuildBucket (cache, bucket, stats, opts) { + return fs.truncateAsync(bucket._path).then(() => { + // This needs to be serialized because cacache explicitly + // lets very racy bucket conflicts clobber each other. + return BB.mapSeries(bucket, entry => { + const content = contentPath(cache, entry.integrity) + return fs.statAsync(content).then(() => { + return index.insert(cache, entry.key, entry.integrity, { + uid: opts.uid, + gid: opts.gid, + metadata: entry.metadata + }).then(() => { stats.totalEntries++ }) + }).catch({code: 'ENOENT'}, () => { + stats.rejectedEntries++ + stats.missingContent++ + }) + }) + }) +} + +function cleanTmp (cache, opts) { + opts.log && opts.log.silly('verify', 'cleaning tmp directory') + return rimraf(path.join(cache, 'tmp')) +} + +function writeVerifile (cache, opts) { + const verifile = path.join(cache, '_lastverified') + opts.log && opts.log.silly('verify', 'writing verifile to ' + verifile) + return fs.writeFileAsync(verifile, '' + (+(new Date()))) +} + +module.exports.lastRun = lastRun +function lastRun (cache) { + return fs.readFileAsync( + path.join(cache, '_lastverified'), 'utf8' + ).then(data => new Date(+data)) +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/en.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/en.js new file mode 100644 index 00000000000..22025cf0e89 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/en.js @@ -0,0 +1,44 @@ +'use strict' + +const ls = require('../ls.js') +const get = require('../get.js') +const put = require('../put.js') +const rm = require('../rm.js') +const verify = require('../verify.js') +const setLocale = require('../lib/util/y.js').setLocale +const clearMemoized = require('../lib/memoization.js').clearMemoized +const tmp = require('../lib/util/tmp.js') + +setLocale('en') + +const x = module.exports + +x.ls = cache => ls(cache) +x.ls.stream = cache => ls.stream(cache) + +x.get = (cache, key, opts) => get(cache, key, opts) +x.get.byDigest = (cache, hash, opts) => get.byDigest(cache, hash, opts) +x.get.stream = (cache, key, opts) => get.stream(cache, key, opts) +x.get.stream.byDigest = (cache, hash, opts) => get.stream.byDigest(cache, hash, opts) +x.get.copy = (cache, key, dest, opts) => get.copy(cache, key, dest, opts) +x.get.copy.byDigest = (cache, hash, dest, opts) => get.copy.byDigest(cache, hash, dest, opts) +x.get.info = (cache, key) => get.info(cache, key) +x.get.hasContent = (cache, hash) => get.hasContent(cache, hash) + +x.put = (cache, key, data, opts) => put(cache, key, data, opts) +x.put.stream = (cache, key, opts) => put.stream(cache, key, opts) + +x.rm = (cache, key) => rm.entry(cache, key) +x.rm.all = cache => rm.all(cache) +x.rm.entry = x.rm +x.rm.content = (cache, hash) => rm.content(cache, hash) + +x.setLocale = lang => setLocale(lang) +x.clearMemoized = () => clearMemoized() + +x.tmp = {} +x.tmp.mkdir = (cache, opts) => tmp.mkdir(cache, opts) +x.tmp.withTmp = (cache, opts, cb) => tmp.withTmp(cache, opts, cb) + +x.verify = (cache, opts) => verify(cache, opts) +x.verify.lastRun = cache => verify.lastRun(cache) diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/en.json b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/en.json new file mode 100644 index 00000000000..82ecb083249 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/en.json @@ -0,0 +1,6 @@ +{ + "No cache entry for `%s` found in `%s`": "No cache entry for %s found in %s", + "Integrity verification failed for %s (%s)": "Integrity verification failed for %s (%s)", + "Bad data size: expected inserted data to be %s bytes, but got %s instead": "Bad data size: expected inserted data to be %s bytes, but got %s instead", + "Cache input stream was empty": "Cache input stream was empty" +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/es.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/es.js new file mode 100644 index 00000000000..9a27de6585a --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/es.js @@ -0,0 +1,46 @@ +'use strict' + +const ls = require('../ls.js') +const get = require('../get.js') +const put = require('../put.js') +const rm = require('../rm.js') +const verify = require('../verify.js') +const setLocale = require('../lib/util/y.js').setLocale +const clearMemoized = require('../lib/memoization.js').clearMemoized +const tmp = require('../lib/util/tmp.js') + +setLocale('es') + +const x = module.exports + +x.ls = cache => ls(cache) +x.ls.flujo = cache => ls.stream(cache) + +x.saca = (cache, clave, ops) => get(cache, clave, ops) +x.saca.porHacheo = (cache, hacheo, ops) => get.byDigest(cache, hacheo, ops) +x.saca.flujo = (cache, clave, ops) => get.stream(cache, clave, ops) +x.saca.flujo.porHacheo = (cache, hacheo, ops) => get.stream.byDigest(cache, hacheo, ops) +x.sava.copia = (cache, clave, destino, opts) => get.copy(cache, clave, destino, opts) +x.sava.copia.porHacheo = (cache, hacheo, destino, opts) => get.copy.byDigest(cache, hacheo, destino, opts) +x.saca.info = (cache, clave) => get.info(cache, clave) +x.saca.tieneDatos = (cache, hacheo) => get.hasContent(cache, hacheo) + +x.mete = (cache, clave, datos, ops) => put(cache, clave, datos, ops) +x.mete.flujo = (cache, clave, ops) => put.stream(cache, clave, ops) + +x.rm = (cache, clave) => rm.entry(cache, clave) +x.rm.todo = cache => rm.all(cache) +x.rm.entrada = x.rm +x.rm.datos = (cache, hacheo) => rm.content(cache, hacheo) + +x.ponLenguaje = lang => setLocale(lang) +x.limpiaMemoizado = () => clearMemoized() + +x.tmp = {} +x.tmp.mkdir = (cache, ops) => tmp.mkdir(cache, ops) +x.tmp.hazdir = x.tmp.mkdir +x.tmp.conTmp = (cache, ops, cb) => tmp.withTmp(cache, ops, cb) + +x.verifica = (cache, ops) => verify(cache, ops) +x.verifica.ultimaVez = cache => verify.lastRun(cache) +x.verifica.últimaVez = x.verifica.ultimaVez diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/es.json b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/es.json new file mode 100644 index 00000000000..a91d76225b4 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/locales/es.json @@ -0,0 +1,6 @@ +{ + "No cache entry for `%s` found in `%s`": "No existe ninguna entrada para «%s» en «%s»", + "Integrity verification failed for %s (%s)": "Verificación de integridad falló para «%s» (%s)", + "Bad data size: expected inserted data to be %s bytes, but got %s instead": "Tamaño incorrecto de datos: los datos insertados debieron haber sido %s octetos, pero fueron %s", + "Cache input stream was empty": "El stream de entrada al caché estaba vacío" +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/ls.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/ls.js new file mode 100644 index 00000000000..9f49b388ac3 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/ls.js @@ -0,0 +1,6 @@ +'use strict' + +var index = require('./lib/entry-index') + +module.exports = index.ls +module.exports.stream = index.lsStream diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/LICENSE b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/LICENSE new file mode 100644 index 00000000000..3c157f0b9d9 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015, Contributors + +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/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/README.md b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/README.md new file mode 100644 index 00000000000..9859458f20b --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/README.md @@ -0,0 +1,91 @@ +# y18n + +[![Build Status][travis-image]][travis-url] +[![Coverage Status][coveralls-image]][coveralls-url] +[![NPM version][npm-image]][npm-url] +[![js-standard-style][standard-image]][standard-url] + +The bare-bones internationalization library used by yargs. + +Inspired by [i18n](https://www.npmjs.com/package/i18n). + +## Examples + +_simple string translation:_ + +```js +var __ = require('y18n').__ + +console.log(__('my awesome string %s', 'foo')) +``` + +output: + +`my awesome string foo` + +_pluralization support:_ + +```js +var __n = require('y18n').__n + +console.log(__n('one fish %s', '%d fishes %s', 2, 'foo')) +``` + +output: + +`2 fishes foo` + +## JSON Language Files + +The JSON language files should be stored in a `./locales` folder. +File names correspond to locales, e.g., `en.json`, `pirate.json`. + +When strings are observed for the first time they will be +added to the JSON file corresponding to the current locale. + +## Methods + +### require('y18n')(config) + +Create an instance of y18n with the config provided, options include: + +* `directory`: the locale directory, default `./locales`. +* `updateFiles`: should newly observed strings be updated in file, default `true`. +* `locale`: what locale should be used. +* `fallbackToLanguage`: should fallback to a language-only file (e.g. `en.json`) + be allowed if a file matching the locale does not exist (e.g. `en_US.json`), + default `true`. + +### y18n.\_\_(str, arg, arg, arg) + +Print a localized string, `%s` will be replaced with `arg`s. + +### y18n.\_\_n(singularString, pluralString, count, arg, arg, arg) + +Print a localized string with appropriate pluralization. If `%d` is provided +in the string, the `count` will replace this placeholder. + +### y18n.setLocale(str) + +Set the current locale being used. + +### y18n.getLocale() + +What locale is currently being used? + +### y18n.updateLocale(obj) + +Update the current locale with the key value pairs in `obj`. + +## License + +ISC + +[travis-url]: https://travis-ci.org/yargs/y18n +[travis-image]: https://img.shields.io/travis/yargs/y18n.svg +[coveralls-url]: https://coveralls.io/github/yargs/y18n +[coveralls-image]: https://img.shields.io/coveralls/yargs/y18n.svg +[npm-url]: https://npmjs.org/package/y18n +[npm-image]: https://img.shields.io/npm/v/y18n.svg +[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg +[standard-url]: https://github.com/feross/standard diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/index.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/index.js new file mode 100644 index 00000000000..91b159e3429 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/index.js @@ -0,0 +1,172 @@ +var fs = require('fs') +var path = require('path') +var util = require('util') + +function Y18N (opts) { + // configurable options. + opts = opts || {} + this.directory = opts.directory || './locales' + this.updateFiles = typeof opts.updateFiles === 'boolean' ? opts.updateFiles : true + this.locale = opts.locale || 'en' + this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true + + // internal stuff. + this.cache = {} + this.writeQueue = [] +} + +Y18N.prototype.__ = function () { + var args = Array.prototype.slice.call(arguments) + var str = args.shift() + var cb = function () {} // start with noop. + + if (typeof args[args.length - 1] === 'function') cb = args.pop() + cb = cb || function () {} // noop. + + if (!this.cache[this.locale]) this._readLocaleFile() + + // we've observed a new string, update the language file. + if (!this.cache[this.locale][str] && this.updateFiles) { + this.cache[this.locale][str] = str + + // include the current directory and locale, + // since these values could change before the + // write is performed. + this._enqueueWrite([this.directory, this.locale, cb]) + } else { + cb() + } + + return util.format.apply(util, [this.cache[this.locale][str] || str].concat(args)) +} + +Y18N.prototype._enqueueWrite = function (work) { + this.writeQueue.push(work) + if (this.writeQueue.length === 1) this._processWriteQueue() +} + +Y18N.prototype._processWriteQueue = function () { + var _this = this + var work = this.writeQueue[0] + + // destructure the enqueued work. + var directory = work[0] + var locale = work[1] + var cb = work[2] + + var languageFile = this._resolveLocaleFile(directory, locale) + var serializedLocale = JSON.stringify(this.cache[locale], null, 2) + + fs.writeFile(languageFile, serializedLocale, 'utf-8', function (err) { + _this.writeQueue.shift() + if (_this.writeQueue.length > 0) _this._processWriteQueue() + cb(err) + }) +} + +Y18N.prototype._readLocaleFile = function () { + var localeLookup = {} + var languageFile = this._resolveLocaleFile(this.directory, this.locale) + + try { + localeLookup = JSON.parse(fs.readFileSync(languageFile, 'utf-8')) + } catch (err) { + if (err instanceof SyntaxError) { + err.message = 'syntax error in ' + languageFile + } + + if (err.code === 'ENOENT') localeLookup = {} + else throw err + } + + this.cache[this.locale] = localeLookup +} + +Y18N.prototype._resolveLocaleFile = function (directory, locale) { + var file = path.resolve(directory, './', locale + '.json') + if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) { + // attempt fallback to language only + var languageFile = path.resolve(directory, './', locale.split('_')[0] + '.json') + if (this._fileExistsSync(languageFile)) file = languageFile + } + return file +} + +// this only exists because fs.existsSync() "will be deprecated" +// see https://nodejs.org/api/fs.html#fs_fs_existssync_path +Y18N.prototype._fileExistsSync = function (file) { + try { + return fs.statSync(file).isFile() + } catch (err) { + return false + } +} + +Y18N.prototype.__n = function () { + var args = Array.prototype.slice.call(arguments) + var singular = args.shift() + var plural = args.shift() + var quantity = args.shift() + + var cb = function () {} // start with noop. + if (typeof args[args.length - 1] === 'function') cb = args.pop() + + if (!this.cache[this.locale]) this._readLocaleFile() + + var str = quantity === 1 ? singular : plural + if (this.cache[this.locale][singular]) { + str = this.cache[this.locale][singular][quantity === 1 ? 'one' : 'other'] + } + + // we've observed a new string, update the language file. + if (!this.cache[this.locale][singular] && this.updateFiles) { + this.cache[this.locale][singular] = { + one: singular, + other: plural + } + + // include the current directory and locale, + // since these values could change before the + // write is performed. + this._enqueueWrite([this.directory, this.locale, cb]) + } else { + cb() + } + + // if a %d placeholder is provided, add quantity + // to the arguments expanded by util.format. + var values = [str] + if (~str.indexOf('%d')) values.push(quantity) + + return util.format.apply(util, values.concat(args)) +} + +Y18N.prototype.setLocale = function (locale) { + this.locale = locale +} + +Y18N.prototype.getLocale = function () { + return this.locale +} + +Y18N.prototype.updateLocale = function (obj) { + if (!this.cache[this.locale]) this._readLocaleFile() + + for (var key in obj) { + this.cache[this.locale][key] = obj[key] + } +} + +module.exports = function (opts) { + var y18n = new Y18N(opts) + + // bind all functions to y18n, so that + // they can be used in isolation. + for (var key in y18n) { + if (typeof y18n[key] === 'function') { + y18n[key] = y18n[key].bind(y18n) + } + } + + return y18n +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/package.json b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/package.json new file mode 100644 index 00000000000..8e45957e982 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/node_modules/y18n/package.json @@ -0,0 +1,65 @@ +{ + "_from": "y18n@^3.2.1", + "_id": "y18n@3.2.1", + "_inBundle": false, + "_integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "_location": "/npm-profile/make-fetch-happen/cacache/y18n", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "y18n@^3.2.1", + "name": "y18n", + "escapedName": "y18n", + "rawSpec": "^3.2.1", + "saveSpec": null, + "fetchSpec": "^3.2.1" + }, + "_requiredBy": [ + "/npm-profile/make-fetch-happen/cacache" + ], + "_resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "_shasum": "6d15fba884c08679c0d77e88e7759e811e07fa41", + "_spec": "y18n@^3.2.1", + "_where": "/Users/zkat/Documents/code/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache", + "author": { + "name": "Ben Coe", + "email": "ben@npmjs.com" + }, + "bugs": { + "url": "https://github.com/yargs/y18n/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "the bare-bones internationalization library used by yargs", + "devDependencies": { + "chai": "^3.4.1", + "coveralls": "^2.11.6", + "mocha": "^2.3.4", + "nyc": "^6.1.1", + "rimraf": "^2.5.0", + "standard": "^5.4.1" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/yargs/y18n", + "keywords": [ + "i18n", + "internationalization", + "yargs" + ], + "license": "ISC", + "main": "index.js", + "name": "y18n", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/yargs/y18n.git" + }, + "scripts": { + "coverage": "nyc report --reporter=text-lcov | coveralls", + "pretest": "standard", + "test": "nyc mocha" + }, + "version": "3.2.1" +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/package.json b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/package.json new file mode 100644 index 00000000000..7f7ad4057e3 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/package.json @@ -0,0 +1,126 @@ +{ + "_from": "cacache@^9.2.9", + "_id": "cacache@9.3.0", + "_inBundle": false, + "_integrity": "sha512-Vbi8J1XfC8v+FbQ6QkOtKXsHpPnB0i9uMeYFJoj40EbdOsEqWB3DPpNjfsnYBkqOPYA8UvrqH6FZPpBP0zdN7g==", + "_location": "/npm-profile/make-fetch-happen/cacache", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "cacache@^9.2.9", + "name": "cacache", + "escapedName": "cacache", + "rawSpec": "^9.2.9", + "saveSpec": null, + "fetchSpec": "^9.2.9" + }, + "_requiredBy": [ + "/npm-profile/make-fetch-happen" + ], + "_resolved": "https://registry.npmjs.org/cacache/-/cacache-9.3.0.tgz", + "_shasum": "9cd58f2dd0b8c8cacf685b7067b416d6d3cf9db1", + "_spec": "cacache@^9.2.9", + "_where": "/Users/zkat/Documents/code/npm/node_modules/npm-profile/node_modules/make-fetch-happen", + "author": { + "name": "Kat Marchán", + "email": "kzm@sykosomatic.org" + }, + "bugs": { + "url": "https://github.com/zkat/cacache/issues" + }, + "bundleDependencies": false, + "cache-version": { + "content": "2", + "index": "5" + }, + "config": { + "nyc": { + "exclude": [ + "node_modules/**", + "test/**" + ] + } + }, + "contributors": [ + { + "name": "Charlotte Spencer", + "email": "charlottelaspencer@gmail.com" + }, + { + "name": "Rebecca Turner", + "email": "me@re-becca.org" + } + ], + "dependencies": { + "bluebird": "^3.5.0", + "chownr": "^1.0.1", + "glob": "^7.1.2", + "graceful-fs": "^4.1.11", + "lru-cache": "^4.1.1", + "mississippi": "^1.3.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.1", + "ssri": "^4.1.6", + "unique-filename": "^1.1.0", + "y18n": "^3.2.1" + }, + "deprecated": false, + "description": "Fast, fault-tolerant, cross-platform, disk-based, data-agnostic, content-addressable cache.", + "devDependencies": { + "benchmark": "^2.1.4", + "chalk": "^2.0.1", + "cross-env": "^5.0.1", + "nyc": "^11.1.0", + "require-inject": "^1.4.2", + "safe-buffer": "^5.1.1", + "standard": "^10.0.2", + "standard-version": "^4.2.0", + "tacks": "^1.2.2", + "tap": "^10.7.0", + "weallbehave": "^1.2.0", + "weallcontribute": "^1.0.8" + }, + "files": [ + "*.js", + "lib", + "locales" + ], + "homepage": "https://github.com/zkat/cacache#readme", + "keywords": [ + "cache", + "caching", + "content-addressable", + "sri", + "sri hash", + "subresource integrity", + "cache", + "storage", + "store", + "file store", + "filesystem", + "disk cache", + "disk storage" + ], + "license": "CC0-1.0", + "main": "index.js", + "name": "cacache", + "repository": { + "type": "git", + "url": "git+https://github.com/zkat/cacache.git" + }, + "scripts": { + "benchmarks": "node test/benchmarks", + "postrelease": "npm publish && git push --follow-tags", + "prerelease": "npm t", + "pretest": "standard lib test *.js", + "release": "standard-version -s", + "test": "cross-env CACACHE_UPDATE_LOCALE_FILES=true nyc --all -- tap -J test/*.js", + "test-docker": "docker run -it --rm --name pacotest -v \"$PWD\":/tmp -w /tmp node:latest npm test", + "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": "9.3.0" +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/put.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/put.js new file mode 100644 index 00000000000..fe1293e5e7c --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/put.js @@ -0,0 +1,71 @@ +'use strict' + +const index = require('./lib/entry-index') +const memo = require('./lib/memoization') +const write = require('./lib/content/write') +const to = require('mississippi').to + +module.exports = putData +function putData (cache, key, data, opts) { + opts = opts || {} + return write(cache, data, opts).then(res => { + // TODO - stop modifying opts + opts.size = res.size + return index.insert(cache, key, res.integrity, opts).then(entry => { + if (opts.memoize) { + memo.put(cache, entry, data, opts) + } + return res.integrity + }) + }) +} + +module.exports.stream = putStream +function putStream (cache, key, opts) { + opts = opts || {} + let integrity + let size + const contentStream = write.stream( + cache, opts + ).on('integrity', int => { + integrity = int + }).on('size', s => { + size = s + }) + let memoData + let memoTotal = 0 + const stream = to((chunk, enc, cb) => { + contentStream.write(chunk, enc, () => { + if (opts.memoize) { + if (!memoData) { memoData = [] } + memoData.push(chunk) + memoTotal += chunk.length + } + cb() + }) + }, cb => { + contentStream.end(() => { + // TODO - stop modifying `opts` + opts.size = size + index.insert(cache, key, integrity, opts).then(entry => { + if (opts.memoize) { + memo.put(cache, entry, Buffer.concat(memoData, memoTotal), opts) + } + stream.emit('integrity', integrity) + cb() + }) + }) + }) + let erred = false + stream.once('error', err => { + if (erred) { return } + erred = true + contentStream.emit('error', err) + }) + contentStream.once('error', err => { + if (erred) { return } + erred = true + stream.emit('error', err) + }) + return stream +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/rm.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/rm.js new file mode 100644 index 00000000000..e71a1d27b4c --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/rm.js @@ -0,0 +1,28 @@ +'use strict' + +const BB = require('bluebird') + +const index = require('./lib/entry-index') +const memo = require('./lib/memoization') +const path = require('path') +const rimraf = BB.promisify(require('rimraf')) +const rmContent = require('./lib/content/rm') + +module.exports = entry +module.exports.entry = entry +function entry (cache, key) { + memo.clearMemoized() + return index.delete(cache, key) +} + +module.exports.content = content +function content (cache, integrity) { + memo.clearMemoized() + return rmContent(cache, integrity) +} + +module.exports.all = all +function all (cache) { + memo.clearMemoized() + return rimraf(path.join(cache, '*(content-*|index-*)')) +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/verify.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/verify.js new file mode 100644 index 00000000000..db7763d7afd --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/cacache/verify.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = require('./lib/verify') diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/index.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/index.js index 2e9c58c99f4..8a5bcab597b 100644 --- a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/index.js +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/index.js @@ -221,7 +221,14 @@ module.exports = class CachePolicy { responseHeaders() { const headers = this._copyWithoutHopByHopHeaders(this._resHeaders); - headers.age = `${Math.round(this.age())}`; + const age = this.age(); + + // A cache SHOULD generate 113 warning if it heuristically chose a freshness + // lifetime greater than 24 hours and the response's age is greater than 24 hours. + if (age > 3600*24 && !this._hasExplicitExpiration() && this.maxAge() > 3600*24) { + headers.warning = (headers.warning ? `${headers.warning}, ` : '') + '113 - "rfc7234 5.5.4"'; + } + headers.age = `${Math.round(age)}`; return headers; } @@ -260,6 +267,13 @@ module.exports = class CachePolicy { return isFinite(ageValue) ? ageValue : 0; } + /** + * Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`. + * + * For an up-to-date value, see `timeToLive()`. + * + * @return Number + */ maxAge() { if (!this.storable() || this._rescc['no-cache']) { return 0; diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/node4/index.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/node4/index.js index 70111068188..bcdaebe80f3 100644 --- a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/node4/index.js +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/node4/index.js @@ -271,7 +271,14 @@ module.exports = function () { CachePolicy.prototype.responseHeaders = function responseHeaders() { var headers = this._copyWithoutHopByHopHeaders(this._resHeaders); - headers.age = '' + Math.round(this.age()); + var age = this.age(); + + // A cache SHOULD generate 113 warning if it heuristically chose a freshness + // lifetime greater than 24 hours and the response's age is greater than 24 hours. + if (age > 3600 * 24 && !this._hasExplicitExpiration() && this.maxAge() > 3600 * 24) { + headers.warning = (headers.warning ? `${headers.warning}, ` : '') + '113 - "rfc7234 5.5.4"'; + } + headers.age = `${Math.round(age)}`; return headers; }; @@ -314,6 +321,15 @@ module.exports = function () { return isFinite(ageValue) ? ageValue : 0; }; + /** + * Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`. + * + * For an up-to-date value, see `timeToLive()`. + * + * @return Number + */ + + CachePolicy.prototype.maxAge = function maxAge() { if (!this.storable() || this._rescc['no-cache']) { return 0; @@ -442,7 +458,7 @@ module.exports = function () { /* MUST send that entity-tag in any cache validation request (using If-Match or If-None-Match) if an entity-tag has been provided by the origin server. */ if (this._resHeaders.etag) { - headers['if-none-match'] = headers['if-none-match'] ? headers['if-none-match'] + ', ' + this._resHeaders.etag : this._resHeaders.etag; + headers['if-none-match'] = headers['if-none-match'] ? `${headers['if-none-match']}, ${this._resHeaders.etag}` : this._resHeaders.etag; } // Clients MAY issue simple (non-subrange) GET requests with either weak validators or strong validators. Clients MUST NOT use weak validators in other forms of request. @@ -531,7 +547,7 @@ module.exports = function () { var newResponse = Object.assign({}, response, { status: this._status, method: this._method, - headers: headers + headers }); return { policy: new this.constructor(request, newResponse), diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/package.json b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/package.json index 0fde2994a3b..0b18a6f9f60 100644 --- a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/package.json +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/package.json @@ -1,8 +1,8 @@ { "_from": "http-cache-semantics@^3.7.3", - "_id": "http-cache-semantics@3.7.3", + "_id": "http-cache-semantics@3.8.0", "_inBundle": false, - "_integrity": "sha1-LzXFMuzSnx5UE7mvgztySjxvf3I=", + "_integrity": "sha512-HGQFfBdru2fj/dwPn1oLx1fy6QMPeTAD1yzKcxD4l5biw+5QVaui/ehCqxaitoKJC/vHMLKv3Yd+nTlxboOJig==", "_location": "/npm-profile/make-fetch-happen/http-cache-semantics", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/npm-profile/make-fetch-happen" ], - "_resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.7.3.tgz", - "_shasum": "2f35c532ecd29f1e5413b9af833b724a3c6f7f72", + "_resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.0.tgz", + "_shasum": "1e3ce248730e189ac692a6697b9e3fdea2ff8da3", "_spec": "http-cache-semantics@^3.7.3", - "_where": "/Users/rebecca/code/npm/node_modules/npm-profile/node_modules/make-fetch-happen", + "_where": "/Users/zkat/Documents/code/npm/node_modules/npm-profile/node_modules/make-fetch-happen", "author": { "name": "Kornel Lesiński", "email": "kornel@geekhood.net", @@ -34,9 +34,9 @@ "deprecated": false, "description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies", "devDependencies": { - "babel-cli": "^6.24.0", - "babel-preset-env": "^1.3.2", - "mocha": "^3.2.0" + "babel-cli": "^6.24.1", + "babel-preset-env": "^1.5.2", + "mocha": "^3.4.2" }, "files": [ "node4/index.js", @@ -56,5 +56,5 @@ "prepublish": "npm run compile", "test": "npm run compile; mocha node4/test" }, - "version": "3.7.3" + "version": "3.8.0" } diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/responsetest.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/responsetest.js index 27bdb28e044..763910b82c2 100644 --- a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/responsetest.js +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/responsetest.js @@ -34,6 +34,12 @@ describe('Response headers', function() { assert.equal(cache.maxAge(), 678); }); + it('IIS', function() { + const cache = new CachePolicy(req, {headers:{'cache-control': 'private, public, max-age=259200'}}, {shared:false}); + assert(!cache.stale()); + assert.equal(cache.maxAge(), 259200); + }); + it('pre-check tolerated', function() { const cc = 'pre-check=0, post-check=0, no-store, no-cache, max-age=100'; const cache = new CachePolicy(req, {headers:{'cache-control': cc}}); diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/revalidatetest.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/revalidatetest.js index 1f905ec27cb..9dc737718d5 100644 --- a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/revalidatetest.js +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/revalidatetest.js @@ -106,6 +106,7 @@ describe('Can be revalidated?', function() { const headers = cache.revalidationHeaders(simpleRequest); assertHeadersPassed(headers); assert.equal(headers['if-modified-since'], 'Tue, 15 Nov 1994 12:45:26 GMT'); + assert(!/113/.test(headers.warning)); }); it('not without validators', function() { @@ -113,6 +114,20 @@ describe('Can be revalidated?', function() { const headers = cache.revalidationHeaders(simpleRequest); assertHeadersPassed(headers); assertNoValidators(headers); + assert(!/113/.test(headers.warning)); + }) + + it('113 added', function() { + const veryOldResponse = { + headers: { + age: 3600*72, + 'last-modified': 'Tue, 15 Nov 1994 12:45:26 GMT', + }, + }; + + const cache = new CachePolicy(simpleRequest, veryOldResponse); + const headers = cache.responseHeaders(simpleRequest); + assert(/113/.test(headers.warning)); }) }); diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/CHANGELOG.md b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/CHANGELOG.md new file mode 100644 index 00000000000..c1136092e33 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/CHANGELOG.md @@ -0,0 +1,175 @@ +# 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.1.6"></a> +## [4.1.6](https://github.com/zkat/ssri/compare/v4.1.5...v4.1.6) (2017-06-07) + + +### Bug Fixes + +* **checkStream:** make sure to pass all opts through ([0b1bcbe](https://github.com/zkat/ssri/commit/0b1bcbe)) + + + +<a name="4.1.5"></a> +## [4.1.5](https://github.com/zkat/ssri/compare/v4.1.4...v4.1.5) (2017-06-05) + + +### Bug Fixes + +* **integrityStream:** stop crashing if opts.algorithms and opts.integrity have an algo mismatch ([fb1293e](https://github.com/zkat/ssri/commit/fb1293e)) + + + +<a name="4.1.4"></a> +## [4.1.4](https://github.com/zkat/ssri/compare/v4.1.3...v4.1.4) (2017-05-31) + + +### Bug Fixes + +* **node:** older versions of node[@4](https://github.com/4) do not support base64buffer string parsing ([513df4e](https://github.com/zkat/ssri/commit/513df4e)) + + + +<a name="4.1.3"></a> +## [4.1.3](https://github.com/zkat/ssri/compare/v4.1.2...v4.1.3) (2017-05-24) + + +### Bug Fixes + +* **check:** handle various bad hash corner cases better ([c2c262b](https://github.com/zkat/ssri/commit/c2c262b)) + + + +<a name="4.1.2"></a> +## [4.1.2](https://github.com/zkat/ssri/compare/v4.1.1...v4.1.2) (2017-04-18) + + +### Bug Fixes + +* **stream:** _flush can be called multiple times. use on("end") ([b1c4805](https://github.com/zkat/ssri/commit/b1c4805)) + + + +<a name="4.1.1"></a> +## [4.1.1](https://github.com/zkat/ssri/compare/v4.1.0...v4.1.1) (2017-04-12) + + +### Bug Fixes + +* **pickAlgorithm:** error if pickAlgorithm() is used in an empty Integrity ([fab470e](https://github.com/zkat/ssri/commit/fab470e)) + + + +<a name="4.1.0"></a> +# [4.1.0](https://github.com/zkat/ssri/compare/v4.0.0...v4.1.0) (2017-04-07) + + +### Features + +* adding ssri.create for a crypto style interface (#2) ([96f52ad](https://github.com/zkat/ssri/commit/96f52ad)) + + + +<a name="4.0.0"></a> +# [4.0.0](https://github.com/zkat/ssri/compare/v3.0.2...v4.0.0) (2017-04-03) + + +### Bug Fixes + +* **integrity:** should have changed the error code before. oops ([8381afa](https://github.com/zkat/ssri/commit/8381afa)) + + +### BREAKING CHANGES + +* **integrity:** EBADCHECKSUM -> EINTEGRITY for verification errors + + + +<a name="3.0.2"></a> +## [3.0.2](https://github.com/zkat/ssri/compare/v3.0.1...v3.0.2) (2017-04-03) + + + +<a name="3.0.1"></a> +## [3.0.1](https://github.com/zkat/ssri/compare/v3.0.0...v3.0.1) (2017-04-03) + + +### Bug Fixes + +* **package.json:** really should have these in the keywords because search ([a6ac6d0](https://github.com/zkat/ssri/commit/a6ac6d0)) + + + +<a name="3.0.0"></a> +# [3.0.0](https://github.com/zkat/ssri/compare/v2.0.0...v3.0.0) (2017-04-03) + + +### Bug Fixes + +* **hashes:** IntegrityMetadata -> Hash ([d04aa1f](https://github.com/zkat/ssri/commit/d04aa1f)) + + +### Features + +* **check:** return IntegrityMetadata on check success ([2301e74](https://github.com/zkat/ssri/commit/2301e74)) +* **fromHex:** ssri.fromHex to make it easier to generate them from hex valus ([049b89e](https://github.com/zkat/ssri/commit/049b89e)) +* **hex:** utility function for getting hex version of digest ([a9f021c](https://github.com/zkat/ssri/commit/a9f021c)) +* **hexDigest:** added hexDigest method to Integrity objects too ([85208ba](https://github.com/zkat/ssri/commit/85208ba)) +* **integrity:** add .isIntegrity and .isIntegrityMetadata ([1b29e6f](https://github.com/zkat/ssri/commit/1b29e6f)) +* **integrityStream:** new stream that can both generate and check streamed data ([fd23e1b](https://github.com/zkat/ssri/commit/fd23e1b)) +* **parse:** allow parsing straight into a single IntegrityMetadata object ([c8ddf48](https://github.com/zkat/ssri/commit/c8ddf48)) +* **pickAlgorithm:** Intergrity#pickAlgorithm() added ([b97a796](https://github.com/zkat/ssri/commit/b97a796)) +* **size:** calculate and update stream sizes ([02ed1ad](https://github.com/zkat/ssri/commit/02ed1ad)) + + +### BREAKING CHANGES + +* **hashes:** `.isIntegrityMetadata` is now `.isHash`. Also, any references to `IntegrityMetadata` now refer to `Hash`. +* **integrityStream:** createCheckerStream has been removed and replaced with a general-purpose integrityStream. + +To convert existing createCheckerStream code, move the `sri` argument into `opts.integrity` in integrityStream. All other options should be the same. +* **check:** `checkData`, `checkStream`, and `createCheckerStream` now yield a whole IntegrityMetadata instance representing the first successful hash match. + + + +<a name="2.0.0"></a> +# [2.0.0](https://github.com/zkat/ssri/compare/v1.0.0...v2.0.0) (2017-03-24) + + +### Bug Fixes + +* **strict-mode:** make regexes more rigid ([122a32c](https://github.com/zkat/ssri/commit/122a32c)) + + +### Features + +* **api:** added serialize alias for unparse ([999b421](https://github.com/zkat/ssri/commit/999b421)) +* **concat:** add Integrity#concat() ([cae12c7](https://github.com/zkat/ssri/commit/cae12c7)) +* **pickAlgo:** pick the strongest algorithm provided, by default ([58c18f7](https://github.com/zkat/ssri/commit/58c18f7)) +* **strict-mode:** strict SRI support ([3f0b64c](https://github.com/zkat/ssri/commit/3f0b64c)) +* **stringify:** replaced unparse/serialize with stringify ([4acad30](https://github.com/zkat/ssri/commit/4acad30)) +* **verification:** add opts.pickAlgorithm ([f72e658](https://github.com/zkat/ssri/commit/f72e658)) + + +### BREAKING CHANGES + +* **pickAlgo:** ssri will prioritize specific hashes now +* **stringify:** serialize and unparse have been removed. Use ssri.stringify instead. +* **strict-mode:** functions that accepted an optional `sep` argument now expect `opts.sep`. + + + +<a name="1.0.0"></a> +# 1.0.0 (2017-03-23) + + +### Features + +* **api:** implemented initial api ([4fbb16b](https://github.com/zkat/ssri/commit/4fbb16b)) + + +### BREAKING CHANGES + +* **api:** Initial API established. diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/LICENSE.md b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/LICENSE.md new file mode 100644 index 00000000000..c05cb09586f --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/LICENSE.md @@ -0,0 +1,3 @@ +To the extent possible under law, maintainers for this project have waived all copyright and related or neighboring rights to this project. + +For more information on this waiver, see: https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/README.md b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/README.md new file mode 100644 index 00000000000..f2fc035da52 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/README.md @@ -0,0 +1,462 @@ +# ssri [![npm version](https://img.shields.io/npm/v/ssri.svg)](https://npm.im/ssri) [![license](https://img.shields.io/npm/l/ssri.svg)](https://npm.im/ssri) [![Travis](https://img.shields.io/travis/zkat/ssri.svg)](https://travis-ci.org/zkat/ssri) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/ssri?svg=true)](https://ci.appveyor.com/project/zkat/ssri) [![Coverage Status](https://coveralls.io/repos/github/zkat/ssri/badge.svg?branch=latest)](https://coveralls.io/github/zkat/ssri?branch=latest) + +[`ssri`](https://github.com/zkat/ssri), short for Standard Subresource +Integrity, is a Node.js utility for parsing, manipulating, serializing, +generating, and verifying [Subresource +Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) hashes. + +## Install + +`$ npm install --save ssri` + +## Table of Contents + +* [Example](#example) +* [Features](#features) +* [Contributing](#contributing) +* [API](#api) + * Parsing & Serializing + * [`parse`](#parse) + * [`stringify`](#stringify) + * [`Integrity#concat`](#integrity-concat) + * [`Integrity#toString`](#integrity-to-string) + * [`Integrity#toJSON`](#integrity-to-json) + * [`Integrity#pickAlgorithm`](#integrity-pick-algorithm) + * [`Integrity#hexDigest`](#integrity-hex-digest) + * Integrity Generation + * [`fromHex`](#from-hex) + * [`fromData`](#from-data) + * [`fromStream`](#from-stream) + * [`create`](#create) + * Integrity Verification + * [`checkData`](#check-data) + * [`checkStream`](#check-stream) + * [`integrityStream`](#integrity-stream) + +### Example + +```javascript +const ssri = require('ssri') + +const integrity = 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' + +// Parsing and serializing +const parsed = ssri.parse(integrity) +ssri.stringify(parsed) // === integrity (works on non-Integrity objects) +parsed.toString() // === integrity + +// Async stream functions +ssri.checkStream(fs.createReadStream('./my-file'), integrity).then(...) +ssri.fromStream(fs.createReadStream('./my-file')).then(sri => { + sri.toString() === integrity +}) +fs.createReadStream('./my-file').pipe(ssri.createCheckerStream(sri)) + +// Sync data functions +ssri.fromData(fs.readFileSync('./my-file')) // === parsed +ssri.checkData(fs.readFileSync('./my-file'), integrity) // => 'sha512' +``` + +### Features + +* Parses and stringifies SRI strings. +* Generates SRI strings from raw data or Streams. +* Strict standard compliance. +* `?foo` metadata option support. +* Multiple entries for the same algorithm. +* Object-based integrity hash manipulation. +* Small footprint: no dependencies, concise implementation. +* Full test coverage. +* Customizable algorithm picker. + +### Contributing + +The ssri 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. + +### API + +#### <a name="parse"></a> `> ssri.parse(sri, [opts]) -> Integrity` + +Parses `sri` into an `Integrity` data structure. `sri` can be an integrity +string, an `Hash`-like with `digest` and `algorithm` fields and an optional +`options` field, or an `Integrity`-like object. The resulting object will be an +`Integrity` instance that has this shape: + +```javascript +{ + 'sha1': [{algorithm: 'sha1', digest: 'deadbeef', options: []}], + 'sha512': [ + {algorithm: 'sha512', digest: 'c0ffee', options: []}, + {algorithm: 'sha512', digest: 'bad1dea', options: ['foo']} + ], +} +``` + +If `opts.single` is truthy, a single `Hash` object will be returned. That is, a +single object that looks like `{algorithm, digest, options}`, as opposed to a +larger object with multiple of these. + +If `opts.strict` is truthy, the resulting object will be filtered such that +it strictly follows the Subresource Integrity spec, throwing away any entries +with any invalid components. This also means a restricted set of algorithms +will be used -- the spec limits them to `sha256`, `sha384`, and `sha512`. + +Strict mode is recommended if the integrity strings are intended for use in +browsers, or in other situations where strict adherence to the spec is needed. + +##### Example + +```javascript +ssri.parse('sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo') // -> Integrity object +``` + +#### <a name="stringify"></a> `> ssri.stringify(sri, [opts]) -> String` + +This function is identical to [`Integrity#toString()`](#integrity-to-string), +except it can be used on _any_ object that [`parse`](#parse) can handle -- that +is, a string, an `Hash`-like, or an `Integrity`-like. + +The `opts.sep` option defines the string to use when joining multiple entries +together. To be spec-compliant, this _must_ be whitespace. The default is a +single space (`' '`). + +If `opts.strict` is true, the integrity string will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +// Useful for cleaning up input SRI strings: +ssri.stringify('\n\rsha512-foo\n\t\tsha384-bar') +// -> 'sha512-foo sha384-bar' + +// Hash-like: only a single entry. +ssri.stringify({ + algorithm: 'sha512', + digest:'9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==', + options: ['foo'] +}) +// -> +// 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' + +// Integrity-like: full multi-entry syntax. Similar to output of `ssri.parse` +ssri.stringify({ + 'sha512': [ + { + algorithm: 'sha512', + digest:'9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==', + options: ['foo'] + } + ] +}) +// -> +// 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' +``` + +#### <a name="integrity-concat"></a> `> Integrity#concat(otherIntegrity, [opts]) -> Integrity` + +Concatenates an `Integrity` object with another IntegrityLike, or an integrity +string. + +This is functionally equivalent to concatenating the string format of both +integrity arguments, and calling [`ssri.parse`](#ssri-parse) on the new string. + +If `opts.strict` is true, the new `Integrity` will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +// This will combine the integrity checks for two different versions of +// your index.js file so you can use a single integrity string and serve +// either of these to clients, from a single `<script>` tag. +const desktopIntegrity = ssri.fromData(fs.readFileSync('./index.desktop.js')) +const mobileIntegrity = ssri.fromData(fs.readFileSync('./index.mobile.js')) + +// Note that browsers (and ssri) will succeed as long as ONE of the entries +// for the *prioritized* algorithm succeeds. That is, in order for this fallback +// to work, both desktop and mobile *must* use the same `algorithm` values. +desktopIntegrity.concat(mobileIntegrity) +``` + +#### <a name="integrity-to-string"></a> `> Integrity#toString([opts]) -> String` + +Returns the string representation of an `Integrity` object. All hash entries +will be concatenated in the string by `opts.sep`, which defaults to `' '`. + +If you want to serialize an object that didn't from from an `ssri` function, +use [`ssri.stringify()`](#stringify). + +If `opts.strict` is true, the integrity string will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +const integrity = 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' + +ssri.parse(integrity).toString() === integrity +``` + +#### <a name="integrity-to-json"></a> `> Integrity#toJSON() -> String` + +Returns the string representation of an `Integrity` object. All hash entries +will be concatenated in the string by `' '`. + +This is a convenience method so you can pass an `Integrity` object directly to `JSON.stringify`. +For more info check out [toJSON() behavior on mdn](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON%28%29_behavior). + +##### Example + +```javascript +const integrity = '"sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo"' + +JSON.stringify(ssri.parse(integrity)) === integrity +``` + +#### <a name="integrity-pick-algorithm"></a> `> Integrity#pickAlgorithm([opts]) -> String` + +Returns the "best" algorithm from those available in the integrity object. + +If `opts.pickAlgorithm` is provided, it will be passed two algorithms as +arguments. ssri will prioritize whichever of the two algorithms is returned by +this function. Note that the function may be called multiple times, and it +**must** return one of the two algorithms provided. By default, ssri will make +a best-effort to pick the strongest/most reliable of the given algorithms. It +may intentionally deprioritize algorithms with known vulnerabilities. + +##### Example + +```javascript +ssri.parse('sha1-WEakDigEST sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1').pickAlgorithm() // sha512 +``` + +#### <a name="integrity-hex-digest"></a> `> Integrity#hexDigest() -> String` + +`Integrity` is assumed to be either a single-hash `Integrity` instance, or a +`Hash` instance. Returns its `digest`, converted to a hex representation of the +base64 data. + +##### Example + +```javascript +ssri.parse('sha1-deadbeef').hexDigest() // '75e69d6de79f' +``` + +#### <a name="from-hex"></a> `> ssri.fromHex(hexDigest, algorithm, [opts]) -> Integrity` + +Creates an `Integrity` object with a single entry, based on a hex-formatted +hash. This is a utility function to help convert existing shasums to the +Integrity format, and is roughly equivalent to something like: + +```javascript +algorithm + '-' + Buffer.from(hexDigest, 'hex').toString('base64') +``` + +`opts.options` may optionally be passed in: it must be an array of option +strings that will be added to all generated integrity hashes generated by +`fromData`. This is a loosely-specified feature of SRIs, and currently has no +specified semantics besides being `?`-separated. Use at your own risk, and +probably avoid if your integrity strings are meant to be used with browsers. + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +If `opts.single` is true, a single `Hash` object will be returned. + +##### Example + +```javascript +ssri.fromHex('75e69d6de79f', 'sha1').toString() // 'sha1-deadbeef' +``` + +#### <a name="from-data"></a> `> ssri.fromData(data, [opts]) -> Integrity` + +Creates an `Integrity` object from either string or `Buffer` data, calculating +all the requested hashes and adding any specified options to the object. + +`opts.algorithms` determines which algorithms to generate hashes for. All +results will be included in a single `Integrity` object. The default value for +`opts.algorithms` is `['sha512']`. All algorithm strings must be hashes listed +in `crypto.getHashes()` for the host Node.js platform. + +`opts.options` may optionally be passed in: it must be an array of option +strings that will be added to all generated integrity hashes generated by +`fromData`. This is a loosely-specified feature of SRIs, and currently has no +specified semantics besides being `?`-separated. Use at your own risk, and +probably avoid if your integrity strings are meant to be used with browsers. + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +const integrityObj = ssri.fromData('foobarbaz', { + algorithms: ['sha256', 'sha384', 'sha512'] +}) +integrity.toString('\n') +// -> +// sha256-l981iLWj8kurw4UbNy8Lpxqdzd7UOxS50Glhv8FwfZ0= +// sha384-irnCxQ0CfQhYGlVAUdwTPC9bF3+YWLxlaDGM4xbYminxpbXEq+D+2GCEBTxcjES9 +// sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1+9vBnypkYWg== +``` + +#### <a name="from-stream"></a> `> ssri.fromStream(stream, [opts]) -> Promise<Integrity>` + +Returns a Promise of an Integrity object calculated by reading data from +a given `stream`. + +It accepts both `opts.algorithms` and `opts.options`, which are documented as +part of [`ssri.fromData`](#from-data). + +Additionally, `opts.Promise` may be passed in to inject a Promise library of +choice. By default, ssri will use Node's built-in Promises. + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +ssri.fromStream(fs.createReadStream('index.js'), { + algorithms: ['sha1', 'sha512'] +}).then(integrity => { + return ssri.checkStream(fs.createReadStream('index.js'), integrity) +}) // succeeds +``` + +#### <a name="create"></a> `> ssri.create([opts]) -> <Hash>` + +Returns a Hash object with `update(<Buffer or string>[,enc])` and `digest()` methods. + + +The Hash object provides the same methods as [crypto class Hash](https://nodejs.org/dist/latest-v6.x/docs/api/crypto.html#crypto_class_hash). +`digest()` accepts no arguments and returns an Integrity object calculated by reading data from +calls to update. + +It accepts both `opts.algorithms` and `opts.options`, which are documented as +part of [`ssri.fromData`](#from-data). + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +const integrity = ssri.create().update('foobarbaz').digest() +integrity.toString() +// -> +// sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1+9vBnypkYWg== +``` + +#### <a name="check-data"></a> `> ssri.checkData(data, sri, [opts]) -> Hash|false` + +Verifies `data` integrity against an `sri` argument. `data` may be either a +`String` or a `Buffer`, and `sri` can be any subresource integrity +representation that [`ssri.parse`](#parse) can handle. + +If verification succeeds, `checkData` will return the name of the algorithm that +was used for verification (a truthy value). Otherwise, it will return `false`. + +If `opts.pickAlgorithm` is provided, it will be used by +[`Integrity#pickAlgorithm`](#integrity-pick-algorithm) when deciding which of +the available digests to match against. + +##### Example + +```javascript +const data = fs.readFileSync('index.js') +ssri.checkData(data, ssri.fromData(data)) // -> 'sha512' +ssri.checkData(data, 'sha256-l981iLWj8kurw4UbNy8Lpxqdzd7UOxS50Glhv8FwfZ0') +ssri.checkData(data, 'sha1-BaDDigEST') // -> false +``` + +#### <a name="check-stream"></a> `> ssri.checkStream(stream, sri, [opts]) -> Promise<Hash>` + +Verifies the contents of `stream` against an `sri` argument. `stream` will be +consumed in its entirety by this process. `sri` can be any subresource integrity +representation that [`ssri.parse`](#parse) can handle. + +`checkStream` will return a Promise that either resolves to the +`Hash` that succeeded verification, or, if the verification fails +or an error happens with `stream`, the Promise will be rejected. + +If the Promise is rejected because verification failed, the returned error will +have `err.code` as `EINTEGRITY`. + +If `opts.size` is given, it will be matched against the stream size. An error +with `err.code` `EBADSIZE` will be returned by a rejection if the expected size +and actual size fail to match. + +If `opts.pickAlgorithm` is provided, it will be used by +[`Integrity#pickAlgorithm`](#integrity-pick-algorithm) when deciding which of +the available digests to match against. + +##### Example + +```javascript +const integrity = ssri.fromData(fs.readFileSync('index.js')) + +ssri.checkStream( + fs.createReadStream('index.js'), + integrity +) +// -> +// Promise<{ +// algorithm: 'sha512', +// digest: 'sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1' +// }> + +ssri.checkStream( + fs.createReadStream('index.js'), + 'sha256-l981iLWj8kurw4UbNy8Lpxqdzd7UOxS50Glhv8FwfZ0' +) // -> Promise<Hash> + +ssri.checkStream( + fs.createReadStream('index.js'), + 'sha1-BaDDigEST' +) // -> Promise<Error<{code: 'EINTEGRITY'}>> +``` + +#### <a name="integrity-stream"></a> `> integrityStream(sri, [opts]) -> IntegrityStream` + +Returns a `Transform` stream that data can be piped through in order to generate +and optionally check data integrity for piped data. When the stream completes +successfully, it emits `size` and `integrity` events, containing the total +number of bytes processed and a calculated `Integrity` instance based on stream +data, respectively. + +If `opts.algorithms` is passed in, the listed algorithms will be calculated when +generating the final `Integrity` instance. The default is `['sha512']`. + +If `opts.single` is passed in, a single `Hash` instance will be returned. + +If `opts.integrity` is passed in, it should be an `integrity` value understood +by [`parse`](#parse) that the stream will check the data against. If +verification succeeds, the integrity stream will emit a `verified` event whose +value is a single `Hash` object that is the one that succeeded verification. If +verification fails, the stream will error with an `EINTEGRITY` error code. + +If `opts.size` is given, it will be matched against the stream size. An error +with `err.code` `EBADSIZE` will be emitted by the stream if the expected size +and actual size fail to match. + +If `opts.pickAlgorithm` is provided, it will be passed two algorithms as +arguments. ssri will prioritize whichever of the two algorithms is returned by +this function. Note that the function may be called multiple times, and it +**must** return one of the two algorithms provided. By default, ssri will make +a best-effort to pick the strongest/most reliable of the given algorithms. It +may intentionally deprioritize algorithms with known vulnerabilities. + +##### Example + +```javascript +const integrity = ssri.fromData(fs.readFileSync('index.js')) +fs.createReadStream('index.js') +.pipe(ssri.checkStream(integrity)) +``` diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/index.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/index.js new file mode 100644 index 00000000000..8ece662ba65 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/index.js @@ -0,0 +1,334 @@ +'use strict' + +const Buffer = require('safe-buffer').Buffer + +const crypto = require('crypto') +const Transform = require('stream').Transform + +const SPEC_ALGORITHMS = ['sha256', 'sha384', 'sha512'] + +const BASE64_REGEX = /^[a-z0-9+/]+(?:=?=?)$/i +const SRI_REGEX = /^([^-]+)-([^?]+)([?\S*]*)$/ +const STRICT_SRI_REGEX = /^([^-]+)-([A-Za-z0-9+/]+(?:=?=?))([?\x21-\x7E]*)$/ +const VCHAR_REGEX = /^[\x21-\x7E]+$/ + +class Hash { + get isHash () { return true } + constructor (hash, opts) { + const strict = !!(opts && opts.strict) + this.source = hash.trim() + // 3.1. Integrity metadata (called "Hash" by ssri) + // https://w3c.github.io/webappsec-subresource-integrity/#integrity-metadata-description + const match = this.source.match( + strict + ? STRICT_SRI_REGEX + : SRI_REGEX + ) + if (!match) { return } + if (strict && !SPEC_ALGORITHMS.some(a => a === match[1])) { return } + this.algorithm = match[1] + this.digest = match[2] + + const rawOpts = match[3] + this.options = rawOpts ? rawOpts.slice(1).split('?') : [] + } + hexDigest () { + return this.digest && Buffer.from(this.digest, 'base64').toString('hex') + } + toJSON () { + return this.toString() + } + toString (opts) { + if (opts && opts.strict) { + // Strict mode enforces the standard as close to the foot of the + // letter as it can. + if (!( + // The spec has very restricted productions for algorithms. + // https://www.w3.org/TR/CSP2/#source-list-syntax + SPEC_ALGORITHMS.some(x => x === this.algorithm) && + // Usually, if someone insists on using a "different" base64, we + // leave it as-is, since there's multiple standards, and the + // specified is not a URL-safe variant. + // https://www.w3.org/TR/CSP2/#base64_value + this.digest.match(BASE64_REGEX) && + // Option syntax is strictly visual chars. + // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-option-expression + // https://tools.ietf.org/html/rfc5234#appendix-B.1 + (this.options || []).every(opt => opt.match(VCHAR_REGEX)) + )) { + return '' + } + } + const options = this.options && this.options.length + ? `?${this.options.join('?')}` + : '' + return `${this.algorithm}-${this.digest}${options}` + } +} + +class Integrity { + get isIntegrity () { return true } + toJSON () { + return this.toString() + } + toString (opts) { + opts = opts || {} + let sep = opts.sep || ' ' + if (opts.strict) { + // Entries must be separated by whitespace, according to spec. + sep = sep.replace(/\S+/g, ' ') + } + return Object.keys(this).map(k => { + return this[k].map(hash => { + return Hash.prototype.toString.call(hash, opts) + }).filter(x => x.length).join(sep) + }).filter(x => x.length).join(sep) + } + concat (integrity, opts) { + const other = typeof integrity === 'string' + ? integrity + : stringify(integrity, opts) + return parse(`${this.toString(opts)} ${other}`, opts) + } + hexDigest () { + return parse(this, {single: true}).hexDigest() + } + pickAlgorithm (opts) { + const pickAlgorithm = (opts && opts.pickAlgorithm) || getPrioritizedHash + const keys = Object.keys(this) + if (!keys.length) { + throw new Error(`No algorithms available for ${ + JSON.stringify(this.toString()) + }`) + } + return keys.reduce((acc, algo) => { + return pickAlgorithm(acc, algo) || acc + }) + } +} + +module.exports.parse = parse +function parse (sri, opts) { + opts = opts || {} + if (typeof sri === 'string') { + return _parse(sri, opts) + } else if (sri.algorithm && sri.digest) { + const fullSri = new Integrity() + fullSri[sri.algorithm] = [sri] + return _parse(stringify(fullSri, opts), opts) + } else { + return _parse(stringify(sri, opts), opts) + } +} + +function _parse (integrity, opts) { + // 3.4.3. Parse metadata + // https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata + if (opts.single) { + return new Hash(integrity, opts) + } + return integrity.trim().split(/\s+/).reduce((acc, string) => { + const hash = new Hash(string, opts) + if (hash.algorithm && hash.digest) { + const algo = hash.algorithm + if (!acc[algo]) { acc[algo] = [] } + acc[algo].push(hash) + } + return acc + }, new Integrity()) +} + +module.exports.stringify = stringify +function stringify (obj, opts) { + if (obj.algorithm && obj.digest) { + return Hash.prototype.toString.call(obj, opts) + } else if (typeof obj === 'string') { + return stringify(parse(obj, opts), opts) + } else { + return Integrity.prototype.toString.call(obj, opts) + } +} + +module.exports.fromHex = fromHex +function fromHex (hexDigest, algorithm, opts) { + const optString = (opts && opts.options && opts.options.length) + ? `?${opts.options.join('?')}` + : '' + return parse( + `${algorithm}-${ + Buffer.from(hexDigest, 'hex').toString('base64') + }${optString}`, opts + ) +} + +module.exports.fromData = fromData +function fromData (data, opts) { + opts = opts || {} + const algorithms = opts.algorithms || ['sha512'] + const optString = opts.options && opts.options.length + ? `?${opts.options.join('?')}` + : '' + return algorithms.reduce((acc, algo) => { + const digest = crypto.createHash(algo).update(data).digest('base64') + const hash = new Hash( + `${algo}-${digest}${optString}`, + opts + ) + if (hash.algorithm && hash.digest) { + const algo = hash.algorithm + if (!acc[algo]) { acc[algo] = [] } + acc[algo].push(hash) + } + return acc + }, new Integrity()) +} + +module.exports.fromStream = fromStream +function fromStream (stream, opts) { + opts = opts || {} + const P = opts.Promise || Promise + const istream = integrityStream(opts) + return new P((resolve, reject) => { + stream.pipe(istream) + stream.on('error', reject) + istream.on('error', reject) + let sri + istream.on('integrity', s => { sri = s }) + istream.on('end', () => resolve(sri)) + istream.on('data', () => {}) + }) +} + +module.exports.checkData = checkData +function checkData (data, sri, opts) { + opts = opts || {} + sri = parse(sri, opts) + if (!Object.keys(sri).length) { return false } + const algorithm = sri.pickAlgorithm(opts) + const digests = sri[algorithm] || [] + const digest = crypto.createHash(algorithm).update(data).digest('base64') + return digests.find(hash => hash.digest === digest) || false +} + +module.exports.checkStream = checkStream +function checkStream (stream, sri, opts) { + opts = opts || {} + const P = opts.Promise || Promise + const checker = integrityStream(Object.assign({}, opts, { + integrity: sri + })) + return new P((resolve, reject) => { + stream.pipe(checker) + stream.on('error', reject) + checker.on('error', reject) + let sri + checker.on('verified', s => { sri = s }) + checker.on('end', () => resolve(sri)) + checker.on('data', () => {}) + }) +} + +module.exports.integrityStream = integrityStream +function integrityStream (opts) { + opts = opts || {} + // For verification + const sri = opts.integrity && parse(opts.integrity, opts) + const goodSri = sri && Object.keys(sri).length + const algorithm = goodSri && sri.pickAlgorithm(opts) + const digests = goodSri && sri[algorithm] + // Calculating stream + const algorithms = opts.algorithms || [algorithm || 'sha512'] + const hashes = algorithms.map(crypto.createHash) + let streamSize = 0 + const stream = new Transform({ + transform (chunk, enc, cb) { + streamSize += chunk.length + hashes.forEach(h => h.update(chunk, enc)) + cb(null, chunk, enc) + } + }).on('end', () => { + const optString = (opts.options && opts.options.length) + ? `?${opts.options.join('?')}` + : '' + const newSri = parse(hashes.map((h, i) => { + return `${algorithms[i]}-${h.digest('base64')}${optString}` + }).join(' '), opts) + const match = ( + // Integrity verification mode + opts.integrity && + newSri[algorithm] && + digests && + digests.find(hash => { + return newSri[algorithm].find(newhash => { + return hash.digest === newhash.digest + }) + }) + ) + if (typeof opts.size === 'number' && streamSize !== opts.size) { + const err = new Error(`stream size mismatch when checking ${sri}.\n Wanted: ${opts.size}\n Found: ${streamSize}`) + err.code = 'EBADSIZE' + err.found = streamSize + err.expected = opts.size + err.sri = sri + stream.emit('error', err) + } else if (opts.integrity && !match) { + const err = new Error(`${sri} integrity checksum failed when using ${algorithm}: wanted ${digests} but got ${newSri}. (${streamSize} bytes)`) + err.code = 'EINTEGRITY' + err.found = newSri + err.expected = digests + err.algorithm = algorithm + err.sri = sri + stream.emit('error', err) + } else { + stream.emit('size', streamSize) + stream.emit('integrity', newSri) + match && stream.emit('verified', match) + } + }) + return stream +} + +module.exports.create = createIntegrity +function createIntegrity (opts) { + opts = opts || {} + const algorithms = opts.algorithms || ['sha512'] + const optString = opts.options && opts.options.length + ? `?${opts.options.join('?')}` + : '' + + const hashes = algorithms.map(crypto.createHash) + + return { + update: function (chunk, enc) { + hashes.forEach(h => h.update(chunk, enc)) + return this + }, + digest: function (enc) { + const integrity = algorithms.reduce((acc, algo) => { + const digest = hashes.shift().digest('base64') + const hash = new Hash( + `${algo}-${digest}${optString}`, + opts + ) + if (hash.algorithm && hash.digest) { + const algo = hash.algorithm + if (!acc[algo]) { acc[algo] = [] } + acc[algo].push(hash) + } + return acc + }, new Integrity()) + + return integrity + } + } +} + +// This is a Best Effort™ at a reasonable priority for hash algos +const DEFAULT_PRIORITY = [ + 'md5', 'whirlpool', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512' +] +function getPrioritizedHash (algo1, algo2) { + return DEFAULT_PRIORITY.indexOf(algo1.toLowerCase()) >= DEFAULT_PRIORITY.indexOf(algo2.toLowerCase()) + ? algo1 + : algo2 +} diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/package.json b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/package.json new file mode 100644 index 00000000000..8bc38753dc8 --- /dev/null +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/ssri/package.json @@ -0,0 +1,90 @@ +{ + "_from": "ssri@^4.1.6", + "_id": "ssri@4.1.6", + "_inBundle": false, + "_integrity": "sha512-WUbCdgSAMQjTFZRWvSPpauryvREEA+Krn19rx67UlJEJx/M192ZHxMmJXjZ4tkdFm+Sb0SXGlENeQVlA5wY7kA==", + "_location": "/npm-profile/make-fetch-happen/ssri", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ssri@^4.1.6", + "name": "ssri", + "escapedName": "ssri", + "rawSpec": "^4.1.6", + "saveSpec": null, + "fetchSpec": "^4.1.6" + }, + "_requiredBy": [ + "/npm-profile/make-fetch-happen", + "/npm-profile/make-fetch-happen/cacache" + ], + "_resolved": "https://registry.npmjs.org/ssri/-/ssri-4.1.6.tgz", + "_shasum": "0cb49b6ac84457e7bdd466cb730c3cb623e9a25b", + "_spec": "ssri@^4.1.6", + "_where": "/Users/zkat/Documents/code/npm/node_modules/npm-profile/node_modules/make-fetch-happen", + "author": { + "name": "Kat Marchán", + "email": "kzm@sykosomatic.org" + }, + "bugs": { + "url": "https://github.com/zkat/ssri/issues" + }, + "bundleDependencies": false, + "config": { + "nyc": { + "exclude": [ + "node_modules/**", + "test/**" + ] + } + }, + "dependencies": { + "safe-buffer": "^5.1.0" + }, + "deprecated": false, + "description": "Standard Subresource Integrity library -- parses, serializes, generates, and verifies integrity metadata according to the SRI spec.", + "devDependencies": { + "nyc": "^10.3.2", + "standard": "^9.0.2", + "standard-version": "^4.1.0", + "tap": "^10.3.3", + "weallbehave": "^1.2.0", + "weallcontribute": "^1.0.8" + }, + "files": [ + "*.js" + ], + "homepage": "https://github.com/zkat/ssri#readme", + "keywords": [ + "w3c", + "web", + "security", + "integrity", + "checksum", + "hashing", + "subresource integrity", + "sri", + "sri hash", + "sri string", + "sri generator", + "html" + ], + "license": "CC0-1.0", + "main": "index.js", + "name": "ssri", + "repository": { + "type": "git", + "url": "git+https://github.com/zkat/ssri.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": "4.1.6" +} diff --git a/deps/npm/node_modules/npm-profile/package.json b/deps/npm/node_modules/npm-profile/package.json index d0df6f801f2..e698111270c 100644 --- a/deps/npm/node_modules/npm-profile/package.json +++ b/deps/npm/node_modules/npm-profile/package.json @@ -1,8 +1,8 @@ { - "_from": "npm-profile@latest", - "_id": "npm-profile@2.0.4", + "_from": "npm-profile@2.0.5", + "_id": "npm-profile@2.0.5", "_inBundle": false, - "_integrity": "sha512-g8WTBuQDOXRuU46qyM1JcUMVhnvA74q77UY6eHb3CTpley2hySLxmNZh+fth+YoU7aYlvUOiCRNQXmSNiF66pw==", + "_integrity": "sha512-tLmpDUCV72f/1/oXoyb+VwsZjOlsanp34pZeIZS0mxDoQUOX4Ld1hgPeOqoX4XggE88m7W47DHET2v+qd6sihg==", "_location": "/npm-profile", "_phantomChildren": { "cacache": "9.2.9", @@ -13,23 +13,23 @@ "ssri": "4.1.6" }, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "npm-profile@latest", + "raw": "npm-profile@2.0.5", "name": "npm-profile", "escapedName": "npm-profile", - "rawSpec": "latest", + "rawSpec": "2.0.5", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "2.0.5" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/npm-profile/-/npm-profile-2.0.4.tgz", - "_shasum": "148070c0da22b512bf61a4a87758b957fdb4bbe7", - "_spec": "npm-profile@latest", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/npm-profile/-/npm-profile-2.0.5.tgz", + "_shasum": "0e61b8f1611bd19d1eeff5e3d5c82e557da3b9d7", + "_spec": "npm-profile@2.0.5", + "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Rebecca Turner", "email": "me@re-becca.org", @@ -57,5 +57,5 @@ "type": "git", "url": "git+https://github.com/npm/npm-profile.git" }, - "version": "2.0.4" + "version": "2.0.5" } diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/npm-package-arg/LICENSE b/deps/npm/node_modules/npm-registry-client/node_modules/npm-package-arg/LICENSE new file mode 100644 index 00000000000..05eeeb88c2e --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/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/npm-registry-client/node_modules/npm-package-arg/README.md b/deps/npm/node_modules/npm-registry-client/node_modules/npm-package-arg/README.md new file mode 100644 index 00000000000..d45032dc74a --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/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/npm-registry-client/node_modules/npm-package-arg/npa.js b/deps/npm/node_modules/npm-registry-client/node_modules/npm-package-arg/npa.js new file mode 100644 index 00000000000..a61c0574298 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/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/npm-registry-client/node_modules/npm-package-arg/package.json b/deps/npm/node_modules/npm-registry-client/node_modules/npm-package-arg/package.json new file mode 100644 index 00000000000..75f30d12582 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/npm-package-arg/package.json @@ -0,0 +1,64 @@ +{ + "_from": "npm-package-arg@^3.0.0 || ^4.0.0 || ^5.0.0", + "_id": "npm-package-arg@5.1.2", + "_inBundle": false, + "_integrity": "sha512-wJBsrf0qpypPT7A0LART18hCdyhpCMxeTtcb0X4IZO2jsP6Om7EHN1d9KSKiqD+KVH030RVNpWS9thk+pb7wzA==", + "_location": "/npm-registry-client/npm-package-arg", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "npm-package-arg@^3.0.0 || ^4.0.0 || ^5.0.0", + "name": "npm-package-arg", + "escapedName": "npm-package-arg", + "rawSpec": "^3.0.0 || ^4.0.0 || ^5.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0 || ^4.0.0 || ^5.0.0" + }, + "_requiredBy": [ + "/npm-registry-client" + ], + "_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-5.1.2.tgz", + "_shasum": "fb18d17bb61e60900d6312619919bd753755ab37", + "_spec": "npm-package-arg@^3.0.0 || ^4.0.0 || ^5.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/npm-registry-client", + "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/npm-registry-client/node_modules/ssri/CHANGELOG.md b/deps/npm/node_modules/npm-registry-client/node_modules/ssri/CHANGELOG.md new file mode 100644 index 00000000000..c1136092e33 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/ssri/CHANGELOG.md @@ -0,0 +1,175 @@ +# 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.1.6"></a> +## [4.1.6](https://github.com/zkat/ssri/compare/v4.1.5...v4.1.6) (2017-06-07) + + +### Bug Fixes + +* **checkStream:** make sure to pass all opts through ([0b1bcbe](https://github.com/zkat/ssri/commit/0b1bcbe)) + + + +<a name="4.1.5"></a> +## [4.1.5](https://github.com/zkat/ssri/compare/v4.1.4...v4.1.5) (2017-06-05) + + +### Bug Fixes + +* **integrityStream:** stop crashing if opts.algorithms and opts.integrity have an algo mismatch ([fb1293e](https://github.com/zkat/ssri/commit/fb1293e)) + + + +<a name="4.1.4"></a> +## [4.1.4](https://github.com/zkat/ssri/compare/v4.1.3...v4.1.4) (2017-05-31) + + +### Bug Fixes + +* **node:** older versions of node[@4](https://github.com/4) do not support base64buffer string parsing ([513df4e](https://github.com/zkat/ssri/commit/513df4e)) + + + +<a name="4.1.3"></a> +## [4.1.3](https://github.com/zkat/ssri/compare/v4.1.2...v4.1.3) (2017-05-24) + + +### Bug Fixes + +* **check:** handle various bad hash corner cases better ([c2c262b](https://github.com/zkat/ssri/commit/c2c262b)) + + + +<a name="4.1.2"></a> +## [4.1.2](https://github.com/zkat/ssri/compare/v4.1.1...v4.1.2) (2017-04-18) + + +### Bug Fixes + +* **stream:** _flush can be called multiple times. use on("end") ([b1c4805](https://github.com/zkat/ssri/commit/b1c4805)) + + + +<a name="4.1.1"></a> +## [4.1.1](https://github.com/zkat/ssri/compare/v4.1.0...v4.1.1) (2017-04-12) + + +### Bug Fixes + +* **pickAlgorithm:** error if pickAlgorithm() is used in an empty Integrity ([fab470e](https://github.com/zkat/ssri/commit/fab470e)) + + + +<a name="4.1.0"></a> +# [4.1.0](https://github.com/zkat/ssri/compare/v4.0.0...v4.1.0) (2017-04-07) + + +### Features + +* adding ssri.create for a crypto style interface (#2) ([96f52ad](https://github.com/zkat/ssri/commit/96f52ad)) + + + +<a name="4.0.0"></a> +# [4.0.0](https://github.com/zkat/ssri/compare/v3.0.2...v4.0.0) (2017-04-03) + + +### Bug Fixes + +* **integrity:** should have changed the error code before. oops ([8381afa](https://github.com/zkat/ssri/commit/8381afa)) + + +### BREAKING CHANGES + +* **integrity:** EBADCHECKSUM -> EINTEGRITY for verification errors + + + +<a name="3.0.2"></a> +## [3.0.2](https://github.com/zkat/ssri/compare/v3.0.1...v3.0.2) (2017-04-03) + + + +<a name="3.0.1"></a> +## [3.0.1](https://github.com/zkat/ssri/compare/v3.0.0...v3.0.1) (2017-04-03) + + +### Bug Fixes + +* **package.json:** really should have these in the keywords because search ([a6ac6d0](https://github.com/zkat/ssri/commit/a6ac6d0)) + + + +<a name="3.0.0"></a> +# [3.0.0](https://github.com/zkat/ssri/compare/v2.0.0...v3.0.0) (2017-04-03) + + +### Bug Fixes + +* **hashes:** IntegrityMetadata -> Hash ([d04aa1f](https://github.com/zkat/ssri/commit/d04aa1f)) + + +### Features + +* **check:** return IntegrityMetadata on check success ([2301e74](https://github.com/zkat/ssri/commit/2301e74)) +* **fromHex:** ssri.fromHex to make it easier to generate them from hex valus ([049b89e](https://github.com/zkat/ssri/commit/049b89e)) +* **hex:** utility function for getting hex version of digest ([a9f021c](https://github.com/zkat/ssri/commit/a9f021c)) +* **hexDigest:** added hexDigest method to Integrity objects too ([85208ba](https://github.com/zkat/ssri/commit/85208ba)) +* **integrity:** add .isIntegrity and .isIntegrityMetadata ([1b29e6f](https://github.com/zkat/ssri/commit/1b29e6f)) +* **integrityStream:** new stream that can both generate and check streamed data ([fd23e1b](https://github.com/zkat/ssri/commit/fd23e1b)) +* **parse:** allow parsing straight into a single IntegrityMetadata object ([c8ddf48](https://github.com/zkat/ssri/commit/c8ddf48)) +* **pickAlgorithm:** Intergrity#pickAlgorithm() added ([b97a796](https://github.com/zkat/ssri/commit/b97a796)) +* **size:** calculate and update stream sizes ([02ed1ad](https://github.com/zkat/ssri/commit/02ed1ad)) + + +### BREAKING CHANGES + +* **hashes:** `.isIntegrityMetadata` is now `.isHash`. Also, any references to `IntegrityMetadata` now refer to `Hash`. +* **integrityStream:** createCheckerStream has been removed and replaced with a general-purpose integrityStream. + +To convert existing createCheckerStream code, move the `sri` argument into `opts.integrity` in integrityStream. All other options should be the same. +* **check:** `checkData`, `checkStream`, and `createCheckerStream` now yield a whole IntegrityMetadata instance representing the first successful hash match. + + + +<a name="2.0.0"></a> +# [2.0.0](https://github.com/zkat/ssri/compare/v1.0.0...v2.0.0) (2017-03-24) + + +### Bug Fixes + +* **strict-mode:** make regexes more rigid ([122a32c](https://github.com/zkat/ssri/commit/122a32c)) + + +### Features + +* **api:** added serialize alias for unparse ([999b421](https://github.com/zkat/ssri/commit/999b421)) +* **concat:** add Integrity#concat() ([cae12c7](https://github.com/zkat/ssri/commit/cae12c7)) +* **pickAlgo:** pick the strongest algorithm provided, by default ([58c18f7](https://github.com/zkat/ssri/commit/58c18f7)) +* **strict-mode:** strict SRI support ([3f0b64c](https://github.com/zkat/ssri/commit/3f0b64c)) +* **stringify:** replaced unparse/serialize with stringify ([4acad30](https://github.com/zkat/ssri/commit/4acad30)) +* **verification:** add opts.pickAlgorithm ([f72e658](https://github.com/zkat/ssri/commit/f72e658)) + + +### BREAKING CHANGES + +* **pickAlgo:** ssri will prioritize specific hashes now +* **stringify:** serialize and unparse have been removed. Use ssri.stringify instead. +* **strict-mode:** functions that accepted an optional `sep` argument now expect `opts.sep`. + + + +<a name="1.0.0"></a> +# 1.0.0 (2017-03-23) + + +### Features + +* **api:** implemented initial api ([4fbb16b](https://github.com/zkat/ssri/commit/4fbb16b)) + + +### BREAKING CHANGES + +* **api:** Initial API established. diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/ssri/LICENSE.md b/deps/npm/node_modules/npm-registry-client/node_modules/ssri/LICENSE.md new file mode 100644 index 00000000000..c05cb09586f --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/ssri/LICENSE.md @@ -0,0 +1,3 @@ +To the extent possible under law, maintainers for this project have waived all copyright and related or neighboring rights to this project. + +For more information on this waiver, see: https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/ssri/README.md b/deps/npm/node_modules/npm-registry-client/node_modules/ssri/README.md new file mode 100644 index 00000000000..f2fc035da52 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/ssri/README.md @@ -0,0 +1,462 @@ +# ssri [![npm version](https://img.shields.io/npm/v/ssri.svg)](https://npm.im/ssri) [![license](https://img.shields.io/npm/l/ssri.svg)](https://npm.im/ssri) [![Travis](https://img.shields.io/travis/zkat/ssri.svg)](https://travis-ci.org/zkat/ssri) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/ssri?svg=true)](https://ci.appveyor.com/project/zkat/ssri) [![Coverage Status](https://coveralls.io/repos/github/zkat/ssri/badge.svg?branch=latest)](https://coveralls.io/github/zkat/ssri?branch=latest) + +[`ssri`](https://github.com/zkat/ssri), short for Standard Subresource +Integrity, is a Node.js utility for parsing, manipulating, serializing, +generating, and verifying [Subresource +Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) hashes. + +## Install + +`$ npm install --save ssri` + +## Table of Contents + +* [Example](#example) +* [Features](#features) +* [Contributing](#contributing) +* [API](#api) + * Parsing & Serializing + * [`parse`](#parse) + * [`stringify`](#stringify) + * [`Integrity#concat`](#integrity-concat) + * [`Integrity#toString`](#integrity-to-string) + * [`Integrity#toJSON`](#integrity-to-json) + * [`Integrity#pickAlgorithm`](#integrity-pick-algorithm) + * [`Integrity#hexDigest`](#integrity-hex-digest) + * Integrity Generation + * [`fromHex`](#from-hex) + * [`fromData`](#from-data) + * [`fromStream`](#from-stream) + * [`create`](#create) + * Integrity Verification + * [`checkData`](#check-data) + * [`checkStream`](#check-stream) + * [`integrityStream`](#integrity-stream) + +### Example + +```javascript +const ssri = require('ssri') + +const integrity = 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' + +// Parsing and serializing +const parsed = ssri.parse(integrity) +ssri.stringify(parsed) // === integrity (works on non-Integrity objects) +parsed.toString() // === integrity + +// Async stream functions +ssri.checkStream(fs.createReadStream('./my-file'), integrity).then(...) +ssri.fromStream(fs.createReadStream('./my-file')).then(sri => { + sri.toString() === integrity +}) +fs.createReadStream('./my-file').pipe(ssri.createCheckerStream(sri)) + +// Sync data functions +ssri.fromData(fs.readFileSync('./my-file')) // === parsed +ssri.checkData(fs.readFileSync('./my-file'), integrity) // => 'sha512' +``` + +### Features + +* Parses and stringifies SRI strings. +* Generates SRI strings from raw data or Streams. +* Strict standard compliance. +* `?foo` metadata option support. +* Multiple entries for the same algorithm. +* Object-based integrity hash manipulation. +* Small footprint: no dependencies, concise implementation. +* Full test coverage. +* Customizable algorithm picker. + +### Contributing + +The ssri 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. + +### API + +#### <a name="parse"></a> `> ssri.parse(sri, [opts]) -> Integrity` + +Parses `sri` into an `Integrity` data structure. `sri` can be an integrity +string, an `Hash`-like with `digest` and `algorithm` fields and an optional +`options` field, or an `Integrity`-like object. The resulting object will be an +`Integrity` instance that has this shape: + +```javascript +{ + 'sha1': [{algorithm: 'sha1', digest: 'deadbeef', options: []}], + 'sha512': [ + {algorithm: 'sha512', digest: 'c0ffee', options: []}, + {algorithm: 'sha512', digest: 'bad1dea', options: ['foo']} + ], +} +``` + +If `opts.single` is truthy, a single `Hash` object will be returned. That is, a +single object that looks like `{algorithm, digest, options}`, as opposed to a +larger object with multiple of these. + +If `opts.strict` is truthy, the resulting object will be filtered such that +it strictly follows the Subresource Integrity spec, throwing away any entries +with any invalid components. This also means a restricted set of algorithms +will be used -- the spec limits them to `sha256`, `sha384`, and `sha512`. + +Strict mode is recommended if the integrity strings are intended for use in +browsers, or in other situations where strict adherence to the spec is needed. + +##### Example + +```javascript +ssri.parse('sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo') // -> Integrity object +``` + +#### <a name="stringify"></a> `> ssri.stringify(sri, [opts]) -> String` + +This function is identical to [`Integrity#toString()`](#integrity-to-string), +except it can be used on _any_ object that [`parse`](#parse) can handle -- that +is, a string, an `Hash`-like, or an `Integrity`-like. + +The `opts.sep` option defines the string to use when joining multiple entries +together. To be spec-compliant, this _must_ be whitespace. The default is a +single space (`' '`). + +If `opts.strict` is true, the integrity string will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +// Useful for cleaning up input SRI strings: +ssri.stringify('\n\rsha512-foo\n\t\tsha384-bar') +// -> 'sha512-foo sha384-bar' + +// Hash-like: only a single entry. +ssri.stringify({ + algorithm: 'sha512', + digest:'9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==', + options: ['foo'] +}) +// -> +// 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' + +// Integrity-like: full multi-entry syntax. Similar to output of `ssri.parse` +ssri.stringify({ + 'sha512': [ + { + algorithm: 'sha512', + digest:'9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==', + options: ['foo'] + } + ] +}) +// -> +// 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' +``` + +#### <a name="integrity-concat"></a> `> Integrity#concat(otherIntegrity, [opts]) -> Integrity` + +Concatenates an `Integrity` object with another IntegrityLike, or an integrity +string. + +This is functionally equivalent to concatenating the string format of both +integrity arguments, and calling [`ssri.parse`](#ssri-parse) on the new string. + +If `opts.strict` is true, the new `Integrity` will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +// This will combine the integrity checks for two different versions of +// your index.js file so you can use a single integrity string and serve +// either of these to clients, from a single `<script>` tag. +const desktopIntegrity = ssri.fromData(fs.readFileSync('./index.desktop.js')) +const mobileIntegrity = ssri.fromData(fs.readFileSync('./index.mobile.js')) + +// Note that browsers (and ssri) will succeed as long as ONE of the entries +// for the *prioritized* algorithm succeeds. That is, in order for this fallback +// to work, both desktop and mobile *must* use the same `algorithm` values. +desktopIntegrity.concat(mobileIntegrity) +``` + +#### <a name="integrity-to-string"></a> `> Integrity#toString([opts]) -> String` + +Returns the string representation of an `Integrity` object. All hash entries +will be concatenated in the string by `opts.sep`, which defaults to `' '`. + +If you want to serialize an object that didn't from from an `ssri` function, +use [`ssri.stringify()`](#stringify). + +If `opts.strict` is true, the integrity string will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +const integrity = 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' + +ssri.parse(integrity).toString() === integrity +``` + +#### <a name="integrity-to-json"></a> `> Integrity#toJSON() -> String` + +Returns the string representation of an `Integrity` object. All hash entries +will be concatenated in the string by `' '`. + +This is a convenience method so you can pass an `Integrity` object directly to `JSON.stringify`. +For more info check out [toJSON() behavior on mdn](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON%28%29_behavior). + +##### Example + +```javascript +const integrity = '"sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo"' + +JSON.stringify(ssri.parse(integrity)) === integrity +``` + +#### <a name="integrity-pick-algorithm"></a> `> Integrity#pickAlgorithm([opts]) -> String` + +Returns the "best" algorithm from those available in the integrity object. + +If `opts.pickAlgorithm` is provided, it will be passed two algorithms as +arguments. ssri will prioritize whichever of the two algorithms is returned by +this function. Note that the function may be called multiple times, and it +**must** return one of the two algorithms provided. By default, ssri will make +a best-effort to pick the strongest/most reliable of the given algorithms. It +may intentionally deprioritize algorithms with known vulnerabilities. + +##### Example + +```javascript +ssri.parse('sha1-WEakDigEST sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1').pickAlgorithm() // sha512 +``` + +#### <a name="integrity-hex-digest"></a> `> Integrity#hexDigest() -> String` + +`Integrity` is assumed to be either a single-hash `Integrity` instance, or a +`Hash` instance. Returns its `digest`, converted to a hex representation of the +base64 data. + +##### Example + +```javascript +ssri.parse('sha1-deadbeef').hexDigest() // '75e69d6de79f' +``` + +#### <a name="from-hex"></a> `> ssri.fromHex(hexDigest, algorithm, [opts]) -> Integrity` + +Creates an `Integrity` object with a single entry, based on a hex-formatted +hash. This is a utility function to help convert existing shasums to the +Integrity format, and is roughly equivalent to something like: + +```javascript +algorithm + '-' + Buffer.from(hexDigest, 'hex').toString('base64') +``` + +`opts.options` may optionally be passed in: it must be an array of option +strings that will be added to all generated integrity hashes generated by +`fromData`. This is a loosely-specified feature of SRIs, and currently has no +specified semantics besides being `?`-separated. Use at your own risk, and +probably avoid if your integrity strings are meant to be used with browsers. + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +If `opts.single` is true, a single `Hash` object will be returned. + +##### Example + +```javascript +ssri.fromHex('75e69d6de79f', 'sha1').toString() // 'sha1-deadbeef' +``` + +#### <a name="from-data"></a> `> ssri.fromData(data, [opts]) -> Integrity` + +Creates an `Integrity` object from either string or `Buffer` data, calculating +all the requested hashes and adding any specified options to the object. + +`opts.algorithms` determines which algorithms to generate hashes for. All +results will be included in a single `Integrity` object. The default value for +`opts.algorithms` is `['sha512']`. All algorithm strings must be hashes listed +in `crypto.getHashes()` for the host Node.js platform. + +`opts.options` may optionally be passed in: it must be an array of option +strings that will be added to all generated integrity hashes generated by +`fromData`. This is a loosely-specified feature of SRIs, and currently has no +specified semantics besides being `?`-separated. Use at your own risk, and +probably avoid if your integrity strings are meant to be used with browsers. + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +const integrityObj = ssri.fromData('foobarbaz', { + algorithms: ['sha256', 'sha384', 'sha512'] +}) +integrity.toString('\n') +// -> +// sha256-l981iLWj8kurw4UbNy8Lpxqdzd7UOxS50Glhv8FwfZ0= +// sha384-irnCxQ0CfQhYGlVAUdwTPC9bF3+YWLxlaDGM4xbYminxpbXEq+D+2GCEBTxcjES9 +// sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1+9vBnypkYWg== +``` + +#### <a name="from-stream"></a> `> ssri.fromStream(stream, [opts]) -> Promise<Integrity>` + +Returns a Promise of an Integrity object calculated by reading data from +a given `stream`. + +It accepts both `opts.algorithms` and `opts.options`, which are documented as +part of [`ssri.fromData`](#from-data). + +Additionally, `opts.Promise` may be passed in to inject a Promise library of +choice. By default, ssri will use Node's built-in Promises. + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +ssri.fromStream(fs.createReadStream('index.js'), { + algorithms: ['sha1', 'sha512'] +}).then(integrity => { + return ssri.checkStream(fs.createReadStream('index.js'), integrity) +}) // succeeds +``` + +#### <a name="create"></a> `> ssri.create([opts]) -> <Hash>` + +Returns a Hash object with `update(<Buffer or string>[,enc])` and `digest()` methods. + + +The Hash object provides the same methods as [crypto class Hash](https://nodejs.org/dist/latest-v6.x/docs/api/crypto.html#crypto_class_hash). +`digest()` accepts no arguments and returns an Integrity object calculated by reading data from +calls to update. + +It accepts both `opts.algorithms` and `opts.options`, which are documented as +part of [`ssri.fromData`](#from-data). + +If `opts.strict` is true, the integrity object will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +const integrity = ssri.create().update('foobarbaz').digest() +integrity.toString() +// -> +// sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1+9vBnypkYWg== +``` + +#### <a name="check-data"></a> `> ssri.checkData(data, sri, [opts]) -> Hash|false` + +Verifies `data` integrity against an `sri` argument. `data` may be either a +`String` or a `Buffer`, and `sri` can be any subresource integrity +representation that [`ssri.parse`](#parse) can handle. + +If verification succeeds, `checkData` will return the name of the algorithm that +was used for verification (a truthy value). Otherwise, it will return `false`. + +If `opts.pickAlgorithm` is provided, it will be used by +[`Integrity#pickAlgorithm`](#integrity-pick-algorithm) when deciding which of +the available digests to match against. + +##### Example + +```javascript +const data = fs.readFileSync('index.js') +ssri.checkData(data, ssri.fromData(data)) // -> 'sha512' +ssri.checkData(data, 'sha256-l981iLWj8kurw4UbNy8Lpxqdzd7UOxS50Glhv8FwfZ0') +ssri.checkData(data, 'sha1-BaDDigEST') // -> false +``` + +#### <a name="check-stream"></a> `> ssri.checkStream(stream, sri, [opts]) -> Promise<Hash>` + +Verifies the contents of `stream` against an `sri` argument. `stream` will be +consumed in its entirety by this process. `sri` can be any subresource integrity +representation that [`ssri.parse`](#parse) can handle. + +`checkStream` will return a Promise that either resolves to the +`Hash` that succeeded verification, or, if the verification fails +or an error happens with `stream`, the Promise will be rejected. + +If the Promise is rejected because verification failed, the returned error will +have `err.code` as `EINTEGRITY`. + +If `opts.size` is given, it will be matched against the stream size. An error +with `err.code` `EBADSIZE` will be returned by a rejection if the expected size +and actual size fail to match. + +If `opts.pickAlgorithm` is provided, it will be used by +[`Integrity#pickAlgorithm`](#integrity-pick-algorithm) when deciding which of +the available digests to match against. + +##### Example + +```javascript +const integrity = ssri.fromData(fs.readFileSync('index.js')) + +ssri.checkStream( + fs.createReadStream('index.js'), + integrity +) +// -> +// Promise<{ +// algorithm: 'sha512', +// digest: 'sha512-yzd8ELD1piyANiWnmdnpCL5F52f10UfUdEkHywVZeqTt0ymgrxR63Qz0GB7TKPoeeZQmWCaz7T1' +// }> + +ssri.checkStream( + fs.createReadStream('index.js'), + 'sha256-l981iLWj8kurw4UbNy8Lpxqdzd7UOxS50Glhv8FwfZ0' +) // -> Promise<Hash> + +ssri.checkStream( + fs.createReadStream('index.js'), + 'sha1-BaDDigEST' +) // -> Promise<Error<{code: 'EINTEGRITY'}>> +``` + +#### <a name="integrity-stream"></a> `> integrityStream(sri, [opts]) -> IntegrityStream` + +Returns a `Transform` stream that data can be piped through in order to generate +and optionally check data integrity for piped data. When the stream completes +successfully, it emits `size` and `integrity` events, containing the total +number of bytes processed and a calculated `Integrity` instance based on stream +data, respectively. + +If `opts.algorithms` is passed in, the listed algorithms will be calculated when +generating the final `Integrity` instance. The default is `['sha512']`. + +If `opts.single` is passed in, a single `Hash` instance will be returned. + +If `opts.integrity` is passed in, it should be an `integrity` value understood +by [`parse`](#parse) that the stream will check the data against. If +verification succeeds, the integrity stream will emit a `verified` event whose +value is a single `Hash` object that is the one that succeeded verification. If +verification fails, the stream will error with an `EINTEGRITY` error code. + +If `opts.size` is given, it will be matched against the stream size. An error +with `err.code` `EBADSIZE` will be emitted by the stream if the expected size +and actual size fail to match. + +If `opts.pickAlgorithm` is provided, it will be passed two algorithms as +arguments. ssri will prioritize whichever of the two algorithms is returned by +this function. Note that the function may be called multiple times, and it +**must** return one of the two algorithms provided. By default, ssri will make +a best-effort to pick the strongest/most reliable of the given algorithms. It +may intentionally deprioritize algorithms with known vulnerabilities. + +##### Example + +```javascript +const integrity = ssri.fromData(fs.readFileSync('index.js')) +fs.createReadStream('index.js') +.pipe(ssri.checkStream(integrity)) +``` diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/ssri/index.js b/deps/npm/node_modules/npm-registry-client/node_modules/ssri/index.js new file mode 100644 index 00000000000..8ece662ba65 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/ssri/index.js @@ -0,0 +1,334 @@ +'use strict' + +const Buffer = require('safe-buffer').Buffer + +const crypto = require('crypto') +const Transform = require('stream').Transform + +const SPEC_ALGORITHMS = ['sha256', 'sha384', 'sha512'] + +const BASE64_REGEX = /^[a-z0-9+/]+(?:=?=?)$/i +const SRI_REGEX = /^([^-]+)-([^?]+)([?\S*]*)$/ +const STRICT_SRI_REGEX = /^([^-]+)-([A-Za-z0-9+/]+(?:=?=?))([?\x21-\x7E]*)$/ +const VCHAR_REGEX = /^[\x21-\x7E]+$/ + +class Hash { + get isHash () { return true } + constructor (hash, opts) { + const strict = !!(opts && opts.strict) + this.source = hash.trim() + // 3.1. Integrity metadata (called "Hash" by ssri) + // https://w3c.github.io/webappsec-subresource-integrity/#integrity-metadata-description + const match = this.source.match( + strict + ? STRICT_SRI_REGEX + : SRI_REGEX + ) + if (!match) { return } + if (strict && !SPEC_ALGORITHMS.some(a => a === match[1])) { return } + this.algorithm = match[1] + this.digest = match[2] + + const rawOpts = match[3] + this.options = rawOpts ? rawOpts.slice(1).split('?') : [] + } + hexDigest () { + return this.digest && Buffer.from(this.digest, 'base64').toString('hex') + } + toJSON () { + return this.toString() + } + toString (opts) { + if (opts && opts.strict) { + // Strict mode enforces the standard as close to the foot of the + // letter as it can. + if (!( + // The spec has very restricted productions for algorithms. + // https://www.w3.org/TR/CSP2/#source-list-syntax + SPEC_ALGORITHMS.some(x => x === this.algorithm) && + // Usually, if someone insists on using a "different" base64, we + // leave it as-is, since there's multiple standards, and the + // specified is not a URL-safe variant. + // https://www.w3.org/TR/CSP2/#base64_value + this.digest.match(BASE64_REGEX) && + // Option syntax is strictly visual chars. + // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-option-expression + // https://tools.ietf.org/html/rfc5234#appendix-B.1 + (this.options || []).every(opt => opt.match(VCHAR_REGEX)) + )) { + return '' + } + } + const options = this.options && this.options.length + ? `?${this.options.join('?')}` + : '' + return `${this.algorithm}-${this.digest}${options}` + } +} + +class Integrity { + get isIntegrity () { return true } + toJSON () { + return this.toString() + } + toString (opts) { + opts = opts || {} + let sep = opts.sep || ' ' + if (opts.strict) { + // Entries must be separated by whitespace, according to spec. + sep = sep.replace(/\S+/g, ' ') + } + return Object.keys(this).map(k => { + return this[k].map(hash => { + return Hash.prototype.toString.call(hash, opts) + }).filter(x => x.length).join(sep) + }).filter(x => x.length).join(sep) + } + concat (integrity, opts) { + const other = typeof integrity === 'string' + ? integrity + : stringify(integrity, opts) + return parse(`${this.toString(opts)} ${other}`, opts) + } + hexDigest () { + return parse(this, {single: true}).hexDigest() + } + pickAlgorithm (opts) { + const pickAlgorithm = (opts && opts.pickAlgorithm) || getPrioritizedHash + const keys = Object.keys(this) + if (!keys.length) { + throw new Error(`No algorithms available for ${ + JSON.stringify(this.toString()) + }`) + } + return keys.reduce((acc, algo) => { + return pickAlgorithm(acc, algo) || acc + }) + } +} + +module.exports.parse = parse +function parse (sri, opts) { + opts = opts || {} + if (typeof sri === 'string') { + return _parse(sri, opts) + } else if (sri.algorithm && sri.digest) { + const fullSri = new Integrity() + fullSri[sri.algorithm] = [sri] + return _parse(stringify(fullSri, opts), opts) + } else { + return _parse(stringify(sri, opts), opts) + } +} + +function _parse (integrity, opts) { + // 3.4.3. Parse metadata + // https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata + if (opts.single) { + return new Hash(integrity, opts) + } + return integrity.trim().split(/\s+/).reduce((acc, string) => { + const hash = new Hash(string, opts) + if (hash.algorithm && hash.digest) { + const algo = hash.algorithm + if (!acc[algo]) { acc[algo] = [] } + acc[algo].push(hash) + } + return acc + }, new Integrity()) +} + +module.exports.stringify = stringify +function stringify (obj, opts) { + if (obj.algorithm && obj.digest) { + return Hash.prototype.toString.call(obj, opts) + } else if (typeof obj === 'string') { + return stringify(parse(obj, opts), opts) + } else { + return Integrity.prototype.toString.call(obj, opts) + } +} + +module.exports.fromHex = fromHex +function fromHex (hexDigest, algorithm, opts) { + const optString = (opts && opts.options && opts.options.length) + ? `?${opts.options.join('?')}` + : '' + return parse( + `${algorithm}-${ + Buffer.from(hexDigest, 'hex').toString('base64') + }${optString}`, opts + ) +} + +module.exports.fromData = fromData +function fromData (data, opts) { + opts = opts || {} + const algorithms = opts.algorithms || ['sha512'] + const optString = opts.options && opts.options.length + ? `?${opts.options.join('?')}` + : '' + return algorithms.reduce((acc, algo) => { + const digest = crypto.createHash(algo).update(data).digest('base64') + const hash = new Hash( + `${algo}-${digest}${optString}`, + opts + ) + if (hash.algorithm && hash.digest) { + const algo = hash.algorithm + if (!acc[algo]) { acc[algo] = [] } + acc[algo].push(hash) + } + return acc + }, new Integrity()) +} + +module.exports.fromStream = fromStream +function fromStream (stream, opts) { + opts = opts || {} + const P = opts.Promise || Promise + const istream = integrityStream(opts) + return new P((resolve, reject) => { + stream.pipe(istream) + stream.on('error', reject) + istream.on('error', reject) + let sri + istream.on('integrity', s => { sri = s }) + istream.on('end', () => resolve(sri)) + istream.on('data', () => {}) + }) +} + +module.exports.checkData = checkData +function checkData (data, sri, opts) { + opts = opts || {} + sri = parse(sri, opts) + if (!Object.keys(sri).length) { return false } + const algorithm = sri.pickAlgorithm(opts) + const digests = sri[algorithm] || [] + const digest = crypto.createHash(algorithm).update(data).digest('base64') + return digests.find(hash => hash.digest === digest) || false +} + +module.exports.checkStream = checkStream +function checkStream (stream, sri, opts) { + opts = opts || {} + const P = opts.Promise || Promise + const checker = integrityStream(Object.assign({}, opts, { + integrity: sri + })) + return new P((resolve, reject) => { + stream.pipe(checker) + stream.on('error', reject) + checker.on('error', reject) + let sri + checker.on('verified', s => { sri = s }) + checker.on('end', () => resolve(sri)) + checker.on('data', () => {}) + }) +} + +module.exports.integrityStream = integrityStream +function integrityStream (opts) { + opts = opts || {} + // For verification + const sri = opts.integrity && parse(opts.integrity, opts) + const goodSri = sri && Object.keys(sri).length + const algorithm = goodSri && sri.pickAlgorithm(opts) + const digests = goodSri && sri[algorithm] + // Calculating stream + const algorithms = opts.algorithms || [algorithm || 'sha512'] + const hashes = algorithms.map(crypto.createHash) + let streamSize = 0 + const stream = new Transform({ + transform (chunk, enc, cb) { + streamSize += chunk.length + hashes.forEach(h => h.update(chunk, enc)) + cb(null, chunk, enc) + } + }).on('end', () => { + const optString = (opts.options && opts.options.length) + ? `?${opts.options.join('?')}` + : '' + const newSri = parse(hashes.map((h, i) => { + return `${algorithms[i]}-${h.digest('base64')}${optString}` + }).join(' '), opts) + const match = ( + // Integrity verification mode + opts.integrity && + newSri[algorithm] && + digests && + digests.find(hash => { + return newSri[algorithm].find(newhash => { + return hash.digest === newhash.digest + }) + }) + ) + if (typeof opts.size === 'number' && streamSize !== opts.size) { + const err = new Error(`stream size mismatch when checking ${sri}.\n Wanted: ${opts.size}\n Found: ${streamSize}`) + err.code = 'EBADSIZE' + err.found = streamSize + err.expected = opts.size + err.sri = sri + stream.emit('error', err) + } else if (opts.integrity && !match) { + const err = new Error(`${sri} integrity checksum failed when using ${algorithm}: wanted ${digests} but got ${newSri}. (${streamSize} bytes)`) + err.code = 'EINTEGRITY' + err.found = newSri + err.expected = digests + err.algorithm = algorithm + err.sri = sri + stream.emit('error', err) + } else { + stream.emit('size', streamSize) + stream.emit('integrity', newSri) + match && stream.emit('verified', match) + } + }) + return stream +} + +module.exports.create = createIntegrity +function createIntegrity (opts) { + opts = opts || {} + const algorithms = opts.algorithms || ['sha512'] + const optString = opts.options && opts.options.length + ? `?${opts.options.join('?')}` + : '' + + const hashes = algorithms.map(crypto.createHash) + + return { + update: function (chunk, enc) { + hashes.forEach(h => h.update(chunk, enc)) + return this + }, + digest: function (enc) { + const integrity = algorithms.reduce((acc, algo) => { + const digest = hashes.shift().digest('base64') + const hash = new Hash( + `${algo}-${digest}${optString}`, + opts + ) + if (hash.algorithm && hash.digest) { + const algo = hash.algorithm + if (!acc[algo]) { acc[algo] = [] } + acc[algo].push(hash) + } + return acc + }, new Integrity()) + + return integrity + } + } +} + +// This is a Best Effort™ at a reasonable priority for hash algos +const DEFAULT_PRIORITY = [ + 'md5', 'whirlpool', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512' +] +function getPrioritizedHash (algo1, algo2) { + return DEFAULT_PRIORITY.indexOf(algo1.toLowerCase()) >= DEFAULT_PRIORITY.indexOf(algo2.toLowerCase()) + ? algo1 + : algo2 +} diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/ssri/package.json b/deps/npm/node_modules/npm-registry-client/node_modules/ssri/package.json new file mode 100644 index 00000000000..ad7949d03e0 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/ssri/package.json @@ -0,0 +1,89 @@ +{ + "_from": "ssri@^4.1.2", + "_id": "ssri@4.1.6", + "_inBundle": false, + "_integrity": "sha512-WUbCdgSAMQjTFZRWvSPpauryvREEA+Krn19rx67UlJEJx/M192ZHxMmJXjZ4tkdFm+Sb0SXGlENeQVlA5wY7kA==", + "_location": "/npm-registry-client/ssri", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ssri@^4.1.2", + "name": "ssri", + "escapedName": "ssri", + "rawSpec": "^4.1.2", + "saveSpec": null, + "fetchSpec": "^4.1.2" + }, + "_requiredBy": [ + "/npm-registry-client" + ], + "_resolved": "https://registry.npmjs.org/ssri/-/ssri-4.1.6.tgz", + "_shasum": "0cb49b6ac84457e7bdd466cb730c3cb623e9a25b", + "_spec": "ssri@^4.1.2", + "_where": "/Users/zkat/Documents/code/npm/node_modules/npm-registry-client", + "author": { + "name": "Kat Marchán", + "email": "kzm@sykosomatic.org" + }, + "bugs": { + "url": "https://github.com/zkat/ssri/issues" + }, + "bundleDependencies": false, + "config": { + "nyc": { + "exclude": [ + "node_modules/**", + "test/**" + ] + } + }, + "dependencies": { + "safe-buffer": "^5.1.0" + }, + "deprecated": false, + "description": "Standard Subresource Integrity library -- parses, serializes, generates, and verifies integrity metadata according to the SRI spec.", + "devDependencies": { + "nyc": "^10.3.2", + "standard": "^9.0.2", + "standard-version": "^4.1.0", + "tap": "^10.3.3", + "weallbehave": "^1.2.0", + "weallcontribute": "^1.0.8" + }, + "files": [ + "*.js" + ], + "homepage": "https://github.com/zkat/ssri#readme", + "keywords": [ + "w3c", + "web", + "security", + "integrity", + "checksum", + "hashing", + "subresource integrity", + "sri", + "sri hash", + "sri string", + "sri generator", + "html" + ], + "license": "CC0-1.0", + "main": "index.js", + "name": "ssri", + "repository": { + "type": "git", + "url": "git+https://github.com/zkat/ssri.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": "4.1.6" +} diff --git a/deps/npm/node_modules/pacote/CHANGELOG.md b/deps/npm/node_modules/pacote/CHANGELOG.md index 3d9ac9dc213..140e861cd7a 100644 --- a/deps/npm/node_modules/pacote/CHANGELOG.md +++ b/deps/npm/node_modules/pacote/CHANGELOG.md @@ -2,6 +2,95 @@ 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="7.0.2"></a> +## [7.0.2](https://github.com/zkat/pacote/compare/v7.0.1...v7.0.2) (2017-11-28) + + +### Bug Fixes + +* **git:** only resolvedRefs can be shallow-cloned ([899720f](https://github.com/zkat/pacote/commit/899720f)) + + + +<a name="7.0.1"></a> +## [7.0.1](https://github.com/zkat/pacote/compare/v7.0.0...v7.0.1) (2017-11-15) + + +### Bug Fixes + +* **git:** use resolved ref if available when doing a full clone (#125) ([46ca45a](https://github.com/zkat/pacote/commit/46ca45a)), closes [#125](https://github.com/zkat/pacote/issues/125) +* **move:** bump cacache for some cross-platform move fixes ([eebdcda](https://github.com/zkat/pacote/commit/eebdcda)) +* **test:** missed a spot converting tests to promises ([c43caed](https://github.com/zkat/pacote/commit/c43caed)) + + + +<a name="7.0.0"></a> +# [7.0.0](https://github.com/zkat/pacote/compare/v6.1.0...v7.0.0) (2017-11-15) + + +### Bug Fixes + +* **docs:** You totally should use pacote now (#126) ([d49a9b5](https://github.com/zkat/pacote/commit/d49a9b5)) +* **git:** stop generating integrity for git ([d45363b](https://github.com/zkat/pacote/commit/d45363b)) +* **integrity:** stop defaulting to sha1 hashes ([62f8cdf](https://github.com/zkat/pacote/commit/62f8cdf)) +* **license:** relicense to MIT for OSI-compat ([ba6b3e0](https://github.com/zkat/pacote/commit/ba6b3e0)) + + +### Features + +* **tarball:** add externall pacote.tarball() api ([e30bd49](https://github.com/zkat/pacote/commit/e30bd49)) + + +### prefetch + +* deprecate pacote.prefetch ([e47e521](https://github.com/zkat/pacote/commit/e47e521)) + + +### BREAKING CHANGES + +* **license:** The license has changed from CC0-1.0 to MIT, which is less permissive and also OSI-approved. +* pacote.prefetch is deprecated in favor of pacote.tarball + + + +<a name="6.1.0"></a> +# [6.1.0](https://github.com/zkat/pacote/compare/v6.0.4...v6.1.0) (2017-10-19) + + +### Bug Fixes + +* **git:** use actual default git branch instead of assuming master (#122) ([79ce949](https://github.com/zkat/pacote/commit/79ce949)) +* **npa:** ensure spec is a valid npa instance ([1757b2b](https://github.com/zkat/pacote/commit/1757b2b)) + + +### Features + +* **selection:** add opts.includeDeprecated (#123) ([2001549](https://github.com/zkat/pacote/commit/2001549)) + + + +<a name="6.0.4"></a> +## [6.0.4](https://github.com/zkat/pacote/compare/v6.0.3...v6.0.4) (2017-10-05) + + +### Bug Fixes + +* **file:** include integrity hash for streamed tarballs too ([030cee7](https://github.com/zkat/pacote/commit/030cee7)) + + + +<a name="6.0.3"></a> +## [6.0.3](https://github.com/zkat/pacote/compare/v6.0.2...v6.0.3) (2017-10-05) + + +### Bug Fixes + +* **extract:** clean up mode/fmode/dmode tests ([f915045](https://github.com/zkat/pacote/commit/f915045)) +* **file:** make sure file tarballs are written to cache and have integrity data ([dae391a](https://github.com/zkat/pacote/commit/dae391a)) +* **git:** version resolution regression from #115 (#119) ([9a68205](https://github.com/zkat/pacote/commit/9a68205)) + + + <a name="6.0.2"></a> ## [6.0.2](https://github.com/zkat/pacote/compare/v6.0.1...v6.0.2) (2017-09-06) diff --git a/deps/npm/node_modules/pacote/LICENSE b/deps/npm/node_modules/pacote/LICENSE index c05cb09586f..ab41caa64b8 100644 --- a/deps/npm/node_modules/pacote/LICENSE +++ b/deps/npm/node_modules/pacote/LICENSE @@ -1,3 +1,21 @@ -To the extent possible under law, maintainers for this project have waived all copyright and related or neighboring rights to this project. +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. -For more information on this waiver, see: https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/deps/npm/node_modules/pacote/README.md b/deps/npm/node_modules/pacote/README.md index 33977762492..5c9985549d9 100644 --- a/deps/npm/node_modules/pacote/README.md +++ b/deps/npm/node_modules/pacote/README.md @@ -1,8 +1,5 @@ # pacote [![npm version](https://img.shields.io/npm/v/pacote.svg)](https://npm.im/pacote) [![license](https://img.shields.io/npm/l/pacote.svg)](https://npm.im/pacote) [![Travis](https://img.shields.io/travis/zkat/pacote.svg)](https://travis-ci.org/zkat/pacote) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/pacote?svg=true)](https://ci.appveyor.com/project/zkat/pacote) [![Coverage Status](https://coveralls.io/repos/github/zkat/pacote/badge.svg?branch=latest)](https://coveralls.io/github/zkat/pacote?branch=latest) - -**NOTE: this package is still under heavy development. Please don't use it yet** - [`pacote`](https://github.com/zkat/pacote) is a Node.js library for downloading [npm](https://npmjs.org)-compatible packages. It supports all package specifier syntax that `npm install` and its ilk support. It transparently caches anything @@ -20,6 +17,9 @@ needed to reduce excess operations, using [`cacache`](https://npm.im/cacache). * [API](#api) * [`manifest`](#manifest) * [`extract`](#extract) + * [`tarball`](#tarball) + * [`tarball.stream`](#tarball-stream) + * [`tarball.toFile`](#tarball-to-file) * [`prefetch`](#prefetch) * [`options`](#options) * [`clearMemoized`](#clearMemoized) @@ -108,8 +108,50 @@ pacote.extract('pacote@1.0.0', './woot', { }) ``` +#### <a name="tarball"></a> `> pacote.tarball(spec, [opts])` + +Fetches package data identified by `<spec>` and returns the data as a buffer. + +This API has two variants: + +* `pacote.tarball.stream(spec, [opts])` - Same as `pacote.tarball`, except it returns a stream instead of a Promise. +* `pacote.tarball.toFile(spec, dest, [opts])` - Instead of returning data directly, data will be written directly to `dest`, and create any required directories along the way. + +##### Example + +```javascript +pacote.tarball('pacote@1.0.0', { cache: './my-cache' }).then(data => { + // data is the tarball data for pacote@1.0.0 +}) +``` + +#### <a name="tarball-stream"></a> `> pacote.tarball.stream(spec, [opts])` + +Same as `pacote.tarball`, except it returns a stream instead of a Promise. + +##### Example + +```javascript +pacote.tarball.stream('pacote@1.0.0') +.pipe(fs.createWriteStream('./pacote-1.0.0.tgz')) +``` + +#### <a name="tarball-to-file"></a> `> pacote.tarball.toFile(spec, dest, [opts])` + +Like `pacote.tarball`, but instead of returning data directly, data will be +written directly to `dest`, and create any required directories along the way. + +##### Example + +```javascript +pacote.tarball.toFile('pacote@1.0.0', './pacote-1.0.0.tgz') +.then(() => /* pacote tarball written directly to ./pacote-1.0.0.tgz */) +``` + #### <a name="prefetch"></a> `> pacote.prefetch(spec, [opts])` +##### THIS API IS DEPRECATED. USE `pacote.tarball()` INSTEAD + Fetches package data identified by `<spec>`, usually for the purpose of warming up the local package cache (with `opts.cache`). It does not return anything. diff --git a/deps/npm/node_modules/pacote/extract.js b/deps/npm/node_modules/pacote/extract.js index 4312f1a9aa2..941c46848b4 100644 --- a/deps/npm/node_modules/pacote/extract.js +++ b/deps/npm/node_modules/pacote/extract.js @@ -13,7 +13,7 @@ const rimraf = BB.promisify(require('rimraf')) module.exports = extract function extract (spec, dest, opts) { opts = optCheck(opts) - spec = typeof spec === 'string' ? npa(spec, opts.where) : spec + spec = npa(spec, opts.where) const startTime = Date.now() if (opts.integrity && opts.cache && !opts.preferOnline) { opts.log.silly('pacote', `trying ${spec} by hash: ${opts.integrity}`) diff --git a/deps/npm/node_modules/pacote/index.js b/deps/npm/node_modules/pacote/index.js index 4c4a5a5812f..7889a5edf23 100644 --- a/deps/npm/node_modules/pacote/index.js +++ b/deps/npm/node_modules/pacote/index.js @@ -4,5 +4,6 @@ module.exports = { extract: require('./extract'), manifest: require('./manifest'), prefetch: require('./prefetch'), + tarball: require('./tarball'), clearMemoized: require('./lib/fetch').clearMemoized } diff --git a/deps/npm/node_modules/pacote/lib/fetchers/file.js b/deps/npm/node_modules/pacote/lib/fetchers/file.js index 8217f5015b1..48bec0c2d8d 100644 --- a/deps/npm/node_modules/pacote/lib/fetchers/file.js +++ b/deps/npm/node_modules/pacote/lib/fetchers/file.js @@ -2,9 +2,10 @@ const BB = require('bluebird') +const cacache = require('cacache') const Fetcher = require('../fetch') const fs = require('fs') -const pipe = require('mississippi').pipe +const pipe = BB.promisify(require('mississippi').pipe) const through = require('mississippi').through const readFileAsync = BB.promisify(fs.readFile) @@ -29,15 +30,39 @@ Fetcher.impl(fetchFile, { const src = spec._resolved || spec.fetchSpec const stream = through() statAsync(src).then(stat => { + if (spec._resolved) { stream.emit('manifest', spec) } if (stat.size <= MAX_BULK_SIZE) { // YAY LET'S DO THING IN BULK return readFileAsync(src).then(data => { - stream.write(data, () => { + if (opts.cache) { + return cacache.put( + opts.cache, `pacote:tarball:file:${src}`, data, { + integrity: opts.integrity + } + ).then(integrity => ({data, integrity})) + } else { + return {data} + } + }).then(info => { + if (info.integrity) { stream.emit('integrity', info.integrity) } + stream.write(info.data, () => { stream.end() }) }) } else { - return pipe(fs.createReadStream(src), stream) + let integrity + const cacheWriter = !opts.cache + ? BB.resolve(null) + : (pipe( + fs.createReadStream(src), + cacache.put.stream(opts.cache, `pacote:tarball:${src}`, { + integrity: opts.integrity + }).on('integrity', d => { integrity = d }) + )) + return cacheWriter.then(() => { + if (integrity) { stream.emit('integrity', integrity) } + return pipe(fs.createReadStream(src), stream) + }) } }, err => stream.emit('error', err)) return stream diff --git a/deps/npm/node_modules/pacote/lib/fetchers/git.js b/deps/npm/node_modules/pacote/lib/fetchers/git.js index a5f51cd6c08..11b56952557 100644 --- a/deps/npm/node_modules/pacote/lib/fetchers/git.js +++ b/deps/npm/node_modules/pacote/lib/fetchers/git.js @@ -111,19 +111,21 @@ function plainManifest (repo, spec, opts) { _spec: spec, _ref: ref, _rawRef: spec.gitCommittish || spec.gitRange, - _uniqueResolved: resolved + _uniqueResolved: resolved, + _integrity: false } } else { // We're SOL and need a full clone :( // // If we're confident enough that `rawRef` is a commit SHA, // then we can at least get `finalize-manifest` to cache its result. - const resolved = spec.saveSpec.replace(/(?:#.*)?$/, `#${rawRef}`) + const resolved = spec.saveSpec.replace(/(?:#.*)?$/, rawRef ? `#${rawRef}` : '') return { _repo: repo, _rawRef: rawRef, - _resolved: rawRef.match(/^[a-f0-9]{40}$/) && resolved, - _uniqueResolved: rawRef.match(/^[a-f0-9]{40}$/) && resolved + _resolved: rawRef && rawRef.match(/^[a-f0-9]{40}$/) && resolved, + _uniqueResolved: rawRef && rawRef.match(/^[a-f0-9]{40}$/) && resolved, + _integrity: false } } }) @@ -161,9 +163,10 @@ function withTmp (opts, cb) { // Only certain whitelisted hosted gits support shadow cloning const SHALLOW_HOSTS = new Set(['github', 'gist', 'gitlab', 'bitbucket']) function cloneRepo (spec, repo, resolvedRef, rawRef, tmp, opts) { + const ref = resolvedRef ? resolvedRef.ref : rawRef if (resolvedRef && spec.hosted && SHALLOW_HOSTS.has(spec.hosted.type)) { - return git.shallow(repo, resolvedRef.ref, tmp, opts) + return git.shallow(repo, ref, tmp, opts) } else { - return git.clone(repo, rawRef, tmp, opts) + return git.clone(repo, ref, tmp, opts) } } diff --git a/deps/npm/node_modules/pacote/lib/fetchers/registry/manifest.js b/deps/npm/node_modules/pacote/lib/fetchers/registry/manifest.js index be67c2e455a..4488ddb4c71 100644 --- a/deps/npm/node_modules/pacote/lib/fetchers/registry/manifest.js +++ b/deps/npm/node_modules/pacote/lib/fetchers/registry/manifest.js @@ -37,7 +37,8 @@ function getManifest (uri, registry, spec, opts) { return fetchPackument(uri, spec, registry, opts).then(packument => { try { return pickManifest(packument, spec.fetchSpec, { - defaultTag: opts.defaultTag + defaultTag: opts.defaultTag, + includeDeprecated: opts.includeDeprecated }) } catch (err) { if (err.code === 'ETARGET' && packument._cached && !opts.offline) { diff --git a/deps/npm/node_modules/pacote/lib/finalize-manifest.js b/deps/npm/node_modules/pacote/lib/finalize-manifest.js index 321b37cdcae..86b273b2154 100644 --- a/deps/npm/node_modules/pacote/lib/finalize-manifest.js +++ b/deps/npm/node_modules/pacote/lib/finalize-manifest.js @@ -97,8 +97,8 @@ function Manifest (pkg, fromTarball, fullMetadata) { // Not all handlers (or registries) provide these out of the box, // and if they don't, we need to extract and read the tarball ourselves. // These are details required by the installer. - this._integrity = pkg._integrity || fromTarball._integrity - this._shasum = pkg._shasum + this._integrity = pkg._integrity || fromTarball._integrity || null + this._shasum = pkg._shasum || null this._shrinkwrap = pkg._shrinkwrap || fromTarball._shrinkwrap || null this.bin = pkg.bin || fromTarball.bin || null @@ -153,7 +153,7 @@ function tarballedProps (pkg, spec, opts) { needsShrinkwrap && jsonFromStream('npm-shrinkwrap.json', extracted), needsManifest && jsonFromStream('package.json', extracted), needsBin && getPaths(extracted), - needsHash && ssri.fromStream(tarStream, { algorithms: ['sha1'] }), + needsHash && ssri.fromStream(tarStream), needsExtract && pipe(tarStream, extracted), (sr, mani, paths, hash) => { if (needsManifest && !mani) { diff --git a/deps/npm/node_modules/pacote/lib/util/git.js b/deps/npm/node_modules/pacote/lib/util/git.js index a24edccdd05..a6162ceeba4 100644 --- a/deps/npm/node_modules/pacote/lib/util/git.js +++ b/deps/npm/node_modules/pacote/lib/util/git.js @@ -58,7 +58,7 @@ function fullClone (repo, committish, target, opts) { return execGit(gitArgs, { cwd: path.dirname(target) }, opts).then(() => { - return execGit(['checkout', committish], { + return committish && execGit(['checkout', committish], { cwd: target }) }).then(() => { @@ -69,7 +69,11 @@ function fullClone (repo, committish, target, opts) { module.exports.shallow = shallowClone function shallowClone (repo, branch, target, opts) { opts = optCheck(opts) - const gitArgs = ['clone', '--depth=1', '-q', '-b', branch, repo, target] + const gitArgs = ['clone', '--depth=1', '-q'] + if (branch) { + gitArgs.push('-b', branch) + } + gitArgs.push(repo, target) if (process.platform === 'win32') { gitArgs.push('--config', 'core.longpaths=true') } @@ -204,8 +208,8 @@ function checkGit () { } } -const REFS_TAGS = '/refs/tags/' -const REFS_HEADS = '/refs/heads/' +const REFS_TAGS = 'refs/tags/' +const REFS_HEADS = 'refs/heads/' const HEAD = 'HEAD' function refType (ref) { return ref.indexOf(REFS_TAGS) !== -1 diff --git a/deps/npm/node_modules/pacote/lib/util/opt-check.js b/deps/npm/node_modules/pacote/lib/util/opt-check.js index a2692836a3a..711f46c91aa 100644 --- a/deps/npm/node_modules/pacote/lib/util/opt-check.js +++ b/deps/npm/node_modules/pacote/lib/util/opt-check.js @@ -43,6 +43,9 @@ function PacoteOptions (opts) { this.projectScope = opts.projectScope this.fullMetadata = opts.fullMetadata this.alwaysAuth = opts.alwaysAuth + this.includeDeprecated = opts.includeDeprecated == null + ? true + : opts.includeDeprecated this.dirPacker = opts.dirPacker || null diff --git a/deps/npm/node_modules/pacote/manifest.js b/deps/npm/node_modules/pacote/manifest.js index 81373ab0f8d..6a89ff76bef 100644 --- a/deps/npm/node_modules/pacote/manifest.js +++ b/deps/npm/node_modules/pacote/manifest.js @@ -9,7 +9,7 @@ const npa = require('npm-package-arg') module.exports = manifest function manifest (spec, opts) { opts = optCheck(opts) - spec = typeof spec === 'string' ? npa(spec, opts.where) : spec + spec = npa(spec, opts.where) const label = [ spec.name, diff --git a/deps/npm/node_modules/pacote/node_modules/get-stream/buffer-stream.js b/deps/npm/node_modules/pacote/node_modules/get-stream/buffer-stream.js new file mode 100644 index 00000000000..ae45d3d9e74 --- /dev/null +++ b/deps/npm/node_modules/pacote/node_modules/get-stream/buffer-stream.js @@ -0,0 +1,51 @@ +'use strict'; +const PassThrough = require('stream').PassThrough; + +module.exports = opts => { + opts = Object.assign({}, opts); + + const array = opts.array; + let encoding = opts.encoding; + const buffer = encoding === 'buffer'; + let objectMode = false; + + if (array) { + objectMode = !(encoding || buffer); + } else { + encoding = encoding || 'utf8'; + } + + if (buffer) { + encoding = null; + } + + let len = 0; + const ret = []; + const stream = new PassThrough({objectMode}); + + if (encoding) { + stream.setEncoding(encoding); + } + + stream.on('data', chunk => { + ret.push(chunk); + + if (objectMode) { + len = ret.length; + } else { + len += chunk.length; + } + }); + + stream.getBufferedValue = () => { + if (array) { + return ret; + } + + return buffer ? Buffer.concat(ret, len) : ret.join(''); + }; + + stream.getBufferedLength = () => len; + + return stream; +}; diff --git a/deps/npm/node_modules/pacote/node_modules/get-stream/index.js b/deps/npm/node_modules/pacote/node_modules/get-stream/index.js new file mode 100644 index 00000000000..2dc5ee96af2 --- /dev/null +++ b/deps/npm/node_modules/pacote/node_modules/get-stream/index.js @@ -0,0 +1,51 @@ +'use strict'; +const bufferStream = require('./buffer-stream'); + +function getStream(inputStream, opts) { + if (!inputStream) { + return Promise.reject(new Error('Expected a stream')); + } + + opts = Object.assign({maxBuffer: Infinity}, opts); + + const maxBuffer = opts.maxBuffer; + let stream; + let clean; + + const p = new Promise((resolve, reject) => { + const error = err => { + if (err) { // null check + err.bufferedData = stream.getBufferedValue(); + } + + reject(err); + }; + + stream = bufferStream(opts); + inputStream.once('error', error); + inputStream.pipe(stream); + + stream.on('data', () => { + if (stream.getBufferedLength() > maxBuffer) { + reject(new Error('maxBuffer exceeded')); + } + }); + stream.once('error', error); + stream.on('end', resolve); + + clean = () => { + // some streams doesn't implement the `stream.Readable` interface correctly + if (inputStream.unpipe) { + inputStream.unpipe(stream); + } + }; + }); + + p.then(clean, clean); + + return p.then(() => stream.getBufferedValue()); +} + +module.exports = getStream; +module.exports.buffer = (stream, opts) => getStream(stream, Object.assign({}, opts, {encoding: 'buffer'})); +module.exports.array = (stream, opts) => getStream(stream, Object.assign({}, opts, {array: true})); diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/object-assign/license b/deps/npm/node_modules/pacote/node_modules/get-stream/license index 654d0bfe943..654d0bfe943 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/object-assign/license +++ b/deps/npm/node_modules/pacote/node_modules/get-stream/license diff --git a/deps/npm/node_modules/pacote/node_modules/get-stream/package.json b/deps/npm/node_modules/pacote/node_modules/get-stream/package.json new file mode 100644 index 00000000000..7670869c4b5 --- /dev/null +++ b/deps/npm/node_modules/pacote/node_modules/get-stream/package.json @@ -0,0 +1,80 @@ +{ + "_from": "get-stream@^3.0.0", + "_id": "get-stream@3.0.0", + "_inBundle": false, + "_integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "_location": "/pacote/get-stream", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "get-stream@^3.0.0", + "name": "get-stream", + "escapedName": "get-stream", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/pacote" + ], + "_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "_shasum": "8e943d1358dc37555054ecbe2edb05aa174ede14", + "_spec": "get-stream@^3.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/get-stream/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Get a stream as a string, buffer, or array", + "devDependencies": { + "ava": "*", + "into-stream": "^3.0.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js", + "buffer-stream.js" + ], + "homepage": "https://github.com/sindresorhus/get-stream#readme", + "keywords": [ + "get", + "stream", + "promise", + "concat", + "string", + "str", + "text", + "buffer", + "read", + "data", + "consume", + "readable", + "readablestream", + "array", + "object", + "obj" + ], + "license": "MIT", + "name": "get-stream", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/get-stream.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "3.0.0", + "xo": { + "esnext": true + } +} diff --git a/deps/npm/node_modules/pacote/node_modules/get-stream/readme.md b/deps/npm/node_modules/pacote/node_modules/get-stream/readme.md new file mode 100644 index 00000000000..73b188fb420 --- /dev/null +++ b/deps/npm/node_modules/pacote/node_modules/get-stream/readme.md @@ -0,0 +1,117 @@ +# get-stream [![Build Status](https://travis-ci.org/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stream) + +> Get a stream as a string, buffer, or array + + +## Install + +``` +$ npm install --save get-stream +``` + + +## Usage + +```js +const fs = require('fs'); +const getStream = require('get-stream'); +const stream = fs.createReadStream('unicorn.txt'); + +getStream(stream).then(str => { + console.log(str); + /* + ,,))))))));, + __)))))))))))))), + \|/ -\(((((''''((((((((. + -*-==//////(('' . `)))))), + /|\ ))| o ;-. '((((( ,(, + ( `| / ) ;))))' ,_))^;(~ + | | | ,))((((_ _____------~~~-. %,;(;(>';'~ + o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~ + ; ''''```` `: `:::|\,__,%% );`'; ~ + | _ ) / `:|`----' `-' + ______/\/~ | / / + /~;;.____/;;' / ___--,-( `;;;/ + / // _;______;'------~~~~~ /;;/\ / + // | | / ; \;;,\ + (<_ | ; /',/-----' _> + \_| ||_ //~;~~~~~~~~~ + `\_| (,~~ + \~\ + ~~ + */ +}); +``` + + +## API + +The methods returns a promise that resolves when the `end` event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode. + +### getStream(stream, [options]) + +Get the `stream` as a string. + +#### options + +##### encoding + +Type: `string`<br> +Default: `utf8` + +[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream. + +##### maxBuffer + +Type: `number`<br> +Default: `Infinity` + +Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected. + +### getStream.buffer(stream, [options]) + +Get the `stream` as a buffer. + +It honors the `maxBuffer` option as above, but it refers to byte length rather than string length. + +### getStream.array(stream, [options]) + +Get the `stream` as an array of values. + +It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen: + +- When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes). + +- When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array. + +- When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array. + + +## Errors + +If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error. + +```js +getStream(streamThatErrorsAtTheEnd('unicorn')) + .catch(err => { + console.log(err.bufferedData); + //=> 'unicorn' + }); +``` + + +## FAQ + +### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)? + +This module accepts a stream instead of being one and returns a promise instead of using a callback. The API is simpler and it only supports returning a string, buffer, or array. It doesn't have a fragile type inference. You explicitly choose what you want. And it doesn't depend on the huge `readable-stream` package. + + +## Related + +- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md index 59698d1c275..f91df127218 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/CHANGELOG.md @@ -2,6 +2,21 @@ 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="2.6.0"></a> +# [2.6.0](https://github.com/zkat/make-fetch-happen/compare/v2.5.0...v2.6.0) (2017-11-14) + + +### Bug Fixes + +* **integrity:** disable node-fetch compress when checking integrity (#42) ([a7cc74c](https://github.com/zkat/make-fetch-happen/commit/a7cc74c)) + + +### Features + +* **onretry:** Add `options.onRetry` (#48) ([f90ccff](https://github.com/zkat/make-fetch-happen/commit/f90ccff)) + + + <a name="2.5.0"></a> # [2.5.0](https://github.com/zkat/make-fetch-happen/compare/v2.4.13...v2.5.0) (2017-08-24) diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/README.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/README.md index 7160fa83893..4d12d8dae7e 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/README.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/README.md @@ -2,8 +2,8 @@ [`make-fetch-happen`](https://github.com/zkat/make-fetch-happen) is a Node.js -library that wraps [`node-fetch`](https://npm.im/node-fetch) with additional -features it doesn't intend to include, including HTTP Cache support, request +library that wraps [`node-fetch-npm`](https://github.com/npm/node-fetch-npm) with additional +features [`node-fetch`](https://github.com/bitinn/node-fetch) doesn't intend to include, including HTTP Cache support, request pooling, proxies, retries, [and more](#features)! ## Install @@ -27,6 +27,7 @@ pooling, proxies, retries, [and more](#features)! * [`opts.ca, opts.cert, opts.key`](#https-opts) * [`opts.maxSockets`](#opts-max-sockets) * [`opts.retry`](#opts-retry) + * [`opts.onRetry`](#opts-onretry) * [`opts.integrity`](#opts-integrity) * [Message From Our Sponsors](#wow) @@ -143,6 +144,7 @@ make-fetch-happen augments the `node-fetch` API with additional features availab * [`opts.localAddress`](#opts-local-address) * [`opts.maxSockets`](#opts-max-sockets) * [`opts.retry`](#opts-retry) - Request retry settings +* [`opts.onRetry`](#opts-onretry) - a function called whenever a retry is attempted * [`opts.integrity`](#opts-integrity) - [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) metadata. #### <a name="opts-cache-manager"></a> `> opts.cacheManager` @@ -363,6 +365,20 @@ fetch('http://one-more.site.com', { }) ``` +#### <a name="opts-onretry"></a> `> opts.onRetry` + +A function called whenever a retry is attempted. + +##### Example + +```javascript +fetch('https://flaky.site.com', { + onRetry() { + console.log('we will retry!') + } +}) +``` + #### <a name="opts-integrity"></a> `> opts.integrity` Matches the response body against the given [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) metadata. If verification fails, the request will fail with an `EINTEGRITY` error. @@ -376,7 +392,7 @@ fetch('https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-1.0.0.tg integrity: 'sha1-o47j7zAYnedYFn1dF/fR9OV3z8Q=' }) // -> ok -fetch('https://malicious-registry.org/make-fetch-happen/-/make-fetch-happen-1.0.0.tgz'. { +fetch('https://malicious-registry.org/make-fetch-happen/-/make-fetch-happen-1.0.0.tgz', { integrity: 'sha1-o47j7zAYnedYFn1dF/fR9OV3z8Q=' }) // Error: EINTEGRITY ``` diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/index.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/index.js index d82811b63db..0f2c164e19f 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/index.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/index.js @@ -108,6 +108,8 @@ function cachingFetch (uri, _opts) { if (opts.integrity) { initializeSsri() + // if verifying integrity, node-fetch must not decompress + opts.compress = false } const isCachable = (opts.method === 'GET' || opts.method === 'HEAD') && @@ -353,6 +355,10 @@ function remoteFetch (uri, opts) { if (!isMethodGetHead) { return opts.cacheManager.delete(req).then(() => { if (res.status >= 500 && req.method !== 'POST' && !isStream) { + if (typeof opts.onRetry === 'function') { + opts.onRetry(res) + } + return retryHandler(res) } @@ -370,6 +376,10 @@ function remoteFetch (uri, opts) { ) if (isRetriable) { + if (typeof opts.onRetry === 'function') { + opts.onRetry(res) + } + return retryHandler(res) } @@ -437,6 +447,10 @@ function remoteFetch (uri, opts) { throw err } + if (typeof opts.onRetry === 'function') { + opts.onRetry(err) + } + return retryHandler(err) }) }, diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/index.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/index.js index 2e9c58c99f4..8a5bcab597b 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/index.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/index.js @@ -221,7 +221,14 @@ module.exports = class CachePolicy { responseHeaders() { const headers = this._copyWithoutHopByHopHeaders(this._resHeaders); - headers.age = `${Math.round(this.age())}`; + const age = this.age(); + + // A cache SHOULD generate 113 warning if it heuristically chose a freshness + // lifetime greater than 24 hours and the response's age is greater than 24 hours. + if (age > 3600*24 && !this._hasExplicitExpiration() && this.maxAge() > 3600*24) { + headers.warning = (headers.warning ? `${headers.warning}, ` : '') + '113 - "rfc7234 5.5.4"'; + } + headers.age = `${Math.round(age)}`; return headers; } @@ -260,6 +267,13 @@ module.exports = class CachePolicy { return isFinite(ageValue) ? ageValue : 0; } + /** + * Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`. + * + * For an up-to-date value, see `timeToLive()`. + * + * @return Number + */ maxAge() { if (!this.storable() || this._rescc['no-cache']) { return 0; diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/node4/index.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/node4/index.js index 70111068188..bcdaebe80f3 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/node4/index.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/node4/index.js @@ -271,7 +271,14 @@ module.exports = function () { CachePolicy.prototype.responseHeaders = function responseHeaders() { var headers = this._copyWithoutHopByHopHeaders(this._resHeaders); - headers.age = '' + Math.round(this.age()); + var age = this.age(); + + // A cache SHOULD generate 113 warning if it heuristically chose a freshness + // lifetime greater than 24 hours and the response's age is greater than 24 hours. + if (age > 3600 * 24 && !this._hasExplicitExpiration() && this.maxAge() > 3600 * 24) { + headers.warning = (headers.warning ? `${headers.warning}, ` : '') + '113 - "rfc7234 5.5.4"'; + } + headers.age = `${Math.round(age)}`; return headers; }; @@ -314,6 +321,15 @@ module.exports = function () { return isFinite(ageValue) ? ageValue : 0; }; + /** + * Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`. + * + * For an up-to-date value, see `timeToLive()`. + * + * @return Number + */ + + CachePolicy.prototype.maxAge = function maxAge() { if (!this.storable() || this._rescc['no-cache']) { return 0; @@ -442,7 +458,7 @@ module.exports = function () { /* MUST send that entity-tag in any cache validation request (using If-Match or If-None-Match) if an entity-tag has been provided by the origin server. */ if (this._resHeaders.etag) { - headers['if-none-match'] = headers['if-none-match'] ? headers['if-none-match'] + ', ' + this._resHeaders.etag : this._resHeaders.etag; + headers['if-none-match'] = headers['if-none-match'] ? `${headers['if-none-match']}, ${this._resHeaders.etag}` : this._resHeaders.etag; } // Clients MAY issue simple (non-subrange) GET requests with either weak validators or strong validators. Clients MUST NOT use weak validators in other forms of request. @@ -531,7 +547,7 @@ module.exports = function () { var newResponse = Object.assign({}, response, { status: this._status, method: this._method, - headers: headers + headers }); return { policy: new this.constructor(request, newResponse), diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/package.json index fa8235f1ed9..af463099858 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/package.json @@ -1,8 +1,8 @@ { "_from": "http-cache-semantics@^3.7.3", - "_id": "http-cache-semantics@3.7.3", + "_id": "http-cache-semantics@3.8.0", "_inBundle": false, - "_integrity": "sha1-LzXFMuzSnx5UE7mvgztySjxvf3I=", + "_integrity": "sha512-HGQFfBdru2fj/dwPn1oLx1fy6QMPeTAD1yzKcxD4l5biw+5QVaui/ehCqxaitoKJC/vHMLKv3Yd+nTlxboOJig==", "_location": "/pacote/make-fetch-happen/http-cache-semantics", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/pacote/make-fetch-happen" ], - "_resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.7.3.tgz", - "_shasum": "2f35c532ecd29f1e5413b9af833b724a3c6f7f72", + "_resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.0.tgz", + "_shasum": "1e3ce248730e189ac692a6697b9e3fdea2ff8da3", "_spec": "http-cache-semantics@^3.7.3", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen", "author": { @@ -34,9 +34,9 @@ "deprecated": false, "description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies", "devDependencies": { - "babel-cli": "^6.24.0", - "babel-preset-env": "^1.3.2", - "mocha": "^3.2.0" + "babel-cli": "^6.24.1", + "babel-preset-env": "^1.5.2", + "mocha": "^3.4.2" }, "files": [ "node4/index.js", @@ -56,5 +56,5 @@ "prepublish": "npm run compile", "test": "npm run compile; mocha node4/test" }, - "version": "3.7.3" + "version": "3.8.0" } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/responsetest.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/responsetest.js index 27bdb28e044..763910b82c2 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/responsetest.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/responsetest.js @@ -34,6 +34,12 @@ describe('Response headers', function() { assert.equal(cache.maxAge(), 678); }); + it('IIS', function() { + const cache = new CachePolicy(req, {headers:{'cache-control': 'private, public, max-age=259200'}}, {shared:false}); + assert(!cache.stale()); + assert.equal(cache.maxAge(), 259200); + }); + it('pre-check tolerated', function() { const cc = 'pre-check=0, post-check=0, no-store, no-cache, max-age=100'; const cache = new CachePolicy(req, {headers:{'cache-control': cc}}); diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/revalidatetest.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/revalidatetest.js index 1f905ec27cb..9dc737718d5 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/revalidatetest.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/revalidatetest.js @@ -106,6 +106,7 @@ describe('Can be revalidated?', function() { const headers = cache.revalidationHeaders(simpleRequest); assertHeadersPassed(headers); assert.equal(headers['if-modified-since'], 'Tue, 15 Nov 1994 12:45:26 GMT'); + assert(!/113/.test(headers.warning)); }); it('not without validators', function() { @@ -113,6 +114,20 @@ describe('Can be revalidated?', function() { const headers = cache.revalidationHeaders(simpleRequest); assertHeadersPassed(headers); assertNoValidators(headers); + assert(!/113/.test(headers.warning)); + }) + + it('113 added', function() { + const veryOldResponse = { + headers: { + age: 3600*72, + 'last-modified': 'Tue, 15 Nov 1994 12:45:26 GMT', + }, + }; + + const cache = new CachePolicy(simpleRequest, veryOldResponse); + const headers = cache.responseHeaders(simpleRequest); + assert(/113/.test(headers.warning)); }) }); diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/.npmignore b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/.npmignore deleted file mode 100644 index c12f3a80c18..00000000000 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -/node_modules -/?.js diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/.travis.yml b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/.travis.yml index 805d3d50d2a..6ce862c6f63 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/.travis.yml +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/.travis.yml @@ -8,6 +8,7 @@ node_js: - "6" - "7" - "8" + - "9" install: - PATH="`npm bin`:`npm bin -g`:$PATH" diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/History.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/History.md index a81fb17a973..e12180e4239 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/History.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/History.md @@ -1,4 +1,10 @@ +4.1.2 / 2017-11-20 +================== + + * test Node 9 on Travis + * ensure that `https.get()` uses the patched `https.request()` + 4.1.1 / 2017-07-20 ================== diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/package.json index 4c28ce76e26..952a19a7781 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/package.json @@ -1,8 +1,8 @@ { "_from": "agent-base@4", - "_id": "agent-base@4.1.1", + "_id": "agent-base@4.1.2", "_inBundle": false, - "_integrity": "sha512-yWGUUmCZD/33IRjG2It94PzixT8lX+47Uq8fjmd0cgQWITCMrJuXFaVIMnGDmDnZGGKAGdwTx8UGeU8lMR2urA==", + "_integrity": "sha512-VE6QoEdaugY86BohRtfGmTDabxdU5sCKOkbcPA6PXKJsRzEi/7A3RCTxJal1ft/4qSfPht5/iQLhMh/wzSkkNw==", "_location": "/pacote/make-fetch-happen/http-proxy-agent/agent-base", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/pacote/make-fetch-happen/http-proxy-agent" ], - "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.1.1.tgz", - "_shasum": "92d8a4fc2524a3b09b3666a33b6c97960f23d6a4", + "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.1.2.tgz", + "_shasum": "80fa6cde440f4dcf9af2617cf246099b5d99f0c8", "_spec": "agent-base@4", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent", "author": { @@ -61,5 +61,5 @@ "scripts": { "test": "mocha --reporter spec" }, - "version": "4.1.1" + "version": "4.1.2" } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/patch-core.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/patch-core.js index a3f7bc6160c..3891c13a8b4 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/patch-core.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/agent-base/patch-core.js @@ -24,3 +24,15 @@ https.request = (function(request) { return request.call(https, options, cb); }; })(https.request); + +/** + * This is needed for Node.js >= 9.0.0 to make sure `https.get()` uses the + * patched `https.request()`. + * + * Ref: https://github.com/nodejs/node/commit/5118f31 + */ +https.get = function(options, cb) { + const req = https.request(options, cb); + req.end(); + return req; +}; diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/CHANGELOG.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/CHANGELOG.md index 3dfb812968e..553da1585ee 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/CHANGELOG.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/CHANGELOG.md @@ -1,4 +1,9 @@ +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + 2.6.8 / 2017-05-18 ================== diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/component.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/component.json index 94cd36d8b6c..9de26410f0d 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/component.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/component.json @@ -2,7 +2,7 @@ "name": "debug", "repo": "visionmedia/debug", "description": "small debugging utility", - "version": "2.6.8", + "version": "2.6.9", "keywords": [ "debug", "log", diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/package.json index 1062dd985b5..3ec58fe84b3 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/package.json @@ -1,8 +1,8 @@ { "_from": "debug@2", - "_id": "debug@2.6.8", + "_id": "debug@2.6.9", "_inBundle": false, - "_integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "_integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "_location": "/pacote/make-fetch-happen/http-proxy-agent/debug", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/pacote/make-fetch-happen/http-proxy-agent" ], - "_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "_shasum": "e731531ca2ede27d188222427da17821d68ff4fc", + "_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "_shasum": "5d128515df134ff327e90a4c93f4e077a536341f", "_spec": "debug@2", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent", "author": { @@ -84,5 +84,5 @@ "type": "git", "url": "git://github.com/visionmedia/debug.git" }, - "version": "2.6.8" + "version": "2.6.9" } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/src/inspector-log.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/src/inspector-log.js new file mode 100644 index 00000000000..60ea6c04aaf --- /dev/null +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/src/inspector-log.js @@ -0,0 +1,15 @@ +module.exports = inspectorLog; + +// black hole +const nullStream = new (require('stream').Writable)(); +nullStream._write = () => {}; + +/** + * Outputs a `console.log()` to the Node.js Inspector console *only*. + */ +function inspectorLog() { + const stdout = console._stdout; + console._stdout = nullStream; + console.log.apply(console, arguments); + console._stdout = stdout; +} diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/src/node.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/src/node.js index af61297683f..b15109c905a 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/src/node.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-proxy-agent/node_modules/debug/src/node.js @@ -85,7 +85,9 @@ function useColors() { exports.formatters.o = function(v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts) - .replace(/\s*\n\s*/g, ' '); + .split('\n').map(function(str) { + return str.trim() + }).join(' '); }; /** diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/.npmignore b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/.npmignore deleted file mode 100644 index c12f3a80c18..00000000000 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -/node_modules -/?.js diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/.travis.yml b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/.travis.yml index 805d3d50d2a..6ce862c6f63 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/.travis.yml +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/.travis.yml @@ -8,6 +8,7 @@ node_js: - "6" - "7" - "8" + - "9" install: - PATH="`npm bin`:`npm bin -g`:$PATH" diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/History.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/History.md index a81fb17a973..e12180e4239 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/History.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/History.md @@ -1,4 +1,10 @@ +4.1.2 / 2017-11-20 +================== + + * test Node 9 on Travis + * ensure that `https.get()` uses the patched `https.request()` + 4.1.1 / 2017-07-20 ================== diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/package.json index 2de34cbacff..51056e94b30 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/package.json @@ -1,8 +1,8 @@ { "_from": "agent-base@^4.1.0", - "_id": "agent-base@4.1.1", + "_id": "agent-base@4.1.2", "_inBundle": false, - "_integrity": "sha512-yWGUUmCZD/33IRjG2It94PzixT8lX+47Uq8fjmd0cgQWITCMrJuXFaVIMnGDmDnZGGKAGdwTx8UGeU8lMR2urA==", + "_integrity": "sha512-VE6QoEdaugY86BohRtfGmTDabxdU5sCKOkbcPA6PXKJsRzEi/7A3RCTxJal1ft/4qSfPht5/iQLhMh/wzSkkNw==", "_location": "/pacote/make-fetch-happen/https-proxy-agent/agent-base", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/pacote/make-fetch-happen/https-proxy-agent" ], - "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.1.1.tgz", - "_shasum": "92d8a4fc2524a3b09b3666a33b6c97960f23d6a4", + "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.1.2.tgz", + "_shasum": "80fa6cde440f4dcf9af2617cf246099b5d99f0c8", "_spec": "agent-base@^4.1.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent", "author": { @@ -61,5 +61,5 @@ "scripts": { "test": "mocha --reporter spec" }, - "version": "4.1.1" + "version": "4.1.2" } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/patch-core.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/patch-core.js index a3f7bc6160c..3891c13a8b4 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/patch-core.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/patch-core.js @@ -24,3 +24,15 @@ https.request = (function(request) { return request.call(https, options, cb); }; })(https.request); + +/** + * This is needed for Node.js >= 9.0.0 to make sure `https.get()` uses the + * patched `https.request()`. + * + * Ref: https://github.com/nodejs/node/commit/5118f31 + */ +https.get = function(options, cb) { + const req = https.request(options, cb); + req.end(); + return req; +}; diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/CHANGELOG.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/CHANGELOG.md index 3dfb812968e..553da1585ee 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/CHANGELOG.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/CHANGELOG.md @@ -1,4 +1,9 @@ +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + 2.6.8 / 2017-05-18 ================== diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/component.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/component.json index 94cd36d8b6c..9de26410f0d 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/component.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/component.json @@ -2,7 +2,7 @@ "name": "debug", "repo": "visionmedia/debug", "description": "small debugging utility", - "version": "2.6.8", + "version": "2.6.9", "keywords": [ "debug", "log", diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/package.json index ade1aa0a01e..72abce89705 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/package.json @@ -1,8 +1,8 @@ { "_from": "debug@^2.4.1", - "_id": "debug@2.6.8", + "_id": "debug@2.6.9", "_inBundle": false, - "_integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "_integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "_location": "/pacote/make-fetch-happen/https-proxy-agent/debug", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/pacote/make-fetch-happen/https-proxy-agent" ], - "_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "_shasum": "e731531ca2ede27d188222427da17821d68ff4fc", + "_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "_shasum": "5d128515df134ff327e90a4c93f4e077a536341f", "_spec": "debug@^2.4.1", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent", "author": { @@ -84,5 +84,5 @@ "type": "git", "url": "git://github.com/visionmedia/debug.git" }, - "version": "2.6.8" + "version": "2.6.9" } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/src/inspector-log.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/src/inspector-log.js new file mode 100644 index 00000000000..60ea6c04aaf --- /dev/null +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/src/inspector-log.js @@ -0,0 +1,15 @@ +module.exports = inspectorLog; + +// black hole +const nullStream = new (require('stream').Writable)(); +nullStream._write = () => {}; + +/** + * Outputs a `console.log()` to the Node.js Inspector console *only*. + */ +function inspectorLog() { + const stdout = console._stdout; + console._stdout = nullStream; + console.log.apply(console, arguments); + console._stdout = stdout; +} diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/src/node.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/src/node.js index af61297683f..b15109c905a 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/src/node.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/debug/src/node.js @@ -85,7 +85,9 @@ function useColors() { exports.formatters.o = function(v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts) - .replace(/\s*\n\s*/g, ' '); + .split('\n').map(function(str) { + return str.trim() + }).join(' '); }; /** diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/Changelog.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/Changelog.md index ee8a05c44a0..5102d7ce950 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/Changelog.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/Changelog.md @@ -1,4 +1,11 @@ +# 0.4.19 / 2017-09-09 + + * Fixed iso8859-1 codec regression in handling untranslatable characters (#162, caused by #147) + * Re-generated windows1255 codec, because it was updated in iconv project + * Fixed grammar in error message when iconv-lite is loaded with encoding other than utf8 + + # 0.4.18 / 2017-06-13 * Fixed CESU-8 regression in Node v8. diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/internal.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/internal.js index e5aeefd6fb0..30e2c47568b 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/internal.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/internal.js @@ -13,8 +13,6 @@ module.exports = { utf16le: "ucs2", binary: { type: "_internal" }, - iso88591: "binary", - base64: { type: "_internal" }, hex: { type: "_internal" }, diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/sbcs-data-generated.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/sbcs-data-generated.js index a30ee2c79aa..9b4823607b6 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/sbcs-data-generated.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/sbcs-data-generated.js @@ -38,6 +38,7 @@ module.exports = { "1256": "windows1256", "1257": "windows1257", "1258": "windows1258", + "28591": "iso88591", "28592": "iso88592", "28593": "iso88593", "28594": "iso88594", @@ -90,7 +91,7 @@ module.exports = { "cp1254": "windows1254", "windows1255": { "type": "_sbcs", - "chars": "€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹ�ֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת���" + "chars": "€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹֺֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת���" }, "win1255": "windows1255", "cp1255": "windows1255", @@ -112,6 +113,11 @@ module.exports = { }, "win1258": "windows1258", "cp1258": "windows1258", + "iso88591": { + "type": "_sbcs", + "chars": "
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "cp28591": "iso88591", "iso88592": { "type": "_sbcs", "chars": "
Ą˘Ł¤ĽŚ§¨ŠŞŤŹŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/sbcs-data.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/sbcs-data.js index 9445df387e2..1009ad9901d 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/sbcs-data.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/encodings/sbcs-data.js @@ -84,8 +84,6 @@ module.exports = { "cp819": "iso88591", "ibm819": "iso88591", - "cp28591": "iso88591", - "28591": "iso88591", "cyrillic": "iso88595", diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/lib/index.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/lib/index.js index f1d44137888..990b421b39c 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/lib/index.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/lib/index.js @@ -144,5 +144,5 @@ if (nodeVer) { } if ("Ā" != "\u0100") { - console.error("iconv-lite warning: javascript files are loaded not with utf-8 encoding. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info."); + console.error("iconv-lite warning: javascript files use encoding different from utf-8. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info."); } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/package.json index 75a538098c4..51b1938ed41 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding/node_modules/iconv-lite/package.json @@ -1,8 +1,8 @@ { "_from": "iconv-lite@~0.4.13", - "_id": "iconv-lite@0.4.18", + "_id": "iconv-lite@0.4.19", "_inBundle": false, - "_integrity": "sha512-sr1ZQph3UwHTR0XftSbK85OvBbxe/abLGzEnPENCQwmHf7sck8Oyu4ob3LgBxWWxRoM+QszeUyl7jbqapu2TqA==", + "_integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", "_location": "/pacote/make-fetch-happen/node-fetch-npm/encoding/iconv-lite", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/pacote/make-fetch-happen/node-fetch-npm/encoding" ], - "_resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz", - "_shasum": "23d8656b16aae6742ac29732ea8f0336a4789cf2", + "_resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "_shasum": "f7468f60135f5e5dad3399c0a81be9a1603a082b", "_spec": "iconv-lite@~0.4.13", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/encoding", "author": { @@ -119,5 +119,5 @@ "test": "mocha --reporter spec --grep ." }, "typings": "./lib/index.d.ts", - "version": "0.4.18" + "version": "0.4.19" } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/History.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/History.md index c4161db723d..b0266b5e35f 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/History.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/History.md @@ -1,4 +1,9 @@ +3.0.1 / 2017-09-18 +================== + + * update "agent-base" to v4.1.0 + 3.0.0 / 2017-06-13 ================== diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/index.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/index.js index f9cfc3281af..3dac18d5645 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/index.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/index.js @@ -28,7 +28,7 @@ function SocksProxyAgent(opts) { throw new Error( 'a SOCKS proxy server `host` and `port` must be specified!' ); - Agent.call(this, connect); + Agent.call(this, opts); var proxy = Object.assign({}, opts); @@ -86,7 +86,7 @@ inherits(SocksProxyAgent, Agent); * @api public */ -function connect(req, opts, fn) { +SocksProxyAgent.prototype.callback = function connect(req, opts, fn) { var proxy = this.proxy; // called once the SOCKS proxy has connected to the specified remote endpoint diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/.npmignore b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/.npmignore deleted file mode 100644 index c12f3a80c18..00000000000 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -/node_modules -/?.js diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/.travis.yml b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/.travis.yml index 805d3d50d2a..6ce862c6f63 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/.travis.yml +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/.travis.yml @@ -8,6 +8,7 @@ node_js: - "6" - "7" - "8" + - "9" install: - PATH="`npm bin`:`npm bin -g`:$PATH" diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/History.md b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/History.md index a81fb17a973..e12180e4239 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/History.md +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/History.md @@ -1,4 +1,10 @@ +4.1.2 / 2017-11-20 +================== + + * test Node 9 on Travis + * ensure that `https.get()` uses the patched `https.request()` + 4.1.1 / 2017-07-20 ================== diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/package.json index 561a1a84e01..73baf0b326b 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/package.json @@ -1,26 +1,26 @@ { - "_from": "agent-base@^4.0.1", - "_id": "agent-base@4.1.1", + "_from": "agent-base@^4.1.0", + "_id": "agent-base@4.1.2", "_inBundle": false, - "_integrity": "sha512-yWGUUmCZD/33IRjG2It94PzixT8lX+47Uq8fjmd0cgQWITCMrJuXFaVIMnGDmDnZGGKAGdwTx8UGeU8lMR2urA==", + "_integrity": "sha512-VE6QoEdaugY86BohRtfGmTDabxdU5sCKOkbcPA6PXKJsRzEi/7A3RCTxJal1ft/4qSfPht5/iQLhMh/wzSkkNw==", "_location": "/pacote/make-fetch-happen/socks-proxy-agent/agent-base", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "agent-base@^4.0.1", + "raw": "agent-base@^4.1.0", "name": "agent-base", "escapedName": "agent-base", - "rawSpec": "^4.0.1", + "rawSpec": "^4.1.0", "saveSpec": null, - "fetchSpec": "^4.0.1" + "fetchSpec": "^4.1.0" }, "_requiredBy": [ "/pacote/make-fetch-happen/socks-proxy-agent" ], - "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.1.1.tgz", - "_shasum": "92d8a4fc2524a3b09b3666a33b6c97960f23d6a4", - "_spec": "agent-base@^4.0.1", + "_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.1.2.tgz", + "_shasum": "80fa6cde440f4dcf9af2617cf246099b5d99f0c8", + "_spec": "agent-base@^4.1.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent", "author": { "name": "Nathan Rajlich", @@ -61,5 +61,5 @@ "scripts": { "test": "mocha --reporter spec" }, - "version": "4.1.1" + "version": "4.1.2" } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/patch-core.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/patch-core.js index a3f7bc6160c..3891c13a8b4 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/patch-core.js +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/agent-base/patch-core.js @@ -24,3 +24,15 @@ https.request = (function(request) { return request.call(https, options, cb); }; })(https.request); + +/** + * This is needed for Node.js >= 9.0.0 to make sure `https.get()` uses the + * patched `https.request()`. + * + * Ref: https://github.com/nodejs/node/commit/5118f31 + */ +https.get = function(options, cb) { + const req = https.request(options, cb); + req.end(); + return req; +}; diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/package.json index 27c335d6882..e980811cfb1 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/package.json @@ -1,8 +1,8 @@ { "_from": "socks-proxy-agent@^3.0.0", - "_id": "socks-proxy-agent@3.0.0", + "_id": "socks-proxy-agent@3.0.1", "_inBundle": false, - "_integrity": "sha512-YJcT+SNNBgFoK/NpO20PChz0VnBOhkjG3X10BwlrYujd0NZlSsH1jbxSQ1S0njt3sOvzwQ2PvGqqUIvP4rNk/w==", + "_integrity": "sha512-ZwEDymm204mTzvdqyUqOdovVr2YRd2NYskrYrF2LXyZ9qDiMAoFESGK8CRphiO7rtbo2Y757k2Nia3x2hGtalA==", "_location": "/pacote/make-fetch-happen/socks-proxy-agent", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/pacote/make-fetch-happen" ], - "_resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-3.0.0.tgz", - "_shasum": "ea23085cd2bde94d084a62448f31139ca7ed6245", + "_resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-3.0.1.tgz", + "_shasum": "2eae7cf8e2a82d34565761539a7f9718c5617659", "_spec": "socks-proxy-agent@^3.0.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote/node_modules/make-fetch-happen", "author": { @@ -32,7 +32,7 @@ }, "bundleDependencies": false, "dependencies": { - "agent-base": "^4.0.1", + "agent-base": "^4.1.0", "socks": "^1.1.10" }, "deprecated": false, @@ -62,5 +62,5 @@ "scripts": { "test": "mocha --reporter spec" }, - "version": "3.0.0" + "version": "3.0.1" } diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/package.json b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/package.json index f900c0d5218..ccbc6defab4 100644 --- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/package.json +++ b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/package.json @@ -1,8 +1,8 @@ { - "_from": "make-fetch-happen@^2.4.13", - "_id": "make-fetch-happen@2.5.0", + "_from": "make-fetch-happen@^2.6.0", + "_id": "make-fetch-happen@2.6.0", "_inBundle": false, - "_integrity": "sha512-JPD5R43T02wIkcxjcmZuR7D06nB20fMR8aC9VEyYsSBXvJa5hOR/QhCxKY+5SXhy3uU5OUY/r+A6r+fJ2mFndA==", + "_integrity": "sha512-FFq0lNI0ax+n9IWzWpH8A4JdgYiAp2DDYIZ3rsaav8JDe8I+72CzK6PQW/oom15YDZpV5bYW/9INd6nIJ2ZfZw==", "_location": "/pacote/make-fetch-happen", "_phantomChildren": { "safe-buffer": "5.1.1" @@ -10,20 +10,20 @@ "_requested": { "type": "range", "registry": true, - "raw": "make-fetch-happen@^2.4.13", + "raw": "make-fetch-happen@^2.6.0", "name": "make-fetch-happen", "escapedName": "make-fetch-happen", - "rawSpec": "^2.4.13", + "rawSpec": "^2.6.0", "saveSpec": null, - "fetchSpec": "^2.4.13" + "fetchSpec": "^2.6.0" }, "_requiredBy": [ "/pacote" ], - "_resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-2.5.0.tgz", - "_shasum": "08c22d499f4f30111addba79fe87c98cf01b6bc8", - "_spec": "make-fetch-happen@^2.4.13", - "_where": "/Users/rebecca/code/npm/node_modules/pacote", + "_resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-2.6.0.tgz", + "_shasum": "8474aa52198f6b1ae4f3094c04e8370d35ea8a38", + "_spec": "make-fetch-happen@^2.6.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote", "author": { "name": "Kat Marchán", "email": "kzm@sykosomatic.org" @@ -34,16 +34,16 @@ "bundleDependencies": false, "dependencies": { "agentkeepalive": "^3.3.0", - "cacache": "^9.2.9", - "http-cache-semantics": "^3.7.3", + "cacache": "^10.0.0", + "http-cache-semantics": "^3.8.0", "http-proxy-agent": "^2.0.0", - "https-proxy-agent": "^2.0.0", + "https-proxy-agent": "^2.1.0", "lru-cache": "^4.1.1", "mississippi": "^1.2.0", - "node-fetch-npm": "^2.0.1", + "node-fetch-npm": "^2.0.2", "promise-retry": "^1.1.1", - "socks-proxy-agent": "^3.0.0", - "ssri": "^4.1.6" + "socks-proxy-agent": "^3.0.1", + "ssri": "^5.0.0" }, "deprecated": false, "description": "Opinionated, caching, retrying fetch client", @@ -93,5 +93,5 @@ "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": "2.5.0" + "version": "2.6.0" } diff --git a/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/CHANGELOG.md b/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/CHANGELOG.md index 77ce48b32bb..5f53e8fce59 100644 --- a/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/CHANGELOG.md +++ b/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/CHANGELOG.md @@ -2,6 +2,42 @@ 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="2.1.0"></a> +# [2.1.0](https://github.com/zkat/npm-pick-manifest/compare/v2.0.1...v2.1.0) (2017-10-18) + + +### Features + +* **selection:** allow manually disabling deprecation skipping ([0d239d3](https://github.com/zkat/npm-pick-manifest/commit/0d239d3)) + + + +<a name="2.0.1"></a> +## [2.0.1](https://github.com/zkat/npm-pick-manifest/compare/v2.0.0...v2.0.1) (2017-10-18) + + + +<a name="2.0.0"></a> +# [2.0.0](https://github.com/zkat/npm-pick-manifest/compare/v1.0.4...v2.0.0) (2017-10-03) + + +### Bug Fixes + +* **license:** relicense project according to npm policy (#3) ([ed743a0](https://github.com/zkat/npm-pick-manifest/commit/ed743a0)) + + +### Features + +* **selection:** Avoid matching deprecated packages if possible ([3fc6c3a](https://github.com/zkat/npm-pick-manifest/commit/3fc6c3a)) + + +### BREAKING CHANGES + +* **selection:** deprecated versions may be skipped now +* **license:** This moves the license from CC0 to ISC and properly documents the copyright as belonging to npm, Inc. + + + <a name="1.0.4"></a> ## [1.0.4](https://github.com/zkat/npm-pick-manifest/compare/v1.0.3...v1.0.4) (2017-06-29) diff --git a/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/LICENSE.md b/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/LICENSE.md index c05cb09586f..8d28acf866d 100644 --- a/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/LICENSE.md +++ b/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/LICENSE.md @@ -1,3 +1,16 @@ -To the extent possible under law, maintainers for this project have waived all copyright and related or neighboring rights to this project. +ISC License -For more information on this waiver, see: https://creativecommons.org/publicdomain/zero/1.0/ +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/pacote/node_modules/npm-pick-manifest/index.js b/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/index.js index 04e7e7f6488..133b6272345 100644 --- a/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/index.js +++ b/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/index.js @@ -13,6 +13,7 @@ function pickManifest (packument, wanted, opts) { } const distTags = packument['dist-tags'] || {} const versions = Object.keys(packument.versions || {}).filter(v => semver.valid(v, true)) + const undeprecated = versions.filter(v => !packument.versions[v].deprecated) let err if (!versions.length) { @@ -45,6 +46,9 @@ function pickManifest (packument, wanted, opts) { target = tagVersion } + if (!target && !opts.includeDeprecated) { + target = semver.maxSatisfying(undeprecated, wanted, true) + } if (!target) { target = semver.maxSatisfying(versions, wanted, true) } diff --git a/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/package.json b/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/package.json index 0e92aacd970..d06ecf6177f 100644 --- a/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/package.json +++ b/deps/npm/node_modules/pacote/node_modules/npm-pick-manifest/package.json @@ -1,26 +1,26 @@ { - "_from": "npm-pick-manifest@^1.0.4", - "_id": "npm-pick-manifest@1.0.4", + "_from": "npm-pick-manifest@^2.1.0", + "_id": "npm-pick-manifest@2.1.0", "_inBundle": false, - "_integrity": "sha512-MKxNdeyOZysPRTTbHtW0M5Fw38Jo/3ARsoGw5qjCfS+XGjvNB/Gb4qtAZUFmKPM2mVum+eX559eHvKywU856BQ==", + "_integrity": "sha512-q9zLP8cTr8xKPmMZN3naxp1k/NxVFsjxN6uWuO1tiw9gxg7wZWQ/b5UTfzD0ANw2q1lQxdLKTeCCksq+bPSgbQ==", "_location": "/pacote/npm-pick-manifest", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "npm-pick-manifest@^1.0.4", + "raw": "npm-pick-manifest@^2.1.0", "name": "npm-pick-manifest", "escapedName": "npm-pick-manifest", - "rawSpec": "^1.0.4", + "rawSpec": "^2.1.0", "saveSpec": null, - "fetchSpec": "^1.0.4" + "fetchSpec": "^2.1.0" }, "_requiredBy": [ "/pacote" ], - "_resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-1.0.4.tgz", - "_shasum": "a5ee6510c1fe7221c0bc0414e70924c14045f7e8", - "_spec": "npm-pick-manifest@^1.0.4", + "_resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-2.1.0.tgz", + "_shasum": "dc381bdd670c35d81655e1d5a94aa3dd4d87fce5", + "_spec": "npm-pick-manifest@^2.1.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/pacote", "author": { "name": "Kat Marchán", @@ -39,14 +39,14 @@ } }, "dependencies": { - "npm-package-arg": "^5.1.2", - "semver": "^5.3.0" + "npm-package-arg": "^6.0.0", + "semver": "^5.4.1" }, "deprecated": false, "description": "Resolves a matching manifest from a package metadata document according to standard npm semver resolution rules.", "devDependencies": { - "nyc": "^10.3.2", - "standard": "^9.0.2", + "nyc": "^11.2.1", + "standard": "^10.0.3", "standard-version": "^4.2.0", "tap": "^10.7.0", "weallbehave": "^1.2.0", @@ -61,7 +61,7 @@ "semver", "package manager" ], - "license": "CC0-1.0", + "license": "ISC", "main": "index.js", "name": "npm-pick-manifest", "repository": { @@ -77,5 +77,5 @@ "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.0.4" + "version": "2.1.0" } diff --git a/deps/npm/node_modules/pacote/package.json b/deps/npm/node_modules/pacote/package.json index 6050cc6241c..7e230fc18fb 100644 --- a/deps/npm/node_modules/pacote/package.json +++ b/deps/npm/node_modules/pacote/package.json @@ -1,37 +1,37 @@ { - "_from": "pacote@latest", - "_id": "pacote@6.0.2", + "_from": "pacote@7.0.2", + "_id": "pacote@7.0.2", "_inBundle": false, - "_integrity": "sha512-PsnzsjS/rNjY0fojY8QNy6Zq1XvTA3X0vhtfNtExAf1h/746f4MaSatHEU6jiAb9yqvzdThnFGAy+t5VtKwgjg==", + "_integrity": "sha512-cTiugiG2ujDcqDtYtJ3doDrS6E3eU0bhuYAHhMTWgBezrhoqTEjc0axSBpbjw4QQkNT5AGRF15Mj2tF2HuBz7w==", "_location": "/pacote", "_phantomChildren": { - "cacache": "9.2.9", + "cacache": "10.0.1", "lru-cache": "4.1.1", "mississippi": "1.3.0", - "npm-package-arg": "5.1.2", + "npm-package-arg": "6.0.0", "retry": "0.10.1", "safe-buffer": "5.1.1", "semver": "5.4.1", - "ssri": "4.1.6" + "ssri": "5.0.0" }, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "pacote@latest", + "raw": "pacote@7.0.2", "name": "pacote", "escapedName": "pacote", - "rawSpec": "latest", + "rawSpec": "7.0.2", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "7.0.2" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/pacote/-/pacote-6.0.2.tgz", - "_shasum": "c618a3c08493aeb390e79aa73f95af331ffc6171", - "_spec": "pacote@latest", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/pacote/-/pacote-7.0.2.tgz", + "_shasum": "c60610c994b8ecdd8fbb7c6a5c0bcd8de52f829c", + "_spec": "pacote@7.0.2", + "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Kat Marchán", "email": "kzm@sykosomatic.org" @@ -51,25 +51,26 @@ } ], "dependencies": { - "bluebird": "^3.5.0", - "cacache": "^9.2.9", + "bluebird": "^3.5.1", + "cacache": "^10.0.1", + "get-stream": "^3.0.0", "glob": "^7.1.2", "lru-cache": "^4.1.1", - "make-fetch-happen": "^2.4.13", + "make-fetch-happen": "^2.6.0", "minimatch": "^3.0.4", "mississippi": "^1.2.0", "normalize-package-data": "^2.4.0", - "npm-package-arg": "^5.1.2", - "npm-packlist": "^1.1.6", - "npm-pick-manifest": "^1.0.4", + "npm-package-arg": "^6.0.0", + "npm-packlist": "^1.1.10", + "npm-pick-manifest": "^2.1.0", "osenv": "^0.1.4", "promise-inflight": "^1.0.1", "promise-retry": "^1.1.1", "protoduck": "^4.0.0", "safe-buffer": "^5.1.1", "semver": "^5.4.1", - "ssri": "^4.1.6", - "tar": "^4.0.0", + "ssri": "^5.0.0", + "tar": "^4.0.2", "unique-filename": "^1.1.0", "which": "^1.3.0" }, @@ -77,11 +78,11 @@ "description": "JavaScript package downloader", "devDependencies": { "mkdirp": "^0.5.1", - "nock": "^9.0.14", + "nock": "^9.0.22", "npmlog": "^4.1.2", - "nyc": "^11.1.0", + "nyc": "^11.2.1", "require-inject": "^1.4.2", - "rimraf": "^2.5.4", + "rimraf": "^2.6.2", "standard": "^10.0.3", "standard-version": "^4.2.0", "tacks": "^1.2.6", @@ -100,7 +101,7 @@ "npm", "git" ], - "license": "CC0-1.0", + "license": "MIT", "main": "index.js", "name": "pacote", "repository": { @@ -117,5 +118,5 @@ "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": "6.0.2" + "version": "7.0.2" } diff --git a/deps/npm/node_modules/pacote/prefetch.js b/deps/npm/node_modules/pacote/prefetch.js index 60ddd624da7..d17725993f9 100644 --- a/deps/npm/node_modules/pacote/prefetch.js +++ b/deps/npm/node_modules/pacote/prefetch.js @@ -10,7 +10,8 @@ const npa = require('npm-package-arg') module.exports = prefetch function prefetch (spec, opts) { opts = optCheck(opts) - spec = typeof spec === 'string' ? npa(spec, opts.where) : spec + spec = npa(spec, opts.where) + opts.log.warn('prefetch', 'pacote.prefetch() is deprecated. Please use pacote.tarball() instead.') const startTime = Date.now() if (!opts.cache) { opts.log.info('prefetch', 'skipping prefetch: no cache provided') diff --git a/deps/npm/node_modules/pacote/tarball.js b/deps/npm/node_modules/pacote/tarball.js new file mode 100644 index 00000000000..f1f3ed93428 --- /dev/null +++ b/deps/npm/node_modules/pacote/tarball.js @@ -0,0 +1,95 @@ +'use strict' + +const BB = require('bluebird') + +const cacache = require('cacache') +const fs = require('fs') +const getStream = require('get-stream') +const mkdirp = BB.promisify(require('mkdirp')) +const npa = require('npm-package-arg') +const optCheck = require('./lib/util/opt-check') +const path = require('path') +const pipe = BB.promisify(require('mississippi').pipe) + +module.exports = tarball +function tarball (spec, opts) { + opts = optCheck(opts) + spec = npa(spec, opts.where) + const startTime = Date.now() + if (opts.integrity && !opts.preferOnline) { + opts.log.silly('tarball', 'checking if', opts.integrity, 'is already cached') + return cacache.get.byDigest(opts.cache, opts.integrity).then(data => { + if (data) { + opts.log.silly('tarball', `cached content available for ${spec} (${Date.now() - startTime}ms)`) + return data + } else { + return getStream.buffer(tarballByManifest(startTime, spec, opts)) + } + }) + } else { + opts.log.silly('tarball', `no integrity hash provided for ${spec} - fetching by manifest`) + return getStream.buffer(tarballByManifest(startTime, spec, opts)) + } +} + +module.exports.stream = tarballStream +function tarballStream (spec, opts) { + opts = optCheck(opts) + spec = npa(spec, opts.where) + const startTime = Date.now() + if (opts.integrity && !opts.preferOnline) { + opts.log.silly('tarball', 'checking if', opts.integrity, 'is already cached') + return cacache.get.hasContent(opts.cache, opts.integrity).then(info => { + if (info) { + opts.log.silly('tarball', `cached content available for ${spec} (${Date.now() - startTime}ms)`) + return cacache.get.stream.byDigest(opts.cache, opts.integrity, opts) + } else { + return tarballByManifest(startTime, spec, opts) + } + }) + } else { + opts.log.silly('tarball', `no integrity hash provided for ${spec} - fetching by manifest`) + return tarballByManifest(startTime, spec, opts) + } +} + +module.exports.toFile = tarballToFile +function tarballToFile (spec, dest, opts) { + opts = optCheck(opts) + spec = npa(spec, opts.where) + const startTime = Date.now() + return mkdirp(path.dirname(dest)).then(() => { + if (opts.integrity && !opts.preferOnline) { + opts.log.silly('tarball', 'checking if', opts.integrity, 'is already cached') + return cacache.get.copy.byDigest(opts.cache, opts.integrity, dest, opts) + .then(() => { + opts.log.silly('tarball', `cached content for ${spec} copied (${Date.now() - startTime}ms)`) + }, err => { + if (err.code === 'ENOENT') { + return pipe( + tarballByManifest(startTime, spec, opts), + fs.createWriteStream(dest) + ) + } else { + throw err + } + }) + } else { + opts.log.silly('tarball', `no integrity hash provided for ${spec} - fetching by manifest`) + return pipe( + tarballByManifest(startTime, spec, opts), + fs.createWriteStream(dest) + ) + } + }) +} + +let fetch +function tarballByManifest (start, spec, opts) { + if (!fetch) { + fetch = require('./lib/fetch') + } + return fetch.tarball(spec, opts).on('end', () => { + opts.log.silly('tarball', `${spec} done in ${Date.now() - start}ms`) + }) +} diff --git a/deps/npm/node_modules/query-string/index.js b/deps/npm/node_modules/query-string/index.js index 37c485377cb..7da4fead5f4 100644 --- a/deps/npm/node_modules/query-string/index.js +++ b/deps/npm/node_modules/query-string/index.js @@ -114,7 +114,11 @@ function keysSorter(input) { } exports.extract = function (str) { - return str.split('?')[1] || ''; + var queryStart = str.indexOf('?'); + if (queryStart === -1) { + return ''; + } + return str.slice(queryStart + 1); }; exports.parse = function (str, opts) { @@ -130,7 +134,7 @@ exports.parse = function (str, opts) { return ret; } - str = str.trim().replace(/^(\?|#|&)/, ''); + str = str.trim().replace(/^[?#&]/, ''); if (!str) { return ret; diff --git a/deps/npm/node_modules/query-string/package.json b/deps/npm/node_modules/query-string/package.json index 861634e96c5..00bf7c58dfb 100644 --- a/deps/npm/node_modules/query-string/package.json +++ b/deps/npm/node_modules/query-string/package.json @@ -1,28 +1,28 @@ { - "_from": "query-string", - "_id": "query-string@5.0.0", + "_from": "query-string@5.0.1", + "_id": "query-string@5.0.1", "_inBundle": false, - "_integrity": "sha1-+99wBLTSr/eS+YcZgbeieU9VWUc=", + "_integrity": "sha512-aM+MkQClojlNiKkO09tiN2Fv8jM/L7GWIjG2liWeKljlOdOPNWr+bW3KQ+w5V/uKprpezC7fAsAMsJtJ+2rLKA==", "_location": "/query-string", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "query-string", + "raw": "query-string@5.0.1", "name": "query-string", "escapedName": "query-string", - "rawSpec": "", + "rawSpec": "5.0.1", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "5.0.1" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/query-string/-/query-string-5.0.0.tgz", - "_shasum": "fbdf7004b4d2aff792f9871981b7a2794f555947", - "_spec": "query-string", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/query-string/-/query-string-5.0.1.tgz", + "_shasum": "6e2b86fe0e08aef682ecbe86e85834765402bd88", + "_spec": "query-string@5.0.1", + "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -74,5 +74,5 @@ "scripts": { "test": "xo && ava" }, - "version": "5.0.0" + "version": "5.0.1" } diff --git a/deps/npm/node_modules/ssri/CHANGELOG.md b/deps/npm/node_modules/ssri/CHANGELOG.md index c1136092e33..7ae2b000dce 100644 --- a/deps/npm/node_modules/ssri/CHANGELOG.md +++ b/deps/npm/node_modules/ssri/CHANGELOG.md @@ -2,6 +2,21 @@ 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/ssri/compare/v4.1.6...v5.0.0) (2017-10-23) + + +### Features + +* **license:** relicense to ISC (#9) ([c82983a](https://github.com/zkat/ssri/commit/c82983a)) + + +### BREAKING CHANGES + +* **license:** the license has been changed from CC0-1.0 to ISC. + + + <a name="4.1.6"></a> ## [4.1.6](https://github.com/zkat/ssri/compare/v4.1.5...v4.1.6) (2017-06-07) diff --git a/deps/npm/node_modules/ssri/LICENSE.md b/deps/npm/node_modules/ssri/LICENSE.md index c05cb09586f..8d28acf866d 100644 --- a/deps/npm/node_modules/ssri/LICENSE.md +++ b/deps/npm/node_modules/ssri/LICENSE.md @@ -1,3 +1,16 @@ -To the extent possible under law, maintainers for this project have waived all copyright and related or neighboring rights to this project. +ISC License -For more information on this waiver, see: https://creativecommons.org/publicdomain/zero/1.0/ +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/ssri/package.json b/deps/npm/node_modules/ssri/package.json index 0279143004f..24722ee8213 100644 --- a/deps/npm/node_modules/ssri/package.json +++ b/deps/npm/node_modules/ssri/package.json @@ -1,31 +1,27 @@ { - "_from": "ssri@4.1.6", - "_id": "ssri@4.1.6", + "_from": "ssri@5.0.0", + "_id": "ssri@5.0.0", "_inBundle": false, - "_integrity": "sha512-WUbCdgSAMQjTFZRWvSPpauryvREEA+Krn19rx67UlJEJx/M192ZHxMmJXjZ4tkdFm+Sb0SXGlENeQVlA5wY7kA==", + "_integrity": "sha512-728D4yoQcQm1ooZvSbywLkV1RjfITZXh0oWrhM/lnsx3nAHx7LsRGJWB/YyvoceAYRq98xqbstiN4JBv1/wNHg==", "_location": "/ssri", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "ssri@4.1.6", + "raw": "ssri@5.0.0", "name": "ssri", "escapedName": "ssri", - "rawSpec": "4.1.6", + "rawSpec": "5.0.0", "saveSpec": null, - "fetchSpec": "4.1.6" + "fetchSpec": "5.0.0" }, "_requiredBy": [ "#USER", - "/", - "/cacache", - "/npm-registry-client", - "/pacote", - "/pacote/make-fetch-happen" + "/" ], - "_resolved": "https://registry.npmjs.org/ssri/-/ssri-4.1.6.tgz", - "_shasum": "0cb49b6ac84457e7bdd466cb730c3cb623e9a25b", - "_spec": "ssri@4.1.6", + "_resolved": "https://registry.npmjs.org/ssri/-/ssri-5.0.0.tgz", + "_shasum": "13c19390b606c821f2a10d02b351c1729b94d8cf", + "_spec": "ssri@5.0.0", "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Kat Marchán", @@ -74,7 +70,7 @@ "sri generator", "html" ], - "license": "CC0-1.0", + "license": "ISC", "main": "index.js", "name": "ssri", "repository": { @@ -90,5 +86,5 @@ "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.1.6" + "version": "5.0.0" } diff --git a/deps/npm/node_modules/tar/package.json b/deps/npm/node_modules/tar/package.json index 4d6683463a6..d68b63a66d4 100644 --- a/deps/npm/node_modules/tar/package.json +++ b/deps/npm/node_modules/tar/package.json @@ -1,29 +1,29 @@ { - "_from": "tar@latest", - "_id": "tar@4.0.1", + "_from": "tar@4.0.2", + "_id": "tar@4.0.2", "_inBundle": false, - "_integrity": "sha512-XBpU+/azPOMvE5m2Tn7Sl6U1ahpGfe77LkdrAlFilwrgHZsR+2iy0l8klQtfJNM+DACZO2Xrw10MTyQRB4du5A==", + "_integrity": "sha512-4lWN4uAEWzw8aHyBUx9HWXvH3vIFEhOyvN22HfBzWpE07HaTBXM8ttSeCQpswRo5On4q3nmmYmk7Tomn0uhUaw==", "_location": "/tar", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "tar@latest", + "raw": "tar@4.0.2", "name": "tar", "escapedName": "tar", - "rawSpec": "latest", + "rawSpec": "4.0.2", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "4.0.2" }, "_requiredBy": [ "#USER", "/", "/pacote" ], - "_resolved": "https://registry.npmjs.org/tar/-/tar-4.0.1.tgz", - "_shasum": "3f5b2e5289db30c2abe4c960f43d0d9fff96aaf0", - "_spec": "tar@latest", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/tar/-/tar-4.0.2.tgz", + "_shasum": "e8e22bf3eec330e5c616d415a698395e294e8fad", + "_spec": "tar@4.0.2", + "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -35,8 +35,8 @@ "bundleDependencies": false, "dependencies": { "chownr": "^1.0.1", - "minipass": "^2.0.2", - "minizlib": "^1.0.3", + "minipass": "^2.2.1", + "minizlib": "^1.0.4", "mkdirp": "^0.5.0", "yallist": "^3.0.2" }, @@ -47,9 +47,9 @@ "end-of-stream": "^1.4.0", "events-to-array": "^1.1.2", "mutate-fs": "^1.1.0", - "rimraf": "1.x", - "tap": "^10.3.3", - "tar-fs": "^1.15.2", + "rimraf": "^2.6.2", + "tap": "^10.7.2", + "tar-fs": "^1.16.0", "tar-stream": "^1.5.2" }, "engines": { @@ -74,5 +74,5 @@ "preversion": "npm test", "test": "tap test/*.js --100 -J --coverage-report=text" }, - "version": "4.0.1" + "version": "4.0.2" } diff --git a/deps/npm/node_modules/update-notifier/index.js b/deps/npm/node_modules/update-notifier/index.js index a5fff01036c..58f2459036b 100644 --- a/deps/npm/node_modules/update-notifier/index.js +++ b/deps/npm/node_modules/update-notifier/index.js @@ -9,6 +9,7 @@ const chalk = importLazy('chalk'); const semverDiff = importLazy('semver-diff'); const latestVersion = importLazy('latest-version'); const isNpm = importLazy('is-npm'); +const isInstalledGlobally = importLazy('is-installed-globally'); const boxen = importLazy('boxen'); const xdgBasedir = importLazy('xdg-basedir'); const ONE_DAY = 1000 * 60 * 60 * 24; @@ -109,7 +110,7 @@ class UpdateNotifier { return this; } - opts = Object.assign({isGlobal: true}, opts); + opts = Object.assign({isGlobal: isInstalledGlobally()}, opts); opts.message = opts.message || 'Update available ' + chalk().dim(this.update.current) + chalk().reset(' → ') + chalk().green(this.update.latest) + ' \nRun ' + chalk().cyan('npm i ' + (opts.isGlobal ? '-g ' : '') + this.packageName) + ' to update'; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/index.js index 2233e3d7b00..0fe96a5a442 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/index.js +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/index.js @@ -118,7 +118,7 @@ module.exports = (text, opts) => { const padWidth = (columns - contentWidth) / 2; marginLeft = PAD.repeat(padWidth); } else if (opts.float === 'right') { - const padWidth = Math.max(columns - contentWidth - 2, 0); + const padWidth = Math.max(columns - contentWidth - margin.right - 2, 0); marginLeft = PAD.repeat(padWidth); } diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/license b/deps/npm/node_modules/update-notifier/node_modules/boxen/license index 654d0bfe943..e7af2f77107 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/license +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +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 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. +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/update-notifier/node_modules/boxen/node_modules/string-width/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/index.js index 1f8a1f11342..bbc49d29b15 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/index.js +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/index.js @@ -7,10 +7,10 @@ module.exports = str => { return 0; } - let width = 0; - str = stripAnsi(str); + let width = 0; + for (let i = 0; i < str.length; i++) { const code = str.codePointAt(i); @@ -19,16 +19,17 @@ module.exports = str => { continue; } + // Ignore combining characters + if (code >= 0x300 && code <= 0x36F) { + continue; + } + // Surrogates - if (code >= 0x10000) { + if (code > 0xFFFF) { i++; } - if (isFullwidthCodePoint(code)) { - width += 2; - } else { - width++; - } + width += isFullwidthCodePoint(code) ? 2 : 1; } return width; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/node_modules/strip-ansi/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/node_modules/strip-ansi/index.js deleted file mode 100644 index 96e0292c8e2..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/node_modules/strip-ansi/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -const ansiRegex = require('ansi-regex'); - -module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/node_modules/strip-ansi/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/node_modules/strip-ansi/package.json deleted file mode 100644 index a40c82aab27..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "_from": "strip-ansi@^4.0.0", - "_id": "strip-ansi@4.0.0", - "_inBundle": false, - "_integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "_location": "/update-notifier/boxen/string-width/strip-ansi", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "strip-ansi@^4.0.0", - "name": "strip-ansi", - "escapedName": "strip-ansi", - "rawSpec": "^4.0.0", - "saveSpec": null, - "fetchSpec": "^4.0.0" - }, - "_requiredBy": [ - "/update-notifier/boxen/string-width" - ], - "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "_shasum": "a8479022eb1ac368a871389b635262c505ee368f", - "_spec": "strip-ansi@^4.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/strip-ansi/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "deprecated": false, - "description": "Strip ANSI escape codes", - "devDependencies": { - "ava": "*", - "xo": "*" - }, - "engines": { - "node": ">=4" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/chalk/strip-ansi#readme", - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "name": "strip-ansi", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/strip-ansi.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "4.0.0" -} diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/node_modules/strip-ansi/readme.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/node_modules/strip-ansi/readme.md deleted file mode 100644 index dc76f0cb1a0..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/node_modules/strip-ansi/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) - -> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install strip-ansi -``` - - -## Usage - -```js -const stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' -``` - - -## Related - -- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module -- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes -- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - - -## License - -MIT diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/package.json index f65eded9c58..52f250897c5 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/string-width/package.json @@ -1,8 +1,8 @@ { "_from": "string-width@^2.0.0", - "_id": "string-width@2.1.0", + "_id": "string-width@2.1.1", "_inBundle": false, - "_integrity": "sha1-AwZkVh/BRslCPsfZeP4kV0N/5tA=", + "_integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "_location": "/update-notifier/boxen/string-width", "_phantomChildren": {}, "_requested": { @@ -19,10 +19,10 @@ "/update-notifier/boxen", "/update-notifier/boxen/ansi-align" ], - "_resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.0.tgz", - "_shasum": "030664561fc146c9423ec7d978fe2457437fe6d0", + "_resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "_shasum": "ab93f27a8dc13d28cac815c462143a6d9012ae9e", "_spec": "string-width@^2.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/update-notifier/node_modules/boxen", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -84,5 +84,5 @@ "scripts": { "test": "xo && ava" }, - "version": "2.1.0" + "version": "2.1.1" } diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/index.js index c6974e2e343..95e410df26a 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/index.js +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/index.js @@ -20,7 +20,7 @@ module.exports = () => { return create(stderr.columns, stderr.rows); } - // these values are static, so not the first choice + // These values are static, so not the first choice if (env.COLUMNS && env.LINES) { return create(env.COLUMNS, env.LINES); } @@ -28,7 +28,7 @@ module.exports = () => { if (process.platform === 'win32') { try { // Binary: https://github.com/sindresorhus/win-term-size - const size = execa.sync(path.join(__dirname, 'vendor/win-term-size.exe')).stdout.split(/\r?\n/); + const size = execa.sync(path.join(__dirname, 'vendor/windows/term-size.exe')).stdout.split(/\r?\n/); if (size.length === 2) { return create(size[0], size[1]); @@ -37,8 +37,8 @@ module.exports = () => { } else { if (process.platform === 'darwin') { try { - // Binary is from https://www.xquartz.org - const size = execa.shellSync(path.join(__dirname, 'vendor/resize'), ['-u']).stdout.match(/\d+/g); + // Binary: https://github.com/sindresorhus/macos-term-size + const size = execa.shellSync(path.join(__dirname, 'vendor/macos/term-size')).stdout.split(/\r?\n/); if (size.length === 2) { return create(size[0], size[1]); diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/index.js index 5f3714a084b..74ba8ee2de8 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/index.js +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/index.js @@ -1,53 +1,64 @@ 'use strict'; -var childProcess = require('child_process'); -var crossSpawnAsync = require('cross-spawn-async'); -var stripEof = require('strip-eof'); -var objectAssign = require('object-assign'); -var npmRunPath = require('npm-run-path'); -var isStream = require('is-stream'); -var pathKey = require('path-key')(); -var TEN_MEBIBYTE = 1024 * 1024 * 10; +const childProcess = require('child_process'); +const util = require('util'); +const crossSpawn = require('cross-spawn'); +const stripEof = require('strip-eof'); +const npmRunPath = require('npm-run-path'); +const isStream = require('is-stream'); +const _getStream = require('get-stream'); +const pFinally = require('p-finally'); +const onExit = require('signal-exit'); +const errname = require('./lib/errname'); +const stdio = require('./lib/stdio'); + +const TEN_MEGABYTES = 1000 * 1000 * 10; function handleArgs(cmd, args, opts) { - var parsed; + let parsed; + + if (opts && opts.env && opts.extendEnv !== false) { + opts.env = Object.assign({}, process.env, opts.env); + } if (opts && opts.__winShell === true) { delete opts.__winShell; parsed = { command: cmd, - args: args, + args, options: opts, file: cmd, original: cmd }; } else { - parsed = crossSpawnAsync._parse(cmd, args, opts); + parsed = crossSpawn._parse(cmd, args, opts); } - opts = objectAssign({ - maxBuffer: TEN_MEBIBYTE, + opts = Object.assign({ + maxBuffer: TEN_MEGABYTES, stripEof: true, preferLocal: true, - encoding: 'utf8' + localDir: parsed.options.cwd || process.cwd(), + encoding: 'utf8', + reject: true, + cleanup: true }, parsed.options); + opts.stdio = stdio(opts); + if (opts.preferLocal) { - opts.env = objectAssign({}, opts.env || process.env); - opts.env[pathKey] = npmRunPath({ - cwd: opts.cwd, - path: opts.env[pathKey] - }); + opts.env = npmRunPath.env(Object.assign({}, opts, {cwd: opts.localDir})); } return { cmd: parsed.command, args: parsed.args, - opts: opts + opts, + parsed }; } function handleInput(spawned, opts) { - var input = opts.input; + const input = opts.input; if (input === null || input === undefined) { return; @@ -61,7 +72,7 @@ function handleInput(spawned, opts) { } function handleOutput(opts, val) { - if (opts.stripEof) { + if (val && opts.stripEof) { val = stripEof(val); } @@ -69,54 +80,193 @@ function handleOutput(opts, val) { } function handleShell(fn, cmd, opts) { - var file; - var args; + let file = '/bin/sh'; + let args = ['-c', cmd]; - opts = objectAssign({}, opts); + opts = Object.assign({}, opts); if (process.platform === 'win32') { opts.__winShell = true; file = process.env.comspec || 'cmd.exe'; - args = ['/s', '/c', '"' + cmd + '"']; + args = ['/s', '/c', `"${cmd}"`]; opts.windowsVerbatimArguments = true; - } else { - file = '/bin/sh'; - args = ['-c', cmd]; } if (opts.shell) { file = opts.shell; + delete opts.shell; } return fn(file, args, opts); } -module.exports = function (cmd, args, opts) { - var spawned; +function getStream(process, stream, encoding, maxBuffer) { + if (!process[stream]) { + return null; + } - var promise = new Promise(function (resolve, reject) { - var parsed = handleArgs(cmd, args, opts); + let ret; - spawned = childProcess.execFile(parsed.cmd, parsed.args, parsed.opts, function (err, stdout, stderr) { - if (err) { - err.stdout = stdout; - err.stderr = stderr; - err.message += stdout; - reject(err); - return; - } + if (encoding) { + ret = _getStream(process[stream], { + encoding, + maxBuffer + }); + } else { + ret = _getStream.buffer(process[stream], {maxBuffer}); + } - resolve({ - stdout: handleOutput(parsed.opts, stdout), - stderr: handleOutput(parsed.opts, stderr) - }); + return ret.catch(err => { + err.stream = stream; + err.message = `${stream} ${err.message}`; + throw err; + }); +} + +module.exports = (cmd, args, opts) => { + let joinedCmd = cmd; + + if (Array.isArray(args) && args.length > 0) { + joinedCmd += ' ' + args.join(' '); + } + + const parsed = handleArgs(cmd, args, opts); + const encoding = parsed.opts.encoding; + const maxBuffer = parsed.opts.maxBuffer; + + let spawned; + try { + spawned = childProcess.spawn(parsed.cmd, parsed.args, parsed.opts); + } catch (err) { + return Promise.reject(err); + } + + let removeExitHandler; + if (parsed.opts.cleanup) { + removeExitHandler = onExit(() => { + spawned.kill(); + }); + } + + let timeoutId = null; + let timedOut = false; + + const cleanupTimeout = () => { + if (timeoutId) { + clearTimeout(timeoutId); + timeoutId = null; + } + }; + + if (parsed.opts.timeout > 0) { + timeoutId = setTimeout(() => { + timeoutId = null; + timedOut = true; + spawned.kill(parsed.opts.killSignal); + }, parsed.opts.timeout); + } + + const processDone = new Promise(resolve => { + spawned.on('exit', (code, signal) => { + cleanupTimeout(); + resolve({code, signal}); }); - crossSpawnAsync._enoent.hookChildProcess(spawned, parsed); + spawned.on('error', err => { + cleanupTimeout(); + resolve({err}); + }); - handleInput(spawned, parsed.opts); + if (spawned.stdin) { + spawned.stdin.on('error', err => { + cleanupTimeout(); + resolve({err}); + }); + } }); + function destroy() { + if (spawned.stdout) { + spawned.stdout.destroy(); + } + + if (spawned.stderr) { + spawned.stderr.destroy(); + } + } + + const promise = pFinally(Promise.all([ + processDone, + getStream(spawned, 'stdout', encoding, maxBuffer), + getStream(spawned, 'stderr', encoding, maxBuffer) + ]).then(arr => { + const result = arr[0]; + const stdout = arr[1]; + const stderr = arr[2]; + + let err = result.err; + const code = result.code; + const signal = result.signal; + + if (removeExitHandler) { + removeExitHandler(); + } + + if (err || code !== 0 || signal !== null) { + if (!err) { + let output = ''; + + if (Array.isArray(parsed.opts.stdio)) { + if (parsed.opts.stdio[2] !== 'inherit') { + output += output.length > 0 ? stderr : `\n${stderr}`; + } + + if (parsed.opts.stdio[1] !== 'inherit') { + output += `\n${stdout}`; + } + } else if (parsed.opts.stdio !== 'inherit') { + output = `\n${stderr}${stdout}`; + } + + err = new Error(`Command failed: ${joinedCmd}${output}`); + err.code = code < 0 ? errname(code) : code; + } + + // TODO: missing some timeout logic for killed + // https://github.com/nodejs/node/blob/master/lib/child_process.js#L203 + // err.killed = spawned.killed || killed; + err.killed = err.killed || spawned.killed; + + err.stdout = stdout; + err.stderr = stderr; + err.failed = true; + err.signal = signal || null; + err.cmd = joinedCmd; + err.timedOut = timedOut; + + if (!parsed.opts.reject) { + return err; + } + + throw err; + } + + return { + stdout: handleOutput(parsed.opts, stdout), + stderr: handleOutput(parsed.opts, stderr), + code: 0, + failed: false, + killed: false, + signal: null, + cmd: joinedCmd, + timedOut: false + }; + }), destroy); + + crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed); + + handleInput(spawned, parsed.opts); + spawned.then = promise.then.bind(promise); spawned.catch = promise.catch.bind(promise); @@ -125,48 +275,35 @@ module.exports = function (cmd, args, opts) { module.exports.stdout = function () { // TODO: set `stderr: 'ignore'` when that option is implemented - return module.exports.apply(null, arguments).then(function (x) { - return x.stdout; - }); + return module.exports.apply(null, arguments).then(x => x.stdout); }; module.exports.stderr = function () { // TODO: set `stdout: 'ignore'` when that option is implemented - return module.exports.apply(null, arguments).then(function (x) { - return x.stderr; - }); + return module.exports.apply(null, arguments).then(x => x.stderr); }; -module.exports.shell = function (cmd, opts) { - return handleShell(module.exports, cmd, opts); -}; - -module.exports.spawn = function (cmd, args, opts) { - var parsed = handleArgs(cmd, args, opts); - var spawned = childProcess.spawn(parsed.cmd, parsed.args, parsed.opts); +module.exports.shell = (cmd, opts) => handleShell(module.exports, cmd, opts); - crossSpawnAsync._enoent.hookChildProcess(spawned, parsed); - - return spawned; -}; - -module.exports.sync = function (cmd, args, opts) { - var parsed = handleArgs(cmd, args, opts); +module.exports.sync = (cmd, args, opts) => { + const parsed = handleArgs(cmd, args, opts); if (isStream(parsed.opts.input)) { throw new TypeError('The `input` option cannot be a stream in sync mode'); } - var result = childProcess.spawnSync(parsed.cmd, parsed.args, parsed.opts); + const result = childProcess.spawnSync(parsed.cmd, parsed.args, parsed.opts); - if (parsed.opts.stripEof) { - result.stdout = stripEof(result.stdout); - result.stderr = stripEof(result.stderr); + if (result.error || result.status !== 0) { + throw (result.error || new Error(result.stderr === '' ? result.stdout : result.stderr)); } + result.stdout = handleOutput(parsed.opts, result.stdout); + result.stderr = handleOutput(parsed.opts, result.stderr); + return result; }; -module.exports.shellSync = function (cmd, opts) { - return handleShell(module.exports.sync, cmd, opts); -}; +module.exports.shellSync = (cmd, opts) => handleShell(module.exports.sync, cmd, opts); + +module.exports.spawn = util.deprecate(module.exports, 'execa.spawn() is deprecated. Use execa() instead.'); diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/lib/errname.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/lib/errname.js new file mode 100644 index 00000000000..328f3e35da0 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/lib/errname.js @@ -0,0 +1,37 @@ +'use strict'; +// The Node team wants to deprecate `process.bind(...)`. +// https://github.com/nodejs/node/pull/2768 +// +// However, we need the 'uv' binding for errname support. +// This is a defensive wrapper around it so `execa` will not fail entirely if it stops working someday. +// +// If this ever stops working. See: https://github.com/sindresorhus/execa/issues/31#issuecomment-215939939 for another possible solution. +let uv; + +try { + uv = process.binding('uv'); + + if (typeof uv.errname !== 'function') { + throw new TypeError('uv.errname is not a function'); + } +} catch (err) { + console.error('execa/lib/errname: unable to establish process.binding(\'uv\')', err); + uv = null; +} + +function errname(uv, code) { + if (uv) { + return uv.errname(code); + } + + if (!(code < 0)) { + throw new Error('err >= 0'); + } + + return `Unknown system error ${code}`; +} + +module.exports = code => errname(uv, code); + +// Used for testing the fallback behavior +module.exports.__test__ = errname; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/lib/stdio.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/lib/stdio.js new file mode 100644 index 00000000000..a82d46838ac --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/lib/stdio.js @@ -0,0 +1,41 @@ +'use strict'; +const alias = ['stdin', 'stdout', 'stderr']; + +const hasAlias = opts => alias.some(x => Boolean(opts[x])); + +module.exports = opts => { + if (!opts) { + return null; + } + + if (opts.stdio && hasAlias(opts)) { + throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${alias.map(x => `\`${x}\``).join(', ')}`); + } + + if (typeof opts.stdio === 'string') { + return opts.stdio; + } + + const stdio = opts.stdio || []; + + if (!Array.isArray(stdio)) { + throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``); + } + + const result = []; + const len = Math.max(stdio.length, alias.length); + + for (let i = 0; i < len; i++) { + let value = null; + + if (stdio[i] !== undefined) { + value = stdio[i]; + } else if (opts[alias[i]] !== undefined) { + value = opts[alias[i]]; + } + + result[i] = value; + } + + return result; +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/license b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/license index 654d0bfe943..e7af2f77107 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/license +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +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 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. +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/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/.editorconfig b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/.editorconfig deleted file mode 100644 index 8bc4f108d54..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false - -[package.json] -indent_size = 2 diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/.npmignore b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/.npmignore deleted file mode 100644 index 93f2f731a92..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules/ -npm-debug.* -test/ diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/.travis.yml b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/.travis.yml deleted file mode 100644 index 22e38a0fdd7..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - '0.10' - - '0.12' - - '4' - - '5' - - '6' diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/README.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/README.md deleted file mode 100644 index 8b3bd69835f..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# cross-spawn-async - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Build status][appveyor-image]][appveyor-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url] - -[npm-url]:https://npmjs.org/package/cross-spawn-async -[downloads-image]:http://img.shields.io/npm/dm/cross-spawn-async.svg -[npm-image]:http://img.shields.io/npm/v/cross-spawn-async.svg -[travis-url]:https://travis-ci.org/IndigoUnited/node-cross-spawn-async -[travis-image]:http://img.shields.io/travis/IndigoUnited/node-cross-spawn-async/master.svg -[appveyor-url]:https://ci.appveyor.com/project/satazor/node-cross-spawn-async -[appveyor-image]:https://img.shields.io/appveyor/ci/satazor/node-cross-spawn-async/master.svg -[david-dm-url]:https://david-dm.org/IndigoUnited/node-cross-spawn-async -[david-dm-image]:https://img.shields.io/david/IndigoUnited/node-cross-spawn-async.svg -[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-cross-spawn-async#info=devDependencies -[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-cross-spawn-async.svg - -A cross platform solution to node's spawn. - -**This module is deprecated, use [cross-spawn](https://github.com/IndigoUnited/node-cross-spawn) instead which no longer requires a build toolchain.** - - -## Installation - -`$ npm install cross-spawn-async` - - -## Why - -Node has issues when using spawn on Windows: - -- It ignores [PATHEXT](https://github.com/joyent/node/issues/2318) -- It does not support [shebangs](http://pt.wikipedia.org/wiki/Shebang) -- It does not allow you to run `del` or `dir` -- It does not properly escape arguments with spaces or special characters - -All these issues are handled correctly by `cross-spawn-async`. -There are some known modules, such as [win-spawn](https://github.com/ForbesLindesay/win-spawn), that try to solve this but they are either broken or provide faulty escaping of shell arguments. - - -## Usage - -Exactly the same way as node's [`spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options), so it's a drop in replacement. - -```javascript -var spawn = require('cross-spawn-async'); - -var child = spawn('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' }); -``` - - -## Tests - -`$ npm test` - - -## License - -Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php). diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/appveyor.yml b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/appveyor.yml deleted file mode 100644 index 9b92823ee78..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/appveyor.yml +++ /dev/null @@ -1,30 +0,0 @@ -# appveyor file -# http://www.appveyor.com/docs/appveyor-yml - -# build version format -version: "{build}" - -# fix lineendings in Windows -init: - - git config --global core.autocrlf input - -# what combinations to test -environment: - matrix: - - nodejs_version: 0.10 - - nodejs_version: 0.12 - - nodejs_version: 4 - - nodejs_version: 5 - - nodejs_version: 6 - -# get the latest stable version of Node 0.STABLE.latest -install: - - ps: Install-Product node $env:nodejs_version - - npm install - -build: off - -test_script: - - node --version - - npm --version - - cmd: npm test --no-color diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/index.js deleted file mode 100644 index 92afff08333..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/index.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -var cp = require('child_process'); -var parse = require('./lib/parse'); -var enoent = require('./lib/enoent'); - -function spawn(command, args, options) { - var parsed; - var spawned; - - // Parse the arguments - parsed = parse(command, args, options); - - // Spawn the child process - spawned = cp.spawn(parsed.command, parsed.args, parsed.options); - - // Hook into child process "exit" event to emit an error if the command - // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 - enoent.hookChildProcess(spawned, parsed); - - return spawned; -} - -module.exports = spawn; -module.exports.spawn = spawn; -module.exports._parse = parse; -module.exports._enoent = enoent; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/lib/parse.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/lib/parse.js deleted file mode 100644 index 923e05e7af3..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/lib/parse.js +++ /dev/null @@ -1,128 +0,0 @@ -'use strict'; - -var fs = require('fs'); -var LRU = require('lru-cache'); -var resolveCommand = require('./resolveCommand'); - -var isWin = process.platform === 'win32'; -var shebangCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec - -function readShebang(command) { - var buffer; - var fd; - var match; - var shebang; - - // Check if it is in the cache first - if (shebangCache.has(command)) { - return shebangCache.get(command); - } - - // Read the first 150 bytes from the file - buffer = new Buffer(150); - - try { - fd = fs.openSync(command, 'r'); - fs.readSync(fd, buffer, 0, 150, 0); - fs.closeSync(fd); - } catch (e) { /* empty */ } - - // Check if it is a shebang - match = buffer.toString().trim().match(/#!(.+)/i); - - if (match) { - shebang = match[1].replace(/\/usr\/bin\/env\s+/i, ''); // Remove /usr/bin/env - } - - // Store the shebang in the cache - shebangCache.set(command, shebang); - - return shebang; -} - -function escapeArg(arg, quote) { - // Convert to string - arg = '' + arg; - - // If we are not going to quote the argument, - // escape shell metacharacters, including double and single quotes: - if (!quote) { - arg = arg.replace(/([\(\)%!\^<>&|;,"'\s])/g, '^$1'); - } else { - // Sequence of backslashes followed by a double quote: - // double up all the backslashes and escape the double quote - arg = arg.replace(/(\\*)"/g, '$1$1\\"'); - - // Sequence of backslashes followed by the end of the string - // (which will become a double quote later): - // double up all the backslashes - arg = arg.replace(/(\\*)$/, '$1$1'); - - // All other backslashes occur literally - - // Quote the whole thing: - arg = '"' + arg + '"'; - } - - return arg; -} - -function escapeCommand(command) { - // Do not escape if this command is not dangerous.. - // We do this so that commands like "echo" or "ifconfig" work - // Quoting them, will make them unaccessible - return /^[a-z0-9_-]+$/i.test(command) ? command : escapeArg(command, true); -} - -function parse(command, args, options) { - var shebang; - var applyQuotes; - var file; - var original; - - // Normalize arguments, similar to nodejs - if (args && !Array.isArray(args)) { - options = args; - args = null; - } - - args = args ? args.slice(0) : []; // Clone array to avoid changing the original - options = options || {}; - original = command; - - if (isWin) { - // Detect & add support for shebangs - file = resolveCommand(command); - file = file || resolveCommand(command, true); - shebang = file && readShebang(file); - - if (shebang) { - args.unshift(file); - command = shebang; - } - - // Escape command & arguments - applyQuotes = command !== 'echo'; // Do not quote arguments for the special "echo" command - command = escapeCommand(command); - args = args.map(function (arg) { - return escapeArg(arg, applyQuotes); - }); - - // Use cmd.exe - args = ['/s', '/c', '"' + command + (args.length ? ' ' + args.join(' ') : '') + '"']; - command = process.env.comspec || 'cmd.exe'; - - // Tell node's spawn that the arguments are already escaped - options.windowsVerbatimArguments = true; - } - - return { - command: command, - args: args, - options: options, - file: file, - original: original, - }; -} - -module.exports = parse; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/CHANGELOG.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/CHANGELOG.md new file mode 100644 index 00000000000..f1298a82f7b --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/CHANGELOG.md @@ -0,0 +1,6 @@ +## 5.0.0 - 2016-10-30 + +- Add support for `options.shell` +- Improve parsing of shebangs by using [`shebang-command`](https://github.com/kevva/shebang-command) module +- Refactor some code to make it more clear +- Update README caveats diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/LICENSE b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/LICENSE index e898822ad30..db5e914de1f 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/LICENSE +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015 IndigoUnited +Copyright (c) 2014 IndigoUnited Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/README.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/README.md new file mode 100644 index 00000000000..dde730df1b1 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/README.md @@ -0,0 +1,85 @@ +# cross-spawn + +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Build status][appveyor-image]][appveyor-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url] + +[npm-url]:https://npmjs.org/package/cross-spawn +[downloads-image]:http://img.shields.io/npm/dm/cross-spawn.svg +[npm-image]:http://img.shields.io/npm/v/cross-spawn.svg +[travis-url]:https://travis-ci.org/IndigoUnited/node-cross-spawn +[travis-image]:http://img.shields.io/travis/IndigoUnited/node-cross-spawn/master.svg +[appveyor-url]:https://ci.appveyor.com/project/satazor/node-cross-spawn +[appveyor-image]:https://img.shields.io/appveyor/ci/satazor/node-cross-spawn/master.svg +[david-dm-url]:https://david-dm.org/IndigoUnited/node-cross-spawn +[david-dm-image]:https://img.shields.io/david/IndigoUnited/node-cross-spawn.svg +[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-cross-spawn#info=devDependencies +[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-cross-spawn.svg + +A cross platform solution to node's spawn and spawnSync. + + +## Installation + +`$ npm install cross-spawn` + +If you are using `spawnSync` on node 0.10 or older, you will also need to install `spawn-sync`: + +`$ npm install spawn-sync` + + +## Why + +Node has issues when using spawn on Windows: + +- It ignores [PATHEXT](https://github.com/joyent/node/issues/2318) +- It does not support [shebangs](http://pt.wikipedia.org/wiki/Shebang) +- No `options.shell` support on node < v6 +- It does not allow you to run `del` or `dir` + +All these issues are handled correctly by `cross-spawn`. +There are some known modules, such as [win-spawn](https://github.com/ForbesLindesay/win-spawn), that try to solve this but they are either broken or provide faulty escaping of shell arguments. + + +## Usage + +Exactly the same way as node's [`spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) or [`spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options), so it's a drop in replacement. + + +```js +var spawn = require('cross-spawn'); + +// Spawn NPM asynchronously +var child = spawn('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' }); + +// Spawn NPM synchronously +var results = spawn.sync('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' }); +``` + + +## Caveats + +#### `options.shell` as an alternative to `cross-spawn` + +Starting from node v6, `spawn` has a `shell` option that allows you run commands from within a shell. This new option solves most of the problems that `cross-spawn` attempts to solve, but: + +- It's not supported in node < v6 +- It has no support for shebangs on Windows +- You must manually escape the command and arguments which is very error prone, specially when passing user input + +If you are using the `shell` option to spawn a command in a cross platform way, consider using `cross-spawn` instead. You have been warned. + + +#### Shebangs + +While `cross-spawn` handles shebangs on Windows, its support is limited: e.g.: it doesn't handle arguments after the path, e.g.: `#!/bin/bash -e`. + +Remember to always test your code on Windows! + + +## Tests + +`$ npm test` + + +## License + +Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php). diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/index.js new file mode 100644 index 00000000000..7814a9692dc --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/index.js @@ -0,0 +1,59 @@ +'use strict'; + +var cp = require('child_process'); +var parse = require('./lib/parse'); +var enoent = require('./lib/enoent'); + +var cpSpawnSync = cp.spawnSync; + +function spawn(command, args, options) { + var parsed; + var spawned; + + // Parse the arguments + parsed = parse(command, args, options); + + // Spawn the child process + spawned = cp.spawn(parsed.command, parsed.args, parsed.options); + + // Hook into child process "exit" event to emit an error if the command + // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 + enoent.hookChildProcess(spawned, parsed); + + return spawned; +} + +function spawnSync(command, args, options) { + var parsed; + var result; + + if (!cpSpawnSync) { + try { + cpSpawnSync = require('spawn-sync'); // eslint-disable-line global-require + } catch (ex) { + throw new Error( + 'In order to use spawnSync on node 0.10 or older, you must ' + + 'install spawn-sync:\n\n' + + ' npm install spawn-sync --save' + ); + } + } + + // Parse the arguments + parsed = parse(command, args, options); + + // Spawn the child process + result = cpSpawnSync(parsed.command, parsed.args, parsed.options); + + // Analyze if the command does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 + result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); + + return result; +} + +module.exports = spawn; +module.exports.spawn = spawn; +module.exports.sync = spawnSync; + +module.exports._parse = parse; +module.exports._enoent = enoent; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/lib/enoent.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/enoent.js index 3254833ae77..d0a193aecd9 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/lib/enoent.js +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/enoent.js @@ -1,6 +1,9 @@ 'use strict'; var isWin = process.platform === 'win32'; +var resolveCommand = require('./util/resolveCommand'); + +var isNode10 = process.version.indexOf('v0.10.') === 0; function notFoundError(command, syscall) { var err; @@ -38,9 +41,27 @@ function hookChildProcess(cp, parsed) { }; } -function verifyENOENT(status, parsed, syscall) { +function verifyENOENT(status, parsed) { if (isWin && status === 1 && !parsed.file) { - return notFoundError(parsed.original, syscall); + return notFoundError(parsed.original, 'spawn'); + } + + return null; +} + +function verifyENOENTSync(status, parsed) { + if (isWin && status === 1 && !parsed.file) { + return notFoundError(parsed.original, 'spawnSync'); + } + + // If we are in node 10, then we are using spawn-sync; if it exited + // with -1 it probably means that the command does not exist + if (isNode10 && status === -1) { + parsed.file = isWin ? parsed.file : resolveCommand(parsed.original); + + if (!parsed.file) { + return notFoundError(parsed.original, 'spawnSync'); + } } return null; @@ -48,4 +69,5 @@ function verifyENOENT(status, parsed, syscall) { module.exports.hookChildProcess = hookChildProcess; module.exports.verifyENOENT = verifyENOENT; +module.exports.verifyENOENTSync = verifyENOENTSync; module.exports.notFoundError = notFoundError; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/parse.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/parse.js new file mode 100644 index 00000000000..10a013625be --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/parse.js @@ -0,0 +1,113 @@ +'use strict'; + +var resolveCommand = require('./util/resolveCommand'); +var hasEmptyArgumentBug = require('./util/hasEmptyArgumentBug'); +var escapeArgument = require('./util/escapeArgument'); +var escapeCommand = require('./util/escapeCommand'); +var readShebang = require('./util/readShebang'); + +var isWin = process.platform === 'win32'; +var skipShellRegExp = /\.(?:com|exe)$/i; + +// Supported in Node >= 6 and >= 4.8 +var supportsShellOption = parseInt(process.version.substr(1).split('.')[0], 10) >= 6 || + parseInt(process.version.substr(1).split('.')[0], 10) === 4 && parseInt(process.version.substr(1).split('.')[1], 10) >= 8; + +function parseNonShell(parsed) { + var shebang; + var needsShell; + var applyQuotes; + + if (!isWin) { + return parsed; + } + + // Detect & add support for shebangs + parsed.file = resolveCommand(parsed.command); + parsed.file = parsed.file || resolveCommand(parsed.command, true); + shebang = parsed.file && readShebang(parsed.file); + + if (shebang) { + parsed.args.unshift(parsed.file); + parsed.command = shebang; + needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(resolveCommand(shebang) || resolveCommand(shebang, true)); + } else { + needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(parsed.file); + } + + // If a shell is required, use cmd.exe and take care of escaping everything correctly + if (needsShell) { + // Escape command & arguments + applyQuotes = (parsed.command !== 'echo'); // Do not quote arguments for the special "echo" command + parsed.command = escapeCommand(parsed.command); + parsed.args = parsed.args.map(function (arg) { + return escapeArgument(arg, applyQuotes); + }); + + // Make use of cmd.exe + parsed.args = ['/d', '/s', '/c', '"' + parsed.command + (parsed.args.length ? ' ' + parsed.args.join(' ') : '') + '"']; + parsed.command = process.env.comspec || 'cmd.exe'; + parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped + } + + return parsed; +} + +function parseShell(parsed) { + var shellCommand; + + // If node supports the shell option, there's no need to mimic its behavior + if (supportsShellOption) { + return parsed; + } + + // Mimic node shell option, see: https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335 + shellCommand = [parsed.command].concat(parsed.args).join(' '); + + if (isWin) { + parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe'; + parsed.args = ['/d', '/s', '/c', '"' + shellCommand + '"']; + parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped + } else { + if (typeof parsed.options.shell === 'string') { + parsed.command = parsed.options.shell; + } else if (process.platform === 'android') { + parsed.command = '/system/bin/sh'; + } else { + parsed.command = '/bin/sh'; + } + + parsed.args = ['-c', shellCommand]; + } + + return parsed; +} + +// ------------------------------------------------ + +function parse(command, args, options) { + var parsed; + + // Normalize arguments, similar to nodejs + if (args && !Array.isArray(args)) { + options = args; + args = null; + } + + args = args ? args.slice(0) : []; // Clone array to avoid changing the original + options = options || {}; + + // Build our parsed object + parsed = { + command: command, + args: args, + options: options, + file: undefined, + original: command, + }; + + // Delegate further parsing to shell or non-shell + return options.shell ? parseShell(parsed) : parseNonShell(parsed); +} + +module.exports = parse; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/escapeArgument.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/escapeArgument.js new file mode 100644 index 00000000000..367263f6699 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/escapeArgument.js @@ -0,0 +1,30 @@ +'use strict'; + +function escapeArgument(arg, quote) { + // Convert to string + arg = '' + arg; + + // If we are not going to quote the argument, + // escape shell metacharacters, including double and single quotes: + if (!quote) { + arg = arg.replace(/([()%!^<>&|;,"'\s])/g, '^$1'); + } else { + // Sequence of backslashes followed by a double quote: + // double up all the backslashes and escape the double quote + arg = arg.replace(/(\\*)"/g, '$1$1\\"'); + + // Sequence of backslashes followed by the end of the string + // (which will become a double quote later): + // double up all the backslashes + arg = arg.replace(/(\\*)$/, '$1$1'); + + // All other backslashes occur literally + + // Quote the whole thing: + arg = '"' + arg + '"'; + } + + return arg; +} + +module.exports = escapeArgument; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/escapeCommand.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/escapeCommand.js new file mode 100644 index 00000000000..d9c25b26566 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/escapeCommand.js @@ -0,0 +1,12 @@ +'use strict'; + +var escapeArgument = require('./escapeArgument'); + +function escapeCommand(command) { + // Do not escape if this command is not dangerous.. + // We do this so that commands like "echo" or "ifconfig" work + // Quoting them, will make them unaccessible + return /^[a-z0-9_-]+$/i.test(command) ? command : escapeArgument(command, true); +} + +module.exports = escapeCommand; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js new file mode 100644 index 00000000000..9f2eba63555 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js @@ -0,0 +1,18 @@ +'use strict'; + +// See: https://github.com/IndigoUnited/node-cross-spawn/pull/34#issuecomment-221623455 +function hasEmptyArgumentBug() { + var nodeVer; + + if (process.platform !== 'win32') { + return false; + } + + nodeVer = process.version.substr(1).split('.').map(function (num) { + return parseInt(num, 10); + }); + + return (nodeVer[0] === 0 && nodeVer[1] < 12); +} + +module.exports = hasEmptyArgumentBug(); diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/readShebang.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/readShebang.js new file mode 100644 index 00000000000..2cf3541c99b --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/readShebang.js @@ -0,0 +1,37 @@ +'use strict'; + +var fs = require('fs'); +var LRU = require('lru-cache'); +var shebangCommand = require('shebang-command'); + +var shebangCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec + +function readShebang(command) { + var buffer; + var fd; + var shebang; + + // Check if it is in the cache first + if (shebangCache.has(command)) { + return shebangCache.get(command); + } + + // Read the first 150 bytes from the file + buffer = new Buffer(150); + + try { + fd = fs.openSync(command, 'r'); + fs.readSync(fd, buffer, 0, 150, 0); + fs.closeSync(fd); + } catch (e) { /* empty */ } + + // Attempt to extract shebang (null is returned if not a shebang) + shebang = shebangCommand(buffer.toString()); + + // Store the shebang in the cache + shebangCache.set(command, shebang); + + return shebang; +} + +module.exports = readShebang; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/lib/resolveCommand.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/resolveCommand.js index 391d3d9b073..b7a94909749 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/lib/resolveCommand.js +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/lib/util/resolveCommand.js @@ -5,17 +5,10 @@ var which = require('which'); var LRU = require('lru-cache'); var commandCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec -var hasSepInPathRegExp = new RegExp(process.platform === 'win32' ? /[\/\\]/ : /\//); function resolveCommand(command, noExtension) { var resolved; - // If command looks like a file path, make it absolute to make it canonical - // and also to circuvent a bug in which, see: https://github.com/npm/node-which/issues/33 - if (hasSepInPathRegExp.test(command)) { - command = path.resolve(command); - } - noExtension = !!noExtension; resolved = commandCache.get(command + '!' + noExtension); diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/index.js new file mode 100644 index 00000000000..2de70b07426 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/index.js @@ -0,0 +1,19 @@ +'use strict'; +var shebangRegex = require('shebang-regex'); + +module.exports = function (str) { + var match = str.match(shebangRegex); + + if (!match) { + return null; + } + + var arr = match[0].replace(/#! ?/, '').split(' '); + var bin = arr[0].split('/').pop(); + var arg = arr[1]; + + return (bin === 'env' ? + arg : + bin + (arg ? ' ' + arg : '') + ); +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/license b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/license new file mode 100644 index 00000000000..0f8cf79c3c9 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Kevin Martensson <kevinmartensson@gmail.com> (github.com/kevva) + +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/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex/index.js new file mode 100644 index 00000000000..d052d2e05e6 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex/index.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = /^#!.*/; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/path-key/license b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex/license index 654d0bfe943..654d0bfe943 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/path-key/license +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex/license diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex/package.json new file mode 100644 index 00000000000..f394bdb1d6e --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex/package.json @@ -0,0 +1,64 @@ +{ + "_from": "shebang-regex@^1.0.0", + "_id": "shebang-regex@1.0.0", + "_inBundle": false, + "_integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "_location": "/update-notifier/boxen/term-size/execa/cross-spawn/shebang-command/shebang-regex", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "shebang-regex@^1.0.0", + "name": "shebang-regex", + "escapedName": "shebang-regex", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/update-notifier/boxen/term-size/execa/cross-spawn/shebang-command" + ], + "_resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "_shasum": "da42f49740c0b42db2ca9728571cb190c98efea3", + "_spec": "shebang-regex@^1.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/shebang-regex/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Regular expression for matching a shebang", + "devDependencies": { + "ava": "0.0.4" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/shebang-regex#readme", + "keywords": [ + "re", + "regex", + "regexp", + "shebang", + "match", + "test" + ], + "license": "MIT", + "name": "shebang-regex", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/shebang-regex.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.0.0" +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex/readme.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex/readme.md new file mode 100644 index 00000000000..ef75e51b5bf --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex/readme.md @@ -0,0 +1,29 @@ +# shebang-regex [![Build Status](https://travis-ci.org/sindresorhus/shebang-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/shebang-regex) + +> Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) + + +## Install + +``` +$ npm install --save shebang-regex +``` + + +## Usage + +```js +var shebangRegex = require('shebang-regex'); +var str = '#!/usr/bin/env node\nconsole.log("unicorns");'; + +shebangRegex.test(str); +//=> true + +shebangRegex.exec(str)[0]; +//=> '#!/usr/bin/env node' +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/package.json new file mode 100644 index 00000000000..6375b899394 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/package.json @@ -0,0 +1,71 @@ +{ + "_from": "shebang-command@^1.2.0", + "_id": "shebang-command@1.2.0", + "_inBundle": false, + "_integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "_location": "/update-notifier/boxen/term-size/execa/cross-spawn/shebang-command", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "shebang-command@^1.2.0", + "name": "shebang-command", + "escapedName": "shebang-command", + "rawSpec": "^1.2.0", + "saveSpec": null, + "fetchSpec": "^1.2.0" + }, + "_requiredBy": [ + "/update-notifier/boxen/term-size/execa/cross-spawn" + ], + "_resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "_shasum": "44aac65b695b03398968c39f363fee5deafdf1ea", + "_spec": "shebang-command@^1.2.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn", + "author": { + "name": "Kevin Martensson", + "email": "kevinmartensson@gmail.com", + "url": "github.com/kevva" + }, + "bugs": { + "url": "https://github.com/kevva/shebang-command/issues" + }, + "bundleDependencies": false, + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "deprecated": false, + "description": "Get the command from a shebang", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/kevva/shebang-command#readme", + "keywords": [ + "cmd", + "command", + "parse", + "shebang" + ], + "license": "MIT", + "name": "shebang-command", + "repository": { + "type": "git", + "url": "git+https://github.com/kevva/shebang-command.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.2.0", + "xo": { + "ignores": [ + "test.js" + ] + } +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/readme.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/readme.md new file mode 100644 index 00000000000..16b0be4d7d0 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/node_modules/shebang-command/readme.md @@ -0,0 +1,39 @@ +# shebang-command [![Build Status](https://travis-ci.org/kevva/shebang-command.svg?branch=master)](https://travis-ci.org/kevva/shebang-command) + +> Get the command from a shebang + + +## Install + +``` +$ npm install --save shebang-command +``` + + +## Usage + +```js +const shebangCommand = require('shebang-command'); + +shebangCommand('#!/usr/bin/env node'); +//=> 'node' + +shebangCommand('#!/bin/bash'); +//=> 'bash' +``` + + +## API + +### shebangCommand(string) + +#### string + +Type: `string` + +String containing a shebang. + + +## License + +MIT © [Kevin Martensson](http://github.com/kevva) diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/package.json index ca828c05050..d2fea962ce9 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn-async/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/cross-spawn/package.json @@ -1,43 +1,43 @@ { - "_from": "cross-spawn-async@^2.1.1", - "_id": "cross-spawn-async@2.2.5", - "_integrity": "sha1-hF/wwINKPe2dFg2sptOQkGuyiMw=", - "_location": "/update-notifier/boxen/term-size/execa/cross-spawn-async", + "_from": "cross-spawn@^5.0.1", + "_id": "cross-spawn@5.1.0", + "_inBundle": false, + "_integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "_location": "/update-notifier/boxen/term-size/execa/cross-spawn", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "cross-spawn-async@^2.1.1", - "name": "cross-spawn-async", - "escapedName": "cross-spawn-async", - "rawSpec": "^2.1.1", + "raw": "cross-spawn@^5.0.1", + "name": "cross-spawn", + "escapedName": "cross-spawn", + "rawSpec": "^5.0.1", "saveSpec": null, - "fetchSpec": "^2.1.1" + "fetchSpec": "^5.0.1" }, "_requiredBy": [ "/update-notifier/boxen/term-size/execa" ], - "_resolved": "https://registry.npmjs.org/cross-spawn-async/-/cross-spawn-async-2.2.5.tgz", - "_shasum": "845ff0c0834a3ded9d160daca6d390906bb288cc", - "_shrinkwrap": null, - "_spec": "cross-spawn-async@^2.1.1", + "_resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "_shasum": "e8bd0efee58fcff6f8f94510a0a554bbfa235449", + "_spec": "cross-spawn@^5.0.1", "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa", "author": { "name": "IndigoUnited", "email": "hello@indigounited.com", "url": "http://indigounited.com" }, - "bin": null, "bugs": { - "url": "https://github.com/IndigoUnited/node-cross-spawn-async/issues/" + "url": "https://github.com/IndigoUnited/node-cross-spawn/issues/" }, "bundleDependencies": false, "dependencies": { - "lru-cache": "^4.0.0", - "which": "^1.2.8" + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" }, "deprecated": false, - "description": "Cross platform child_process#spawn", + "description": "Cross platform child_process#spawn and child_process#spawnSync", "devDependencies": { "@satazor/eslint-config": "^3.0.0", "eslint": "^3.0.0", @@ -45,11 +45,17 @@ "glob": "^7.0.0", "mkdirp": "^0.5.1", "mocha": "^3.0.2", + "once": "^1.4.0", "rimraf": "^2.5.0" }, - "homepage": "https://github.com/IndigoUnited/node-cross-spawn-async#readme", + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/IndigoUnited/node-cross-spawn#readme", "keywords": [ "spawn", + "spawnSync", "windows", "cross", "platform", @@ -64,16 +70,14 @@ ], "license": "MIT", "main": "index.js", - "name": "cross-spawn-async", - "optionalDependencies": {}, - "peerDependencies": {}, + "name": "cross-spawn", "repository": { "type": "git", - "url": "git://github.com/IndigoUnited/node-cross-spawn-async.git" + "url": "git://github.com/IndigoUnited/node-cross-spawn.git" }, "scripts": { "lint": "eslint '{*.js,lib/**/*.js,test/**/*.js}'", "test": "node test/prepare && mocha --bail test/test" }, - "version": "2.2.5" + "version": "5.1.0" } diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/buffer-stream.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/buffer-stream.js new file mode 100644 index 00000000000..ae45d3d9e74 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/buffer-stream.js @@ -0,0 +1,51 @@ +'use strict'; +const PassThrough = require('stream').PassThrough; + +module.exports = opts => { + opts = Object.assign({}, opts); + + const array = opts.array; + let encoding = opts.encoding; + const buffer = encoding === 'buffer'; + let objectMode = false; + + if (array) { + objectMode = !(encoding || buffer); + } else { + encoding = encoding || 'utf8'; + } + + if (buffer) { + encoding = null; + } + + let len = 0; + const ret = []; + const stream = new PassThrough({objectMode}); + + if (encoding) { + stream.setEncoding(encoding); + } + + stream.on('data', chunk => { + ret.push(chunk); + + if (objectMode) { + len = ret.length; + } else { + len += chunk.length; + } + }); + + stream.getBufferedValue = () => { + if (array) { + return ret; + } + + return buffer ? Buffer.concat(ret, len) : ret.join(''); + }; + + stream.getBufferedLength = () => len; + + return stream; +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/index.js new file mode 100644 index 00000000000..2dc5ee96af2 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/index.js @@ -0,0 +1,51 @@ +'use strict'; +const bufferStream = require('./buffer-stream'); + +function getStream(inputStream, opts) { + if (!inputStream) { + return Promise.reject(new Error('Expected a stream')); + } + + opts = Object.assign({maxBuffer: Infinity}, opts); + + const maxBuffer = opts.maxBuffer; + let stream; + let clean; + + const p = new Promise((resolve, reject) => { + const error = err => { + if (err) { // null check + err.bufferedData = stream.getBufferedValue(); + } + + reject(err); + }; + + stream = bufferStream(opts); + inputStream.once('error', error); + inputStream.pipe(stream); + + stream.on('data', () => { + if (stream.getBufferedLength() > maxBuffer) { + reject(new Error('maxBuffer exceeded')); + } + }); + stream.once('error', error); + stream.on('end', resolve); + + clean = () => { + // some streams doesn't implement the `stream.Readable` interface correctly + if (inputStream.unpipe) { + inputStream.unpipe(stream); + } + }; + }); + + p.then(clean, clean); + + return p.then(() => stream.getBufferedValue()); +} + +module.exports = getStream; +module.exports.buffer = (stream, opts) => getStream(stream, Object.assign({}, opts, {encoding: 'buffer'})); +module.exports.array = (stream, opts) => getStream(stream, Object.assign({}, opts, {array: true})); diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/license b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/license index 654d0bfe943..654d0bfe943 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/license +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/license diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/package.json new file mode 100644 index 00000000000..4dd1d9caf44 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/package.json @@ -0,0 +1,80 @@ +{ + "_from": "get-stream@^3.0.0", + "_id": "get-stream@3.0.0", + "_inBundle": false, + "_integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "_location": "/update-notifier/boxen/term-size/execa/get-stream", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "get-stream@^3.0.0", + "name": "get-stream", + "escapedName": "get-stream", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/update-notifier/boxen/term-size/execa" + ], + "_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "_shasum": "8e943d1358dc37555054ecbe2edb05aa174ede14", + "_spec": "get-stream@^3.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/get-stream/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Get a stream as a string, buffer, or array", + "devDependencies": { + "ava": "*", + "into-stream": "^3.0.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js", + "buffer-stream.js" + ], + "homepage": "https://github.com/sindresorhus/get-stream#readme", + "keywords": [ + "get", + "stream", + "promise", + "concat", + "string", + "str", + "text", + "buffer", + "read", + "data", + "consume", + "readable", + "readablestream", + "array", + "object", + "obj" + ], + "license": "MIT", + "name": "get-stream", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/get-stream.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "3.0.0", + "xo": { + "esnext": true + } +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/readme.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/readme.md new file mode 100644 index 00000000000..73b188fb420 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/get-stream/readme.md @@ -0,0 +1,117 @@ +# get-stream [![Build Status](https://travis-ci.org/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stream) + +> Get a stream as a string, buffer, or array + + +## Install + +``` +$ npm install --save get-stream +``` + + +## Usage + +```js +const fs = require('fs'); +const getStream = require('get-stream'); +const stream = fs.createReadStream('unicorn.txt'); + +getStream(stream).then(str => { + console.log(str); + /* + ,,))))))));, + __)))))))))))))), + \|/ -\(((((''''((((((((. + -*-==//////(('' . `)))))), + /|\ ))| o ;-. '((((( ,(, + ( `| / ) ;))))' ,_))^;(~ + | | | ,))((((_ _____------~~~-. %,;(;(>';'~ + o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~ + ; ''''```` `: `:::|\,__,%% );`'; ~ + | _ ) / `:|`----' `-' + ______/\/~ | / / + /~;;.____/;;' / ___--,-( `;;;/ + / // _;______;'------~~~~~ /;;/\ / + // | | / ; \;;,\ + (<_ | ; /',/-----' _> + \_| ||_ //~;~~~~~~~~~ + `\_| (,~~ + \~\ + ~~ + */ +}); +``` + + +## API + +The methods returns a promise that resolves when the `end` event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode. + +### getStream(stream, [options]) + +Get the `stream` as a string. + +#### options + +##### encoding + +Type: `string`<br> +Default: `utf8` + +[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream. + +##### maxBuffer + +Type: `number`<br> +Default: `Infinity` + +Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected. + +### getStream.buffer(stream, [options]) + +Get the `stream` as a buffer. + +It honors the `maxBuffer` option as above, but it refers to byte length rather than string length. + +### getStream.array(stream, [options]) + +Get the `stream` as an array of values. + +It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen: + +- When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes). + +- When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array. + +- When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array. + + +## Errors + +If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error. + +```js +getStream(streamThatErrorsAtTheEnd('unicorn')) + .catch(err => { + console.log(err.bufferedData); + //=> 'unicorn' + }); +``` + + +## FAQ + +### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)? + +This module accepts a stream instead of being one and returns a promise instead of using a callback. The API is simpler and it only supports returning a string, buffer, or array. It doesn't have a fragile type inference. You explicitly choose what you want. And it doesn't depend on the huge `readable-stream` package. + + +## Related + +- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/index.js index 92b8d7dc3d9..56f31e47129 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/index.js +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/index.js @@ -1,14 +1,16 @@ 'use strict'; -var path = require('path'); -var pathKey = require('path-key'); +const path = require('path'); +const pathKey = require('path-key'); -module.exports = function (opts) { - opts = opts || {}; +module.exports = opts => { + opts = Object.assign({ + cwd: process.cwd(), + path: process.env[pathKey()] + }, opts); - var prev; - var pth = path.resolve(opts.cwd || '.'); - - var ret = []; + let prev; + let pth = path.resolve(opts.cwd); + const ret = []; while (prev !== pth) { ret.push(path.join(pth, 'node_modules/.bin')); @@ -19,5 +21,19 @@ module.exports = function (opts) { // ensure the running `node` binary is used ret.push(path.dirname(process.execPath)); - return ret.concat(opts.path || process.env[pathKey()]).join(path.delimiter); + return ret.concat(opts.path).join(path.delimiter); +}; + +module.exports.env = opts => { + opts = Object.assign({ + env: process.env + }, opts); + + const env = Object.assign({}, opts.env); + const path = pathKey({env}); + + opts.path = env[path]; + env[path] = module.exports(opts); + + return env; }; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/node_modules/path-key/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/node_modules/path-key/index.js new file mode 100644 index 00000000000..62c8250ab4e --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/node_modules/path-key/index.js @@ -0,0 +1,13 @@ +'use strict'; +module.exports = opts => { + opts = opts || {}; + + const env = opts.env || process.env; + const platform = opts.platform || process.platform; + + if (platform !== 'win32') { + return 'PATH'; + } + + return Object.keys(env).find(x => x.toUpperCase() === 'PATH') || 'Path'; +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/node_modules/path-key/license index 654d0bfe943..654d0bfe943 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/node_modules/path-key/license diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/path-key/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/node_modules/path-key/package.json index 9c1e20920da..75b08325d9f 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/path-key/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/node_modules/path-key/package.json @@ -1,39 +1,36 @@ { - "_from": "path-key@^1.0.0", - "_id": "path-key@1.0.0", - "_integrity": "sha1-XVPVeAGWRsDWiADbThRua9wqx68=", - "_location": "/update-notifier/boxen/term-size/execa/path-key", + "_from": "path-key@^2.0.0", + "_id": "path-key@2.0.1", + "_inBundle": false, + "_integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "_location": "/update-notifier/boxen/term-size/execa/npm-run-path/path-key", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "path-key@^1.0.0", + "raw": "path-key@^2.0.0", "name": "path-key", "escapedName": "path-key", - "rawSpec": "^1.0.0", + "rawSpec": "^2.0.0", "saveSpec": null, - "fetchSpec": "^1.0.0" + "fetchSpec": "^2.0.0" }, "_requiredBy": [ - "/update-notifier/boxen/term-size/execa", "/update-notifier/boxen/term-size/execa/npm-run-path" ], - "_resolved": "https://registry.npmjs.org/path-key/-/path-key-1.0.0.tgz", - "_shasum": "5d53d578019646c0d68800db4e146e6bdc2ac7af", - "_shrinkwrap": null, - "_spec": "path-key@^1.0.0", - "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa", + "_resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "_shasum": "411cadb574c5a140d3a4b1910d40d80cc9f40b40", + "_spec": "path-key@^2.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, - "bin": null, "bugs": { "url": "https://github.com/sindresorhus/path-key/issues" }, "bundleDependencies": false, - "dependencies": {}, "deprecated": false, "description": "Get the PATH environment variable key cross-platform", "devDependencies": { @@ -41,7 +38,7 @@ "xo": "*" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "files": [ "index.js" @@ -60,8 +57,6 @@ ], "license": "MIT", "name": "path-key", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/sindresorhus/path-key.git" @@ -69,5 +64,8 @@ "scripts": { "test": "xo && ava" }, - "version": "1.0.0" + "version": "2.0.1", + "xo": { + "esnext": true + } } diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/path-key/readme.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/node_modules/path-key/readme.md index 799e8296e1e..cb5710aace7 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/path-key/readme.md +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/node_modules/path-key/readme.md @@ -33,14 +33,14 @@ const PATH = process.env[key]; ##### env -Type: `object` +Type: `Object`<br> Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env) Use a custom environment variables object. #### platform -Type: `string` +Type: `string`<br> Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform) Get the PATH key for a specific platform. @@ -48,4 +48,4 @@ Get the PATH key for a specific platform. ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/package.json index 9b3b0430849..357c5ceaf5b 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/package.json @@ -1,39 +1,38 @@ { - "_from": "npm-run-path@^1.0.0", - "_id": "npm-run-path@1.0.0", - "_integrity": "sha1-9cMr9ZX+ga6Sfa7FLoL4sACsPI8=", + "_from": "npm-run-path@^2.0.0", + "_id": "npm-run-path@2.0.2", + "_inBundle": false, + "_integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "_location": "/update-notifier/boxen/term-size/execa/npm-run-path", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "npm-run-path@^1.0.0", + "raw": "npm-run-path@^2.0.0", "name": "npm-run-path", "escapedName": "npm-run-path", - "rawSpec": "^1.0.0", + "rawSpec": "^2.0.0", "saveSpec": null, - "fetchSpec": "^1.0.0" + "fetchSpec": "^2.0.0" }, "_requiredBy": [ "/update-notifier/boxen/term-size/execa" ], - "_resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-1.0.0.tgz", - "_shasum": "f5c32bf595fe81ae927daec52e82f8b000ac3c8f", - "_shrinkwrap": null, - "_spec": "npm-run-path@^1.0.0", + "_resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "_shasum": "35a9232dfa35d7067b4cb2ddf2357b1871536c5f", + "_spec": "npm-run-path@^2.0.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, - "bin": null, "bugs": { "url": "https://github.com/sindresorhus/npm-run-path/issues" }, "bundleDependencies": false, "dependencies": { - "path-key": "^1.0.0" + "path-key": "^2.0.0" }, "deprecated": false, "description": "Get your PATH prepended with locally installed binaries", @@ -42,7 +41,7 @@ "xo": "*" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "files": [ "index.js" @@ -64,8 +63,6 @@ ], "license": "MIT", "name": "npm-run-path", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/sindresorhus/npm-run-path.git" @@ -73,5 +70,8 @@ "scripts": { "test": "xo && ava" }, - "version": "1.0.0" + "version": "2.0.2", + "xo": { + "esnext": true + } } diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/readme.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/readme.md index c68017fdd1c..4ff4722a6ce 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/readme.md +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/npm-run-path/readme.md @@ -26,9 +26,7 @@ console.log(npmRunPath()); // `foo` is a locally installed binary childProcess.execFileSync('foo', { - env: { - PATH: npmRunPath() - } + env: npmRunPath.env() }); ``` @@ -41,19 +39,36 @@ childProcess.execFileSync('foo', { ##### cwd -Type: `string` +Type: `string`<br> Default: `process.cwd()` Working directory. ##### path -Type: `string` +Type: `string`<br> Default: [`PATH`](https://github.com/sindresorhus/path-key) PATH to be appended.<br> Set it to an empty string to exclude the default PATH. +### npmRunPath.env([options]) + +#### options + +##### cwd + +Type: `string`<br> +Default: `process.cwd()` + +Working directory. + +##### env + +Type: `Object` + +Accepts an object of environment variables, like `process.env`, and modifies the PATH using the correct [PATH key](https://github.com/sindresorhus/path-key). Use this if you're modifying the PATH for use in the `child_process` options. + ## Related @@ -63,4 +78,4 @@ Set it to an empty string to exclude the default PATH. ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/object-assign/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/object-assign/index.js deleted file mode 100644 index 0930cf8890b..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/object-assign/index.js +++ /dev/null @@ -1,90 +0,0 @@ -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - -'use strict'; -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; -}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/object-assign/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/object-assign/package.json deleted file mode 100644 index 85d97b9068f..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/object-assign/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "_from": "object-assign@^4.0.1", - "_id": "object-assign@4.1.1", - "_integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "_location": "/update-notifier/boxen/term-size/execa/object-assign", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "object-assign@^4.0.1", - "name": "object-assign", - "escapedName": "object-assign", - "rawSpec": "^4.0.1", - "saveSpec": null, - "fetchSpec": "^4.0.1" - }, - "_requiredBy": [ - "/update-notifier/boxen/term-size/execa" - ], - "_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "_shasum": "2109adc7965887cfc05cbbd442cac8bfbb360863", - "_shrinkwrap": null, - "_spec": "object-assign@^4.0.1", - "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bin": null, - "bugs": { - "url": "https://github.com/sindresorhus/object-assign/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "ES2015 `Object.assign()` ponyfill", - "devDependencies": { - "ava": "^0.16.0", - "lodash": "^4.16.4", - "matcha": "^0.7.0", - "xo": "^0.16.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/object-assign#readme", - "keywords": [ - "object", - "assign", - "extend", - "properties", - "es2015", - "ecmascript", - "harmony", - "ponyfill", - "prollyfill", - "polyfill", - "shim", - "browser" - ], - "license": "MIT", - "name": "object-assign", - "optionalDependencies": {}, - "peerDependencies": {}, - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/object-assign.git" - }, - "scripts": { - "bench": "matcha bench.js", - "test": "xo && ava" - }, - "version": "4.1.1" -} diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/object-assign/readme.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/object-assign/readme.md deleted file mode 100644 index 1be09d35c77..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/object-assign/readme.md +++ /dev/null @@ -1,61 +0,0 @@ -# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) - -> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) - - -## Use the built-in - -Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), -support `Object.assign()` :tada:. If you target only those environments, then by all -means, use `Object.assign()` instead of this package. - - -## Install - -``` -$ npm install --save object-assign -``` - - -## Usage - -```js -const objectAssign = require('object-assign'); - -objectAssign({foo: 0}, {bar: 1}); -//=> {foo: 0, bar: 1} - -// multiple sources -objectAssign({foo: 0}, {bar: 1}, {baz: 2}); -//=> {foo: 0, bar: 1, baz: 2} - -// overwrites equal keys -objectAssign({foo: 0}, {foo: 1}, {foo: 2}); -//=> {foo: 2} - -// ignores null and undefined sources -objectAssign({foo: 0}, null, {bar: 1}, undefined); -//=> {foo: 0, bar: 1} -``` - - -## API - -### objectAssign(target, [source, ...]) - -Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. - - -## Resources - -- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) - - -## Related - -- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/p-finally/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/p-finally/index.js new file mode 100644 index 00000000000..52b7b49c5f3 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/p-finally/index.js @@ -0,0 +1,15 @@ +'use strict'; +module.exports = (promise, onFinally) => { + onFinally = onFinally || (() => {}); + + return promise.then( + val => new Promise(resolve => { + resolve(onFinally()); + }).then(() => val), + err => new Promise(resolve => { + resolve(onFinally()); + }).then(() => { + throw err; + }) + ); +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/license b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/p-finally/license index 654d0bfe943..654d0bfe943 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/license +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/p-finally/license diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/p-finally/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/p-finally/package.json new file mode 100644 index 00000000000..902a8e39df4 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/p-finally/package.json @@ -0,0 +1,74 @@ +{ + "_from": "p-finally@^1.0.0", + "_id": "p-finally@1.0.0", + "_inBundle": false, + "_integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "_location": "/update-notifier/boxen/term-size/execa/p-finally", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "p-finally@^1.0.0", + "name": "p-finally", + "escapedName": "p-finally", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/update-notifier/boxen/term-size/execa" + ], + "_resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "_shasum": "3fbcfb15b899a44123b34b6dcc18b724336a2cae", + "_spec": "p-finally@^1.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/p-finally/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "`Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/p-finally#readme", + "keywords": [ + "promise", + "finally", + "handler", + "function", + "async", + "await", + "promises", + "settled", + "ponyfill", + "polyfill", + "shim", + "bluebird" + ], + "license": "MIT", + "name": "p-finally", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/p-finally.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.0.0", + "xo": { + "esnext": true + } +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/p-finally/readme.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/p-finally/readme.md new file mode 100644 index 00000000000..09ef36416b2 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/p-finally/readme.md @@ -0,0 +1,47 @@ +# p-finally [![Build Status](https://travis-ci.org/sindresorhus/p-finally.svg?branch=master)](https://travis-ci.org/sindresorhus/p-finally) + +> [`Promise#finally()`](https://github.com/tc39/proposal-promise-finally) [ponyfill](https://ponyfill.com) - Invoked when the promise is settled regardless of outcome + +Useful for cleanup. + + +## Install + +``` +$ npm install --save p-finally +``` + + +## Usage + +```js +const pFinally = require('p-finally'); + +const dir = createTempDir(); + +pFinally(write(dir), () => cleanup(dir)); +``` + + +## API + +### pFinally(promise, [onFinally]) + +Returns a `Promise`. + +#### onFinally + +Type: `Function` + +Note: Throwing or returning a rejected promise will reject `promise` with the rejection reason. + + +## Related + +- [p-try](https://github.com/sindresorhus/p-try) - `Promise#try()` ponyfill - Starts a promise chain +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/path-key/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/path-key/index.js deleted file mode 100644 index 3233661e112..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/path-key/index.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -module.exports = function (opts) { - opts = opts || {}; - - var env = opts.env || process.env; - var platform = opts.platform || process.platform; - - if (platform !== 'win32') { - return 'PATH'; - } - - return Object.keys(env).filter(function (x) { - return x.toUpperCase() === 'PATH'; - })[0] || 'Path'; -}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/CHANGELOG.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/CHANGELOG.md new file mode 100644 index 00000000000..e2f70d22503 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/CHANGELOG.md @@ -0,0 +1,27 @@ +# 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="3.0.1"></a> +## [3.0.1](https://github.com/tapjs/signal-exit/compare/v3.0.0...v3.0.1) (2016-09-08) + + +### Bug Fixes + +* do not listen on SIGBUS, SIGFPE, SIGSEGV and SIGILL ([#40](https://github.com/tapjs/signal-exit/issues/40)) ([5b105fb](https://github.com/tapjs/signal-exit/commit/5b105fb)) + + + +<a name="3.0.0"></a> +# [3.0.0](https://github.com/tapjs/signal-exit/compare/v2.1.2...v3.0.0) (2016-06-13) + + +### Bug Fixes + +* get our test suite running on Windows ([#23](https://github.com/tapjs/signal-exit/issues/23)) ([6f3eda8](https://github.com/tapjs/signal-exit/commit/6f3eda8)) +* hooking SIGPROF was interfering with profilers see [#21](https://github.com/tapjs/signal-exit/issues/21) ([#24](https://github.com/tapjs/signal-exit/issues/24)) ([1248a4c](https://github.com/tapjs/signal-exit/commit/1248a4c)) + + +### BREAKING CHANGES + +* signal-exit no longer wires into SIGPROF diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/LICENSE.txt b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/LICENSE.txt new file mode 100644 index 00000000000..eead04a1216 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/LICENSE.txt @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) 2015, Contributors + +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/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/README.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/README.md new file mode 100644 index 00000000000..8ebccabecae --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/README.md @@ -0,0 +1,40 @@ +# signal-exit + +[![Build Status](https://travis-ci.org/tapjs/signal-exit.png)](https://travis-ci.org/tapjs/signal-exit) +[![Coverage](https://coveralls.io/repos/tapjs/signal-exit/badge.svg?branch=master)](https://coveralls.io/r/tapjs/signal-exit?branch=master) +[![NPM version](https://img.shields.io/npm/v/signal-exit.svg)](https://www.npmjs.com/package/signal-exit) +[![Windows Tests](https://img.shields.io/appveyor/ci/bcoe/signal-exit/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/bcoe/signal-exit) +[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) + +When you want to fire an event no matter how a process exits: + +* reaching the end of execution. +* explicitly having `process.exit(code)` called. +* having `process.kill(pid, sig)` called. +* receiving a fatal signal from outside the process + +Use `signal-exit`. + +```js +var onExit = require('signal-exit') + +onExit(function (code, signal) { + console.log('process exited!') +}) +``` + +## API + +`var remove = onExit(function (code, signal) {}, options)` + +The return value of the function is a function that will remove the +handler. + +Note that the function *only* fires for signals if the signal would +cause the proces to exit. That is, there are no other listeners, and +it is a fatal signal. + +## Options + +* `alwaysLast`: Run this handler after any other signal or exit + handlers. This causes `process.emit` to be monkeypatched. diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/index.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/index.js new file mode 100644 index 00000000000..337f691ed23 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/index.js @@ -0,0 +1,157 @@ +// Note: since nyc uses this module to output coverage, any lines +// that are in the direct sync flow of nyc's outputCoverage are +// ignored, since we can never get coverage for them. +var assert = require('assert') +var signals = require('./signals.js') + +var EE = require('events') +/* istanbul ignore if */ +if (typeof EE !== 'function') { + EE = EE.EventEmitter +} + +var emitter +if (process.__signal_exit_emitter__) { + emitter = process.__signal_exit_emitter__ +} else { + emitter = process.__signal_exit_emitter__ = new EE() + emitter.count = 0 + emitter.emitted = {} +} + +// Because this emitter is a global, we have to check to see if a +// previous version of this library failed to enable infinite listeners. +// I know what you're about to say. But literally everything about +// signal-exit is a compromise with evil. Get used to it. +if (!emitter.infinite) { + emitter.setMaxListeners(Infinity) + emitter.infinite = true +} + +module.exports = function (cb, opts) { + assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler') + + if (loaded === false) { + load() + } + + var ev = 'exit' + if (opts && opts.alwaysLast) { + ev = 'afterexit' + } + + var remove = function () { + emitter.removeListener(ev, cb) + if (emitter.listeners('exit').length === 0 && + emitter.listeners('afterexit').length === 0) { + unload() + } + } + emitter.on(ev, cb) + + return remove +} + +module.exports.unload = unload +function unload () { + if (!loaded) { + return + } + loaded = false + + signals.forEach(function (sig) { + try { + process.removeListener(sig, sigListeners[sig]) + } catch (er) {} + }) + process.emit = originalProcessEmit + process.reallyExit = originalProcessReallyExit + emitter.count -= 1 +} + +function emit (event, code, signal) { + if (emitter.emitted[event]) { + return + } + emitter.emitted[event] = true + emitter.emit(event, code, signal) +} + +// { <signal>: <listener fn>, ... } +var sigListeners = {} +signals.forEach(function (sig) { + sigListeners[sig] = function listener () { + // If there are no other listeners, an exit is coming! + // Simplest way: remove us and then re-send the signal. + // We know that this will kill the process, so we can + // safely emit now. + var listeners = process.listeners(sig) + if (listeners.length === emitter.count) { + unload() + emit('exit', null, sig) + /* istanbul ignore next */ + emit('afterexit', null, sig) + /* istanbul ignore next */ + process.kill(process.pid, sig) + } + } +}) + +module.exports.signals = function () { + return signals +} + +module.exports.load = load + +var loaded = false + +function load () { + if (loaded) { + return + } + loaded = true + + // This is the number of onSignalExit's that are in play. + // It's important so that we can count the correct number of + // listeners on signals, and don't wait for the other one to + // handle it instead of us. + emitter.count += 1 + + signals = signals.filter(function (sig) { + try { + process.on(sig, sigListeners[sig]) + return true + } catch (er) { + return false + } + }) + + process.emit = processEmit + process.reallyExit = processReallyExit +} + +var originalProcessReallyExit = process.reallyExit +function processReallyExit (code) { + process.exitCode = code || 0 + emit('exit', process.exitCode, null) + /* istanbul ignore next */ + emit('afterexit', process.exitCode, null) + /* istanbul ignore next */ + originalProcessReallyExit.call(process, process.exitCode) +} + +var originalProcessEmit = process.emit +function processEmit (ev, arg) { + if (ev === 'exit') { + if (arg !== undefined) { + process.exitCode = arg + } + var ret = originalProcessEmit.apply(this, arguments) + emit('exit', process.exitCode, null) + /* istanbul ignore next */ + emit('afterexit', process.exitCode, null) + return ret + } else { + return originalProcessEmit.apply(this, arguments) + } +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/package.json new file mode 100644 index 00000000000..92d88ba361f --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/package.json @@ -0,0 +1,66 @@ +{ + "_from": "signal-exit@^3.0.0", + "_id": "signal-exit@3.0.2", + "_inBundle": false, + "_integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "_location": "/update-notifier/boxen/term-size/execa/signal-exit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "signal-exit@^3.0.0", + "name": "signal-exit", + "escapedName": "signal-exit", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/update-notifier/boxen/term-size/execa" + ], + "_resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "_shasum": "b5fdc08f1287ea1178628e415e25132b73646c6d", + "_spec": "signal-exit@^3.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa", + "author": { + "name": "Ben Coe", + "email": "ben@npmjs.com" + }, + "bugs": { + "url": "https://github.com/tapjs/signal-exit/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "when you want to fire an event no matter how a process exits.", + "devDependencies": { + "chai": "^3.5.0", + "coveralls": "^2.11.10", + "nyc": "^8.1.0", + "standard": "^7.1.2", + "standard-version": "^2.3.0", + "tap": "^8.0.1" + }, + "files": [ + "index.js", + "signals.js" + ], + "homepage": "https://github.com/tapjs/signal-exit", + "keywords": [ + "signal", + "exit" + ], + "license": "ISC", + "main": "index.js", + "name": "signal-exit", + "repository": { + "type": "git", + "url": "git+https://github.com/tapjs/signal-exit.git" + }, + "scripts": { + "coverage": "nyc report --reporter=text-lcov | coveralls", + "pretest": "standard", + "release": "standard-version", + "test": "tap --timeout=240 ./test/*.js --cov" + }, + "version": "3.0.2" +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/signals.js b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/signals.js new file mode 100644 index 00000000000..3bd67a8a554 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/node_modules/signal-exit/signals.js @@ -0,0 +1,53 @@ +// This is not the set of all possible signals. +// +// It IS, however, the set of all signals that trigger +// an exit on either Linux or BSD systems. Linux is a +// superset of the signal names supported on BSD, and +// the unknown signals just fail to register, so we can +// catch that easily enough. +// +// Don't bother with SIGKILL. It's uncatchable, which +// means that we can't fire any callbacks anyway. +// +// If a user does happen to register a handler on a non- +// fatal signal like SIGWINCH or something, and then +// exit, it'll end up firing `process.emit('exit')`, so +// the handler will be fired anyway. +// +// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised +// artificially, inherently leave the process in a +// state from which it is not safe to try and enter JS +// listeners. +module.exports = [ + 'SIGABRT', + 'SIGALRM', + 'SIGHUP', + 'SIGINT', + 'SIGTERM' +] + +if (process.platform !== 'win32') { + module.exports.push( + 'SIGVTALRM', + 'SIGXCPU', + 'SIGXFSZ', + 'SIGUSR2', + 'SIGTRAP', + 'SIGSYS', + 'SIGQUIT', + 'SIGIOT' + // should detect profiler and enable/disable accordingly. + // see #21 + // 'SIGPROF' + ) +} + +if (process.platform === 'linux') { + module.exports.push( + 'SIGIO', + 'SIGPOLL', + 'SIGPWR', + 'SIGSTKFLT', + 'SIGUNUSED' + ) +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/package.json index b66b7709598..08df8f3b498 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/package.json @@ -1,46 +1,46 @@ { - "_from": "execa@^0.4.0", - "_id": "execa@0.4.0", - "_integrity": "sha1-TrZGejaglfq7KXD/nV4/t7zm68M=", + "_from": "execa@^0.7.0", + "_id": "execa@0.7.0", + "_inBundle": false, + "_integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "_location": "/update-notifier/boxen/term-size/execa", "_phantomChildren": { - "lru-cache": "4.0.2", - "which": "1.2.14" + "lru-cache": "4.1.1", + "which": "1.3.0" }, "_requested": { "type": "range", "registry": true, - "raw": "execa@^0.4.0", + "raw": "execa@^0.7.0", "name": "execa", "escapedName": "execa", - "rawSpec": "^0.4.0", + "rawSpec": "^0.7.0", "saveSpec": null, - "fetchSpec": "^0.4.0" + "fetchSpec": "^0.7.0" }, "_requiredBy": [ "/update-notifier/boxen/term-size" ], - "_resolved": "https://registry.npmjs.org/execa/-/execa-0.4.0.tgz", - "_shasum": "4eb6467a36a095fabb2970ff9d5e3fb7bce6ebc3", - "_shrinkwrap": null, - "_spec": "execa@^0.4.0", + "_resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "_shasum": "944becd34cc41ee32a63a9faf27ad5a65fc59777", + "_spec": "execa@^0.7.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, - "bin": null, "bugs": { "url": "https://github.com/sindresorhus/execa/issues" }, "bundleDependencies": false, "dependencies": { - "cross-spawn-async": "^2.1.1", + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", "is-stream": "^1.1.0", - "npm-run-path": "^1.0.0", - "object-assign": "^4.0.1", - "path-key": "^1.0.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", "strip-eof": "^1.0.0" }, "deprecated": false, @@ -49,15 +49,18 @@ "ava": "*", "cat-names": "^1.0.2", "coveralls": "^2.11.9", - "get-stream": "^2.0.0", - "nyc": "^6.4.0", + "delay": "^2.0.0", + "is-running": "^2.0.0", + "nyc": "^11.0.2", + "tempfile": "^2.0.0", "xo": "*" }, "engines": { - "node": ">=0.12" + "node": ">=4" }, "files": [ - "index.js" + "index.js", + "lib" ], "homepage": "https://github.com/sindresorhus/execa#readme", "keywords": [ @@ -86,15 +89,23 @@ } ], "name": "execa", - "optionalDependencies": {}, - "peerDependencies": {}, + "nyc": { + "reporter": [ + "text", + "lcov" + ], + "exclude": [ + "**/fixtures/**", + "**/test.js", + "**/test/**" + ] + }, "repository": { "type": "git", "url": "git+https://github.com/sindresorhus/execa.git" }, "scripts": { - "coveralls": "nyc report --reporter=text-lcov | coveralls", "test": "xo && nyc ava" }, - "version": "0.4.0" + "version": "0.7.0" } diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/readme.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/readme.md index 1231e6d8d72..18c808aa690 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/readme.md +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/node_modules/execa/readme.md @@ -8,9 +8,10 @@ - Promise interface. - [Strips EOF](https://github.com/sindresorhus/strip-eof) from the output so you don't have to `stdout.trim()`. - Supports [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) binaries cross-platform. -- [Improved Windows support.](https://github.com/IndigoUnited/node-cross-spawn-async#why) +- [Improved Windows support.](https://github.com/IndigoUnited/node-cross-spawn#why) - Higher max buffer. 10 MB instead of 200 KB. - [Executes locally installed binaries by name.](#preferlocal) +- [Cleans up spawned processes when the parent process dies.](#cleanup) ## Install @@ -30,6 +31,9 @@ execa('echo', ['unicorns']).then(result => { //=> 'unicorns' }); +// pipe the child process stdout to the current stdout +execa('echo', ['unicorns']).stdout.pipe(process.stdout); + execa.shell('echo unicorns').then(result => { console.log(result.stdout); //=> 'unicorns' @@ -46,7 +50,8 @@ execa.shell('exit 3').catch(error => { signal: null, cmd: '/bin/sh -c exit 3', stdout: '', - stderr: '' + stderr: '', + timedOut: false } */ }); @@ -59,11 +64,9 @@ execa.shell('exit 3').catch(error => { Execute a file. -Same options as [`child_process.execFile`](https://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback). - -Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess). +Think of this as a mix of `child_process.execFile` and `child_process.spawn`. -The `child_process` instance is enhanced to also be promise for a result object with `stdout` and `stderr` properties. +Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties. ### execa.stdout(file, [arguments], [options]) @@ -77,37 +80,86 @@ Same as `execa()`, but returns only `stderr`. Execute a command through the system shell. Prefer `execa()` whenever possible, as it's both faster and safer. -Same options as [`child_process.exec`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback). - Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess). The `child_process` instance is enhanced to also be promise for a result object with `stdout` and `stderr` properties. -### execa.spawn(file, [arguments], [options]) - -Spawn a file. - -Same API as [`child_process.spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options). - ### execa.sync(file, [arguments], [options]) Execute a file synchronously. -Same options as [`child_process.execFileSync`](https://nodejs.org/api/child_process.html#child_process_child_process_execfilesync_file_args_options), except the default encoding is `utf8` instead of `buffer`. - Returns the same result object as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options). +This method throws an `Error` if the command fails. + ### execa.shellSync(file, [options]) Execute a command synchronously through the system shell. -Same options as [`child_process.execSync`](https://nodejs.org/api/child_process.html#child_process_child_process_execsync_command_options), except the default encoding is `utf8` instead of `buffer`. - Returns the same result object as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options). ### options -Additional options: +Type: `Object` + +#### cwd + +Type: `string`<br> +Default: `process.cwd()` + +Current working directory of the child process. + +#### env + +Type: `Object`<br> +Default: `process.env` + +Environment key-value pairs. Extends automatically from `process.env`. Set `extendEnv` to `false` if you don't want this. + +#### extendEnv + +Type: `boolean`<br> +Default: `true` + +Set to `false` if you don't want to extend the environment variables when providing the `env` property. + +#### argv0 + +Type: `string` + +Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified. + +#### stdio + +Type: `Array` `string`<br> +Default: `pipe` + +Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration. + +#### detached + +Type: `boolean` + +Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached). + +#### uid + +Type: `number` + +Sets the user identity of the process. + +#### gid + +Type: `number` + +Sets the group identity of the process. + +#### shell + +Type: `boolean` `string`<br> +Default: `false` + +If `true`, runs `command` inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows. #### stripEof @@ -124,13 +176,103 @@ Default: `true` Prefer locally installed binaries when looking for a binary to execute.<br> If you `$ npm install foo`, you can then `execa('foo')`. +#### localDir + +Type: `string`<br> +Default: `process.cwd()` + +Preferred path to find locally installed binaries in (use with `preferLocal`). + #### input -Type: `string` `Buffer` `ReadableStream` +Type: `string` `Buffer` `stream.Readable` Write some input to the `stdin` of your binary.<br> Streams are not allowed when using the synchronous methods. +#### reject + +Type: `boolean`<br> +Default: `true` + +Setting this to `false` resolves the promise with the error instead of rejecting it. + +#### cleanup + +Type: `boolean`<br> +Default: `true` + +Keep track of the spawned process and `kill` it when the parent process exits. + +#### encoding + +Type: `string`<br> +Default: `utf8` + +Specify the character encoding used to decode the `stdout` and `stderr` output. + +#### timeout + +Type: `number`<br> +Default: `0` + +If timeout is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than timeout milliseconds. + +#### maxBuffer + +Type: `number`<br> +Default: `10000000` (10MB) + +Largest amount of data in bytes allowed on `stdout` or `stderr`. + +#### killSignal + +Type: `string` `number`<br> +Default: `SIGTERM` + +Signal value to be used when the spawned process will be killed. + +#### stdin + +Type: `string` `number` `Stream` `undefined` `null`<br> +Default: `pipe` + +Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio). + +#### stdout + +Type: `string` `number` `Stream` `undefined` `null`<br> +Default: `pipe` + +Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio). + +#### stderr + +Type: `string` `number` `Stream` `undefined` `null`<br> +Default: `pipe` + +Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio). + + +## Tips + +### Save and pipe output from a child process + +Let's say you want to show the output of a child process in real-time while also saving it to a variable. + +```js +const execa = require('execa'); +const getStream = require('get-stream'); + +const stream = execa('echo', ['foo']).stdout; + +stream.pipe(process.stdout); + +getStream(stream).then(value => { + console.log('child output:', value); +}); +``` + ## License diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/package.json index 5fbea59b8b9..b4b65c52e66 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/package.json @@ -1,48 +1,46 @@ { - "_from": "term-size@^0.1.0", - "_id": "term-size@0.1.1", - "_integrity": "sha1-hzYLljlsq1dgljcUzaDQy+7K2co=", + "_from": "term-size@^1.2.0", + "_id": "term-size@1.2.0", + "_inBundle": false, + "_integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", "_location": "/update-notifier/boxen/term-size", "_phantomChildren": { - "lru-cache": "4.0.2", - "which": "1.2.14" + "lru-cache": "4.1.1", + "which": "1.3.0" }, "_requested": { "type": "range", "registry": true, - "raw": "term-size@^0.1.0", + "raw": "term-size@^1.2.0", "name": "term-size", "escapedName": "term-size", - "rawSpec": "^0.1.0", + "rawSpec": "^1.2.0", "saveSpec": null, - "fetchSpec": "^0.1.0" + "fetchSpec": "^1.2.0" }, "_requiredBy": [ "/update-notifier/boxen" ], - "_resolved": "https://registry.npmjs.org/term-size/-/term-size-0.1.1.tgz", - "_shasum": "87360b96396cab5760963714cda0d0cbeecad9ca", - "_shrinkwrap": null, - "_spec": "term-size@^0.1.0", + "_resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", + "_shasum": "458b83887f288fc56d6fffbfad262e26638efa69", + "_spec": "term-size@^1.2.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/boxen", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, - "bin": null, "bugs": { "url": "https://github.com/sindresorhus/term-size/issues" }, "bundleDependencies": false, "dependencies": { - "execa": "^0.4.0" + "execa": "^0.7.0" }, "deprecated": false, - "description": "Reliably get the terminal window size", + "description": "Reliably get the terminal window size (columns & rows)", "devDependencies": { "ava": "*", - "execa": "^0.4.0", "xo": "*" }, "engines": { @@ -64,12 +62,11 @@ "columns", "rows", "lines", - "tty" + "tty", + "redirected" ], "license": "MIT", "name": "term-size", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/sindresorhus/term-size.git" @@ -77,8 +74,5 @@ "scripts": { "test": "xo && ava" }, - "version": "0.1.1", - "xo": { - "esnext": true - } + "version": "1.2.0" } diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/readme.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/readme.md index a067f80098f..dd642cadc20 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/readme.md +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/readme.md @@ -2,7 +2,7 @@ > Reliably get the terminal window size -Because [`process.stdout.columns`](https://nodejs.org/api/tty.html#tty_writestream_columns) doesn't exist when run [non-interactively](http://www.tldp.org/LDP/abs/html/intandnonint.html), for example, in a child process or when piped. +Because [`process.stdout.columns`](https://nodejs.org/api/tty.html#tty_writestream_columns) doesn't exist when run [non-interactively](http://www.tldp.org/LDP/abs/html/intandnonint.html), for example, in a child process or when piped. This module even works when all the TTY file descriptors are redirected! Confirmed working on macOS, Linux, and Windows. diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/vendor/macos/term-size b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/vendor/macos/term-size Binary files differnew file mode 100755 index 00000000000..e383cc737f8 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/vendor/macos/term-size diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/vendor/resize b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/vendor/resize Binary files differdeleted file mode 100755 index 476ede4c07e..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/vendor/resize +++ /dev/null diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/vendor/win-term-size.exe b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/vendor/windows/term-size.exe Binary files differindex c7a170c9644..c7a170c9644 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/vendor/win-term-size.exe +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/node_modules/term-size/vendor/windows/term-size.exe diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/package.json b/deps/npm/node_modules/update-notifier/node_modules/boxen/package.json index 4b36119f9f2..4b294032729 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/package.json @@ -1,13 +1,13 @@ { "_from": "boxen@^1.0.0", - "_id": "boxen@1.1.0", + "_id": "boxen@1.2.1", "_inBundle": false, - "_integrity": "sha1-sbad1SIwXoB6md7ud329blFnsQI=", + "_integrity": "sha1-DxHn/jRO25OXl3/BPt5/ZNlWSB0=", "_location": "/update-notifier/boxen", "_phantomChildren": { "lru-cache": "4.1.1", "strip-ansi": "4.0.0", - "which": "1.2.14" + "which": "1.3.0" }, "_requested": { "type": "range", @@ -22,10 +22,10 @@ "_requiredBy": [ "/update-notifier" ], - "_resolved": "https://registry.npmjs.org/boxen/-/boxen-1.1.0.tgz", - "_shasum": "b1b69dd522305e807a99deee777dbd6e5167b102", + "_resolved": "https://registry.npmjs.org/boxen/-/boxen-1.2.1.tgz", + "_shasum": "0f11e7fe344edb9397977fc13ede7f64d956481d", "_spec": "boxen@^1.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/update-notifier", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -38,17 +38,17 @@ "dependencies": { "ansi-align": "^2.0.0", "camelcase": "^4.0.0", - "chalk": "^1.1.1", + "chalk": "^2.0.1", "cli-boxes": "^1.0.0", "string-width": "^2.0.0", - "term-size": "^0.1.0", + "term-size": "^1.2.0", "widest-line": "^1.0.0" }, "deprecated": false, "description": "Create boxes in the terminal", "devDependencies": { "ava": "*", - "nyc": "^10.3.0", + "nyc": "^11.0.3", "xo": "*" }, "engines": { @@ -79,8 +79,5 @@ "scripts": { "test": "xo && nyc ava" }, - "version": "1.1.0", - "xo": { - "esnext": true - } + "version": "1.2.1" } diff --git a/deps/npm/node_modules/update-notifier/node_modules/boxen/readme.md b/deps/npm/node_modules/update-notifier/node_modules/boxen/readme.md index abb78bff126..d8db8e98a27 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/boxen/readme.md +++ b/deps/npm/node_modules/update-notifier/node_modules/boxen/readme.md @@ -8,7 +8,7 @@ ## Install ``` -$ npm install --save boxen +$ npm install boxen ``` @@ -124,7 +124,7 @@ Reduce opacity of the border. ##### padding -Type: `number` `object`<br> +Type: `number` `Object`<br> Default: `0` Space between the text and box border. @@ -133,7 +133,7 @@ Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` p ##### margin -Type: `number` `object`<br> +Type: `number` `Object`<br> Default: `0` Space around the box. diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/index.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/index.js index 2d85a91747a..4c81d6d20fb 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/index.js +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/index.js @@ -1,116 +1,220 @@ 'use strict'; -var escapeStringRegexp = require('escape-string-regexp'); -var ansiStyles = require('ansi-styles'); -var stripAnsi = require('strip-ansi'); -var hasAnsi = require('has-ansi'); -var supportsColor = require('supports-color'); -var defineProps = Object.defineProperties; -var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM); +const escapeStringRegexp = require('escape-string-regexp'); +const ansiStyles = require('ansi-styles'); +const supportsColor = require('supports-color'); + +const template = require('./templates.js'); + +const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); + +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; + +// `color-convert` models to exclude from the Chalk API due to conflicts and such +const skipModels = new Set(['gray']); + +const styles = Object.create(null); + +function applyOptions(obj, options) { + options = options || {}; + + // Detect level if not set manually + const scLevel = supportsColor ? supportsColor.level : 0; + obj.level = options.level === undefined ? scLevel : options.level; + obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; +} function Chalk(options) { - // detect mode if not set manually - this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled; + // We check for this.template here since calling `chalk.constructor()` + // by itself will have a `this` of a previously constructed chalk object + if (!this || !(this instanceof Chalk) || this.template) { + const chalk = {}; + applyOptions(chalk, options); + + chalk.template = function () { + const args = [].slice.call(arguments); + return chalkTag.apply(null, [chalk.template].concat(args)); + }; + + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); + + chalk.template.constructor = Chalk; + + return chalk.template; + } + + applyOptions(this, options); } -// use bright blue on Windows as the normal blue color is illegible +// Use bright blue on Windows as the normal blue color is illegible if (isSimpleWindowsTerm) { - ansiStyles.blue.open = '\u001b[94m'; + ansiStyles.blue.open = '\u001B[94m'; } -var styles = (function () { - var ret = {}; +for (const key of Object.keys(ansiStyles)) { + ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - Object.keys(ansiStyles).forEach(function (key) { - ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + styles[key] = { + get() { + const codes = ansiStyles[key]; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], key); + } + }; +} - ret[key] = { - get: function () { - return build.call(this, this._styles.concat(key)); - } - }; - }); +ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); +for (const model of Object.keys(ansiStyles.color.ansi)) { + if (skipModels.has(model)) { + continue; + } + + styles[model] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.color.close, + closeRe: ansiStyles.color.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], model); + }; + } + }; +} - return ret; -})(); +ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); +for (const model of Object.keys(ansiStyles.bgColor.ansi)) { + if (skipModels.has(model)) { + continue; + } + + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const level = this.level; + return function () { + const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); + const codes = { + open, + close: ansiStyles.bgColor.close, + closeRe: ansiStyles.bgColor.closeRe + }; + return build.call(this, this._styles ? this._styles.concat(codes) : [codes], model); + }; + } + }; +} -var proto = defineProps(function chalk() {}, styles); +const proto = Object.defineProperties(() => {}, styles); -function build(_styles) { - var builder = function () { +function build(_styles, key) { + const builder = function () { return applyStyle.apply(builder, arguments); }; builder._styles = _styles; - builder.enabled = this.enabled; - // __proto__ is used because we must return a function, but there is - // no way to create a function with a different prototype. - /* eslint-disable no-proto */ - builder.__proto__ = proto; + + const self = this; + + Object.defineProperty(builder, 'level', { + enumerable: true, + get() { + return self.level; + }, + set(level) { + self.level = level; + } + }); + + Object.defineProperty(builder, 'enabled', { + enumerable: true, + get() { + return self.enabled; + }, + set(enabled) { + self.enabled = enabled; + } + }); + + // See below for fix regarding invisible grey/dim combination on Windows + builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; + + // `__proto__` is used because we must return a function, but there is + // no way to create a function with a different prototype + builder.__proto__ = proto; // eslint-disable-line no-proto return builder; } function applyStyle() { - // support varags, but simply cast to string in case there's only one arg - var args = arguments; - var argsLen = args.length; - var str = argsLen !== 0 && String(arguments[0]); + // Support varags, but simply cast to string in case there's only one arg + const args = arguments; + const argsLen = args.length; + let str = String(arguments[0]); + + if (argsLen === 0) { + return ''; + } if (argsLen > 1) { - // don't slice `arguments`, it prevents v8 optimizations - for (var a = 1; a < argsLen; a++) { + // Don't slice `arguments`, it prevents V8 optimizations + for (let a = 1; a < argsLen; a++) { str += ' ' + args[a]; } } - if (!this.enabled || !str) { + if (!this.enabled || this.level <= 0 || !str) { return str; } - var nestedStyles = this._styles; - var i = nestedStyles.length; - // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, // see https://github.com/chalk/chalk/issues/58 // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. - var originalDim = ansiStyles.dim.open; - if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) { + const originalDim = ansiStyles.dim.open; + if (isSimpleWindowsTerm && this.hasGrey) { ansiStyles.dim.open = ''; } - while (i--) { - var code = ansiStyles[nestedStyles[i]]; - + for (const code of this._styles.slice().reverse()) { // Replace any instances already present with a re-opening code // otherwise only the part of the string until said closing code // will be colored, and the rest will simply be 'plain'. str = code.open + str.replace(code.closeRe, code.open) + code.close; + + // Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS + // https://github.com/chalk/chalk/pull/92 + str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); } - // Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue. + // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue ansiStyles.dim.open = originalDim; return str; } -function init() { - var ret = {}; +function chalkTag(chalk, strings) { + if (!Array.isArray(strings)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return [].slice.call(arguments, 1).join(' '); + } - Object.keys(styles).forEach(function (name) { - ret[name] = { - get: function () { - return build.call(this, [name]); - } - }; - }); + const args = [].slice.call(arguments, 2); + const parts = [strings.raw[0]]; + + for (let i = 1; i < strings.length; i++) { + parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); + parts.push(String(strings.raw[i])); + } - return ret; + return template(chalk, parts.join('')); } -defineProps(Chalk.prototype, init()); +Object.defineProperties(Chalk.prototype, styles); -module.exports = new Chalk(); -module.exports.styles = ansiStyles; -module.exports.hasColor = hasAnsi; -module.exports.stripColor = stripAnsi; +module.exports = Chalk(); // eslint-disable-line new-cap module.exports.supportsColor = supportsColor; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/license b/deps/npm/node_modules/update-notifier/node_modules/chalk/license index 654d0bfe943..e7af2f77107 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/license +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +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 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. +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/update-notifier/node_modules/chalk/node_modules/ansi-styles/index.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/index.js index 78945278f78..3d3baa66d75 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/index.js +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/index.js @@ -1,10 +1,28 @@ 'use strict'; +const colorConvert = require('color-convert'); -function assembleStyles () { - var styles = { - modifiers: { +const wrapAnsi16 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => function () { + const rgb = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { reset: [0, 0], - bold: [1, 22], // 21 isn't widely supported and 22 does the same thing + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], @@ -12,7 +30,7 @@ function assembleStyles () { hidden: [8, 28], strikethrough: [9, 29] }, - colors: { + color: { black: [30, 39], red: [31, 39], green: [32, 39], @@ -21,9 +39,18 @@ function assembleStyles () { magenta: [35, 39], cyan: [36, 39], white: [37, 39], - gray: [90, 39] + gray: [90, 39], + + // Bright color + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] }, - bgColors: { + bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], @@ -31,34 +58,94 @@ function assembleStyles () { bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], - bgWhite: [47, 49] + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] } }; - // fix humans - styles.colors.grey = styles.colors.gray; + // Fix humans + styles.color.grey = styles.color.gray; - Object.keys(styles).forEach(function (groupName) { - var group = styles[groupName]; + for (const groupName of Object.keys(styles)) { + const group = styles[groupName]; - Object.keys(group).forEach(function (styleName) { - var style = group[styleName]; + for (const styleName of Object.keys(group)) { + const style = group[styleName]; - styles[styleName] = group[styleName] = { - open: '\u001b[' + style[0] + 'm', - close: '\u001b[' + style[1] + 'm' + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` }; - }); + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } Object.defineProperty(styles, groupName, { value: group, enumerable: false }); - }); + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + } + + const rgb2rgb = (r, g, b) => [r, g, b]; + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi = {}; + styles.color.ansi256 = {}; + styles.color.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 0) + }; + + styles.bgColor.ansi = {}; + styles.bgColor.ansi256 = {}; + styles.bgColor.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 10) + }; + + for (const key of Object.keys(colorConvert)) { + if (typeof colorConvert[key] !== 'object') { + continue; + } + + const suite = colorConvert[key]; + + if ('ansi16' in suite) { + styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); + styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); + } + + if ('ansi256' in suite) { + styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); + styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); + } + + if ('rgb' in suite) { + styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); + styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); + } + } return styles; } +// Make the export immutable Object.defineProperty(module, 'exports', { enumerable: true, get: assembleStyles diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/license b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/license index 654d0bfe943..e7af2f77107 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/license +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +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 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. +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/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/CHANGELOG.md b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/CHANGELOG.md new file mode 100644 index 00000000000..0a7bce4fd57 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/CHANGELOG.md @@ -0,0 +1,54 @@ +# 1.0.0 - 2016-01-07 + +- Removed: unused speed test +- Added: Automatic routing between previously unsupported conversions +([#27](https://github.com/Qix-/color-convert/pull/27)) +- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions +([#27](https://github.com/Qix-/color-convert/pull/27)) +- Removed: `convert()` class +([#27](https://github.com/Qix-/color-convert/pull/27)) +- Changed: all functions to lookup dictionary +([#27](https://github.com/Qix-/color-convert/pull/27)) +- Changed: `ansi` to `ansi256` +([#27](https://github.com/Qix-/color-convert/pull/27)) +- Fixed: argument grouping for functions requiring only one argument +([#27](https://github.com/Qix-/color-convert/pull/27)) + +# 0.6.0 - 2015-07-23 + +- Added: methods to handle +[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors: + - rgb2ansi16 + - rgb2ansi + - hsl2ansi16 + - hsl2ansi + - hsv2ansi16 + - hsv2ansi + - hwb2ansi16 + - hwb2ansi + - cmyk2ansi16 + - cmyk2ansi + - keyword2ansi16 + - keyword2ansi + - ansi162rgb + - ansi162hsl + - ansi162hsv + - ansi162hwb + - ansi162cmyk + - ansi162keyword + - ansi2rgb + - ansi2hsl + - ansi2hsv + - ansi2hwb + - ansi2cmyk + - ansi2keyword +([#18](https://github.com/harthur/color-convert/pull/18)) + +# 0.5.3 - 2015-06-02 + +- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]` +([#15](https://github.com/harthur/color-convert/issues/15)) + +--- + +Check out commit logs for older releases diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/LICENSE b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/LICENSE new file mode 100644 index 00000000000..0e2e4909183 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/README.md b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/README.md new file mode 100644 index 00000000000..d4b08fc3699 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/README.md @@ -0,0 +1,68 @@ +# color-convert + +[![Build Status](https://travis-ci.org/Qix-/color-convert.svg?branch=master)](https://travis-ci.org/Qix-/color-convert) + +Color-convert is a color conversion library for JavaScript and node. +It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest): + +```js +var convert = require('color-convert'); + +convert.rgb.hsl(140, 200, 100); // [96, 48, 59] +convert.keyword.rgb('blue'); // [0, 0, 255] + +var rgbChannels = convert.rgb.channels; // 3 +var cmykChannels = convert.cmyk.channels; // 4 +var ansiChannels = convert.ansi16.channels; // 1 +``` + +# Install + +```console +$ npm install color-convert +``` + +# API + +Simply get the property of the _from_ and _to_ conversion that you're looking for. + +All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function. + +All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha). + +```js +var convert = require('color-convert'); + +// Hex to LAB +convert.hex.lab('DEADBF'); // [ 76, 21, -2 ] +convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ] + +// RGB to CMYK +convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ] +convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ] +``` + +### Arrays +All functions that accept multiple arguments also support passing an array. + +Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.) + +```js +var convert = require('color-convert'); + +convert.rgb.hex(123, 45, 67); // '7B2D43' +convert.rgb.hex([123, 45, 67]); // '7B2D43' +``` + +## Routing + +Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex). + +Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js). + +# Contribute + +If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request. + +# License +Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE). diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/conversions.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/conversions.js new file mode 100644 index 00000000000..19ca4a9bf5a --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/conversions.js @@ -0,0 +1,861 @@ +/* MIT license */ +var cssKeywords = require('color-name'); + +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) + +var reverseKeywords = {}; +for (var key in cssKeywords) { + if (cssKeywords.hasOwnProperty(key)) { + reverseKeywords[cssKeywords[key]] = key; + } +} + +var convert = module.exports = { + rgb: {channels: 3, labels: 'rgb'}, + hsl: {channels: 3, labels: 'hsl'}, + hsv: {channels: 3, labels: 'hsv'}, + hwb: {channels: 3, labels: 'hwb'}, + cmyk: {channels: 4, labels: 'cmyk'}, + xyz: {channels: 3, labels: 'xyz'}, + lab: {channels: 3, labels: 'lab'}, + lch: {channels: 3, labels: 'lch'}, + hex: {channels: 1, labels: ['hex']}, + keyword: {channels: 1, labels: ['keyword']}, + ansi16: {channels: 1, labels: ['ansi16']}, + ansi256: {channels: 1, labels: ['ansi256']}, + hcg: {channels: 3, labels: ['h', 'c', 'g']}, + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, + gray: {channels: 1, labels: ['gray']} +}; + +// hide .channels and .labels properties +for (var model in convert) { + if (convert.hasOwnProperty(model)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); + } + + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } + + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } + + var channels = convert[model].channels; + var labels = convert[model].labels; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', {value: channels}); + Object.defineProperty(convert[model], 'labels', {value: labels}); + } +} + +convert.rgb.hsl = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var delta = max - min; + var h; + var s; + var l; + + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } + + h = Math.min(h * 60, 360); + + if (h < 0) { + h += 360; + } + + l = (min + max) / 2; + + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } + + return [h, s * 100, l * 100]; +}; + +convert.rgb.hsv = function (rgb) { + var r = rgb[0]; + var g = rgb[1]; + var b = rgb[2]; + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var delta = max - min; + var h; + var s; + var v; + + if (max === 0) { + s = 0; + } else { + s = (delta / max * 1000) / 10; + } + + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } + + h = Math.min(h * 60, 360); + + if (h < 0) { + h += 360; + } + + v = ((max / 255) * 1000) / 10; + + return [h, s, v]; +}; + +convert.rgb.hwb = function (rgb) { + var r = rgb[0]; + var g = rgb[1]; + var b = rgb[2]; + var h = convert.rgb.hsl(rgb)[0]; + var w = 1 / 255 * Math.min(r, Math.min(g, b)); + + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); + + return [h, w * 100, b * 100]; +}; + +convert.rgb.cmyk = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var c; + var m; + var y; + var k; + + k = Math.min(1 - r, 1 - g, 1 - b); + c = (1 - r - k) / (1 - k) || 0; + m = (1 - g - k) / (1 - k) || 0; + y = (1 - b - k) / (1 - k) || 0; + + return [c * 100, m * 100, y * 100, k * 100]; +}; + +/** + * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + * */ +function comparativeDistance(x, y) { + return ( + Math.pow(x[0] - y[0], 2) + + Math.pow(x[1] - y[1], 2) + + Math.pow(x[2] - y[2], 2) + ); +} + +convert.rgb.keyword = function (rgb) { + var reversed = reverseKeywords[rgb]; + if (reversed) { + return reversed; + } + + var currentClosestDistance = Infinity; + var currentClosestKeyword; + + for (var keyword in cssKeywords) { + if (cssKeywords.hasOwnProperty(keyword)) { + var value = cssKeywords[keyword]; + + // Compute comparative distance + var distance = comparativeDistance(rgb, value); + + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + } + + return currentClosestKeyword; +}; + +convert.keyword.rgb = function (keyword) { + return cssKeywords[keyword]; +}; + +convert.rgb.xyz = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + + // assume sRGB + r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); + g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); + b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); + + var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + + return [x * 100, y * 100, z * 100]; +}; + +convert.rgb.lab = function (rgb) { + var xyz = convert.rgb.xyz(rgb); + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); + + l = (116 * y) - 16; + a = 500 * (x - y); + b = 200 * (y - z); + + return [l, a, b]; +}; + +convert.hsl.rgb = function (hsl) { + var h = hsl[0] / 360; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var t1; + var t2; + var t3; + var rgb; + var val; + + if (s === 0) { + val = l * 255; + return [val, val, val]; + } + + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } + + t1 = 2 * l - t2; + + rgb = [0, 0, 0]; + for (var i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + if (t3 < 0) { + t3++; + } + if (t3 > 1) { + t3--; + } + + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } + + rgb[i] = val * 255; + } + + return rgb; +}; + +convert.hsl.hsv = function (hsl) { + var h = hsl[0]; + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var smin = s; + var lmin = Math.max(l, 0.01); + var sv; + var v; + + l *= 2; + s *= (l <= 1) ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + v = (l + s) / 2; + sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); + + return [h, sv * 100, v * 100]; +}; + +convert.hsv.rgb = function (hsv) { + var h = hsv[0] / 60; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var hi = Math.floor(h) % 6; + + var f = h - Math.floor(h); + var p = 255 * v * (1 - s); + var q = 255 * v * (1 - (s * f)); + var t = 255 * v * (1 - (s * (1 - f))); + v *= 255; + + switch (hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } +}; + +convert.hsv.hsl = function (hsv) { + var h = hsv[0]; + var s = hsv[1] / 100; + var v = hsv[2] / 100; + var vmin = Math.max(v, 0.01); + var lmin; + var sl; + var l; + + l = (2 - s) * v; + lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= (lmin <= 1) ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; + + return [h, sl * 100, l * 100]; +}; + +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +convert.hwb.rgb = function (hwb) { + var h = hwb[0] / 360; + var wh = hwb[1] / 100; + var bl = hwb[2] / 100; + var ratio = wh + bl; + var i; + var v; + var f; + var n; + + // wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } + + i = Math.floor(6 * h); + v = 1 - bl; + f = 6 * h - i; + + if ((i & 0x01) !== 0) { + f = 1 - f; + } + + n = wh + f * (v - wh); // linear interpolation + + var r; + var g; + var b; + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } + + return [r * 255, g * 255, b * 255]; +}; + +convert.cmyk.rgb = function (cmyk) { + var c = cmyk[0] / 100; + var m = cmyk[1] / 100; + var y = cmyk[2] / 100; + var k = cmyk[3] / 100; + var r; + var g; + var b; + + r = 1 - Math.min(1, c * (1 - k) + k); + g = 1 - Math.min(1, m * (1 - k) + k); + b = 1 - Math.min(1, y * (1 - k) + k); + + return [r * 255, g * 255, b * 255]; +}; + +convert.xyz.rgb = function (xyz) { + var x = xyz[0] / 100; + var y = xyz[1] / 100; + var z = xyz[2] / 100; + var r; + var g; + var b; + + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); + + // assume sRGB + r = r > 0.0031308 + ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) + : r * 12.92; + + g = g > 0.0031308 + ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) + : g * 12.92; + + b = b > 0.0031308 + ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) + : b * 12.92; + + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); + + return [r * 255, g * 255, b * 255]; +}; + +convert.xyz.lab = function (xyz) { + var x = xyz[0]; + var y = xyz[1]; + var z = xyz[2]; + var l; + var a; + var b; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116); + + l = (116 * y) - 16; + a = 500 * (x - y); + b = 200 * (y - z); + + return [l, a, b]; +}; + +convert.lab.xyz = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var x; + var y; + var z; + + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; + + var y2 = Math.pow(y, 3); + var x2 = Math.pow(x, 3); + var z2 = Math.pow(z, 3); + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; + + x *= 95.047; + y *= 100; + z *= 108.883; + + return [x, y, z]; +}; + +convert.lab.lch = function (lab) { + var l = lab[0]; + var a = lab[1]; + var b = lab[2]; + var hr; + var h; + var c; + + hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; + + if (h < 0) { + h += 360; + } + + c = Math.sqrt(a * a + b * b); + + return [l, c, h]; +}; + +convert.lch.lab = function (lch) { + var l = lch[0]; + var c = lch[1]; + var h = lch[2]; + var a; + var b; + var hr; + + hr = h / 360 * 2 * Math.PI; + a = c * Math.cos(hr); + b = c * Math.sin(hr); + + return [l, a, b]; +}; + +convert.rgb.ansi16 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; + var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization + + value = Math.round(value / 50); + + if (value === 0) { + return 30; + } + + var ansi = 30 + + ((Math.round(b / 255) << 2) + | (Math.round(g / 255) << 1) + | Math.round(r / 255)); + + if (value === 2) { + ansi += 60; + } + + return ansi; +}; + +convert.hsv.ansi16 = function (args) { + // optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); +}; + +convert.rgb.ansi256 = function (args) { + var r = args[0]; + var g = args[1]; + var b = args[2]; + + // we use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (r === g && g === b) { + if (r < 8) { + return 16; + } + + if (r > 248) { + return 231; + } + + return Math.round(((r - 8) / 247) * 24) + 232; + } + + var ansi = 16 + + (36 * Math.round(r / 255 * 5)) + + (6 * Math.round(g / 255 * 5)) + + Math.round(b / 255 * 5); + + return ansi; +}; + +convert.ansi16.rgb = function (args) { + var color = args % 10; + + // handle greyscale + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } + + color = color / 10.5 * 255; + + return [color, color, color]; + } + + var mult = (~~(args > 50) + 1) * 0.5; + var r = ((color & 1) * mult) * 255; + var g = (((color >> 1) & 1) * mult) * 255; + var b = (((color >> 2) & 1) * mult) * 255; + + return [r, g, b]; +}; + +convert.ansi256.rgb = function (args) { + // handle greyscale + if (args >= 232) { + var c = (args - 232) * 10 + 8; + return [c, c, c]; + } + + args -= 16; + + var rem; + var r = Math.floor(args / 36) / 5 * 255; + var g = Math.floor((rem = args % 36) / 6) / 5 * 255; + var b = (rem % 6) / 5 * 255; + + return [r, g, b]; +}; + +convert.rgb.hex = function (args) { + var integer = ((Math.round(args[0]) & 0xFF) << 16) + + ((Math.round(args[1]) & 0xFF) << 8) + + (Math.round(args[2]) & 0xFF); + + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert.hex.rgb = function (args) { + var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + if (!match) { + return [0, 0, 0]; + } + + var colorString = match[0]; + + if (match[0].length === 3) { + colorString = colorString.split('').map(function (char) { + return char + char; + }).join(''); + } + + var integer = parseInt(colorString, 16); + var r = (integer >> 16) & 0xFF; + var g = (integer >> 8) & 0xFF; + var b = integer & 0xFF; + + return [r, g, b]; +}; + +convert.rgb.hcg = function (rgb) { + var r = rgb[0] / 255; + var g = rgb[1] / 255; + var b = rgb[2] / 255; + var max = Math.max(Math.max(r, g), b); + var min = Math.min(Math.min(r, g), b); + var chroma = (max - min); + var grayscale; + var hue; + + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } + + if (chroma <= 0) { + hue = 0; + } else + if (max === r) { + hue = ((g - b) / chroma) % 6; + } else + if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma + 4; + } + + hue /= 6; + hue %= 1; + + return [hue * 360, chroma * 100, grayscale * 100]; +}; + +convert.hsl.hcg = function (hsl) { + var s = hsl[1] / 100; + var l = hsl[2] / 100; + var c = 1; + var f = 0; + + if (l < 0.5) { + c = 2.0 * s * l; + } else { + c = 2.0 * s * (1.0 - l); + } + + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } + + return [hsl[0], c * 100, f * 100]; +}; + +convert.hsv.hcg = function (hsv) { + var s = hsv[1] / 100; + var v = hsv[2] / 100; + + var c = s * v; + var f = 0; + + if (c < 1.0) { + f = (v - c) / (1 - c); + } + + return [hsv[0], c * 100, f * 100]; +}; + +convert.hcg.rgb = function (hcg) { + var h = hcg[0] / 360; + var c = hcg[1] / 100; + var g = hcg[2] / 100; + + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } + + var pure = [0, 0, 0]; + var hi = (h % 1) * 6; + var v = hi % 1; + var w = 1 - v; + var mg = 0; + + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; pure[1] = v; pure[2] = 0; break; + case 1: + pure[0] = w; pure[1] = 1; pure[2] = 0; break; + case 2: + pure[0] = 0; pure[1] = 1; pure[2] = v; break; + case 3: + pure[0] = 0; pure[1] = w; pure[2] = 1; break; + case 4: + pure[0] = v; pure[1] = 0; pure[2] = 1; break; + default: + pure[0] = 1; pure[1] = 0; pure[2] = w; + } + + mg = (1.0 - c) * g; + + return [ + (c * pure[0] + mg) * 255, + (c * pure[1] + mg) * 255, + (c * pure[2] + mg) * 255 + ]; +}; + +convert.hcg.hsv = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + + var v = c + g * (1.0 - c); + var f = 0; + + if (v > 0.0) { + f = c / v; + } + + return [hcg[0], f * 100, v * 100]; +}; + +convert.hcg.hsl = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + + var l = g * (1.0 - c) + 0.5 * c; + var s = 0; + + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else + if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } + + return [hcg[0], s * 100, l * 100]; +}; + +convert.hcg.hwb = function (hcg) { + var c = hcg[1] / 100; + var g = hcg[2] / 100; + var v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; + +convert.hwb.hcg = function (hwb) { + var w = hwb[1] / 100; + var b = hwb[2] / 100; + var v = 1 - b; + var c = v - w; + var g = 0; + + if (c < 1) { + g = (v - c) / (1 - c); + } + + return [hwb[0], c * 100, g * 100]; +}; + +convert.apple.rgb = function (apple) { + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +}; + +convert.rgb.apple = function (rgb) { + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; +}; + +convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; + +convert.gray.hsl = convert.gray.hsv = function (args) { + return [0, 0, args[0]]; +}; + +convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; +}; + +convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; + +convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; +}; + +convert.gray.hex = function (gray) { + var val = Math.round(gray[0] / 100 * 255) & 0xFF; + var integer = (val << 16) + (val << 8) + val; + + var string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert.rgb.gray = function (rgb) { + var val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/index.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/index.js new file mode 100644 index 00000000000..e65b5d775da --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/index.js @@ -0,0 +1,78 @@ +var conversions = require('./conversions'); +var route = require('./route'); + +var convert = {}; + +var models = Object.keys(conversions); + +function wrapRaw(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; + } + + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); + } + + return fn(args); + }; + + // preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +function wrapRounded(fn) { + var wrappedFn = function (args) { + if (args === undefined || args === null) { + return args; + } + + if (arguments.length > 1) { + args = Array.prototype.slice.call(arguments); + } + + var result = fn(args); + + // we're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + if (typeof result === 'object') { + for (var len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } + + return result; + }; + + // preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +models.forEach(function (fromModel) { + convert[fromModel] = {}; + + Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); + Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); + + var routes = route(fromModel); + var routeModels = Object.keys(routes); + + routeModels.forEach(function (toModel) { + var fn = routes[toModel]; + + convert[fromModel][toModel] = wrapRounded(fn); + convert[fromModel][toModel].raw = wrapRaw(fn); + }); +}); + +module.exports = convert; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/.eslintrc.json b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/.eslintrc.json new file mode 100644 index 00000000000..c50c250446e --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/.eslintrc.json @@ -0,0 +1,43 @@ +{ + "env": { + "browser": true, + "node": true, + "commonjs": true, + "es6": true + }, + "extends": "eslint:recommended", + "rules": { + "strict": 2, + "indent": 0, + "linebreak-style": 0, + "quotes": 0, + "semi": 0, + "no-cond-assign": 1, + "no-constant-condition": 1, + "no-duplicate-case": 1, + "no-empty": 1, + "no-ex-assign": 1, + "no-extra-boolean-cast": 1, + "no-extra-semi": 1, + "no-fallthrough": 1, + "no-func-assign": 1, + "no-global-assign": 1, + "no-implicit-globals": 2, + "no-inner-declarations": ["error", "functions"], + "no-irregular-whitespace": 2, + "no-loop-func": 1, + "no-multi-str": 1, + "no-mixed-spaces-and-tabs": 1, + "no-proto": 1, + "no-sequences": 1, + "no-throw-literal": 1, + "no-unmodified-loop-condition": 1, + "no-useless-call": 1, + "no-void": 1, + "no-with": 2, + "wrap-iife": 1, + "no-redeclare": 1, + "no-unused-vars": ["error", { "vars": "all", "args": "none" }], + "no-sparse-arrays": 1 + } +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/.npmignore b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/.npmignore new file mode 100644 index 00000000000..3854c07dc6e --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/.npmignore @@ -0,0 +1,107 @@ +//this will affect all the git repos +git config --global core.excludesfile ~/.gitignore + + +//update files since .ignore won't if already tracked +git rm --cached <file> + +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so + +# Packages # +############ +# it's better to unpack these files and commit the raw source +# git has its own built in compression methods +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Logs and databases # +###################### +*.log +*.sql +*.sqlite + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +# Icon? +ehthumbs.db +Thumbs.db +.cache +.project +.settings +.tmproj +*.esproj +nbproject + +# Numerous always-ignore extensions # +##################################### +*.diff +*.err +*.orig +*.rej +*.swn +*.swo +*.swp +*.vi +*~ +*.sass-cache +*.grunt +*.tmp + +# Dreamweaver added files # +########################### +_notes +dwsync.xml + +# Komodo # +########################### +*.komodoproject +.komodotools + +# Node # +##################### +node_modules + +# Bower # +##################### +bower_components + +# Folders to ignore # +##################### +.hg +.svn +.CVS +intermediate +publish +.idea +.graphics +_test +_archive +uploads +tmp + +# Vim files to ignore # +####################### +.VimballRecord +.netrwhist + +bundle.* + +_demo
\ No newline at end of file diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/LICENSE b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/LICENSE new file mode 100644 index 00000000000..4d9802a89e2 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2015 Dmitry Ivanov + +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.
\ No newline at end of file diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/README.md b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/README.md new file mode 100644 index 00000000000..3611a6b523f --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/README.md @@ -0,0 +1,11 @@ +A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors. + +[![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/) + + +```js +var colors = require('color-name'); +colors.red //[255,0,0] +``` + +<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a> diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/index.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/index.js new file mode 100644 index 00000000000..e42aa68a542 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/index.js @@ -0,0 +1,152 @@ +'use strict' + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/package.json b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/package.json new file mode 100644 index 00000000000..f269d7266a4 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/package.json @@ -0,0 +1,53 @@ +{ + "_from": "color-name@^1.1.1", + "_id": "color-name@1.1.3", + "_inBundle": false, + "_integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "_location": "/update-notifier/chalk/ansi-styles/color-convert/color-name", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "color-name@^1.1.1", + "name": "color-name", + "escapedName": "color-name", + "rawSpec": "^1.1.1", + "saveSpec": null, + "fetchSpec": "^1.1.1" + }, + "_requiredBy": [ + "/update-notifier/chalk/ansi-styles/color-convert" + ], + "_resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "_shasum": "a7d0558bd89c42f795dd42328f740831ca53bc25", + "_spec": "color-name@^1.1.1", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert", + "author": { + "name": "DY", + "email": "dfcreative@gmail.com" + }, + "bugs": { + "url": "https://github.com/dfcreative/color-name/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "A list of color names and its values", + "homepage": "https://github.com/dfcreative/color-name", + "keywords": [ + "color-name", + "color", + "color-keyword", + "keyword" + ], + "license": "MIT", + "main": "index.js", + "name": "color-name", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/dfcreative/color-name.git" + }, + "scripts": { + "test": "node test.js" + }, + "version": "1.1.3" +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/test.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/test.js new file mode 100644 index 00000000000..7a08746215e --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/test.js @@ -0,0 +1,7 @@ +'use strict' + +var names = require('./'); +var assert = require('assert'); + +assert.deepEqual(names.red, [255,0,0]); +assert.deepEqual(names.aliceblue, [240,248,255]); diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/package.json b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/package.json new file mode 100644 index 00000000000..b52844a38d2 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/package.json @@ -0,0 +1,81 @@ +{ + "_from": "color-convert@^1.9.0", + "_id": "color-convert@1.9.0", + "_inBundle": false, + "_integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "_location": "/update-notifier/chalk/ansi-styles/color-convert", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "color-convert@^1.9.0", + "name": "color-convert", + "escapedName": "color-convert", + "rawSpec": "^1.9.0", + "saveSpec": null, + "fetchSpec": "^1.9.0" + }, + "_requiredBy": [ + "/update-notifier/chalk/ansi-styles" + ], + "_resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "_shasum": "1accf97dd739b983bf994d56fec8f95853641b7a", + "_spec": "color-convert@^1.9.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles", + "author": { + "name": "Heather Arthur", + "email": "fayearthur@gmail.com" + }, + "bugs": { + "url": "https://github.com/Qix-/color-convert/issues" + }, + "bundleDependencies": false, + "dependencies": { + "color-name": "^1.1.1" + }, + "deprecated": false, + "description": "Plain color conversion functions", + "devDependencies": { + "chalk": "^1.1.1", + "xo": "^0.11.2" + }, + "files": [ + "index.js", + "conversions.js", + "css-keywords.js", + "route.js" + ], + "homepage": "https://github.com/Qix-/color-convert#readme", + "keywords": [ + "color", + "colour", + "convert", + "converter", + "conversion", + "rgb", + "hsl", + "hsv", + "hwb", + "cmyk", + "ansi", + "ansi16" + ], + "license": "MIT", + "name": "color-convert", + "repository": { + "type": "git", + "url": "git+https://github.com/Qix-/color-convert.git" + }, + "scripts": { + "pretest": "xo", + "test": "node test/basic.js" + }, + "version": "1.9.0", + "xo": { + "rules": { + "default-case": 0, + "no-inline-comments": 0, + "operator-linebreak": 0 + } + } +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/route.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/route.js new file mode 100644 index 00000000000..cba36384cca --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/route.js @@ -0,0 +1,97 @@ +var conversions = require('./conversions'); + +/* + this function routes a model to all other models. + + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). + + conversions that are not possible simply are not included. +*/ + +// https://jsperf.com/object-keys-vs-for-in-with-closure/3 +var models = Object.keys(conversions); + +function buildGraph() { + var graph = {}; + + for (var len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } + + return graph; +} + +// https://en.wikipedia.org/wiki/Breadth-first_search +function deriveBFS(fromModel) { + var graph = buildGraph(); + var queue = [fromModel]; // unshift -> queue -> pop + + graph[fromModel].distance = 0; + + while (queue.length) { + var current = queue.pop(); + var adjacents = Object.keys(conversions[current]); + + for (var len = adjacents.length, i = 0; i < len; i++) { + var adjacent = adjacents[i]; + var node = graph[adjacent]; + + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } + + return graph; +} + +function link(from, to) { + return function (args) { + return to(from(args)); + }; +} + +function wrapConversion(toModel, graph) { + var path = [graph[toModel].parent, toModel]; + var fn = conversions[graph[toModel].parent][toModel]; + + var cur = graph[toModel].parent; + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link(conversions[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } + + fn.conversion = path; + return fn; +} + +module.exports = function (fromModel) { + var graph = deriveBFS(fromModel); + var conversion = {}; + + var models = Object.keys(graph); + for (var len = models.length, i = 0; i < len; i++) { + var toModel = models[i]; + var node = graph[toModel]; + + if (node.parent === null) { + // no possible conversion, or this node is the source model. + continue; + } + + conversion[toModel] = wrapConversion(toModel, graph); + } + + return conversion; +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/package.json b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/package.json index a2c2431c05c..c9c0f3af060 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/package.json @@ -1,45 +1,51 @@ { - "_from": "ansi-styles@^2.2.1", - "_id": "ansi-styles@2.2.1", - "_integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "_from": "ansi-styles@^3.1.0", + "_id": "ansi-styles@3.2.0", + "_inBundle": false, + "_integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "_location": "/update-notifier/chalk/ansi-styles", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "ansi-styles@^2.2.1", + "raw": "ansi-styles@^3.1.0", "name": "ansi-styles", "escapedName": "ansi-styles", - "rawSpec": "^2.2.1", + "rawSpec": "^3.1.0", "saveSpec": null, - "fetchSpec": "^2.2.1" + "fetchSpec": "^3.1.0" }, "_requiredBy": [ "/update-notifier/chalk" ], - "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "_shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe", - "_shrinkwrap": null, - "_spec": "ansi-styles@^2.2.1", + "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "_shasum": "c159b8d5be0f9e5a6f346dab94f16ce022161b88", + "_spec": "ansi-styles@^3.1.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/chalk", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, - "bin": null, + "ava": { + "require": "babel-polyfill" + }, "bugs": { "url": "https://github.com/chalk/ansi-styles/issues" }, "bundleDependencies": false, - "dependencies": {}, + "dependencies": { + "color-convert": "^1.9.0" + }, "deprecated": false, "description": "ANSI escape codes for styling strings in the terminal", "devDependencies": { - "mocha": "*" + "ava": "*", + "babel-polyfill": "^6.23.0", + "xo": "*" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "files": [ "index.js" @@ -68,27 +74,13 @@ "text" ], "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com", - "url": "jbnicolai.com" - } - ], "name": "ansi-styles", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/chalk/ansi-styles.git" }, "scripts": { - "test": "mocha" + "test": "xo && ava" }, - "version": "2.2.1" + "version": "3.2.0" } diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/readme.md b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/readme.md index 3f933f6162e..dce368742b4 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/readme.md +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/ansi-styles/readme.md @@ -10,18 +10,27 @@ You probably want the higher-level [chalk](https://github.com/chalk/chalk) modul ## Install ``` -$ npm install --save ansi-styles +$ npm install ansi-styles ``` ## Usage ```js -var ansi = require('ansi-styles'); +const style = require('ansi-styles'); + +console.log(`${style.green.open}Hello world!${style.green.close}`); -console.log(ansi.green.open + 'Hello world!' + ansi.green.close); -``` +// Color conversion between 16/256/truecolor +// NOTE: If conversion goes to 16 colors or 256 colors, the original color +// may be degraded to fit that color palette. This means terminals +// that do not support 16 million colors will best-match the +// original color. +console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close); +console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close); +console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close); +``` ## API @@ -35,11 +44,11 @@ Each style has an `open` and `close` property. - `reset` - `bold` - `dim` -- `italic` *(not widely supported)* +- `italic` *(Not widely supported)* - `underline` - `inverse` - `hidden` -- `strikethrough` *(not widely supported)* +- `strikethrough` *(Not widely supported)* ### Colors @@ -51,7 +60,14 @@ Each style has an `open` and `close` property. - `magenta` - `cyan` - `white` -- `gray` +- `gray` ("bright black") +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` ### Background colors @@ -63,24 +79,69 @@ Each style has an `open` and `close` property. - `bgMagenta` - `bgCyan` - `bgWhite` +- `bgBlackBright` +- `bgRedBright` +- `bgGreenBright` +- `bgYellowBright` +- `bgBlueBright` +- `bgMagentaBright` +- `bgCyanBright` +- `bgWhiteBright` ## Advanced usage -By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `style.modifier` +- `style.color` +- `style.bgColor` + +###### Example -- `ansi.modifiers` -- `ansi.colors` -- `ansi.bgColors` +```js +console.log(style.color.green.open); +``` +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. ###### Example ```js -console.log(ansi.colors.green.open); +console.log(style.codes.get(36)); +//=> 39 ``` +## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) + +`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors. + +To use these, call the associated conversion function with the intended output, for example: + +```js +style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code +style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code + +style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code +style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code + +style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code +style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code +``` + + +## Related + +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/index.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/index.js deleted file mode 100644 index 98fae067673..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -var ansiRegex = require('ansi-regex'); -var re = new RegExp(ansiRegex().source); // remove the `g` flag -module.exports = re.test.bind(re); diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js deleted file mode 100644 index b9574ed7e82..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -module.exports = function () { - return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; -}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json deleted file mode 100644 index 9d0f936206b..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "_from": "ansi-regex@^2.0.0", - "_id": "ansi-regex@2.1.1", - "_inBundle": false, - "_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "_location": "/update-notifier/chalk/has-ansi/ansi-regex", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ansi-regex@^2.0.0", - "name": "ansi-regex", - "escapedName": "ansi-regex", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/update-notifier/chalk/has-ansi" - ], - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df", - "_spec": "ansi-regex@^2.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/ansi-regex/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Regular expression for matching ANSI escape codes", - "devDependencies": { - "ava": "0.17.0", - "xo": "0.16.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/chalk/ansi-regex#readme", - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com", - "url": "jbnicolai.com" - }, - { - "name": "JD Ballard", - "email": "i.am.qix@gmail.com", - "url": "github.com/qix-" - } - ], - "name": "ansi-regex", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/ansi-regex.git" - }, - "scripts": { - "test": "xo && ava --verbose", - "view-supported": "node fixtures/view-codes.js" - }, - "version": "2.1.1", - "xo": { - "rules": { - "guard-for-in": 0, - "no-loop-func": 0 - } - } -} diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md deleted file mode 100644 index 6a928edf0f6..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) - -> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install --save ansi-regex -``` - - -## Usage - -```js -const ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001b[4mcake\u001b[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001b[4mcake\u001b[0m'.match(ansiRegex()); -//=> ['\u001b[4m', '\u001b[0m'] -``` - -## FAQ - -### Why do you test for codes not in the ECMA 48 standard? - -Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. - -On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/package.json b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/package.json deleted file mode 100644 index 363177f426c..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/package.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "_from": "has-ansi@^2.0.0", - "_id": "has-ansi@2.0.0", - "_integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "_location": "/update-notifier/chalk/has-ansi", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "has-ansi@^2.0.0", - "name": "has-ansi", - "escapedName": "has-ansi", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/update-notifier/chalk" - ], - "_resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "_shasum": "34f5049ce1ecdf2b0649af3ef24e45ed35416d91", - "_shrinkwrap": null, - "_spec": "has-ansi@^2.0.0", - "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/chalk", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bin": null, - "bugs": { - "url": "https://github.com/sindresorhus/has-ansi/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "deprecated": false, - "description": "Check if a string has ANSI escape codes", - "devDependencies": { - "ava": "0.0.4" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/sindresorhus/has-ansi#readme", - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern", - "has" - ], - "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com", - "url": "jbnicolai.com" - } - ], - "name": "has-ansi", - "optionalDependencies": {}, - "peerDependencies": {}, - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/has-ansi.git" - }, - "scripts": { - "test": "node test.js" - }, - "version": "2.0.0" -} diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/readme.md b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/readme.md deleted file mode 100644 index 02bc7c2300a..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/readme.md +++ /dev/null @@ -1,36 +0,0 @@ -# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi) - -> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install --save has-ansi -``` - - -## Usage - -```js -var hasAnsi = require('has-ansi'); - -hasAnsi('\u001b[4mcake\u001b[0m'); -//=> true - -hasAnsi('cake'); -//=> false -``` - - -## Related - -- [has-ansi-cli](https://github.com/sindresorhus/has-ansi-cli) - CLI for this module -- [strip-ansi](https://github.com/sindresorhus/strip-ansi) - Strip ANSI escape codes -- [ansi-regex](https://github.com/sindresorhus/ansi-regex) - Regular expression for matching ANSI escape codes -- [chalk](https://github.com/sindresorhus/chalk) - Terminal string styling done right - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/index.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/index.js deleted file mode 100644 index 099480fbfc5..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; -var ansiRegex = require('ansi-regex')(); - -module.exports = function (str) { - return typeof str === 'string' ? str.replace(ansiRegex, '') : str; -}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js deleted file mode 100644 index b9574ed7e82..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -module.exports = function () { - return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; -}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json deleted file mode 100644 index d862639987b..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "_from": "ansi-regex@^2.0.0", - "_id": "ansi-regex@2.1.1", - "_inBundle": false, - "_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "_location": "/update-notifier/chalk/strip-ansi/ansi-regex", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "ansi-regex@^2.0.0", - "name": "ansi-regex", - "escapedName": "ansi-regex", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/update-notifier/chalk/strip-ansi" - ], - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df", - "_spec": "ansi-regex@^2.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/ansi-regex/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Regular expression for matching ANSI escape codes", - "devDependencies": { - "ava": "0.17.0", - "xo": "0.16.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/chalk/ansi-regex#readme", - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com", - "url": "jbnicolai.com" - }, - { - "name": "JD Ballard", - "email": "i.am.qix@gmail.com", - "url": "github.com/qix-" - } - ], - "name": "ansi-regex", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/ansi-regex.git" - }, - "scripts": { - "test": "xo && ava --verbose", - "view-supported": "node fixtures/view-codes.js" - }, - "version": "2.1.1", - "xo": { - "rules": { - "guard-for-in": 0, - "no-loop-func": 0 - } - } -} diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md deleted file mode 100644 index 6a928edf0f6..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) - -> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install --save ansi-regex -``` - - -## Usage - -```js -const ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001b[4mcake\u001b[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001b[4mcake\u001b[0m'.match(ansiRegex()); -//=> ['\u001b[4m', '\u001b[0m'] -``` - -## FAQ - -### Why do you test for codes not in the ECMA 48 standard? - -Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. - -On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/package.json b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/package.json deleted file mode 100644 index 1b040a1afaf..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "_from": "strip-ansi@^3.0.0", - "_id": "strip-ansi@3.0.1", - "_inBundle": false, - "_integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "_location": "/update-notifier/chalk/strip-ansi", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "strip-ansi@^3.0.0", - "name": "strip-ansi", - "escapedName": "strip-ansi", - "rawSpec": "^3.0.0", - "saveSpec": null, - "fetchSpec": "^3.0.0" - }, - "_requiredBy": [ - "/update-notifier/chalk" - ], - "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "_shasum": "6a385fb8853d952d5ff05d0e8aaf94278dc63dcf", - "_spec": "strip-ansi@^3.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/update-notifier/node_modules/chalk", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/strip-ansi/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "deprecated": false, - "description": "Strip ANSI escape codes", - "devDependencies": { - "ava": "*", - "xo": "*" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/chalk/strip-ansi#readme", - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Boy Nicolai Appelman", - "email": "joshua@jbna.nl", - "url": "jbna.nl" - }, - { - "name": "JD Ballard", - "email": "i.am.qix@gmail.com", - "url": "github.com/qix-" - } - ], - "name": "strip-ansi", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/strip-ansi.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "3.0.1" -} diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/readme.md b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/readme.md deleted file mode 100644 index cb7d9ff7ee4..00000000000 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/readme.md +++ /dev/null @@ -1,33 +0,0 @@ -# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) - -> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install --save strip-ansi -``` - - -## Usage - -```js -var stripAnsi = require('strip-ansi'); - -stripAnsi('\u001b[4mcake\u001b[0m'); -//=> 'cake' -``` - - -## Related - -- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module -- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes -- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/browser.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/browser.js new file mode 100644 index 00000000000..ae7c87b17cc --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/browser.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = false; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/index.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/index.js index 4346e272e1f..a5d9331df14 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/index.js +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/index.js @@ -1,50 +1,115 @@ 'use strict'; -var argv = process.argv; +const os = require('os'); +const hasFlag = require('has-flag'); -var terminator = argv.indexOf('--'); -var hasFlag = function (flag) { - flag = '--' + flag; - var pos = argv.indexOf(flag); - return pos !== -1 && (terminator !== -1 ? pos < terminator : true); -}; +const env = process.env; -module.exports = (function () { - if ('FORCE_COLOR' in process.env) { - return true; +const support = level => { + if (level === 0) { + return false; } + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +}; + +let supportLevel = (() => { if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { - return false; + return 0; + } + + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; } if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) { - return true; + return 1; } if (process.stdout && !process.stdout.isTTY) { - return false; + return 0; } if (process.platform === 'win32') { - return true; + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows + // release that supports 256 colors. + const osRelease = os.release().split('.'); + if ( + Number(process.versions.node.split('.')[0]) >= 8 && + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return 2; + } + + return 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } + + return 0; } - if ('COLORTERM' in process.env) { - return true; + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } - if (process.env.TERM === 'dumb') { - return false; + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Hyper': + return 3; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; } - if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) { - return true; + if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; } - return false; + if ('COLORTERM' in env) { + return 1; + } + + if (env.TERM === 'dumb') { + return 0; + } + + return 0; })(); + +if ('FORCE_COLOR' in env) { + supportLevel = parseInt(env.FORCE_COLOR, 10) === 0 ? 0 : (supportLevel || 1); +} + +module.exports = process && support(supportLevel); diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/license b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/license index 654d0bfe943..e7af2f77107 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/license +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +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 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. +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/update-notifier/node_modules/chalk/node_modules/supports-color/node_modules/has-flag/index.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/node_modules/has-flag/index.js new file mode 100644 index 00000000000..68820307dc2 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/node_modules/has-flag/index.js @@ -0,0 +1,10 @@ +'use strict'; +module.exports = function (flag, argv) { + argv = argv || process.argv; + + var terminatorPos = argv.indexOf('--'); + var prefix = /^-{1,2}/.test(flag) ? '' : '--'; + var pos = argv.indexOf(prefix + flag); + + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/node_modules/has-flag/license index 654d0bfe943..654d0bfe943 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/node_modules/has-flag/license diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/node_modules/has-flag/package.json b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/node_modules/has-flag/package.json new file mode 100644 index 00000000000..804a12fdcb0 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/node_modules/has-flag/package.json @@ -0,0 +1,93 @@ +{ + "_from": "has-flag@^2.0.0", + "_id": "has-flag@2.0.0", + "_inBundle": false, + "_integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "_location": "/update-notifier/chalk/supports-color/has-flag", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "has-flag@^2.0.0", + "name": "has-flag", + "escapedName": "has-flag", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/update-notifier/chalk/supports-color" + ], + "_resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "_shasum": "e8207af1cc7b30d446cc70b734b5e8be18f88d51", + "_spec": "has-flag@^2.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/has-flag/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Check if argv has a specific flag", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/has-flag#readme", + "keywords": [ + "has", + "check", + "detect", + "contains", + "find", + "flag", + "cli", + "command-line", + "argv", + "process", + "arg", + "args", + "argument", + "arguments", + "getopt", + "minimist", + "optimist" + ], + "license": "MIT", + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + { + "name": "Joshua Appelman", + "email": "jappelman@xebia.com", + "url": "jbnicolai.com" + }, + { + "name": "JD Ballard", + "email": "i.am.qix@gmail.com", + "url": "github.com/qix-" + } + ], + "name": "has-flag", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/has-flag.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.0.0" +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/node_modules/has-flag/readme.md b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/node_modules/has-flag/readme.md new file mode 100644 index 00000000000..0caca6cba13 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/node_modules/has-flag/readme.md @@ -0,0 +1,67 @@ +# has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag) + +> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag + +Correctly stops looking after an `--` argument terminator. + + +## Install + +``` +$ npm install --save has-flag +``` + + +## Usage + +```js +// foo.js +const hasFlag = require('has-flag'); + +hasFlag('unicorn'); +//=> true + +hasFlag('--unicorn'); +//=> true + +hasFlag('-f'); +//=> true + +hasFlag('foo=bar'); +//=> true + +hasFlag('foo'); +//=> false + +hasFlag('rainbow'); +//=> false +``` + +``` +$ node foo.js -f --unicorn --foo=bar -- --rainbow +``` + + +## API + +### hasFlag(flag, [argv]) + +Returns a boolean whether the flag exists. + +#### flag + +Type: `string` + +CLI flag to look for. The `--` prefix is optional. + +#### argv + +Type: `array`<br> +Default: `process.argv` + +CLI arguments. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/package.json b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/package.json index 902348ca1d5..6f0d0362b83 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/package.json @@ -1,49 +1,53 @@ { - "_from": "supports-color@^2.0.0", - "_id": "supports-color@2.0.0", - "_integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "_from": "supports-color@^4.0.0", + "_id": "supports-color@4.4.0", + "_inBundle": false, + "_integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "_location": "/update-notifier/chalk/supports-color", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "supports-color@^2.0.0", + "raw": "supports-color@^4.0.0", "name": "supports-color", "escapedName": "supports-color", - "rawSpec": "^2.0.0", + "rawSpec": "^4.0.0", "saveSpec": null, - "fetchSpec": "^2.0.0" + "fetchSpec": "^4.0.0" }, "_requiredBy": [ "/update-notifier/chalk" ], - "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "_shasum": "535d045ce6b6363fa40117084629995e9df324c7", - "_shrinkwrap": null, - "_spec": "supports-color@^2.0.0", + "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "_shasum": "883f7ddabc165142b2a61427f3352ded195d1a3e", + "_spec": "supports-color@^4.0.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/chalk", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, - "bin": null, + "browser": "browser.js", "bugs": { "url": "https://github.com/chalk/supports-color/issues" }, "bundleDependencies": false, - "dependencies": {}, + "dependencies": { + "has-flag": "^2.0.0" + }, "deprecated": false, "description": "Detect whether a terminal supports color", "devDependencies": { - "mocha": "*", - "require-uncached": "^1.0.2" + "ava": "*", + "import-fresh": "^2.0.0", + "xo": "*" }, "engines": { - "node": ">=0.8.0" + "node": ">=4" }, "files": [ - "index.js" + "index.js", + "browser.js" ], "homepage": "https://github.com/chalk/supports-color#readme", "keywords": [ @@ -64,30 +68,18 @@ "support", "supports", "capability", - "detect" + "detect", + "truecolor", + "16m" ], "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com", - "url": "jbnicolai.com" - } - ], "name": "supports-color", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/chalk/supports-color.git" }, "scripts": { - "test": "mocha" + "test": "xo && ava" }, - "version": "2.0.0" + "version": "4.4.0" } diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/readme.md b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/readme.md index b4761f1ecde..3bef57db0ec 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/readme.md +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/node_modules/supports-color/readme.md @@ -6,23 +6,47 @@ ## Install ``` -$ npm install --save supports-color +$ npm install supports-color ``` ## Usage ```js -var supportsColor = require('supports-color'); +const supportsColor = require('supports-color'); if (supportsColor) { console.log('Terminal supports color'); } + +if (supportsColor.has256) { + console.log('Terminal supports 256 colors'); +} + +if (supportsColor.has16m) { + console.log('Terminal supports 16 million colors (truecolor)'); +} ``` + +## API + +Returns an `Object`, or `false` if color is not supported. + +The returned object specifies a level of support for color through a `.level` property and a corresponding flag: + +- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors) +- `.level = 2` and `.has256 = true`: 256 color support +- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors) + + +## Info + It obeys the `--color` and `--no-color` CLI flags. -For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`. +Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks. + +Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. ## Related @@ -31,6 +55,12 @@ For situations where using `--color` is not possible, add an environment variabl - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/package.json b/deps/npm/node_modules/update-notifier/node_modules/chalk/package.json index 34954626c4c..8433207ecee 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/package.json @@ -1,59 +1,55 @@ { - "_from": "chalk@^1.0.0", - "_id": "chalk@1.1.3", - "_integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "_from": "chalk@^2.0.1", + "_id": "chalk@2.1.0", + "_inBundle": false, + "_integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", "_location": "/update-notifier/chalk", - "_phantomChildren": { - "ansi-regex": "2.1.1" - }, + "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "chalk@^1.0.0", + "raw": "chalk@^2.0.1", "name": "chalk", "escapedName": "chalk", - "rawSpec": "^1.0.0", + "rawSpec": "^2.0.1", "saveSpec": null, - "fetchSpec": "^1.0.0" + "fetchSpec": "^2.0.1" }, "_requiredBy": [ "/update-notifier", "/update-notifier/boxen" ], - "_resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "_shasum": "a8115c55e4a702fe4d150abd3872822a7e09fc98", - "_shrinkwrap": null, - "_spec": "chalk@^1.0.0", + "_resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "_shasum": "ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e", + "_spec": "chalk@^2.0.1", "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier", - "bin": null, "bugs": { "url": "https://github.com/chalk/chalk/issues" }, "bundleDependencies": false, "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "ansi-styles": "^3.1.0", + "escape-string-regexp": "^1.0.5", + "supports-color": "^4.0.0" }, "deprecated": false, - "description": "Terminal string styling done right. Much color.", + "description": "Terminal string styling done right", "devDependencies": { + "ava": "*", "coveralls": "^2.11.2", - "matcha": "^0.6.0", - "mocha": "*", - "nyc": "^3.0.0", - "require-uncached": "^1.0.2", - "resolve-from": "^1.0.0", - "semver": "^4.3.3", + "execa": "^0.7.0", + "import-fresh": "^2.0.0", + "matcha": "^0.7.0", + "nyc": "^11.0.2", + "resolve-from": "^3.0.0", "xo": "*" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "files": [ - "index.js" + "index.js", + "templates.js" ], "homepage": "https://github.com/chalk/chalk#readme", "keywords": [ @@ -80,37 +76,17 @@ "text" ], "license": "MIT", - "maintainers": [ - { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - { - "name": "Joshua Appelman", - "email": "jappelman@xebia.com", - "url": "jbnicolai.com" - }, - { - "name": "JD Ballard", - "email": "i.am.qix@gmail.com", - "url": "github.com/qix-" - } - ], "name": "chalk", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/chalk/chalk.git" }, "scripts": { "bench": "matcha benchmark.js", - "coverage": "nyc npm test && nyc report", - "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls", - "test": "xo && mocha" + "coveralls": "nyc report --reporter=text-lcov | coveralls", + "test": "xo && nyc ava" }, - "version": "1.1.3", + "version": "2.1.0", "xo": { "envs": [ "node", diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/readme.md b/deps/npm/node_modules/update-notifier/node_modules/chalk/readme.md index 5cf111e3533..dfcfdf25d84 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/chalk/readme.md +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/readme.md @@ -1,7 +1,7 @@ <h1 align="center"> <br> <br> - <img width="360" src="https://cdn.rawgit.com/chalk/chalk/19935d6484811c5e468817f846b7b3d417d7bf4a/logo.svg" alt="chalk"> + <img width="320" src="https://cdn.rawgit.com/chalk/chalk/19935d6484811c5e468817f846b7b3d417d7bf4a/logo.svg" alt="chalk"> <br> <br> <br> @@ -9,81 +9,104 @@ > Terminal string styling done right -[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) -[![Coverage Status](https://coveralls.io/repos/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/r/chalk/chalk?branch=master) -[![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) +[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo) - -[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough. - -**Chalk is a clean and focused alternative.** +### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0) ![](https://github.com/chalk/ansi-styles/raw/master/screenshot.png) -## Why +## Highlights -- Highly performant -- Doesn't extend `String.prototype` - Expressive API +- Highly performant - Ability to nest styles -- Clean and focused +- [256/Truecolor color support](#256-and-truecolor-color-support) - Auto-detects color support +- Doesn't extend `String.prototype` +- Clean and focused - Actively maintained -- [Used by ~4500 modules](https://www.npmjs.com/browse/depended/chalk) as of July 15, 2015 +- [Used by ~17,000 packages](https://www.npmjs.com/browse/depended/chalk) as of June 20th, 2017 ## Install -``` -$ npm install --save chalk +```console +$ npm install chalk ``` ## Usage +```js +const chalk = require('chalk'); + +console.log(chalk.blue('Hello world!')); +``` + Chalk comes with an easy to use composable API where you just chain and nest the styles you want. ```js -var chalk = require('chalk'); - -// style a string -chalk.blue('Hello world!'); +const chalk = require('chalk'); +const log = console.log; -// combine styled and normal strings -chalk.blue('Hello') + 'World' + chalk.red('!'); +// Combine styled and normal strings +log(chalk.blue('Hello') + 'World' + chalk.red('!')); -// compose multiple styles using the chainable API -chalk.blue.bgRed.bold('Hello world!'); +// Compose multiple styles using the chainable API +log(chalk.blue.bgRed.bold('Hello world!')); -// pass in multiple arguments -chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'); +// Pass in multiple arguments +log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); -// nest styles -chalk.red('Hello', chalk.underline.bgBlue('world') + '!'); +// Nest styles +log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); -// nest styles of the same type even (color, underline, background) -chalk.green( +// Nest styles of the same type even (color, underline, background) +log(chalk.green( 'I am a green line ' + chalk.blue.underline.bold('with a blue substring') + ' that becomes green again!' -); +)); + +// ES2015 template literal +log(` +CPU: ${chalk.red('90%')} +RAM: ${chalk.green('40%')} +DISK: ${chalk.yellow('70%')} +`); + +// ES2015 tagged template literal +log(chalk` +CPU: {red ${cpu.totalPercent}%} +RAM: {green ${ram.used / ram.total * 100}%} +DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} +`); + +// Use RGB colors in terminal emulators that support it. +log(chalk.keyword('orange')('Yay for orange colored text!')); +log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); +log(chalk.hex('#DEADED').bold('Bold gray!')); ``` -Easily define your own themes. +Easily define your own themes: ```js -var chalk = require('chalk'); -var error = chalk.bold.red; +const chalk = require('chalk'); + +const error = chalk.bold.red; +const warning = chalk.keyword('orange'); + console.log(error('Error!')); +console.log(warning('Warning!')); ``` -Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data). +Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): ```js -var name = 'Sindre'; +const name = 'Sindre'; console.log(chalk.green('Hello %s'), name); -//=> Hello Sindre +//=> 'Hello Sindre' ``` @@ -93,61 +116,46 @@ console.log(chalk.green('Hello %s'), name); Example: `chalk.red.bold.underline('Hello', 'world');` -Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `Chalk.red.yellow.green` is equivalent to `Chalk.green`. +Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`. Multiple arguments will be separated by space. ### chalk.enabled -Color support is automatically detected, but you can override it by setting the `enabled` property. You should however only do this in your own code as it applies globally to all chalk consumers. +Color support is automatically detected, as is the level (see `chalk.level`). However, if you'd like to simply enable/disable Chalk, you can do so via the `.enabled` property. + +Chalk is enabled by default unless expicitly disabled via the constructor or `chalk.level` is `0`. -If you need to change this in a reusable module create a new instance: +If you need to change this in a reusable module, create a new instance: ```js -var ctx = new chalk.constructor({enabled: false}); +const ctx = new chalk.constructor({enabled: false}); ``` -### chalk.supportsColor - -Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience. - -Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`. - -### chalk.styles +### chalk.level -Exposes the styles as [ANSI escape codes](https://github.com/chalk/ansi-styles). +Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers. -Generally not useful, but you might need just the `.open` or `.close` escape code if you're mixing externally styled strings with your own. +If you need to change this in a reusable module, create a new instance: ```js -var chalk = require('chalk'); - -console.log(chalk.styles.red); -//=> {open: '\u001b[31m', close: '\u001b[39m'} - -console.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close); +const ctx = new chalk.constructor({level: 0}); ``` -### chalk.hasColor(string) - -Check whether a string [has color](https://github.com/chalk/has-ansi). - -### chalk.stripColor(string) +Levels are as follows: -[Strip color](https://github.com/chalk/strip-ansi) from a string. +0. All colors disabled +1. Basic color support (16 colors) +2. 256 color support +3. Truecolor support (16 million colors) -Can be useful in combination with `.supportsColor` to strip color on externally styled text when it's not supported. +### chalk.supportsColor -Example: +Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience. -```js -var chalk = require('chalk'); -var styledString = getText(); +Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks. -if (!chalk.supportsColor) { - styledString = chalk.stripColor(styledString); -} -``` +Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. ## Styles @@ -157,11 +165,11 @@ if (!chalk.supportsColor) { - `reset` - `bold` - `dim` -- `italic` *(not widely supported)* +- `italic` *(Not widely supported)* - `underline` - `inverse` - `hidden` -- `strikethrough` *(not widely supported)* +- `strikethrough` *(Not widely supported)* ### Colors @@ -169,11 +177,18 @@ if (!chalk.supportsColor) { - `red` - `green` - `yellow` -- `blue` *(on Windows the bright version is used as normal blue is illegible)* +- `blue` *(On Windows the bright version is used since normal blue is illegible)* - `magenta` - `cyan` - `white` -- `gray` +- `gray` ("bright black") +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` ### Background colors @@ -185,29 +200,107 @@ if (!chalk.supportsColor) { - `bgMagenta` - `bgCyan` - `bgWhite` +- `bgBlackBright` +- `bgRedBright` +- `bgGreenBright` +- `bgYellowBright` +- `bgBlueBright` +- `bgMagentaBright` +- `bgCyanBright` +- `bgWhiteBright` + + +## Tagged template literal + +Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals). + +```js +const chalk = require('chalk'); + +const miles = 18; +const calculateFeet = miles => miles * 5280; + +console.log(chalk` + There are {bold 5280 feet} in a mile. + In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}. +`); +``` + +Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`). + +Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent: + +```js +console.log(chalk.bold.rgb(10, 100, 200)('Hello!')); +console.log(chalk`{bold.rgb(10,100,200) Hello!}`); +``` + +Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters. +All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped. -## 256-colors -Chalk does not support anything other than the base eight colors, which guarantees it will work on all terminals and systems. Some terminals, specifically `xterm` compliant ones, will support the full range of 8-bit colors. For this the lower level [ansi-256-colors](https://github.com/jbnicolai/ansi-256-colors) package can be used. +## 256 and Truecolor color support + +Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps. + +Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red). + +Examples: + +- `chalk.hex('#DEADED').underline('Hello, world!')` +- `chalk.keyword('orange')('Some orange text')` +- `chalk.rgb(15, 100, 204).inverse('Hello!')` + +Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors). + +- `chalk.bgHex('#DEADED').underline('Hello, world!')` +- `chalk.bgKeyword('orange')('Some orange text')` +- `chalk.bgRgb(15, 100, 204).inverse('Hello!')` + +The following color models can be used: + +- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')` +- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')` +- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')` +- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')` +- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 1, 1).bold('Orange!')` +- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hsl(32, 0, 50).bold('Orange!')` +- `ansi16` +- `ansi256` ## Windows -If you're on Windows, do yourself a favor and use [`cmder`](http://bliker.github.io/cmder/) instead of `cmd.exe`. +If you're on Windows, do yourself a favor and use [`cmder`](http://cmder.net/) instead of `cmd.exe`. + + +## Origin story + +[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative. ## Related - [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module -- [ansi-styles](https://github.com/chalk/ansi-styles/) - ANSI escape codes for styling strings in the terminal -- [supports-color](https://github.com/chalk/supports-color/) - Detect whether a terminal supports color +- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal +- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color - [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes - [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes - [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes - [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes +- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes +- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models +- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal +- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT diff --git a/deps/npm/node_modules/update-notifier/node_modules/chalk/templates.js b/deps/npm/node_modules/update-notifier/node_modules/chalk/templates.js new file mode 100644 index 00000000000..101551528a9 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/chalk/templates.js @@ -0,0 +1,128 @@ +'use strict'; +const TEMPLATE_REGEX = /(?:\\(u[a-f0-9]{4}|x[a-f0-9]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX = /\\(u[0-9a-f]{4}|x[0-9a-f]{2}|.)|([^\\])/gi; + +const ESCAPES = { + n: '\n', + r: '\r', + t: '\t', + b: '\b', + f: '\f', + v: '\v', + 0: '\0', + '\\': '\\', + e: '\u001b', + a: '\u0007' +}; + +function unescape(c) { + if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } + + return ESCAPES[c] || c; +} + +function parseArguments(name, args) { + const results = []; + const chunks = args.trim().split(/\s*,\s*/g); + let matches; + + for (const chunk of chunks) { + if (!isNaN(chunk)) { + results.push(Number(chunk)); + } else if ((matches = chunk.match(STRING_REGEX))) { + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } + + return results; +} + +function parseStyle(style) { + STYLE_REGEX.lastIndex = 0; + + const results = []; + let matches; + + while ((matches = STYLE_REGEX.exec(style)) !== null) { + const name = matches[1]; + + if (matches[2]) { + const args = parseArguments(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } + + return results; +} + +function buildStyle(chalk, styles) { + const enabled = {}; + + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } + + let current = chalk; + for (const styleName of Object.keys(enabled)) { + if (Array.isArray(enabled[styleName])) { + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } + + if (enabled[styleName].length > 0) { + current = current[styleName].apply(current, enabled[styleName]); + } else { + current = current[styleName]; + } + } + } + + return current; +} + +module.exports = (chalk, tmp) => { + const styles = []; + const chunks = []; + let chunk = []; + + // eslint-disable-next-line max-params + tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => { + if (escapeChar) { + chunk.push(unescape(escapeChar)); + } else if (style) { + const str = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str)); + styles.push({inverse, styles: parseStyle(style)}); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } + + chunks.push(buildStyle(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(chr); + } + }); + + chunks.push(chunk.join('')); + + if (styles.length > 0) { + const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMsg); + } + + return chunks.join(''); +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/configstore/index.js b/deps/npm/node_modules/update-notifier/node_modules/configstore/index.js index 166de5349f2..4883613cad2 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/configstore/index.js +++ b/deps/npm/node_modules/update-notifier/node_modules/configstore/index.js @@ -10,7 +10,7 @@ const uniqueString = require('unique-string'); const configDir = xdgBasedir.config || path.join(os.tmpdir(), uniqueString()); const permissionError = 'You don\'t have access to this file.'; -const defaultPathMode = 0o0700; +const makeDirOptions = {mode: 0o0700}; const writeFileOptions = {mode: 0o0600}; class Configstore { @@ -30,7 +30,7 @@ class Configstore { } catch (err) { // Create dir if it doesn't exist if (err.code === 'ENOENT') { - makeDir.sync(path.dirname(this.path), defaultPathMode); + makeDir.sync(path.dirname(this.path), makeDirOptions); return {}; } @@ -51,7 +51,7 @@ class Configstore { set all(val) { try { // Make sure the folder exists as it could have been deleted in the meantime - makeDir.sync(path.dirname(this.path), defaultPathMode); + makeDir.sync(path.dirname(this.path), makeDirOptions); writeFileAtomic.sync(this.path, JSON.stringify(val, null, '\t'), writeFileOptions); } catch (err) { diff --git a/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/index.js b/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/index.js index 59a0e226441..15282bb3924 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/index.js +++ b/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/index.js @@ -53,9 +53,10 @@ module.exports = { set(obj, path, value) { if (!isObj(obj) || typeof path !== 'string') { - return; + return obj; } + const root = obj; const pathArr = getPathSegments(path); for (let i = 0; i < pathArr.length; i++) { @@ -71,6 +72,8 @@ module.exports = { obj = obj[p]; } + + return root; }, delete(obj, path) { diff --git a/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/package.json b/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/package.json index ae0d9f8b45d..1512c61aff2 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/package.json @@ -1,7 +1,8 @@ { "_from": "dot-prop@^4.1.0", - "_id": "dot-prop@4.1.1", - "_integrity": "sha1-qEk/C3te7sglJbXHWH+n3nyoWcE=", + "_id": "dot-prop@4.2.0", + "_inBundle": false, + "_integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", "_location": "/update-notifier/configstore/dot-prop", "_phantomChildren": {}, "_requested": { @@ -17,9 +18,8 @@ "_requiredBy": [ "/update-notifier/configstore" ], - "_resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.1.1.tgz", - "_shasum": "a8493f0b7b5eeec82525b5c7587fa7de7ca859c1", - "_shrinkwrap": null, + "_resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "_shasum": "1f19e0c2e1aa0e32797c49799f2837ac6af69c57", "_spec": "dot-prop@^4.1.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/configstore", "author": { @@ -27,7 +27,6 @@ "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, - "bin": null, "bugs": { "url": "https://github.com/sindresorhus/dot-prop/issues" }, @@ -66,8 +65,6 @@ ], "license": "MIT", "name": "dot-prop", - "optionalDependencies": {}, - "peerDependencies": {}, "repository": { "type": "git", "url": "git+https://github.com/sindresorhus/dot-prop.git" @@ -76,7 +73,7 @@ "bench": "matcha bench.js", "test": "xo && ava" }, - "version": "4.1.1", + "version": "4.2.0", "xo": { "esnext": true } diff --git a/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/readme.md b/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/readme.md index f612c47f7ad..fab3b7afe00 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/readme.md +++ b/deps/npm/node_modules/update-notifier/node_modules/configstore/node_modules/dot-prop/readme.md @@ -34,6 +34,10 @@ dotProp.set(obj, 'foo.bar', 'b'); console.log(obj); //=> {foo: {bar: 'b'}} +const foo = dotProp.set({}, 'foo.bar', 'c'); +console.log(foo); +//=> {foo: {bar: 'c'}} + dotProp.set(obj, 'foo.baz', 'x'); console.log(obj); //=> {foo: {bar: 'b', baz: 'x'}} @@ -61,6 +65,8 @@ console.log(obj); ### set(obj, path, value) +Returns the object. + ### has(obj, path) ### delete(obj, path) diff --git a/deps/npm/node_modules/update-notifier/node_modules/configstore/package.json b/deps/npm/node_modules/update-notifier/node_modules/configstore/package.json index 3e86ca418e6..46762de578a 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/configstore/package.json +++ b/deps/npm/node_modules/update-notifier/node_modules/configstore/package.json @@ -1,8 +1,8 @@ { "_from": "configstore@^3.0.0", - "_id": "configstore@3.1.0", + "_id": "configstore@3.1.1", "_inBundle": false, - "_integrity": "sha1-Rd+QcHPibfoc9LLVL1tgVF6qEdE=", + "_integrity": "sha512-5oNkD/L++l0O6xGXxb1EWS7SivtjfGQlRyxJsYgE0Z495/L81e2h4/d3r969hoPXuFItzNOKMtsXgYG4c7dYvw==", "_location": "/update-notifier/configstore", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/update-notifier" ], - "_resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.0.tgz", - "_shasum": "45df907073e26dfa1cf4b2d52f5b60545eaa11d1", + "_resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.1.tgz", + "_shasum": "094ee662ab83fad9917678de114faaea8fcdca90", "_spec": "configstore@^3.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/update-notifier", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -75,5 +75,5 @@ "scripts": { "test": "xo && ava" }, - "version": "3.1.0" + "version": "3.1.1" } diff --git a/deps/npm/node_modules/update-notifier/node_modules/configstore/readme.md b/deps/npm/node_modules/update-notifier/node_modules/configstore/readme.md index 1613e5a8332..6af37719bc0 100644 --- a/deps/npm/node_modules/update-notifier/node_modules/configstore/readme.md +++ b/deps/npm/node_modules/update-notifier/node_modules/configstore/readme.md @@ -5,7 +5,7 @@ Config is stored in a JSON file located in `$XDG_CONFIG_HOME` or `~/.config`.<br> Example: `~/.config/configstore/some-id.json` -*If you need this for Electron, check out [`electron-config`](https://github.com/sindresorhus/electron-config) instead.* +*If you need this for Electron, check out [`electron-store`](https://github.com/sindresorhus/electron-store) instead.* ## Usage diff --git a/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/index.js b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/index.js new file mode 100644 index 00000000000..5092c2b2daa --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/index.js @@ -0,0 +1,5 @@ +'use strict'; +const globalDirs = require('global-dirs'); +const isPathInside = require('is-path-inside'); + +module.exports = isPathInside(__dirname, globalDirs.yarn.packages) || isPathInside(__dirname, globalDirs.npm.packages); diff --git a/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/license b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/license new file mode 100644 index 00000000000..e7af2f77107 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/index.js b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/index.js new file mode 100644 index 00000000000..c88287c0b09 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/index.js @@ -0,0 +1,89 @@ +'use strict'; +const path = require('path'); +const os = require('os'); +const fs = require('fs'); +const ini = require('ini'); + +const readRc = fp => { + try { + return ini.parse(fs.readFileSync(fp, 'utf8')).prefix; + } catch (err) {} +}; + +const defaultNpmPrefix = (() => { + if (process.env.PREFIX) { + return process.env.PREFIX; + } + + if (process.platform === 'win32') { + // `c:\node\node.exe` → `prefix=c:\node\` + return path.dirname(process.execPath); + } + + // `/usr/local/bin/node` → `prefix=/usr/local` + return path.dirname(path.dirname(process.execPath)); +})(); + +const getNpmPrefix = () => { + if (process.env.PREFIX) { + return process.env.PREFIX; + } + + const homePrefix = readRc(path.join(os.homedir(), '.npmrc')); + if (homePrefix) { + return homePrefix; + } + + const globalConfigPrefix = readRc(path.resolve(defaultNpmPrefix, 'etc', 'npmrc')); + if (globalConfigPrefix) { + return globalConfigPrefix; + } + + if (process.platform === 'win32') { + // Hardcoded contents of `c:\Program Files\nodejs\node_modules\npm\.npmrc` + return path.join(process.env.APPDATA, 'npm'); + } + + return defaultNpmPrefix; +}; + +const npmPrefix = path.resolve(getNpmPrefix()); + +const getYarnPrefix = () => { + if (process.env.PREFIX) { + return process.env.PREFIX; + } + + if (process.platform === 'win32') { + if (process.env.LOCALAPPDATA) { + const prefix = path.join(process.env.LOCALAPPDATA, 'Yarn'); + if (fs.existsSync(prefix)) { + return prefix; + } + } + } + + const configPrefix = path.join(os.homedir(), '.config/yarn'); + if (fs.existsSync(configPrefix)) { + return configPrefix; + } + + const homePrefix = path.join(os.homedir(), '.yarn-config'); + if (fs.existsSync(homePrefix)) { + return homePrefix; + } + + // Yarn supports the npm conventions but the inverse is not true + return npmPrefix; +}; + +exports.npm = {}; +exports.npm.prefix = npmPrefix; +exports.npm.packages = path.join(npmPrefix, process.platform === 'win32' ? 'node_modules' : 'lib/node_modules'); +exports.npm.binaries = process.platform === 'win32' ? npmPrefix : path.join(npmPrefix, 'bin'); + +const yarnPrefix = path.resolve(getYarnPrefix()); +exports.yarn = {}; +exports.yarn.prefix = yarnPrefix; +exports.yarn.packages = path.join(yarnPrefix, process.platform === 'win32' ? 'config/global/node_modules' : 'global/node_modules'); +exports.yarn.binaries = path.join(exports.yarn.packages, '.bin'); diff --git a/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/license b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/license new file mode 100644 index 00000000000..e7af2f77107 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/package.json b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/package.json new file mode 100644 index 00000000000..65334a0279f --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/package.json @@ -0,0 +1,84 @@ +{ + "_from": "global-dirs@^0.1.0", + "_id": "global-dirs@0.1.0", + "_inBundle": false, + "_integrity": "sha1-ENNAOeDfBCcuJizyQiT3IJQ0308=", + "_location": "/update-notifier/is-installed-globally/global-dirs", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "global-dirs@^0.1.0", + "name": "global-dirs", + "escapedName": "global-dirs", + "rawSpec": "^0.1.0", + "saveSpec": null, + "fetchSpec": "^0.1.0" + }, + "_requiredBy": [ + "/update-notifier/is-installed-globally" + ], + "_resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.0.tgz", + "_shasum": "10d34039e0df04272e262cf24224f7209434df4f", + "_spec": "global-dirs@^0.1.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/is-installed-globally", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/global-dirs/issues" + }, + "bundleDependencies": false, + "dependencies": { + "ini": "^1.3.4" + }, + "deprecated": false, + "description": "Get the directory of globally installed packages and binaries", + "devDependencies": { + "ava": "*", + "execa": "^0.7.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/global-dirs#readme", + "keywords": [ + "global", + "prefix", + "path", + "paths", + "npm", + "yarn", + "node", + "modules", + "node-modules", + "package", + "packages", + "binary", + "binaries", + "bin", + "directory", + "directories", + "npmrc", + "rc", + "config", + "root", + "resolve" + ], + "license": "MIT", + "name": "global-dirs", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/global-dirs.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "0.1.0" +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/readme.md b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/readme.md new file mode 100644 index 00000000000..1acea6d739f --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/global-dirs/readme.md @@ -0,0 +1,69 @@ +# global-dirs [![Build Status](https://travis-ci.org/sindresorhus/global-dirs.svg?branch=master)](https://travis-ci.org/sindresorhus/global-dirs) + +> Get the directory of globally installed packages and binaries + +Uses the same resolution logic as `npm` and `yarn`. + + +## Install + +``` +$ npm install global-dirs +``` + + +## Usage + +```js +const globalDirs = require('global-dirs'); + +console.log(globalDirs.npm.prefix); +//=> '/usr/local' + +console.log(globalDirs.npm.packages); +//=> '/usr/local/lib/node_modules' + +console.log(globalDirs.npm.binaries); +//=> '/usr/local/bin' + +console.log(globalDirs.yarn.packages); +//=> '/Users/sindresorhus/.config/yarn/global/node_modules' +``` + + +## API + +### globalDirs + +#### npm +#### yarn + +##### packages + +Directory with globally installed packages. + +Equivalent to `npm root --global`. + +##### binaries + +Directory with globally installed binaries. + +Equivalent to `npm bin --global`. + +##### prefix + +Directory with directories for packages and binaries. You probably want either of the above. + +Equivalent to `npm prefix --global`. + + +## Related + +- [import-global](https://github.com/sindresorhus/import-global) - Import a globally installed module +- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module +- [is-installed-globally](https://github.com/sindresorhus/is-installed-globally) - Check if your package was installed globally + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/is-path-inside/index.js b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/is-path-inside/index.js new file mode 100644 index 00000000000..0a4d2fd1e58 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/is-path-inside/index.js @@ -0,0 +1,14 @@ +'use strict'; +var path = require('path'); +var pathIsInside = require('path-is-inside'); + +module.exports = function (a, b) { + a = path.resolve(a); + b = path.resolve(b); + + if (a === b) { + return false; + } + + return pathIsInside(a, b); +}; diff --git a/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/is-path-inside/package.json b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/is-path-inside/package.json new file mode 100644 index 00000000000..c56279c7cb8 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/is-path-inside/package.json @@ -0,0 +1,68 @@ +{ + "_from": "is-path-inside@^1.0.0", + "_id": "is-path-inside@1.0.0", + "_inBundle": false, + "_integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", + "_location": "/update-notifier/is-installed-globally/is-path-inside", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-path-inside@^1.0.0", + "name": "is-path-inside", + "escapedName": "is-path-inside", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/update-notifier/is-installed-globally" + ], + "_resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", + "_shasum": "fc06e5a1683fbda13de667aff717bbc10a48f37f", + "_spec": "is-path-inside@^1.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier/node_modules/is-installed-globally", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/is-path-inside/issues" + }, + "bundleDependencies": false, + "dependencies": { + "path-is-inside": "^1.0.1" + }, + "deprecated": false, + "description": "Check if a path is inside another path", + "devDependencies": { + "mocha": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/is-path-inside#readme", + "keywords": [ + "path", + "inside", + "folder", + "directory", + "dir", + "file", + "resolve" + ], + "license": "MIT", + "name": "is-path-inside", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/is-path-inside.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "1.0.0" +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/is-path-inside/readme.md b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/is-path-inside/readme.md new file mode 100644 index 00000000000..0e4eb74f754 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/node_modules/is-path-inside/readme.md @@ -0,0 +1,31 @@ +# is-path-inside [![Build Status](https://travis-ci.org/sindresorhus/is-path-inside.svg?branch=master)](https://travis-ci.org/sindresorhus/is-path-inside) + +> Check if a path is inside another path + + +## Install + +```sh +$ npm install --save is-path-inside +``` + + +## Usage + +```js +var isPathInside = require('is-path-inside'); + +isPathInside('a/b', 'a/b/c'); +//=> true + +isPathInside('x/y', 'a/b/c'); +//=> false + +isPathInside('a/b/c', 'a/b/c'); +//=> false +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/package.json b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/package.json new file mode 100644 index 00000000000..d89580e7d1d --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/package.json @@ -0,0 +1,83 @@ +{ + "_from": "is-installed-globally@^0.1.0", + "_id": "is-installed-globally@0.1.0", + "_inBundle": false, + "_integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=", + "_location": "/update-notifier/is-installed-globally", + "_phantomChildren": { + "ini": "1.3.4", + "path-is-inside": "1.0.2" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-installed-globally@^0.1.0", + "name": "is-installed-globally", + "escapedName": "is-installed-globally", + "rawSpec": "^0.1.0", + "saveSpec": null, + "fetchSpec": "^0.1.0" + }, + "_requiredBy": [ + "/update-notifier" + ], + "_resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz", + "_shasum": "0dfd98f5a9111716dd535dda6492f67bf3d25a80", + "_spec": "is-installed-globally@^0.1.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/update-notifier", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/is-installed-globally/issues" + }, + "bundleDependencies": false, + "dependencies": { + "global-dirs": "^0.1.0", + "is-path-inside": "^1.0.0" + }, + "deprecated": false, + "description": "Check if your package was installed globally", + "devDependencies": { + "ava": "*", + "execa": "^0.7.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/is-installed-globally#readme", + "keywords": [ + "global", + "package", + "globally", + "module", + "install", + "installed", + "npm", + "yarn", + "is", + "check", + "detect", + "local", + "locally", + "cli", + "bin", + "binary" + ], + "license": "MIT", + "name": "is-installed-globally", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/is-installed-globally.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "0.1.0" +} diff --git a/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/readme.md b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/readme.md new file mode 100644 index 00000000000..f3c93386d32 --- /dev/null +++ b/deps/npm/node_modules/update-notifier/node_modules/is-installed-globally/readme.md @@ -0,0 +1,39 @@ +# is-installed-globally [![Build Status](https://travis-ci.org/sindresorhus/is-installed-globally.svg?branch=master)](https://travis-ci.org/sindresorhus/is-installed-globally) + +> Check if your package was installed globally + +Can be useful if your CLI needs different behavior when installed globally and locally. + + +## Install + +``` +$ npm install is-installed-globally +``` + + +## Usage + +```js +const isInstalledGlobally = require('is-installed-globally'); + +// With `npm install your-package` +console.log(isInstalledGlobally); +//=> false + +// With `npm install --global your-package` +console.log(isInstalledGlobally); +//=> true +``` + + +## Related + +- [import-global](https://github.com/sindresorhus/import-global) - Import a globally installed module +- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module +- [global-dirs](https://github.com/sindresorhus/global-dirs) - Get the directory of globally installed packages and binaries + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/deps/npm/node_modules/update-notifier/package.json b/deps/npm/node_modules/update-notifier/package.json index d01b75b9291..537142bf565 100644 --- a/deps/npm/node_modules/update-notifier/package.json +++ b/deps/npm/node_modules/update-notifier/package.json @@ -1,37 +1,39 @@ { - "_from": "update-notifier@2.2.0", - "_id": "update-notifier@2.2.0", + "_from": "update-notifier@2.3", + "_id": "update-notifier@2.3.0", "_inBundle": false, - "_integrity": "sha1-G1g3z5DAc22IYncytmHBOPht5y8=", + "_integrity": "sha1-TognpruRUUCrCTVZ1wFOPruDdFE=", "_location": "/update-notifier", "_phantomChildren": { "graceful-fs": "4.1.11", "ini": "1.3.4", "lru-cache": "4.1.1", + "path-is-inside": "1.0.2", "safe-buffer": "5.1.1", - "semver": "5.3.0", + "semver": "5.4.1", "strip-ansi": "4.0.0", - "which": "1.2.14", + "which": "1.3.0", "write-file-atomic": "2.1.0" }, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "update-notifier@2.2.0", + "raw": "update-notifier@2.3", "name": "update-notifier", "escapedName": "update-notifier", - "rawSpec": "2.2.0", + "rawSpec": "2.3", "saveSpec": null, - "fetchSpec": "2.2.0" + "fetchSpec": "2.3" }, "_requiredBy": [ "#USER", - "/" + "/", + "/libnpx" ], - "_resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.2.0.tgz", - "_shasum": "1b5837cf90c0736d88627732b661c138f86de72f", - "_spec": "update-notifier@2.2.0", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.3.0.tgz", + "_shasum": "4e8827a6bb915140ab093559d7014e3ebb837451", + "_spec": "update-notifier@2.3", + "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -42,10 +44,11 @@ }, "bundleDependencies": false, "dependencies": { - "boxen": "^1.0.0", - "chalk": "^1.0.0", + "boxen": "^1.2.1", + "chalk": "^2.0.1", "configstore": "^3.0.0", "import-lazy": "^2.1.0", + "is-installed-globally": "^0.1.0", "is-npm": "^1.0.0", "latest-version": "^3.0.0", "semver-diff": "^2.0.0", @@ -54,10 +57,10 @@ "deprecated": false, "description": "Update notifications for your CLI app", "devDependencies": { + "ava": "*", "clear-module": "^2.1.0", "fixture-stdout": "^0.2.1", - "mocha": "*", - "strip-ansi": "^3.0.1", + "strip-ansi": "^4.0.0", "xo": "^0.18.2" }, "engines": { @@ -88,7 +91,7 @@ "url": "git+https://github.com/yeoman/update-notifier.git" }, "scripts": { - "test": "xo && mocha --timeout 20000" + "test": "xo && ava --timeout=20s" }, - "version": "2.2.0" + "version": "2.3.0" } diff --git a/deps/npm/node_modules/update-notifier/readme.md b/deps/npm/node_modules/update-notifier/readme.md index e41d6faf1e1..99e73976eee 100644 --- a/deps/npm/node_modules/update-notifier/readme.md +++ b/deps/npm/node_modules/update-notifier/readme.md @@ -8,14 +8,22 @@ Inform users of your package of updates in a non-intrusive way. #### Contents -- [Examples](#examples) +- [Install](#install) +- [Usage](#usage) - [How](#how) - [API](#api) - [About](#about) - [Users](#users) -## Examples +## Install + +``` +$ npm install update-notifier +``` + + +## Usafe ### Simple @@ -168,7 +176,7 @@ There are a bunch projects using it: - [Pageres](https://github.com/sindresorhus/pageres) - Capture website screenshots - [Node GH](http://nodegh.io) - GitHub command line tool -[And 1200+ more…](https://www.npmjs.org/browse/depended/update-notifier) +[And 1600+ more…](https://www.npmjs.org/browse/depended/update-notifier) ## License diff --git a/deps/npm/node_modules/worker-farm/.npmignore b/deps/npm/node_modules/worker-farm/.npmignore deleted file mode 100644 index 3c3629e647f..00000000000 --- a/deps/npm/node_modules/worker-farm/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/deps/npm/node_modules/worker-farm/lib/fork.js b/deps/npm/node_modules/worker-farm/lib/fork.js index cbd4011c735..46cf79b73e7 100644 --- a/deps/npm/node_modules/worker-farm/lib/fork.js +++ b/deps/npm/node_modules/worker-farm/lib/fork.js @@ -15,17 +15,15 @@ function fork (forkModule) { , 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 : function (data) { - try { - child.send(data) - } catch (e) { - // this *should* be picked up by onExit and the operation requeued - } - } + send : child.send.bind(child) , child : child } } diff --git a/deps/npm/node_modules/worker-farm/package.json b/deps/npm/node_modules/worker-farm/package.json index d3ff94a6162..d60f581cff7 100644 --- a/deps/npm/node_modules/worker-farm/package.json +++ b/deps/npm/node_modules/worker-farm/package.json @@ -1,28 +1,28 @@ { - "_from": "worker-farm@1.5.0", - "_id": "worker-farm@1.5.0", + "_from": "worker-farm@1.5.1", + "_id": "worker-farm@1.5.1", "_inBundle": false, - "_integrity": "sha512-DHRiUggxtbruaTwnLDm2/BRDKZIoOYvrgYUj5Bam4fU6Gtvc0FaEyoswFPBjMXAweGW2H4BDNIpy//1yXXuaqQ==", + "_integrity": "sha512-T5NH6Wqsd8MwGD4AK8BBllUy6LmHaqjEOyo/YIUEegZui6/v5Bqde//3jwyE3PGiGYMmWi06exFBi5LNhhPFNw==", "_location": "/worker-farm", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "worker-farm@1.5.0", + "raw": "worker-farm@1.5.1", "name": "worker-farm", "escapedName": "worker-farm", - "rawSpec": "1.5.0", + "rawSpec": "1.5.1", "saveSpec": null, - "fetchSpec": "1.5.0" + "fetchSpec": "1.5.1" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.0.tgz", - "_shasum": "adfdf0cd40581465ed0a1f648f9735722afd5c8d", - "_spec": "worker-farm@1.5.0", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.1.tgz", + "_shasum": "8e9f4a7da4f3c595aa600903051b969390423fa1", + "_spec": "worker-farm@1.5.1", + "_where": "/Users/zkat/Documents/code/npm", "authors": [ "Rod Vagg @rvagg <rod@vagg.org> (https://github.com/rvagg)" ], @@ -57,5 +57,5 @@ "test": "node ./tests/" }, "types": "./index.d.ts", - "version": "1.5.0" + "version": "1.5.1" } diff --git a/deps/npm/node_modules/worker-farm/tests/child.js b/deps/npm/node_modules/worker-farm/tests/child.js deleted file mode 100644 index 0c0d68a846f..00000000000 --- a/deps/npm/node_modules/worker-farm/tests/child.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict' - -const fs = require('fs') - - -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) - } -} - - -let started = Date.now() -module.exports.uptime = function(callback) { - callback(null, Date.now() - started) -} diff --git a/deps/npm/node_modules/worker-farm/tests/debug.js b/deps/npm/node_modules/worker-farm/tests/debug.js deleted file mode 100644 index 6ffd4464894..00000000000 --- a/deps/npm/node_modules/worker-farm/tests/debug.js +++ /dev/null @@ -1,11 +0,0 @@ -'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/worker-farm/tests/index.js b/deps/npm/node_modules/worker-farm/tests/index.js deleted file mode 100644 index bc39c1081b4..00000000000 --- a/deps/npm/node_modules/worker-farm/tests/index.js +++ /dev/null @@ -1,493 +0,0 @@ -'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) { - t.plan(4) - - let child = workerFarm({ maxConcurrentWorkers: 3, autoStart: true }, childPath, ['uptime']) - , pids = [] - , i = 3 - , delay = 150 - - setTimeout(function() { - while (i--) - child.uptime(function (err, uptime) { - t.ok(uptime > 10, 'child has been up before the request') - }) - - 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, maxCallsPerWorker: 1 }, childPath) - , pids = [] - , i = 10 - - while (i--) { - child(0, function (err, pid) { - pids.push(pid) - if (pids.length == 10) { - t.equal(10, uniq(pids).length, 'one process for each call (by pid)') - workerFarm.end(child, function () { - t.ok(true, 'workerFarm ended') - }) - } else if (pids.length > 10) - 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, maxCallsPerWorker: 2 }, childPath) - , pids = [] - , i = 10 - - while (i--) { - child(0, function (err, pid) { - pids.push(pid) - if (pids.length == 10) { - t.equal(5, uniq(pids).length, 'one process for each call (by pid)') - workerFarm.end(child, function () { - t.ok(true, 'workerFarm ended') - }) - } else if (pids.length > 10) - 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 }, childPath) - , i = 10 - , cbc = 0 - , start = Date.now() - - while (i--) { - child(100, function () { - if (++cbc == 10) { - let time = Date.now() - start - t.ok(time > 100 && time < 250, 'processed tasks concurrently (' + time + 'ms)') - workerFarm.end(child, function () { - t.ok(true, 'workerFarm ended') - }) - } else if (cbc > 10) - t.fail('too many callbacks!') - }) - } -}) - - -// 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 } - , childPath - ) - , i = 10 - , cbc = 0 - , start = Date.now() - - while (i--) { - child(20, function () { - if (++cbc == 10) { - let time = Date.now() - start - t.ok(time > 200 && time < 400, 'processed tasks sequentially (' + time + 'ms)') - workerFarm.end(child, function () { - t.ok(true, 'workerFarm ended') - }) - } else if (cbc > 10) - t.fail('too many callbacks!') - }) - } -}) - - -// use timing to confirm that one child processes *only* 5 calls concurrently -tape('multiple concurrent calls', function (t) { - t.plan(2) - - let child = workerFarm({ maxConcurrentWorkers: 1, maxConcurrentCallsPerWorker: 5 }, childPath) - , i = 10 - , cbc = 0 - , start = Date.now() - - while (i--) { - child(100, function () { - if (++cbc == 10) { - let time = Date.now() - start - t.ok(time > 200 && time < 350, 'processed tasks concurrently (' + time + 'ms)') - workerFarm.end(child, function () { - t.ok(true, 'workerFarm ended') - }) - } else if (cbc > 10) - t.fail('too many callbacks!') - }) - } -}) - - -// 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 = [] - , i = 10 - - while (i--) { - child.killable(i, function (err, id, pid) { - ids.push(id) - pids.push(pid) - if (ids.length == 10) { - t.ok(uniq(pids).length > 2, 'processed by many (' + uniq(pids).length + ') workers, but got there in the end!') - t.ok(uniq(ids).length == 10, 'received a single result for each unique call') - workerFarm.end(child, function () { - t.ok(true, 'workerFarm ended') - }) - } else if (ids.length > 10) - 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') - }) -}) diff --git a/deps/npm/package.json b/deps/npm/package.json index 71443a9ee2c..fb2b04c1b5c 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "5.5.1", + "version": "5.6.0", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -40,8 +40,9 @@ "ansistyles": "~0.1.3", "aproba": "~1.2.0", "archy": "~1.0.0", - "bluebird": "~3.5.0", - "cacache": "~9.2.9", + "bin-links": "^1.1.0", + "bluebird": "~3.5.1", + "cacache": "~10.0.1", "call-limit": "~1.1.0", "chownr": "~1.0.1", "cli-table2": "~0.2.0", @@ -51,8 +52,10 @@ "detect-indent": "~5.0.0", "dezalgo": "~1.0.3", "editor": "~1.0.0", + "find-npm-prefix": "~1.0.1", "fs-vacuum": "~1.2.10", "fs-write-stream-atomic": "~1.0.10", + "gentle-fs": "^2.0.1", "glob": "~7.1.2", "graceful-fs": "~4.1.11", "has-unicode": "~2.0.1", @@ -64,7 +67,7 @@ "init-package-json": "~1.10.1", "is-cidr": "~1.0.0", "lazy-property": "~1.0.0", - "libnpx": "~9.6.0", + "libnpx": "~9.7.1", "lockfile": "~1.0.3", "lodash._baseuniq": "~4.6.0", "lodash.clonedeep": "~4.5.0", @@ -75,27 +78,26 @@ "meant": "~1.0.1", "mississippi": "~1.3.0", "mkdirp": "~0.5.1", - "move-concurrently": "~1.0.1", - "node-gyp": "~3.6.2", + "move-concurrently": "^1.0.1", "nopt": "~4.0.1", "normalize-package-data": "~2.4.0", "npm-cache-filename": "~1.0.2", "npm-install-checks": "~3.0.0", - "npm-lifecycle": "~1.0.3", - "npm-package-arg": "~5.1.2", - "npm-packlist": "~1.1.9", - "npm-profile": "~2.0.4", + "npm-lifecycle": "~2.0.0", + "npm-package-arg": "~6.0.0", + "npm-packlist": "~1.1.10", + "npm-profile": "~2.0.5", "npm-registry-client": "~8.5.0", "npm-user-validate": "~1.0.0", "npmlog": "~4.1.2", "once": "~1.4.0", "opener": "~1.4.3", "osenv": "~0.1.4", - "pacote": "~6.0.2", + "pacote": "^7.0.2", "path-is-inside": "~1.0.2", "promise-inflight": "~1.0.1", "qrcode-terminal": "~0.11.0", - "query-string": "~5.0.0", + "query-string": "~5.0.1", "qw": "~1.0.1", "read": "~1.0.7", "read-cmd-shim": "~1.0.1", @@ -112,19 +114,19 @@ "slide": "~1.1.6", "sorted-object": "~2.0.1", "sorted-union-stream": "~2.1.3", - "ssri": "~4.1.6", + "ssri": "~5.0.0", "strip-ansi": "~4.0.0", - "tar": "~4.0.1", + "tar": "^4.0.2", "text-table": "~0.2.0", "uid-number": "0.0.6", "umask": "~1.1.0", "unique-filename": "~1.1.0", "unpipe": "~1.0.0", - "update-notifier": "~2.2.0", + "update-notifier": "~2.3.0", "uuid": "~3.1.0", "validate-npm-package-name": "~3.0.0", "which": "~1.3.0", - "worker-farm": "~1.5.0", + "worker-farm": "~1.5.1", "wrappy": "~1.0.2", "write-file-atomic": "~2.1.0" }, @@ -138,6 +140,7 @@ "cacache", "call-limit", "bluebird", + "bin-links", "chownr", "cli-table2", "cmd-shim", @@ -147,8 +150,10 @@ "detect-indent", "dezalgo", "editor", + "find-npm-prefix", "fs-vacuum", "fs-write-stream-atomic", + "gentle-fs", "glob", "graceful-fs", "has-unicode", @@ -180,7 +185,6 @@ "mkdirp", "mississippi", "move-concurrently", - "node-gyp", "nopt", "normalize-package-data", "npm-cache-filename", diff --git a/deps/npm/test/tap/add-remote-git-file.js b/deps/npm/test/tap/add-remote-git-file.js index 546a73ff656..20392af8770 100644 --- a/deps/npm/test/tap/add-remote-git-file.js +++ b/deps/npm/test/tap/add-remote-git-file.js @@ -10,6 +10,7 @@ var rimraf = require('rimraf') var test = require('tap').test var npm = require('../../lib/npm.js') +var fetchPackageMetadata = require('../../lib/fetch-package-metadata.js') var common = require('../common-tap.js') var pkg = resolve(__dirname, 'add-remote-git-file') @@ -34,13 +35,15 @@ test('setup', function (t) { test('cache from repo', function (t) { process.chdir(pkg) - return npm.commands.cache.add(cloneURL).then((data) => { + fetchPackageMetadata(cloneURL, process.cwd(), {}, (err, manifest) => { + if (err) t.fail(err.message) t.equal( - url.parse(data.manifest._resolved).protocol, + url.parse(manifest._resolved).protocol, 'git+file:', 'npm didn\'t go crazy adding git+git+git+git' ) - t.equal(data.manifest._spec.type, 'git', 'cached git') + t.equal(manifest._requested.type, 'git', 'cached git') + t.end() }) }) diff --git a/deps/npm/test/tap/bearer-token-check.js b/deps/npm/test/tap/bearer-token-check.js index 23870d2f210..e3af793e602 100644 --- a/deps/npm/test/tap/bearer-token-check.js +++ b/deps/npm/test/tap/bearer-token-check.js @@ -1,8 +1,9 @@ var resolve = require('path').resolve var writeFileSync = require('graceful-fs').writeFileSync +var fs = require('fs') var mkdirp = require('mkdirp') -var mr = require('npm-registry-mock') +var http = require('http') var osenv = require('osenv') var rimraf = require('rimraf') var test = require('tap').test @@ -18,25 +19,29 @@ var tarballPath = '/scoped-underscore/-/scoped-underscore-1.3.1.tgz' var tarballURL = 'http://127.0.0.1:' + common.port + tarballPath var tarball = resolve(__dirname, '../fixtures/scoped-underscore-1.3.1.tgz') -var server - -var EXEC_OPTS = { cwd: pkg } - -function mocks (server) { - var auth = 'Bearer 0xabad1dea' - server.get(tarballPath, { authorization: auth }).reply(403, { - error: 'token leakage', - reason: 'This token should not be sent.' - }) - server.get(tarballPath).replyWithFile(200, tarball) -} +var EXEC_OPTS = { cwd: pkg, stdio: [0, 'pipe', 2] } + +var auth = 'Bearer 0xabad1dea' +var server = http.createServer() +server.on('request', (req, res) => { + if (req.method === 'GET' && req.url === tarballPath) { + if (req.headers.authorization === auth) { + res.writeHead(403, 'this token should not be sent') + res.end() + } else { + res.writeHead(200, 'ok') + res.end(fs.readFileSync(tarball)) + } + } else { + res.writeHead(500) + res.end() + } +}) test('setup', function (t) { - mr({ port: common.port, plugin: mocks }, function (er, s) { - server = s - t.ok(s, 'set up mock registry') + server.listen(common.port, () => { setup() - t.end() + t.done() }) }) @@ -44,7 +49,6 @@ test('authed npm install with tarball not on registry', function (t) { common.npm( [ 'install', - '--loglevel', 'silent', '--json', '--fetch-retries', 0, '--registry', common.registry, @@ -52,7 +56,7 @@ test('authed npm install with tarball not on registry', function (t) { ], EXEC_OPTS, function (err, code, stdout, stderr) { - t.ifError(err, 'test runner executed without error') + if (err) throw err t.equal(code, 0, 'npm install exited OK') t.comment(stdout.trim()) t.comment(stderr.trim()) @@ -79,9 +83,10 @@ test('authed npm install with tarball not on registry', function (t) { }) test('cleanup', function (t) { - server.close() - cleanup() - t.end() + server.close(() => { + cleanup() + t.end() + }) }) var contents = '@scoped:registry=' + common.registry + '\n' + diff --git a/deps/npm/test/tap/config-basic.js b/deps/npm/test/tap/config-basic.js index b8102da90c9..2787f813719 100644 --- a/deps/npm/test/tap/config-basic.js +++ b/deps/npm/test/tap/config-basic.js @@ -4,7 +4,6 @@ var common = require('./00-config-setup.js') var path = require('path') var projectData = { - 'save-prefix': '~', 'legacy-bundling': true } diff --git a/deps/npm/test/tap/config-builtin.js b/deps/npm/test/tap/config-builtin.js index 53d00a31a79..038f47dd12b 100644 --- a/deps/npm/test/tap/config-builtin.js +++ b/deps/npm/test/tap/config-builtin.js @@ -15,7 +15,6 @@ var biData = { 'builtin-config': true } var cli = { foo: 'bar', heading: 'foo', 'git-tag-version': false } var projectData = { - 'save-prefix': '~', 'legacy-bundling': true } diff --git a/deps/npm/test/tap/files-and-ignores.js b/deps/npm/test/tap/files-and-ignores.js index 6d44f3ea35f..6d8b43e9d57 100644 --- a/deps/npm/test/tap/files-and-ignores.js +++ b/deps/npm/test/tap/files-and-ignores.js @@ -626,6 +626,36 @@ test('folder-based inclusion works', function (t) { }) }) +test('file that starts with @ sign included normally', (t) => { + const fixture = new Tacks( + Dir({ + 'package.json': File({ + name: 'npm-test-files', + version: '1.2.5' + }), + '@sub1': Dir({ + sub: Dir({ + include1: File('') + }) + }), + sub2: Dir({ + '@include': File(''), + '@sub3': Dir({ + include1: File('') + }) + }) + }) + ) + withFixture(t, fixture, function (done) { + t.ok(fileExists('@sub1/sub/include1'), '@ dir included') + + t.ok(fileExists('sub2/@include'), '@ file included') + t.ok(fileExists('sub2/@sub3/include1'), 'nested @ dir included') + + done() + }) +}) + function fileExists (file) { try { return !!fs.statSync(path.resolve(targetpath, 'package', file)) diff --git a/deps/npm/test/tap/install-package-lock-only.js b/deps/npm/test/tap/install-package-lock-only.js new file mode 100644 index 00000000000..b117dc97e3b --- /dev/null +++ b/deps/npm/test/tap/install-package-lock-only.js @@ -0,0 +1,86 @@ +'use strict' +var fs = require('fs') +var path = require('path') +var test = require('tap').test +var mr = require('npm-registry-mock') +var Tacks = require('tacks') +var File = Tacks.File +var Dir = Tacks.Dir +var extend = Object.assign || require('util')._extend +var common = require('../common-tap.js') + +var basedir = path.join(__dirname, path.basename(__filename, '.js')) +var testdir = path.join(basedir, 'testdir') +var cachedir = path.join(basedir, 'cache') +var globaldir = path.join(basedir, 'global') +var tmpdir = path.join(basedir, 'tmp') + +var pkgLockPath = path.join(testdir, 'package-lock.json') +var nodeModulesPath = path.join(testdir, 'node_modules') + +var conf = { + cwd: testdir, + env: extend(extend({}, process.env), { + npm_config_cache: cachedir, + npm_config_tmp: tmpdir, + npm_config_prefix: globaldir, + npm_config_registry: common.registry, + npm_config_loglevel: 'warn' + }) +} + +var server +var fixture = new Tacks(Dir({ + cache: Dir(), + global: Dir(), + tmp: Dir(), + testdir: Dir({ + 'package.json': File({ + name: 'install-package-lock-only', + version: '1.0.0', + dependencies: { + mkdirp: '^0.3.4' + } + }) + }) +})) + +function setup () { + cleanup() + fixture.create(basedir) +} + +function cleanup () { + fixture.remove(basedir) +} + +test('setup', function (t) { + setup() + mr({port: common.port, throwOnUnmatched: true}, function (err, s) { + if (err) throw err + server = s + t.done() + }) +}) + +test('package-lock-only', function (t) { + return common.npm(['install', '--package-lock-only'], conf).spread((code, stdout, stderr) => { + t.is(code, 0, 'command ran ok') + t.comment(stdout.trim()) + t.comment(stderr.trim()) + // Verify that node_modules does not exist + t.notOk(fs.existsSync(nodeModulesPath), 'ensure that node_modules does not exist') + + // Verify that package-lock.json exists and has `mkdirp@0.3.5` in it. + t.ok(fs.existsSync(pkgLockPath), 'ensure that package-lock.json was created') + var pkgLock = JSON.parse(fs.readFileSync(pkgLockPath, 'utf-8')) + t.equal(pkgLock.dependencies.mkdirp.version, '0.3.5') + t.done() + }) +}) + +test('cleanup', function (t) { + server.close() + cleanup() + t.done() +}) diff --git a/deps/npm/test/tap/install-shrinkwrapped-git.js b/deps/npm/test/tap/install-shrinkwrapped-git.js index f697980de90..db22acc7f6f 100644 --- a/deps/npm/test/tap/install-shrinkwrapped-git.js +++ b/deps/npm/test/tap/install-shrinkwrapped-git.js @@ -30,6 +30,7 @@ var childPackageJSON = JSON.stringify({ }) test('setup', function (t) { + cleanup() setup(function (err, result) { t.ifError(err, 'git started up successfully') diff --git a/deps/npm/test/tap/is-registry.js b/deps/npm/test/tap/is-registry.js new file mode 100644 index 00000000000..832eb537d3f --- /dev/null +++ b/deps/npm/test/tap/is-registry.js @@ -0,0 +1,27 @@ +'use strict' +const test = require('tap').test +const npa = require('npm-package-arg') +const isRegistry = require('../../lib/utils/is-registry.js') + +test('current npa', (t) => { + t.is(Boolean(isRegistry(npa('foo@1.0.0'))), true, 'version') + t.is(Boolean(isRegistry(npa('foo@^1.0.0'))), true, 'range') + t.is(Boolean(isRegistry(npa('foo@test'))), true, 'tag') + t.is(Boolean(isRegistry(npa('foo@git://foo.bar/test.git'))), false, 'git') + t.is(Boolean(isRegistry(npa('foo@foo/bar'))), false, 'github') + t.is(Boolean(isRegistry(npa('foo@http://example.com/example.tgz'))), false, 'remote') + t.is(Boolean(isRegistry(npa('foo@file:example.tgz'))), false, 'file') + t.is(Boolean(isRegistry(npa('foo@file:example/'))), false, 'dir') + t.done() +}) + +test('legacy spec data', (t) => { + t.is(Boolean(isRegistry({type: 'version'})), true, 'version') + t.is(Boolean(isRegistry({type: 'range'})), true, 'range') + t.is(Boolean(isRegistry({type: 'tag'})), true, 'tag') + t.is(Boolean(isRegistry({type: 'git'})), false, 'git') + t.is(Boolean(isRegistry({type: 'file'})), false, 'file') + t.is(Boolean(isRegistry({type: 'directory'})), false, 'directory') + t.is(Boolean(isRegistry({type: 'remote'})), false, 'remote') + t.done() +}) diff --git a/deps/npm/test/tap/lockfile-http-deps.js b/deps/npm/test/tap/lockfile-http-deps.js new file mode 100644 index 00000000000..058525c947b --- /dev/null +++ b/deps/npm/test/tap/lockfile-http-deps.js @@ -0,0 +1,91 @@ +'use strict' +const fs = require('fs') +var path = require('path') +var test = require('tap').test +var mr = require('npm-registry-mock') +var Tacks = require('tacks') +var File = Tacks.File +var Dir = Tacks.Dir +var extend = Object.assign || require('util')._extend +var common = require('../common-tap.js') + +var basedir = path.join(__dirname, path.basename(__filename, '.js')) +var testdir = path.join(basedir, 'testdir') +var cachedir = path.join(basedir, 'cache') +var globaldir = path.join(basedir, 'global') +var tmpdir = path.join(basedir, 'tmp') + +var conf = { + cwd: testdir, + env: extend(extend({}, process.env), { + npm_config_cache: cachedir, + npm_config_tmp: tmpdir, + npm_config_prefix: globaldir, + npm_config_registry: common.registry, + npm_config_loglevel: 'warn' + }) +} + +var server +var fixture = new Tacks(Dir({ + cache: Dir(), + global: Dir(), + tmp: Dir(), + testdir: Dir({ + 'package-lock.json': File({ + name: 'http-locks', + version: '1.0.0', + lockfileVersion: 1, + requires: true, + dependencies: { + minimist: { + version: common.registry + '/minimist/-/minimist-0.0.5.tgz', + integrity: 'sha1-16oye87PUY+RBqxrjwA/o7zqhWY=' + } + } + }), + 'package.json': File({ + name: 'http-locks', + version: '1.0.0', + dependencies: { + minimist: common.registry + '/minimist/-/minimist-0.0.5.tgz' + } + }) + }) +})) + +function setup () { + cleanup() + fixture.create(basedir) +} + +function cleanup () { + fixture.remove(basedir) +} + +test('setup', function (t) { + setup() + mr({port: common.port, throwOnUnmatched: true}, function (err, s) { + if (err) throw err + server = s + t.done() + }) +}) + +test('http deps in lock files', function (t) { + common.npm(['install'], conf, function (err, code, stdout, stderr) { + if (err) throw err + t.is(code, 0, 'command ran ok') + t.comment(stdout.trim()) + t.comment(stderr.trim()) + const minPackage = JSON.parse(fs.readFileSync(testdir + '/node_modules/minimist/package.json')) + t.is(minPackage.version, '0.0.5', 'package version was maintained') + t.done() + }) +}) + +test('cleanup', function (t) { + server.close() + cleanup() + t.done() +}) diff --git a/deps/npm/test/tap/optional-metadep-rollback-collision.js b/deps/npm/test/tap/optional-metadep-rollback-collision.js index ce62e005ba4..f4ac6bdc790 100644 --- a/deps/npm/test/tap/optional-metadep-rollback-collision.js +++ b/deps/npm/test/tap/optional-metadep-rollback-collision.js @@ -158,7 +158,7 @@ test('setup', function (t) { }) }) test('go go test racer', function (t) { - common.npm( + return common.npm( [ '--prefix', pkg, '--fetch-retries', '0', @@ -175,19 +175,13 @@ test('go go test racer', function (t) { PATH: process.env.PATH, Path: process.env.Path }, - stdio: [ 0, 'pipe', 2 ] - }, - function (er, code, stdout, stderr) { - t.ifError(er, 'install ran to completion without error') - t.is(code, 0, 'npm install exited with code 0') + stdio: 'pipe' + }).spread((code, stdout, stderr) => { + t.comment(stdout.trim()) t.comment(stderr.trim()) - // stdout should be empty, because we only have one, optional, dep and - // if it fails we shouldn't try installing anything - t.equal(stdout, '') + t.is(code, 0, 'npm install exited with code 0') t.notOk(/not ok/.test(stdout), 'should not contain the string \'not ok\'') - t.end() - } - ) + }) }) test('verify results', function (t) { diff --git a/deps/npm/test/tap/process-logger.js b/deps/npm/test/tap/process-logger.js new file mode 100644 index 00000000000..45c4e708cc1 --- /dev/null +++ b/deps/npm/test/tap/process-logger.js @@ -0,0 +1,12 @@ +'use strict' +const test = require('tap').test +require('../../lib/npm.js') + +test('process logging', (t) => { + t.ok(process.listenerCount('log') >= 1, `log listener attached ${process.listenerCount('log')} >= 1`) + t.doesNotThrow(() => process.emit('log', 'error', 'test', 'this'), 'logging does not throw') + t.doesNotThrow(() => process.emit('log', 2348), 'invalid args do not throw') + t.doesNotThrow(() => process.emit('log', null), 'null does not throw') + t.doesNotThrow(() => process.emit('log', {}), 'obj does not throw') + t.done() +}) diff --git a/deps/npm/test/tap/shrinkwrap-_auth.js b/deps/npm/test/tap/shrinkwrap-_auth.js index d96cfa9dc31..5aff86fb08f 100644 --- a/deps/npm/test/tap/shrinkwrap-_auth.js +++ b/deps/npm/test/tap/shrinkwrap-_auth.js @@ -1,10 +1,14 @@ +'use strict' + +var fs = require('fs') var path = require('path') var writeFileSync = require('graceful-fs').writeFileSync var mkdirp = require('mkdirp') -var mr = require('npm-registry-mock') var osenv = require('osenv') +var http = require('http') var rimraf = require('rimraf') +var ssri = require('ssri') var test = require('tap').test var common = require('../common-tap.js') @@ -16,26 +20,33 @@ var modules = path.resolve(pkg, 'node_modules') var tarballPath = '/scoped-underscore/-/scoped-underscore-1.3.1.tgz' var tarballURL = common.registry + tarballPath var tarball = path.resolve(__dirname, '../fixtures/scoped-underscore-1.3.1.tgz') +var tarballIntegrity = ssri.fromData(fs.readFileSync(tarball)).toString() var _auth = '0xabad1dea' - -var server - -function mocks (server) { - var auth = 'Basic ' + _auth - server.get(tarballPath, { authorization: auth }).replyWithFile(200, tarball) - server.get(tarballPath).reply(401, { - error: 'unauthorized', - reason: 'You are not authorized to access this db.' - }) -} +var server = http.createServer() +const errors = [] +server.on('request', (req, res) => { + const auth = 'Basic ' + _auth + if (req.method === 'GET' && req.url === tarballPath) { + if (req.headers.authorization === auth) { + res.writeHead(200, 'ok') + res.end(fs.readFileSync(tarball)) + } else { + res.writeHead(403, 'unauthorized') + errors.push("Got authorization of '" + req.headers.authorization + "' expected '" + auth + "'") + res.end() + } + } else { + res.writeHead(500) + errors.push('Unknown request: ' + req.method + ' ' + req.url) + res.end() + } +}) test('setup', function (t) { - mr({ port: common.port, plugin: mocks }, function (er, s) { - server = s - t.ok(s, 'set up mock registry') + server.listen(common.port, () => { setup() - t.end() + t.done() }) }) @@ -43,15 +54,17 @@ test('authed npm install with shrinkwrapped global package using _auth', functio common.npm( [ 'install', - '--loglevel', 'warn', + '--loglevel', 'error', '--json', '--fetch-retries', 0, + '--registry', common.registry, '--userconfig', outfile ], {cwd: pkg, stdio: [0, 'pipe', 2]}, function (err, code, stdout) { if (err) throw err t.equal(code, 0, 'npm install exited OK') + errors.forEach((err) => t.comment('Error: ' + err)) try { var results = JSON.parse(stdout) t.match(results, {added: [{name: '@scoped/underscore', version: '1.3.1'}]}, '@scoped/underscore installed') @@ -66,13 +79,13 @@ test('authed npm install with shrinkwrapped global package using _auth', functio }) test('cleanup', function (t) { - server.close() - cleanup() - t.end() + server.close(() => { + cleanup() + t.end() + }) }) -var contents = 'registry=' + common.registry + '\n' + - '_auth=' + _auth + '\n' + +var contents = '_auth=' + _auth + '\n' + '\'always-auth\'=true\n' var json = { @@ -86,9 +99,11 @@ var json = { var shrinkwrap = { name: 'test-package-install', version: '1.0.0', + lockfileVersion: 1, dependencies: { '@scoped/underscore': { resolved: tarballURL, + integrity: tarballIntegrity, version: '1.3.1' } } diff --git a/deps/npm/test/tap/shrinkwrap-global-auth.js b/deps/npm/test/tap/shrinkwrap-global-auth.js index be04d99c78f..76fa0a4662b 100644 --- a/deps/npm/test/tap/shrinkwrap-global-auth.js +++ b/deps/npm/test/tap/shrinkwrap-global-auth.js @@ -1,3 +1,6 @@ +'use strict' + +var fs = require('fs') var path = require('path') var writeFileSync = require('graceful-fs').writeFileSync @@ -5,6 +8,7 @@ var mkdirp = require('mkdirp') var mr = require('npm-registry-mock') var osenv = require('osenv') var rimraf = require('rimraf') +var ssri = require('ssri') var test = require('tap').test var common = require('../common-tap.js') @@ -16,6 +20,7 @@ var modules = path.resolve(pkg, 'node_modules') var tarballPath = '/scoped-underscore/-/scoped-underscore-1.3.1.tgz' var tarballURL = common.registry + tarballPath var tarball = path.resolve(__dirname, '../fixtures/scoped-underscore-1.3.1.tgz') +var tarballIntegrity = ssri.fromData(fs.readFileSync(tarball)).toString() var server @@ -41,10 +46,11 @@ test('authed npm install with shrinkwrapped global package', function (t) { common.npm( [ 'install', - '--loglevel', 'warn', + '--loglevel', 'error', '--json', '--fetch-retries', 0, - '--userconfig', outfile + '--userconfig', outfile, + '--registry', common.registry ], {cwd: pkg, stdio: [0, 'pipe', 2]}, function (err, code, stdout) { @@ -84,9 +90,11 @@ var json = { var shrinkwrap = { name: 'test-package-install', version: '1.0.0', + lockfileVersion: 1, dependencies: { '@scoped/underscore': { resolved: tarballURL, + integrity: tarballIntegrity, version: '1.3.1' } } diff --git a/deps/npm/test/tap/shrinkwrap-scoped-auth.js b/deps/npm/test/tap/shrinkwrap-scoped-auth.js index 1b000f93854..72c3b511985 100644 --- a/deps/npm/test/tap/shrinkwrap-scoped-auth.js +++ b/deps/npm/test/tap/shrinkwrap-scoped-auth.js @@ -1,3 +1,6 @@ +'use strict' + +var fs = require('fs') var path = require('path') var writeFileSync = require('graceful-fs').writeFileSync @@ -5,6 +8,7 @@ var mkdirp = require('mkdirp') var mr = require('npm-registry-mock') var osenv = require('osenv') var rimraf = require('rimraf') +var ssri = require('ssri') var test = require('tap').test var common = require('../common-tap.js') @@ -16,6 +20,7 @@ var modules = path.resolve(pkg, 'node_modules') var tarballPath = '/scoped-underscore/-/scoped-underscore-1.3.1.tgz' var tarballURL = common.registry + tarballPath var tarball = path.resolve(__dirname, '../fixtures/scoped-underscore-1.3.1.tgz') +var tarballIntegrity = ssri.fromData(fs.readFileSync(tarball)).toString() var server @@ -41,10 +46,11 @@ test('authed npm install with shrinkwrapped scoped package', function (t) { common.npm( [ 'install', - '--loglevel', 'warn', + '--loglevel', 'error', '--json', '--fetch-retries', 0, - '--userconfig', outfile + '--userconfig', outfile, + '--registry', common.registry ], {cwd: pkg, stdio: [0, 'pipe', 2]}, function (err, code, stdout) { @@ -83,9 +89,11 @@ var json = { var shrinkwrap = { name: 'test-package-install', version: '1.0.0', + lockfileVersion: 1, dependencies: { '@scoped/underscore': { resolved: tarballURL, + integrity: tarballIntegrity, version: '1.3.1' } } diff --git a/deps/npm/test/tap/unit-gentlyrm.js b/deps/npm/test/tap/unit-gentlyrm.js deleted file mode 100644 index 8ea0a11fc25..00000000000 --- a/deps/npm/test/tap/unit-gentlyrm.js +++ /dev/null @@ -1,387 +0,0 @@ -'use strict' -var test = require('tap').test -var requireInject = require('require-inject') -var path = require('path') - -function error (code) { - var er = new Error() - er.code = code - return er -} - -function platformPath (unixPath) { - if (unixPath[0] === '/') { - return path.resolve(unixPath) - } else { - return path.join.apply(path, unixPath.split('/')) - } -} - -function makeObjUsePlatformPaths (obj) { - if (typeof obj === 'string') { - return platformPath(obj) - } else if (obj == null || typeof obj !== 'object') { - return obj - } else { - Object.keys(obj).forEach(function (key) { - var newKey = platformPath(key) - obj[key] = makeObjUsePlatformPaths(obj[key]) - if (newKey !== key) { - obj[newKey] = obj[key] - delete obj[key] - } - }) - } - return obj -} - -function makeArgsUsePlatformPaths (fn) { - return function () { - var args = Array.prototype.slice.call(arguments) - return fn.apply(null, makeObjUsePlatformPaths(args)) - } -} - -function pathIs (t, arg1, arg2, msg) { - t.is(arg1, makeObjUsePlatformPaths(arg2), msg) -} - -function pathIsDeeply (t, arg1, arg2, msg) { - t.isDeeply(arg1, makeObjUsePlatformPaths(arg2), msg) -} - -function mockWith (fixture) { - makeObjUsePlatformPaths(fixture) - return { - '../../lib/npm.js': {}, - 'graceful-fs': { - lstat: function (path, cb) { - path = platformPath(path) - var entry = fixture[path] - if (!entry) return cb(error('ENOENT')) - cb(null, { - isDirectory: function () { return entry.type === 'directory' }, - isSymbolicLink: function () { return entry.type === 'symlink' }, - isFile: function () { return entry.type === 'file' || entry.type === 'cmdshim' || entry.type === 'error' } - }) - }, - readlink: function (path, cb) { - path = platformPath(path) - var entry = fixture[path] - if (!entry) return cb(error('ENOENT')) - if (entry.type !== 'symlink') return cb(error('EINVAL')) - cb(null, entry.dest) - } - }, - 'read-cmd-shim': function (path, cb) { - path = platformPath(path) - var entry = fixture[path] - if (!entry) return cb(error('ENOENT')) - if (entry.type === 'directory') return cb(error('EISDIR')) - if (entry.type === 'error') return cb(error(entry.code)) - if (entry.type !== 'cmdshim') return cb(error('ENOTASHIM')) - cb(null, entry.dest) - } - } -} - -test('readLinkOrShim', function (t) { - t.plan(10) - - var mocks = mockWith({ - '/path/to/directory': { type: 'directory' }, - '/path/to/link': { type: 'symlink', dest: '../to/file' }, - '/path/to/file': { type: 'file' }, - '/path/to/cmdshim': { type: 'cmdshim', dest: '../to/file' }, - '/path/to/invalid': { type: 'error', code: 'EINVAL' } - }) - - var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mocks) - var readLinkOrShim = makeArgsUsePlatformPaths(gentlyRm._readLinkOrShim) - - readLinkOrShim('/path/to/nowhere', function (er, path) { - t.is(er && er.code, 'ENOENT', 'missing files are errors') - }) - readLinkOrShim('/path/to/invalid', function (er, path) { - t.is(er && er.code, 'EINVAL', 'other errors pass through too') - }) - readLinkOrShim('/path/to/directory', function (er, path) { - t.ifError(er, "reading dirs isn't an error") - pathIs(t, path, null, 'reading non links/cmdshims gives us null') - }) - readLinkOrShim('/path/to/file', function (er, path) { - t.ifError(er, "reading non-cmdshim files isn't an error") - pathIs(t, path, null, 'reading non links/cmdshims gives us null') - }) - readLinkOrShim('/path/to/link', function (er, path) { - t.ifError(er, "reading links isn't an error") - pathIs(t, path, '../to/file', 'reading links works') - }) - readLinkOrShim('/path/to/cmdshim', function (er, path) { - t.ifError(er, "reading cmdshims isn't an error") - pathIs(t, path, '../to/file', 'reading cmdshims works') - }) - t.done() -}) - -test('resolveSymlink', function (t) { - t.plan(9) - - var mocks = mockWith({ - '/path/to/directory': { type: 'directory' }, - '/path/to/link': { type: 'symlink', dest: '../to/file' }, - '/path/to/file': { type: 'file' }, - '/path/to/cmdshim': { type: 'cmdshim', dest: '../to/file' } - }) - - var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mocks) - var resolveSymlink = makeArgsUsePlatformPaths(gentlyRm._resolveSymlink) - - resolveSymlink('/path/to/nowhere', function (er, path) { - t.is(er && er.code, 'ENOENT', 'missing files are errors') - }) - - // these aren't symlinks so we get back what we passed in - resolveSymlink('/path/to/directory', function (er, path) { - t.ifError(er, "reading dirs isn't an error") - pathIs(t, path, '/path/to/directory', 'reading non links/cmdshims gives us path we passed in') - }) - resolveSymlink('/path/to/file', function (er, path) { - t.ifError(er, "reading non-cmdshim files isn't an error") - pathIs(t, path, '/path/to/file', 'reading non links/cmdshims gives us the path we passed in') - }) - - // these are symlinks so the resolved version is platform specific - resolveSymlink('/path/to/link', function (er, path) { - t.ifError(er, "reading links isn't an error") - pathIs(t, path, '/path/to/file', 'reading links works') - }) - resolveSymlink('/path/to/cmdshim', function (er, path) { - t.ifError(er, "reading cmdshims isn't an error") - pathIs(t, path, '/path/to/file', 'reading cmdshims works') - }) - t.done() -}) - -test('readAllLinks', function (t) { - t.plan(16) - - var mocks = mockWith({ - '/path/to/directory': { type: 'directory' }, - '/path/to/link': { type: 'symlink', dest: '../to/file' }, - '/path/to/file': { type: 'file' }, - '/path/to/cmdshim': { type: 'cmdshim', dest: '../to/file' }, - '/path/to/linktolink': { type: 'symlink', dest: 'link' }, - '/path/to/linktolink^2': { type: 'symlink', dest: 'linktolink' }, - '/path/to/linktocmdshim': { type: 'symlink', dest: 'cmdshim' }, - '/path/to/linktobad': { type: 'symlink', dest: '/does/not/exist' } - }) - - var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mocks) - var readAllLinks = makeArgsUsePlatformPaths(gentlyRm._readAllLinks) - - readAllLinks('/path/to/nowhere', function (er, path) { - t.is(er && er.code, 'ENOENT', 'missing files are errors') - }) - readAllLinks('/path/to/directory', function (er, path) { - t.ifError(er, "reading dirs isn't an error") - pathIsDeeply(t, path, ['/path/to/directory'], 'reading non links/cmdshims gives us path we passed in') - }) - readAllLinks('/path/to/file', function (er, path) { - t.ifError(er, "reading non-cmdshim files isn't an error") - pathIsDeeply(t, path, ['/path/to/file'], 'reading non links/cmdshims gives us the path we passed in') - }) - readAllLinks('/path/to/linktobad', function (er, path) { - t.is(er && er.code, 'ENOENT', 'links to missing files are errors') - }) - readAllLinks('/path/to/link', function (er, results) { - t.ifError(er, "reading links isn't an error") - pathIsDeeply(t, results, ['/path/to/link', '/path/to/file'], 'reading links works') - }) - readAllLinks('/path/to/cmdshim', function (er, path) { - t.ifError(er, "reading cmdshims isn't an error") - pathIsDeeply(t, path, ['/path/to/cmdshim', '/path/to/file'], 'reading cmdshims works') - }) - readAllLinks('/path/to/linktolink', function (er, path) { - t.ifError(er, "reading link to link isn't an error") - pathIsDeeply(t, path, ['/path/to/linktolink', '/path/to/link', '/path/to/file'], 'reading link to link works') - }) - readAllLinks('/path/to/linktolink^2', function (er, path) { - t.ifError(er, "reading link to link to link isn't an error") - pathIsDeeply(t, path, ['/path/to/linktolink^2', '/path/to/linktolink', '/path/to/link', '/path/to/file'], 'reading link to link to link works') - }) - readAllLinks('/path/to/linktocmdshim', function (er, path) { - t.ifError(er, "reading link to cmdshim isn't an error") - pathIsDeeply(t, path, ['/path/to/linktocmdshim', '/path/to/cmdshim', '/path/to/file'], 'reading link to cmdshim works') - }) - t.done() -}) - -test('areAnyInsideAny', function (t) { - var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mockWith({})) - var areAnyInsideAny = makeArgsUsePlatformPaths(gentlyRm._areAnyInsideAny) - - var noneOneToOne = areAnyInsideAny(['/abc'], ['/xyz']) - t.is(noneOneToOne, false, 'none inside: one to one') - var noneOneToMany = areAnyInsideAny(['/abc'], ['/rst', '/uvw', '/xyz']) - t.is(noneOneToMany, false, 'none inside: one to many') - var noneManyToOne = areAnyInsideAny(['/abc', '/def', '/ghi'], ['/xyz']) - t.is(noneManyToOne, false, 'none inside: many to one') - var noneManyToMany = areAnyInsideAny(['/abc', '/def', '/ghi'], ['/rst', '/uvw', '/xyz']) - t.is(noneManyToMany, false, 'none inside: many to many') - - var oneToOne = areAnyInsideAny(['/one/toOne'], ['/one']) - pathIsDeeply(t, oneToOne, {target: '/one/toOne', path: '/one'}, 'first: one to one') - - var firstOneToMany = areAnyInsideAny(['/abc/def'], ['/abc', '/def', '/ghi']) - pathIsDeeply(t, firstOneToMany, {target: '/abc/def', path: '/abc'}, 'first: one to many') - var secondOneToMany = areAnyInsideAny(['/def/ghi'], ['/abc', '/def', '/ghi']) - pathIsDeeply(t, secondOneToMany, {target: '/def/ghi', path: '/def'}, 'second: one to many') - var lastOneToMany = areAnyInsideAny(['/ghi/jkl'], ['/abc', '/def', '/ghi']) - pathIsDeeply(t, lastOneToMany, {target: '/ghi/jkl', path: '/ghi'}, 'last: one to many') - - var firstManyToOne = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/abc']) - pathIsDeeply(t, firstManyToOne, {target: '/abc/def', path: '/abc'}, 'first: many to one') - var secondManyToOne = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/uvw']) - pathIsDeeply(t, secondManyToOne, {target: '/uvw/def', path: '/uvw'}, 'second: many to one') - var lastManyToOne = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/xyz']) - pathIsDeeply(t, lastManyToOne, {target: '/xyz/def', path: '/xyz'}, 'last: many to one') - - var firstToFirst = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/abc', '/uvw', '/xyz']) - pathIsDeeply(t, firstToFirst, {target: '/abc/def', path: '/abc'}, 'first to first: many to many') - var firstToSecond = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/nope', '/abc', '/xyz']) - pathIsDeeply(t, firstToSecond, {target: '/abc/def', path: '/abc'}, 'first to second: many to many') - var firstToLast = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/nope', '/nooo', '/abc']) - pathIsDeeply(t, firstToLast, {target: '/abc/def', path: '/abc'}, 'first to last: many to many') - - var secondToFirst = areAnyInsideAny(['/!!!', '/abc/def', '/xyz/def'], ['/abc', '/uvw', '/xyz']) - pathIsDeeply(t, secondToFirst, {target: '/abc/def', path: '/abc'}, 'second to first: many to many') - var secondToSecond = areAnyInsideAny(['/!!!', '/abc/def', '/xyz/def'], ['/nope', '/abc', '/xyz']) - pathIsDeeply(t, secondToSecond, {target: '/abc/def', path: '/abc'}, 'second to second: many to many') - var secondToLast = areAnyInsideAny(['/!!!', '/abc/def', '/uvw/def'], ['/nope', '/nooo', '/abc']) - pathIsDeeply(t, secondToLast, {target: '/abc/def', path: '/abc'}, 'second to last: many to many') - - var lastToFirst = areAnyInsideAny(['/!!!', '/???', '/abc/def'], ['/abc', '/uvw', '/xyz']) - pathIsDeeply(t, lastToFirst, {target: '/abc/def', path: '/abc'}, 'last to first: many to many') - var lastToSecond = areAnyInsideAny(['/!!!', '/???', '/abc/def'], ['/nope', '/abc', '/xyz']) - pathIsDeeply(t, lastToSecond, {target: '/abc/def', path: '/abc'}, 'last to second: many to many') - var lastToLast = areAnyInsideAny(['/!!!', '/???', '/abc/def'], ['/nope', '/nooo', '/abc']) - pathIsDeeply(t, lastToLast, {target: '/abc/def', path: '/abc'}, 'last to last: many to many') - - t.done() -}) - -test('isEverInside', function (t) { - t.plan(15) - - var mocks = mockWith({ - '/path/other/link': { type: 'symlink', dest: '../to/file' }, - '/path/to/file': { type: 'file' }, - '/path/to': { type: 'directory' }, - '/linkpath': { type: 'symlink', dest: '../path/to' }, - '/path/to/invalid': { type: 'error', code: 'EINVAL' } - }) - - var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mocks) - var isEverInside = makeArgsUsePlatformPaths(gentlyRm._isEverInside) - - isEverInside('/path/to/file', ['/path/to', '/path/to/invalid'], function (er, inside) { - t.ifError(er) - pathIsDeeply(t, inside, {target: '/path/to/file', path: '/path/to'}, 'bad paths are ignored if something matches') - }) - - isEverInside('/path/to/invalid', ['/path/to/invalid'], function (er, inside) { - t.is(er && er.code, 'EINVAL', 'errors bubble out') - }) - - isEverInside('/path/to/file', ['/ten'], function (er, inside) { - t.ifError(er) - t.is(inside, false, 'not inside') - }) - isEverInside('/path/to/nowhere', ['/ten'], function (er, inside) { - t.ifError(er) - t.is(inside, false, 'missing target') - }) - - isEverInside('/path/to/file', ['/path/to'], function (er, inside) { - t.ifError(er) - pathIsDeeply(t, inside, {target: '/path/to/file', path: '/path/to'}, 'plain file in plain path') - }) - isEverInside('/path/other/link', ['/path/to'], function (er, inside) { - t.ifError(er) - pathIsDeeply(t, inside, {target: '/path/to/file', path: '/path/to'}, 'link in plain path') - }) - - isEverInside('/path/to/file', ['/linkpath'], function (er, inside) { - t.ifError(er) - pathIsDeeply(t, inside, {target: '/path/to/file', path: '/path/to'}, 'plain file in link path') - }) - isEverInside('/path/other/link', ['/linkpath'], function (er, inside) { - t.ifError(er) - pathIsDeeply(t, inside, {target: '/path/to/file', path: '/path/to'}, 'link in link path') - }) - - t.done() -}) - -test('isSafeToRm', function (t) { - var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mockWith({})) - var isSafeToRm = makeArgsUsePlatformPaths(gentlyRm._isSafeToRm) - - t.plan(12) - - function testIsSafeToRm (t, parent, target, shouldPath, shouldBase, msg) { - isSafeToRm(parent, target, function (er, path, base) { - t.ifError(er, msg + ' no error') - pathIs(t, path, shouldPath, msg + ' path') - pathIs(t, base, shouldBase, msg + ' base') - }) - } - - function testNotIsSafeToRm (t, parent, target, msg) { - isSafeToRm(parent, target, function (er) { - t.is(er && er.code, 'EEXIST', msg + ' error') - }) - } - - var unmanagedParent = {path: '/foo', managed: false} - var managedParent = {path: '/foo', managed: true} - var targetInParent = { - path: '/foo/bar/baz', - inParent: { - target: '/foo/bar/baz', - path: '/foo' - } - } - var targetLinkInParent = { - path: '/foo/bar/baz', - inParent: { - target: '/other/area/baz', - path: '/other/area' - } - } - var targetManagedLinkNotInParent = { - path: '/foo/bar/baz', - managed: true, - inParent: false, - symlink: '/foo/bar/bark' - } - var targetUnmanagedLink = { - path: '/not/managed/baz', - managed: false, - inParent: false, - symlink: '/not/managed/foo' - } - var targetUnmanagedFile = { - path: '/not/managed/baz', - managed: false, - inParent: false, - symlink: false - } - testNotIsSafeToRm(t, unmanagedParent, targetInParent, 'unmanaged parent') - testIsSafeToRm(t, managedParent, targetInParent, '/foo/bar/baz', '/foo', 'path is in parent') - testIsSafeToRm(t, managedParent, targetLinkInParent, '/foo/bar/baz', '/foo/bar', 'path links to parent') - testIsSafeToRm(t, managedParent, targetManagedLinkNotInParent, undefined, undefined, 'managed but not owned by package') - testNotIsSafeToRm(t, managedParent, targetUnmanagedLink, 'unmanaged link') - testNotIsSafeToRm(t, managedParent, targetUnmanagedFile, 'unmanaged file') -}) diff --git a/deps/npm/test/tap/unit-link.js b/deps/npm/test/tap/unit-link.js deleted file mode 100644 index 4f4083e110c..00000000000 --- a/deps/npm/test/tap/unit-link.js +++ /dev/null @@ -1,281 +0,0 @@ -'use strict' -var util = require('util') -var test = require('tap').test -var requireInject = require('require-inject') -var dezalgo = require('dezalgo') -var mkdirp = require('mkdirp') -var path = require('path') - -test('gently/force', function (t) { - t.plan(5) - - linkOk(t, 'gently=true, force=false, works', { - // args - from: 'wibble', - to: '/foo/bar/baz', - gently: true, - abs: true, - force: false, - - // expect - rm: {'/foo/bar/baz': {gently: true}}, - mkdir: {'/foo/bar': true}, - lstat: {'/foo/bar/wibble': {isLink: false}}, - stat: {'/foo/bar/wibble': true}, - symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, - readlink: {} - }) - - linkNotOk(t, 'gently=true, force=false, does not work', { - // args - from: 'wibble', - to: '/foo/bar/baz', - gently: true, - abs: true, - force: false, - - // expect - rm: {'/foo/bar/baz': {gently: false}}, - mkdir: {'/foo/bar': true}, - lstat: {'/foo/bar/wibble': {isLink: false}}, - stat: {'/foo/bar/wibble': true}, - symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, - readlink: {} - }) - - linkOk(t, 'gently=false, force=false, aok', { - // args - from: 'wibble', - to: '/foo/bar/baz', - gently: false, - abs: true, - force: false, - - // expect - rm: {'/foo/bar/baz': {gently: false}}, - mkdir: {'/foo/bar': true}, - lstat: {'/foo/bar/wibble': {isLink: false}}, - stat: {'/foo/bar/wibble': true}, - symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, - readlink: {} - }) - - linkOk(t, 'gently=true, force=true, aok', { - // args - from: 'wibble', - to: '/foo/bar/baz', - gently: true, - abs: true, - force: true, - - // expect - rm: {'/foo/bar/baz': {gently: false}}, - mkdir: {'/foo/bar': true}, - lstat: {'/foo/bar/wibble': {isLink: false}}, - stat: {'/foo/bar/wibble': true}, - symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, - readlink: {} - }) - - linkOk(t, 'gently=false, force=true, aok', { - // args - from: 'wibble', - to: '/foo/bar/baz', - gently: false, - abs: true, - force: true, - - // expect - rm: {'/foo/bar/baz': {gently: false}}, - mkdir: {'/foo/bar': true}, - lstat: {'/foo/bar/wibble': {isLink: false}}, - stat: {'/foo/bar/wibble': true}, - symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, - readlink: {} - }) -}) - -test('abs, noabs', function (t) { - t.plan(4) - - linkOk(t, 'abs', { - // args - from: 'wibble', - to: '/foo/bar/baz', - gently: true, - abs: true, - force: false, - - // expect - rm: {'/foo/bar/baz': {gently: true}}, - mkdir: {'/foo/bar': true}, - lstat: {'/foo/bar/wibble': {isLink: false}}, - stat: {'/foo/bar/wibble': true}, - symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, - readlink: {} - }) - - linkOk(t, 'relative', { - // args - from: 'wibble', - to: '/foo/bar/baz', - gently: true, - abs: false, - force: false, - - // expect - rm: {'/foo/bar/baz': {gently: true}}, - mkdir: {'/foo/bar': true}, - lstat: {'/foo/bar/wibble': {isLink: false}}, - stat: {'/foo/bar/wibble': true}, - symlink: {'wibble': {'/foo/bar/baz': 'junction'}}, - readlink: {} - }) - - linkOk(t, 'relative ..', { - // args - from: '../wibble/bark/blump', - to: '/foo/bar/baz', - gently: true, - abs: false, - force: false, - - // expect - rm: {'/foo/bar/baz': {gently: true}}, - mkdir: {'/foo/bar': true}, - lstat: {'/foo/wibble/bark/blump': {isLink: false}}, - stat: {'/foo/wibble/bark/blump': true}, - symlink: {'../wibble/bark/blump': {'/foo/bar/baz': 'junction'}}, - readlink: {} - }) - - linkOk(t, 'relative .. deep', { - // args - from: 'zib/zap/../../../wibble/bark/blump', - to: '/foo/bar/baz', - gently: true, - abs: false, - force: false, - - // expect - rm: {'/foo/bar/baz': {gently: true}}, - mkdir: {'/foo/bar': true}, - lstat: {'/foo/wibble/bark/blump': {isLink: false}}, - stat: {'/foo/wibble/bark/blump': true}, - symlink: {'../wibble/bark/blump': {'/foo/bar/baz': 'junction'}}, - readlink: {} - }) -}) - -function linkOk (t, msg, opts) { - testLink(opts, function (err) { - t.ifError(err, msg) - }) -} - -function linkNotOk (t, msg, opts) { - testLink(opts, function (err) { - t.ok(err, msg) - }) -} - -function platformPath (unixPath) { - if (unixPath[0] === '/') { - return path.resolve(unixPath) - } else { - return path.join.apply(path, unixPath.split('/')) - } -} - -function platformerize (obj) { - Object.keys(obj).forEach(function (key) { - var newKey = platformPath(key) - if (typeof obj[key] === 'object') { - platformerize(obj[key]) - } else if (typeof obj[key] === 'string') { - obj[key] = platformPath(obj[key]) - } - if (newKey !== key) { - obj[newKey] = obj[key] - delete obj[key] - } - }) -} - -function testLink (opts, cb) { - var mkdirpMock = dezalgo(function (dir, cb) { - if (opts.mkdir[dir]) { - cb() - } else { - cb(new Error('mkdirp failed: ' + util.inspect(dir))) - } - }) - // sync version used by istanbul for test coverage - // we shouldn't have to do this ;.; - // require-inject and/or instanbul will need patching - mkdirpMock.sync = mkdirp.sync - - // convert any paths in our opts into platform specific paths, for windows support. - platformerize(opts) - - var link = requireInject('../../lib/utils/link.js', { - '../../lib/npm.js': { - config: { - get: function (name) { - if (name !== 'force') return new Error('unknown config key: ' + name) - return opts.force - } - } - }, - '../../lib/utils/gently-rm.js': dezalgo(function (toRemove, gently, basedir, cb) { - if (opts.rm[toRemove] && opts.rm[toRemove].gently === gently) { - cb() - } else { - cb(new Error('Removing toRemove: ' + util.inspect(toRemove) + - ' gently: ' + util.inspect(gently) + - ' not allowed: ' + util.inspect(opts.rm))) - } - }), - 'mkdirp': mkdirpMock, - 'graceful-fs': { - 'stat': dezalgo(function (file, cb) { - if (opts.stat[file]) { - cb(null, {}) - } else { - cb(new Error('stat failed for: ' + util.inspect(file))) - } - }), - 'lstat': dezalgo(function (file, cb) { - if (opts.lstat[file]) { - var linkStat = opts.lstat[file] - cb(null, { - isSymbolicLink: function () { - return linkStat.isLink - } - }) - } else { - cb(new Error('lstat failed for: ' + util.inspect(file))) - } - }), - 'symlink': dezalgo(function (from, to, type, cb) { - if (!cb) { - cb = type - type = null - } - if (opts.symlink[from] && opts.symlink[from][to] === type) { - cb() - } else { - cb(new Error('symlink failed from: ' + util.inspect(from) + ' to: ' + util.inspect(to) + ' type: ' + util.inspect(type))) - } - }), - 'readlink': function (file, cb) { - if (opts.readlink[file]) { - cb() - } else { - cb(new Error('readlink failed for: ' + util.inspect(file))) - } - } - } - }) - link(opts.from, opts.to, opts.gently, opts.abs, cb) -} diff --git a/deps/npm/test/tap/update-examples.js b/deps/npm/test/tap/update-examples.js index 54844789556..532a67f3869 100644 --- a/deps/npm/test/tap/update-examples.js +++ b/deps/npm/test/tap/update-examples.js @@ -125,7 +125,7 @@ function mockInstaller (where, dryrun, what) { } mockInstaller.prototype = {} mockInstaller.prototype.run = function (cb) { - cb() + return cb ? cb() : Promise.resolve() } var npm = requireInject.installGlobally('../../lib/npm.js', { |