From 7d0baf174155195bcc93ec63716118a3696095d7 Mon Sep 17 00:00:00 2001 From: Forrest L Norvell Date: Fri, 13 Mar 2015 02:07:27 -0700 Subject: [PATCH] deps: upgrade npm to 2.7.1 PR-URL: https://github.com/iojs/io.js/pull/1142 Reviewed-By: Jeremiah Senkpiel Reviewed-By: Rod Vagg --- deps/npm/AUTHORS | 7 + deps/npm/CHANGELOG.md | 95 +- deps/npm/doc/cli/npm-install.md | 2 +- deps/npm/doc/cli/npm-link.md | 3 +- deps/npm/doc/cli/npm-run-script.md | 7 + deps/npm/html/doc/README.html | 4 +- deps/npm/html/doc/api/npm-bin.html | 2 +- deps/npm/html/doc/api/npm-bugs.html | 2 +- deps/npm/html/doc/api/npm-cache.html | 2 +- deps/npm/html/doc/api/npm-commands.html | 2 +- deps/npm/html/doc/api/npm-config.html | 2 +- deps/npm/html/doc/api/npm-deprecate.html | 2 +- deps/npm/html/doc/api/npm-docs.html | 2 +- deps/npm/html/doc/api/npm-edit.html | 2 +- deps/npm/html/doc/api/npm-explore.html | 2 +- deps/npm/html/doc/api/npm-help-search.html | 2 +- deps/npm/html/doc/api/npm-init.html | 2 +- deps/npm/html/doc/api/npm-install.html | 2 +- deps/npm/html/doc/api/npm-link.html | 2 +- deps/npm/html/doc/api/npm-load.html | 2 +- deps/npm/html/doc/api/npm-ls.html | 2 +- deps/npm/html/doc/api/npm-outdated.html | 2 +- deps/npm/html/doc/api/npm-owner.html | 2 +- deps/npm/html/doc/api/npm-pack.html | 2 +- deps/npm/html/doc/api/npm-prefix.html | 2 +- deps/npm/html/doc/api/npm-prune.html | 2 +- deps/npm/html/doc/api/npm-publish.html | 2 +- deps/npm/html/doc/api/npm-rebuild.html | 2 +- deps/npm/html/doc/api/npm-repo.html | 2 +- deps/npm/html/doc/api/npm-restart.html | 2 +- deps/npm/html/doc/api/npm-root.html | 2 +- deps/npm/html/doc/api/npm-run-script.html | 2 +- deps/npm/html/doc/api/npm-search.html | 2 +- deps/npm/html/doc/api/npm-shrinkwrap.html | 2 +- deps/npm/html/doc/api/npm-start.html | 2 +- deps/npm/html/doc/api/npm-stop.html | 2 +- deps/npm/html/doc/api/npm-tag.html | 2 +- deps/npm/html/doc/api/npm-test.html | 2 +- deps/npm/html/doc/api/npm-uninstall.html | 2 +- deps/npm/html/doc/api/npm-unpublish.html | 2 +- deps/npm/html/doc/api/npm-update.html | 2 +- deps/npm/html/doc/api/npm-version.html | 2 +- deps/npm/html/doc/api/npm-view.html | 2 +- deps/npm/html/doc/api/npm-whoami.html | 2 +- deps/npm/html/doc/api/npm.html | 4 +- deps/npm/html/doc/cli/npm-access.html | 2 +- deps/npm/html/doc/cli/npm-adduser.html | 2 +- deps/npm/html/doc/cli/npm-bin.html | 2 +- deps/npm/html/doc/cli/npm-bugs.html | 2 +- deps/npm/html/doc/cli/npm-build.html | 2 +- deps/npm/html/doc/cli/npm-bundle.html | 2 +- deps/npm/html/doc/cli/npm-cache.html | 2 +- deps/npm/html/doc/cli/npm-completion.html | 2 +- deps/npm/html/doc/cli/npm-config.html | 2 +- deps/npm/html/doc/cli/npm-dedupe.html | 2 +- deps/npm/html/doc/cli/npm-deprecate.html | 2 +- deps/npm/html/doc/cli/npm-dist-tag.html | 2 +- deps/npm/html/doc/cli/npm-docs.html | 2 +- deps/npm/html/doc/cli/npm-edit.html | 2 +- deps/npm/html/doc/cli/npm-explore.html | 2 +- deps/npm/html/doc/cli/npm-help-search.html | 2 +- deps/npm/html/doc/cli/npm-help.html | 2 +- deps/npm/html/doc/cli/npm-init.html | 2 +- deps/npm/html/doc/cli/npm-install.html | 6 +- deps/npm/html/doc/cli/npm-link.html | 5 +- deps/npm/html/doc/cli/npm-logout.html | 2 +- deps/npm/html/doc/cli/npm-ls.html | 4 +- deps/npm/html/doc/cli/npm-outdated.html | 2 +- deps/npm/html/doc/cli/npm-owner.html | 2 +- deps/npm/html/doc/cli/npm-pack.html | 2 +- deps/npm/html/doc/cli/npm-prefix.html | 2 +- deps/npm/html/doc/cli/npm-prune.html | 2 +- deps/npm/html/doc/cli/npm-publish.html | 2 +- deps/npm/html/doc/cli/npm-rebuild.html | 2 +- deps/npm/html/doc/cli/npm-repo.html | 2 +- deps/npm/html/doc/cli/npm-restart.html | 2 +- deps/npm/html/doc/cli/npm-rm.html | 2 +- deps/npm/html/doc/cli/npm-root.html | 2 +- deps/npm/html/doc/cli/npm-run-script.html | 8 +- deps/npm/html/doc/cli/npm-search.html | 2 +- deps/npm/html/doc/cli/npm-shrinkwrap.html | 2 +- deps/npm/html/doc/cli/npm-star.html | 2 +- deps/npm/html/doc/cli/npm-stars.html | 2 +- deps/npm/html/doc/cli/npm-start.html | 2 +- deps/npm/html/doc/cli/npm-stop.html | 2 +- deps/npm/html/doc/cli/npm-tag.html | 2 +- deps/npm/html/doc/cli/npm-test.html | 2 +- deps/npm/html/doc/cli/npm-uninstall.html | 2 +- deps/npm/html/doc/cli/npm-unpublish.html | 2 +- deps/npm/html/doc/cli/npm-update.html | 2 +- deps/npm/html/doc/cli/npm-version.html | 2 +- deps/npm/html/doc/cli/npm-view.html | 2 +- deps/npm/html/doc/cli/npm-whoami.html | 2 +- deps/npm/html/doc/cli/npm.html | 10 +- deps/npm/html/doc/files/npm-folders.html | 2 +- deps/npm/html/doc/files/npm-global.html | 2 +- deps/npm/html/doc/files/npm-json.html | 2 +- deps/npm/html/doc/files/npmrc.html | 2 +- deps/npm/html/doc/files/package.json.html | 2 +- deps/npm/html/doc/index.html | 2 +- deps/npm/html/doc/misc/npm-coding-style.html | 2 +- deps/npm/html/doc/misc/npm-config.html | 2 +- deps/npm/html/doc/misc/npm-developers.html | 2 +- deps/npm/html/doc/misc/npm-disputes.html | 8 +- deps/npm/html/doc/misc/npm-faq.html | 4 +- deps/npm/html/doc/misc/npm-index.html | 2 +- deps/npm/html/doc/misc/npm-registry.html | 2 +- deps/npm/html/doc/misc/npm-scope.html | 2 +- deps/npm/html/doc/misc/npm-scripts.html | 2 +- deps/npm/html/doc/misc/removing-npm.html | 2 +- deps/npm/html/doc/misc/semver.html | 2 +- deps/npm/html/partial/doc/README.html | 2 +- deps/npm/html/partial/doc/api/npm.html | 2 +- .../npm/html/partial/doc/cli/npm-install.html | 4 +- deps/npm/html/partial/doc/cli/npm-link.html | 3 +- deps/npm/html/partial/doc/cli/npm-ls.html | 2 +- .../html/partial/doc/cli/npm-run-script.html | 6 + deps/npm/html/partial/doc/cli/npm.html | 8 +- .../html/partial/doc/misc/npm-disputes.html | 6 +- deps/npm/html/partial/doc/misc/npm-faq.html | 2 +- deps/npm/lib/cache/add-named.js | 7 - deps/npm/lib/cache/add-remote-git.js | 532 +++++----- deps/npm/lib/cache/add-remote-tarball.js | 2 +- deps/npm/lib/config/defaults.js | 15 +- deps/npm/lib/dedupe.js | 27 +- deps/npm/lib/install.js | 29 +- deps/npm/lib/npm.js | 1 + deps/npm/lib/publish.js | 13 +- deps/npm/lib/stars.js | 11 + deps/npm/lib/update.js | 20 +- deps/npm/lib/utils/error-handler.js | 3 +- deps/npm/lib/whoami.js | 24 +- deps/npm/man/man1/npm-install.1 | 4 +- deps/npm/man/man1/npm-link.1 | 3 +- deps/npm/man/man1/npm-ls.1 | 2 +- deps/npm/man/man1/npm-run-script.1 | 7 + deps/npm/man/man1/npm.1 | 2 +- deps/npm/man/man3/npm.3 | 2 +- deps/npm/node_modules/glob/glob.js | 19 +- deps/npm/node_modules/glob/package.json | 19 +- deps/npm/node_modules/glob/sync.js | 13 +- deps/npm/node_modules/inflight/.eslintrc | 17 + deps/npm/node_modules/node-gyp/addon.gypi | 2 +- deps/npm/node_modules/node-gyp/lib/build.js | 8 +- deps/npm/node_modules/node-gyp/lib/install.js | 40 +- .../node_modules/normalize-git-url/.eslintrc | 19 + .../readdir-scoped-modules/.eslintrc | 17 + .../json-parse-helpfulerror/.editorconfig | 14 + .../json-parse-helpfulerror/.npmignore | 28 + .../json-parse-helpfulerror/LICENSE | 21 + .../json-parse-helpfulerror/README.md | 29 + .../json-parse-helpfulerror/index.js | 21 + .../node_modules/jju/.editorconfig | 19 + .../node_modules/jju/.npmignore | 6 + .../node_modules/jju/README.md | 242 +++++ .../node_modules/jju/benchmark/benchmark.js | 40 + .../node_modules/jju/benchmark/package.json | 9 + .../node_modules/jju/docs/Grammar.md | 219 +++++ .../node_modules/jju/docs/JSON5.md | 50 + .../node_modules/jju/index.js | 32 + .../node_modules/jju/lib/analyze.js | 91 ++ .../node_modules/jju/lib/document.js | 484 +++++++++ .../node_modules/jju/lib/parse.js | 751 ++++++++++++++ .../node_modules/jju/lib/stringify.js | 382 ++++++++ .../node_modules/jju/lib/unicode.js | 71 ++ .../node_modules/jju/lib/utils.js | 45 + .../node_modules/jju/package.json | 63 ++ .../node_modules/jju/package.yaml | 45 + .../jju/test/portable-json5-tests.yaml | 916 ++++++++++++++++++ .../node_modules/jju/test/test_analyze.js | 52 + .../node_modules/jju/test/test_document.js | 214 ++++ .../node_modules/jju/test/test_errors.js | 55 ++ .../node_modules/jju/test/test_parse.js | 170 ++++ .../node_modules/jju/test/test_portable.js | 59 ++ .../node_modules/jju/test/test_stringify.js | 89 ++ .../node_modules/jju/test/test_tokenize.js | 98 ++ .../node_modules/jju/test/test_updates.js | 21 + .../node_modules/jju/test/update/author.yaml | 30 + .../jju/test/update/deep-object.yaml | 35 + .../node_modules/jju/test/update/delete.yaml | 35 + .../jju/test/update/norm-array.yaml | 31 + .../jju/test/update/norm-object.yaml | 31 + .../jju/test/update/npm-array-bin.yaml | 28 + .../jju/test/update/pkg-json5.yaml | 35 + .../json-parse-helpfulerror/package.json | 61 ++ .../json-parse-helpfulerror/test/test.js | 32 + .../read-package-json/package.json | 37 +- .../read-package-json/read-json.js | 5 +- .../test/fixtures/emptybin.json | 2 +- .../test/fixtures/erroneous.json | 4 + .../read-package-json/test/helpful.js | 17 + deps/npm/node_modules/request/.eslintrc | 22 + .../request/node_modules/isstream/.jshintrc | 59 ++ deps/npm/node_modules/rimraf/AUTHORS | 6 - deps/npm/node_modules/rimraf/README.md | 10 +- deps/npm/node_modules/rimraf/package.json | 49 +- deps/npm/node_modules/rimraf/rimraf.js | 155 ++- deps/npm/node_modules/rimraf/test/run.sh | 16 - deps/npm/node_modules/rimraf/test/setup.sh | 47 - .../node_modules/rimraf/test/test-async.js | 5 - .../npm/node_modules/rimraf/test/test-sync.js | 3 - deps/npm/package.json | 12 +- .../test/tap/add-remote-git-fake-windows.js | 4 +- .../npm/test/tap/add-remote-git-shrinkwrap.js | 171 ++++ deps/npm/test/tap/config-semver-tag.js | 27 - deps/npm/test/tap/dedupe-scoped.js | 146 +++ .../test/tap/git-dependency-install-link.js | 184 ++++ .../test/tap/publish-invalid-semver-tag.js | 79 ++ deps/npm/test/tap/update-examples.js | 10 + 209 files changed, 6297 insertions(+), 681 deletions(-) create mode 100644 deps/npm/node_modules/inflight/.eslintrc create mode 100644 deps/npm/node_modules/normalize-git-url/.eslintrc create mode 100644 deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/.eslintrc create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.editorconfig create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.npmignore create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/LICENSE create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/README.md create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/index.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.editorconfig create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.npmignore create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/README.md create mode 100755 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/benchmark.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/package.json create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/Grammar.md create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/JSON5.md create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/index.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/analyze.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/document.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/parse.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/stringify.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/unicode.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/utils.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.json create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.yaml create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/portable-json5-tests.yaml create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_analyze.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_document.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_errors.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_parse.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_portable.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_stringify.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_tokenize.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_updates.js create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/author.yaml create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/deep-object.yaml create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/delete.yaml create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-array.yaml create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-object.yaml create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/npm-array-bin.yaml create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/pkg-json5.yaml create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/package.json create mode 100644 deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/test/test.js create mode 100644 deps/npm/node_modules/read-package-json/test/fixtures/erroneous.json create mode 100644 deps/npm/node_modules/read-package-json/test/helpful.js create mode 100644 deps/npm/node_modules/request/.eslintrc create mode 100644 deps/npm/node_modules/request/node_modules/isstream/.jshintrc delete mode 100644 deps/npm/node_modules/rimraf/AUTHORS delete mode 100644 deps/npm/node_modules/rimraf/test/run.sh delete mode 100644 deps/npm/node_modules/rimraf/test/setup.sh delete mode 100644 deps/npm/node_modules/rimraf/test/test-async.js delete mode 100644 deps/npm/node_modules/rimraf/test/test-sync.js create mode 100644 deps/npm/test/tap/add-remote-git-shrinkwrap.js delete mode 100644 deps/npm/test/tap/config-semver-tag.js create mode 100644 deps/npm/test/tap/dedupe-scoped.js create mode 100644 deps/npm/test/tap/git-dependency-install-link.js create mode 100644 deps/npm/test/tap/publish-invalid-semver-tag.js diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index 20ff0440fc..c6ab02b4be 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -187,6 +187,13 @@ Joost-Wim Boekesteijn Dalmais Maxence Marcus Ekwall Jordan Harband +Guðlaugur Stefán Egilsson +Helge Skogly Holm +Peter A. Shevtsov +Alain Kalker +Bryant Williams +thriqon +Tim Whidden Steve Mason Wil Moore III Sergey Belov diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index 006eb06ff2..beba8e9f27 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,92 @@ +### v2.7.1 (2015-03-05): + +#### GITSANITY + +* [`6823807`](https://github.com/npm/npm/commit/6823807bba6c00228a724e1205ae90d67df0adad) + [#7121](https://github.com/npm/npm/issues/7121) `npm install --save` for Git + dependencies saves the URL passed in, instead of the temporary directory used + to clone the remote repo. Fixes using Git dependencies when shrinkwwapping. + In the process, rewrote the Git dependency caching code. Again. No more + single-letter variable names, and a much clearer workflow. + ([@othiym23](https://github.com/othiym23)) +* [`c8258f3`](https://github.com/npm/npm/commit/c8258f31365b045e5fcf15b865a363abbc3be616) + [#7486](https://github.com/npm/npm/issues/7486) When installing Git remotes, + the caching code was passing in the function `gitEnv` instead of the results + of invoking it. ([@functino](https://github.com/functino)) +* [`c618eed`](https://github.com/npm/npm/commit/c618eeda3e321fd454d77c476b53a0330f2344cc) + [#2556](https://github.com/npm/npm/issues/2556) Make it possible to install + Git dependencies when using `--link` by not linking just the Git + dependencies. ([@smikes](https://github.com/smikes)) + +#### WHY DID THIS TAKE SO LONG. + +* [`abdd040`](https://github.com/npm/npm/commit/abdd040da90932535472f593d5433a67ee074801) + `read-package-json@1.3.2`: Provide more helpful error messages when JSON + parse errors are encountered by using a more forgiving JSON parser than + JSON.parse. ([@smikes](https://github.com/smikes)) + +#### BUGS & TWEAKS + +* [`c56cfcd`](https://github.com/npm/npm/commit/c56cfcd79cd8ab4ccd06d2c03d7e04030d576683) + [#7525](https://github.com/npm/npm/issues/7525) `npm dedupe` handles scoped + packages. ([@KidkArolis](https://github.com/KidkArolis)) +* [`1b8ba74`](https://github.com/npm/npm/commit/1b8ba7426393cbae2c76ad2c35953782d4401871) + [#7531](https://github.com/npm/npm/issues/7531) `npm stars` and `npm whoami` + will no longer send the registry the error text saying you need to log in as + your username. ([@othiym23](https://github.com/othiym23)) +* [`6de1e91`](https://github.com/npm/npm/commit/6de1e91116a5105dfa75126532b9083d8672e034) + [#6441](https://github.com/npm/npm/issues/6441) Prevent needless reinstalls + by only updating packages when the current version isn't the same as the + version returned as `wanted` by `npm outdated`. + ([@othiym23](https://github.com/othiym23)) +* [`2abc3ee`](https://github.com/npm/npm/commit/2abc3ee08f0cabc4e7bfd7b973c0b59dc44715ff) + Add `npm upgrade` as an alias for `npm update`. + ([@othiym23](https://github.com/othiym23)) +* [`bcd4722`](https://github.com/npm/npm/commit/bcd47224e18884191a5d0057c2b2fff83ac8206e) + [#7508](https://github.com/npm/npm/issues/7508) FreeBSD uses `EAI_FAIL` + instead of `ENOTFOUND`. ([@othiym23](https://github.com/othiym23)) +* [`21c1ac4`](https://github.com/npm/npm/commit/21c1ac41280f0716a208cde14025a2ad5ef61fed) + [#7507](https://github.com/npm/npm/issues/7507) Update support URL in generic + error handler to `https:` from `http:`. + ([@watilde](https://github.com/watilde)) +* [`b6bd99a`](https://github.com/npm/npm/commit/b6bd99a73f575545fbbaef95c12237c47dd32561) + [#7492](https://github.com/npm/npm/issues/7492) On install, the + `package.json` `engineStrict` deprecation only warns for the current package. + ([@othiym23](https://github.com/othiym23)) +* [`4ef1412`](https://github.com/npm/npm/commit/4ef1412d0061239da2b1c4460ed6db37cc9ded27) + [#7075](https://github.com/npm/npm/issues/7075) If you try to tag a release + as a valid semver range, `npm publish` and `npm tag` will error early instead + of proceeding. ([@smikes](https://github.com/smikes)) +* [`ad53d0f`](https://github.com/npm/npm/commit/ad53d0f666125d9f50d661b54901c6e5bab4d603) + Use `rimraf` in npm build script because Windows doesn't know what rm is. + ([@othiym23](https://github.com/othiym23)) +* [`8885c4d`](https://github.com/npm/npm/commit/8885c4dfb618f2838930b5c5149abea300a762d6) + `rimraf@2.3.1`: Better Windows support. + ([@isaacs](https://github.com/isaacs)) +* [`8885c4d`](https://github.com/npm/npm/commit/8885c4dfb618f2838930b5c5149abea300a762d6) + `glob@4.4.2`: Handle bad symlinks properly. + ([@isaacs](https://github.com/isaacs)) + +###E TYPSO & CLARFIICATIONS + +dId yuo know that submiting fxies for doc tpyos is an exclelent way to get +strated contriburting to a new open-saurce porject? + +* [`42c605c`](https://github.com/npm/npm/commit/42c605c7b401f603c32ea70427e1a7666adeafd9) + Fix typo in `CHANGELOG.md` ([@adrianblynch](https://github.com/adrianblynch)) +* [`c9bd58d`](https://github.com/npm/npm/commit/c9bd58dd637b9c41441023584a13e3818d5db336) + Add note about `node_modules/.bin` being added to the path in `npm + run-script`. ([@quarterto](https://github.com/quarterto)) +* [`903bdd1`](https://github.com/npm/npm/commit/903bdd105b205d6e45d3a2ab83eea8e4071e9aeb) + Matt Ranney confused the world when he renamed `node-redis` to `redis`. "The + world" includes npm's documentation. + ([@RichardLitt](https://github.com/RichardLitt)) +* [`dea9bb2`](https://github.com/npm/npm/commit/dea9bb2319183fe54bf4d173d8533d46d2c6611c) + Fix typo in contributor link. ([@watilde](https://github.com/watilde)) +* [`1226ca9`](https://github.com/npm/npm/commit/1226ca98d4d7650cc3ba16bf7ac62e44820f3bfa) + Properly close code block in npm-install.md. + ([@olizilla](https://github.com/olizilla)) + ### v2.7.0 (2015-02-26): #### SOMETIMES SEMVER MEANS "SUBJECTIVE-EMPATHETIC VERSIONING" @@ -14,7 +103,7 @@ If the patch below were landed on its own, free of context, it would be a breaking change. But, since the "new" behavior is how the documentation claims this feature has always worked, I'm classifying it as a patch-level bug fix. I apologize in advance if this breaks anybody's deployment scripts, and if it -turns out to be a significant regression in practics, we can revert this change +turns out to be a significant regression in practice, we can revert this change and move it to `npm@3`, which is allowed to make breaking changes due to being a new major version of semver. @@ -65,7 +154,7 @@ tracker, and they included some nice small features and fixes: [#7354](https://github.com/npm/npm/issues/7354) Add `--if-present` flag to allow e.g. CI systems to call (semi-) standard build tasks defined in `package.json`, but don't raise an error if no such script is defined. - ([@jussi](https://github.com/jussi)-kalliokoski) + ([@jussi-kalliokoski](https://github.com/jussi-kalliokoski)) * [`7bf85cc`](https://github.com/npm/npm/commit/7bf85cc372ab5698593b01e139c383fa62c92516) [#4005](https://github.com/npm/npm/issues/4005) [#6248](https://github.com/npm/npm/issues/6248) Globally unlink a package @@ -1077,7 +1166,7 @@ Other changes: * [`b706d63`](https://github.com/npm/npm/commit/b706d637d5965dbf8f7ce07dc5c4bc80887f30d8) [#3059](https://github.com/npm/npm/issues/3059) disable prepublish when running `npm install --production` - ([@jussi](https://github.com/jussi)-kalliokoski) + ([@jussi-kalliokoski](https://github.com/jussi-kalliokoski)) * [`119f068`](https://github.com/npm/npm/commit/119f068eae2a36fa8b9c9ca557c70377792243a4) attach the node version used when publishing a package to its registry metadata ([@othiym23](https://github.com/othiym23)) diff --git a/deps/npm/doc/cli/npm-install.md b/deps/npm/doc/cli/npm-install.md index 6b2ac7778c..acc221d31f 100644 --- a/deps/npm/doc/cli/npm-install.md +++ b/deps/npm/doc/cli/npm-install.md @@ -157,7 +157,7 @@ after packing it up into a tarball (b). * `npm install /`: - Install the package at `https://github.com/githubname/githubrepo" by + Install the package at `https://github.com/githubname/githubrepo` by attempting to clone it using `git`. Example: diff --git a/deps/npm/doc/cli/npm-link.md b/deps/npm/doc/cli/npm-link.md index a48fb97785..d634e3458c 100644 --- a/deps/npm/doc/cli/npm-link.md +++ b/deps/npm/doc/cli/npm-link.md @@ -38,7 +38,8 @@ For example: npm link redis # link-install the package Now, any changes to ~/projects/node-redis will be reflected in -~/projects/node-bloggy/node_modules/node-redis/ +~/projects/node-bloggy/node_modules/node-redis/. Note that the link should +be to the package name, not the directory name for that package. You may also shortcut the two steps in one. For example, to do the above use-case in a shorter way: diff --git a/deps/npm/doc/cli/npm-run-script.md b/deps/npm/doc/cli/npm-run-script.md index 9e6e17e1d0..487bd5942a 100644 --- a/deps/npm/doc/cli/npm-run-script.md +++ b/deps/npm/doc/cli/npm-run-script.md @@ -29,6 +29,13 @@ environment variables that will be available to the script at runtime. If an "env" command is defined in your package it will take precedence over the built-in. +In addition to the shell's pre-existing `PATH`, `npm run` adds +`node_modules/.bin` to the `PATH` provided to scripts. Any binaries provided by +locally-installed dependencies can be used without the `node_modules/.bin` +prefix. For example, if there is a `devDependency` on `tap` in your package, +you should write `"scripts": {"test": "tap test/\*.js"}` instead of `"scripts": +{"test": "node_modules/.bin/tap test/\*.js"}` to run your tests. + ## SEE ALSO * npm-scripts(7) diff --git a/deps/npm/html/doc/README.html b/deps/npm/html/doc/README.html index a85c865b09..cd0289b5bf 100644 --- a/deps/npm/html/doc/README.html +++ b/deps/npm/html/doc/README.html @@ -126,7 +126,7 @@ specific purpose, or lack of malice in any given npm package.

If you have a complaint about a package in the public npm registry, and cannot resolve it with the package owner, please email -support@npmjs.com and explain the situation.

+support@npmjs.com and explain the situation.

Any data published to The npm Registry (including user account information) may be removed or modified at the sole discretion of the npm server administrators.

@@ -169,5 +169,5 @@ will no doubt tell you to put the output in a gist or email.

       - + diff --git a/deps/npm/html/doc/api/npm-bin.html b/deps/npm/html/doc/api/npm-bin.html index 40b07e5d7f..8df3be84f3 100644 --- a/deps/npm/html/doc/api/npm-bin.html +++ b/deps/npm/html/doc/api/npm-bin.html @@ -28,5 +28,5 @@ to the npm.bin property.

       - + diff --git a/deps/npm/html/doc/api/npm-bugs.html b/deps/npm/html/doc/api/npm-bugs.html index d39cf2440d..e7c1bc2c94 100644 --- a/deps/npm/html/doc/api/npm-bugs.html +++ b/deps/npm/html/doc/api/npm-bugs.html @@ -33,5 +33,5 @@ friendly for programmatic use.

       - + diff --git a/deps/npm/html/doc/api/npm-cache.html b/deps/npm/html/doc/api/npm-cache.html index 4f0c96be74..5bb54f56b6 100644 --- a/deps/npm/html/doc/api/npm-cache.html +++ b/deps/npm/html/doc/api/npm-cache.html @@ -42,5 +42,5 @@ incrementation.

       - + diff --git a/deps/npm/html/doc/api/npm-commands.html b/deps/npm/html/doc/api/npm-commands.html index ebf5b0e74e..34d5640696 100644 --- a/deps/npm/html/doc/api/npm-commands.html +++ b/deps/npm/html/doc/api/npm-commands.html @@ -36,5 +36,5 @@ usage, or man 3 npm-<command> for programmatic usage.

       - + diff --git a/deps/npm/html/doc/api/npm-config.html b/deps/npm/html/doc/api/npm-config.html index 11877eb6c0..9ecdfc7302 100644 --- a/deps/npm/html/doc/api/npm-config.html +++ b/deps/npm/html/doc/api/npm-config.html @@ -57,5 +57,5 @@ functions instead.

       - + diff --git a/deps/npm/html/doc/api/npm-deprecate.html b/deps/npm/html/doc/api/npm-deprecate.html index a8d8753152..b902c6dc84 100644 --- a/deps/npm/html/doc/api/npm-deprecate.html +++ b/deps/npm/html/doc/api/npm-deprecate.html @@ -47,5 +47,5 @@ a deprecation warning to all who attempt to install it.

       - + diff --git a/deps/npm/html/doc/api/npm-docs.html b/deps/npm/html/doc/api/npm-docs.html index f3fce38b78..2497dc8f78 100644 --- a/deps/npm/html/doc/api/npm-docs.html +++ b/deps/npm/html/doc/api/npm-docs.html @@ -33,5 +33,5 @@ friendly for programmatic use.

       - + diff --git a/deps/npm/html/doc/api/npm-edit.html b/deps/npm/html/doc/api/npm-edit.html index 1b8b2264d4..693b55ada7 100644 --- a/deps/npm/html/doc/api/npm-edit.html +++ b/deps/npm/html/doc/api/npm-edit.html @@ -36,5 +36,5 @@ and how this is used.

       - + diff --git a/deps/npm/html/doc/api/npm-explore.html b/deps/npm/html/doc/api/npm-explore.html index b26c04af59..1fb9fb0e3c 100644 --- a/deps/npm/html/doc/api/npm-explore.html +++ b/deps/npm/html/doc/api/npm-explore.html @@ -31,5 +31,5 @@ sure to use npm rebuild <pkg> if you make any changes.

       - + diff --git a/deps/npm/html/doc/api/npm-help-search.html b/deps/npm/html/doc/api/npm-help-search.html index 99f7a5e556..0afaecacb9 100644 --- a/deps/npm/html/doc/api/npm-help-search.html +++ b/deps/npm/html/doc/api/npm-help-search.html @@ -44,5 +44,5 @@ Name of the file that matched        - + diff --git a/deps/npm/html/doc/api/npm-init.html b/deps/npm/html/doc/api/npm-init.html index ffeae2c3ad..e7fa6badb6 100644 --- a/deps/npm/html/doc/api/npm-init.html +++ b/deps/npm/html/doc/api/npm-init.html @@ -39,5 +39,5 @@ then go ahead and use this programmatically.

       - + diff --git a/deps/npm/html/doc/api/npm-install.html b/deps/npm/html/doc/api/npm-install.html index a2267a58fd..1223fb7b1b 100644 --- a/deps/npm/html/doc/api/npm-install.html +++ b/deps/npm/html/doc/api/npm-install.html @@ -32,5 +32,5 @@ installed or when an error has been encountered.

       - + diff --git a/deps/npm/html/doc/api/npm-link.html b/deps/npm/html/doc/api/npm-link.html index 67caab6b89..cb5420461c 100644 --- a/deps/npm/html/doc/api/npm-link.html +++ b/deps/npm/html/doc/api/npm-link.html @@ -42,5 +42,5 @@ the package in the current working directory

       - + diff --git a/deps/npm/html/doc/api/npm-load.html b/deps/npm/html/doc/api/npm-load.html index e3b6641bb6..1f8a55998d 100644 --- a/deps/npm/html/doc/api/npm-load.html +++ b/deps/npm/html/doc/api/npm-load.html @@ -37,5 +37,5 @@ config object.

       - + diff --git a/deps/npm/html/doc/api/npm-ls.html b/deps/npm/html/doc/api/npm-ls.html index 1040339764..b6ec24ea12 100644 --- a/deps/npm/html/doc/api/npm-ls.html +++ b/deps/npm/html/doc/api/npm-ls.html @@ -63,5 +63,5 @@ dependency will only be output once.

       - + diff --git a/deps/npm/html/doc/api/npm-outdated.html b/deps/npm/html/doc/api/npm-outdated.html index 2fbda56fa7..5de5a20c97 100644 --- a/deps/npm/html/doc/api/npm-outdated.html +++ b/deps/npm/html/doc/api/npm-outdated.html @@ -28,5 +28,5 @@ currently outdated.

       - + diff --git a/deps/npm/html/doc/api/npm-owner.html b/deps/npm/html/doc/api/npm-owner.html index 3a86a8b026..72c17af593 100644 --- a/deps/npm/html/doc/api/npm-owner.html +++ b/deps/npm/html/doc/api/npm-owner.html @@ -47,5 +47,5 @@ that is not implemented at this time.

       - + diff --git a/deps/npm/html/doc/api/npm-pack.html b/deps/npm/html/doc/api/npm-pack.html index 7dbdf463e2..24b6af54f1 100644 --- a/deps/npm/html/doc/api/npm-pack.html +++ b/deps/npm/html/doc/api/npm-pack.html @@ -33,5 +33,5 @@ overwritten the second time.

       - + diff --git a/deps/npm/html/doc/api/npm-prefix.html b/deps/npm/html/doc/api/npm-prefix.html index 62c91d8c74..709395064d 100644 --- a/deps/npm/html/doc/api/npm-prefix.html +++ b/deps/npm/html/doc/api/npm-prefix.html @@ -29,5 +29,5 @@        - + diff --git a/deps/npm/html/doc/api/npm-prune.html b/deps/npm/html/doc/api/npm-prune.html index ae9cf1c4dd..3c0a2910ba 100644 --- a/deps/npm/html/doc/api/npm-prune.html +++ b/deps/npm/html/doc/api/npm-prune.html @@ -30,5 +30,5 @@ package's dependencies list.

       - + diff --git a/deps/npm/html/doc/api/npm-publish.html b/deps/npm/html/doc/api/npm-publish.html index d0ae43fa39..f678da43fb 100644 --- a/deps/npm/html/doc/api/npm-publish.html +++ b/deps/npm/html/doc/api/npm-publish.html @@ -46,5 +46,5 @@ the registry. Overwrites when the "force" environment variable is set        - + diff --git a/deps/npm/html/doc/api/npm-rebuild.html b/deps/npm/html/doc/api/npm-rebuild.html index 4ae5944032..1e67b3c298 100644 --- a/deps/npm/html/doc/api/npm-rebuild.html +++ b/deps/npm/html/doc/api/npm-rebuild.html @@ -30,5 +30,5 @@ the new binary. If no 'packages' parameter is specify, every package wil        - + diff --git a/deps/npm/html/doc/api/npm-repo.html b/deps/npm/html/doc/api/npm-repo.html index 60b8a9aebb..5e77463041 100644 --- a/deps/npm/html/doc/api/npm-repo.html +++ b/deps/npm/html/doc/api/npm-repo.html @@ -33,5 +33,5 @@ friendly for programmatic use.

       - + diff --git a/deps/npm/html/doc/api/npm-restart.html b/deps/npm/html/doc/api/npm-restart.html index b657e5e9b1..66b5084fc2 100644 --- a/deps/npm/html/doc/api/npm-restart.html +++ b/deps/npm/html/doc/api/npm-restart.html @@ -52,5 +52,5 @@ behavior will be accompanied by an increase in major version number

       - + diff --git a/deps/npm/html/doc/api/npm-root.html b/deps/npm/html/doc/api/npm-root.html index a40933007f..ff399cfb7c 100644 --- a/deps/npm/html/doc/api/npm-root.html +++ b/deps/npm/html/doc/api/npm-root.html @@ -29,5 +29,5 @@        - + diff --git a/deps/npm/html/doc/api/npm-run-script.html b/deps/npm/html/doc/api/npm-run-script.html index 5e3eaf840b..0ae85e1cf0 100644 --- a/deps/npm/html/doc/api/npm-run-script.html +++ b/deps/npm/html/doc/api/npm-run-script.html @@ -41,5 +41,5 @@ assumed to be the command to run. All other elements are ignored.

       - + diff --git a/deps/npm/html/doc/api/npm-search.html b/deps/npm/html/doc/api/npm-search.html index 9e5a72e97f..cdd1f91bc4 100644 --- a/deps/npm/html/doc/api/npm-search.html +++ b/deps/npm/html/doc/api/npm-search.html @@ -53,5 +53,5 @@ like).

       - + diff --git a/deps/npm/html/doc/api/npm-shrinkwrap.html b/deps/npm/html/doc/api/npm-shrinkwrap.html index 47bba84e1d..da2375817f 100644 --- a/deps/npm/html/doc/api/npm-shrinkwrap.html +++ b/deps/npm/html/doc/api/npm-shrinkwrap.html @@ -33,5 +33,5 @@ been saved.

       - + diff --git a/deps/npm/html/doc/api/npm-start.html b/deps/npm/html/doc/api/npm-start.html index cca572f495..9eea6a29d0 100644 --- a/deps/npm/html/doc/api/npm-start.html +++ b/deps/npm/html/doc/api/npm-start.html @@ -28,5 +28,5 @@        - + diff --git a/deps/npm/html/doc/api/npm-stop.html b/deps/npm/html/doc/api/npm-stop.html index cb2ae75494..ff314f6580 100644 --- a/deps/npm/html/doc/api/npm-stop.html +++ b/deps/npm/html/doc/api/npm-stop.html @@ -28,5 +28,5 @@ in the packages parameter.

       - + diff --git a/deps/npm/html/doc/api/npm-tag.html b/deps/npm/html/doc/api/npm-tag.html index 14dfbd32aa..c11e368cb2 100644 --- a/deps/npm/html/doc/api/npm-tag.html +++ b/deps/npm/html/doc/api/npm-tag.html @@ -36,5 +36,5 @@ used. For more information about how to set this config, check        - + diff --git a/deps/npm/html/doc/api/npm-test.html b/deps/npm/html/doc/api/npm-test.html index e60d561e81..68cd5c43d9 100644 --- a/deps/npm/html/doc/api/npm-test.html +++ b/deps/npm/html/doc/api/npm-test.html @@ -30,5 +30,5 @@ in the packages parameter.

       - + diff --git a/deps/npm/html/doc/api/npm-uninstall.html b/deps/npm/html/doc/api/npm-uninstall.html index 3eea11c6f4..ac29d12f90 100644 --- a/deps/npm/html/doc/api/npm-uninstall.html +++ b/deps/npm/html/doc/api/npm-uninstall.html @@ -30,5 +30,5 @@ uninstalled or when an error has been encountered.

       - + diff --git a/deps/npm/html/doc/api/npm-unpublish.html b/deps/npm/html/doc/api/npm-unpublish.html index f9abc239ec..61f032e51f 100644 --- a/deps/npm/html/doc/api/npm-unpublish.html +++ b/deps/npm/html/doc/api/npm-unpublish.html @@ -33,5 +33,5 @@ the root package entry is removed from the registry entirely.

       - + diff --git a/deps/npm/html/doc/api/npm-update.html b/deps/npm/html/doc/api/npm-update.html index 851fbdae2c..39f60a1567 100644 --- a/deps/npm/html/doc/api/npm-update.html +++ b/deps/npm/html/doc/api/npm-update.html @@ -33,5 +33,5 @@ parameter will be called when done or when an error occurs.

       - + diff --git a/deps/npm/html/doc/api/npm-version.html b/deps/npm/html/doc/api/npm-version.html index 0277a27412..f73cdea778 100644 --- a/deps/npm/html/doc/api/npm-version.html +++ b/deps/npm/html/doc/api/npm-version.html @@ -32,5 +32,5 @@ not have exactly one element. The only element should be a version number.

       - + diff --git a/deps/npm/html/doc/api/npm-view.html b/deps/npm/html/doc/api/npm-view.html index f68cec8d58..d2bbb05043 100644 --- a/deps/npm/html/doc/api/npm-view.html +++ b/deps/npm/html/doc/api/npm-view.html @@ -81,5 +81,5 @@ the field name.

       - + diff --git a/deps/npm/html/doc/api/npm-whoami.html b/deps/npm/html/doc/api/npm-whoami.html index 8eac49bcb4..105b0d2622 100644 --- a/deps/npm/html/doc/api/npm-whoami.html +++ b/deps/npm/html/doc/api/npm-whoami.html @@ -29,5 +29,5 @@        - + diff --git a/deps/npm/html/doc/api/npm.html b/deps/npm/html/doc/api/npm.html index 69585f5c98..0a0a093e96 100644 --- a/deps/npm/html/doc/api/npm.html +++ b/deps/npm/html/doc/api/npm.html @@ -23,7 +23,7 @@ npm.load([configObject, ]function (er, npm) { npm.commands.install(["package"], cb) })

VERSION

-

2.7.0

+

2.7.1

DESCRIPTION

This is the API documentation for npm. To find documentation of the command line @@ -109,5 +109,5 @@ method names. Use the npm.deref method to find the real name.

       - + diff --git a/deps/npm/html/doc/cli/npm-access.html b/deps/npm/html/doc/cli/npm-access.html index 836ef8c4da..d614560eb2 100644 --- a/deps/npm/html/doc/cli/npm-access.html +++ b/deps/npm/html/doc/cli/npm-access.html @@ -75,5 +75,5 @@ with an HTTP 402 status code (logically enough), unless you use        - + diff --git a/deps/npm/html/doc/cli/npm-adduser.html b/deps/npm/html/doc/cli/npm-adduser.html index 93818e9aef..81fd7bbecf 100644 --- a/deps/npm/html/doc/cli/npm-adduser.html +++ b/deps/npm/html/doc/cli/npm-adduser.html @@ -68,5 +68,5 @@ precedence over any global configuration.

       - + diff --git a/deps/npm/html/doc/cli/npm-bin.html b/deps/npm/html/doc/cli/npm-bin.html index c9b43ad0c4..fdb6f85939 100644 --- a/deps/npm/html/doc/cli/npm-bin.html +++ b/deps/npm/html/doc/cli/npm-bin.html @@ -35,5 +35,5 @@        - + diff --git a/deps/npm/html/doc/cli/npm-bugs.html b/deps/npm/html/doc/cli/npm-bugs.html index f19b04c837..45a9a21dee 100644 --- a/deps/npm/html/doc/cli/npm-bugs.html +++ b/deps/npm/html/doc/cli/npm-bugs.html @@ -54,5 +54,5 @@ a package.json in the current folder and use the name        - + diff --git a/deps/npm/html/doc/cli/npm-build.html b/deps/npm/html/doc/cli/npm-build.html index 21d010e9a8..ed4f8c93f5 100644 --- a/deps/npm/html/doc/cli/npm-build.html +++ b/deps/npm/html/doc/cli/npm-build.html @@ -38,5 +38,5 @@ A folder containing a package.json file in its root.        - + diff --git a/deps/npm/html/doc/cli/npm-bundle.html b/deps/npm/html/doc/cli/npm-bundle.html index 35b09036a4..3b93dce574 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.

       - + diff --git a/deps/npm/html/doc/cli/npm-cache.html b/deps/npm/html/doc/cli/npm-cache.html index 516e769021..0dde876b3e 100644 --- a/deps/npm/html/doc/cli/npm-cache.html +++ b/deps/npm/html/doc/cli/npm-cache.html @@ -81,5 +81,5 @@ they do not make an HTTP request to the registry.

       - + diff --git a/deps/npm/html/doc/cli/npm-completion.html b/deps/npm/html/doc/cli/npm-completion.html index 58548888a6..36580f3473 100644 --- a/deps/npm/html/doc/cli/npm-completion.html +++ b/deps/npm/html/doc/cli/npm-completion.html @@ -42,5 +42,5 @@ completions based on the arguments.

       - + diff --git a/deps/npm/html/doc/cli/npm-config.html b/deps/npm/html/doc/cli/npm-config.html index 4b55be25e9..4ddc6fb92b 100644 --- a/deps/npm/html/doc/cli/npm-config.html +++ b/deps/npm/html/doc/cli/npm-config.html @@ -66,5 +66,5 @@ global config.

       - + diff --git a/deps/npm/html/doc/cli/npm-dedupe.html b/deps/npm/html/doc/cli/npm-dedupe.html index 1c06741d37..69486b9b37 100644 --- a/deps/npm/html/doc/cli/npm-dedupe.html +++ b/deps/npm/html/doc/cli/npm-dedupe.html @@ -63,5 +63,5 @@ versions.

       - + diff --git a/deps/npm/html/doc/cli/npm-deprecate.html b/deps/npm/html/doc/cli/npm-deprecate.html index 6411329570..770333cef7 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:

       - + diff --git a/deps/npm/html/doc/cli/npm-dist-tag.html b/deps/npm/html/doc/cli/npm-dist-tag.html index 0b679b856d..905bbe7c9f 100644 --- a/deps/npm/html/doc/cli/npm-dist-tag.html +++ b/deps/npm/html/doc/cli/npm-dist-tag.html @@ -76,5 +76,5 @@ begin with a number or the letter v.

       - + diff --git a/deps/npm/html/doc/cli/npm-docs.html b/deps/npm/html/doc/cli/npm-docs.html index 3ea861db29..7782ddde29 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 name property.

       - + diff --git a/deps/npm/html/doc/cli/npm-edit.html b/deps/npm/html/doc/cli/npm-edit.html index d3d535dc9d..62db4aa694 100644 --- a/deps/npm/html/doc/cli/npm-edit.html +++ b/deps/npm/html/doc/cli/npm-edit.html @@ -49,5 +49,5 @@ or "notepad" on Windows.        - + diff --git a/deps/npm/html/doc/cli/npm-explore.html b/deps/npm/html/doc/cli/npm-explore.html index 835290f5c8..d535eaf749 100644 --- a/deps/npm/html/doc/cli/npm-explore.html +++ b/deps/npm/html/doc/cli/npm-explore.html @@ -49,5 +49,5 @@ Windows        - + diff --git a/deps/npm/html/doc/cli/npm-help-search.html b/deps/npm/html/doc/cli/npm-help-search.html index 17b3f5dec9..6309bbd1d5 100644 --- a/deps/npm/html/doc/cli/npm-help-search.html +++ b/deps/npm/html/doc/cli/npm-help-search.html @@ -46,5 +46,5 @@ where the terms were found in the documentation.

       - + diff --git a/deps/npm/html/doc/cli/npm-help.html b/deps/npm/html/doc/cli/npm-help.html index 5c0efe03e5..a01dccd4f0 100644 --- a/deps/npm/html/doc/cli/npm-help.html +++ b/deps/npm/html/doc/cli/npm-help.html @@ -52,5 +52,5 @@ matches are equivalent to specifying a topic name.

       - + diff --git a/deps/npm/html/doc/cli/npm-init.html b/deps/npm/html/doc/cli/npm-init.html index 3aa29a8106..cde9aa3e57 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.

       - + diff --git a/deps/npm/html/doc/cli/npm-install.html b/deps/npm/html/doc/cli/npm-install.html index e43c2d05f0..fdb17847a6 100644 --- a/deps/npm/html/doc/cli/npm-install.html +++ b/deps/npm/html/doc/cli/npm-install.html @@ -132,8 +132,8 @@ fetch the package by name if it is not valid. npm install @myorg/privatepackage@">=0.1.0 <0.2.0"
  • npm install <githubname>/<githubrepo>:

    -

    Install the package at https://github.com/githubname/githubrepo" by - attempting to clone it usinggit`.

    +

    Install the package at https://github.com/githubname/githubrepo by + attempting to clone it using git.

    Example:

        npm install mygithubuser/myproject
     

    To reference a package in a git repo that is not on GitHub, see git @@ -240,5 +240,5 @@ affects a real use-case, it will be investigated.

           - + diff --git a/deps/npm/html/doc/cli/npm-link.html b/deps/npm/html/doc/cli/npm-link.html index 818d660ec0..71aaa74c10 100644 --- a/deps/npm/html/doc/cli/npm-link.html +++ b/deps/npm/html/doc/cli/npm-link.html @@ -35,7 +35,8 @@ npm link # creates global link cd ~/projects/node-bloggy # go into some other package directory. npm link redis # link-install the package

    Now, any changes to ~/projects/node-redis will be reflected in -~/projects/node-bloggy/node_modules/node-redis/

    +~/projects/node-bloggy/node_modules/node-redis/. Note that the link should +be to the package name, not the directory name for that package.

    You may also shortcut the two steps in one. For example, to do the above use-case in a shorter way:

    cd ~/projects/node-bloggy  # go into the dir of your main project
    @@ -71,5 +72,5 @@ include that scope, e.g.

           - + diff --git a/deps/npm/html/doc/cli/npm-logout.html b/deps/npm/html/doc/cli/npm-logout.html index 4a77e01c59..bdc68a3781 100644 --- a/deps/npm/html/doc/cli/npm-logout.html +++ b/deps/npm/html/doc/cli/npm-logout.html @@ -55,5 +55,5 @@ that registry at the same time.

           - + diff --git a/deps/npm/html/doc/cli/npm-ls.html b/deps/npm/html/doc/cli/npm-ls.html index 861aad2310..ada66398ea 100644 --- a/deps/npm/html/doc/cli/npm-ls.html +++ b/deps/npm/html/doc/cli/npm-ls.html @@ -22,7 +22,7 @@ installed, as well as their dependencies, in a tree-structure.

    limit the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm's source tree will show:

    -
    npm@2.7.0 /path/to/npm
    +
    npm@2.7.1 /path/to/npm
     └─┬ init-package-json@0.0.4
       └── promzard@0.1.5
     

    It will print out extraneous, missing, and invalid packages.

    @@ -97,5 +97,5 @@ project.

           - + diff --git a/deps/npm/html/doc/cli/npm-outdated.html b/deps/npm/html/doc/cli/npm-outdated.html index 10df0aacd3..9b7b56ec76 100644 --- a/deps/npm/html/doc/cli/npm-outdated.html +++ b/deps/npm/html/doc/cli/npm-outdated.html @@ -67,5 +67,5 @@ project.

           - + diff --git a/deps/npm/html/doc/cli/npm-owner.html b/deps/npm/html/doc/cli/npm-owner.html index 01b8380c9a..b3ddc0f1f0 100644 --- a/deps/npm/html/doc/cli/npm-owner.html +++ b/deps/npm/html/doc/cli/npm-owner.html @@ -49,5 +49,5 @@ that is not implemented at this time.

           - + diff --git a/deps/npm/html/doc/cli/npm-pack.html b/deps/npm/html/doc/cli/npm-pack.html index b3f70935a0..eb89641bd2 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.

           - + diff --git a/deps/npm/html/doc/cli/npm-prefix.html b/deps/npm/html/doc/cli/npm-prefix.html index caef5516d6..b49cb9be0d 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 -g is also specified.

           - + diff --git a/deps/npm/html/doc/cli/npm-prune.html b/deps/npm/html/doc/cli/npm-prune.html index fbf0aaf84c..d6605d62b3 100644 --- a/deps/npm/html/doc/cli/npm-prune.html +++ b/deps/npm/html/doc/cli/npm-prune.html @@ -39,5 +39,5 @@ packages specified in your devDependencies.

           - + diff --git a/deps/npm/html/doc/cli/npm-publish.html b/deps/npm/html/doc/cli/npm-publish.html index 3cd7406fc1..c86dc24f37 100644 --- a/deps/npm/html/doc/cli/npm-publish.html +++ b/deps/npm/html/doc/cli/npm-publish.html @@ -66,5 +66,5 @@ it is removed with        - + diff --git a/deps/npm/html/doc/cli/npm-rebuild.html b/deps/npm/html/doc/cli/npm-rebuild.html index 898d904a1c..47850321c8 100644 --- a/deps/npm/html/doc/cli/npm-rebuild.html +++ b/deps/npm/html/doc/cli/npm-rebuild.html @@ -38,5 +38,5 @@ the new binary.

           - + diff --git a/deps/npm/html/doc/cli/npm-repo.html b/deps/npm/html/doc/cli/npm-repo.html index 50840d500d..5fd02cf501 100644 --- a/deps/npm/html/doc/cli/npm-repo.html +++ b/deps/npm/html/doc/cli/npm-repo.html @@ -42,5 +42,5 @@ a package.json in the current folder and use the name        - + diff --git a/deps/npm/html/doc/cli/npm-restart.html b/deps/npm/html/doc/cli/npm-restart.html index c09e1039ed..715b57ea2e 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

           - + diff --git a/deps/npm/html/doc/cli/npm-rm.html b/deps/npm/html/doc/cli/npm-rm.html index 09ef1100ff..6d07a82122 100644 --- a/deps/npm/html/doc/cli/npm-rm.html +++ b/deps/npm/html/doc/cli/npm-rm.html @@ -39,5 +39,5 @@ on its behalf.

           - + diff --git a/deps/npm/html/doc/cli/npm-root.html b/deps/npm/html/doc/cli/npm-root.html index 39b6e6ca88..68d10a82c1 100644 --- a/deps/npm/html/doc/cli/npm-root.html +++ b/deps/npm/html/doc/cli/npm-root.html @@ -35,5 +35,5 @@        - + diff --git a/deps/npm/html/doc/cli/npm-run-script.html b/deps/npm/html/doc/cli/npm-run-script.html index ca0f575cfc..f1defdf3bd 100644 --- a/deps/npm/html/doc/cli/npm-run-script.html +++ b/deps/npm/html/doc/cli/npm-run-script.html @@ -30,6 +30,12 @@ and not to any pre or post script.

    environment variables that will be available to the script at runtime. If an "env" command is defined in your package it will take precedence over the built-in.

    +

    In addition to the shell's pre-existing PATH, npm run adds +node_modules/.bin to the PATH provided to scripts. Any binaries provided by +locally-installed dependencies can be used without the node_modules/.bin +prefix. For example, if there is a devDependency on tap in your package, +you should write "scripts": {"test": "tap test/\*.js"} instead of "scripts": +{"test": "node_modules/.bin/tap test/\*.js"} to run your tests.

    SEE ALSO

    • npm-scripts(7)
    • @@ -50,5 +56,5 @@ built-in.

             - + diff --git a/deps/npm/html/doc/cli/npm-search.html b/deps/npm/html/doc/cli/npm-search.html index eb4c522e55..3926624f41 100644 --- a/deps/npm/html/doc/cli/npm-search.html +++ b/deps/npm/html/doc/cli/npm-search.html @@ -49,5 +49,5 @@ fall on multiple lines.

             - + diff --git a/deps/npm/html/doc/cli/npm-shrinkwrap.html b/deps/npm/html/doc/cli/npm-shrinkwrap.html index 3676105b2c..cae35b71d9 100644 --- a/deps/npm/html/doc/cli/npm-shrinkwrap.html +++ b/deps/npm/html/doc/cli/npm-shrinkwrap.html @@ -164,5 +164,5 @@ contents rather than versions.

             - + diff --git a/deps/npm/html/doc/cli/npm-star.html b/deps/npm/html/doc/cli/npm-star.html index 0a31eb6990..a4474e7b43 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.

             - + diff --git a/deps/npm/html/doc/cli/npm-stars.html b/deps/npm/html/doc/cli/npm-stars.html index 3d893db265..1a227df849 100644 --- a/deps/npm/html/doc/cli/npm-stars.html +++ b/deps/npm/html/doc/cli/npm-stars.html @@ -37,5 +37,5 @@ you will most certainly enjoy this command.

             - + diff --git a/deps/npm/html/doc/cli/npm-start.html b/deps/npm/html/doc/cli/npm-start.html index 5a163f6a07..4959ed84d6 100644 --- a/deps/npm/html/doc/cli/npm-start.html +++ b/deps/npm/html/doc/cli/npm-start.html @@ -34,5 +34,5 @@        - + diff --git a/deps/npm/html/doc/cli/npm-stop.html b/deps/npm/html/doc/cli/npm-stop.html index 8b401e7c58..62c29c1ef8 100644 --- a/deps/npm/html/doc/cli/npm-stop.html +++ b/deps/npm/html/doc/cli/npm-stop.html @@ -34,5 +34,5 @@        - + diff --git a/deps/npm/html/doc/cli/npm-tag.html b/deps/npm/html/doc/cli/npm-tag.html index dae1ecc4df..f8d307f9c7 100644 --- a/deps/npm/html/doc/cli/npm-tag.html +++ b/deps/npm/html/doc/cli/npm-tag.html @@ -62,5 +62,5 @@ that do not begin with a number or the letter v.

             - + diff --git a/deps/npm/html/doc/cli/npm-test.html b/deps/npm/html/doc/cli/npm-test.html index 8ae25dd8af..67c4156a4d 100644 --- a/deps/npm/html/doc/cli/npm-test.html +++ b/deps/npm/html/doc/cli/npm-test.html @@ -37,5 +37,5 @@ true.

             - + diff --git a/deps/npm/html/doc/cli/npm-uninstall.html b/deps/npm/html/doc/cli/npm-uninstall.html index 9cd72c7055..bdbde20daf 100644 --- a/deps/npm/html/doc/cli/npm-uninstall.html +++ b/deps/npm/html/doc/cli/npm-uninstall.html @@ -57,5 +57,5 @@ npm uninstall dtrace-provider --save-optional        - + diff --git a/deps/npm/html/doc/cli/npm-unpublish.html b/deps/npm/html/doc/cli/npm-unpublish.html index e363c0a618..6692c1ddd2 100644 --- a/deps/npm/html/doc/cli/npm-unpublish.html +++ b/deps/npm/html/doc/cli/npm-unpublish.html @@ -47,5 +47,5 @@ package again, a new version number must be used.

             - + diff --git a/deps/npm/html/doc/cli/npm-update.html b/deps/npm/html/doc/cli/npm-update.html index 2a132bbf8a..5e5392fb1b 100644 --- a/deps/npm/html/doc/cli/npm-update.html +++ b/deps/npm/html/doc/cli/npm-update.html @@ -119,5 +119,5 @@ be downgraded.

             - + diff --git a/deps/npm/html/doc/cli/npm-version.html b/deps/npm/html/doc/cli/npm-version.html index d167770d0c..0794ce8386 100644 --- a/deps/npm/html/doc/cli/npm-version.html +++ b/deps/npm/html/doc/cli/npm-version.html @@ -65,5 +65,5 @@ Enter passphrase:        - + diff --git a/deps/npm/html/doc/cli/npm-view.html b/deps/npm/html/doc/cli/npm-view.html index 99ffc892e6..3a659e1c08 100644 --- a/deps/npm/html/doc/cli/npm-view.html +++ b/deps/npm/html/doc/cli/npm-view.html @@ -82,5 +82,5 @@ the field name.

             - + diff --git a/deps/npm/html/doc/cli/npm-whoami.html b/deps/npm/html/doc/cli/npm-whoami.html index d284a41aa1..48d1e3f959 100644 --- a/deps/npm/html/doc/cli/npm-whoami.html +++ b/deps/npm/html/doc/cli/npm-whoami.html @@ -33,5 +33,5 @@        - + diff --git a/deps/npm/html/doc/cli/npm.html b/deps/npm/html/doc/cli/npm.html index 8b67cacba6..af0a36589b 100644 --- a/deps/npm/html/doc/cli/npm.html +++ b/deps/npm/html/doc/cli/npm.html @@ -13,7 +13,7 @@

      SYNOPSIS

      npm <command> [args]
       

      VERSION

      -

      2.7.0

      +

      2.7.1

      DESCRIPTION

      npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency @@ -110,7 +110,7 @@ easily by doing npm view npm contributors.

      the issues list or ask on the mailing list.

      BUGS

      When you find issues, please report them:

      @@ -118,7 +118,7 @@ the issues list or ask on the mailing list.

    • web: http://github.com/npm/npm/issues
    • email: -npm-@googlegroups.com
    • +npm-@googlegroups.com

    Be sure to include all of the output from the npm command that didn't work as expected. The npm-debug.log file is also helpful to provide.

    @@ -128,7 +128,7 @@ will no doubt tell you to put the output in a gist or email.

    Isaac Z. Schlueter :: isaacs :: @izs :: -i@izs.me

    +i@izs.me

    SEE ALSO

    VERSION

    -

    2.7.0

    +

    2.7.1

    DESCRIPTION

    This is the API documentation for npm. To find documentation of the command line diff --git a/deps/npm/html/partial/doc/cli/npm-install.html b/deps/npm/html/partial/doc/cli/npm-install.html index a8e84d1a00..dc601780c3 100644 --- a/deps/npm/html/partial/doc/cli/npm-install.html +++ b/deps/npm/html/partial/doc/cli/npm-install.html @@ -121,8 +121,8 @@ fetch the package by name if it is not valid. npm install @myorg/privatepackage@">=0.1.0 <0.2.0"

  • npm install <githubname>/<githubrepo>:

    -

    Install the package at https://github.com/githubname/githubrepo" by - attempting to clone it usinggit`.

    +

    Install the package at https://github.com/githubname/githubrepo by + attempting to clone it using git.

    Example:

        npm install mygithubuser/myproject
     

    To reference a package in a git repo that is not on GitHub, see git diff --git a/deps/npm/html/partial/doc/cli/npm-link.html b/deps/npm/html/partial/doc/cli/npm-link.html index 1a33cf2c3e..d25a64005b 100644 --- a/deps/npm/html/partial/doc/cli/npm-link.html +++ b/deps/npm/html/partial/doc/cli/npm-link.html @@ -24,7 +24,8 @@ npm link # creates global link cd ~/projects/node-bloggy # go into some other package directory. npm link redis # link-install the package

    Now, any changes to ~/projects/node-redis will be reflected in -~/projects/node-bloggy/node_modules/node-redis/

    +~/projects/node-bloggy/node_modules/node-redis/. Note that the link should +be to the package name, not the directory name for that package.

    You may also shortcut the two steps in one. For example, to do the above use-case in a shorter way:

    cd ~/projects/node-bloggy  # go into the dir of your main project
    diff --git a/deps/npm/html/partial/doc/cli/npm-ls.html b/deps/npm/html/partial/doc/cli/npm-ls.html
    index a3cab85695..aeec1f70fb 100644
    --- a/deps/npm/html/partial/doc/cli/npm-ls.html
    +++ b/deps/npm/html/partial/doc/cli/npm-ls.html
    @@ -11,7 +11,7 @@ installed, as well as their dependencies, in a tree-structure.

    limit the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm's source tree will show:

    -
    npm@2.7.0 /path/to/npm
    +
    npm@2.7.1 /path/to/npm
     └─┬ init-package-json@0.0.4
       └── promzard@0.1.5
     

    It will print out extraneous, missing, and invalid packages.

    diff --git a/deps/npm/html/partial/doc/cli/npm-run-script.html b/deps/npm/html/partial/doc/cli/npm-run-script.html index 5ee7644078..4d3b6722f0 100644 --- a/deps/npm/html/partial/doc/cli/npm-run-script.html +++ b/deps/npm/html/partial/doc/cli/npm-run-script.html @@ -19,6 +19,12 @@ and not to any pre or post script.

    environment variables that will be available to the script at runtime. If an "env" command is defined in your package it will take precedence over the built-in.

    +

    In addition to the shell's pre-existing PATH, npm run adds +node_modules/.bin to the PATH provided to scripts. Any binaries provided by +locally-installed dependencies can be used without the node_modules/.bin +prefix. For example, if there is a devDependency on tap in your package, +you should write "scripts": {"test": "tap test/\*.js"} instead of "scripts": +{"test": "node_modules/.bin/tap test/\*.js"} to run your tests.

    SEE ALSO

    • npm-scripts(7)
    • diff --git a/deps/npm/html/partial/doc/cli/npm.html b/deps/npm/html/partial/doc/cli/npm.html index a290535ece..d9337c05cf 100644 --- a/deps/npm/html/partial/doc/cli/npm.html +++ b/deps/npm/html/partial/doc/cli/npm.html @@ -2,7 +2,7 @@

      SYNOPSIS

      npm <command> [args]
       

      VERSION

      -

      2.7.0

      +

      2.7.1

      DESCRIPTION

      npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency @@ -99,7 +99,7 @@ easily by doing npm view npm contributors.

      the issues list or ask on the mailing list.

      BUGS

      When you find issues, please report them:

      @@ -107,7 +107,7 @@ the issues list or ask on the mailing list.

    • web: http://github.com/npm/npm/issues
    • email: -npm-@googlegroups.com
    • +npm-@googlegroups.com

    Be sure to include all of the output from the npm command that didn't work as expected. The npm-debug.log file is also helpful to provide.

    @@ -117,7 +117,7 @@ will no doubt tell you to put the output in a gist or email.

    Isaac Z. Schlueter :: isaacs :: @izs :: -i@izs.me

    +i@izs.me

    SEE ALSO

    • npm-help(1)
    • diff --git a/deps/npm/html/partial/doc/misc/npm-disputes.html b/deps/npm/html/partial/doc/misc/npm-disputes.html index 2a9cb8246f..b159a5cb06 100644 --- a/deps/npm/html/partial/doc/misc/npm-disputes.html +++ b/deps/npm/html/partial/doc/misc/npm-disputes.html @@ -2,7 +2,7 @@

      SYNOPSIS

      1. Get the author email with npm owner ls <pkgname>
      2. -
      3. Email the author, CC support@npmjs.com
      4. +
      5. Email the author, CC support@npmjs.com
      6. After a few weeks, if there's no resolution, we'll sort it out.

      Don't squat on package names. Publish code or move out of the way.

      @@ -40,12 +40,12 @@ Joe's appropriate course of action in each case is the same.

      owner (Bob).
    • Joe emails Bob, explaining the situation as respectfully as possible, and what he would like to do with the module name. He -adds the npm support staff support@npmjs.com to the CC list of +adds the npm support staff support@npmjs.com to the CC list of the email. Mention in the email that Bob can run npm owner add joe foo to add Joe as an owner of the foo package.
    • After a reasonable amount of time, if Bob has not responded, or if Bob and Joe can't come to any sort of resolution, email support -support@npmjs.com and we'll sort it out. ("Reasonable" is +support@npmjs.com and we'll sort it out. ("Reasonable" is usually at least 4 weeks, but extra time is allowed around common holidays.)
    • diff --git a/deps/npm/html/partial/doc/misc/npm-faq.html b/deps/npm/html/partial/doc/misc/npm-faq.html index 60db91f90b..a72cff8925 100644 --- a/deps/npm/html/partial/doc/misc/npm-faq.html +++ b/deps/npm/html/partial/doc/misc/npm-faq.html @@ -225,7 +225,7 @@ that has a package.json in its root, or a git url.

      To check if the registry is down, open up https://registry.npmjs.org/ in a web browser. This will also tell you if you are just unable to access the internet for some reason.

      -

      If the registry IS down, let us know by emailing support@npmjs.com +

      If the registry IS down, let us know by emailing support@npmjs.com or posting an issue at https://github.com/npm/npm/issues. If it's down for the world (and not just on your local network) then we're probably already being pinged about it.

      diff --git a/deps/npm/lib/cache/add-named.js b/deps/npm/lib/cache/add-named.js index d81b7b0da6..cb5a3fa8a6 100644 --- a/deps/npm/lib/cache/add-named.js +++ b/deps/npm/lib/cache/add-named.js @@ -12,7 +12,6 @@ var path = require("path") , addRemoteTarball = require("./add-remote-tarball.js") , cachedPackageRoot = require("./cached-package-root.js") , mapToRegistry = require("../utils/map-to-registry.js") - , warnStrict = require("../utils/warn-deprecated.js")("engineStrict") module.exports = addNamed @@ -92,12 +91,6 @@ function engineFilter (data) { Object.keys(data.versions || {}).forEach(function (v) { var eng = data.versions[v].engines if (!eng) return - if (data.versions[v].engineStrict) { - warnStrict([ - "Per-package engineStrict (found in package.json for "+data.name+")", - "won't be used in npm 3+. Use the config setting `engine-strict` instead." - ], data.name) - } if (!strict && !data.versions[v].engineStrict) return if (eng.node && !semver.satisfies(nodev, eng.node, true) || eng.npm && !semver.satisfies(npmv, eng.npm, true)) { diff --git a/deps/npm/lib/cache/add-remote-git.js b/deps/npm/lib/cache/add-remote-git.js index 974c158f9c..9eaf6b18a5 100644 --- a/deps/npm/lib/cache/add-remote-git.js +++ b/deps/npm/lib/cache/add-remote-git.js @@ -1,269 +1,330 @@ -var mkdir = require("mkdirp") - , assert = require("assert") - , git = require("../utils/git.js") - , fs = require("graceful-fs") - , log = require("npmlog") - , path = require("path") - , url = require("url") - , chownr = require("chownr") - , crypto = require("crypto") - , npm = require("../npm.js") - , rm = require("../utils/gently-rm.js") - , inflight = require("inflight") - , getCacheStat = require("./get-stat.js") - , addLocal = require("./add-local.js") - , realizePackageSpecifier = require("realize-package-specifier") - , normalizeGitUrl = require("normalize-git-url") - , randomBytes = require("crypto").pseudoRandomBytes // only need uniqueness - -var remotes = path.resolve(npm.config.get("cache"), "_git-remotes") -var templates = path.join(remotes, "_templates") +var mkdir = require('mkdirp') +var assert = require('assert') +var git = require('../utils/git.js') +var fs = require('graceful-fs') +var log = require('npmlog') +var path = require('path') +var url = require('url') +var chownr = require('chownr') +var crypto = require('crypto') +var npm = require('../npm.js') +var rm = require('../utils/gently-rm.js') +var inflight = require('inflight') +var getCacheStat = require('./get-stat.js') +var addLocal = require('./add-local.js') +var realizePackageSpecifier = require('realize-package-specifier') +var normalizeGitUrl = require('normalize-git-url') +var randomBytes = require('crypto').pseudoRandomBytes // only need uniqueness + +var remotes = path.resolve(npm.config.get('cache'), '_git-remotes') +var templates = path.join(remotes, '_templates') var VALID_VARIABLES = [ - "GIT_SSH", - "GIT_SSL_NO_VERIFY", - "GIT_PROXY_COMMAND", - "GIT_SSL_CAINFO" + 'GIT_SSH', + 'GIT_SSL_NO_VERIFY', + 'GIT_PROXY_COMMAND', + 'GIT_SSL_CAINFO' ] -// 1. cacheDir = path.join(cache,'_git-remotes',sha1(u)) -// 2. checkGitDir(cacheDir) ? 4. : 3. (rm cacheDir if necessary) -// 3. git clone --mirror u cacheDir -// 4. cd cacheDir && git fetch -a origin -// 5. git archive /tmp/random.tgz -// 6. addLocalTarball(/tmp/random.tgz) --format=tar --prefix=package/ -// silent flag is used if this should error quietly -module.exports = function addRemoteGit (u, silent, cb) { - assert(typeof u === "string", "must have git URL") - assert(typeof cb === "function", "must have callback") - - log.verbose("addRemoteGit", "u=%j silent=%j", u, silent) - var normalized = normalizeGitUrl(u) - log.silly("addRemoteGit", "normalized", normalized) - - var v = crypto.createHash("sha1").update(normalized.url).digest("hex").slice(0, 8) - v = normalized.url.replace(/[^a-zA-Z0-9]+/g, "-")+"-"+v - log.silly("addRemoteGit", "v", v) - - var p = path.join(remotes, v) - cb = inflight(p, cb) - if (!cb) return log.verbose("addRemoteGit", p, "already in flight; waiting") - log.verbose("addRemoteGit", p, "not in flight; cloning") +module.exports = function addRemoteGit (uri, silent, cb) { + assert(typeof uri === 'string', 'must have git URL') + assert(typeof cb === 'function', 'must have callback') + + // reconstruct the URL as it was passed in – realizePackageSpecifier + // strips off `git+` and `maybeGithub` doesn't include it. + var originalURL + if (!/^git[+:]/.test(uri)) { + originalURL = 'git+' + uri + } else { + originalURL = uri + } - getGitDir(function (er) { - if (er) return cb(er) - checkGitDir(p, normalized.url, normalized.branch, u, silent, function (er, data) { - if (er) return cb(er, data) + // break apart the origin URL and the branch / tag / commitish + var normalized = normalizeGitUrl(uri) + var gitURL = normalized.url + var treeish = normalized.branch - addModeRecursive(p, npm.modes.file, function (er) { - return cb(er, data) - }) - }) - }) -} + // ensure that similarly-named remotes don't collide + var repoID = gitURL.replace(/[^a-zA-Z0-9]+/g, '-') + '-' + + crypto.createHash('sha1').update(gitURL).digest('hex').slice(0, 8) + var cachedRemote = path.join(remotes, repoID) -function getGitDir (cb) { - getCacheStat(function (er, st) { - if (er) return cb(er) + // set later, as the callback flow proceeds + var resolvedURL + var resolvedTreeish + var tmpdir - // We don't need global templates when cloning. Use an empty directory for - // the templates, creating it (and setting its permissions) if necessary. - mkdir(templates, function (er) { - if (er) return cb(er) + cb = inflight(repoID, cb) + if (!cb) { + return log.verbose('addRemoteGit', repoID, 'already in flight; waiting') + } + log.verbose('addRemoteGit', repoID, 'not in flight; caching') - // Ensure that both the template and remotes directories have the correct - // permissions. - fs.chown(templates, st.uid, st.gid, function (er) { - if (er) return cb(er) + // initialize the remotes cache with the correct perms + getGitDir(function (er) { + if (er) return cb(er) + fs.stat(cachedRemote, function (er, s) { + if (er) return mirrorRemote(finish) + if (!s.isDirectory()) return resetRemote(finish) - fs.chown(remotes, st.uid, st.gid, function (er) { - cb(er, st) - }) - }) + validateExistingRemote(finish) }) + + // always set permissions on the cached remote + function finish (er, data) { + if (er) return cb(er, data) + addModeRecursive(cachedRemote, npm.modes.file, function (er) { + return cb(er, data) + }) + } }) -} -function checkGitDir (p, u, co, origUrl, silent, cb) { - fs.stat(p, function (er, s) { - if (er) return cloneGitRemote(p, u, co, origUrl, silent, cb) - if (!s.isDirectory()) return rm(p, function (er) { + // don't try too hard to hold on to a remote + function resetRemote (cb) { + log.info('addRemoteGit', 'resetting', cachedRemote) + rm(cachedRemote, function (er) { if (er) return cb(er) - cloneGitRemote(p, u, co, origUrl, silent, cb) + mirrorRemote(cb) }) + } + // reuse a cached remote when possible, but nuke it if it's in an + // inconsistent state + function validateExistingRemote (cb) { git.whichAndExec( - [ "config", "--get", "remote.origin.url" ], - { cwd : p, env : gitEnv }, + ['config', '--get', 'remote.origin.url'], + { cwd: cachedRemote, env: gitEnv() }, function (er, stdout, stderr) { - var stdoutTrimmed = (stdout + "\n" + stderr).trim() - if (er || u !== stdout.trim()) { - log.warn( "`git config --get remote.origin.url` returned " - + "wrong result ("+u+")", stdoutTrimmed ) - return rm(p, function (er){ - if (er) return cb(er) - cloneGitRemote(p, u, co, origUrl, silent, cb) - }) + var originURL = stdout.trim() + stderr = stderr.trim() + log.verbose('addRemoteGit', 'remote.origin.url:', originURL) + + if (stderr || er) { + log.warn('addRemoteGit', 'resetting remote', cachedRemote, 'because of error:', stderr || er) + return resetRemote(cb) + } else if (gitURL !== originURL) { + log.warn( + 'addRemoteGit', + 'pre-existing cached repo', cachedRemote, 'points to', originURL, 'and not', gitURL + ) + return resetRemote(cb) } - log.verbose("git remote.origin.url", stdoutTrimmed) - fetchRemote(p, u, co, origUrl, cb) + + log.verbose('addRemoteGit', 'updating existing cached remote', cachedRemote) + updateRemote(cb) } ) - }) -} + } -function cloneGitRemote (p, u, co, origUrl, silent, cb) { - mkdir(p, function (er) { - if (er) return cb(er) + // make a complete bare mirror of the remote repo + // NOTE: npm uses a blank template directory to prevent weird inconsistencies + // https://github.com/npm/npm/issues/5867 + function mirrorRemote (cb) { + mkdir(cachedRemote, function (er) { + if (er) return cb(er) - git.whichAndExec( - [ "clone", "--template=" + templates, "--mirror", u, p ], - { cwd : p, env : gitEnv() }, - function (er, stdout, stderr) { - stdout = (stdout + "\n" + stderr).trim() - if (er) { - if (silent) { - log.verbose("git clone " + u, stdout) - } else { - log.error("git clone " + u, stdout) + var args = [ + 'clone', + '--template=' + templates, + '--mirror', + gitURL, cachedRemote + ] + git.whichAndExec( + ['clone', '--template=' + templates, '--mirror', gitURL, cachedRemote], + { cwd: cachedRemote, env: gitEnv() }, + function (er, stdout, stderr) { + if (er) { + var combined = (stdout + '\n' + stderr).trim() + var command = 'git ' + args.join(' ') + ':' + if (silent) { + log.verbose(command, combined) + } else { + log.error(command, combined) + } + return cb(er) } - return cb(er) + log.verbose('addRemoteGit', 'git clone ' + gitURL, stdout.trim()) + setPermissions(cb) } - log.verbose("git clone " + u, stdout) - fetchRemote(p, u, co, origUrl, cb) - } - ) - }) -} + ) + }) + } -function fetchRemote (p, u, co, origUrl, cb) { - git.whichAndExec( - [ "fetch", "-a", "origin" ], - { cwd : p, env : gitEnv() }, - function (er, stdout, stderr) { - stdout = (stdout + "\n" + stderr).trim() - if (er) { - log.error("git fetch -a origin ("+u+")", stdout) - return cb(er) - } - log.verbose("git fetch -a origin ("+u+")", stdout) + function setPermissions (cb) { + if (process.platform === 'win32') { + log.verbose('addRemoteGit', 'skipping chownr on Windows') + resolveHead(cb) + } else { + getGitDir(function (er, cs) { + if (er) { + log.error('addRemoteGit', 'could not get cache stat') + return cb(er) + } - if (process.platform === "win32") { - log.silly("verifyOwnership", "skipping for windows") - resolveHead(p, u, co, origUrl, cb) - } - else { - getGitDir(function (er, cs) { + chownr(cachedRemote, cs.uid, cs.gid, function (er) { if (er) { - log.error("Could not get cache stat") + log.error( + 'addRemoteGit', + 'Failed to change folder ownership under npm cache for', + cachedRemote + ) return cb(er) } - chownr(p, cs.uid, cs.gid, function (er) { - if (er) { - log.error("Failed to change folder ownership under npm cache for %s", p) - return cb(er) - } - - resolveHead(p, u, co, origUrl, cb) - }) + log.verbose('addRemoteGit', 'set permissions on', cachedRemote) + resolveHead(cb) }) - } + }) } - ) -} - -function resolveHead (p, u, co, origUrl, cb) { - git.whichAndExec( - [ "rev-list", "-n1", co ], - { cwd : p, env : gitEnv() }, - function (er, stdout, stderr) { - stdout = (stdout + "\n" + stderr).trim() - if (er) { - log.error("Failed resolving git HEAD (" + u + ")", stderr) - return cb(er) - } - log.verbose("git rev-list -n1 " + co, stdout) - var parsed = url.parse(origUrl) - parsed.hash = stdout - var resolved = url.format(parsed) + } - if (!/^git[+:]/.test(parsed.protocol)) { - resolved = "git+" + resolved - } + // always fetch the origin, even right after mirroring, because this way + // permissions will get set correctly + function updateRemote (cb) { + git.whichAndExec( + ['fetch', '-a', 'origin'], + { cwd: cachedRemote, env: gitEnv() }, + function (er, stdout, stderr) { + if (er) { + var combined = (stdout + '\n' + stderr).trim() + log.error('git fetch -a origin (' + gitURL + ')', combined) + return cb(er) + } + log.verbose('addRemoteGit', 'git fetch -a origin (' + gitURL + ')', stdout.trim()) - // https://github.com/npm/npm/issues/3224 - // node incorrectly sticks a / at the start of the path We know that the - // host won't change, so split and detect this - var spo = origUrl.split(parsed.host) - var spr = resolved.split(parsed.host) - if (spo[1].charAt(0) === ":" && spr[1].charAt(0) === "/") { - spr[1] = spr[1].slice(1) + setPermissions(cb) } - resolved = spr.join(parsed.host) + ) + } - log.verbose("resolved git url", resolved) - cache(p, u, stdout, resolved, cb) - } - ) -} + // branches and tags are both symbolic labels that can be attached to different + // commits, so resolve the commitish to the current actual treeish the label + // corresponds to + // + // important for shrinkwrap + function resolveHead (cb) { + log.verbose('addRemoteGit', 'original treeish:', treeish) + var args = ['rev-list', '-n1', treeish] + git.whichAndExec( + args, + { cwd: cachedRemote, env: gitEnv() }, + function (er, stdout, stderr) { + if (er) { + log.error('git ' + args.join(' ') + ':', stderr) + return cb(er) + } -/** - * Make an actual clone from the bare (mirrored) cache. There is no safe way to - * do a one-step clone to a treeish that isn't guaranteed to be a branch, so - * this has to be two steps. - */ -function cache (p, u, treeish, resolved, cb) { - // generate a unique filename - randomBytes(6, function (er, random) { - if (er) return cb(er) + resolvedTreeish = stdout.trim() + log.silly('addRemoteGit', 'resolved treeish:', resolvedTreeish) - var tmp = path.join( - npm.tmp, - "git-cache-"+random.toString("hex"), - treeish - ) + resolvedURL = getResolved(originalURL, resolvedTreeish) + log.verbose('addRemoteGit', 'resolved Git URL:', resolvedURL) - mkdir(tmp, function (er) { - if (er) return cb(er) + // generate a unique filename + tmpdir = path.join( + npm.tmp, + 'git-cache-' + randomBytes(6).toString('hex'), + resolvedTreeish + ) + log.silly('addRemoteGit', 'Git working directory:', tmpdir) - git.whichAndExec(["clone", p, tmp], { cwd : p, env : gitEnv() }, clone) - }) + mkdir(tmpdir, function (er) { + if (er) return cb(er) - function clone (er, stdout, stderr) { - stdout = (stdout + "\n" + stderr).trim() - if (er) { - log.error("Failed to clone "+resolved+" from "+u, stderr) - return cb(er) + cloneResolved(cb) + }) } - log.verbose("git clone", "from", p) - log.verbose("git clone", stdout) + ) + } - git.whichAndExec(["checkout", treeish], { cwd : tmp, env : gitEnv() }, checkout) - } + // make a clone from the mirrored cache so we have a temporary directory in + // which we can check out the resolved treeish + function cloneResolved (cb) { + var args = ['clone', cachedRemote, tmpdir] + git.whichAndExec( + args, + { cwd: cachedRemote, env: gitEnv() }, + function (er, stdout, stderr) { + stdout = (stdout + '\n' + stderr).trim() + if (er) { + log.error('git ' + args.join(' ') + ':', stderr) + return cb(er) + } + log.verbose('addRemoteGit', 'clone', stdout) - function checkout (er, stdout, stderr) { - stdout = (stdout + "\n" + stderr).trim() - if (er) { - log.error("Failed to check out "+treeish, stderr) - return cb(er) + checkoutTreeish(cb) } - log.verbose("git checkout", stdout) + ) + } - realizePackageSpecifier(tmp, function (er, spec) { + // there is no safe way to do a one-step clone to a treeish that isn't + // guaranteed to be a branch, so explicitly check out the treeish once it's + // cloned + function checkoutTreeish (cb) { + var args = ['checkout', resolvedTreeish] + git.whichAndExec( + args, + { cwd: tmpdir, env: gitEnv() }, + function (er, stdout, stderr) { + stdout = (stdout + '\n' + stderr).trim() if (er) { - log.error("Failed to map", tmp, "to a package specifier") + log.error('git ' + args.join(' ') + ':', stderr) return cb(er) } + log.verbose('addRemoteGit', 'checkout', stdout) - // https://github.com/npm/npm/issues/6400 - // ensure pack logic is applied - addLocal(spec, null, function (er, data) { - if (data) data._resolved = resolved - cb(er, data) + // convince addLocal that the checkout is a local dependency + realizePackageSpecifier(tmpdir, function (er, spec) { + if (er) { + log.error('addRemoteGit', 'Failed to map', tmpdir, 'to a package specifier') + return cb(er) + } + + // ensure pack logic is applied + // https://github.com/npm/npm/issues/6400 + addLocal(spec, null, function (er, data) { + if (data) { + log.verbose('addRemoteGit', 'data._resolved:', resolvedURL) + data._resolved = resolvedURL + + // the spec passed to addLocal is not what the user originally requested, + // so remap + // https://github.com/npm/npm/issues/7121 + if (!data._fromGitHub) { + log.silly('addRemoteGit', 'data._from:', originalURL) + data._from = originalURL + } else { + log.silly('addRemoteGit', 'data._from:', data._from, '(GitHub)') + } + } + + cb(er, data) + }) + }) + } + ) + } +} + +function getGitDir (cb) { + getCacheStat(function (er, stats) { + if (er) return cb(er) + + // We don't need global templates when cloning. Use an empty directory for + // the templates, creating it (and setting its permissions) if necessary. + mkdir(templates, function (er) { + if (er) return cb(er) + + // Ensure that both the template and remotes directories have the correct + // permissions. + fs.chown(templates, stats.uid, stats.gid, function (er) { + if (er) return cb(er) + + fs.chown(remotes, stats.uid, stats.gid, function (er) { + cb(er, stats) }) }) - } + }) }) } @@ -280,41 +341,60 @@ function gitEnv () { return gitEnv_ } +function getResolved (uri, treeish) { + var parsed = url.parse(uri) + parsed.hash = treeish + if (!/^git[+:]/.test(parsed.protocol)) { + parsed.protocol = 'git+' + parsed.protocol + } + var resolved = url.format(parsed) + + // node incorrectly sticks a / at the start of the path We know that the host + // won't change, so split and detect this + // https://github.com/npm/npm/issues/3224 + var spo = uri.split(parsed.host) + var spr = resolved.split(parsed.host) + if (spo[1].charAt(0) === ':' && spr[1].charAt(0) === '/') { + spr[1] = spr[1].slice(1) + } + return spr.join(parsed.host) +} + // similar to chmodr except it add permissions rather than overwriting them // adapted from https://github.com/isaacs/chmodr/blob/master/chmodr.js -function addModeRecursive(p, mode, cb) { - fs.readdir(p, function (er, children) { +function addModeRecursive (cachedRemote, mode, cb) { + fs.readdir(cachedRemote, function (er, children) { // Any error other than ENOTDIR means it's not readable, or doesn't exist. // Give up. - if (er && er.code !== "ENOTDIR") return cb(er) - if (er || !children.length) return addMode(p, mode, cb) + if (er && er.code !== 'ENOTDIR') return cb(er) + if (er || !children.length) return addMode(cachedRemote, mode, cb) var len = children.length var errState = null children.forEach(function (child) { - addModeRecursive(path.resolve(p, child), mode, then) + addModeRecursive(path.resolve(cachedRemote, child), mode, then) }) function then (er) { if (errState) return undefined if (er) return cb(errState = er) - if (--len === 0) return addMode(p, dirMode(mode), cb) + if (--len === 0) return addMode(cachedRemote, dirMode(mode), cb) } }) } -function addMode(p, mode, cb) { - fs.stat(p, function (er, stats) { +function addMode (cachedRemote, mode, cb) { + fs.stat(cachedRemote, function (er, stats) { if (er) return cb(er) mode = stats.mode | mode - fs.chmod(p, mode, cb) + fs.chmod(cachedRemote, mode, cb) }) } // taken from https://github.com/isaacs/chmodr/blob/master/chmodr.js -function dirMode(mode) { - if (mode & parseInt("0400", 8)) mode |= parseInt("0100", 8) - if (mode & parseInt( "040", 8)) mode |= parseInt( "010", 8) - if (mode & parseInt( "04", 8)) mode |= parseInt( "01", 8) +function dirMode (mode) { + if (mode & parseInt('0400', 8)) mode |= parseInt('0100', 8) + if (mode & parseInt('040', 8)) mode |= parseInt('010', 8) + if (mode & parseInt('04', 8)) mode |= parseInt('01', 8) return mode } diff --git a/deps/npm/lib/cache/add-remote-tarball.js b/deps/npm/lib/cache/add-remote-tarball.js index e87ac54bb1..66d2200966 100644 --- a/deps/npm/lib/cache/add-remote-tarball.js +++ b/deps/npm/lib/cache/add-remote-tarball.js @@ -19,8 +19,8 @@ function addRemoteTarball (u, pkgData, shasum, auth, cb_) { function cb (er, data) { if (data) { data._from = u - data._shasum = data._shasum || shasum data._resolved = u + data._shasum = data._shasum || shasum } cb_(er, data) } diff --git a/deps/npm/lib/config/defaults.js b/deps/npm/lib/config/defaults.js index e49ce210b3..e5744772ed 100644 --- a/deps/npm/lib/config/defaults.js +++ b/deps/npm/lib/config/defaults.js @@ -32,12 +32,6 @@ function validateSemver (data, k, val) { data[k] = semver.valid(val) } -function validateTag (data, k, val) { - val = ("" + val).trim() - if (!val || semver.validRange(val)) return false - data[k] = val -} - function validateStream (data, k, val) { if (!(val instanceof Stream)) return false data[k] = val @@ -47,10 +41,6 @@ nopt.typeDefs.semver = { type: semver, validate: validateSemver } nopt.typeDefs.Stream = { type: Stream, validate: validateStream } nopt.typeDefs.Umask = { type: Umask, validate: validateUmask } -// Don't let --tag=1.2.3 ever be a thing -var tag = {} -nopt.typeDefs.tag = { type: tag, validate: validateTag } - nopt.invalidHandler = function (k, val, type) { log.warn("invalid config", k + "=" + JSON.stringify(val)) @@ -60,9 +50,6 @@ nopt.invalidHandler = function (k, val, type) { } switch (type) { - case tag: - log.warn("invalid config", "Tag must not be a SemVer range") - break case Umask: log.warn("invalid config", "Must be umask, octal number in range 0000..0777") break @@ -312,7 +299,7 @@ exports.types = , "sign-git-tag": Boolean , spin: ["always", Boolean] , "strict-ssl": Boolean - , tag : tag + , tag : String , tmp : path , unicode : Boolean , "unsafe-perm" : Boolean diff --git a/deps/npm/lib/dedupe.js b/deps/npm/lib/dedupe.js index 6a4abd7307..c63705e18d 100644 --- a/deps/npm/lib/dedupe.js +++ b/deps/npm/lib/dedupe.js @@ -314,11 +314,28 @@ function readInstalled (dir, counter, parent, cb) { }) fs.readdir(path.resolve(dir, "node_modules"), function (er, c) { - children = c || [] // error is ok, just means no children. - children = children.filter(function (p) { - return !p.match(/^[\._-]/) - }) - next() + children = children || [] // error is ok, just means no children. + // check if there are scoped packages. + asyncMap(c || [], function (child, cb) { + if (child.indexOf('@') === 0) { + fs.readdir(path.resolve(dir, "node_modules", child), function (er, scopedChildren) { + // error is ok, just means no children. + (scopedChildren || []).forEach(function (sc) { + children.push(path.join(child, sc)) + }) + cb() + }) + } else { + children.push(child) + cb() + } + }, function (er) { + if (er) return cb(er) + children = children.filter(function (p) { + return !p.match(/^[\._-]/) + }) + next(); + }); }) function next () { diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index 73580e5afa..1a235793df 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -109,6 +109,7 @@ var npm = require("./npm.js") , locker = require("./utils/locker.js") , lock = locker.lock , unlock = locker.unlock + , warnStrict = require("./utils/warn-deprecated.js")("engineStrict") , warnPeers = require("./utils/warn-deprecated.js")("peerDependencies") function install (args, cb_) { @@ -117,7 +118,7 @@ function install (args, cb_) { function cb (er, installed) { if (er) return cb_(er) - findPeerInvalid(where, function (er, problem) { + validateInstall(where, function (er, problem) { if (er) return cb_(er) if (problem) { @@ -244,11 +245,24 @@ function install (args, cb_) { }) } -function findPeerInvalid (where, cb) { - readInstalled(where, { log: log.warn, dev: true }, function (er, data) { - if (er) return cb(er) +function validateInstall (where, cb) { + readJson(path.resolve(where, 'package.json'), log.warn, function (er, data) { + if (er + && er.code !== 'ENOENT' + && er.code !== 'ENOTDIR') return cb(er) + + if (data && data.engineStrict) { + warnStrict([ + "Per-package engineStrict (found in this package's package.json) ", + "won't be used in npm 3+. Use the config setting `engine-strict` instead." + ], data.name) + } + + readInstalled(where, { log: log.warn, dev: true }, function (er, data) { + if (er) return cb(er) - cb(null, findPeerInvalid_(data.dependencies, [])) + cb(null, findPeerInvalid_(data.dependencies, [])) + }) }) } @@ -854,8 +868,11 @@ function targetResolver (where, context, deps) { function installOne (target, where, context, cb) { // the --link flag makes this a "link" command if it's at the // the top level. + var isGit = false + if (target && target._from) isGit = npa(target._from).type === 'git' + if (where === npm.prefix && npm.config.get("link") - && !npm.config.get("global")) { + && !npm.config.get("global") && !isGit) { return localLink(target, where, context, cb) } installOne_(target, where, context, function (er, installedWhat) { diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index 3cd21cac1d..459a3c3245 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -66,6 +66,7 @@ var commandCache = {} , "i" : "install" , "isntall" : "install" , "up" : "update" + , "upgrade" : "update" , "c" : "config" , "dist-tags" : "dist-tag" , "info" : "view" diff --git a/deps/npm/lib/publish.js b/deps/npm/lib/publish.js index 06a3404af9..92a9a9b671 100644 --- a/deps/npm/lib/publish.js +++ b/deps/npm/lib/publish.js @@ -13,10 +13,12 @@ var npm = require("./npm.js") , cachedPackageRoot = require("./cache/cached-package-root.js") , createReadStream = require("graceful-fs").createReadStream , npa = require("npm-package-arg") + , semver = require('semver') -publish.usage = "npm publish " - + "\nnpm publish " +publish.usage = "npm publish [--tag ]" + + "\nnpm publish [--tag ]" + "\n\nPublishes '.' if no argument supplied" + + "\n\nSets tag `latest` if no --tag specified" publish.completion = function (opts, cb) { // publish can complete to a folder with a package.json @@ -34,6 +36,13 @@ function publish (args, isRetry, cb) { if (args.length !== 1) return cb(publish.usage) log.verbose("publish", args) + + var t = npm.config.get('tag').trim() + if (semver.validRange(t)) { + var er = new Error("Tag name must not be a valid SemVer range: " + t) + return cb(er) + } + var arg = args[0] // if it's a local folder, then run the prepublish there, first. readJson(path.resolve(arg, "package.json"), function (er, data) { diff --git a/deps/npm/lib/stars.js b/deps/npm/lib/stars.js index 087e8d9bf2..01ec76e42c 100644 --- a/deps/npm/lib/stars.js +++ b/deps/npm/lib/stars.js @@ -9,6 +9,17 @@ var npm = require("./npm.js") function stars (args, cb) { npm.commands.whoami([], true, function (er, username) { var name = args.length === 1 ? args[0] : username + + if (er) { + if (er.code === 'ENEEDAUTH' && !name) { + var needAuth = new Error("'npm stars' on your own user account requires auth") + needAuth.code = 'ENEEDAUTH' + return cb(needAuth) + } + + if (er.code !== 'ENEEDAUTH') return cb(er) + } + mapToRegistry("", npm.config, function (er, uri, auth) { if (er) return cb(er) diff --git a/deps/npm/lib/update.js b/deps/npm/lib/update.js index 06d199cc09..3e9438e923 100644 --- a/deps/npm/lib/update.js +++ b/deps/npm/lib/update.js @@ -22,10 +22,26 @@ update.completion = npm.commands.outdated.completion function update (args, cb) { npm.commands.outdated(args, true, function (er, outdated) { - log.info("outdated", "updating", outdated) if (er) return cb(er) - asyncMap(outdated, function (ww, cb) { + var wanted = outdated.filter(function (ww) { + var dep = ww[1] + var current = ww[2] + var wanted = ww[3] + var latest = ww[4] + if (current === wanted && wanted !== latest) { + log.verbose( + 'outdated', + 'not updating', dep, + "because it's currently at the maximum version that matches its specified semver range" + ) + } + return current !== wanted + }) + if (wanted.length === 0) return cb() + + log.info('outdated', 'updating', wanted) + asyncMap(wanted, function (ww, cb) { // [[ dir, dep, has, want, req ]] var where = ww[0] , dep = ww[1] diff --git a/deps/npm/lib/utils/error-handler.js b/deps/npm/lib/utils/error-handler.js index de12c63632..1c80ab590f 100644 --- a/deps/npm/lib/utils/error-handler.js +++ b/deps/npm/lib/utils/error-handler.js @@ -287,6 +287,7 @@ function errorHandler (er) { case "ECONNRESET": case "ENOTFOUND": case "ETIMEDOUT": + case "EAI_FAIL": log.error("network", [er.message ,"This is most likely not a problem with npm itself" ,"and is related to network connectivity." @@ -354,7 +355,7 @@ function errorHandler (er) { default: log.error("", er.message || er) log.error("", ["", "If you need help, you may report this error at:" - ," " + ," " ].join("\n")) break } diff --git a/deps/npm/lib/whoami.js b/deps/npm/lib/whoami.js index 42cede1b82..d92a6574a1 100644 --- a/deps/npm/lib/whoami.js +++ b/deps/npm/lib/whoami.js @@ -14,14 +14,6 @@ function whoami (args, silent, cb) { var registry = npm.config.get("registry") if (!registry) return cb(new Error("no default registry set")) - function noUser () { - // At this point, if they have a credentials object, it doesn't have a - // token or auth in it. Probably just the default registry. - var msg = "Not authed. Run 'npm adduser'" - if (!silent) console.log(msg) - cb(null, msg) - } - var auth = npm.config.getCredentialsByURI(registry) if (auth) { if (auth.username) { @@ -31,7 +23,13 @@ function whoami (args, silent, cb) { else if (auth.token) { return npm.registry.whoami(registry, { auth : auth }, function (er, username) { if (er) return cb(er) - if (!username) return noUser() + if (!username) { + var needNewSession = new Error( + "Your auth token is no longer valid. Please log in again." + ) + needNewSession.code = 'ENEEDAUTH' + return cb(needNewSession) + } if (!silent) console.log(username) cb(null, username) @@ -39,5 +37,11 @@ function whoami (args, silent, cb) { } } - process.nextTick(noUser) + // At this point, if they have a credentials object, it doesn't have a token + // or auth in it. Probably just the default registry. + var needAuth = new Error( + "'npm whoami' requires you to be logged in." + ) + needAuth.code = 'ENEEDAUTH' + process.nextTick(cb.bind(this, needAuth)) } diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index 3f01a6085f..e8416eb4c3 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -182,8 +182,8 @@ fetch the package by name if it is not valid\. .RE .IP \(bu 2 \fBnpm install /\fR: - Install the package at \fBhttps://github\.com/githubname/githubrepo" by - attempting to clone it using\fRgit`\. + Install the package at \fBhttps://github\.com/githubname/githubrepo\fR by + attempting to clone it using \fBgit\fR\|\. Example: .P .RS 2 diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index 57bd6d9222..523731f3b5 100644 --- a/deps/npm/man/man1/npm-link.1 +++ b/deps/npm/man/man1/npm-link.1 @@ -45,7 +45,8 @@ npm link redis # link\-install the package .RE .P Now, any changes to ~/projects/node\-redis will be reflected in -~/projects/node\-bloggy/node_modules/node\-redis/ +~/projects/node\-bloggy/node_modules/node\-redis/\. Note that the link should +be to the package name, not the directory name for that package\. .P You may also shortcut the two steps in one\. For example, to do the above use\-case in a shorter way: diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 4f0b0e98c7..aeedc91e4c 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -23,7 +23,7 @@ For example, running \fBnpm ls promzard\fR in npm's source tree will show: .P .RS 2 .nf -npm@2.7.0 /path/to/npm +npm@2.7.1 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index b095ddb65f..7f94067d30 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -35,6 +35,13 @@ The \fBenv\fR script is a special built\-in command that can be used to list environment variables that will be available to the script at runtime\. If an "env" command is defined in your package it will take precedence over the built\-in\. +.P +In addition to the shell's pre\-existing \fBPATH\fR, \fBnpm run\fR adds +\fBnode_modules/\.bin\fR to the \fBPATH\fR provided to scripts\. Any binaries provided by +locally\-installed dependencies can be used without the \fBnode_modules/\.bin\fR +prefix\. For example, if there is a \fBdevDependency\fR on \fBtap\fR in your package, +you should write \fB"scripts": {"test": "tap test/\\*\.js"}\fR instead of \fB"scripts": +{"test": "node_modules/\.bin/tap test/\\*\.js"}\fR to run your tests\. .SH SEE ALSO .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 4dc37963e9..4d42aec638 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -10,7 +10,7 @@ npm [args] .RE .SH VERSION .P -2.7.0 +2.7.1 .SH DESCRIPTION .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man3/npm.3 b/deps/npm/man/man3/npm.3 index cd71b11511..5df7b6a89e 100644 --- a/deps/npm/man/man3/npm.3 +++ b/deps/npm/man/man3/npm.3 @@ -20,7 +20,7 @@ npm\.load([configObject, ]function (er, npm) { .RE .SH VERSION .P -2.7.0 +2.7.1 .SH DESCRIPTION .P This is the API documentation for npm\. diff --git a/deps/npm/node_modules/glob/glob.js b/deps/npm/node_modules/glob/glob.js index 0075c1fb86..e1a5c9ece5 100644 --- a/deps/npm/node_modules/glob/glob.js +++ b/deps/npm/node_modules/glob/glob.js @@ -627,12 +627,23 @@ Glob.prototype._stat = function (f, cb) { } var self = this - var statcb = inflight('stat\0' + abs, statcb_) + var statcb = inflight('stat\0' + abs, lstatcb_) if (statcb) - fs.stat(abs, statcb) + fs.lstat(abs, statcb) - function statcb_ (er, stat) { - self._stat2(f, abs, er, stat, cb) + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } } } diff --git a/deps/npm/node_modules/glob/package.json b/deps/npm/node_modules/glob/package.json index 8c11fbb77e..59eff1188f 100644 --- a/deps/npm/node_modules/glob/package.json +++ b/deps/npm/node_modules/glob/package.json @@ -6,7 +6,7 @@ }, "name": "glob", "description": "a little globber", - "version": "4.4.1", + "version": "4.4.2", "repository": { "type": "git", "url": "git://github.com/isaacs/node-glob.git" @@ -42,16 +42,16 @@ "benchclean": "bash benchclean.sh" }, "license": "ISC", - "gitHead": "a10b0294183788c0e9f56fc3ac88832e2c3513bc", + "gitHead": "c13abc0df649ec29f8cfec42f818412887736aa1", "bugs": { "url": "https://github.com/isaacs/node-glob/issues" }, "homepage": "https://github.com/isaacs/node-glob", - "_id": "glob@4.4.1", - "_shasum": "8395b16d01f4a58f0bf3f6359174997b78d74197", - "_from": "glob@>=4.4.1 <4.5.0", + "_id": "glob@4.4.2", + "_shasum": "3ef93e297ee096c1b9b3ffb1d21025c78ab60548", + "_from": "glob@>=4.4.2 <4.5.0", "_npmVersion": "2.6.0", - "_nodeVersion": "1.1.0", + "_nodeVersion": "1.4.2", "_npmUser": { "name": "isaacs", "email": "i@izs.me" @@ -63,9 +63,10 @@ } ], "dist": { - "shasum": "8395b16d01f4a58f0bf3f6359174997b78d74197", - "tarball": "http://registry.npmjs.org/glob/-/glob-4.4.1.tgz" + "shasum": "3ef93e297ee096c1b9b3ffb1d21025c78ab60548", + "tarball": "http://registry.npmjs.org/glob/-/glob-4.4.2.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/glob/-/glob-4.4.1.tgz" + "_resolved": "https://registry.npmjs.org/glob/-/glob-4.4.2.tgz", + "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/glob/sync.js b/deps/npm/node_modules/glob/sync.js index 7aa0d07c59..315fbfb0b4 100644 --- a/deps/npm/node_modules/glob/sync.js +++ b/deps/npm/node_modules/glob/sync.js @@ -391,11 +391,22 @@ GlobSync.prototype._stat = function (f) { var exists var stat = this.statCache[abs] if (!stat) { + var lstat try { - stat = fs.statSync(abs) + lstat = fs.lstatSync(abs) } catch (er) { return false } + + if (lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } } this.statCache[abs] = stat diff --git a/deps/npm/node_modules/inflight/.eslintrc b/deps/npm/node_modules/inflight/.eslintrc new file mode 100644 index 0000000000..b7a1550efc --- /dev/null +++ b/deps/npm/node_modules/inflight/.eslintrc @@ -0,0 +1,17 @@ +{ + "env" : { + "node" : true + }, + "rules" : { + "semi": [2, "never"], + "strict": 0, + "quotes": [1, "single", "avoid-escape"], + "no-use-before-define": 0, + "curly": 0, + "no-underscore-dangle": 0, + "no-lonely-if": 1, + "no-unused-vars": [2, {"vars" : "all", "args" : "after-used"}], + "no-mixed-requires": 0, + "space-infix-ops": 0 + } +} diff --git a/deps/npm/node_modules/node-gyp/addon.gypi b/deps/npm/node_modules/node-gyp/addon.gypi index 63fefe3d16..0b81fab202 100644 --- a/deps/npm/node_modules/node-gyp/addon.gypi +++ b/deps/npm/node_modules/node-gyp/addon.gypi @@ -42,7 +42,7 @@ '-luuid.lib', '-lodbc32.lib', '-lDelayImp.lib', - '-l"<(node_root_dir)/$(ConfigurationName)/iojs.lib"' + '-l"<(node_root_dir)/$(ConfigurationName)/node.lib"' ], # warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent' # needs to have dll-interface to be used by clients of class 'node::ObjectWrap' diff --git a/deps/npm/node_modules/node-gyp/lib/build.js b/deps/npm/node_modules/node-gyp/lib/build.js index 3d3c58785f..f3605902e9 100644 --- a/deps/npm/node_modules/node-gyp/lib/build.js +++ b/deps/npm/node_modules/node-gyp/lib/build.js @@ -173,7 +173,7 @@ function build (gyp, argv, callback) { } /** - * Copies the iojs.lib file for the current target architecture into the + * Copies the node.lib file for the current target architecture into the * current proper dev dir location. */ @@ -181,15 +181,15 @@ function build (gyp, argv, callback) { if (!win || !copyDevLib) return doBuild() var buildDir = path.resolve(nodeDir, buildType) - , archNodeLibPath = path.resolve(nodeDir, arch, 'iojs.lib') - , buildNodeLibPath = path.resolve(buildDir, 'iojs.lib') + , archNodeLibPath = path.resolve(nodeDir, arch, 'node.lib') + , buildNodeLibPath = path.resolve(buildDir, 'node.lib') mkdirp(buildDir, function (err, isNew) { if (err) return callback(err) log.verbose('"' + buildType + '" dir needed to be created?', isNew) var rs = fs.createReadStream(archNodeLibPath) , ws = fs.createWriteStream(buildNodeLibPath) - log.verbose('copying "iojs.lib" for ' + arch, buildNodeLibPath) + log.verbose('copying "node.lib" for ' + arch, buildNodeLibPath) rs.pipe(ws) rs.on('error', callback) ws.on('error', callback) diff --git a/deps/npm/node_modules/node-gyp/lib/install.js b/deps/npm/node_modules/node-gyp/lib/install.js index f9176b3ab0..6f72e6a93d 100644 --- a/deps/npm/node_modules/node-gyp/lib/install.js +++ b/deps/npm/node_modules/node-gyp/lib/install.js @@ -39,7 +39,7 @@ function install (gyp, argv, callback) { } } - var distUrl = gyp.opts['dist-url'] || gyp.opts.disturl || 'https://iojs.org/dist' + var distUrl = gyp.opts['dist-url'] || gyp.opts.disturl || 'http://nodejs.org/dist' // Determine which node dev files version we are installing @@ -185,7 +185,7 @@ function install (gyp, argv, callback) { // now download the node tarball var tarPath = gyp.opts['tarball'] - var tarballUrl = tarPath ? tarPath : distUrl + '/v' + version + '/iojs-v' + version + '.tar.gz' + var tarballUrl = tarPath ? tarPath : distUrl + '/v' + version + '/node-v' + version + '.tar.gz' , badDownload = false , extractCount = 0 , gunzip = zlib.createGunzip() @@ -267,7 +267,7 @@ function install (gyp, argv, callback) { var async = 0 if (win) { - // need to download iojs.lib + // need to download node.lib async++ downloadNodeLib(deref) } @@ -343,36 +343,36 @@ function install (gyp, argv, callback) { } function downloadNodeLib (done) { - log.verbose('on Windows; need to download `iojs.lib`...') + log.verbose('on Windows; need to download `node.lib`...') var dir32 = path.resolve(devDir, 'ia32') , dir64 = path.resolve(devDir, 'x64') - , nodeLibPath32 = path.resolve(dir32, 'iojs.lib') - , nodeLibPath64 = path.resolve(dir64, 'iojs.lib') - , nodeLibUrl32 = distUrl + '/v' + version + '/win-x86/iojs.lib' - , nodeLibUrl64 = distUrl + '/v' + version + '/win-x64/iojs.lib' + , nodeLibPath32 = path.resolve(dir32, 'node.lib') + , nodeLibPath64 = path.resolve(dir64, 'node.lib') + , nodeLibUrl32 = distUrl + '/v' + version + '/node.lib' + , nodeLibUrl64 = distUrl + '/v' + version + '/x64/node.lib' - log.verbose('32-bit iojs.lib dir', dir32) - log.verbose('64-bit iojs.lib dir', dir64) - log.verbose('`iojs.lib` 32-bit url', nodeLibUrl32) - log.verbose('`iojs.lib` 64-bit url', nodeLibUrl64) + log.verbose('32-bit node.lib dir', dir32) + log.verbose('64-bit node.lib dir', dir64) + log.verbose('`node.lib` 32-bit url', nodeLibUrl32) + log.verbose('`node.lib` 64-bit url', nodeLibUrl64) var async = 2 mkdir(dir32, function (err) { if (err) return done(err) - log.verbose('streaming 32-bit iojs.lib to:', nodeLibPath32) + log.verbose('streaming 32-bit node.lib to:', nodeLibPath32) var req = download(nodeLibUrl32) if (!req) return req.on('error', done) req.on('response', function (res) { if (res.statusCode !== 200) { - done(new Error(res.statusCode + ' status code downloading 32-bit iojs.lib')) + done(new Error(res.statusCode + ' status code downloading 32-bit node.lib')) return } getContentSha(res, function (_, checksum) { - contentShasums['win-x86/iojs.lib'] = checksum - log.verbose('content checksum', 'win-x86/iojs.lib', checksum) + contentShasums['node.lib'] = checksum + log.verbose('content checksum', 'node.lib', checksum) }) var ws = fs.createWriteStream(nodeLibPath32) @@ -385,20 +385,20 @@ function install (gyp, argv, callback) { }) mkdir(dir64, function (err) { if (err) return done(err) - log.verbose('streaming 64-bit iojs.lib to:', nodeLibPath64) + log.verbose('streaming 64-bit node.lib to:', nodeLibPath64) var req = download(nodeLibUrl64) if (!req) return req.on('error', done) req.on('response', function (res) { if (res.statusCode !== 200) { - done(new Error(res.statusCode + ' status code downloading 64-bit iojs.lib')) + done(new Error(res.statusCode + ' status code downloading 64-bit node.lib')) return } getContentSha(res, function (_, checksum) { - contentShasums['win-x64/iojs.lib'] = checksum - log.verbose('content checksum', 'win-x64/iojs.lib', checksum) + contentShasums['x64/node.lib'] = checksum + log.verbose('content checksum', 'x64/node.lib', checksum) }) var ws = fs.createWriteStream(nodeLibPath64) diff --git a/deps/npm/node_modules/normalize-git-url/.eslintrc b/deps/npm/node_modules/normalize-git-url/.eslintrc new file mode 100644 index 0000000000..b54e30fd2a --- /dev/null +++ b/deps/npm/node_modules/normalize-git-url/.eslintrc @@ -0,0 +1,19 @@ +{ + "env" : { + "node" : true + }, + "rules" : { + "semi": [2, "never"], + "strict": 0, + "quotes": [1, "double", "avoid-escape"], + "no-use-before-define": 0, + "curly": 0, + "no-underscore-dangle": 0, + "no-lonely-if": 1, + "no-unused-vars": [2, {"vars" : "all", "args" : "after-used"}], + "no-mixed-requires": 0, + "space-infix-ops": 0, + "key-spacing": 0, + "no-multi-spaces": 0 + } +} diff --git a/deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/.eslintrc b/deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/.eslintrc new file mode 100644 index 0000000000..ba33150421 --- /dev/null +++ b/deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/.eslintrc @@ -0,0 +1,17 @@ +{ + "env" : { + "node" : true + }, + "rules" : { + "semi": [2, "never"], + "strict": 0, + "quotes": [1, "double", "avoid-escape"], + "no-use-before-define": 0, + "curly": 0, + "no-underscore-dangle": 0, + "no-lonely-if": 1, + "no-unused-vars": [2, {"vars" : "all", "args" : "after-used"}], + "no-mixed-requires": 0, + "space-infix-ops": 0 + } +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.editorconfig b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.editorconfig new file mode 100644 index 0000000000..fb7f73a832 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.editorconfig @@ -0,0 +1,14 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.js, **/*.js] +indent_size = 4 +indent_style = space + +[{package.json,.travis.yml}] +indent_size = 2 +indent_style = space diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.npmignore b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.npmignore new file mode 100644 index 0000000000..59d842baa8 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.npmignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Users Environment Variables +.lock-wscript diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/LICENSE b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/LICENSE new file mode 100644 index 0000000000..c3d2eb3550 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Sam Mikes + +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/read-package-json/node_modules/json-parse-helpfulerror/README.md b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/README.md new file mode 100644 index 0000000000..ffad93584b --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/README.md @@ -0,0 +1,29 @@ +# json-parse-helpfulerror + +A drop-in replacement for `JSON.parse` that uses + to provide more useful error messages in the +event of a parse error. + +# Example + +## Installation + +``` +npm i -S json-parse-helpfulerror +``` + +## Use + +```js +var jph = require('json-parse-helpfulerror'); + +var notJSON = "{'foo': 3}"; // keys must be double-quoted in JSON + +JSON.parse(notJSON); // throws unhelpful error + +jph.parse("{'foo': 3}") // throws more helpful error: "Unexpected token '\''..." +``` + +# License + +MIT \ No newline at end of file diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/index.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/index.js new file mode 100644 index 0000000000..15648b017b --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/index.js @@ -0,0 +1,21 @@ +'use strict'; + +var jju = require('jju'); + +function parse(text, reviver) { + try { + return JSON.parse(text, reviver); + } catch (err) { + // we expect this to throw with a more informative message + jju.parse(text, { + mode: 'json', + reviver: reviver + }); + + // backup if jju is not as strict as JSON.parse; re-throw error + // data-dependent code path, I do not know how to cover it + throw err; + } +} + +exports.parse = parse; diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.editorconfig b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.editorconfig new file mode 100644 index 0000000000..8de2a35e3a --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true + +[{.,}*.{js,json,json5,yml,yaml}] +indent_style = space +indent_size = 2 + +[*.md] +indent_style = space +indent_size = 4 +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.npmignore b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.npmignore new file mode 100644 index 0000000000..b561496c91 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.npmignore @@ -0,0 +1,6 @@ +package.json +node_modules +test/external +examples +/.eslint* +/.travis.yml diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/README.md b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/README.md new file mode 100644 index 0000000000..3d61083fb0 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/README.md @@ -0,0 +1,242 @@ +`jju` - a set of utilities to work with JSON / JSON5 documents + +[![npm version badge](https://img.shields.io/npm/v/jju.svg)](https://www.npmjs.org/package/jju) +[![travis badge](http://img.shields.io/travis/rlidwka/jju.svg)](https://travis-ci.org/rlidwka/jju) +[![downloads badge](http://img.shields.io/npm/dm/jju.svg)](https://www.npmjs.org/package/jju) + +## Installation + +``` +npm install jju +``` + +## Usage + +This module provides following functions: + +1. [jju.parse()](#jjuparse-function) parses json/json5 text and returns a javascript value it corresponds to +2. [jju.stringify()](#jjustringify-function) converts javascript value to an appropriate json/json5 text +3. [jju.tokenize()](#jjutokenize-function) parses json/json5 text and returns an array of tokens it consists of ([see demo](http://rlidwka.github.io/jju/tokenizer.html)) +4. [jju.analyze()](#jjuanalyze-function) parses json/json5 text and tries to guess indentation, quoting style, etc. +5. [jju.update()](#jjuupdate-function) changes json/json5 text, preserving original formatting as much as possible ([see demo](http://rlidwka.github.io/jju/editor.html)) + +All functions are able to work with a standard JSON documents. `jju.parse()` and `jju.stringify()` are better in some cases, but slower than native `JSON.parse()` and `JSON.stringify()` versions. Detailed description see below. + +### jju.parse() function + +```javascript +/* + * Main syntax: + * + * `text` - text to parse, type: String + * `options` - parser options, type: Object + */ +jju.parse(text[, options]) + +// compatibility syntax +jju.parse(text[, reviver]) +``` + +Options: + + - reserved\_keys - what to do with reserved keys (String, default="ignore") + - "ignore" - ignore reserved keys + - "throw" - throw SyntaxError in case of reserved keys + - "replace" - replace reserved keys, this is the default JSON.parse behaviour, unsafe + + Reserved keys are keys that exist in an empty object (`hasOwnProperty`, `__proto__`, etc.). + +```javascript +// 'ignore' will cause reserved keys to be ignored: +parse('{hasOwnProperty: 1}', {reserved_keys: 'ignore'}) == {} +parse('{hasOwnProperty: 1, x: 2}', {reserved_keys: 'ignore'}).hasOwnProperty('x') == true + +// 'throw' will cause SyntaxError in these cases: +parse('{hasOwnProperty: 1}', {reserved_keys: 'throw'}) == SyntaxError + +// 'replace' will replace reserved keys with new ones: +parse('{hasOwnProperty: 1}', {reserved_keys: 'throw'}) == {hasOwnProperty: 1} +parse('{hasOwnProperty: 1, x: 2}', {reserved_keys: 'ignore'}).hasOwnProperty('x') == TypeError +``` + + + - null\_prototype - create object as Object.create(null) instead of '{}' (Boolean) + + if `reserved_keys != 'replace'`, default is **false** + + if `reserved_keys == 'replace'`, default is **true** + + It is usually unsafe and not recommended to change this option to false in the last case. + + - reviver - reviver function - Function + + This function should follow JSON specification + + - mode - operation mode, set it to 'json' if you want to throw on non-strict json files (String) + +### jju.stringify() function + +```javascript +/* + * Main syntax: + * + * `value` - value to serialize, type: * + * `options` - serializer options, type: Object + */ +jju.stringify(value[, options]) + +// compatibility syntax +jju.stringify(value[, replacer [, indent]) +``` + +Options: + + - ascii - output ascii only (Boolean, default=false) + If this option is enabled, output will not have any characters except of 0x20-0x7f. + + - indent - indentation (String, Number or Boolean, default='\t') + This option follows JSON specification. + + - quote - enquoting char (String, "'" or '"', default="'") + - quote\_keys - whether keys quoting in objects is required or not (String, default=false) + If you want `{"q": 1}` instead of `{q: 1}`, set it to true. + + - sort\_keys - sort all keys while stringifying (Boolean or Function, default=false) + By default sort order will depend on implementation, with v8 it's insertion order. If set to `true`, all keys (but not arrays) will be sorted alphabetically. You can provide your own sorting function as well. + + - replacer - replacer function or array (Function or Array) + This option follows JSON specification. + + - no\_trailing\_comma = don't output trailing comma (Boolean, default=false) + If this option is set, arrays like this `[1,2,3,]` will never be generated. Otherwise they may be generated for pretty printing. + + - mode - operation mode, set it to 'json' if you want correct json in the output (String) + + Currently it's either 'json' or something else. If it is 'json', following options are implied: + + - options.quote = '"' + - options.no\_trailing\_comma = true + - options.quote\_keys = true + - '\x' literals are not used + +### jju.tokenize() function + +```javascript +/* + * Main syntax: + * + * `text` - text to tokenize, type: String + * `options` - parser options, type: Object + */ +jju.tokenize(text[, options]) +``` + +Options are the same as for the `jju.parse` function. + +Return value is an array of tokens, where each token is an object: + + - raw (String) - raw text of this token, if you join all raw's, you will get the original document + - type (String) - type of the token, can be `whitespace`, `comment`, `key`, `literal`, `separator` or `newline` + - stack (Array) - path to the current token in the syntax tree + - value - value of the token if token is a `key` or `literal` + +You can check tokenizer for yourself using [this demo](http://rlidwka.github.io/jju/tokenizer.html). + +### jju.analyze() function + +```javascript +/* + * Main syntax: + * + * `text` - text to analyze, type: String + * `options` - parser options, type: Object + */ +jju.analyze(text[, options]) +``` + +Options are the same as for the `jju.parse` function. + +Return value is an object defining a programming style in which the document was written. + + - indent (String) - preferred indentation + - newline (String) - preferred newline + - quote (String) - `"` or `'` depending on which quote is preferred + - quote\_keys (Boolean) - `true` if unquoted keys were used at least once + - has\_whitespace (Boolean) - `true` if input has a whitespace token + - has\_comments (Boolean) - `true` if input has a comment token + - has\_newlines (Boolean) - `true` if input has a newline token + - has\_trailing\_comma (Boolean) - `true` if input has at least one trailing comma + +### jju.update() function + +```javascript +/* + * Main syntax: + * + * `text` - original text, type: String + * `new_value` - new value you want to set + * `options` - parser or stringifier options, type: Object + */ +jju.update(text, new_value[, options]) +``` + +If you want to update a JSON document, here is the general approach: + +```javascript +// here is your original JSON document: +var input = '{"foo": "bar", "baz": 123}' + +// you need to parse it first: +var json = jju.parse(input, {mode: 'json'}) +// json is { foo: 'bar', baz: 123 } + +// then you can change it as you like: +json.foo = 'quux' +json.hello = 'world' + +// then you run an update function to change the original json: +var output = jju.update(input, json, {mode: 'json'}) +// output is '{"foo": "quux", "baz": 123, "hello": "world"}' +``` + +Look at [this demo](http://rlidwka.github.io/jju/editor.html) to test various types of json. + +## Advantages over existing JSON libraries + +In a few cases it makes sense to use this module instead of built-in JSON methods. + +Parser: + - better error reporting with source code and line numbers + +In case of syntax error, JSON.parse does not return any good information to the user. This module does: + +``` +$ node -e 'require("jju").parse("[1,1,1,1,invalid]")' + +SyntaxError: Unexpected token 'i' at 0:9 +[1,1,1,1,invalid] + ^ +``` + +This module is about 5 times slower, so if user experience matters to you more than performance, use this module. If you're working with a lot of machine-generated data, use JSON.parse instead. + +Stringifier: + - util.inspect-like pretty printing + +This module behaves more smart when dealing with object and arrays, and does not always print newlines in them: + +``` +$ node -e 'console.log(require("./").stringify([[,,,],,,[,,,,]], {mode:"json"}))' +[ + [null, null, null], + null, + null, + [null, null, null, null] +] +``` + +JSON.stringify will split this into 15 lines, and it's hard to read. + +Yet again, this feature comes with a performance hit, so if user experience matters to you more than performance, use this module. If your JSON will be consumed by machines, use JSON.stringify instead. + +As a rule of thumb, if you use "space" argument to indent your JSON, you'd better use this module instead. diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/benchmark.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/benchmark.js new file mode 100755 index 0000000000..28a6aad75a --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/benchmark.js @@ -0,0 +1,40 @@ +#!/usr/bin/env node + +var Benchmark = require('benchmark') +var YAML = require('js-yaml') +var JJU = require('../') +var JSON5 = require('json5') +var suite = new Benchmark.Suite + +var sample +sample = require('fs').readFileSync(__dirname + '/../package.yaml') +sample = YAML.safeLoad(sample) +sample = JSON.stringify(sample) + +var functions = { + 'JSON': function(x) { JSON.parse(x) }, + 'JSON5': function(x) { JSON5.parse(x) }, + 'JJU': function(x) { JJU.parse(x) }, + 'JS-YAML': function(x) { YAML.safeLoad(x) }, +} + +for (var name in functions) { + with ({ fn: functions[name] }) { + suite.add(name, { + onCycle: function onCycle(event) { + process.stdout.write('\r\033[2K - ' + event.target) + }, + fn: function () { + fn(sample) + }, + }) + } +} + +console.log() +suite.on('cycle', function(event) { + console.log('\r\033[2K + ' + String(event.target)) +}) +.run() + +process.on('exit', function() { console.log() }) diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/package.json b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/package.json new file mode 100644 index 0000000000..7f0dcf08b7 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/package.json @@ -0,0 +1,9 @@ +{ + "name": "benchmarks", + "private": true, + "dependencies": { + "json5": "*", + "js-yaml": "*", + "benchmark": "*" + } +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/Grammar.md b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/Grammar.md new file mode 100644 index 0000000000..61ae49b380 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/Grammar.md @@ -0,0 +1,219 @@ + +JSON5 grammar expressed in EBNF form. + +PS: I don't know what is appropriate syntax highlighter for this, so I'm using "modula2" because why not. I also inserted after backslash to preserve syntax highlighting, this character has nothing to do with actual JSON5 syntax and should be ignored. + +```modula2 +json5_text = expression_with_whitespace + +expression_with_whitespace = [white_space] , expression , [white_space] + +expression = literal + | array_literal + | object_literal + +literal = null_literal + | boolean_literal + | signed_numeric_literal + | string_literal + +null_literal = 'null' + +boolean_literal = 'true' + | 'false' + +(* Source Characters *) + +source_character = . + (* any Unicode code unit *) + +line_terminator = + | + | + | + +line_terminator_sequence = + | + | + | + | , + +white_space = white_space_element + | white_space , white_space_element + +white_space_element = white_space_character + | comment + +white_space_character = + | + | + | + | + | + | + +comment = multi_line_comment + | single_line_comment + +multi_line_comment = '/*' , [multi_line_comment_chars] , '*/' + +multi_line_comment_chars = (source_character - '*') , [multi_line_comment_chars] + | '*' , [post_asterisk_comment_chars] + +post_asterisk_comment_chars = (source_character - ('*' | '/')) , [multi_line_comment_chars] + | '*' , [post_asterisk_comment_chars] + +single_line_comment = '//' , [single_line_comment_chars] + +single_line_comment_chars = single_line_comment_char , single_line_comment_chars + +single_line_comment_char = source_character - line_terminator + +(* Character classes *) + +decimal_digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' + +non_zero_digit = decimal_digit - '0' + +hex_digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' + | 'b' | 'c' | 'd' | 'e' | 'f' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' + +ascii_letter = ascii_letter_lowercase + | ascii_letter_uppercase + +ascii_letter_lowercase = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' + | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' + | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' + +ascii_letter_uppercase = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' + | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' + | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' + +(* Numeric Literals *) + +signed_numeric_literal = '-' , numeric_literal + | '+' , numeric_literal + | numeric_literal + +numeric_literal = decimal_literal + | hex_integer_literal + | non_finite_literal + +non_finite_literal = 'Infinity' + | 'NaN' + +decimal_literal = decimal_integer_literal , '.' , [decimal_digits] , [exponent_part] + | '.' , decimal_digits , [exponent_part] + | decimal_integer_literal , [exponent_part] + +decimal_integer_literal = '0' + | non_zero_digit , [decimal_digits] + +decimal_digits = decimal_digit + | decimal_digits , decimal_digit + +exponent_part = exponent_indicator , signed_integer + +exponent_indicator = 'e' | 'E' + +signed_integer = decimal_digits + | '+' , decimal_digits + | '-' , decimal_digits + +hex_integer_literal = '0x' , hex_digit + | '0X' , hex_digit + | hex_integer_literal , hex_digit + +(* String Literals *) + +string_literal = '"' , [double_string_characters] , '"' + | "'" , [single_string_characters] , "'" + +double_string_characters = double_string_character , [double_string_characters] + +single_string_characters = single_string_character , [single_string_characters] + +double_string_character = source_character - ('"' | '\​' | line_terminator) + | '\​' , escape_sequence + | line_continuation + +single_string_character = source_character - ("'" | '\​' | line_terminator) + | '\​' , escape_sequence + | line_continuation + +line_continuation = '\​' , line_terminator_sequence + +escape_sequence = character_escape_sequence + | '0' + | hex_escape_sequence + | unicode_escape_sequence + +character_escape_sequence = single_escape_character + | non_escape_character + +single_escape_character = '"' | "'" | '\​' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' + +non_escape_character = source_character - (escape_character | line_terminator) + +escape_character = single_escape_character + | decimal_digit + | 'x' + | 'u' + +hex_escape_sequence = 'x' , hex_digit , hex_digit + +unicode_escape_sequence = 'u' , hex_digit , hex_digit , hex_digit , hex_digit + +(* Array Literals *) + +array_literal = '[' , [white_space] , ']' + | '[' , [white_space] , element_list , ']' + | '[' , [white_space] , element_list , ',' , [white_space] , ']' + +element_list = expression , [white_space] + | element_list , ',' , [white_space] , expression , [white_space] + +(* Object Literals *) + +object_literal = '{' , [white_space] , '}' + | '{' , [white_space] , property_name_and_value_list , '}' + | '{' , [white_space] , property_name_and_value_list , ',' , '}' + +property_name_and_value_list = property_assignment , [white_space] + | property_name_and_value_list , [white_space] , ',' , [white_space] , property_assignment , [white_space] + +property_assignment = property_name , [white_space] , ':' , [white_space] , expression + +property_name = identifier_name + | string_literal + | numeric_literal + +identifier_name = identifier_start + | identifier_name , identifier_part + +identifier_start = unicode_letter + | '$' + | '_' + | '\​' , unicode_escape_sequence + +identifier_part = identifier_start + | unicode_combining_mark + | unicode_digit + | unicode_connector_punctuation + | + | + +unicode_letter = ascii_letter + (* + any character in the Unicode categories "Uppercase letter (Lu)", "Lowercase letter (Ll)", "Titlecase letter (Lt)", "Modifier letter (Lm)", "Other letter (Lo)", or "Letter number (Nl)" *) + +unicode_combining_mark = + (* + any character in the Unicode categories "Non-spacing mark (Mn)" or "Combining spacing mark (Mc)" *) + +unicode_digit = decimal_digit + (* + any character in the Unicode category "Decimal number (Nd)" *) + +unicode_connector_punctuation = + (* + any character in the Unicode category "Connector punctuation (Pc)" *) + + +``` diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/JSON5.md b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/JSON5.md new file mode 100644 index 0000000000..bbe18a3d8c --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/JSON5.md @@ -0,0 +1,50 @@ +## JSON5 syntax + +We support slighly modified version of JSON5, see https://groups.google.com/forum/#!topic/json5/3DjClVYI6Wg + +I started from ES5 specification and added a set of additional restrictions on top of ES5 spec. So I'd expect my implementation to be much closer to javascript. It's no longer an extension of json, but a reduction of ecmascript, which was my original intent. + +This JSON5 version is a subset of ES5 language, specification is here: + +http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf + +This is a language that defines data structures only, so following notes/restrictions are applied: + +- Literals (NullLiteral, BooleanLiteral, NumericLiteral, StringLiteral) are allowed. +- Compatibility syntax is not supported, which means octal literals are forbidden. +- ArrayLiterals and allowed, but instead of AssignmentExpressions you can only use other allowed Literals, ArrayLiterals and ObjectLiterals. Elisions are currently not supported. +- ObjectLiterals and allowed, but instead of AssignmentExpressions you can only use other allowed Literals, ArrayLiterals and ObjectLiterals. Setters and getters are forbidden. +- All other primary expressions ("this", Identifier, Expression) are forbidden. +- Two unary expressions ('-' and '+') allowed before NumericLiterals. +- Any data that has a number type can be represented, including +0, -0, +Infinity, -Infinity and NaN. +- "undefined" is forbidden, use null instead if applicable. +- Comments and whitespace are defined according to spec. + +Main authority here is ES5 spec, so strict backward JSON compatibility is not guaranteed. + + +If you're unsure whether a behaviour of this library is a bug or not, you can run this test: + +```javascript +JSON5.parse(String(something)) +``` + +Should always be equal to: + +```javascript +eval('(function(){return ('+String(something)+'\n)\n})()') +``` + +If `something` meets all rules above. Parens and newlines in the example above are carefully placed so comments and another newlines will work properly, so don't look so impressed about that. + + +## Weirdness of JSON5 + +These are the parts that I don't particulary like, but see no good way to fix: + + - no elisions, `[,,,] -> [null,null,null]` + - `[Object], [Circular]` aren't parsed + - no way of nicely representing multiline strings + - unicode property names are way to hard to implement + - Date and other custom objects + - incompatible with YAML (at least comments) diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/index.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/index.js new file mode 100644 index 0000000000..50f1624963 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/index.js @@ -0,0 +1,32 @@ + +module.exports.__defineGetter__('parse', function() { + return require('./lib/parse').parse +}) + +module.exports.__defineGetter__('stringify', function() { + return require('./lib/stringify').stringify +}) + +module.exports.__defineGetter__('tokenize', function() { + return require('./lib/parse').tokenize +}) + +module.exports.__defineGetter__('update', function() { + return require('./lib/document').update +}) + +module.exports.__defineGetter__('analyze', function() { + return require('./lib/analyze').analyze +}) + +module.exports.__defineGetter__('utils', function() { + return require('./lib/utils') +}) + +/**package +{ "name": "jju", + "version": "0.0.0", + "dependencies": {"js-yaml": "*"}, + "scripts": {"postinstall": "js-yaml package.yaml > package.json ; npm install"} +} +**/ diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/analyze.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/analyze.js new file mode 100644 index 0000000000..39303b0969 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/analyze.js @@ -0,0 +1,91 @@ +/* + * Author: Alex Kocharin + * GIT: https://github.com/rlidwka/jju + * License: WTFPL, grab your copy here: http://www.wtfpl.net/txt/copying/ + */ + +var tokenize = require('./parse').tokenize + +module.exports.analyze = function analyzeJSON(input, options) { + if (options == null) options = {} + + if (!Array.isArray(input)) { + input = tokenize(input, options) + } + + var result = { + has_whitespace: false, + has_comments: false, + has_newlines: false, + has_trailing_comma: false, + indent: '', + newline: '\n', + quote: '"', + quote_keys: true, + } + + var stats = { + indent: {}, + newline: {}, + quote: {}, + } + + for (var i=0; i stats[k][b] ? a : b + }) + } + } + + return result +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/document.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/document.js new file mode 100644 index 0000000000..af1a01a03d --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/document.js @@ -0,0 +1,484 @@ +/* + * Author: Alex Kocharin + * GIT: https://github.com/rlidwka/jju + * License: WTFPL, grab your copy here: http://www.wtfpl.net/txt/copying/ + */ + +var assert = require('assert') +var tokenize = require('./parse').tokenize +var stringify = require('./stringify').stringify +var analyze = require('./analyze').analyze + +function isObject(x) { + return typeof(x) === 'object' && x !== null +} + +function value_to_tokenlist(value, stack, options, is_key, indent) { + options = Object.create(options) + options._stringify_key = !!is_key + + if (indent) { + options._prefix = indent.prefix.map(function(x) { + return x.raw + }).join('') + } + + if (options._splitMin == null) options._splitMin = 0 + if (options._splitMax == null) options._splitMax = 0 + + var stringified = stringify(value, options) + + if (is_key) { + return [ { raw: stringified, type: 'key', stack: stack, value: value } ] + } + + options._addstack = stack + var result = tokenize(stringified, { + _addstack: stack, + }) + result.data = null + return result +} + +// '1.2.3' -> ['1','2','3'] +function arg_to_path(path) { + // array indexes + if (typeof(path) === 'number') path = String(path) + + if (path === '') path = [] + if (typeof(path) === 'string') path = path.split('.') + + if (!Array.isArray(path)) throw Error('Invalid path type, string or array expected') + return path +} + +// returns new [begin, end] or false if not found +// +// {x:3, xxx: 111, y: [111, {q: 1, e: 2} ,333] } +// f('y',0) returns this B^^^^^^^^^^^^^^^^^^^^^^^^E +// then f('1',1) would reduce it to B^^^^^^^^^^E +function find_element_in_tokenlist(element, lvl, tokens, begin, end) { + while(tokens[begin].stack[lvl] != element) { + if (begin++ >= end) return false + } + while(tokens[end].stack[lvl] != element) { + if (end-- < begin) return false + } + return [begin, end] +} + +function is_whitespace(token_type) { + return token_type === 'whitespace' + || token_type === 'newline' + || token_type === 'comment' +} + +function find_first_non_ws_token(tokens, begin, end) { + while(is_whitespace(tokens[begin].type)) { + if (begin++ >= end) return false + } + return begin +} + +function find_last_non_ws_token(tokens, begin, end) { + while(is_whitespace(tokens[end].type)) { + if (end-- < begin) return false + } + return end +} + +/* + * when appending a new element of an object/array, we are trying to + * figure out the style used on the previous element + * + * return {prefix, sep1, sep2, suffix} + * + * ' "key" : "element" \r\n' + * prefix^^^^ sep1^ ^^sep2 ^^^^^^^^suffix + * + * begin - the beginning of the object/array + * end - last token of the last element (value or comma usually) + */ +function detect_indent_style(tokens, is_array, begin, end, level) { + var result = { + sep1: [], + sep2: [], + suffix: [], + prefix: [], + newline: [], + } + + if (tokens[end].type === 'separator' && tokens[end].stack.length !== level+1 && tokens[end].raw !== ',') { + // either a beginning of the array (no last element) or other weird situation + // + // just return defaults + return result + } + + // ' "key" : "value" ,' + // skipping last separator, we're now here ^^ + if (tokens[end].type === 'separator') + end = find_last_non_ws_token(tokens, begin, end - 1) + if (end === false) return result + + // ' "key" : "value" ,' + // skipping value ^^^^^^^ + while(tokens[end].stack.length > level) end-- + + if (!is_array) { + while(is_whitespace(tokens[end].type)) { + if (end < begin) return result + if (tokens[end].type === 'whitespace') { + result.sep2.unshift(tokens[end]) + } else { + // newline, comment or other unrecognized codestyle + return result + } + end-- + } + + // ' "key" : "value" ,' + // skipping separator ^ + assert.equal(tokens[end].type, 'separator') + assert.equal(tokens[end].raw, ':') + while(is_whitespace(tokens[--end].type)) { + if (end < begin) return result + if (tokens[end].type === 'whitespace') { + result.sep1.unshift(tokens[end]) + } else { + // newline, comment or other unrecognized codestyle + return result + } + } + + assert.equal(tokens[end].type, 'key') + end-- + } + + // ' "key" : "value" ,' + // skipping key ^^^^^ + while(is_whitespace(tokens[end].type)) { + if (end < begin) return result + if (tokens[end].type === 'whitespace') { + result.prefix.unshift(tokens[end]) + } else if (tokens[end].type === 'newline') { + result.newline.unshift(tokens[end]) + return result + } else { + // comment or other unrecognized codestyle + return result + } + end-- + } + + return result +} + +function Document(text, options) { + var self = Object.create(Document.prototype) + + if (options == null) options = {} + //options._structure = true + var tokens = self._tokens = tokenize(text, options) + self._data = tokens.data + tokens.data = null + self._options = options + + var stats = analyze(text, options) + if (options.indent == null) { + options.indent = stats.indent + } + if (options.quote == null) { + options.quote = stats.quote + } + if (options.quote_keys == null) { + options.quote_keys = stats.quote_keys + } + if (options.no_trailing_comma == null) { + options.no_trailing_comma = !stats.has_trailing_comma + } + return self +} + +// return true if it's a proper object +// throw otherwise +function check_if_can_be_placed(key, object, is_unset) { + //if (object == null) return false + function error(add) { + return Error("You can't " + (is_unset ? 'unset' : 'set') + " key '" + key + "'" + add) + } + + if (!isObject(object)) { + throw error(' of an non-object') + } + if (Array.isArray(object)) { + // array, check boundary + if (String(key).match(/^\d+$/)) { + key = Number(String(key)) + if (object.length < key || (is_unset && object.length === key)) { + throw error(', out of bounds') + } else if (is_unset && object.length !== key+1) { + throw error(' in the middle of an array') + } else { + return true + } + } else { + throw error(' of an array') + } + } else { + // object + return true + } +} + +// usage: document.set('path.to.something', 'value') +// or: document.set(['path','to','something'], 'value') +Document.prototype.set = function(path, value) { + path = arg_to_path(path) + + // updating this._data and check for errors + if (path.length === 0) { + if (value === undefined) throw Error("can't remove root document") + this._data = value + var new_key = false + + } else { + var data = this._data + + for (var i=0; i {x:1}` + // removing sep, literal and optional sep + // ':' + var pos2 = find_last_non_ws_token(this._tokens, pos_old[0], position[0] - 1) + assert.equal(this._tokens[pos2].type, 'separator') + assert.equal(this._tokens[pos2].raw, ':') + position[0] = pos2 + + // key + var pos2 = find_last_non_ws_token(this._tokens, pos_old[0], position[0] - 1) + assert.equal(this._tokens[pos2].type, 'key') + assert.equal(this._tokens[pos2].value, path[path.length-1]) + position[0] = pos2 + } + + // removing comma in arrays and objects + var pos2 = find_last_non_ws_token(this._tokens, pos_old[0], position[0] - 1) + assert.equal(this._tokens[pos2].type, 'separator') + if (this._tokens[pos2].raw === ',') { + position[0] = pos2 + } else { + // beginning of the array/object, so we should remove trailing comma instead + pos2 = find_first_non_ws_token(this._tokens, position[1] + 1, pos_old[1]) + assert.equal(this._tokens[pos2].type, 'separator') + if (this._tokens[pos2].raw === ',') { + position[1] = pos2 + } + } + + } else { + var indent = pos2 !== false + ? detect_indent_style(this._tokens, Array.isArray(data), pos_old[0], position[1] - 1, i) + : {} + var newtokens = value_to_tokenlist(value, path, this._options, false, indent) + } + + } else { + // insert new key, that's tricky + var path_1 = path.slice(0, i) + + // find a last separator after which we're inserting it + var pos2 = find_last_non_ws_token(this._tokens, position[0] + 1, position[1] - 1) + assert(pos2 !== false) + + var indent = pos2 !== false + ? detect_indent_style(this._tokens, Array.isArray(data), position[0] + 1, pos2, i) + : {} + + var newtokens = value_to_tokenlist(value, path, this._options, false, indent) + + // adding leading whitespaces according to detected codestyle + var prefix = [] + if (indent.newline && indent.newline.length) + prefix = prefix.concat(indent.newline) + if (indent.prefix && indent.prefix.length) + prefix = prefix.concat(indent.prefix) + + // adding '"key":' (as in "key":"value") to object values + if (!Array.isArray(data)) { + prefix = prefix.concat(value_to_tokenlist(path[path.length-1], path_1, this._options, true)) + if (indent.sep1 && indent.sep1.length) + prefix = prefix.concat(indent.sep1) + prefix.push({raw: ':', type: 'separator', stack: path_1}) + if (indent.sep2 && indent.sep2.length) + prefix = prefix.concat(indent.sep2) + } + + newtokens.unshift.apply(newtokens, prefix) + + // check if prev token is a separator AND they're at the same level + if (this._tokens[pos2].type === 'separator' && this._tokens[pos2].stack.length === path.length-1) { + // previous token is either , or [ or { + if (this._tokens[pos2].raw === ',') { + // restore ending comma + newtokens.push({raw: ',', type: 'separator', stack: path_1}) + } + } else { + // previous token isn't a separator, so need to insert one + newtokens.unshift({raw: ',', type: 'separator', stack: path_1}) + } + + if (indent.suffix && indent.suffix.length) + newtokens.push.apply(newtokens, indent.suffix) + + assert.equal(this._tokens[position[1]].type, 'separator') + position[0] = pos2+1 + position[1] = pos2 + } + + newtokens.unshift(position[1] - position[0] + 1) + newtokens.unshift(position[0]) + this._tokens.splice.apply(this._tokens, newtokens) + + return this +} + +// convenience method +Document.prototype.unset = function(path) { + return this.set(path, undefined) +} + +Document.prototype.get = function(path) { + path = arg_to_path(path) + + var data = this._data + for (var i=0; i old_data.length) { + // adding new elements, so going forward + for (var i=0; i=0; i--) { + path.push(String(i)) + change(path, old_data[i], new_data[i]) + path.pop() + } + } + + } else { + // both values are objects here + for (var i in new_data) { + path.push(String(i)) + change(path, old_data[i], new_data[i]) + path.pop() + } + + for (var i in old_data) { + if (i in new_data) continue + path.push(String(i)) + change(path, old_data[i], new_data[i]) + path.pop() + } + } + } +} + +Document.prototype.toString = function() { + return this._tokens.map(function(x) { + return x.raw + }).join('') +} + +module.exports.Document = Document + +module.exports.update = function updateJSON(source, new_value, options) { + return Document(source, options).update(new_value).toString() +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/parse.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/parse.js new file mode 100644 index 0000000000..2b78949378 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/parse.js @@ -0,0 +1,751 @@ +/* + * Author: Alex Kocharin + * GIT: https://github.com/rlidwka/jju + * License: WTFPL, grab your copy here: http://www.wtfpl.net/txt/copying/ + */ + +// RTFM: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf + +var Uni = require('./unicode') + +function isHexDigit(x) { + return (x >= '0' && x <= '9') + || (x >= 'A' && x <= 'F') + || (x >= 'a' && x <= 'f') +} + +function isOctDigit(x) { + return x >= '0' && x <= '7' +} + +function isDecDigit(x) { + return x >= '0' && x <= '9' +} + +var unescapeMap = { + '\'': '\'', + '"' : '"', + '\\': '\\', + 'b' : '\b', + 'f' : '\f', + 'n' : '\n', + 'r' : '\r', + 't' : '\t', + 'v' : '\v', + '/' : '/', +} + +function formatError(input, msg, position, lineno, column, json5) { + var result = msg + ' at ' + (lineno + 1) + ':' + (column + 1) + , tmppos = position - column - 1 + , srcline = '' + , underline = '' + + var isLineTerminator = json5 ? Uni.isLineTerminator : Uni.isLineTerminatorJSON + + // output no more than 70 characters before the wrong ones + if (tmppos < position - 70) { + tmppos = position - 70 + } + + while (1) { + var chr = input[++tmppos] + + if (isLineTerminator(chr) || tmppos === input.length) { + if (position >= tmppos) { + // ending line error, so show it after the last char + underline += '^' + } + break + } + srcline += chr + + if (position === tmppos) { + underline += '^' + } else if (position > tmppos) { + underline += input[tmppos] === '\t' ? '\t' : ' ' + } + + // output no more than 78 characters on the string + if (srcline.length > 78) break + } + + return result + '\n' + srcline + '\n' + underline +} + +function parse(input, options) { + // parse as a standard JSON mode + var json5 = !(options.mode === 'json' || options.legacy) + var isLineTerminator = json5 ? Uni.isLineTerminator : Uni.isLineTerminatorJSON + var isWhiteSpace = json5 ? Uni.isWhiteSpace : Uni.isWhiteSpaceJSON + + var length = input.length + , lineno = 0 + , linestart = 0 + , position = 0 + , stack = [] + + var tokenStart = function() {} + var tokenEnd = function(v) {return v} + + /* tokenize({ + raw: '...', + type: 'whitespace'|'comment'|'key'|'literal'|'separator'|'newline', + value: 'number'|'string'|'whatever', + path: [...], + }) + */ + if (options._tokenize) { + ;(function() { + var start = null + tokenStart = function() { + if (start !== null) throw Error('internal error, token overlap') + start = position + } + + tokenEnd = function(v, type) { + if (start != position) { + var hash = { + raw: input.substr(start, position-start), + type: type, + stack: stack.slice(0), + } + if (v !== undefined) hash.value = v + options._tokenize.call(null, hash) + } + start = null + return v + } + })() + } + + function fail(msg) { + var column = position - linestart + + if (!msg) { + if (position < length) { + var token = '\'' + + JSON + .stringify(input[position]) + .replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + + '\'' + + if (!msg) msg = 'Unexpected token ' + token + } else { + if (!msg) msg = 'Unexpected end of input' + } + } + + var error = SyntaxError(formatError(input, msg, position, lineno, column, json5)) + error.row = lineno + 1 + error.column = column + 1 + throw error + } + + function newline(chr) { + // account for + if (chr === '\r' && input[position] === '\n') position++ + linestart = position + lineno++ + } + + function parseGeneric() { + var result + + while (position < length) { + tokenStart() + var chr = input[position++] + + if (chr === '"' || (chr === '\'' && json5)) { + return tokenEnd(parseString(chr), 'literal') + + } else if (chr === '{') { + tokenEnd(undefined, 'separator') + return parseObject() + + } else if (chr === '[') { + tokenEnd(undefined, 'separator') + return parseArray() + + } else if (chr === '-' + || chr === '.' + || isDecDigit(chr) + // + number Infinity NaN + || (json5 && (chr === '+' || chr === 'I' || chr === 'N')) + ) { + return tokenEnd(parseNumber(), 'literal') + + } else if (chr === 'n') { + parseKeyword('null') + return tokenEnd(null, 'literal') + + } else if (chr === 't') { + parseKeyword('true') + return tokenEnd(true, 'literal') + + } else if (chr === 'f') { + parseKeyword('false') + return tokenEnd(false, 'literal') + + } else { + position-- + return tokenEnd(undefined) + } + } + } + + function parseKey() { + var result + + while (position < length) { + tokenStart() + var chr = input[position++] + + if (chr === '"' || (chr === '\'' && json5)) { + return tokenEnd(parseString(chr), 'key') + + } else if (chr === '{') { + tokenEnd(undefined, 'separator') + return parseObject() + + } else if (chr === '[') { + tokenEnd(undefined, 'separator') + return parseArray() + + } else if (chr === '.' + || isDecDigit(chr) + ) { + return tokenEnd(parseNumber(true), 'key') + + } else if (json5 + && Uni.isIdentifierStart(chr) || (chr === '\\' && input[position] === 'u')) { + // unicode char or a unicode sequence + var rollback = position - 1 + var result = parseIdentifier() + + if (result === undefined) { + position = rollback + return tokenEnd(undefined) + } else { + return tokenEnd(result, 'key') + } + + } else { + position-- + return tokenEnd(undefined) + } + } + } + + function skipWhiteSpace() { + tokenStart() + while (position < length) { + var chr = input[position++] + + if (isLineTerminator(chr)) { + position-- + tokenEnd(undefined, 'whitespace') + tokenStart() + position++ + newline(chr) + tokenEnd(undefined, 'newline') + tokenStart() + + } else if (isWhiteSpace(chr)) { + // nothing + + } else if (chr === '/' + && json5 + && (input[position] === '/' || input[position] === '*') + ) { + position-- + tokenEnd(undefined, 'whitespace') + tokenStart() + position++ + skipComment(input[position++] === '*') + tokenEnd(undefined, 'comment') + tokenStart() + + } else { + position-- + break + } + } + return tokenEnd(undefined, 'whitespace') + } + + function skipComment(multi) { + while (position < length) { + var chr = input[position++] + + if (isLineTerminator(chr)) { + // LineTerminator is an end of singleline comment + if (!multi) { + // let parent function deal with newline + position-- + return + } + + newline(chr) + + } else if (chr === '*' && multi) { + // end of multiline comment + if (input[position] === '/') { + position++ + return + } + + } else { + // nothing + } + } + + if (multi) { + fail('Unclosed multiline comment') + } + } + + function parseKeyword(keyword) { + // keyword[0] is not checked because it should've checked earlier + var _pos = position + var len = keyword.length + for (var i=1; i= length || keyword[i] != input[position]) { + position = _pos-1 + fail() + } + position++ + } + } + + function parseObject() { + var result = options.null_prototype ? Object.create(null) : {} + , empty_object = {} + , is_non_empty = false + + while (position < length) { + skipWhiteSpace() + var item1 = parseKey() + skipWhiteSpace() + tokenStart() + var chr = input[position++] + tokenEnd(undefined, 'separator') + + if (chr === '}' && item1 === undefined) { + if (!json5 && is_non_empty) { + position-- + fail('Trailing comma in object') + } + return result + + } else if (chr === ':' && item1 !== undefined) { + skipWhiteSpace() + stack.push(item1) + var item2 = parseGeneric() + stack.pop() + + if (item2 === undefined) fail('No value found for key ' + item1) + if (typeof(item1) !== 'string') { + if (!json5 || typeof(item1) !== 'number') { + fail('Wrong key type: ' + item1) + } + } + + if ((item1 in empty_object || empty_object[item1] != null) && options.reserved_keys !== 'replace') { + if (options.reserved_keys === 'throw') { + fail('Reserved key: ' + item1) + } else { + // silently ignore it + } + } else { + if (typeof(options.reviver) === 'function') { + item2 = options.reviver.call(null, item1, item2) + } + + if (item2 !== undefined) { + is_non_empty = true + Object.defineProperty(result, item1, { + value: item2, + enumerable: true, + configurable: true, + writable: true, + }) + } + } + + skipWhiteSpace() + + tokenStart() + var chr = input[position++] + tokenEnd(undefined, 'separator') + + if (chr === ',') { + continue + + } else if (chr === '}') { + return result + + } else { + fail() + } + + } else { + position-- + fail() + } + } + + fail() + } + + function parseArray() { + var result = [] + + while (position < length) { + skipWhiteSpace() + stack.push(result.length) + var item = parseGeneric() + stack.pop() + skipWhiteSpace() + tokenStart() + var chr = input[position++] + tokenEnd(undefined, 'separator') + + if (item !== undefined) { + if (typeof(options.reviver) === 'function') { + item = options.reviver.call(null, String(result.length), item) + } + if (item === undefined) { + result.length++ + item = true // hack for check below, not included into result + } else { + result.push(item) + } + } + + if (chr === ',') { + if (item === undefined) { + fail('Elisions are not supported') + } + + } else if (chr === ']') { + if (!json5 && item === undefined && result.length) { + position-- + fail('Trailing comma in array') + } + return result + + } else { + position-- + fail() + } + } + } + + function parseNumber() { + // rewind because we don't know first char + position-- + + var start = position + , chr = input[position++] + , t + + var to_num = function(is_octal) { + var str = input.substr(start, position - start) + + if (is_octal) { + var result = parseInt(str.replace(/^0o?/, ''), 8) + } else { + var result = Number(str) + } + + if (Number.isNaN(result)) { + position-- + fail('Bad numeric literal - "' + input.substr(start, position - start + 1) + '"') + } else if (!json5 && !str.match(/^-?(0|[1-9][0-9]*)(\.[0-9]+)?(e[+-]?[0-9]+)?$/i)) { + // additional restrictions imposed by json + position-- + fail('Non-json numeric literal - "' + input.substr(start, position - start + 1) + '"') + } else { + return result + } + } + + // ex: -5982475.249875e+29384 + // ^ skipping this + if (chr === '-' || (chr === '+' && json5)) chr = input[position++] + + if (chr === 'N' && json5) { + parseKeyword('NaN') + return NaN + } + + if (chr === 'I' && json5) { + parseKeyword('Infinity') + + // returning +inf or -inf + return to_num() + } + + if (chr >= '1' && chr <= '9') { + // ex: -5982475.249875e+29384 + // ^^^ skipping these + while (position < length && isDecDigit(input[position])) position++ + chr = input[position++] + } + + // special case for leading zero: 0.123456 + if (chr === '0') { + chr = input[position++] + + // new syntax, "0o777" old syntax, "0777" + var is_octal = chr === 'o' || chr === 'O' || isOctDigit(chr) + var is_hex = chr === 'x' || chr === 'X' + + if (json5 && (is_octal || is_hex)) { + while (position < length + && (is_hex ? isHexDigit : isOctDigit)( input[position] ) + ) position++ + + var sign = 1 + if (input[start] === '-') { + sign = -1 + start++ + } else if (input[start] === '+') { + start++ + } + + return sign * to_num(is_octal) + } + } + + if (chr === '.') { + // ex: -5982475.249875e+29384 + // ^^^ skipping these + while (position < length && isDecDigit(input[position])) position++ + chr = input[position++] + } + + if (chr === 'e' || chr === 'E') { + chr = input[position++] + if (chr === '-' || chr === '+') position++ + // ex: -5982475.249875e+29384 + // ^^^ skipping these + while (position < length && isDecDigit(input[position])) position++ + chr = input[position++] + } + + // we have char in the buffer, so count for it + position-- + return to_num() + } + + function parseIdentifier() { + // rewind because we don't know first char + position-- + + var result = '' + + while (position < length) { + var chr = input[position++] + + if (chr === '\\' + && input[position] === 'u' + && isHexDigit(input[position+1]) + && isHexDigit(input[position+2]) + && isHexDigit(input[position+3]) + && isHexDigit(input[position+4]) + ) { + // UnicodeEscapeSequence + chr = String.fromCharCode(parseInt(input.substr(position+1, 4), 16)) + position += 5 + } + + if (result.length) { + // identifier started + if (Uni.isIdentifierPart(chr)) { + result += chr + } else { + position-- + return result + } + + } else { + if (Uni.isIdentifierStart(chr)) { + result += chr + } else { + return undefined + } + } + } + + fail() + } + + function parseString(endChar) { + // 7.8.4 of ES262 spec + var result = '' + + while (position < length) { + var chr = input[position++] + + if (chr === endChar) { + return result + + } else if (chr === '\\') { + if (position >= length) fail() + chr = input[position++] + + if (unescapeMap[chr] && (json5 || (chr != 'v' && chr != "'"))) { + result += unescapeMap[chr] + + } else if (json5 && isLineTerminator(chr)) { + // line continuation + newline(chr) + + } else if (chr === 'u' || (chr === 'x' && json5)) { + // unicode/character escape sequence + var off = chr === 'u' ? 4 : 2 + + // validation for \uXXXX + for (var i=0; i= length) fail() + if (!isHexDigit(input[position])) fail('Bad escape sequence') + position++ + } + + result += String.fromCharCode(parseInt(input.substr(position-off, off), 16)) + } else if (json5 && isOctDigit(chr)) { + if (chr < '4' && isOctDigit(input[position]) && isOctDigit(input[position+1])) { + // three-digit octal + var digits = 3 + } else if (isOctDigit(input[position])) { + // two-digit octal + var digits = 2 + } else { + var digits = 1 + } + position += digits - 1 + result += String.fromCharCode(parseInt(input.substr(position-digits, digits), 8)) + /*if (!isOctDigit(input[position])) { + // \0 is allowed still + result += '\0' + } else { + fail('Octal literals are not supported') + }*/ + + } else if (json5) { + // \X -> x + result += chr + + } else { + position-- + fail() + } + + } else if (isLineTerminator(chr)) { + fail() + + } else { + if (!json5 && chr.charCodeAt(0) < 32) { + position-- + fail('Unexpected control character') + } + + // SourceCharacter but not one of " or \ or LineTerminator + result += chr + } + } + + fail() + } + + skipWhiteSpace() + var return_value = parseGeneric() + if (return_value !== undefined || position < length) { + skipWhiteSpace() + + if (position >= length) { + if (typeof(options.reviver) === 'function') { + return_value = options.reviver.call(null, '', return_value) + } + return return_value + } else { + fail() + } + + } else { + if (position) { + fail('No data, only a whitespace') + } else { + fail('No data, empty input') + } + } +} + +/* + * parse(text, options) + * or + * parse(text, reviver) + * + * where: + * text - string + * options - object + * reviver - function + */ +module.exports.parse = function parseJSON(input, options) { + // support legacy functions + if (typeof(options) === 'function') { + options = { + reviver: options + } + } + + if (input === undefined) { + // parse(stringify(x)) should be equal x + // with JSON functions it is not 'cause of undefined + // so we're fixing it + return undefined + } + + // JSON.parse compat + if (typeof(input) !== 'string') input = String(input) + if (options == null) options = {} + if (options.reserved_keys == null) options.reserved_keys = 'ignore' + + if (options.reserved_keys === 'throw' || options.reserved_keys === 'ignore') { + if (options.null_prototype == null) { + options.null_prototype = true + } + } + + try { + return parse(input, options) + } catch(err) { + // jju is a recursive parser, so JSON.parse("{{{{{{{") could blow up the stack + // + // this catch is used to skip all those internal calls + if (err instanceof SyntaxError && err.row != null && err.column != null) { + var old_err = err + err = SyntaxError(old_err.message) + err.column = old_err.column + err.row = old_err.row + } + throw err + } +} + +module.exports.tokenize = function tokenizeJSON(input, options) { + if (options == null) options = {} + + options._tokenize = function(smth) { + if (options._addstack) smth.stack.unshift.apply(smth.stack, options._addstack) + tokens.push(smth) + } + + var tokens = [] + tokens.data = module.exports.parse(input, options) + return tokens +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/stringify.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/stringify.js new file mode 100644 index 0000000000..754019eac5 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/stringify.js @@ -0,0 +1,382 @@ +/* + * Author: Alex Kocharin + * GIT: https://github.com/rlidwka/jju + * License: WTFPL, grab your copy here: http://www.wtfpl.net/txt/copying/ + */ + +var Uni = require('./unicode') + +// Fix Function#name on browsers that do not support it (IE) +// http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie +if (!(function f(){}).name) { + Object.defineProperty((function(){}).constructor.prototype, 'name', { + get: function() { + var name = this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1] + // For better performance only parse once, and then cache the + // result through a new accessor for repeated access. + Object.defineProperty(this, 'name', { value: name }) + return name + } + }) +} + +var special_chars = { + 0: '\\0', // this is not an octal literal + 8: '\\b', + 9: '\\t', + 10: '\\n', + 11: '\\v', + 12: '\\f', + 13: '\\r', + 92: '\\\\', +} + +// for oddballs +var hasOwnProperty = Object.prototype.hasOwnProperty + +// some people escape those, so I'd copy this to be safe +var escapable = /[\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/ + +function _stringify(object, options, recursiveLvl, currentKey) { + var opt_json = options.mode === 'json' + /* + * Opinionated decision warning: + * + * Objects are serialized in the following form: + * { type: 'Class', data: DATA } + * + * Class is supposed to be a function, and new Class(DATA) is + * supposed to be equivalent to the original value + */ + /*function custom_type() { + return stringify({ + type: object.constructor.name, + data: object.toString() + }) + }*/ + + // if add, it's an internal indentation, so we add 1 level and a eol + // if !add, it's an ending indentation, so we just indent + function indent(str, add) { + var prefix = options._prefix ? options._prefix : '' + if (!options.indent) return prefix + str + var result = '' + var count = recursiveLvl + (add || 0) + for (var i=0; i 0) { + if (!Uni.isIdentifierPart(key[i])) + return _stringify_str(key) + + } else { + if (!Uni.isIdentifierStart(key[i])) + return _stringify_str(key) + } + + var chr = key.charCodeAt(i) + + if (options.ascii) { + if (chr < 0x80) { + result += key[i] + + } else { + result += '\\u' + ('0000' + chr.toString(16)).slice(-4) + } + + } else { + if (escapable.exec(key[i])) { + result += '\\u' + ('0000' + chr.toString(16)).slice(-4) + + } else { + result += key[i] + } + } + } + + return result + } + + function _stringify_str(key) { + var quote = options.quote + var quoteChr = quote.charCodeAt(0) + + var result = '' + for (var i=0; i= 8 && chr <= 13 && (!opt_json || chr !== 11)) { + result += special_chars[chr] + } else if (!opt_json) { + result += '\\x0' + chr.toString(16) + } else { + result += '\\u000' + chr.toString(16) + } + + } else if (chr < 0x20) { + if (!opt_json) { + result += '\\x' + chr.toString(16) + } else { + result += '\\u00' + chr.toString(16) + } + + } else if (chr >= 0x20 && chr < 0x80) { + // ascii range + if (chr === 47 && i && key[i-1] === '<') { + // escaping slashes in + result += '\\' + key[i] + + } else if (chr === 92) { + result += '\\\\' + + } else if (chr === quoteChr) { + result += '\\' + quote + + } else { + result += key[i] + } + + } else if (options.ascii || Uni.isLineTerminator(key[i]) || escapable.exec(key[i])) { + if (chr < 0x100) { + if (!opt_json) { + result += '\\x' + chr.toString(16) + } else { + result += '\\u00' + chr.toString(16) + } + + } else if (chr < 0x1000) { + result += '\\u0' + chr.toString(16) + + } else if (chr < 0x10000) { + result += '\\u' + chr.toString(16) + + } else { + throw Error('weird codepoint') + } + } else { + result += key[i] + } + } + return quote + result + quote + } + + function _stringify_object() { + if (object === null) return 'null' + var result = [] + , len = 0 + , braces + + if (Array.isArray(object)) { + braces = '[]' + for (var i=0; i options._splitMax - recursiveLvl * options.indent.length || len > options._splitMin) ) { + // remove trailing comma in multiline if asked to + if (options.no_trailing_comma && result.length) { + result[result.length-1] = result[result.length-1].substring(0, result[result.length-1].length-1) + } + + var innerStuff = result.map(function(x) {return indent(x, 1)}).join('') + return braces[0] + + (options.indent ? '\n' : '') + + innerStuff + + indent(braces[1]) + } else { + // always remove trailing comma in one-lined arrays + if (result.length) { + result[result.length-1] = result[result.length-1].substring(0, result[result.length-1].length-1) + } + + var innerStuff = result.join(options.indent ? ' ' : '') + return braces[0] + + innerStuff + + braces[1] + } + } + + function _stringify_nonobject(object) { + if (typeof(options.replacer) === 'function') { + object = options.replacer.call(null, currentKey, object) + } + + switch(typeof(object)) { + case 'string': + return _stringify_str(object) + + case 'number': + if (object === 0 && 1/object < 0) { + // Opinionated decision warning: + // + // I want cross-platform negative zero in all js engines + // I know they're equal, but why lose that tiny bit of + // information needlessly? + return '-0' + } + if (options.mode === 'json' && !Number.isFinite(object)) { + // json don't support infinity (= sucks) + return 'null' + } + return object.toString() + + case 'boolean': + return object.toString() + + case 'undefined': + return undefined + + case 'function': +// return custom_type() + + default: + // fallback for something weird + return JSON.stringify(object) + } + } + + if (options._stringify_key) { + return _stringify_key(object) + } + + if (typeof(object) === 'object') { + if (object === null) return 'null' + + var str + if (typeof(str = object.toJSON5) === 'function' && options.mode !== 'json') { + object = str.call(object, currentKey) + + } else if (typeof(str = object.toJSON) === 'function') { + object = str.call(object, currentKey) + } + + if (object === null) return 'null' + if (typeof(object) !== 'object') return _stringify_nonobject(object) + + if (object.constructor === Number || object.constructor === Boolean || object.constructor === String) { + object = object.valueOf() + return _stringify_nonobject(object) + + } else if (object.constructor === Date) { + // only until we can't do better + return _stringify_nonobject(object.toISOString()) + + } else { + if (typeof(options.replacer) === 'function') { + object = options.replacer.call(null, currentKey, object) + if (typeof(object) !== 'object') return _stringify_nonobject(object) + } + + return _stringify_object(object) + } + } else { + return _stringify_nonobject(object) + } +} + +/* + * stringify(value, options) + * or + * stringify(value, replacer, space) + * + * where: + * value - anything + * options - object + * replacer - function or array + * space - boolean or number or string + */ +module.exports.stringify = function stringifyJSON(object, options, _space) { + // support legacy syntax + if (typeof(options) === 'function' || Array.isArray(options)) { + options = { + replacer: options + } + } else if (typeof(options) === 'object' && options !== null) { + // nothing to do + } else { + options = {} + } + if (_space != null) options.indent = _space + + if (options.indent == null) options.indent = '\t' + if (options.quote == null) options.quote = "'" + if (options.ascii == null) options.ascii = false + if (options.mode == null) options.mode = 'simple' + + if (options.mode === 'json') { + // json only supports double quotes (= sucks) + options.quote = '"' + + // json don't support trailing commas (= sucks) + options.no_trailing_comma = true + + // json don't support unquoted property names (= sucks) + options.quote_keys = true + } + + // why would anyone use such objects? + if (typeof(options.indent) === 'object') { + if (options.indent.constructor === Number + || options.indent.constructor === Boolean + || options.indent.constructor === String) + options.indent = options.indent.valueOf() + } + + // gap is capped at 10 characters + if (typeof(options.indent) === 'number') { + if (options.indent >= 0) { + options.indent = Array(Math.min(~~options.indent, 10) + 1).join(' ') + } else { + options.indent = false + } + } else if (typeof(options.indent) === 'string') { + options.indent = options.indent.substr(0, 10) + } + + if (options._splitMin == null) options._splitMin = 50 + if (options._splitMax == null) options._splitMax = 70 + + return _stringify(object, options, 0, '') +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/unicode.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/unicode.js new file mode 100644 index 0000000000..1a29143c2d --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/unicode.js @@ -0,0 +1,71 @@ + +// This is autogenerated with esprima tools, see: +// https://github.com/ariya/esprima/blob/master/esprima.js +// +// PS: oh God, I hate Unicode + +// ECMAScript 5.1/Unicode v6.3.0 NonAsciiIdentifierStart: + +var Uni = module.exports + +module.exports.isWhiteSpace = function isWhiteSpace(x) { + // section 7.2, table 2 + return x === '\u0020' + || x === '\u00A0' + || x === '\uFEFF' // <-- this is not a Unicode WS, only a JS one + || (x >= '\u0009' && x <= '\u000D') // 9 A B C D + + // + whitespace characters from unicode, category Zs + || x === '\u1680' + || x === '\u180E' + || (x >= '\u2000' && x <= '\u200A') // 0 1 2 3 4 5 6 7 8 9 A + || x === '\u2028' + || x === '\u2029' + || x === '\u202F' + || x === '\u205F' + || x === '\u3000' +} + +module.exports.isWhiteSpaceJSON = function isWhiteSpaceJSON(x) { + return x === '\u0020' + || x === '\u0009' + || x === '\u000A' + || x === '\u000D' +} + +module.exports.isLineTerminator = function isLineTerminator(x) { + // ok, here is the part when JSON is wrong + // section 7.3, table 3 + return x === '\u000A' + || x === '\u000D' + || x === '\u2028' + || x === '\u2029' +} + +module.exports.isLineTerminatorJSON = function isLineTerminatorJSON(x) { + return x === '\u000A' + || x === '\u000D' +} + +module.exports.isIdentifierStart = function isIdentifierStart(x) { + return x === '$' + || x === '_' + || (x >= 'A' && x <= 'Z') + || (x >= 'a' && x <= 'z') + || (x >= '\u0080' && Uni.NonAsciiIdentifierStart.test(x)) +} + +module.exports.isIdentifierPart = function isIdentifierPart(x) { + return x === '$' + || x === '_' + || (x >= 'A' && x <= 'Z') + || (x >= 'a' && x <= 'z') + || (x >= '0' && x <= '9') // <-- addition to Start + || (x >= '\u0080' && Uni.NonAsciiIdentifierPart.test(x)) +} + +module.exports.NonAsciiIdentifierStart = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ + +// ECMAScript 5.1/Unicode v6.3.0 NonAsciiIdentifierPart: + +module.exports.NonAsciiIdentifierPart = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0\u08A2-\u08AC\u08E4-\u08FE\u0900-\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C82\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191C\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA697\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE26\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/utils.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/utils.js new file mode 100644 index 0000000000..dd4752c73a --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/utils.js @@ -0,0 +1,45 @@ +var FS = require('fs') +var jju = require('../') + +// this function registers json5 extension, so you +// can do `require("./config.json5")` kind of thing +module.exports.register = function() { + var r = require, e = 'extensions' + r[e]['.json5'] = function(m, f) { + /*eslint no-sync:0*/ + m.exports = jju.parse(FS.readFileSync(f, 'utf8')) + } +} + +// this function monkey-patches JSON.parse, so it +// will return an exact position of error in case +// of parse failure +module.exports.patch_JSON_parse = function() { + var _parse = JSON.parse + JSON.parse = function(text, rev) { + try { + return _parse(text, rev) + } catch(err) { + // this call should always throw + require('jju').parse(text, { + mode: 'json', + legacy: true, + reviver: rev, + reserved_keys: 'replace', + null_prototype: false, + }) + + // if it didn't throw, but original parser did, + // this is an error in this library and should be reported + throw err + } + } +} + +// this function is an express/connect middleware +// that accepts uploads in application/json5 format +module.exports.middleware = function() { + return function(req, res, next) { + throw Error('this function is removed, use express-json5 instead') + } +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.json b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.json new file mode 100644 index 0000000000..bdcdae6b46 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.json @@ -0,0 +1,63 @@ +{ + "name": "jju", + "version": "1.2.0", + "description": "a set of utilities to work with JSON / JSON5 documents", + "author": { + "name": "Alex Kocharin", + "email": "alex@kocharin.ru" + }, + "repository": { + "type": "git", + "url": "git://github.com/rlidwka/jju" + }, + "bugs": { + "url": "https://github.com/rlidwka/jju/issues" + }, + "homepage": "http://rlidwka.github.io/jju/", + "devDependencies": { + "mocha": ">=1.21.0", + "js-yaml": ">=3.1.0", + "eslint": "~0.4.2" + }, + "scripts": { + "test": "mocha test/*.js", + "lint": "eslint -c ./.eslint.yaml ./lib" + }, + "keywords": [ + "json", + "json5", + "parser", + "serializer", + "data" + ], + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, + "license": { + "type": "WTFPL", + "url": "http://www.wtfpl.net/txt/copying/" + }, + "gitHead": "6f1b2a8321cb0dfcffc50378b3632853cf529671", + "_id": "jju@1.2.0", + "_shasum": "add5b586fec853b44929d78bf94864ab577c02e9", + "_from": "jju@>=1.1.0 <2.0.0", + "_npmVersion": "2.0.1", + "_nodeVersion": "1.1.1", + "_npmUser": { + "name": "rlidwka", + "email": "alex@kocharin.ru" + }, + "maintainers": [ + { + "name": "rlidwka", + "email": "alex@kocharin.ru" + } + ], + "dist": { + "shasum": "add5b586fec853b44929d78bf94864ab577c02e9", + "tarball": "http://registry.npmjs.org/jju/-/jju-1.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/jju/-/jju-1.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.yaml new file mode 100644 index 0000000000..c971ba2826 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.yaml @@ -0,0 +1,45 @@ +# use "yapm install ." if you're installing this from git repository + +# "jju" stands for "json/json5 utils" +name: jju + +version: 1.2.0 +description: a set of utilities to work with JSON / JSON5 documents + +author: + name: Alex Kocharin + email: alex@kocharin.ru + +repository: + type: git + url: git://github.com/rlidwka/jju + +bugs: + url: https://github.com/rlidwka/jju/issues + +homepage: http://rlidwka.github.io/jju/ + +devDependencies: + mocha: '>=1.21.0' + js-yaml: '>=3.1.0' + + # linting tools + eslint: '~0.4.2' + +scripts: + test: 'mocha test/*.js' + lint: 'eslint -c ./.eslint.yaml ./lib' + +keywords: + - json + - json5 + - parser + - serializer + - data + +publishConfig: + registry: https://registry.npmjs.org/ + +license: + type: WTFPL + url: http://www.wtfpl.net/txt/copying/ diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/portable-json5-tests.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/portable-json5-tests.yaml new file mode 100644 index 0000000000..5bf6ac38fe --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/portable-json5-tests.yaml @@ -0,0 +1,916 @@ +# vi:set ts=2 sts=2 sw=2 et: +# +# Copyright (c) JD 2456730 Alex Kocharin +# +# 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 original file is available here: +# https://github.com/rlidwka/jju/tree/master/test/portable-json5-tests.yaml +# +# ---------------------------------------------------------------------------- +# +# Portable JSON5 test suite. +# +# This file contains an actual YAML data and it may include fancy syntax. +# If your platform does not support YAML, you might wish to pre-process it +# using a generic YAML parser. +# + +%YAML 1.2 +--- +# +# "input" is an arbitrary JSON5 you have to parse +# "output" is a normalized JSON you have to compare your result with, +# or !error (null) if your input should result in parser error +# +# Types of tests: +# +# - basic - Tests that every JSON5 parser should pass. +# +# - advanced - Tests that bring close compatibility with javascript. Not +# strictly required, but nice to have for completeness. +# +# - extra - Extra test cases you can follow at your discretion. +# +# Questionable features like elisions go to extra. All valid javascript, but +# invalid json5 also goes to extra. Feel free to ignore this section if you +# want to. Thus, eval(input) is a complete json5 parser, that should pass all +# basic and advanced tests. +# + +# Basic types in minimal form +# --------------------------- + +type-no-data: + type: extra + output: !error + input: '' + +type-null: + type: basic + output: null + input: > + null + +# undefined is not supported, +# null should be used instead +type-no-undefined: + type: extra + output: !error + input: > + undefined + +type-no-raw: + type: extra + output: !error + input: > + foobar + +type-bool-true: + type: basic + output: true + input: > + true + +type-bool-false: + type: basic + output: false + input: > + false + +type-number: + type: basic + output: 0 + input: > + 0 + +type-string: + type: basic + output: "" + input: > + "" + +type-object: + type: basic + output: {} + input: > + {} + +type-array: + type: basic + output: [] + input: > + [] + +# Numbers: special +# ---------------- + +# note: it's hard to test this +# just add `1/x < 0` check in your code somewhere +num-negative-zero: + type: extra + output: -0.0 + input: > + -0 + +num-nan: + type: basic + output: .nan + input: > + NaN + +num-signed-nan: + type: basic + output: .nan + input: > + +NaN + +num-positive-inf: + type: basic + output: +.inf + input: > + Infinity + +num-negative-inf: + type: basic + output: -.inf + input: > + -Infinity + +num-inf-exact-case: + type: extra + output: !error + input: > + INFINITY + +# Numbers: hexadecimal +# -------------------- + +num-hex-zero: + type: basic + output: 0 + input: > + 0x0 + +num-cut-hex: + type: basic + output: !error + input: > + 0x + +num-all-hex: + type: basic + output: 12841684683518 + input: > + 0xBADF00DCAFE + +num-mixed-case: + type: basic + output: 3735928559 + input: > + 0xDeAdBEef + +num-signed-hex: + type: advanced + output: 31 + input: > + +0x1F + +num-negative-hex: + type: advanced + output: -31 + input: > + -0x1f + +num-bad-hex: + type: advanced + output: !error + input: > + 0xBADxF00D + +num-no-hex-float: + type: advanced + output: !error + input: > + 0x12.345 + +# this is not actually an exponent :) +num-hex-exponent: + type: advanced + output: 4836 + input: > + 0x0012e4 + +# Numbers: octal +# -------------- + +# Octals are primarily used in config files +# to set up a file mask (like 0777) +# +# Note: they will have 0o12345 syntax instead +# of 012345 in the ES6, so we'll need to switch +# as well in the future + +num-octal: + type: extra + output: 342391 + input: > + 01234567 + +num-octal-zeroes: + type: extra + output: -24000 + input: > + -000000056700 + +num-bad-octal: + type: extra + output: !error + input: > + 012345678 + +num-no-octal-float: + type: extra + output: !error + input: > + 012.345 + +num-no-octal-exp: + type: extra + output: !error + input: > + 0123e4 + +# Numbers: floating point +# ----------------------- + +num-float: + type: basic + output: 123.456 + input: > + 123.456 + +num-signed-foat: + type: basic + output: -0.00098765 + input: > + -0.00098765 + +num-omit-trailing-mantissa: + type: basic + output: 1234000 + input: > + 1234.e3 + +num-omit-leading-mantissa: + type: advanced + output: -123.4 + input: > + -.1234e3 + +num-bad-float: + type: advanced + output: !error + input: > + 0.12.345 + +num-bad-sum: + type: extra + output: !error + input: > + 0.12+345 + +num-uc-exp: + type: advanced + output: -1230000 + input: > + -123E+4 + +num-float-exp: + type: basic + output: 123000 + input: > + 0.0123e7 + +num-bad-exp: + type: extra + output: !error + input: > + 123e7.3 + +num-bad-char: + type: extra + output: !error + input: > + 123a456 + +num-no-exp: + type: advanced + output: !error + input: > + 123e + +num-zero-exp: + type: advanced + output: -0.0 + input: > + -.00e-0 + +num-dec-base-signed-exp: + type: advanced + output: 0.00000123 + input: > + 1230000E-012 + +# String: quotes +# -------------- + +string-double-quotes: + type: basic + output: foobar + input: > + "foobar" + +string-single-quotes: + type: basic + output: foobar + input: > + 'foobar' + +string-open: + type: basic + output: !error + input: > + "\\\\\\\\\\\\\" + +string-not-open: + type: basic + output: "\\\\\\\\\\\\\\" + input: > + "\\\\\\\\\\\\\\" + +string-continuation: + type: advanced + output: " foo bar " + input: > + " foo \ + bar \ + " + +string-win-continuation: + type: advanced + output: "foobar" + input: "'foo\\\r\nbar'" + +string-win-reverse-continuation: + type: advanced + output: !error + input: "'foo\\\n\rbar'" + +string-unicode-continuation: + type: advanced + output: "foobarbaz" + input: "'foo\\\u2028bar\\\u2029baz'" + +string-multi-bad-continuation: + type: advanced + output: !error + input: > + foo\ + + bar + +string-bad-ending: + type: basic + output: !error + input: "'foo\rbar'" + +string-bad-ending-2028: + type: advanced + output: !error + input: "'foo\u2028bar'" + +string-bad-ending-2029: + type: advanced + output: !error + input: "'foo\u2029bar'" + +string-literal-unicode: + type: advanced + output: "foo\uFEFF\u2030bar\u1234" + input: "'foo\uFEFF\u2030bar\u1234'" + +string-control-char: + type: advanced + output: "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0b\x0c\x0e\x0f" + input: "'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0b\x0c\x0e\x0f'" + +# String: escape sequences +# ------------------------ + +string-octal-escape: + type: extra + output: "\x1b[1;32mhi\x1b[m??" + input: > + '\033[1;32mhi\033[m\077\077' + +string-octal-two-digits: + type: extra + output: "\n\x1c\x2e\x07890\x01" + input: > + '\12\34\56\78\90\1' + +string-octal-three-digits: + type: extra + output: "\n34.78\xff 0" + input: > + '\01234\5678\377\400' + +string-hex-escape: + type: extra + output: "\x01\x23\xab\xcd\xef" + input: > + "\x01\x23\xab\xCd\xEF" + +# \0 is *not* an octal escape sequence, +# and is allowed even in strict mode +string-zero-point: + type: basic + output: "\0" + input: > + '\0' + +string-escape-double-quotes: + type: basic + output: "\"''" + input: > + "\"'\'" + +string-escape-single-quotes: + type: basic + output: " '\"\" " + input: > + ' \'"\" ' + +string-escape-json-chars: + type: basic + output: "\\\/\b\f\n\r\t" + input: > + "\\\/\b\f\n\r\t" + +# this character was left out of +# json spec for whatever reason +string-escape-slash-v: + type: basic + output: "\v" + input: > + "\v" + +string-unicode-escape: + type: basic + output: "\u0000\uffffx\ufeff\u1234\u9f6a\u2028\uabcd" + input: > + "\u0000\uFFFFx\uFeFf\u1234\u9F6a\u2028\uabcd" + +string-arbitrary-escape: + type: advanced + output: "X12Uqwe\r\tyiopasd\fghjklzc\u000b\b\nm9 " + input: > + '\X12\U\q\w\e\r\t\y\i\o\p\a\s\d\f\g\h\j\k\l\z\c\v\b\n\m\9\ ' + +string-bad-unicode: + type: advanced + output: !error + input: > + '\uEFGH' + +string-incomplete-unicode: + type: advanced + output: !error + input: > + '\u$' + +string-bad-hex: + type: advanced + output: !error + input: > + '\xFG' + +string-incomplete-hex: + type: advanced + output: !error + input: > + '\x$' + +# Object literals +# --------------- + +object-nested: + type: basic + output: {q:{'w':{"e":[1]}}} + input: | + {q:{'w':{"e":[1]}}} + +object-trailing-comma: + type: basic + output: {foo: 'bar'} + input: | + {foo: 'bar',} + +object-leading-comma-style: + type: basic + output: {q: 1,w: 2,e: 3} + input: | + { q: 1 + , w: 2 + , e: 3 + } + +object-incomplete: + type: basic + output: !error + input: | + {q:1,w:2,{} + +object-isnt-array: + type: basic + output: !error + input: | + {1,2} + +object-no-single-comma: + type: basic + output: !error + input: | + {,} + +object-no-elisions: + type: basic + output: !error + input: | + {q:1,,w:2} + +# Objects: keys +# ------------- + +object-singlequoted: + type: basic + output: {q: 1,w: 2,e: 3} + input: | + {'q':1,'w':2,'e':3} + +object-doublequoted: + type: basic + output: {q: 1,w: 2,e: 3} + input: | + {"q":1,"w":2,"e":3} + +object-unquoted: + type: basic + output: {$FOO_bar123: 'baz'} + input: > + {$FOO_bar123: 'baz'} + +object-no-first-digit: + type: advanced + output: !error + input: > + {123foo: bar} + +object-unquoted-unicode: + type: advanced + output: {"\u1f04\u03bb\u03c6\u03b1": baz} + input: "{\u1f04\u03bb\u03c6\u03b1:'baz'}" + +object-unicode-escape-key: + type: advanced + output: {foo: 'bar', "\u1f04\u03bb\u03c6\u03b1": baz, "qwe\u1f04rty": quux} + input: | + {foo:'bar', \u1f04\u03bb\u03c6\u03b1:'baz', qwe\u1f04rty: "quux"} + +object-no-raw-literal: + type: extra + output: !error + input: | + {foo: bar} + +object-bad-literal: + type: advanced + output: !error + input: | + {foo-bar: 123} + +object-no-space-in-key: + type: advanced + output: !error + input: | + {foo bar: 123} + +object-no-comment-in-key: + type: advanced + output: !error + input: | + {foo/*bar*/baz: 123} + +object-float-keys: + type: advanced + output: {'1': 'one', '3.1415': 'pi'} + input: | + {1:'one', 3.1415:'pi'} + +object-no-negative: + type: advanced + output: !error + input: | + {-5: 123} + +object-exponent-keys: + type: advanced + output: {'1': 'exp', '1000': 'pos', '0.001': 'neg'} + input: | + {1e0: 'exp', 1e+3: 'pos', 1e-3: 'neg'} + +object-octal-keys: + type: extra + output: {'668': 1} + input: | + {01234: 1} + +object-hex-keys: + type: advanced + output: {'51966': 1} + input: | + {0xCAFE: 1} + +object-null-keys: + type: basic + output: {'null': null} + input: | + {null: null} + +object-no-array-keys: + type: extra + output: !error + input: | + {[]: 123} + +object-no-empty-keys: + type: basic + output: !error + input: | + {: 123} + +object-empty-string-key: + type: basic + output: {s: {'': 1}, m: {'': 2}} + input: | + {s: {'': 1}, m: {"": 2}} + +object-bad-unicode-space: + type: advanced + output: !error + input: | + { \u0020foobar: 123 } + +object-bad-unicode-dash: + type: advanced + output: !error + input: | + { foo\u002dbar: 123} + +object-incomplete-unicode-sequence: + type: advanced + output: !error + input: | + { foo\u12f: 123 } + +object-double-escape: + type: advanced + output: !error + input: | + { foo\\u1234bar: 123 } + +object-we-arent-es3: + type: basic + output: {new: 1, delete: 2, throw: 3} + input: | + {new: 1, delete: 2, throw: 3} + +object-last-digits: + type: basic + output: {$123e2: 1, abc123: 2} + input: | + {$123e2: 1, abc123: 2} + +object-unicode-in-string: + type: advanced + output: {"\uff13qwe": 123} + input: | + {"\uff13qwe": 123} + +object-unicode-esc-in-string: + type: advanced + output: {"\\uff13qwe": 123} + input: | + {"\\uff13qwe": 123} + +object-unicode-digits-first-esc: + type: advanced + output: !error + input: | + {\uff13qwe: 123} + +object-unicode-digits-first-lit: + type: advanced + output: !error + input: "{\uff13qwe: 123}" + +object-unicode-weirdness-esc: + type: advanced + output: {"digit\uff13": 1, "comb\u094F": 2, "punct\u2040": 3, "zwnj\u200C": 4} + input: | + {digit\uff13: 1, comb\u094F: 2, punct\u2040: 3, zwnj\u200C: 4} + +object-unicode-weirdness-lit: + type: advanced + output: {"digit\uff13": 1, "comb\u094F": 2, "punct\u2040": 3, "zwnj\u200C": 4} + input: "{digit\uff13: 1, comb\u094F: 2, punct\u2040: 3, zwnj\u200C: 4}" + +# Array literals +# -------------- + +array-all-types: + type: basic + output: [1.2,"3,4",{},[],null,+.inf] + input: | + [1.2,"3,4",{},[],null,Infinity] + +array-trailing-comma: + type: basic + output: [1,2,3,4] + input: | + [1,2,3,4,] + +array-leading-comma-style: + type: basic + output: [quux,foo,bar,baz] + input: | + [ 'quux' + , 'foo' + , 'bar' + , 'baz' + ] + +array-incomplete: + type: basic + output: !error + input: | + [1,2,3,[] + +array-nested: + type: basic + output: [[[[[[]]]]],[[],[]]] + input: | + [[[[[[/*[]*/]]]]],[[],[]]] + +array-isnt-object: + type: extra + output: !error + input: | + [1:2] + +array-no-single-comma: + type: extra + output: !error + input: | + [,] + +array-no-elisions: + type: extra + output: !error + input: | + [1,,2,3] + +# Comments +# -------- + +comment-single: + type: basic + output: foobar + input: | + // blahblah + "foobar" + // another one + +comment-multi: + type: basic + output: foobar + input: | + /* + * 123 + */ + "foobar" + /**/ + +comment-single-newlines: + type: advanced + output: [ 123, 456, 789 ] + input: "[// foo\r123,// bar\u2028456,// baz\u2029789]" + +comment-inside: + type: advanced + output: [123, '// foo', '/* bar'] + input: > + [ + /* + " // */ 123, // ", + "// foo", + '/* bar', + ] + +comment-in-token: + type: advanced + output: !error + input: + 123/*comment*/456 + +comment-java-style: + type: basic + output: 123 + input: + /*****************/ + 123 + /****************/ + +comment-object: + type: basic + output: {q: 123} + input: /**/{/**/q/**/:/**/123/**/,/**/}// + +# Whitespace +# ---------- + +ws-no-whitespace: + type: basic + output: {"foo":bar,bar:["qwe",null,[],{}],"baz":123} + input: '{foo:"bar","bar":["qwe",null,[],{}],"baz":123}' + +ws-allow-prefix: + type: basic + output: 123 + input: " \t123" + +ws-unicode-spaces: + type: advanced + output: { foo : 123 } + input: " + \u0020\u00A0\uFEFF + { + \x09\x0A\x0B\x0C\x0D\u1680\u180E + foo + \u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A + : + \u2028\u2029\u202F\u205F\u3000 + 123 + \uFEFF + }" + +ws-unicode-newlines: + type: advanced + output: [ 123, 456 ] + input: " + [ + \u000D + 123, + \u2028 + 456, + \u2029 + ] + " + +# Multiple tokens +# --------------- + +multi-string-nospace: + type: basic + output: !error + input: '"foo""bar"' + +multi-string: + type: basic + output: !error + input: '"foo" "bar"' + +# note: valid javascript +multi-array: + type: extra + output: !error + input: '[0] [0]' + +multi-object: + type: basic + output: !error + input: '{} {}' +... diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_analyze.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_analyze.js new file mode 100644 index 0000000000..e353efcd1a --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_analyze.js @@ -0,0 +1,52 @@ +var _assert = require('assert') +var analyze = require('../').analyze + +function addTest(a, b) { + if (typeof(describe) === 'function') { + it('test_analyze: ' + a + ' == ' + b, function() { + _assert.equal(a, b) + }) + } else { + _assert.equal(a, b) + } +} + +var t = analyze(JSON.stringify(require('os').networkInterfaces())) +addTest(t.has_whitespace, false) +addTest(t.has_comments, false) +addTest(t.has_newlines, false) +addTest(t.newline, '\n') +addTest(t.quote, '"') +addTest(t.quote_keys, true) +addTest(t.indent, '') + +var t = analyze(JSON.stringify(require('os').networkInterfaces(), null, 2)) +addTest(t.has_whitespace, true) +addTest(t.has_comments, false) +addTest(t.has_newlines, true) +addTest(t.newline, '\n') +addTest(t.quote, '"') +addTest(t.quote_keys, true) +addTest(t.indent, ' ') + +var t = analyze(JSON.stringify(require('os').networkInterfaces(), null, 3)) +addTest(t.indent, ' ') + +var t = analyze(JSON.stringify(require('os').networkInterfaces(), null, '\t')) +addTest(t.indent, '\t') + +var t = analyze(JSON.stringify(require('os').networkInterfaces(), null, 3).replace(/\n/g, '\r\n')) +addTest(t.indent, ' ') +addTest(t.newline, '\r\n') + +var t = analyze(JSON.stringify(require('os').networkInterfaces()).replace(/"/g, "'")) +addTest(t.quote, "'") +addTest(t.quote_keys, true) + +var t = analyze("{foo:'bar', 'bar':\"baz\", 'baz':\"quux\"}") +addTest(t.quote, "'") +addTest(t.quote_keys, false) + +var t = analyze("{foo:'bar', \"bar\":'baz', \"baz\":\"quux\"}") +addTest(t.quote, '"') +addTest(t.quote_keys, false) diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_document.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_document.js new file mode 100644 index 0000000000..5f1ef2aaf6 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_document.js @@ -0,0 +1,214 @@ +var assert = require('assert') +var create = require('../lib/document').Document +var jju = require('..') + +var str = '{ x\r\n:\n1, y: {"..z.": 123, t: null, s:"123", a:[ 1,2,{x:3},] }}\n' +var d = create(str) +assert.equal(d + '', str) +assert.deepEqual(d.get(''), {x:1,y:{'..z.':123,t:null,s:'123',a:[1,2,{x:3}]}}) +assert.deepEqual(d.get('x'), 1) +assert.deepEqual(d.get('x.x'), undefined) +assert.deepEqual(d.get('x.x.x.x'), undefined) +assert.strictEqual(d.get('y.x'), undefined) +assert.deepEqual(d.get('y.s'), '123') +assert.strictEqual(d.get('y.t'), null) +assert.strictEqual(d.get('y.t.x'), undefined) +assert.equal(d.has(''), true) +assert.equal(d.has('x'), true) +assert.equal(d.has('x.x'), false) +assert.equal(d.has('x.x.x.x'), false) +assert.equal(d.has('y.x'), false) +assert.equal(d.has('y'), true) +assert.equal(d.has('y.s'), true) +assert.equal(d.has('y.t'), true) +assert.equal(d.has('a'), false) + +// arrays +assert.deepEqual(d.get('y.a'), [1,2,{x:3}]) +assert.deepEqual(d.get('y.a.0'), 1) +assert.deepEqual(d.get('y.a.2.x'), 3) +assert.deepEqual(d.get('y.a.10'), undefined) +assert.deepEqual(d.has('y.a.0'), true) +assert.deepEqual(d.has('y.a.10'), false) +assert.deepEqual(d.get('y.a.2'), {x:3}) +assert.deepEqual(d.get('y.a.-1'), undefined) + +// controversial +assert.strictEqual(d.get('y.s.0'), undefined) +assert.equal(d.has('y.s.0'), false) + +// paths +assert.deepEqual(d.get([]), {x:1,y:{'..z.':123,t:null,s:'123',a:[1,2,{x:3}]}}) +assert.strictEqual(d.has([]), true) +assert.strictEqual(d.get(['y','..z.']), 123) +assert.strictEqual(d.has(['y','..z.']), true) +assert.deepEqual(d.get(['y','a',2,'x']), 3) +assert.deepEqual(create('[1]').set(0, 4).get(''), [4]) +assert.deepEqual(create('[1]').set(1, 4).get(''), [1,4]) +assert.deepEqual(create('[1]').has(0), true) +assert.deepEqual(create('[1]').has(1), false) +assert.deepEqual(create('[1]').get(0), 1) + +// invalid paths +assert.throws(function() { create('[1]').set(null, 4) }, /invalid path type/i) +assert.throws(function() { create('[1]').set({}, 4) }, /invalid path type/i) +assert.throws(function() { create('[1]').set(/./, 4) }, /invalid path type/i) +assert.throws(function() { create('[1]').set(function(){}, 4) }, /invalid path type/i) +assert.throws(function() { create('[1]').set(false, 4) }, /invalid path type/i) +assert.throws(function() { create('[1]').set(undefined, 4) }, /invalid path type/i) + +// set root +assert.strictEqual(create(str).set('', 4).get(''), 4) +assert.strictEqual(create(str).set('', null).get(''), null) +assert.strictEqual(create(str).set('', {x:4}).get('x'), 4) +assert.deepEqual(create(str).set('', [1,2,3]).get(''), [1,2,3]) +assert.strictEqual(create('1').set('', 4).get(''), 4) +assert.strictEqual(create('null').set('', 4).get(''), 4) +assert.strictEqual(create('[]').set('', 4).get(''), 4) +assert.strictEqual(create('{}').set('', 4).get(''), 4) + +// set 1st level +assert.deepEqual(create('{}').set('x', 4).get('x'), 4) +assert.deepEqual(create('{a:{b:[]}}').set('a.b.0', 4).get('a'), {b:[4]}) +//assert.deepEqual(create('1').set('x', 4).get('x'), 4) +//assert.deepEqual(create('null').set('x', 4).get('x'), 4) + +// array: boundaries +assert.strictEqual(create('[]').set('0', 4).get('0'), 4) +assert.strictEqual(create('[1,2,3]').set('2', 4).get('2'), 4) +assert.strictEqual(create('[1,2,3]').set('3', 4).get('3'), 4) + +// various error cases +assert.throws(function() { create('1').set('x', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('null').set('x', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('[]').set('x', 4) }, /set key .* of an array/) +assert.throws(function() { create('""').set('x', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('{}').set('x.x.x', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('1').set('1', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('null').set('1', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('""').set('1', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('[]').set('-1', 4) }, /set key .* of an array/) +assert.throws(function() { create('[]').set('1', 4) }, /set key .* out of bounds/) +assert.throws(function() { create('[1,2,3]').set('4', 4) }, /set key .* out of bounds/) +assert.throws(function() { create('{a:{b:[]}}').set('a.b.x', 4) }, /set key .* of an array/) + +// unsetting stuff +assert.throws(function() { create('[]').unset('') }, /can't remove root document/) + +// arrays: handling spaces correctly +assert.equal(create("[]").set(0,{})+"", '[{}]') +assert.equal(create("[0]").set(1,{})+"", '[0,{}]') +assert.equal(create("[0,]").set(1,{})+"", '[0,{},]') +assert.equal(create("[ ]").set(0,{})+"", '[{} ]') +assert.equal(create("[ 0 , ]").set(1,{})+"", '[ 0 , {}, ]') +assert.equal(create("[ 0 ]").set(1,{})+"", '[ 0, {} ]') +assert.equal(create("{}").set('y',{})+"", '{"y":{}}') +assert.equal(create("{x:1}").set('y',{})+"", '{x:1,y:{}}') +assert.equal(create("{x:1,}").set('y',{})+"", '{x:1,y:{},}') +assert.equal(create("{ }").set('y',{})+"", '{"y":{} }') +assert.equal(create("{ x:1 , }").set('y',{})+"", '{ x:1 , y:{}, }') +assert.equal(create("{ x:1 }").set('y',{})+"", '{ x:1, y:{} }') + +// deleting elements +assert.throws(function() { create('[]').unset('0') }, /unset key .* out of bounds/) +assert.throws(function() { create('[1,2]').unset('2') }, /unset key .* out of bounds/) +assert.throws(function() { create('[1,2,3]').unset('0') }, /in the middle of an array/) + +// CommonJS assert spec is "awesome" +assert.deepEqual(create('[1,2]').unset('1').get(''), [1]) +assert.deepEqual(create('[1,2]').unset('1').get('').length, 1) +assert.deepEqual(create('[1,2,3]').unset('2').unset('1').get(''), [1]) +assert.deepEqual(create('[1,2,3]').unset('2').unset('1').get('').length, 1) +assert.deepEqual(create('[1]').unset('0').get(''), []) +assert.deepEqual(create('[1]').unset('0').get('').length, 0) + +assert.deepEqual(create('{x:{y:"z"}, z:4}').unset('x').get(''), {z:4}) +assert.throws(function() { create('[1,2]').unset('') }, /root/) + +// getting crazy +//assert.deepEqual(create(str).set('a.b.c.d.e', 1).get('a'), {b:{c:{d:{e:1}}}}) + +// update: arrays +assert.deepEqual(create("[1]").update([2,3])+"", '[2,3]') +assert.deepEqual(create("[1]").update([2,3,4])+"", '[2,3,4]') +assert.deepEqual(create("[]").update([2])+"", '[2]') +assert.deepEqual(create("[2]").update([])+"", '[]') +assert.deepEqual(create("[2,3,4]").update([2,3])+"", '[2,3]') +assert.deepEqual(create("[2,3,4]").update([])+"", '[]') +assert.deepEqual(create("[]").update([2,3,4])+"", '[2,3,4]') +assert.deepEqual(create(" /*zz*/ [ 2 , 3 , 4 ] /*xx*/ ").update([])+"", ' /*zz*/ [ ] /*xx*/ ') +assert.deepEqual(create(" /*zz*/ [ ] /*xx*/ ").update([2,3,4])+"", ' /*zz*/ [2,3,4 ] /*xx*/ ') + +// update: objects +assert.deepEqual(create("{x:1}").update({x:1,y:2,z:3})+"", '{x:1,y:2,z:3}') +assert.deepEqual(create("{x:1}").update({x:2,z:3,t:4})+"", '{x:2,z:3,t:4}') +assert.deepEqual(create("{}").update({x:1,y:2})+"", '{"x":1,"y":2}') +assert.deepEqual(create("{x:1}").update({})+"", '{}') +assert.deepEqual(create("{x:1,y:2}").update({x:1})+"", '{x:1}') +assert.deepEqual(create(" /*zz*/ { x /*a*/ : /*b*/ 2 , y:3 , z //\n: 4 } /*xx*/ ").update({})+"", ' /*zz*/ { } /*xx*/ ') +assert.deepEqual(create(" /*zz*/ { } /*xx*/ ").update({x: 2, y: 3, z: 4})+"", ' /*zz*/ {"x":2,"y":3,"z":4 } /*xx*/ ') + +// remove trailing comma +assert.deepEqual(create("{x:1,}").update({})+"", '{}') +assert.deepEqual(create("[0,]").update([])+"", '[]') +assert.deepEqual(create("[0 /*z*/ , /*z*/]").update([])+"", '[ /*z*/]') + +// mode +assert.equal(create('{"test":123}', {mode:'json'}).update({q:1,w:2})+'', '{"q":1,"w":2}') + +assert.equal(create('{1:2}').update({ a: 1, b: [1,2], c: 3})+'', '{a:1,b:[1,2],c:3}') + +// undef +//assert.throws(function(){ jju.update(undefined, undefined) }, /root doc/) +assert.equal(jju.update(undefined, undefined), '') +assert.equal(jju.update(undefined, 42), '42') +assert.equal(jju.update(undefined, {x: 5}), '{"x":5}') + +/* + * real test + */ +var upd = { name: 'yapm', + version: '0.6.0', + description: 'npm wrapper allowing to use package.yaml instead of package.json', + author: { name: 'Alex Kocharin', email: 'alex@kocharin.ru' }, + keywords: + [ 'package manager', + 'modules', + 'install', + 'package.yaml', + 'package.json5', + 'yaml', + 'json5', + 'npm' ], + preferGlobal: true, + homepage: 'https://npmjs.org/doc/', + repository: { type: 'git', url: 'https://github.com/rlidwka/yapm' }, + bugs: { url: 'http://github.com/rlidwka/yapm/issues' }, + main: './yapm.js', + bin: { yapm: './yapm.js' }, + dependencies: { npm: '*', 'js-yaml': '*', through: '*', 'json5-utils': '*' }, + devDependencies: { async: '*' }, + optionalDependencies: { 'yaml-update': '*' }, + test_nonascii: 'тест' } + +assert.deepEqual(create(create('{"garbage":"garbage"}').update(upd)).get(''), upd) +assert.deepEqual(JSON.parse(create('{"garbage":"garbage"}', {mode:'json',legacy:true}).update(upd)), upd) + +//console.log(create('{"garbage":"garbage"}').update(upd)+'') + +//assert.deepEqual(create(" [ ] //").set(0,{})+"" [ ,{}] // + + +//node -e 'console.log(require("./document").Document("{}").set("",[1,2,3])+"")'[1, 2, 3] + +//alex@elu:~/json5-utils/lib$ node -e 'console.log(require("./document").Document("[]").set("0",[1,2,3]).get(""))' +//[ [ 1, 2, 3 ] ] + + +/*assert.equal(create('"test"').get(''), 'test') +assert.equal(create('"test"').get([]), 'test') +assert.equal(create('"test"').get(false), 'test') +assert.equal(create(undefined).get(''), undefined) + +//assert.equal(create('"test"').set('', 'foo').toString(), '"foo"') +*/ diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_errors.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_errors.js new file mode 100644 index 0000000000..b88fcd3892 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_errors.js @@ -0,0 +1,55 @@ +var assert = require('assert') +var parse = require('../').parse + +function addTest(arg, row, col, errRegExp) { + var fn = function() { + try { + parse(arg) + } catch(err) { + if (row !== undefined) assert.equal(err.row, row, 'wrong row: ' + err.row) + if (col !== undefined) assert.equal(err.column, col, 'wrong column: ' + err.column) + if (errRegExp) assert(errRegExp.exec(err.message)) + return + } + throw Error("no error") + } + + if (typeof(describe) === 'function') { + it('test_errors: ' + JSON.stringify(arg), fn) + } else { + fn() + } +} + +// semicolon will be unexpected, so it indicates an error position +addTest(';', 1, 1) +addTest('\n\n\n;', 4, 1) +addTest('\r\n;', 2, 1) +addTest('\n\r;', 3, 1) +addTest('\n\u2028;', 3, 1) +addTest('\n\u2029;', 3, 1) +addTest('[\n1\n,\n;', 4, 1) +addTest('{\n;', 2, 1) +addTest('{\n1\n:\n;', 4, 1) +addTest('.e3', 1, 3, /"\.e3"/) + +// line continuations +addTest('["\\\n",\n;', 3, 1) +addTest('["\\\r\n",\n;', 3, 1) +addTest('["\\\u2028",\n;', 3, 1) +addTest('["\\\u2029",\n;', 3, 1) + +// bareword rewind +addTest('nulz', 1, 1) + +// no data +addTest(' ', 1, 3, /No data.*whitespace/) +addTest('blah', 1, 1, /Unexpected token 'b'/) +addTest('', 1, 1, /No data.*empty input/) + +try { + parse('{{{{{{{{{') +} catch(err) { + var x = err.stack.match(/parseObject/g) + assert(!x || x.length < 2, "shouldn't blow up the stack with internal calls") +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_parse.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_parse.js new file mode 100644 index 0000000000..c539cc7858 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_parse.js @@ -0,0 +1,170 @@ +var assert = require('assert') +var parse = require('../').parse + +function addTest(arg, bulk) { + function fn_json5() { + //console.log('testing: ', arg) + try { + var x = parse(arg) + } catch(err) { + x = 'fail' + } + try { + var z = eval('(function(){"use strict"\nreturn ('+String(arg)+'\n)\n})()') + } catch(err) { + z = 'fail' + } + assert.deepEqual(x, z) + } + + function fn_strict() { + //console.log('testing: ', arg) + try { + var x = parse(arg, {mode: 'json'}) + } catch(err) { + x = 'fail' + } + try { + var z = JSON.parse(arg) + } catch(err) { + z = 'fail' + } + assert.deepEqual(x, z) + } + + if (typeof(describe) === 'function' && !bulk) { + it('test_parse_json5: ' + JSON.stringify(arg), fn_json5) + it('test_parse_strict: ' + JSON.stringify(arg), fn_strict) + } else { + fn_json5() + fn_strict() + } +} + +addTest('"\\uaaaa\\u0000\\uFFFF\\uFaAb"') +addTest(' "\\xaa\\x00\xFF\xFa\0\0" ') +addTest('"\\\'\\"\\b\\f\\t\\n\\r\\v"') +addTest('"\\q\\w\\e\\r\\t\\y\\\\i\\o\\p\\[\\/\\\\"') +addTest('"\\\n\\\r\n\\\n"') +addTest('\'\\\n\\\r\n\\\n\'') +addTest(' null') +addTest('true ') +addTest('false') +addTest(' Infinity ') +addTest('+Infinity') +addTest('[]') +addTest('[ 0xA2, 0X024324AaBf]') +addTest('-0x12') +addTest(' [1,2,3,4,5]') +addTest('[1,2,3,4,5,] ') +addTest('[1e-13]') +addTest('[null, true, false]') +addTest(' [1,2,"3,4,",5,]') +addTest('[ 1,\n2,"3,4," \r\n,\n5,]') +addTest('[ 1 , 2 , 3 , 4 , 5 , ]') +addTest('{} ') +addTest('{"2":1,"3":null,}') +addTest('{ "2 " : 1 , "3":null , }') +addTest('{ \"2\" : 25e245 , \"3\": 23 }') +addTest('{"2":1,"3":nul,}') +addTest('{:1,"3":nul,}') +addTest('[1,2] // ssssssssss 3,4,5,] ') +addTest('[1,2 , // ssssssssss \n//xxx\n3,4,5,] ') +addTest('[1,2 /* ssssssssss 3,4,*/ /* */ , 5 ] ') +addTest('[1,2 /* ssssssssss 3,4,*/ /* * , 5 ] ') +addTest('{"3":1,"3":,}') +addTest('{ чйуач:1, щцкшчлм : 4,}') +addTest('{ qef-:1 }') +addTest('{ $$$:1 , ___: 3}') +addTest('{3:1,2:1}') +addTest('{3.4e3:1}') +addTest('{-3e3:1}') +addTest('{+3e3:1}') +addTest('{.3e3:1}') + +for (var i=0; i<200; i++) { + addTest('"' + String.fromCharCode(i) + '"', true) +} + +// strict JSON test cases +addTest('"\\xaa"') +addTest('"\\0"') +addTest('"\0"') +addTest('"\\v"') +addTest('{null: 123}') +addTest("{'null': 123}") + +assert.throws(function() { + parse('0o') +}) + +assert.strictEqual(parse('01234567'), 342391) +assert.strictEqual(parse('0o1234567'), 342391) + +// undef +assert.strictEqual(parse(undefined), undefined) + +// whitespaces +addTest('[1,\r\n2,\r3,\n]') +'\u0020\u00A0\uFEFF\x09\x0A\x0B\x0C\x0D\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000'.split('').forEach(function(x) { + addTest(x+'[1,'+x+'2]'+x) + addTest('"'+x+'"'+x) +}) +'\u000A\u000D\u2028\u2029'.split('').forEach(function(x) { + addTest(x+'[1,'+x+'2]'+x) + addTest('"\\'+x+'"'+x) +}) + +/* weird ES6 stuff, not working + +if (process.version > 'v0.11.7') { + assert(Array.isArray(parse('{__proto__:[]}').__proto__)) + assert.equal(parse('{__proto__:{xxx:5}}').xxx, undefined) + assert.equal(parse('{__proto__:{xxx:5}}').__proto__.xxx, 5) + + var o1 = parse('{"__proto__":[]}') + assert.deepEqual([], o1.__proto__) + assert.deepEqual(["__proto__"], Object.keys(o1)) + assert.deepEqual([], Object.getOwnPropertyDescriptor(o1, "__proto__").value) + assert.deepEqual(["__proto__"], Object.getOwnPropertyNames(o1)) + assert(o1.hasOwnProperty("__proto__")) + assert(Object.prototype.isPrototypeOf(o1)) + + // Parse a non-object value as __proto__. + var o2 = JSON.parse('{"__proto__":5}') + assert.deepEqual(5, o2.__proto__) + assert.deepEqual(["__proto__"], Object.keys(o2)) + assert.deepEqual(5, Object.getOwnPropertyDescriptor(o2, "__proto__").value) + assert.deepEqual(["__proto__"], Object.getOwnPropertyNames(o2)) + assert(o2.hasOwnProperty("__proto__")) + assert(Object.prototype.isPrototypeOf(o2)) +}*/ + +assert.throws(parse.bind(null, "{-1:42}")) + +for (var i=0; i<100; i++) { + var str = '-01.e'.split('') + + var rnd = [1,2,3,4,5].map(function(x) { + x = ~~(Math.random()*str.length) + return str[x] + }).join('') + + try { + var x = parse(rnd) + } catch(err) { + x = 'fail' + } + try { + var y = JSON.parse(rnd) + } catch(err) { + y = 'fail' + } + try { + var z = eval(rnd) + } catch(err) { + z = 'fail' + } + //console.log(rnd, x, y, z) + if (x !== y && x !== z) throw 'ERROR' +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_portable.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_portable.js new file mode 100644 index 0000000000..bf24aa68b3 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_portable.js @@ -0,0 +1,59 @@ +var assert = require('assert') +var FS = require('fs') +var YAML = require('js-yaml') +var jju = require('../') + +function addTest(name, fn) { + if (typeof(describe) === 'function') { + it(name, fn) + } else { + fn() + } +} + +var schema = YAML.Schema.create([ + new YAML.Type('!error', { + kind: 'scalar', + resolve: function (state) { + //state.result = null + return true + }, + }) +]) + +var tests = YAML.safeLoad(FS.readFileSync(__dirname + '/portable-json5-tests.yaml', 'utf8'), { + schema: schema +}) + +if (!Object.is) { + Object.defineProperty(Object, 'is', { + value: function(x, y) { + if (x === y) { + return x !== 0 || 1 / x === 1 / y; + } + return x !== x && y !== y; + }, + configurable: true, + enumerable: false, + writable: true, + }) +} + +for (var k in tests) { + ;(function(k) { + addTest(k, function() { + try { + var result = jju.parse(tests[k].input) + } catch(err) { + result = null + } + + // need deepStrictEqual + if (typeof(result) === 'object') { + assert.deepEqual(result, tests[k].output) + } else { + assert(Object.is(result, tests[k].output), String(result) + ' == ' + tests[k].output) + } + }) + })(k) +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_stringify.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_stringify.js new file mode 100644 index 0000000000..c97e38e93c --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_stringify.js @@ -0,0 +1,89 @@ +var assert = require('assert') +var parse = require('../').parse +var stringify = require('../').stringify + +function deepEqual(x, y) { + if (Number.isNaN(x)) { + return assert(Number.isNaN(y)) + } + assert.deepEqual(x, y) +} + +function addTest(arg, arg2, arg3) { + function fn() { + deepEqual(parse(stringify(arg)), arg2 === undefined ? arg : arg2) + if (arg !== undefined) deepEqual(JSON.parse(stringify(arg, {mode: 'json', indent: false})), (arg3 === undefined ? (arg2 === undefined ? arg : arg2) : arg3)) + } + + if (typeof(describe) === 'function') { + it('test_stringify: ' + JSON.stringify(arg), fn) + } else { + fn() + } +} + +addTest(0) +addTest(-0) +addTest(NaN, undefined, null) +addTest(Infinity, undefined, null) +addTest(-Infinity, undefined, null) +addTest(123) +addTest(19508130958019385.135135) +addTest(-2e123) +addTest(null) +addTest(undefined) +addTest([]) +addTest([,,,,,,,], [null,null,null,null,null,null,null]) +addTest([undefined,null,1,2,3,], [null,null,1,2,3]) +addTest([[[[]]],[[]]]) +addTest({}) +addTest({1:2,3:4}) +addTest({1:{1:{1:{1:4}}}, 3:4}) +addTest({1:undefined, 3:undefined}, {}) +addTest(new Number(4), 4) +addTest(new Boolean(true), true) +addTest(new String('xqefxef'), 'xqefxef') +addTest(new Boolean(), false) + +var r='';for (var i=0; i<5000; i++) {r+=String.fromCharCode(i)} +addTest(r) + +assert.equal("[1, 2, 3]", stringify([1, 2, 3], {indent: 1})) +assert.equal("[1, 2, 3]", stringify([1, 2, 3], {indent: 2})) + +var oddball = Object(42) +oddball.__proto__ = { __proto__: null } +assert.equal('{}', stringify(oddball)) + +/* this WILL throw +var falseNum = Object("37") +falseNum.__proto__ = Number.prototype +assert.equal("{0: '3', 1: '7'}", stringify(falseNum))*/ + +assert.equal(stringify(Infinity), 'Infinity') +assert.equal(stringify(Infinity, {mode: 'json'}), 'null') +assert.equal(stringify(NaN), 'NaN') +assert.equal(stringify(NaN, {mode: 'json'}), 'null') +assert.equal(stringify(-0), '-0') + +assert.equal(stringify('test', null), "'test'") + +var array = [""] +var expected = "''" +for (var i = 0; i < 1000; i++) { + array.push("") + expected = "''," + expected +} +expected = '[' + expected + ']' +assert.equal(expected, stringify(array, {indent: false})) + +assert.strictEqual(stringify([1,2,3], function(){}), undefined) + +// don't stringify prototype +assert.equal('{a: 1}', stringify({a:1,__proto__:{b:2}})) + +// sort keys tests +assert.equal('{a: 1, b: 2, z: 3}', stringify({b:2,a:1,z:3}, {sort_keys: 1})) +assert.equal('{a: 1, b: {a: 2, b: 5, c: 1}, z: 3}', stringify({b:{c:1,a:2,b:5},a:1,z:3}, {sort_keys: 1})) +assert.equal('{a: [3, 5, 1], b: 2, z: 3}', stringify({b:2,a:[3,5,1],z:3}, {sort_keys: 1})) +assert.equal('{b: 2, a: 1, z: 3}', stringify({b:2,a:1,z:3}, {sort_keys: 0})) diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_tokenize.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_tokenize.js new file mode 100644 index 0000000000..02726154ae --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_tokenize.js @@ -0,0 +1,98 @@ +var assert = require('assert') +var parse = require('../').parse + +function tokenize(arg) { + var result = [] + parse(arg, {_tokenize: function(smth) { + result.push(smth) + }}) + assert.deepEqual(result.map(function(x){return x.raw}).join(''), arg) + return result +} + +function addTest(x, exp) { + function fn(){assert.deepEqual(tokenize(x), exp)} + + if (typeof(describe) === 'function') { + it('test_tokenize: ' + JSON.stringify(x), fn) + } else { + fn() + } +} + +addTest('123', [ { raw: '123', value: 123, type: 'literal', stack: [] }]) + +addTest(' /* zz */\r\n true /* zz */\n', +[ { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '/* zz */', type: 'comment', stack: [] }, + { raw: '\r\n', type: 'newline', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: 'true', type: 'literal', value: true, stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '/* zz */', type: 'comment', stack: [] }, + { raw: '\n', type: 'newline', stack: [] } ]) + +addTest('{q:123, w : /*zz*/\n\r 345 } ', +[ { raw: '{', type: 'separator', stack: [] }, + { raw: 'q', type: 'key', value: 'q', stack: [] }, + { raw: ':', type: 'separator', stack: [] }, + { raw: '123', type: 'literal', value: 123, stack: ['q'] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: 'w', type: 'key', value: 'w', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: ':', type: 'separator', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '/*zz*/', type: 'comment', stack: [] }, + { raw: '\n', type: 'newline', stack: [] }, + { raw: '\r', type: 'newline', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '345', type: 'literal', value: 345, stack: ['w'] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '}', type: 'separator', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] } ]) + +addTest('null /* */// xxx\n//xxx', +[ { raw: 'null', type: 'literal', value: null, stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '/* */', type: 'comment', stack: [] }, + { raw: '// xxx', type: 'comment', stack: [] }, + { raw: '\n', type: 'newline', stack: [] }, + { raw: '//xxx', type: 'comment', stack: [] } ]) + +addTest('[1,2,[[],[1]],{},{1:2},{q:{q:{}}},]', +[ { raw: '[', type: 'separator', stack: [] }, + { raw: '1', type: 'literal', value: 1, stack: [0] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: '2', type: 'literal', value: 2, stack: [1] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: '[', type: 'separator', stack: [2] }, + { raw: '[', type: 'separator', stack: [2,0] }, + { raw: ']', type: 'separator', stack: [2,0] }, + { raw: ',', type: 'separator', stack: [2] }, + { raw: '[', type: 'separator', stack: [2,1] }, + { raw: '1', type: 'literal', value: 1, stack: [2,1,0] }, + { raw: ']', type: 'separator', stack: [2,1] }, + { raw: ']', type: 'separator', stack: [2] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: '{', type: 'separator', stack: [3] }, + { raw: '}', type: 'separator', stack: [3] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: '{', type: 'separator', stack: [4] }, + { raw: '1', type: 'key', value: 1, stack: [4] }, + { raw: ':', type: 'separator', stack: [4] }, + { raw: '2', type: 'literal', value: 2, stack: [4,'1'] }, + { raw: '}', type: 'separator', stack: [4] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: '{', type: 'separator', stack: [5] }, + { raw: 'q', type: 'key', value: 'q', stack: [5] }, + { raw: ':', type: 'separator', stack: [5] }, + { raw: '{', type: 'separator', stack: [5,'q'] }, + { raw: 'q', type: 'key', value: 'q', stack: [5,'q'] }, + { raw: ':', type: 'separator', stack: [5,'q'] }, + { raw: '{', type: 'separator', stack: [5,'q','q'] }, + { raw: '}', type: 'separator', stack: [5,'q','q'] }, + { raw: '}', type: 'separator', stack: [5,'q'] }, + { raw: '}', type: 'separator', stack: [5] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: ']', type: 'separator', stack: [] } ]) diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_updates.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_updates.js new file mode 100644 index 0000000000..560f33692a --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_updates.js @@ -0,0 +1,21 @@ +var assert = require('assert') +var FS = require('fs') +var YAML = require('js-yaml') +var jju = require('../') + +function addTest(name, fn) { + if (typeof(describe) === 'function') { + it(name, fn) + } else { + fn() + } +} + +FS.readdirSync(__dirname + '/update').filter(function(file) { + return file.match(/^[^\.].*\.yaml$/) +}).forEach(function(file) { + addTest('update: ' + file, function() { + var test = YAML.load(FS.readFileSync(__dirname + '/update/' + file, 'utf8')) + assert.strictEqual(test.test(jju, test.input), test.output) + }) +}) diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/author.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/author.yaml new file mode 100644 index 0000000000..b991dc9a0d --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/author.yaml @@ -0,0 +1,30 @@ +input: | + { "name": "just-a-demo", + "version": "0.1.2", + "description": "blahblahblah", + "main": "test.js", + "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, + "author": "John Doe ", + "license": "BSD-2-Clause" } + +output: | + { "name": "just-a-demo", + "version": "0.1.2", + "description": "blahblahblah", + "main": "test.js", + "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, + "author": { + "name": "John Doe", + "email": "whoever@google.com" + }, + "license": "BSD-2-Clause" } + +test: !!js/function | + function(jju, input) { + obj = jju.parse(input) + obj.author = { + name: 'John Doe', + email: 'whoever@google.com', + } + return jju.update(input, obj) + } diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/deep-object.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/deep-object.yaml new file mode 100644 index 0000000000..1bc1681c88 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/deep-object.yaml @@ -0,0 +1,35 @@ +input: | + { + "foo": { + "bar": { + "baz": { + "quux": "4" + } + } + } + } + +output: | + { + "foo": { + "bar": { + "baz": { + "quux": "4" + }, + "qwe": { + "rty": { + "aaa": { + "bbb": 1 + } + } + } + } + } + } + +test: !!js/function | + function(jju, input) { + obj = jju.parse(input) + obj.foo.bar.qwe = {rty: {aaa: {bbb: 1}}} + return jju.update(input, obj, {mode:'json'}) + } diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/delete.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/delete.yaml new file mode 100644 index 0000000000..c388332138 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/delete.yaml @@ -0,0 +1,35 @@ +input: | + { + "name": "test", + "version": "0.0.0", + "dependencies": { + "foo": "1.2.x", + "bar": ">= 1" + }, + "bundleDependencies": [ + "foo", + "bar" + ], + "license": "BSD-2-Clause" + } + +output: | + { + "name": "test", + "version": "0.0.0", + "dependencies": { + "foo": "1.2.x" + }, + "bundleDependencies": [ + "foo" + ], + "license": "BSD-2-Clause" + } + +test: !!js/function | + function(jju, input) { + obj = jju.parse(input) + obj.bundleDependencies.pop() + delete obj.dependencies.bar + return jju.update(input, obj, {mode:'json'}) + } diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-array.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-array.yaml new file mode 100644 index 0000000000..1a67db77ae --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-array.yaml @@ -0,0 +1,31 @@ +input: | + { + "name": "test", + "version": "0.0.0", + "bundleDependencies": [ + "foo", + "bar" + ], + "license": "BSD-2-Clause" + } + +output: | + { + "name": "test", + "version": "0.0.0", + "bundleDependencies": [ + "foo", + "bar", + "baz", + "quux" + ], + "license": "BSD-2-Clause" + } + +test: !!js/function | + function(jju, input) { + obj = jju.parse(input) + obj.bundleDependencies.push('baz') + obj.bundleDependencies.push('quux') + return jju.update(input, obj, {mode:'json'}) + } diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-object.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-object.yaml new file mode 100644 index 0000000000..1734f738e3 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-object.yaml @@ -0,0 +1,31 @@ +input: | + { + "name": "test", + "version": "0.0.0", + "dependencies": { + "foobar": "*", + "bazquux": ">= 1.1.1" + }, + "license": "BSD-2-Clause" + } + +output: | + { + "name": "test", + "version": "0.0.0", + "dependencies": { + "foobar": "*", + "bazquux": ">= 1.1.1", + "whatever": "1.2.x", + "qwerty": "1" + }, + "license": "BSD-2-Clause" + } + +test: !!js/function | + function(jju, input) { + obj = jju.parse(input) + obj.dependencies.whatever = '1.2.x' + obj.dependencies.qwerty = '1' + return jju.update(input, obj, {mode:'json'}) + } diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/npm-array-bin.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/npm-array-bin.yaml new file mode 100644 index 0000000000..9308007e48 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/npm-array-bin.yaml @@ -0,0 +1,28 @@ +input: | + { "name":"npm-test-array-bin" + , "version":"1.2.5" + , "bin": [ "bin/array-bin" ] + , "scripts": { "test": "node test.js" } } + +# less than ideal, I know... +output: | + { "name":"npm-test-array-bin" + , "version":"1.2.5" + , "bin": {"array-bin":"bin/array-bin"} + , "scripts": { "test": "node test.js" }, "readme": "just an npm test\n", "readmeFilename": "README", "description": "just an npm test", "_id": "npm-test-array-bin@1.2.5", "dist": {"shasum":"9c426a1bd55e98718ab4ddcc01fa57ea83c649f1"}, "_from": "npm-test-array-bin/" } + +test: !!js/function | + function(jju, input) { + obj = + { name: 'npm-test-array-bin', + version: '1.2.5', + bin: { 'array-bin': 'bin/array-bin' }, + scripts: { test: 'node test.js' }, + readme: 'just an npm test\n', + readmeFilename: 'README', + description: 'just an npm test', + _id: 'npm-test-array-bin@1.2.5', + dist: { shasum: '9c426a1bd55e98718ab4ddcc01fa57ea83c649f1' }, + _from: 'npm-test-array-bin/' } + return jju.update(input, obj) + } diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/pkg-json5.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/pkg-json5.yaml new file mode 100644 index 0000000000..5721f41ac7 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/pkg-json5.yaml @@ -0,0 +1,35 @@ +input: | + // vim:syntax=javascript + { + name: 'yapm', + version: '1.1.0-1325', // upstream npm@1.3.25 + description: 'A package manager for node (npm fork)', + } + +output: | + // vim:syntax=javascript + { + name: 'yapm', + version: '1.1.0-1325', // upstream npm@1.3.25 + description: 'A package manager for node (npm fork)', + _id: 'yapm@1.1.0-1325', + dist: { + shasum: 'd5aa31c1ad00c1e7e57e07cea1b22c1806a47111', + }, + _from: './zzz', + } + +test: !!js/function | + function(jju, input) { + var upd = { + "name": "yapm", + "version": "1.1.0-1325", + "description": "A package manager for node (npm fork)", + "_id": "yapm@1.1.0-1325", + "dist": { + "shasum": "d5aa31c1ad00c1e7e57e07cea1b22c1806a47111" + }, + "_from": "./zzz" + } + return jju.update(input, upd) + } diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/package.json b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/package.json new file mode 100644 index 0000000000..9ebc2ff8a6 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/package.json @@ -0,0 +1,61 @@ +{ + "name": "json-parse-helpfulerror", + "version": "1.0.3", + "description": "A drop-in replacement for JSON.parse that uses `jju` to give helpful errors", + "main": "index.js", + "scripts": { + "test": "lab -c", + "lint": "jslint --edition=latest --terse *.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/smikes/json-parse-helpfulerror.git" + }, + "keywords": [ + "json", + "parse", + "line", + "doublequote", + "error" + ], + "author": { + "name": "Sam Mikes", + "email": "smikes@cubane.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/smikes/json-parse-helpfulerror/issues" + }, + "homepage": "https://github.com/smikes/json-parse-helpfulerror", + "devDependencies": { + "code": "^1.2.1", + "jslint": "^0.7.1", + "lab": "^5.1.1" + }, + "dependencies": { + "jju": "^1.1.0" + }, + "gitHead": "eedb116ec96b5c479be3919b526d6de0a521be5e", + "_id": "json-parse-helpfulerror@1.0.3", + "_shasum": "13f14ce02eed4e981297b64eb9e3b932e2dd13dc", + "_from": "json-parse-helpfulerror@>=1.0.2 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "smikes", + "email": "smikes@cubane.com" + }, + "maintainers": [ + { + "name": "smikes", + "email": "smikes@cubane.com" + } + ], + "dist": { + "shasum": "13f14ce02eed4e981297b64eb9e3b932e2dd13dc", + "tarball": "http://registry.npmjs.org/json-parse-helpfulerror/-/json-parse-helpfulerror-1.0.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/json-parse-helpfulerror/-/json-parse-helpfulerror-1.0.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/test/test.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/test/test.js new file mode 100644 index 0000000000..fca458ac08 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/test/test.js @@ -0,0 +1,32 @@ +var Code = require('code'), + Lab = require('lab'), + lab = Lab.script(), + jph = require('..'); // 'json-parse-helpfulerror' + +exports.lab = lab; + +lab.test('can parse', function (done) { + var o = jph.parse('{"foo": "bar"}'); + + Code.expect(o.foo).to.equal('bar'); + done(); +}); + +lab.test('helpful error for bad JSON', function (done) { + + var bad = "{'foo': 'bar'}"; + + Code.expect(function () { JSON.parse(bad) }).to.throw(); + + Code.expect(function () { jph.parse(bad) }).to.throw(SyntaxError, "Unexpected token '\\'' at 1:2\n" + bad + '\n ^'); + + done(); +}); + +lab.test('fails if reviver throws', function (done) { + function badReviver() { throw new ReferenceError('silly'); } + + Code.expect(function () { jph.parse('3', badReviver) }).to.throw(ReferenceError, 'silly'); + + done(); +}); \ No newline at end of file diff --git a/deps/npm/node_modules/read-package-json/package.json b/deps/npm/node_modules/read-package-json/package.json index 3c2ff0ff80..a61555cef7 100644 --- a/deps/npm/node_modules/read-package-json/package.json +++ b/deps/npm/node_modules/read-package-json/package.json @@ -1,6 +1,6 @@ { "name": "read-package-json", - "version": "1.3.1", + "version": "1.3.2", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -19,45 +19,26 @@ "github-url-from-git": "^1.3.0", "github-url-from-username-repo": "~1.0.0", "glob": "^4.0.2", + "json-parse-helpfulerror": "^1.0.2", "lru-cache": "2", "normalize-package-data": "^1.0.0", "graceful-fs": "2 || 3" }, "devDependencies": { - "tap": "~0.2.5" + "tap": "^0.7.1" }, "optionalDependencies": { "graceful-fs": "2 || 3" }, "license": "ISC", - "gitHead": "59011e6b660cf0cc916646a08955c12a8f990174", + "readme": "# read-package-json\n\nThis is the thing that npm uses to read package.json files. It\nvalidates some stuff, and loads some default things.\n\nIt keeps a cache of the files you've read, so that you don't end\nup reading the same package.json file multiple times.\n\nNote that if you just want to see what's literally in the package.json\nfile, you can usually do `var data = require('some-module/package.json')`.\n\nThis module is basically only needed by npm, but it's handy to see what\nnpm will see when it looks at your package.\n\n## Usage\n\n```javascript\nvar readJson = require('read-package-json')\n\n// readJson(filename, [logFunction=noop], [strict=false], cb)\nreadJson('/path/to/package.json', console.error, false, function (er, data) {\n if (er) {\n console.error(\"There was an error reading the file\")\n return\n }\n\n console.error('the package data is', data)\n});\n```\n\n## readJson(file, [logFn = noop], [strict = false], cb)\n\n* `file` {String} The path to the package.json file\n* `logFn` {Function} Function to handle logging. Defaults to a noop.\n* `strict` {Boolean} True to enforce SemVer 2.0 version strings, and\n other strict requirements.\n* `cb` {Function} Gets called with `(er, data)`, as is The Node Way.\n\nReads the JSON file and does the things.\n\n## `package.json` Fields\n\nSee `man 5 package.json` or `npm help json`.\n\n## readJson.log\n\nBy default this is a reference to the `npmlog` module. But if that\nmodule can't be found, then it'll be set to just a dummy thing that does\nnothing.\n\nReplace with your own `{log,warn,error}` object for fun loggy time.\n\n## readJson.extras(file, data, cb)\n\nRun all the extra stuff relative to the file, with the parsed data.\n\nModifies the data as it does stuff. Calls the cb when it's done.\n\n## readJson.extraSet = [fn, fn, ...]\n\nArray of functions that are called by `extras`. Each one receives the\narguments `fn(file, data, cb)` and is expected to call `cb(er, data)`\nwhen done or when an error occurs.\n\nOrder is indeterminate, so each function should be completely\nindependent.\n\nMix and match!\n\n## readJson.cache\n\nThe `lru-cache` object that readJson uses to not read the same file over\nand over again. See\n[lru-cache](https://github.com/isaacs/node-lru-cache) for details.\n\n## Other Relevant Files Besides `package.json`\n\nSome other files have an effect on the resulting data object, in the\nfollowing ways:\n\n### `README?(.*)`\n\nIf there is a `README` or `README.*` file present, then npm will attach\na `readme` field to the data with the contents of this file.\n\nOwing to the fact that roughly 100% of existing node modules have\nMarkdown README files, it will generally be assumed to be Markdown,\nregardless of the extension. Please plan accordingly.\n\n### `server.js`\n\nIf there is a `server.js` file, and there is not already a\n`scripts.start` field, then `scripts.start` will be set to `node\nserver.js`.\n\n### `AUTHORS`\n\nIf there is not already a `contributors` field, then the `contributors`\nfield will be set to the contents of the `AUTHORS` file, split by lines,\nand parsed.\n\n### `bindings.gyp`\n\nIf a bindings.gyp file exists, and there is not already a\n`scripts.install` field, then the `scripts.install` field will be set to\n`node-gyp rebuild`.\n\n### `wscript`\n\nIf a wscript file exists, and there is not already a `scripts.install`\nfield, then the `scripts.install` field will be set to `node-waf clean ;\nnode-waf configure build`.\n\nNote that the `bindings.gyp` file supercedes this, since node-waf has\nbeen deprecated in favor of node-gyp.\n\n### `index.js`\n\nIf the json file does not exist, but there is a `index.js` file\npresent instead, and that file has a package comment, then it will try\nto parse the package comment, and use that as the data instead.\n\nA package comment looks like this:\n\n```javascript\n/**package\n * { \"name\": \"my-bare-module\"\n * , \"version\": \"1.2.3\"\n * , \"description\": \"etc....\" }\n **/\n\n// or...\n\n/**package\n{ \"name\": \"my-bare-module\"\n, \"version\": \"1.2.3\"\n, \"description\": \"etc....\" }\n**/\n```\n\nThe important thing is that it starts with `/**package`, and ends with\n`**/`. If the package.json file exists, then the index.js is not\nparsed.\n\n### `{directories.man}/*.[0-9]`\n\nIf there is not already a `man` field defined as an array of files or a\nsingle file, and\nthere is a `directories.man` field defined, then that directory will\nbe searched for manpages.\n\nAny valid manpages found in that directory will be assigned to the `man`\narray, and installed in the appropriate man directory at package install\ntime, when installed globally on a Unix system.\n\n### `{directories.bin}/*`\n\nIf there is not already a `bin` field defined as a string filename or a\nhash of ` : ` pairs, then the `directories.bin`\ndirectory will be searched and all the files within it will be linked as\nexecutables at install time.\n\nWhen installing locally, npm links bins into `node_modules/.bin`, which\nis in the `PATH` environ when npm runs scripts. When\ninstalling globally, they are linked into `{prefix}/bin`, which is\npresumably in the `PATH` environment variable.\n", + "readmeFilename": "README.md", + "gitHead": "d307d827f1a4f13a3a8bc4d747bb854779ad35c8", "bugs": { "url": "https://github.com/isaacs/read-package-json/issues" }, "homepage": "https://github.com/isaacs/read-package-json", - "_id": "read-package-json@1.3.1", - "_shasum": "5a965f9fc34b25ffa5e0d93b1d0fc063af6d10b0", - "_from": "read-package-json@1.3.1", - "_npmVersion": "2.5.1", - "_nodeVersion": "0.12.0", - "_npmUser": { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - }, - { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" - } - ], - "dist": { - "shasum": "5a965f9fc34b25ffa5e0d93b1d0fc063af6d10b0", - "tarball": "http://registry.npmjs.org/read-package-json/-/read-package-json-1.3.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-1.3.1.tgz" + "_id": "read-package-json@1.3.2", + "_shasum": "5228bc7ad1f33ded75184ece48710036101affa2", + "_from": "read-package-json@>=1.3.2 <1.4.0" } diff --git a/deps/npm/node_modules/read-package-json/read-json.js b/deps/npm/node_modules/read-package-json/read-json.js index 863f8e8e32..98ab9f16d2 100644 --- a/deps/npm/node_modules/read-package-json/read-json.js +++ b/deps/npm/node_modules/read-package-json/read-json.js @@ -14,6 +14,7 @@ readJson.cache = new LRU({max: 1000}) var path = require("path") var glob = require("glob") var normalizeData = require("normalize-package-data") +var jsonparse = require("json-parse-helpfulerror") // put more stuff on here to customize. readJson.extraSet = [ @@ -79,7 +80,7 @@ function parseJson (file, er, d, log, strict, cb) { } if (er) return cb(er); try { - d = JSON.parse(stripBOM(d)) + d = jsonparse.parse(stripBOM(d)) } catch (er) { d = parseIndex(d) if (!d) return cb(parseError(er, file)); @@ -395,7 +396,7 @@ function parseIndex (data) { data = data[0] data = data.replace(/^\s*\*/mg, "") try { - return JSON.parse(data) + return jsonparse.parse(data) } catch (er) { return null } diff --git a/deps/npm/node_modules/read-package-json/test/fixtures/emptybin.json b/deps/npm/node_modules/read-package-json/test/fixtures/emptybin.json index ef926f04d3..5e12ed4e9a 100644 --- a/deps/npm/node_modules/read-package-json/test/fixtures/emptybin.json +++ b/deps/npm/node_modules/read-package-json/test/fixtures/emptybin.json @@ -1,5 +1,5 @@ { - "name": "badbin-test", + "name": "emptybin-test", "description": "my desc", "repository": { "type": "git", diff --git a/deps/npm/node_modules/read-package-json/test/fixtures/erroneous.json b/deps/npm/node_modules/read-package-json/test/fixtures/erroneous.json new file mode 100644 index 0000000000..212e37ec86 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/test/fixtures/erroneous.json @@ -0,0 +1,4 @@ +{ + 'wrong': 'kind', + 'of': 'quotes' +} diff --git a/deps/npm/node_modules/read-package-json/test/helpful.js b/deps/npm/node_modules/read-package-json/test/helpful.js new file mode 100644 index 0000000000..579b558d0c --- /dev/null +++ b/deps/npm/node_modules/read-package-json/test/helpful.js @@ -0,0 +1,17 @@ +// vim: set softtabstop=16 shiftwidth=16: +var tap = require("tap") +var readJson = require("../") +var path = require("path") +var fs = require("fs") +var p = path.resolve(__dirname, "fixtures/erroneous.json") + +var expect = {} + +console.error("readme test") +tap.test("readme test", function (t) { + readJson(p, function (er, data) { + t.ok(er instanceof Error) + t.ok(er.message.match(/Unexpected token '\\''/)) + t.end() + }) +}) diff --git a/deps/npm/node_modules/request/.eslintrc b/deps/npm/node_modules/request/.eslintrc new file mode 100644 index 0000000000..9c3350d6bb --- /dev/null +++ b/deps/npm/node_modules/request/.eslintrc @@ -0,0 +1,22 @@ +{ + "env": { + "node": true + }, + "rules": { + // Disallow semi-colons, unless needed to disambiguate statement + "semi": [2, "never"], + // Require strings to use single quotes + "quotes": [2, "single"], + // Require curly braces for all control statements + "curly": 2, + // Disallow using variables and functions before they've been defined + "no-use-before-define": 2, + // Allow any case for variable naming + "camelcase": 0, + // Disallow unused variables, except as function arguments + "no-unused-vars": [2, {"args":"none"}], + // Allow leading underscores for method names + // REASON: we use underscores to denote private methods + "no-underscore-dangle": 0 + } +} diff --git a/deps/npm/node_modules/request/node_modules/isstream/.jshintrc b/deps/npm/node_modules/request/node_modules/isstream/.jshintrc new file mode 100644 index 0000000000..c8ef3ca409 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/isstream/.jshintrc @@ -0,0 +1,59 @@ +{ + "predef": [ ] + , "bitwise": false + , "camelcase": false + , "curly": false + , "eqeqeq": false + , "forin": false + , "immed": false + , "latedef": false + , "noarg": true + , "noempty": true + , "nonew": true + , "plusplus": false + , "quotmark": true + , "regexp": false + , "undef": true + , "unused": true + , "strict": false + , "trailing": true + , "maxlen": 120 + , "asi": true + , "boss": true + , "debug": true + , "eqnull": true + , "esnext": true + , "evil": true + , "expr": true + , "funcscope": false + , "globalstrict": false + , "iterator": false + , "lastsemic": true + , "laxbreak": true + , "laxcomma": true + , "loopfunc": true + , "multistr": false + , "onecase": false + , "proto": false + , "regexdash": false + , "scripturl": true + , "smarttabs": false + , "shadow": false + , "sub": true + , "supernew": false + , "validthis": true + , "browser": true + , "couch": false + , "devel": false + , "dojo": false + , "mootools": false + , "node": true + , "nonstandard": true + , "prototypejs": false + , "rhino": false + , "worker": true + , "wsh": false + , "nomen": false + , "onevar": false + , "passfail": false +} \ No newline at end of file diff --git a/deps/npm/node_modules/rimraf/AUTHORS b/deps/npm/node_modules/rimraf/AUTHORS deleted file mode 100644 index 247b754373..0000000000 --- a/deps/npm/node_modules/rimraf/AUTHORS +++ /dev/null @@ -1,6 +0,0 @@ -# Authors sorted by whether or not they're me. -Isaac Z. Schlueter (http://blog.izs.me) -Wayne Larsen (http://github.com/wvl) -ritch -Marcel Laverdet -Yosef Dinerstein diff --git a/deps/npm/node_modules/rimraf/README.md b/deps/npm/node_modules/rimraf/README.md index cd123b6524..c178dedc34 100644 --- a/deps/npm/node_modules/rimraf/README.md +++ b/deps/npm/node_modules/rimraf/README.md @@ -1,4 +1,4 @@ -`rm -rf` for node. +The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node. Install with `npm install rimraf`, or just drop rimraf.js somewhere. @@ -10,9 +10,15 @@ The callback will be called with an error if there is one. Certain errors are handled for you: * Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of - `opts.maxBusyTries` times before giving up. + `opts.maxBusyTries` times before giving up, adding 100ms of wait + between each attempt. The default `maxBusyTries` is 3. * `ENOENT` - If the file doesn't exist, rimraf will return successfully, since your desired outcome is already the case. +* `EMFILE` - Since `readdir` requires opening a file descriptor, it's + possible to hit `EMFILE` if too many file descriptors are in use. + In the sync case, there's nothing to be done for this. But in the + async case, rimraf will gradually back off with timeouts up to + `opts.emfileWait` ms, which defaults to 1000. ## rimraf.sync diff --git a/deps/npm/node_modules/rimraf/package.json b/deps/npm/node_modules/rimraf/package.json index 164fc495a4..a257986dea 100644 --- a/deps/npm/node_modules/rimraf/package.json +++ b/deps/npm/node_modules/rimraf/package.json @@ -1,6 +1,6 @@ { "name": "rimraf", - "version": "2.2.8", + "version": "2.3.1", "main": "rimraf.js", "description": "A deep deletion module for node (like `rm -rf`)", "author": { @@ -22,37 +22,25 @@ "bin": { "rimraf": "./bin.js" }, - "contributors": [ - { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - }, - { - "name": "Wayne Larsen", - "email": "wayne@larsen.st", - "url": "http://github.com/wvl" - }, - { - "name": "ritch", - "email": "skawful@gmail.com" - }, - { - "name": "Marcel Laverdet" - }, - { - "name": "Yosef Dinerstein", - "email": "yosefd@microsoft.com" - } + "dependencies": { + "glob": "^4.4.2" + }, + "files": [ + "bin.js", + "rimraf.js", + "LICENSE", + "README.md" ], + "gitHead": "aa707db2fb5b11c35fc614a1472775373dc9d46c", "bugs": { "url": "https://github.com/isaacs/rimraf/issues" }, "homepage": "https://github.com/isaacs/rimraf", - "_id": "rimraf@2.2.8", - "_shasum": "e439be2aaee327321952730f99a8929e4fc50582", - "_from": "rimraf@latest", - "_npmVersion": "1.4.10", + "_id": "rimraf@2.3.1", + "_shasum": "f83df78c168d5daf9f021e8e092e7a165898ee75", + "_from": "rimraf@>=2.3.1 <2.4.0", + "_npmVersion": "2.6.0", + "_nodeVersion": "1.4.2", "_npmUser": { "name": "isaacs", "email": "i@izs.me" @@ -64,10 +52,9 @@ } ], "dist": { - "shasum": "e439be2aaee327321952730f99a8929e4fc50582", - "tarball": "http://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz" + "shasum": "f83df78c168d5daf9f021e8e092e7a165898ee75", + "tarball": "http://registry.npmjs.org/rimraf/-/rimraf-2.3.1.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.3.1.tgz" } diff --git a/deps/npm/node_modules/rimraf/rimraf.js b/deps/npm/node_modules/rimraf/rimraf.js index eb96c46afd..6dffdf0646 100644 --- a/deps/npm/node_modules/rimraf/rimraf.js +++ b/deps/npm/node_modules/rimraf/rimraf.js @@ -4,11 +4,17 @@ rimraf.sync = rimrafSync var assert = require("assert") var path = require("path") var fs = require("fs") +var glob = require("glob") + +var globOpts = { + nosort: true, + nocomment: true, + nonegate: true, + silent: true +} // for EMFILE handling var timeout = 0 -exports.EMFILE_MAX = 1000 -exports.BUSYTRIES_MAX = 3 var isWindows = (process.platform === "win32") @@ -17,6 +23,7 @@ function defaults (options) { 'unlink', 'chmod', 'stat', + 'lstat', 'rmdir', 'readdir' ] @@ -25,6 +32,9 @@ function defaults (options) { m = m + 'Sync' options[m] = options[m] || fs[m] }) + + options.maxBusyTries = options.maxBusyTries || 3 + options.emfileWait = options.emfileWait || 1000 } function rimraf (p, options, cb) { @@ -41,32 +51,54 @@ function rimraf (p, options, cb) { if (!cb) throw new Error("No callback passed to rimraf()") var busyTries = 0 - rimraf_(p, options, function CB (er) { - if (er) { - if (isWindows && (er.code === "EBUSY" || er.code === "ENOTEMPTY") && - busyTries < exports.BUSYTRIES_MAX) { - busyTries ++ - var time = busyTries * 100 - // try again, with the same exact callback as this one. - return setTimeout(function () { - rimraf_(p, options, CB) - }, time) - } + var errState = null + var n = 0 - // this one won't happen if graceful-fs is used. - if (er.code === "EMFILE" && timeout < exports.EMFILE_MAX) { - return setTimeout(function () { - rimraf_(p, options, CB) - }, timeout ++) - } + glob(p, globOpts, afterGlob) - // already gone - if (er.code === "ENOENT") er = null - } + function next (er) { + errState = errState || er + if (--n === 0) + cb(errState) + } - timeout = 0 - cb(er) - }) + function afterGlob (er, results) { + if (er) + return cb(er) + + n = results.length + if (n === 0) + return cb() + + results.forEach(function (p) { + rimraf_(p, options, function CB (er) { + if (er) { + if (isWindows && (er.code === "EBUSY" || er.code === "ENOTEMPTY") && + busyTries < options.maxBusyTries) { + busyTries ++ + var time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(function () { + rimraf_(p, options, CB) + }, time) + } + + // this one won't happen if graceful-fs is used. + if (er.code === "EMFILE" && timeout < options.emfileWait) { + return setTimeout(function () { + rimraf_(p, options, CB) + }, timeout ++) + } + + // already gone + if (er.code === "ENOENT") er = null + } + + timeout = 0 + next(er) + }) + }) + } } // Two possible strategies. @@ -85,18 +117,28 @@ function rimraf_ (p, options, cb) { assert(options) assert(typeof cb === 'function') - options.unlink(p, function (er) { - if (er) { - if (er.code === "ENOENT") - return cb(null) - if (er.code === "EPERM") - return (isWindows) - ? fixWinEPERM(p, options, er, cb) - : rmdir(p, options, er, cb) - if (er.code === "EISDIR") - return rmdir(p, options, er, cb) - } - return cb(er) + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, function (er, st) { + if (er && er.code === "ENOENT") + return cb(null) + + if (st && st.isDirectory()) + return rmdir(p, options, er, cb) + + options.unlink(p, function (er) { + if (er) { + if (er.code === "ENOENT") + return cb(null) + if (er.code === "EPERM") + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + if (er.code === "EISDIR") + return rmdir(p, options, er, cb) + } + return cb(er) + }) }) } @@ -207,16 +249,35 @@ function rimrafSync (p, options) { assert(p) assert(options) - try { - options.unlinkSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - if (er.code === "EPERM") - return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) - if (er.code !== "EISDIR") - throw er - rmdirSync(p, options, er) + var results = glob.sync(p, globOpts) + if (!results.length) + return + + for (var i = 0; i < results.length; i++) { + var p = results[i] + + try { + var st = options.lstatSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + } + + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) + rmdirSync(p, options, null) + else + options.unlinkSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "EPERM") + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + if (er.code !== "EISDIR") + throw er + rmdirSync(p, options, er) + } } } diff --git a/deps/npm/node_modules/rimraf/test/run.sh b/deps/npm/node_modules/rimraf/test/run.sh deleted file mode 100644 index 653ff9b798..0000000000 --- a/deps/npm/node_modules/rimraf/test/run.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -e -code=0 -for i in test-*.js; do - echo -n $i ... - bash setup.sh - node $i - if [ -d target ]; then - echo "fail" - code=1 - else - echo "pass" - fi -done -rm -rf target -exit $code diff --git a/deps/npm/node_modules/rimraf/test/setup.sh b/deps/npm/node_modules/rimraf/test/setup.sh deleted file mode 100644 index 2602e63160..0000000000 --- a/deps/npm/node_modules/rimraf/test/setup.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -set -e - -files=10 -folders=2 -depth=4 -target="$PWD/target" - -rm -rf target - -fill () { - local depth=$1 - local files=$2 - local folders=$3 - local target=$4 - - if ! [ -d $target ]; then - mkdir -p $target - fi - - local f - - f=$files - while [ $f -gt 0 ]; do - touch "$target/f-$depth-$f" - let f-- - done - - let depth-- - - if [ $depth -le 0 ]; then - return 0 - fi - - f=$folders - while [ $f -gt 0 ]; do - mkdir "$target/folder-$depth-$f" - fill $depth $files $folders "$target/d-$depth-$f" - let f-- - done -} - -fill $depth $files $folders $target - -# sanity assert -[ -d $target ] diff --git a/deps/npm/node_modules/rimraf/test/test-async.js b/deps/npm/node_modules/rimraf/test/test-async.js deleted file mode 100644 index 9c2e0b7be0..0000000000 --- a/deps/npm/node_modules/rimraf/test/test-async.js +++ /dev/null @@ -1,5 +0,0 @@ -var rimraf = require("../rimraf") - , path = require("path") -rimraf(path.join(__dirname, "target"), function (er) { - if (er) throw er -}) diff --git a/deps/npm/node_modules/rimraf/test/test-sync.js b/deps/npm/node_modules/rimraf/test/test-sync.js deleted file mode 100644 index eb71f10476..0000000000 --- a/deps/npm/node_modules/rimraf/test/test-sync.js +++ /dev/null @@ -1,3 +0,0 @@ -var rimraf = require("../rimraf") - , path = require("path") -rimraf.sync(path.join(__dirname, "target")) diff --git a/deps/npm/package.json b/deps/npm/package.json index 9a7a13b33d..a73503cb18 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "2.7.0", + "version": "2.7.1", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -53,7 +53,7 @@ "fstream-npm": "~1.0.1", "github-url-from-git": "~1.4.0", "github-url-from-username-repo": "~1.0.2", - "glob": "~4.4.1", + "glob": "~4.4.2", "graceful-fs": "~3.0.5", "inflight": "~1.0.4", "inherits": "~2.0.1", @@ -79,12 +79,12 @@ "path-is-inside": "~1.0.0", "read": "~1.0.4", "read-installed": "~3.1.5", - "read-package-json": "~1.3.1", + "read-package-json": "~1.3.2", "readable-stream": "~1.0.33", "realize-package-specifier": "~1.3.0", "request": "~2.53.0", "retry": "~0.6.1", - "rimraf": "~2.2.8", + "rimraf": "~2.3.1", "semver": "~4.3.1", "sha": "~1.3.0", "slide": "~1.1.6", @@ -167,7 +167,7 @@ "devDependencies": { "marked": "~0.3.3", "marked-man": "~0.1.4", - "nock": "~0.59.0", + "nock": "~1.1.0", "npm-registry-couchapp": "~2.6.2", "npm-registry-mock": "~1.0.0", "require-inject": "~1.1.0", @@ -179,7 +179,7 @@ "test": "tap --timeout 120 test/tap/*.js", "tap": "tap --timeout 120 test/tap/*.js", "test-all": "node ./test/run.js && tap test/tap/*.js", - "prepublish": "node bin/npm-cli.js prune --prefix=. --no-global && rm -rf test/*/*/node_modules && make -j8 doc", + "prepublish": "node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j8 doc", "dumpconf": "env | grep npm | sort | uniq" }, "license": "Artistic-2.0" diff --git a/deps/npm/test/tap/add-remote-git-fake-windows.js b/deps/npm/test/tap/add-remote-git-fake-windows.js index 3052477927..b665f752ac 100644 --- a/deps/npm/test/tap/add-remote-git-fake-windows.js +++ b/deps/npm/test/tap/add-remote-git-fake-windows.js @@ -58,7 +58,7 @@ var pjParent = JSON.stringify({ name : "parent", version : "1.2.3", dependencies : { - "child" : "git://localhost:1234/child.git" + "child" : "git://localhost:1233/child.git" } }, null, 2) + "\n" @@ -93,7 +93,7 @@ function setup (cb) { "--listen=localhost", "--export-all", "--base-path=.", - "--port=1234" + "--port=1233" ], { cwd : pkg, diff --git a/deps/npm/test/tap/add-remote-git-shrinkwrap.js b/deps/npm/test/tap/add-remote-git-shrinkwrap.js new file mode 100644 index 0000000000..555dca2131 --- /dev/null +++ b/deps/npm/test/tap/add-remote-git-shrinkwrap.js @@ -0,0 +1,171 @@ +var fs = require('fs') +var resolve = require('path').resolve + +var chain = require('slide').chain +var osenv = require('osenv') +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') +var test = require('tap').test + +var npm = require('../../lib/npm.js') +var common = require('../common-tap.js') + +var pkg = resolve(__dirname, 'add-remote-git-shrinkwrap') +var repo = resolve(__dirname, 'add-remote-git-shrinkwrap-repo') + +var daemon +var daemonPID +var git + +test('setup', function (t) { + bootstrap() + setup(function (er, r) { + t.ifError(er, 'git started up successfully') + + if (!er) { + daemon = r[r.length - 2] + daemonPID = r[r.length - 1] + } + + t.end() + }) +}) + +test('install from repo', function (t) { + process.chdir(pkg) + npm.commands.install('.', [], function (er) { + t.ifError(er, 'npm installed via git') + + t.end() + }) +}) + +test('shrinkwrap gets correct _from and _resolved (#7121)', function (t) { + common.npm( + [ + 'shrinkwrap', + '--loglevel', 'silent' + ], + { cwd: pkg }, + function (er, code, stdout, stderr) { + t.ifError(er, 'npm shrinkwrapped without errors') + t.notOk(code, '`npm shrinkwrap` exited with 0') + t.equal(stdout.trim(), 'wrote npm-shrinkwrap.json') + t.notOk(stderr, 'no error output on successful shrinkwrap') + + var shrinkwrap = require(resolve(pkg, 'npm-shrinkwrap.json')) + t.equal( + shrinkwrap.dependencies.child.from, + 'git://localhost:1235/child.git#master', + 'npm shrinkwrapped from correctly' + ) + + git.whichAndExec( + ['rev-list', '-n1', 'master'], + { cwd: repo, env: process.env }, + function (er, stdout, stderr) { + t.ifErr(er, 'git rev-list ran without error') + t.notOk(stderr, 'no error output') + var treeish = stdout.trim() + + t.equal( + shrinkwrap.dependencies.child.resolved, + 'git://localhost:1235/child.git#' + treeish, + 'npm shrinkwrapped resolved correctly' + ) + + t.end() + } + ) + } + ) +}) + +test('clean', function (t) { + daemon.on('close', function () { + cleanup() + t.end() + }) + process.kill(daemonPID) +}) + +var pjParent = JSON.stringify({ + name: 'parent', + version: '1.2.3', + dependencies: { + 'child': 'git://localhost:1235/child.git#master' + } +}, null, 2) + '\n' + +var pjChild = JSON.stringify({ + name: 'child', + version: '1.0.3' +}, null, 2) + '\n' + +function bootstrap () { + mkdirp.sync(pkg) + fs.writeFileSync(resolve(pkg, 'package.json'), pjParent) +} + +function setup (cb) { + mkdirp.sync(repo) + fs.writeFileSync(resolve(repo, 'package.json'), pjChild) + npm.load({ prefix: pkg, registry: common.registry, loglevel: 'silent' }, function () { + git = require('../../lib/utils/git.js') + + function startDaemon (cb) { + // start git server + var d = git.spawn( + [ + 'daemon', + '--verbose', + '--listen=localhost', + '--export-all', + '--base-path=.', + '--port=1235' + ], + { + cwd: pkg, + env: process.env, + stdio: ['pipe', 'pipe', 'pipe'] + } + ) + d.stderr.on('data', childFinder) + + function childFinder (c) { + var cpid = c.toString().match(/^\[(\d+)\]/) + if (cpid[1]) { + this.removeListener('data', childFinder) + cb(null, [d, cpid[1]]) + } + } + } + + var opts = { + cwd: repo, + env: process.env + } + + chain( + [ + git.chainableExec(['init'], opts), + git.chainableExec(['config', 'user.name', 'PhantomFaker'], opts), + git.chainableExec(['config', 'user.email', 'nope@not.real'], opts), + git.chainableExec(['add', 'package.json'], opts), + git.chainableExec(['commit', '-m', 'stub package'], opts), + git.chainableExec( + ['clone', '--bare', repo, 'child.git'], + { cwd: pkg, env: process.env } + ), + startDaemon + ], + cb + ) + }) +} + +function cleanup () { + process.chdir(osenv.tmpdir()) + rimraf.sync(repo) + rimraf.sync(pkg) +} diff --git a/deps/npm/test/tap/config-semver-tag.js b/deps/npm/test/tap/config-semver-tag.js deleted file mode 100644 index 4ce1cb219e..0000000000 --- a/deps/npm/test/tap/config-semver-tag.js +++ /dev/null @@ -1,27 +0,0 @@ -var util = require("util") -var test = require("tap").test -var npmconf = require("../../lib/config/core.js") -var common = require("./00-config-setup.js") - -var cli = { tag: "v2.x" } - -var log = require("npmlog") - -test("tag cannot be a SemVer", function (t) { - var messages = [] - log.warn = function (m) { - messages.push(m + " " + util.format.apply(util, [].slice.call(arguments, 1))) - } - - var expect = [ - 'invalid config tag="v2.x"', - "invalid config Tag must not be a SemVer range" - ] - - npmconf.load(cli, common.builtin, function (er, conf) { - if (er) throw er - t.equal(conf.get("tag"), "latest") - t.same(messages, expect) - t.end() - }) -}) diff --git a/deps/npm/test/tap/dedupe-scoped.js b/deps/npm/test/tap/dedupe-scoped.js new file mode 100644 index 0000000000..dacf405fcf --- /dev/null +++ b/deps/npm/test/tap/dedupe-scoped.js @@ -0,0 +1,146 @@ +var fs = require('fs') +var join = require('path').join + +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') +var test = require('tap').test + +var common = require('../common-tap.js') +var pkg = join(__dirname, 'dedupe-scoped') +var modules = join(pkg, 'node_modules') + +var EXEC_OPTS = { cwd: pkg } + +test('setup', function (t) { + setup() + t.end() +}) + +// we like the cars +function ltrimm (l) { return l.trim() } + +test('dedupe finds the common scoped modules and moves it up one level', function (t) { + common.npm( + [ + 'find-dupes' // I actually found a use for this command! + ], + EXEC_OPTS, + function (err, code, stdout, stderr) { + t.ifError(err, 'successful dry run against fake install') + t.notOk(code, 'npm ran without issue') + t.notOk(stderr, 'npm printed no errors') + t.same( + stdout.trim().split('\n').map(ltrimm), + [prolog].concat(body).map(ltrimm), + 'got expected output' + ) + + t.end() + } + ) +}) + +test('cleanup', function (t) { + cleanup() + t.end() +}) + +var prolog = 'dedupe@0.0.0 ' + pkg +var body = function () {/* +├─┬ first@1.0.0 +│ └── @scope/shared@2.1.6 +└─┬ second@2.0.0 + └── @scope/shared@2.1.6 +*/}.toString().split('\n').slice(1, -1) + +var deduper = { + 'name': 'dedupe', + 'version': '0.0.0', + 'dependencies': { + 'first': '1.0.0', + 'second': '2.0.0' + } +} + +var first = { + 'name': 'first', + 'version': '1.0.0', + 'dependencies': { + 'firstUnique': '0.6.0', + '@scope/shared': '2.1.6' + } +} + +var second = { + 'name': 'second', + 'version': '2.0.0', + 'dependencies': { + 'secondUnique': '1.2.0', + '@scope/shared': '2.1.6' + } +} + +var shared = { + 'name': '@scope/shared', + 'version': '2.1.6' +} + +var firstUnique = { + 'name': 'firstUnique', + 'version': '0.6.0' +} + +var secondUnique = { + 'name': 'secondUnique', + 'version': '1.2.0' +} + +function setup (cb) { + cleanup() + + mkdirp.sync(pkg) + fs.writeFileSync( + join(pkg, 'package.json'), + JSON.stringify(deduper, null, 2) + ) + + mkdirp.sync(join(modules, 'first')) + fs.writeFileSync( + join(modules, 'first', 'package.json'), + JSON.stringify(first, null, 2) + ) + + mkdirp.sync(join(modules, 'first', 'node_modules', 'firstUnique')) + fs.writeFileSync( + join(modules, 'first', 'node_modules', 'firstUnique', 'package.json'), + JSON.stringify(firstUnique, null, 2) + ) + + mkdirp.sync(join(modules, 'first', 'node_modules', '@scope', 'shared')) + fs.writeFileSync( + join(modules, 'first', 'node_modules', '@scope', 'shared', 'package.json'), + JSON.stringify(shared, null, 2) + ) + + mkdirp.sync(join(modules, 'second')) + fs.writeFileSync( + join(modules, 'second', 'package.json'), + JSON.stringify(second, null, 2) + ) + + mkdirp.sync(join(modules, 'second', 'node_modules', 'secondUnique')) + fs.writeFileSync( + join(modules, 'second', 'node_modules', 'secondUnique', 'package.json'), + JSON.stringify(secondUnique, null, 2) + ) + + mkdirp.sync(join(modules, 'second', 'node_modules', '@scope', 'shared')) + fs.writeFileSync( + join(modules, 'second', 'node_modules', '@scope', 'shared', 'package.json'), + JSON.stringify(shared, null, 2) + ) +} + +function cleanup () { + rimraf.sync(pkg) +} diff --git a/deps/npm/test/tap/git-dependency-install-link.js b/deps/npm/test/tap/git-dependency-install-link.js new file mode 100644 index 0000000000..2d382dd560 --- /dev/null +++ b/deps/npm/test/tap/git-dependency-install-link.js @@ -0,0 +1,184 @@ +var fs = require('fs') +var resolve = require('path').resolve + +var chain = require('slide').chain +var osenv = require('osenv') +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') +var test = require('tap').test +var readJson = require('read-package-json') +var mr = require('npm-registry-mock') + +var npm = require('../../lib/npm.js') +var common = require('../common-tap.js') + +var pkg = resolve(__dirname, 'git-dependency-install-link') +var repo = resolve(__dirname, 'git-dependency-install-link-repo') +var cache = resolve(pkg, 'cache') + +var daemon +var daemonPID +var git +var mockRegistry + +var EXEC_OPTS = { + registry: common.registry, + cwd: pkg, + cache: cache +} + +test('setup', function (t) { + bootstrap() + setup(function (er, r) { + t.ifError(er, 'git started up successfully') + + if (!er) { + daemon = r[r.length - 2] + daemonPID = r[r.length - 1] + } + + mr({ + port: common.port + }, function (er, server) { + t.ifError(er, 'started mock registry') + mockRegistry = server + + t.end() + }) + }) +}) + +test('install from git repo [no --link]', function (t) { + process.chdir(pkg) + + common.npm(['install', '--loglevel', 'error'], EXEC_OPTS, function (err, code, stdout, stderr) { + t.ifError(err, 'npm install failed') + + t.dissimilar(stderr, /Command failed:/, 'expect git to succeed') + t.dissimilar(stderr, /version not found/, 'should not go to repository') + + readJson(resolve(pkg, 'node_modules', 'child', 'package.json'), function (err, data) { + t.ifError(err, 'error reading child package.json') + + t.equal(data && data.version, '1.0.3') + t.end() + }) + }) +}) + +test('install from git repo [with --link]', function (t) { + process.chdir(pkg) + rimraf.sync(resolve(pkg, 'node_modules')) + + common.npm(['install', '--link', '--loglevel', 'error'], EXEC_OPTS, function (err, code, stdout, stderr) { + t.ifError(err, 'npm install --link failed') + + t.dissimilar(stderr, /Command failed:/, 'expect git to succeed') + t.dissimilar(stderr, /version not found/, 'should not go to repository') + + readJson(resolve(pkg, 'node_modules', 'child', 'package.json'), function (err, data) { + t.ifError(err, 'error reading child package.json') + + t.equal(data && data.version, '1.0.3') + t.end() + }) + }) +}) + +test('clean', function (t) { + mockRegistry.close() + daemon.on('close', function () { + cleanup() + t.end() + }) + process.kill(daemonPID) +}) + +var pjParent = JSON.stringify({ + name: 'parent', + version: '1.2.3', + dependencies: { + 'child': 'git://localhost:1234/child.git' + } +}, null, 2) + '\n' + +var pjChild = JSON.stringify({ + name: 'child', + version: '1.0.3' +}, null, 2) + '\n' + +function bootstrap () { + rimraf.sync(repo) + rimraf.sync(pkg) + mkdirp.sync(pkg) + mkdirp.sync(cache) + + fs.writeFileSync(resolve(pkg, 'package.json'), pjParent) +} + +function setup (cb) { + mkdirp.sync(repo) + fs.writeFileSync(resolve(repo, 'package.json'), pjChild) + npm.load({ + link: true, + prefix: pkg, + loglevel: 'silent' + }, function () { + git = require('../../lib/utils/git.js') + + function startDaemon (cb) { + // start git server + var d = git.spawn( + [ + 'daemon', + '--verbose', + '--listen=localhost', + '--export-all', + '--base-path=.', + '--port=1234' + ], + { + cwd: pkg, + env: process.env, + stdio: ['pipe', 'pipe', 'pipe'] + } + ) + d.stderr.on('data', childFinder) + + function childFinder (c) { + var cpid = c.toString().match(/^\[(\d+)\]/) + if (cpid[1]) { + this.removeListener('data', childFinder) + cb(null, [d, cpid[1]]) + } + } + } + + var opts = { + cwd: repo, + env: process.env + } + + chain( + [ + git.chainableExec(['init'], opts), + git.chainableExec(['config', 'user.name', 'PhantomFaker'], opts), + git.chainableExec(['config', 'user.email', 'nope@not.real'], opts), + git.chainableExec(['add', 'package.json'], opts), + git.chainableExec(['commit', '-m', 'stub package'], opts), + git.chainableExec( + ['clone', '--bare', repo, 'child.git'], + { cwd: pkg, env: process.env } + ), + startDaemon + ], + cb + ) + }) +} + +function cleanup () { + process.chdir(osenv.tmpdir()) + rimraf.sync(repo) + rimraf.sync(pkg) +} diff --git a/deps/npm/test/tap/publish-invalid-semver-tag.js b/deps/npm/test/tap/publish-invalid-semver-tag.js new file mode 100644 index 0000000000..1a741d348d --- /dev/null +++ b/deps/npm/test/tap/publish-invalid-semver-tag.js @@ -0,0 +1,79 @@ +var common = require('../common-tap.js') +var test = require('tap').test +var npm = require('../../lib/npm.js') +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') +var path = require('path') +var fs = require('fs') +var mr = require('npm-registry-mock') + +var osenv = require('osenv') + +var PKG_DIR = path.resolve(__dirname, 'publish-invalid-semver-tag') +var CACHE_DIR = path.resolve(PKG_DIR, 'cache') + +var DEFAULT_PKG = { + 'name': 'examples', + 'version': '1.2.3' +} + +var mockServer + +function resetPackage (options) { + rimraf.sync(CACHE_DIR) + mkdirp.sync(CACHE_DIR) + + fs.writeFileSync(path.resolve(PKG_DIR, 'package.json'), DEFAULT_PKG) +} + +test('setup', function (t) { + process.chdir(osenv.tmpdir()) + mkdirp.sync(PKG_DIR) + process.chdir(PKG_DIR) + + resetPackage({}) + + mr({ port: common.port }, function (er, server) { + npm.load({ + cache: CACHE_DIR, + registry: common.registry, + cwd: PKG_DIR + }, function (err) { + t.ifError(err, 'started server') + mockServer = server + + t.end() + }) + }) +}) + +test('attempt publish with semver-like version', function (t) { + resetPackage({}) + + npm.config.set('tag', 'v1.x') + npm.commands.publish([], function (err) { + t.notEqual(err, null) + t.same(err.message, 'Tag name must not be a valid SemVer range: v1.x') + t.end() + }) +}) + +test('attempt publish with semver-like version', function (t) { + resetPackage({}) + + npm.config.set('tag', '1.2.3') + npm.commands.publish([], function (err) { + t.notEqual(err, null) + t.same(err.message, 'Tag name must not be a valid SemVer range: 1.2.3') + t.end() + }) +}) + +test('cleanup', function (t) { + mockServer.close() + + process.chdir(osenv.tmpdir()) + rimraf.sync(PKG_DIR) + + t.end() +}) diff --git a/deps/npm/test/tap/update-examples.js b/deps/npm/test/tap/update-examples.js index 2349e25329..633713d9d7 100644 --- a/deps/npm/test/tap/update-examples.js +++ b/deps/npm/test/tap/update-examples.js @@ -158,6 +158,16 @@ test('update tilde dependency to latest', function (t) { }) }) +test('hold tilde dependency at wanted (#6441)', function (t) { + resetPackage({ wanted: '~1.1.2', installed: '1.1.2' }) + + npm.commands.update([], function (err) { + t.ifError(err) + t.notOk(installAskedFor, 'should not want to install anything') + t.end() + }) +}) + test('update old caret dependency with no newer', function (t) { resetPackage({ wanted: '^0.2.0', installed: '^0.2.0' })