From bd8b1ddb2007dcc8ec2a0a08e16208aa21b83400 Mon Sep 17 00:00:00 2001 From: Kat Marchán Date: Fri, 27 May 2016 14:07:59 -0700 Subject: deps: upgrade npm to 3.9.3 Contains the following npm releases: - v3.9.0: https://github.com/npm/npm/releases/tag/v3.9.0 - v3.9.1: https://github.com/npm/npm/releases/tag/v3.9.1 - v3.9.2: https://github.com/npm/npm/releases/tag/v3.9.2 - v3.9.3: https://github.com/npm/npm/releases/tag/v3.9.3 PR-URL: https://github.com/nodejs/node/pull/7030 Reviewed-By: Jeremiah Senkpiel --- deps/npm/AUTHORS | 2 + deps/npm/CHANGELOG.md | 288 +- deps/npm/appveyor.yml | 36 + deps/npm/bin/npm-cli.js | 1 - deps/npm/doc/files/package.json.md | 10 +- deps/npm/doc/misc/npm-scripts.md | 3 +- deps/npm/html/doc/README.html | 2 +- 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-test.html | 2 +- deps/npm/html/doc/cli/npm-install.html | 2 +- deps/npm/html/doc/cli/npm-link.html | 2 +- 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-ping.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-root.html | 2 +- deps/npm/html/doc/cli/npm-run-script.html | 2 +- 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-team.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 | 6 +- 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 | 12 +- deps/npm/html/doc/files/npmrc.html | 2 +- deps/npm/html/doc/files/package.json.html | 12 +- 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-index.html | 2 +- deps/npm/html/doc/misc/npm-orgs.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 | 5 +- deps/npm/html/doc/misc/removing-npm.html | 2 +- deps/npm/html/doc/misc/semver.html | 2 +- deps/npm/lib/access.js | 1 - deps/npm/lib/cache/add-remote-git.js | 2 +- deps/npm/lib/cache/caching-client.js | 6 + deps/npm/lib/completion.js | 4 +- deps/npm/lib/config/core.js | 3 +- deps/npm/lib/explore.js | 27 +- deps/npm/lib/fetch-package-metadata.js | 45 +- deps/npm/lib/install/action/extract.js | 5 + deps/npm/lib/install/deps.js | 132 +- deps/npm/lib/install/inflate-shrinkwrap.js | 8 +- deps/npm/lib/ls.js | 11 +- deps/npm/lib/npm.js | 10 +- deps/npm/lib/unbuild.js | 2 +- deps/npm/lib/utils/completion/file-completion.js | 4 +- deps/npm/lib/utils/error-handler.js | 6 +- deps/npm/lib/utils/escape-arg.js | 27 + deps/npm/lib/utils/escape-exec-path.js | 30 + deps/npm/lib/utils/git.js | 6 +- deps/npm/lib/utils/is-windows-bash.js | 3 + deps/npm/lib/utils/is-windows-shell.js | 4 + deps/npm/lib/utils/is-windows.js | 2 + deps/npm/lib/utils/lifecycle.js | 56 +- deps/npm/lib/utils/link.js | 16 +- deps/npm/lib/utils/module-name.js | 2 +- deps/npm/man/man1/npm-ls.1 | 2 +- deps/npm/man/man1/npm.1 | 2 +- deps/npm/man/man5/npm-json.5 | 10 +- deps/npm/man/man5/package.json.5 | 10 +- deps/npm/man/man7/npm-scripts.7 | 3 +- deps/npm/node_modules/fstream-npm/fstream-npm.js | 3 + .../node_modules/fstream-ignore/.npmignore | 1 - .../node_modules/fstream-ignore/example/basic.js | 13 - .../node_modules/brace-expansion/index.js | 2 +- .../node_modules/balanced-match/.npmignore | 7 +- .../node_modules/balanced-match/.travis.yml | 3 - .../node_modules/balanced-match/Makefile | 5 - .../node_modules/balanced-match/README.md | 4 +- .../node_modules/balanced-match/example.js | 4 - .../node_modules/balanced-match/index.js | 8 + .../node_modules/balanced-match/package.json | 71 +- .../node_modules/balanced-match/test/balanced.js | 84 - .../node_modules/brace-expansion/package.json | 61 +- .../node_modules/fstream-ignore/package.json | 115 +- .../node_modules/fstream-ignore/test/.ignore | 2 - .../node_modules/fstream-ignore/test/.npmignore | 1 - .../node_modules/fstream-ignore/test/00-setup.js | 70 - .../node_modules/fstream-ignore/test/basic.js | 28 - .../node_modules/fstream-ignore/test/common.js | 40 - .../fstream-ignore/test/ignore-most.js | 41 - .../fstream-ignore/test/nested-ignores.js | 51 - .../fstream-ignore/test/read-file-order.js | 81 - .../fstream-ignore/test/unignore-child.js | 38 - .../node_modules/fstream-ignore/test/zz-cleanup.js | 10 - deps/npm/node_modules/fstream-npm/package.json | 108 +- deps/npm/node_modules/graceful-fs/README.md | 84 +- deps/npm/node_modules/graceful-fs/package.json | 65 +- deps/npm/node_modules/hosted-git-info/.npmignore | 5 +- deps/npm/node_modules/hosted-git-info/.travis.yml | 5 - deps/npm/node_modules/hosted-git-info/package.json | 112 +- .../npm/node_modules/hosted-git-info/test/basic.js | 15 - .../test/bitbucket-https-with-embedded-auth.js | 27 - .../node_modules/hosted-git-info/test/bitbucket.js | 23 - deps/npm/node_modules/hosted-git-info/test/gist.js | 41 - .../node_modules/hosted-git-info/test/github.js | 40 - .../node_modules/hosted-git-info/test/gitlab.js | 23 - .../hosted-git-info/test/https-with-inline-auth.js | 39 - .../hosted-git-info/test/lib/standard-tests.js | 27 - deps/npm/node_modules/inflight/package.json | 121 +- deps/npm/node_modules/inflight/test.js | 97 - .../init-package-json/init-package-json.js | 16 +- .../node_modules/balanced-match/.npmignore | 7 +- .../node_modules/balanced-match/.travis.yml | 3 - .../node_modules/balanced-match/Makefile | 5 - .../node_modules/balanced-match/README.md | 4 +- .../node_modules/balanced-match/example.js | 4 - .../node_modules/balanced-match/index.js | 8 + .../node_modules/balanced-match/package.json | 49 +- .../node_modules/balanced-match/test/balanced.js | 84 - .../node_modules/brace-expansion/package.json | 41 +- .../node_modules/init-package-json/package.json | 79 +- deps/npm/node_modules/lodash._baseuniq/LICENSE | 64 +- deps/npm/node_modules/lodash._baseuniq/README.md | 4 +- deps/npm/node_modules/lodash._baseuniq/index.js | 632 ++- .../node_modules/lodash._createset/LICENSE | 64 +- .../node_modules/lodash._createset/README.md | 4 +- .../node_modules/lodash._createset/index.js | 110 +- .../node_modules/lodash._createset/package.json | 22 +- .../node_modules/lodash._root/LICENSE | 23 + .../node_modules/lodash._root/README.md | 18 + .../node_modules/lodash._root/index.js | 59 + .../node_modules/lodash._root/package.json | 101 + .../node_modules/lodash._setcache/LICENSE | 23 - .../node_modules/lodash._setcache/README.md | 18 - .../node_modules/lodash._setcache/index.js | 588 -- .../node_modules/lodash._setcache/package.json | 101 - .../npm/node_modules/lodash._baseuniq/package.json | 40 +- deps/npm/node_modules/lodash.keys/README.md | 4 +- deps/npm/node_modules/lodash.keys/index.js | 41 +- deps/npm/node_modules/lodash.keys/package.json | 34 +- deps/npm/node_modules/lodash.union/README.md | 4 +- deps/npm/node_modules/lodash.union/index.js | 4 +- .../node_modules/lodash._baseflatten/README.md | 4 +- .../node_modules/lodash._baseflatten/index.js | 6 +- .../node_modules/lodash._baseflatten/package.json | 16 +- .../node_modules/lodash.rest/README.md | 4 +- .../lodash.union/node_modules/lodash.rest/index.js | 73 +- .../node_modules/lodash.rest/package.json | 20 +- deps/npm/node_modules/lodash.union/package.json | 32 +- deps/npm/node_modules/lodash.uniq/LICENSE | 64 +- deps/npm/node_modules/lodash.uniq/README.md | 4 +- deps/npm/node_modules/lodash.uniq/index.js | 13 +- deps/npm/node_modules/lodash.uniq/package.json | 38 +- deps/npm/node_modules/lodash.without/LICENSE | 64 +- deps/npm/node_modules/lodash.without/README.md | 4 +- deps/npm/node_modules/lodash.without/index.js | 45 +- .../node_modules/lodash._basedifference/LICENSE | 64 +- .../node_modules/lodash._basedifference/README.md | 4 +- .../node_modules/lodash._basedifference/index.js | 632 ++- .../node_modules/lodash._root/LICENSE | 23 + .../node_modules/lodash._root/README.md | 18 + .../node_modules/lodash._root/index.js | 59 + .../node_modules/lodash._root/package.json | 101 + .../node_modules/lodash._setcache/LICENSE | 23 - .../node_modules/lodash._setcache/README.md | 18 - .../node_modules/lodash._setcache/index.js | 588 -- .../node_modules/lodash._setcache/package.json | 101 - .../lodash._basedifference/package.json | 34 +- .../node_modules/lodash.rest/LICENSE | 29 +- .../node_modules/lodash.rest/README.md | 4 +- .../node_modules/lodash.rest/index.js | 160 +- .../node_modules/lodash.rest/package.json | 38 +- deps/npm/node_modules/lodash.without/package.json | 38 +- deps/npm/node_modules/npm-package-arg/package.json | 16 +- .../node_modules/read-package-tree/package.json | 116 +- deps/npm/node_modules/read-package-tree/rpt.js | 158 +- .../test/symlinked-node-modules.js | 70 + deps/npm/node_modules/readable-stream/README.md | 4 +- .../readable-stream/coverage/lcov-report/base.css | 212 + .../coverage/lcov-report/index.html | 93 + .../lcov-report/lib/_stream_duplex.js.html | 287 + .../lcov-report/lib/_stream_passthrough.js.html | 140 + .../lcov-report/lib/_stream_readable.js.html | 2741 ++++++++++ .../lcov-report/lib/_stream_transform.js.html | 602 ++ .../lcov-report/lib/_stream_writable.js.html | 1640 ++++++ .../coverage/lcov-report/lib/index.html | 145 + .../coverage/lcov-report/prettify.css | 1 + .../coverage/lcov-report/prettify.js | 1 + .../coverage/lcov-report/sort-arrow-sprite.png | Bin 0 -> 209 bytes .../readable-stream/coverage/lcov-report/sorter.js | 158 + .../readable-stream/coverage/lcov.info | 1642 ++++++ .../readable-stream/doc/stream.markdown | 1761 ------ .../npm/node_modules/readable-stream/doc/stream.md | 1772 ++++++ .../readable-stream/lib/_stream_readable.js | 53 +- .../readable-stream/lib/_stream_transform.js | 6 +- .../readable-stream/lib/_stream_writable.js | 40 +- .../node_modules/buffer-shims/index.js | 108 + .../node_modules/buffer-shims/license.md | 19 + .../node_modules/buffer-shims/package.json | 84 + .../node_modules/buffer-shims/readme.md | 21 + .../node_modules/inline-process-browser/index.js | 37 - .../node_modules/falafel/.travis.yml | 3 - .../node_modules/falafel/example/array.js | 14 - .../node_modules/falafel/example/keyword.js | 16 - .../node_modules/falafel/example/prompt.js | 49 - .../node_modules/falafel/index.js | 79 - .../falafel/node_modules/acorn/.editorconfig | 7 - .../falafel/node_modules/acorn/.gitattributes | 1 - .../falafel/node_modules/acorn/.npmignore | 3 - .../falafel/node_modules/acorn/.tern-project | 1 - .../falafel/node_modules/acorn/.travis.yml | 2 - .../falafel/node_modules/acorn/AUTHORS | 38 - .../falafel/node_modules/acorn/LICENSE | 19 - .../falafel/node_modules/acorn/README.md | 377 -- .../falafel/node_modules/acorn/bin/acorn | 54 - .../falafel/node_modules/acorn/bin/build-acorn.js | 51 - .../acorn/bin/generate-identifier-regex.js | 47 - .../falafel/node_modules/acorn/bin/prepublish.sh | 2 - .../node_modules/acorn/bin/update_authors.sh | 6 - .../falafel/node_modules/acorn/bin/without_eval | 48 - .../falafel/node_modules/acorn/dist/.keep | 0 .../falafel/node_modules/acorn/dist/acorn.js | 4014 -------------- .../falafel/node_modules/acorn/dist/acorn_csp.js | 3985 -------------- .../falafel/node_modules/acorn/dist/acorn_loose.js | 1298 ----- .../falafel/node_modules/acorn/dist/walk.js | 342 -- .../falafel/node_modules/acorn/package.json | 192 - .../falafel/node_modules/acorn/src/expression.js | 697 --- .../falafel/node_modules/acorn/src/identifier.js | 129 - .../falafel/node_modules/acorn/src/index.js | 75 - .../falafel/node_modules/acorn/src/location.js | 68 - .../node_modules/acorn/src/loose/acorn_loose.js | 0 .../node_modules/acorn/src/loose/expression.js | 511 -- .../falafel/node_modules/acorn/src/loose/index.js | 50 - .../node_modules/acorn/src/loose/parseutil.js | 126 - .../falafel/node_modules/acorn/src/loose/state.js | 17 - .../node_modules/acorn/src/loose/statement.js | 419 -- .../node_modules/acorn/src/loose/tokenize.js | 108 - .../falafel/node_modules/acorn/src/lval.js | 213 - .../falafel/node_modules/acorn/src/node.js | 70 - .../falafel/node_modules/acorn/src/options.js | 118 - .../falafel/node_modules/acorn/src/parseutil.js | 89 - .../falafel/node_modules/acorn/src/state.js | 78 - .../falafel/node_modules/acorn/src/statement.js | 594 -- .../falafel/node_modules/acorn/src/tokencontext.js | 107 - .../falafel/node_modules/acorn/src/tokenize.js | 672 --- .../falafel/node_modules/acorn/src/tokentype.js | 142 - .../falafel/node_modules/acorn/src/util.js | 9 - .../falafel/node_modules/acorn/src/walk/index.js | 291 - .../falafel/node_modules/acorn/src/whitespace.js | 11 - .../falafel/node_modules/foreach/.npmignore | 3 - .../falafel/node_modules/foreach/LICENSE | 24 - .../falafel/node_modules/foreach/Makefile | 11 - .../falafel/node_modules/foreach/Readme.md | 29 - .../falafel/node_modules/foreach/component.json | 11 - .../falafel/node_modules/foreach/index.js | 21 - .../falafel/node_modules/foreach/package.json | 109 - .../falafel/node_modules/foreach/test.js | 152 - .../falafel/node_modules/isarray/README.md | 54 - .../falafel/node_modules/isarray/build/build.js | 208 - .../falafel/node_modules/isarray/component.json | 19 - .../falafel/node_modules/isarray/index.js | 3 - .../falafel/node_modules/isarray/package.json | 78 - .../falafel/node_modules/object-keys/.editorconfig | 12 - .../falafel/node_modules/object-keys/.jscs.json | 130 - .../falafel/node_modules/object-keys/.npmignore | 1 - .../falafel/node_modules/object-keys/.travis.yml | 60 - .../falafel/node_modules/object-keys/CHANGELOG.md | 203 - .../falafel/node_modules/object-keys/LICENSE | 21 - .../falafel/node_modules/object-keys/README.md | 75 - .../falafel/node_modules/object-keys/index.js | 128 - .../node_modules/object-keys/isArguments.js | 17 - .../falafel/node_modules/object-keys/package.json | 141 - .../falafel/node_modules/object-keys/test/index.js | 5 - .../node_modules/falafel/package.json | 137 - .../node_modules/falafel/readme.markdown | 122 - .../node_modules/falafel/test/array.js | 35 - .../node_modules/falafel/test/async.js | 42 - .../node_modules/falafel/test/bin/run.js | 5 - .../node_modules/falafel/test/custom-parser.js | 42 - .../node_modules/falafel/test/es6.js | 15 - .../node_modules/falafel/test/for.js | 30 - .../node_modules/falafel/test/inspect.js | 36 - .../node_modules/falafel/test/opts.js | 134 - .../node_modules/falafel/test/parent.js | 33 - .../node_modules/through2/.npmignore | 3 - .../node_modules/through2/LICENSE | 39 - .../node_modules/through2/README.md | 132 - .../node_modules/readable-stream/.npmignore | 5 - .../through2/node_modules/readable-stream/LICENSE | 18 - .../node_modules/readable-stream/README.md | 14 - .../node_modules/readable-stream/duplex.js | 1 - .../readable-stream/lib/_stream_duplex.js | 89 - .../readable-stream/lib/_stream_passthrough.js | 46 - .../readable-stream/lib/_stream_readable.js | 982 ---- .../readable-stream/lib/_stream_transform.js | 210 - .../readable-stream/lib/_stream_writable.js | 386 -- .../readable-stream/node_modules/isarray/README.md | 54 - .../node_modules/isarray/build/build.js | 208 - .../node_modules/isarray/component.json | 19 - .../readable-stream/node_modules/isarray/index.js | 3 - .../node_modules/isarray/package.json | 78 - .../node_modules/readable-stream/package.json | 104 - .../node_modules/readable-stream/passthrough.js | 1 - .../node_modules/readable-stream/readable.js | 11 - .../node_modules/readable-stream/transform.js | 1 - .../node_modules/readable-stream/writable.js | 1 - .../through2/node_modules/xtend/.npmignore | 1 - .../through2/node_modules/xtend/LICENCE | 19 - .../through2/node_modules/xtend/Makefile | 4 - .../through2/node_modules/xtend/README.md | 32 - .../through2/node_modules/xtend/immutable.js | 19 - .../through2/node_modules/xtend/mutable.js | 17 - .../through2/node_modules/xtend/package.json | 109 - .../through2/node_modules/xtend/test.js | 83 - .../node_modules/through2/package.json | 94 - .../node_modules/through2/through2.js | 96 - .../inline-process-browser/package.json | 86 - .../node_modules/inline-process-browser/readme.md | 23 - .../node_modules/process-nextick-args/index.js | 39 +- .../node_modules/process-nextick-args/package.json | 38 +- .../unreachable-branch-transform/README.md | 72 - .../unreachable-branch-transform/index.js | 59 - .../node_modules/esmangle-evaluator/.npmignore | 3 - .../node_modules/esmangle-evaluator/README.md | 24 - .../node_modules/esmangle-evaluator/common.js | 58 - .../node_modules/esmangle-evaluator/evaluator.js | 364 -- .../node_modules/esmangle-evaluator/package.json | 73 - .../node_modules/recast/.editorconfig | 3 - .../node_modules/recast/.npmignore | 2 - .../node_modules/recast/.travis.yml | 15 - .../node_modules/recast/LICENSE | 20 - .../node_modules/recast/README.md | 143 - .../node_modules/recast/example/add-braces | 44 - .../node_modules/recast/example/generic-identity | 17 - .../node_modules/recast/example/identity | 8 - .../node_modules/recast/example/to-while | 84 - .../node_modules/recast/lib/comments.js | 351 -- .../node_modules/recast/lib/fast-path.js | 477 -- .../node_modules/recast/lib/lines.js | 878 --- .../node_modules/recast/lib/mapping.js | 277 - .../node_modules/recast/lib/options.js | 95 - .../node_modules/recast/lib/parser.js | 152 - .../node_modules/recast/lib/patcher.js | 515 -- .../node_modules/recast/lib/printer.js | 1802 ------ .../node_modules/recast/lib/types.js | 5 - .../node_modules/recast/lib/util.js | 283 - .../node_modules/recast/main.js | 99 - .../recast/node_modules/ast-types/.npmignore | 2 - .../recast/node_modules/ast-types/.travis.yml | 20 - .../recast/node_modules/ast-types/LICENSE | 20 - .../recast/node_modules/ast-types/README.md | 489 -- .../recast/node_modules/ast-types/def/babel.js | 105 - .../recast/node_modules/ast-types/def/core.js | 367 -- .../recast/node_modules/ast-types/def/e4x.js | 84 - .../recast/node_modules/ast-types/def/es6.js | 217 - .../recast/node_modules/ast-types/def/es7.js | 36 - .../recast/node_modules/ast-types/def/esprima.js | 96 - .../recast/node_modules/ast-types/def/flow.js | 269 - .../recast/node_modules/ast-types/def/jsx.js | 100 - .../recast/node_modules/ast-types/def/mozilla.js | 49 - .../recast/node_modules/ast-types/lib/equiv.js | 184 - .../recast/node_modules/ast-types/lib/node-path.js | 474 -- .../node_modules/ast-types/lib/path-visitor.js | 419 -- .../recast/node_modules/ast-types/lib/path.js | 366 -- .../recast/node_modules/ast-types/lib/scope.js | 330 -- .../recast/node_modules/ast-types/lib/shared.js | 41 - .../recast/node_modules/ast-types/lib/types.js | 828 --- .../recast/node_modules/ast-types/main.js | 34 - .../recast/node_modules/ast-types/package.json | 100 - .../recast/node_modules/esprima/ChangeLog | 170 - .../recast/node_modules/esprima/LICENSE.BSD | 21 - .../recast/node_modules/esprima/README.md | 27 - .../recast/node_modules/esprima/bin/esparse.js | 126 - .../recast/node_modules/esprima/bin/esvalidate.js | 199 - .../recast/node_modules/esprima/esprima.js | 5739 -------------------- .../recast/node_modules/esprima/package.json | 145 - .../recast/node_modules/private/.travis.yml | 6 - .../recast/node_modules/private/LICENSE | 20 - .../recast/node_modules/private/README.md | 246 - .../recast/node_modules/private/package.json | 85 - .../recast/node_modules/private/private.js | 129 - .../recast/node_modules/private/test/run.js | 68 - .../recast/node_modules/source-map/README.md | 729 --- .../source-map/dist/source-map.debug.js | 3006 ---------- .../node_modules/source-map/dist/source-map.js | 3005 ---------- .../node_modules/source-map/dist/source-map.min.js | 2 - .../source-map/dist/source-map.min.js.map | 1 - .../node_modules/source-map/lib/array-set.js | 104 - .../node_modules/source-map/lib/base64-vlq.js | 141 - .../recast/node_modules/source-map/lib/base64.js | 68 - .../node_modules/source-map/lib/binary-search.js | 112 - .../node_modules/source-map/lib/mapping-list.js | 80 - .../node_modules/source-map/lib/quick-sort.js | 115 - .../source-map/lib/source-map-consumer.js | 1082 ---- .../source-map/lib/source-map-generator.js | 396 -- .../node_modules/source-map/lib/source-node.js | 408 -- .../recast/node_modules/source-map/lib/util.js | 369 -- .../recast/node_modules/source-map/package.json | 240 - .../recast/node_modules/source-map/source-map.js | 8 - .../node_modules/recast/package.json | 102 - .../unreachable-branch-transform/package.json | 94 - .../unreachableBranchTransformer.js | 97 - deps/npm/node_modules/readable-stream/package.json | 59 +- deps/npm/node_modules/readable-stream/readable.js | 6 +- .../realize-package-specifier/index.js | 4 +- deps/npm/node_modules/which/.npmignore | 3 - deps/npm/node_modules/which/.travis.yml | 6 - deps/npm/node_modules/which/CHANGELOG.md | 118 + deps/npm/node_modules/which/changelog.sh | 9 + .../which/node_modules/is-absolute/LICENSE | 21 - .../which/node_modules/is-absolute/README.md | 53 - .../which/node_modules/is-absolute/index.js | 26 - .../node_modules/is-relative/LICENSE-MIT | 21 - .../is-absolute/node_modules/is-relative/README.md | 38 - .../is-absolute/node_modules/is-relative/index.js | 21 - .../node_modules/is-relative/package.json | 76 - .../which/node_modules/is-absolute/package.json | 76 - .../node_modules/which/node_modules/isexe/LICENSE | 15 + .../which/node_modules/isexe/package.json | 24 +- deps/npm/node_modules/which/package.json | 63 +- deps/npm/node_modules/which/test/basic.js | 120 - deps/npm/node_modules/which/test/bin.js | 119 - deps/npm/node_modules/which/test/windows.js | 10 - deps/npm/node_modules/which/which.js | 26 +- deps/npm/package.json | 32 +- deps/npm/test/common-tap.js | 35 +- deps/npm/test/fixtures/config/userconfig-with-gc | 22 + deps/npm/test/tap/00-config-setup.js | 10 +- deps/npm/test/tap/bugs.js | 7 +- deps/npm/test/tap/builtin-config.js | 28 +- .../test/tap/bundled-dependencies-no-pkgjson.js | 47 + deps/npm/test/tap/cache-ls-filenames.js | 51 + deps/npm/test/tap/cache-shasum.js | 24 +- deps/npm/test/tap/check-permissions.js | 11 +- deps/npm/test/tap/config-basic.js | 39 +- deps/npm/test/tap/config-certfile.js | 3 +- deps/npm/test/tap/config-edit.js | 8 +- deps/npm/test/tap/dedupe-scoped.js | 14 +- deps/npm/test/tap/do-not-remove-other-bins.js | 4 +- deps/npm/test/tap/extraneous-dep-cycle-ls-ok.js | 2 +- deps/npm/test/tap/gently-rm-linked-module.js | 108 +- .../npm/test/tap/gently-rm-symlinked-global-dir.js | 24 +- deps/npm/test/tap/git-cache-locking.js | 19 +- deps/npm/test/tap/git-cache-no-hooks.js | 36 +- deps/npm/test/tap/git-dependency-install-link.js | 9 +- deps/npm/test/tap/git-npmignore.js | 131 +- deps/npm/test/tap/github-shortcut.js | 8 +- deps/npm/test/tap/graceful-restart.js | 4 +- deps/npm/test/tap/install-bad-man.js | 2 + deps/npm/test/tap/install-link-scripts.js | 6 +- deps/npm/test/tap/install-man.js | 2 + deps/npm/test/tap/install-save-local.js | 4 +- .../test/tap/install-scoped-already-installed.js | 2 +- deps/npm/test/tap/install-scoped-link.js | 6 +- deps/npm/test/tap/legacy-bundled-git.js | 4 - deps/npm/test/tap/legacy-missing-bindir.js | 4 - deps/npm/test/tap/legacy-npm-self-install.js | 6 +- deps/npm/test/tap/legacy-test-package.js | 6 - deps/npm/test/tap/legacy-url-dep.js | 2 - deps/npm/test/tap/lifecycle-path.js | 43 +- deps/npm/test/tap/logout-scoped.js | 6 +- deps/npm/test/tap/logout.js | 6 +- deps/npm/test/tap/ls-l-depth-0.js | 2 + deps/npm/test/tap/ls.js | 188 + deps/npm/test/tap/no-global-warns.js | 25 +- .../tap/optional-metadep-rollback-collision.js | 8 +- deps/npm/test/tap/outdated-depth-deep.js | 71 +- deps/npm/test/tap/outdated-depth-integer.js | 3 +- deps/npm/test/tap/outdated.js | 2 +- .../publish-access-unscoped-restricted-fails.js | 58 +- deps/npm/test/tap/publish-config.js | 2 +- deps/npm/test/tap/registry.js | 4 +- deps/npm/test/tap/repo.js | 26 +- deps/npm/test/tap/retry-on-stale-cache.js | 195 + deps/npm/test/tap/scripts-whitespace-windows.js | 4 +- deps/npm/test/tap/shrinkwrap-nested.js | 153 + deps/npm/test/tap/shrinkwrap-version-match.js | 124 +- deps/npm/test/tap/sorted-package-json.js | 47 +- deps/npm/test/tap/spawn-enoent-help.js | 2 + deps/npm/test/tap/symlink-cycle.js | 2 +- deps/npm/test/tap/umask-lifecycle.js | 14 +- deps/npm/test/tap/unit-child-path.js | 11 +- deps/npm/test/tap/unit-gentlyrm.js | 140 +- deps/npm/test/tap/unit-link.js | 281 + deps/npm/test/tap/unpack-foreign-tarball.js | 3 +- deps/npm/test/tap/unpublish-config.js | 2 +- deps/npm/test/tap/verify-no-lifecycle-on-repo.js | 27 +- deps/npm/test/tap/version-lifecycle.js | 54 +- deps/npm/test/tap/version-update-shrinkwrap.js | 14 +- 523 files changed, 15715 insertions(+), 54615 deletions(-) create mode 100644 deps/npm/appveyor.yml create mode 100644 deps/npm/lib/utils/escape-arg.js create mode 100644 deps/npm/lib/utils/escape-exec-path.js create mode 100644 deps/npm/lib/utils/is-windows-bash.js create mode 100644 deps/npm/lib/utils/is-windows-shell.js create mode 100644 deps/npm/lib/utils/is-windows.js delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/.npmignore delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/example/basic.js delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/.ignore delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/.npmignore delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/00-setup.js delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/basic.js delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/common.js delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/ignore-most.js delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/nested-ignores.js delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/read-file-order.js delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/unignore-child.js delete mode 100644 deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/zz-cleanup.js delete mode 100644 deps/npm/node_modules/hosted-git-info/.travis.yml delete mode 100644 deps/npm/node_modules/hosted-git-info/test/basic.js delete mode 100644 deps/npm/node_modules/hosted-git-info/test/bitbucket-https-with-embedded-auth.js delete mode 100644 deps/npm/node_modules/hosted-git-info/test/bitbucket.js delete mode 100644 deps/npm/node_modules/hosted-git-info/test/gist.js delete mode 100644 deps/npm/node_modules/hosted-git-info/test/github.js delete mode 100644 deps/npm/node_modules/hosted-git-info/test/gitlab.js delete mode 100644 deps/npm/node_modules/hosted-git-info/test/https-with-inline-auth.js delete mode 100644 deps/npm/node_modules/hosted-git-info/test/lib/standard-tests.js delete mode 100644 deps/npm/node_modules/inflight/test.js delete mode 100644 deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml delete mode 100644 deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile delete mode 100644 deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js delete mode 100644 deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js create mode 100644 deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/LICENSE create mode 100644 deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/README.md create mode 100644 deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/index.js create mode 100644 deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/package.json delete mode 100644 deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/LICENSE delete mode 100644 deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/README.md delete mode 100644 deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/index.js delete mode 100644 deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/package.json create mode 100644 deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/LICENSE create mode 100644 deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/README.md create mode 100644 deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/index.js create mode 100644 deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/package.json delete mode 100644 deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/LICENSE delete mode 100644 deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/README.md delete mode 100644 deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/index.js delete mode 100644 deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/package.json create mode 100644 deps/npm/node_modules/read-package-tree/test/symlinked-node-modules.js create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/base.css create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/index.html create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_duplex.js.html create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_passthrough.js.html create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_readable.js.html create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_transform.js.html create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_writable.js.html create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/index.html create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/prettify.css create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/prettify.js create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/sort-arrow-sprite.png create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov-report/sorter.js create mode 100644 deps/npm/node_modules/readable-stream/coverage/lcov.info delete mode 100644 deps/npm/node_modules/readable-stream/doc/stream.markdown create mode 100644 deps/npm/node_modules/readable-stream/doc/stream.md create mode 100644 deps/npm/node_modules/readable-stream/node_modules/buffer-shims/index.js create mode 100644 deps/npm/node_modules/readable-stream/node_modules/buffer-shims/license.md create mode 100644 deps/npm/node_modules/readable-stream/node_modules/buffer-shims/package.json create mode 100644 deps/npm/node_modules/readable-stream/node_modules/buffer-shims/readme.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/index.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/.travis.yml delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/array.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/keyword.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/prompt.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/index.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.editorconfig delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.gitattributes delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.npmignore delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.tern-project delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.travis.yml delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/AUTHORS delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/LICENSE delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/README.md delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/acorn delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/build-acorn.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/generate-identifier-regex.js delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/prepublish.sh delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/update_authors.sh delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/without_eval delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/dist/.keep delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/dist/acorn.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/dist/acorn_csp.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/dist/acorn_loose.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/dist/walk.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/package.json delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/expression.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/identifier.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/index.js delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/location.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/loose/acorn_loose.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/loose/expression.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/loose/index.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/loose/parseutil.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/loose/state.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/loose/statement.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/loose/tokenize.js delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/lval.js delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/node.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/options.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/parseutil.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/state.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/statement.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/tokencontext.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/tokenize.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/tokentype.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/util.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/walk/index.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/src/whitespace.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/foreach/.npmignore delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/foreach/LICENSE delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/foreach/Makefile delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/foreach/Readme.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/foreach/component.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/foreach/index.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/foreach/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/foreach/test.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/isarray/README.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/isarray/build/build.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/isarray/component.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/isarray/index.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/isarray/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/object-keys/.editorconfig delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/object-keys/.jscs.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/object-keys/.npmignore delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/object-keys/.travis.yml delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/object-keys/CHANGELOG.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/object-keys/LICENSE delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/object-keys/README.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/object-keys/index.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/object-keys/isArguments.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/object-keys/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/object-keys/test/index.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/readme.markdown delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/array.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/async.js delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/bin/run.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/custom-parser.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/es6.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/for.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/inspect.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/opts.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/parent.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/.npmignore delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/LICENSE delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/README.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/.npmignore delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/LICENSE delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/README.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/duplex.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/lib/_stream_duplex.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/lib/_stream_passthrough.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/node_modules/isarray/README.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/node_modules/isarray/build/build.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/node_modules/isarray/component.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/node_modules/isarray/index.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/node_modules/isarray/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/passthrough.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/readable.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/transform.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/readable-stream/writable.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/xtend/.npmignore delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/xtend/LICENCE delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/xtend/Makefile delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/xtend/README.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/xtend/immutable.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/xtend/mutable.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/xtend/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/node_modules/xtend/test.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/through2/through2.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/readme.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/README.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/index.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/esmangle-evaluator/.npmignore delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/esmangle-evaluator/README.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/esmangle-evaluator/common.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/esmangle-evaluator/evaluator.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/esmangle-evaluator/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/.editorconfig delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/.npmignore delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/.travis.yml delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/LICENSE delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/README.md delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/example/add-braces delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/example/generic-identity delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/example/identity delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/example/to-while delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/lib/comments.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/lib/fast-path.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/lib/lines.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/lib/mapping.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/lib/options.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/lib/parser.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/lib/patcher.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/lib/printer.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/lib/types.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/lib/util.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/main.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/.npmignore delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/.travis.yml delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/LICENSE delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/README.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/def/babel.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/def/core.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/def/e4x.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/def/es6.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/def/es7.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/def/esprima.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/def/flow.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/def/jsx.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/def/mozilla.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/lib/equiv.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/lib/node-path.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/lib/path-visitor.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/lib/path.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/lib/scope.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/lib/shared.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/lib/types.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/main.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/ast-types/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/esprima/ChangeLog delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/esprima/LICENSE.BSD delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/esprima/README.md delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/esprima/bin/esparse.js delete mode 100755 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/esprima/bin/esvalidate.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/esprima/esprima.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/esprima/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/.travis.yml delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/LICENSE delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/README.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/private.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/test/run.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/README.md delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.debug.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.min.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.min.js.map delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/array-set.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/base64-vlq.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/base64.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/binary-search.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/mapping-list.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/quick-sort.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-map-consumer.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-map-generator.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-node.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/util.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/source-map.js delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/package.json delete mode 100644 deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/unreachableBranchTransformer.js delete mode 100644 deps/npm/node_modules/which/.npmignore delete mode 100644 deps/npm/node_modules/which/.travis.yml create mode 100644 deps/npm/node_modules/which/CHANGELOG.md create mode 100644 deps/npm/node_modules/which/changelog.sh delete mode 100644 deps/npm/node_modules/which/node_modules/is-absolute/LICENSE delete mode 100644 deps/npm/node_modules/which/node_modules/is-absolute/README.md delete mode 100644 deps/npm/node_modules/which/node_modules/is-absolute/index.js delete mode 100644 deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/LICENSE-MIT delete mode 100644 deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/README.md delete mode 100644 deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/index.js delete mode 100644 deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/package.json delete mode 100644 deps/npm/node_modules/which/node_modules/is-absolute/package.json create mode 100644 deps/npm/node_modules/which/node_modules/isexe/LICENSE delete mode 100644 deps/npm/node_modules/which/test/basic.js delete mode 100644 deps/npm/node_modules/which/test/bin.js delete mode 100644 deps/npm/node_modules/which/test/windows.js create mode 100644 deps/npm/test/fixtures/config/userconfig-with-gc create mode 100644 deps/npm/test/tap/bundled-dependencies-no-pkgjson.js create mode 100644 deps/npm/test/tap/cache-ls-filenames.js create mode 100644 deps/npm/test/tap/ls.js create mode 100644 deps/npm/test/tap/retry-on-stale-cache.js create mode 100644 deps/npm/test/tap/shrinkwrap-nested.js create mode 100644 deps/npm/test/tap/unit-link.js (limited to 'deps/npm') diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index 1793a43860..2a76de5f20 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -396,3 +396,5 @@ Steve Mao Anna Henningsen Rachel Evans Sam Minnee +Zirak +Daniel Lupu diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index a0475830c9..20a42d1676 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,289 @@ +### v3.9.3 (2016-05-19): + +This week continues our `big-bug` squashing adventure! Things are churning along +nicely, and we've gotten a lot of fantastic contributions from the community. +Please keep it up! + +A quick note on last week's release: We had a small `npm shrinkwrap`-related +crasher in `npm@3.9.1`, so once this release goes out, `v3.9.2` is going to be +`npm@latest`. Please update if you ended up in with that previous version! + +Remember we have a weekly team meeting, and you can [suggest agenda items in the +GitHub issue](https://github.com/npm/npm/issues/12761). Keep an eye out for the +`#npmweekly` tag on Twitter, too, and join the conversation! We'll do our best +to address questions y'all send us. ✌ + +#### FIXES + +* [`42d71be`](https://github.com/npm/npm/commit/42d71be2cec674dd9e860ad414f53184f667620d) + [#12685](https://github.com/npm/npm/pull/12685) + When using `npm ls ` without a semver specifier, `npm ls` would skip + any packages in your tree that matched by name, but had a prerelease version + in their `package.json`. This patch fixes it so `npm ls` does a simple name + match unless you use the `npm ls @` format. + ([@zkat](https://github.com/zkat)) +* [`c698ae6`](https://github.com/npm/npm/commit/c698ae666afc92fbc0fcba3c082cfa9b34a4420d) + [#12685](https://github.com/npm/npm/pull/12685) + Added some tests for more basic `npm ls` functionality. + ([@zkat](https://github.com/zkat)) + +### NOTABLE DEPENDENCY UPDATES + +* [`3a6fe23`](https://github.com/npm/npm/commit/3a6fe2373c45e80a1f28aaf176d552f6f97cf131) + [npm/fstream-npm#17](https://github.com/npm/fstream-npm/pull/17) + `fstream-npm@1.1.0`: + `fstream-npm` always includes NOTICE files now. + ([@kemitchell](https://github.com/kemitchell)) +* [`df04e05`](https://github.com/npm/npm/commit/df04e05af1f257a1903372e1baf334c0969fbdbd) + [#10013](https://github.com/npm/npm/issues/10013) + `read-package-tree@5.1.4`: + Fixes an issue where `npm install` would fail if your `node_modules` was + symlinked. + ([@iarna](https://github.com/iarna)) +* [`584676f`](https://github.com/npm/npm/commit/584676f85eaebcb9d6c4d70d2ad320be8a8d6a74) + [npm/init-package-json#62](https://github.com/npm/init-package-json/pull/62) + `init-package-json@1.9.4`: + Stop using `package` for a variable, which defeats some bundlers and linters. + ([@adius](https://github.com/adius)) +* [`935a7e3`](https://github.com/npm/npm/commit/935a7e359535e13924934811b77924cbad82619a) + `readable-stream@2.1.3`: + Node 6 build and buffer-related updates. + ([@calvinmetcalf](https://github.com/calvinmetcalf)) + +#### OTHER DEPENDENCY UPDATES + +* [`4c4609e`](https://github.com/npm/npm/commit/4c4609ea49e77303f9d72af6757620e6b3a9a6a9) + `inflight@1.0.5` + ([@zkat](https://github.com/zkat)) +* [`7a3030d`](https://github.com/npm/npm/commit/7a3030d3d44ea2136425f72950ba22e6efd441d9) + `hosted-git-info@2.1.5` + ([@zkat](https://github.com/zkat)) +* [`5ed4b58`](https://github.com/npm/npm/commit/5ed4b58409eeb134bca1c96252682fd7600d9906) + `which@1.2.9` + ([@isaacs](https://github.com/isaacs)) + +### v3.9.2 (2016-05-17) + +This is a quick patch release. The previous release, 3.9.1, introduced a +bug where npm would crash given a combination of specific package tree on +disk and a shrinkwrap. + +* [`cde367f`](https://github.com/npm/npm/commit/cde367fbb6eebc5db68a44b12a5c7bea158d70db) + [#12724](https://github.com/npm/npm/issues/12724) + Fix crasher when inflating shrinkwraps with packages on disk that were + installed by older npm versions. + ([@iarna](https://github.com/iarna)) + +### v3.9.1 (2016-05-12) + +HI all! We have bug fixes to a couple of the hairy corners of `npm`, in the +form of shrinkwraps and bundled dependencies. Plus some documentation improvements +and our lodash deps bot a bump. + +This is our first week really focused on getting the +[big bugs](https://github.com/npm/npm/issues?q=is%3Aopen+is%3Aissue+label:big-bug) +list down. Our work from this week will be landing next week, and I can't +wait to tell you about that! (It's about symlinks!) + +#### SHRINKWRAP FIX + +* [`b894413`](https://github.com/npm/npm/commit/b8944139a935680c4a267468bb2d3c3082b5609f) + [#12372](https://github.com/npm/npm/issues/12372) + Changing a nested dependency in an `npm-shrinkwrap.json` and then running `npm install` + would not get up the updated package. This corrects that. + ([@misterbyrne](https://github.com/misterbyrne)) + +#### BUNDLED DEPENDENCIES FIX + +* [`d0c6d19`](https://github.com/npm/npm/commit/d0c6d194471be8ce3e7b41b744b24f63dd1a3f6f) + [#12476](https://github.com/npm/npm/pull/12476) + Protects against a crasher when a bundled dep is missing a package.json. + ([@dflupu](https://github.com/dflupu)) + +#### DOCS IMPROVEMENTS + +* [`6699aa5`](https://github.com/npm/npm/commit/6699aa53c0a729cfc921ac1d8107c320e5a5ac95) + [#12585](https://github.com/npm/npm/pull/12585) + Document that engineStrict is quite gone. Not "deprecated" so much as "extirpated". + ([@othiym23](https://github.com/othiym23)) +* [`7a41a84`](https://github.com/npm/npm/commit/7a41a84b655be3204d2e80848278a510e42c80e7) + [#12636](https://github.com/npm/npm/pull/12636) + Improve `npm-scripts` documentation regarding when `node-gyp` is used. + ([@reconbot](https://github.com/reconbot)) +* [`4c4b4ba`](https://github.com/npm/npm/commit/4c4b4badf09b9b50cdca85314429a0111bb35cb1) + [#12586](https://github.com/npm/npm/pull/12586) + Correct `package.json` documentation as to when `node-gyp rebuild` called. + This now matches https://docs.npmjs.com/misc/scripts#default-values + ([@reconbot](https://github.com/reconbot)) + +#### DEPENDENCY UPDATES + +* [`cfa797f`](https://github.com/npm/npm/commit/cfa797fedd34696d45b61e3ae0398407afece880) + `lodash._baseuniq@4.6.0` + ([@jdalton](https://github.com/jdalton)) +* [`ab6f180`](https://github.com/npm/npm/commit/ab6f1801971b513f9294b4b8902034ab402af02d) + `lodash.keys@4.0.7` + ([@jdalton](https://github.com/jdalton)) +* [`4b8d8b6`](https://github.com/npm/npm/commit/4b8d8b63e760a8aa03e8bffa974495dfafbfcb06) + `lodash.union@4.4.0` + ([@jdalton](https://github.com/jdalton)) +* [`46099d3`](https://github.com/npm/npm/commit/46099d34542760098e5d13c7468a405a724ca407) + `lodash.uniq@4.3.0` + ([@jdalton](https://github.com/jdalton)) +* [`fff89c6`](https://github.com/npm/npm/commit/fff89c6826c86e9e789adcc9c398385539306042) + `lodash.without@4.2.0` + ([@jdalton](https://github.com/jdalton)) + +### v3.9.0 (2016-05-05) + +Wow! This is a big release week! We've completed the fixes that let the +test suite pass on Windows, plus more general bug fixes we found while +fixing things on Windows. Plus a warning to help folks work around a common +footgun. PLUS an improvement to how npm works with long cache timeouts. + +#### INFINITE CACHE A LITTLE BETTER + +* [`111ae3e`](https://github.com/npm/npm/commit/111ae3ec366ece7ebcf5988f5bc2a7cd70737dfe) + [#8581](https://github.com/npm/npm/issues/8581) + When a package is fetched from the cache which cannot satisfy the version + requirements, an attempt to fetch it from the network is made. This is + helpful for folks using high values for `--cache-min` who are willing to + accept possibly not-the-most-recent modules in return for less network + traffic. + ([@Zirak](https://github.com/Zirak)) + +#### WARNING: FOOTGUN + +* [`60b9a05`](https://github.com/npm/npm/commit/60b9a051aa46b8892fe63b3681839a6fd6642bfd) + [#12475](https://github.com/npm/npm/pull/12475) + Options can only start with ASCII dashes. Ordinarily this isn't a problem + but many web documentation tools "helpfully" convert `--` into an emdash + (–), or `-` into an endash (–). If you copy and paste from this documentation + your commands won't work the way you expect. This adds a warning that tries + to be a little more descriptive about why your command is failing. + ([@iarna](https://github.com/iarna)) + +#### WINDOWS CI + +We have [Windows CI](https://ci.appveyor.com/project/npm/npm) setup now! We still have to +tweak it a little bit around paths to the git binaries, but it's otherwise ready! + +* [`bb5d6cb`](https://github.com/npm/npm/commit/bb5d6cbf46b2609243d3b384caadd196e665a797) + [#11444](https://github.com/npm/npm/pull/11444) + Add AppVeyor to CI matrix. + ([@othiym23](https://github.com/othiym23)) + +#### COVERAGE DATA + +Not only do our tests produce coverage reports after they run now, we also +automatically [update Coveralls](https://coveralls.io/github/npm/npm) with +results from [Travis CI](travis-ci.org/npm/npm) runs. + +* [`044cbab`](https://github.com/npm/npm/commit/044cbab0d49adeeb0d9310c64fee6c9759cc7428) + [#11444](https://github.com/npm/npm/pull/11444) + Enable coverage reporting for every test run. + ([@othiym23](https://github.com/othiym23)) + +#### EVERYONE BUGS + +* [`37c6a51`](https://github.com/npm/npm/commit/37c6a51c71b0feec8f639b3199a8a9172e58deec) + [#12150](https://github.com/npm/npm/pull/12150) + Ensure that 'npm cache ls' outputs real filenames. Previously it would + sometimes double up the package name in the path it printed. + ([@isaacs](https://github.com/isaacs)) +* [`d3ce0b2`](https://github.com/npm/npm/commit/d3ce0b253eb519375071aee29db4ee129dbcdf5c) + [#11444](https://github.com/npm/npm/pull/11444) + Fix unbuilding bins for scoped modules. + ([@iarna](https://github.com/iarna)) +* [`e928a30`](https://github.com/npm/npm/commit/e928a30947477a09245f54e9381f46b97bee32d5) + [#11444](https://github.com/npm/npm/pull/11444) + Make handling of local modules (eg `npm install /path/to/my/module`) more + consistent when saved to a `package.json`. There were bugs previously where + it wouldn't consistently resolve relative paths in the same way. + ([@iarna](https://github.com/iarna)) +* [`b820ed4`](https://github.com/npm/npm/commit/b820ed4fc04e21577fa66f7c9482b5ab002e7985) + [#11444](https://github.com/npm/npm/pull/11444) + Under certain circumstances the paths produced for linking, either + relative or absolute, would end up basing off the wrong virtual cwd. + This resulted in failures for `npm link` in this situations. + ([@iarna](https://github.com/iarna)) + +#### WINDOWS BUGS + +* [`7380425`](https://github.com/npm/npm/commit/7380425d810fb8bfc69405a9cbbdec19978a7bee) + [#11444](https://github.com/npm/npm/pull/11444) + Scoped module names were not being correctly inferred from the path on Windows. + ([@zkat](https://github.com/zkat)) +* [`91fc24f`](https://github.com/npm/npm/commit/91fc24f2763c2e0591093099ffc866c735f27fde) + [#11444](https://github.com/npm/npm/pull/11444) + Explore with a command to run didn't work properly in Windows– it would pop open a new + cmd window and leave it there. + ([@iarna](https://github.com/iarna)) + +#### WINDOWS REFACTORING + +* [`f07e643`](https://github.com/npm/npm/commit/f07e6430d4ca02f811138f6140a8bad927607a1f) + [#11444](https://github.com/npm/npm/pull/11444) + Move exec path escaping out to its own function. This turns out to be + tricky to get right because how you escape commands to run on Windows via + cmd is different then how you escape them at other times. Specifically, + you HAVE to quote each directory segment that has a quote in it, that is: + `C:\"Program Files"\MyApp\MyApp.exe` By contrast, if that were an argument + to a command being run, you CAN'T DO quote it that way, instead you have + to wrap the entire path in quotes, like so: `"C:\Program + Files\MyApp\MyApp.exe"`. + ([@iarna](https://github.com/iarna)) +* [`2e01d29`](https://github.com/npm/npm/commit/2e01d299f8244134b1aa040cab1b59c72c9df4da) + [#11444](https://github.com/npm/npm/pull/11444) + Create a single function for detecting if we're running on Windows (and + using a Windows shell like cmd) and use this instead of doing it one-off + all over the place. + ([@iarna](https://github.com/iarna)) + +#### FIX WINDOWS TESTS + +As I said before, our tests are passing on Windows! 🎉 + +* [`ef0dd74`](https://github.com/npm/npm/commit/ef0dd74583be25c72343ed07d1127e4d0cc02df9) + [#11444](https://github.com/npm/npm/pull/11444) + The fruits of many weeks of labor, fix our tests to pass on Windows. + ([@zkat](https://github.com/zkat)) + ([@iarna](https://github.com/iarna)) + +#### DEPENDENCY UPDATES + +* [`8fccda8`](https://github.com/npm/npm/commit/8fccda8587209659c469ab55c608b0e2d7533530) + [#11444](https://github.com/npm/npm/pull/11444) + `normalize-git-url@3.0.2`: + Fix file URLs on Windows. + ([@zkat](https://github.com/zkat)) +* [`f53a154`](https://github.com/npm/npm/commit/f53a154df8e0696623e6a71f33e0a7c11a7555aa) + `readable-stream@2.1.2`: + When readable-stream is disabled, reuse result of `require('stream')` + instead of calling it every time. + ([@calvinmetcalf](https://github.com/calvinmetcalf)) +* [`02841cf`](https://github.com/npm/npm/commit/02841cfb81d6ba86f691ab43d9bbdac29aec27e7) + [#11444](https://github.com/npm/npm/pull/11444) + `realize-package-specifier@3.0.2`: + Resolve local package paths relative to package root, not cwd. + ([@zkat](https://github.com/zkat)) + ([@iarna](https://github.com/iarna)) +* [`247c1c5`](https://github.com/npm/npm/commit/247c1c5ae08c882c9232ca605731039168bae6ed) + [#11444](https://github.com/npm/npm/pull/11444) + `npm-package-arg@4.1.1`: + Fix Windows file URIs with leading slashes. + ([@zkat](https://github.com/zkat)) +* [`365c72b`](https://github.com/npm/npm/commit/365c72bc3ecd9e45f9649725dd635d5625219d8c) + `which@1.2.8` + ([@isaacs](https://github.com/isaacs)) +* [`e568caa`](https://github.com/npm/npm/commit/e568caabb8390a924ce1cfa51fc914ee6c1637a2) + `graceful-fs@4.1.4` + ([@isaacs](https://github.com/isaacs)) +* [`304b974`](https://github.com/npm/npm/commit/304b97434959a58f84383bcccc0357c51a4eb39a) + [#11444](https://github.com/npm/npm/pull/11444) + `standard@6.0.8` + ([@feross](https://github.com/feross)) + ### v3.8.9 (2016-04-28) Our biggest news this week is that we got the @@ -2412,7 +2698,7 @@ in line with `npm@2`. * [`95ee92c`](https://github.com/npm/npm/commit/95ee92c) [#9433](https://github.com/npm/npm/issues/9433) - Give better error messages for invalid urls in the dependecy + Give better error messages for invalid URLs in the dependecy list. ([@jamietre](https://github.com/jamietre)) diff --git a/deps/npm/appveyor.yml b/deps/npm/appveyor.yml new file mode 100644 index 0000000000..47d806df34 --- /dev/null +++ b/deps/npm/appveyor.yml @@ -0,0 +1,36 @@ +environment: + matrix: + # LTS is our most important target + - nodejs_version: "4" + # latest + - nodejs_version: "5" + # I like 0.10 better than 0.12 + - nodejs_version: "0.10" + - nodejs_version: "0.12" + # EOL summer 2016, most likely + - nodejs_version: "0.8" + COVERALLS_REPO_TOKEN: + secure: XdC0aySefK0HLh1GNk6aKrzZPbCfPQLyA4mYtFGEp4DrTuZA/iuCUS0LDqFYO8JQ +platform: + - x86 + - x64 +install: + - ps: Install-Product node $env:nodejs_version $env:platform + - npm config set spin false + - npm rebuild + - node . install -g . + - set "PATH=%APPDATA%\npm;C:\Program Files\Git\mingw64\libexec;%PATH%" + - npm install --loglevel=http +test_script: + - node --version + - npm --version + - npm test +notifications: +- provider: Slack + incoming_webhook: + secure: vXiG5AgpqxJsXZ0N0CTYDuVrX6RMjBybZKtOx6IbRxCyjgd+DAx6Z9/0XgYQjuof7QFJY3M/U6HxaREQVYbNVHA+C5N5dNALRbKzAC8QNbA= +# GO_FAST +matrix: + fast_finish: true +# we don't need the builds, we just need tests +build: off diff --git a/deps/npm/bin/npm-cli.js b/deps/npm/bin/npm-cli.js index 2346feba47..55fa054d66 100755 --- a/deps/npm/bin/npm-cli.js +++ b/deps/npm/bin/npm-cli.js @@ -1,6 +1,5 @@ #!/usr/bin/env node ;(function () { // wrapper in case we're in module_context mode - // windows: running "npm blah" in this folder will invoke WSH, not node. /*global WScript*/ if (typeof WScript !== 'undefined') { diff --git a/deps/npm/doc/files/package.json.md b/deps/npm/doc/files/package.json.md index 15cba2b7df..af7fb8a536 100644 --- a/deps/npm/doc/files/package.json.md +++ b/deps/npm/doc/files/package.json.md @@ -654,10 +654,10 @@ field is advisory only will produce warnings when your package is installed as a ## engineStrict -**This feature was deprecated with npm 3.0.0** +**This feature was removed in npm 3.0.0** Prior to npm 3.0.0, this feature was used to treat this package as if the -user had set `engine-strict`. +user had set `engine-strict`. It is no longer used. ## os @@ -731,10 +731,10 @@ npm will default some values based on package contents. If there is a `server.js` file in the root of your package, then npm will default the `start` command to `node server.js`. -* `"scripts":{"preinstall": "node-gyp rebuild"}` +* `"scripts":{"install": "node-gyp rebuild"}` - If there is a `binding.gyp` file in the root of your package, npm will - default the `preinstall` command to compile using node-gyp. + If there is a `binding.gyp` file in the root of your package and you have not defined an `install` or `preinstall` script, npm will + default the `install` command to compile using node-gyp. * `"contributors": [...]` diff --git a/deps/npm/doc/misc/npm-scripts.md b/deps/npm/doc/misc/npm-scripts.md index e7f0f0c4e3..3164715d98 100644 --- a/deps/npm/doc/misc/npm-scripts.md +++ b/deps/npm/doc/misc/npm-scripts.md @@ -71,7 +71,8 @@ npm will default some script values based on package contents. * `"install": "node-gyp rebuild"`: - If there is a `binding.gyp` file in the root of your package, npm will + If there is a `binding.gyp` file in the root of your package and you + haven't defined your own `install` or `preinstall` scripts, npm will default the `install` command to compile using node-gyp. ## USER diff --git a/deps/npm/html/doc/README.html b/deps/npm/html/doc/README.html index bc00a45f08..d8a75cce97 100644 --- a/deps/npm/html/doc/README.html +++ b/deps/npm/html/doc/README.html @@ -126,5 +126,5 @@ will no doubt tell you to put the output in a gist or email.

       - + diff --git a/deps/npm/html/doc/cli/npm-access.html b/deps/npm/html/doc/cli/npm-access.html index 7c440d8b03..1ba078beb9 100644 --- a/deps/npm/html/doc/cli/npm-access.html +++ b/deps/npm/html/doc/cli/npm-access.html @@ -84,5 +84,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 6e98920109..e6135b2d24 100644 --- a/deps/npm/html/doc/cli/npm-adduser.html +++ b/deps/npm/html/doc/cli/npm-adduser.html @@ -72,5 +72,5 @@ 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 169066e35c..f838c7ec04 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 7c19ab81fa..43e6ad0a00 100644 --- a/deps/npm/html/doc/cli/npm-bugs.html +++ b/deps/npm/html/doc/cli/npm-bugs.html @@ -55,5 +55,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 c049a5970a..29dc60289d 100644 --- a/deps/npm/html/doc/cli/npm-build.html +++ b/deps/npm/html/doc/cli/npm-build.html @@ -40,5 +40,5 @@ directly, run:

       - + diff --git a/deps/npm/html/doc/cli/npm-bundle.html b/deps/npm/html/doc/cli/npm-bundle.html index adf4984324..5bb20102c8 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 ff8e909533..fcf9fa3b0c 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 18c53c4bf1..7b78e9e468 100644 --- a/deps/npm/html/doc/cli/npm-completion.html +++ b/deps/npm/html/doc/cli/npm-completion.html @@ -43,5 +43,5 @@ completions based on the arguments.

       - + diff --git a/deps/npm/html/doc/cli/npm-config.html b/deps/npm/html/doc/cli/npm-config.html index 6ba2140103..7495ef9a3b 100644 --- a/deps/npm/html/doc/cli/npm-config.html +++ b/deps/npm/html/doc/cli/npm-config.html @@ -67,5 +67,5 @@ global config.

       - + diff --git a/deps/npm/html/doc/cli/npm-dedupe.html b/deps/npm/html/doc/cli/npm-dedupe.html index ee21a8813b..58b4be2955 100644 --- a/deps/npm/html/doc/cli/npm-dedupe.html +++ b/deps/npm/html/doc/cli/npm-dedupe.html @@ -61,5 +61,5 @@ result in new modules being installed.

       - + diff --git a/deps/npm/html/doc/cli/npm-deprecate.html b/deps/npm/html/doc/cli/npm-deprecate.html index 34031e1c12..2ee07776d9 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 9bfb253b18..5938cbc315 100644 --- a/deps/npm/html/doc/cli/npm-dist-tag.html +++ b/deps/npm/html/doc/cli/npm-dist-tag.html @@ -87,5 +87,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 440c2968ec..221da6b9a5 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 53a6628580..2303e31e7c 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 3df5851dd5..dc369cc353 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 dfcfc0d613..251d15f1ae 100644 --- a/deps/npm/html/doc/cli/npm-help-search.html +++ b/deps/npm/html/doc/cli/npm-help-search.html @@ -45,5 +45,5 @@ where the terms were found in the documentation.

       - + diff --git a/deps/npm/html/doc/cli/npm-help.html b/deps/npm/html/doc/cli/npm-help.html index 9f7c503b02..16aa7f74c0 100644 --- a/deps/npm/html/doc/cli/npm-help.html +++ b/deps/npm/html/doc/cli/npm-help.html @@ -50,5 +50,5 @@ matches are equivalent to specifying a topic name.

       - + diff --git a/deps/npm/html/doc/cli/npm-init.html b/deps/npm/html/doc/cli/npm-init.html index 8ec506cb0d..8378206733 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-test.html b/deps/npm/html/doc/cli/npm-install-test.html index 31b2360d2f..9b8f31b37e 100644 --- a/deps/npm/html/doc/cli/npm-install-test.html +++ b/deps/npm/html/doc/cli/npm-install-test.html @@ -42,4 +42,4 @@ takes exactly the same arguments as npm install.

       - + diff --git a/deps/npm/html/doc/cli/npm-install.html b/deps/npm/html/doc/cli/npm-install.html index 19433d8ddb..d0d91f6574 100644 --- a/deps/npm/html/doc/cli/npm-install.html +++ b/deps/npm/html/doc/cli/npm-install.html @@ -312,5 +312,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 171d15d02b..b059f3d24b 100644 --- a/deps/npm/html/doc/cli/npm-link.html +++ b/deps/npm/html/doc/cli/npm-link.html @@ -73,5 +73,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 5bfb0614b3..e941a8e64d 100644 --- a/deps/npm/html/doc/cli/npm-logout.html +++ b/deps/npm/html/doc/cli/npm-logout.html @@ -51,5 +51,5 @@ it takes precedence.

       - + diff --git a/deps/npm/html/doc/cli/npm-ls.html b/deps/npm/html/doc/cli/npm-ls.html index 8054e28c1a..6e0645ba50 100644 --- a/deps/npm/html/doc/cli/npm-ls.html +++ b/deps/npm/html/doc/cli/npm-ls.html @@ -21,7 +21,7 @@ installed, as well as their dependencies, in a tree-structure.

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@3.8.9 /path/to/npm
+
npm@3.9.3 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5
 

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

@@ -104,5 +104,5 @@ project.

       - + diff --git a/deps/npm/html/doc/cli/npm-outdated.html b/deps/npm/html/doc/cli/npm-outdated.html index 44adfcf8c3..d1abeec7c9 100644 --- a/deps/npm/html/doc/cli/npm-outdated.html +++ b/deps/npm/html/doc/cli/npm-outdated.html @@ -116,5 +116,5 @@ project.

       - + diff --git a/deps/npm/html/doc/cli/npm-owner.html b/deps/npm/html/doc/cli/npm-owner.html index 6128be0aed..ca54bbd494 100644 --- a/deps/npm/html/doc/cli/npm-owner.html +++ b/deps/npm/html/doc/cli/npm-owner.html @@ -51,5 +51,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 6231908218..331f878363 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-ping.html b/deps/npm/html/doc/cli/npm-ping.html index cd427f7daf..d99f3a785a 100644 --- a/deps/npm/html/doc/cli/npm-ping.html +++ b/deps/npm/html/doc/cli/npm-ping.html @@ -32,4 +32,4 @@        - + diff --git a/deps/npm/html/doc/cli/npm-prefix.html b/deps/npm/html/doc/cli/npm-prefix.html index 6590641892..705cb7ef6e 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 2056b1e8c5..ad6df58f94 100644 --- a/deps/npm/html/doc/cli/npm-prune.html +++ b/deps/npm/html/doc/cli/npm-prune.html @@ -40,5 +40,5 @@ negate NODE_ENV being set to production.

       - + diff --git a/deps/npm/html/doc/cli/npm-publish.html b/deps/npm/html/doc/cli/npm-publish.html index fc55ae4a8c..510934dd93 100644 --- a/deps/npm/html/doc/cli/npm-publish.html +++ b/deps/npm/html/doc/cli/npm-publish.html @@ -72,5 +72,5 @@ it is removed with npm-unpublish(1).

       - + diff --git a/deps/npm/html/doc/cli/npm-rebuild.html b/deps/npm/html/doc/cli/npm-rebuild.html index 7d010cf146..7aa72125c9 100644 --- a/deps/npm/html/doc/cli/npm-rebuild.html +++ b/deps/npm/html/doc/cli/npm-rebuild.html @@ -35,5 +35,5 @@ the new binary.

       - + diff --git a/deps/npm/html/doc/cli/npm-repo.html b/deps/npm/html/doc/cli/npm-repo.html index 2cb9c62624..415a6fc26c 100644 --- a/deps/npm/html/doc/cli/npm-repo.html +++ b/deps/npm/html/doc/cli/npm-repo.html @@ -41,5 +41,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 85c870f2d2..5ca681c9dc 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-root.html b/deps/npm/html/doc/cli/npm-root.html index 3a551f9f64..ba312bdfa6 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 d22c8a7533..598b7658e4 100644 --- a/deps/npm/html/doc/cli/npm-run-script.html +++ b/deps/npm/html/doc/cli/npm-run-script.html @@ -63,5 +63,5 @@ you will be given a warning to run npm install, just in case you        - + diff --git a/deps/npm/html/doc/cli/npm-search.html b/deps/npm/html/doc/cli/npm-search.html index 2398f8e98b..55ccade815 100644 --- a/deps/npm/html/doc/cli/npm-search.html +++ b/deps/npm/html/doc/cli/npm-search.html @@ -57,5 +57,5 @@ Pass a different registry url such as the default above in order to override thi        - + diff --git a/deps/npm/html/doc/cli/npm-shrinkwrap.html b/deps/npm/html/doc/cli/npm-shrinkwrap.html index 1154c1d554..25d8744b0f 100644 --- a/deps/npm/html/doc/cli/npm-shrinkwrap.html +++ b/deps/npm/html/doc/cli/npm-shrinkwrap.html @@ -169,5 +169,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 3707e36ea8..87229093b5 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 dd81cc8500..f1aa3beeb1 100644 --- a/deps/npm/html/doc/cli/npm-stars.html +++ b/deps/npm/html/doc/cli/npm-stars.html @@ -36,5 +36,5 @@ you will most certainly enjoy this command.

       - + diff --git a/deps/npm/html/doc/cli/npm-start.html b/deps/npm/html/doc/cli/npm-start.html index f3b8c1e93d..591d0c4da4 100644 --- a/deps/npm/html/doc/cli/npm-start.html +++ b/deps/npm/html/doc/cli/npm-start.html @@ -39,5 +39,5 @@ more details.

       - + diff --git a/deps/npm/html/doc/cli/npm-stop.html b/deps/npm/html/doc/cli/npm-stop.html index 5b17fbe4f1..4ec953de40 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 5bde83752a..edf98f585c 100644 --- a/deps/npm/html/doc/cli/npm-tag.html +++ b/deps/npm/html/doc/cli/npm-tag.html @@ -63,5 +63,5 @@ that do not begin with a number or the letter v.

       - + diff --git a/deps/npm/html/doc/cli/npm-team.html b/deps/npm/html/doc/cli/npm-team.html index 9c800024dc..b3a481f9f3 100644 --- a/deps/npm/html/doc/cli/npm-team.html +++ b/deps/npm/html/doc/cli/npm-team.html @@ -67,4 +67,4 @@ use the npm access command to grant or revoke the appropriate permi        - + diff --git a/deps/npm/html/doc/cli/npm-test.html b/deps/npm/html/doc/cli/npm-test.html index 8b087f522f..755d319cd5 100644 --- a/deps/npm/html/doc/cli/npm-test.html +++ b/deps/npm/html/doc/cli/npm-test.html @@ -38,5 +38,5 @@ true.

       - + diff --git a/deps/npm/html/doc/cli/npm-uninstall.html b/deps/npm/html/doc/cli/npm-uninstall.html index bcba8719ce..93c940af07 100644 --- a/deps/npm/html/doc/cli/npm-uninstall.html +++ b/deps/npm/html/doc/cli/npm-uninstall.html @@ -60,5 +60,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 e326472db8..ea5e2c53b6 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 3fc761c639..76af599fd1 100644 --- a/deps/npm/html/doc/cli/npm-update.html +++ b/deps/npm/html/doc/cli/npm-update.html @@ -118,5 +118,5 @@ be downgraded.

       - + diff --git a/deps/npm/html/doc/cli/npm-version.html b/deps/npm/html/doc/cli/npm-version.html index 124e48157d..4baf12a64d 100644 --- a/deps/npm/html/doc/cli/npm-version.html +++ b/deps/npm/html/doc/cli/npm-version.html @@ -100,5 +100,5 @@ and tag up to the server, and deletes the build/temp directory.

       - + diff --git a/deps/npm/html/doc/cli/npm-view.html b/deps/npm/html/doc/cli/npm-view.html index c2e626905c..714c32e6ae 100644 --- a/deps/npm/html/doc/cli/npm-view.html +++ b/deps/npm/html/doc/cli/npm-view.html @@ -86,5 +86,5 @@ the field name.

       - + diff --git a/deps/npm/html/doc/cli/npm-whoami.html b/deps/npm/html/doc/cli/npm-whoami.html index 03488a3852..7932350fbc 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 cb8ad46157..9fb7db821e 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

-

3.8.9

+

3.9.3

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 @@ -126,7 +126,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

Unless the user has set the engine-strict config flag, this field is advisory only will produce warnings when your package is installed as a dependency.

engineStrict

-

This feature was deprecated with npm 3.0.0

+

This feature was removed in npm 3.0.0

Prior to npm 3.0.0, this feature was used to treat this package as if the -user had set engine-strict.

+user had set engine-strict. It is no longer used.

os

You can specify which operating systems your module will run on:

@@ -544,9 +544,9 @@ overridden.

If there is a server.js file in the root of your package, then npm will default the start command to node server.js.

-
  • "scripts":{"preinstall": "node-gyp rebuild"}

    -

    If there is a binding.gyp file in the root of your package, npm will -default the preinstall command to compile using node-gyp.

    +
  • "scripts":{"install": "node-gyp rebuild"}

    +

    If there is a binding.gyp file in the root of your package and you have not defined an install or preinstall script, npm will +default the install command to compile using node-gyp.

  • "contributors": [...]

    If there is an AUTHORS file in the root of your package, npm will @@ -579,5 +579,5 @@ ignored.

           - + diff --git a/deps/npm/html/doc/files/npmrc.html b/deps/npm/html/doc/files/npmrc.html index 603df70296..14a406d25c 100644 --- a/deps/npm/html/doc/files/npmrc.html +++ b/deps/npm/html/doc/files/npmrc.html @@ -83,5 +83,5 @@ manner.

           - + diff --git a/deps/npm/html/doc/files/package.json.html b/deps/npm/html/doc/files/package.json.html index f64867d4bc..abad06ab89 100644 --- a/deps/npm/html/doc/files/package.json.html +++ b/deps/npm/html/doc/files/package.json.html @@ -494,9 +494,9 @@ are capable of properly installing your program. For example:

    Unless the user has set the engine-strict config flag, this field is advisory only will produce warnings when your package is installed as a dependency.

    engineStrict

    -

    This feature was deprecated with npm 3.0.0

    +

    This feature was removed in npm 3.0.0

    Prior to npm 3.0.0, this feature was used to treat this package as if the -user had set engine-strict.

    +user had set engine-strict. It is no longer used.

    os

    You can specify which operating systems your module will run on:

    @@ -544,9 +544,9 @@ overridden.

    If there is a server.js file in the root of your package, then npm will default the start command to node server.js.

  • -
  • "scripts":{"preinstall": "node-gyp rebuild"}

    -

    If there is a binding.gyp file in the root of your package, npm will -default the preinstall command to compile using node-gyp.

    +
  • "scripts":{"install": "node-gyp rebuild"}

    +

    If there is a binding.gyp file in the root of your package and you have not defined an install or preinstall script, npm will +default the install command to compile using node-gyp.

  • "contributors": [...]

    If there is an AUTHORS file in the root of your package, npm will @@ -579,5 +579,5 @@ ignored.

           - + diff --git a/deps/npm/html/doc/index.html b/deps/npm/html/doc/index.html index 47ec351d52..7a3b07647e 100644 --- a/deps/npm/html/doc/index.html +++ b/deps/npm/html/doc/index.html @@ -162,5 +162,5 @@        - + diff --git a/deps/npm/html/doc/misc/npm-coding-style.html b/deps/npm/html/doc/misc/npm-coding-style.html index c30d6200f1..a1c314795f 100644 --- a/deps/npm/html/doc/misc/npm-coding-style.html +++ b/deps/npm/html/doc/misc/npm-coding-style.html @@ -153,5 +153,5 @@ set to anything."

           - + diff --git a/deps/npm/html/doc/misc/npm-config.html b/deps/npm/html/doc/misc/npm-config.html index 82612bff67..81da576c69 100644 --- a/deps/npm/html/doc/misc/npm-config.html +++ b/deps/npm/html/doc/misc/npm-config.html @@ -862,5 +862,5 @@ exit successfully.

           - + diff --git a/deps/npm/html/doc/misc/npm-developers.html b/deps/npm/html/doc/misc/npm-developers.html index d2c690a8e8..07e7de3c0b 100644 --- a/deps/npm/html/doc/misc/npm-developers.html +++ b/deps/npm/html/doc/misc/npm-developers.html @@ -194,5 +194,5 @@ from a fresh checkout.

           - + diff --git a/deps/npm/html/doc/misc/npm-disputes.html b/deps/npm/html/doc/misc/npm-disputes.html index 245b8d62e4..6db1b489b6 100644 --- a/deps/npm/html/doc/misc/npm-disputes.html +++ b/deps/npm/html/doc/misc/npm-disputes.html @@ -13,7 +13,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.

    @@ -51,12 +51,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.)
  • @@ -112,5 +112,5 @@ things into it.        - + diff --git a/deps/npm/html/doc/misc/npm-index.html b/deps/npm/html/doc/misc/npm-index.html index 8ca630d3e6..88bd599dba 100644 --- a/deps/npm/html/doc/misc/npm-index.html +++ b/deps/npm/html/doc/misc/npm-index.html @@ -162,4 +162,4 @@        - + diff --git a/deps/npm/html/doc/misc/npm-orgs.html b/deps/npm/html/doc/misc/npm-orgs.html index 98b8ca0fb4..d038adea8b 100644 --- a/deps/npm/html/doc/misc/npm-orgs.html +++ b/deps/npm/html/doc/misc/npm-orgs.html @@ -86,4 +86,4 @@        - + diff --git a/deps/npm/html/doc/misc/npm-registry.html b/deps/npm/html/doc/misc/npm-registry.html index 363a1528ef..4de51caf8f 100644 --- a/deps/npm/html/doc/misc/npm-registry.html +++ b/deps/npm/html/doc/misc/npm-registry.html @@ -70,5 +70,5 @@ effectively implement the entire CouchDB API anyway.

           - + diff --git a/deps/npm/html/doc/misc/npm-scope.html b/deps/npm/html/doc/misc/npm-scope.html index 98e9b5901f..4e60189a90 100644 --- a/deps/npm/html/doc/misc/npm-scope.html +++ b/deps/npm/html/doc/misc/npm-scope.html @@ -91,5 +91,5 @@ that registry instead.

           - + diff --git a/deps/npm/html/doc/misc/npm-scripts.html b/deps/npm/html/doc/misc/npm-scripts.html index 6ba0c93fd0..eacb44166d 100644 --- a/deps/npm/html/doc/misc/npm-scripts.html +++ b/deps/npm/html/doc/misc/npm-scripts.html @@ -74,7 +74,8 @@ other system tools on the target machines. will default the start command to node server.js.

  • "install": "node-gyp rebuild":

    -

    If there is a binding.gyp file in the root of your package, npm will +

    If there is a binding.gyp file in the root of your package and you +haven't defined your own install or preinstall scripts, npm will default the install command to compile using node-gyp.

  • @@ -207,5 +208,5 @@ scripts is for compilation which must be done on the target architecture.        - + diff --git a/deps/npm/html/doc/misc/removing-npm.html b/deps/npm/html/doc/misc/removing-npm.html index 0341d6a195..66ea0812ec 100644 --- a/deps/npm/html/doc/misc/removing-npm.html +++ b/deps/npm/html/doc/misc/removing-npm.html @@ -57,5 +57,5 @@ modules. To track those down, you can do the following:

           - + diff --git a/deps/npm/html/doc/misc/semver.html b/deps/npm/html/doc/misc/semver.html index d0ae3178c6..26e2ab5731 100644 --- a/deps/npm/html/doc/misc/semver.html +++ b/deps/npm/html/doc/misc/semver.html @@ -302,5 +302,5 @@ range, use the satisfies(version, range) function.

           - + diff --git a/deps/npm/lib/access.js b/deps/npm/lib/access.js index 158ce50544..69527c2aa4 100644 --- a/deps/npm/lib/access.js +++ b/deps/npm/lib/access.js @@ -35,7 +35,6 @@ access.completion = function (opts, cb) { } else { return cb(null, []) } - break case 'public': case 'restricted': case 'ls-packages': diff --git a/deps/npm/lib/cache/add-remote-git.js b/deps/npm/lib/cache/add-remote-git.js index 5fbd8dbeda..d8f64a85be 100644 --- a/deps/npm/lib/cache/add-remote-git.js +++ b/deps/npm/lib/cache/add-remote-git.js @@ -443,7 +443,7 @@ function getResolved (uri, treeish) { // Checks for known protocols: // http:, https:, ssh:, and git:, with optional git+ prefix. if (!parsed.protocol || - !parsed.protocol.match(/^(((git\+)?(https?|ssh))|git|file):$/)) { + !parsed.protocol.match(/^(((git\+)?(https?|ssh|file))|git|file):$/)) { uri = 'git+ssh://' + uri } diff --git a/deps/npm/lib/cache/caching-client.js b/deps/npm/lib/cache/caching-client.js index f06dde0021..a6bcee373d 100644 --- a/deps/npm/lib/cache/caching-client.js +++ b/deps/npm/lib/cache/caching-client.js @@ -75,6 +75,10 @@ function get (uri, params, cb) { return get_.call(this, uri, cachePath, params, cb) } + if (params.skipCache) { + return get_.call(this, uri, cachePath, params, cb) + } + var client = this fs.stat(cachePath, function (er, stat) { if (!er) { @@ -112,6 +116,8 @@ function get_ (uri, cachePath, params, cb) { if (data._etag) etag = data._etag if (data._lastModified) lastModified = data._lastModified + data._cached = true + if (stat && timeout && timeout > 0) { if ((Date.now() - stat.mtime.getTime()) / 1000 < timeout) { log.verbose('get', uri, 'not expired, no request') diff --git a/deps/npm/lib/completion.js b/deps/npm/lib/completion.js index 96f4c3ee55..ae611f918e 100644 --- a/deps/npm/lib/completion.js +++ b/deps/npm/lib/completion.js @@ -1,4 +1,3 @@ - module.exports = completion completion.usage = 'source <(npm completion)' @@ -14,6 +13,7 @@ var configNames = Object.keys(configTypes) var shorthandNames = Object.keys(shorthands) var allConfs = configNames.concat(shorthandNames) var once = require('once') +var isWindowsShell = require('./utils/is-windows-shell.js') completion.completion = function (opts, cb) { if (opts.w > 3) return cb() @@ -45,7 +45,7 @@ completion.completion = function (opts, cb) { } function completion (args, cb) { - if (process.platform === 'win32' && !(/^MINGW(32|64)$/.test(process.env.MSYSTEM))) { + if (isWindowsShell) { var e = new Error('npm completion supported only in MINGW / Git bash on Windows') e.code = 'ENOTSUP' e.errno = require('constants').ENOTSUP diff --git a/deps/npm/lib/config/core.js b/deps/npm/lib/config/core.js index d1306eb4c8..b833b75409 100644 --- a/deps/npm/lib/config/core.js +++ b/deps/npm/lib/config/core.js @@ -10,6 +10,7 @@ var ini = require('ini') var Umask = configDefs.Umask var mkdirp = require('mkdirp') var umask = require('../utils/umask') +var isWindows = require('../utils/is-windows.js') exports.load = load exports.Conf = Conf @@ -391,7 +392,7 @@ function parseField (f, k) { f = envReplace(f) if (isPath) { - var homePattern = process.platform === 'win32' ? /^~(\/|\\)/ : /^~\// + var homePattern = isWindows ? /^~(\/|\\)/ : /^~\// if (f.match(homePattern) && process.env.HOME) { f = path.resolve(process.env.HOME, f.substr(2)) } diff --git a/deps/npm/lib/explore.js b/deps/npm/lib/explore.js index 105ff84cc8..05b5220d5f 100644 --- a/deps/npm/lib/explore.js +++ b/deps/npm/lib/explore.js @@ -9,15 +9,30 @@ var npm = require('./npm.js') var spawn = require('./utils/spawn') var path = require('path') var fs = require('graceful-fs') +var isWindowsShell = require('./utils/is-windows-shell.js') +var escapeExecPath = require('./utils/escape-exec-path.js') +var escapeArg = require('./utils/escape-arg.js') function explore (args, cb) { if (args.length < 1 || !args[0]) return cb(explore.usage) var p = args.shift() - args = args.join(' ').trim() - if (args) args = ['-c', args] - else args = [] var cwd = path.resolve(npm.dir, p) + var opts = {cwd: cwd, stdio: 'inherit'} + + var shellArgs = [] + if (args) { + if (isWindowsShell) { + var execCmd = escapeExecPath(args.shift()) + var execArgs = [execCmd].concat(args.map(escapeArg)) + opts.windowsVerbatimArguments = true + shellArgs = ['/d', '/s', '/c'].concat(execArgs) + } else { + shellArgs.unshift('-c') + shellArgs = ['-c', args.map(escapeArg).join(' ').trim()] + } + } + var sh = npm.config.get('shell') fs.stat(cwd, function (er, s) { if (er || !s.isDirectory()) { @@ -26,17 +41,17 @@ function explore (args, cb) { )) } - if (!args.length) { + if (!shellArgs.length) { console.log( '\nExploring ' + cwd + '\n' + "Type 'exit' or ^D when finished\n" ) } - var shell = spawn(sh, args, { cwd: cwd, stdio: 'inherit' }) + var shell = spawn(sh, shellArgs, opts) shell.on('close', function (er) { // only fail if non-interactive. - if (!args.length) return cb() + if (!shellArgs.length) return cb() cb(er) }) }) diff --git a/deps/npm/lib/fetch-package-metadata.js b/deps/npm/lib/fetch-package-metadata.js index 8965a561aa..d4f02bb278 100644 --- a/deps/npm/lib/fetch-package-metadata.js +++ b/deps/npm/lib/fetch-package-metadata.js @@ -63,26 +63,29 @@ module.exports = function fetchPackageMetadata (spec, where, tracker, done) { fetchOtherPackageData(spec, dep, where, addRequestedAndFinish) } function addRequestedAndFinish (er, pkg) { - if (pkg) { - pkg._requested = dep - pkg._spec = spec - pkg._where = where - if (!pkg._args) pkg._args = [] - pkg._args.push([pkg._spec, pkg._where]) - // non-npm registries can and will return unnormalized data, plus - // even the npm registry may have package data normalized with older - // normalization rules. This ensures we get package data in a consistent, - // stable format. - try { - normalizePackageData(pkg) - } catch (ex) { - // don't care - } - } + if (pkg) annotateMetadata(pkg, dep, spec, where) logAndFinish(er, pkg) } } +var annotateMetadata = module.exports.annotateMetadata = function (pkg, requested, spec, where) { + validate('OOSS', arguments) + pkg._requested = requested + pkg._spec = spec + pkg._where = where + if (!pkg._args) pkg._args = [] + pkg._args.push([requested, where]) + // non-npm registries can and will return unnormalized data, plus + // even the npm registry may have package data normalized with older + // normalization rules. This ensures we get package data in a consistent, + // stable format. + try { + normalizePackageData(pkg) + } catch (ex) { + // don't care + } +} + function fetchOtherPackageData (spec, dep, where, next) { validate('SOSF', arguments) log.silly('fetchOtherPackageData', spec) @@ -150,6 +153,16 @@ function fetchNamedPackageData (dep, next) { } } + // We didn't manage to find a compatible version + // If this package was requested from cache, force hitting the network + if (pkg._cached) { + log.silly('fetchNamedPackageData', 'No valid target from cache, forcing network') + return npm.registry.get(url, { + auth: auth, + skipCache: true + }, pulseTillDone('fetchMetadata', iferr(next, pickVersionFromRegistryDocument))) + } + // And failing that, we error out var targets = versions.length ? 'Valid install targets:\n' + versions.join(', ') + '\n' diff --git a/deps/npm/lib/install/action/extract.js b/deps/npm/lib/install/action/extract.js index 4b627a5c30..60aae036c2 100644 --- a/deps/npm/lib/install/action/extract.js +++ b/deps/npm/lib/install/action/extract.js @@ -30,6 +30,11 @@ function andUpdatePackageJson (pkg, buildpath, next) { function andStageBundledChildren (pkg, buildpath, log, next) { var staging = path.resolve(buildpath, '..') return iferr(next, function () { + for (var i = 0; i < pkg.children.length; ++i) { + var c = pkg.children[i] + if (!c.package.name) return next(c.error) + } + asyncMap(pkg.children, andStageBundledModule(pkg, staging, buildpath), cleanupBundled) }) function cleanupBundled () { diff --git a/deps/npm/lib/install/deps.js b/deps/npm/lib/install/deps.js index e15403545c..edc317f846 100644 --- a/deps/npm/lib/install/deps.js +++ b/deps/npm/lib/install/deps.js @@ -31,30 +31,32 @@ var moduleName = require('../utils/module-name.js') // The export functions in this module mutate a dependency tree, adding // items to them. -function isDep (tree, child) { - if (child.fromShrinkwrap) return true +function isDep (tree, child, cb) { var name = moduleName(child) - var requested = isProdDep(tree, name) - var matches - if (requested) matches = doesChildVersionMatch(child, requested, tree) - if (matches) return matches - requested = isDevDep(tree, name) - if (!requested) return - return doesChildVersionMatch(child, requested, tree) + var prodVer = isProdDep(tree, name) + var devVer = isDevDep(tree, name) + + childDependencySpecifier(tree, name, prodVer, function (er, prodSpec) { + if (er) return cb(child.fromShrinkwrap) + var matches + if (prodSpec) matches = doesChildVersionMatch(child, prodSpec, tree) + if (matches) return cb(true, prodSpec) + if (devVer === prodVer) return cb(child.fromShrinkwrap) + childDependencySpecifier(tree, name, devVer, function (er, devSpec) { + if (er) return cb(child.fromShrinkwrap) + cb(doesChildVersionMatch(child, devSpec, tree) || child.fromShrinkwrap, null, devSpec) + }) + }) } -function isDevDep (tree, name) { +function isDevDep (tree, name, cb) { var devDeps = tree.package.devDependencies || {} - var reqVer = devDeps[name] - if (reqVer == null) return - return npa(name + '@' + reqVer) + return devDeps[name] } -function isProdDep (tree, name) { +function isProdDep (tree, name, cb) { var deps = tree.package.dependencies || {} - var reqVer = deps[name] - if (reqVer == null) return false - return npa(name + '@' + reqVer) + return deps[name] } var registryTypes = { range: true, version: true } @@ -80,6 +82,21 @@ exports.recalculateMetadata = function (tree, log, next) { recalculateMetadata(tree, log, {}, next) } +function childDependencySpecifier (tree, name, spec, cb) { + if (!tree.resolved) tree.resolved = {} + if (!tree.resolved[name]) tree.resolved[name] = {} + if (tree.resolved[name][spec]) { + return process.nextTick(function () { + cb(null, tree.resolved[name][spec]) + }) + } + realizePackageSpecifier(name + '@' + spec, packageRelativePath(tree), function (er, req) { + if (er) return cb(er) + tree.resolved[name][spec] = req + cb(null, req) + }) +} + function recalculateMetadata (tree, log, seen, next) { validate('OOOF', arguments) if (seen[tree.path]) return next() @@ -87,7 +104,8 @@ function recalculateMetadata (tree, log, seen, next) { if (tree.parent == null) resetMetadata(tree) function markDeps (spec, done) { validate('SF', arguments) - realizePackageSpecifier(spec, packageRelativePath(tree), function (er, req) { + var matched = spec.match(/^(@?[^@]+)@(.*)$/) + childDependencySpecifier(tree, matched[1], matched[2], function (er, req) { if (er || !req.name) return done() var child = findRequirement(tree, req.name, req) if (child) { @@ -106,11 +124,26 @@ function recalculateMetadata (tree, log, seen, next) { function specs (deps) { return Object.keys(deps).map(function (depname) { return depname + '@' + deps[depname] }) } + + // Ensure dependencies and dev dependencies are marked as required var tomark = specs(tree.package.dependencies) if (!tree.parent && (npm.config.get('dev') || !npm.config.get('production'))) { tomark = union(tomark, specs(tree.package.devDependencies)) } + // Ensure any children ONLY from a shrinkwrap are also included + var childrenOnlyInShrinkwrap = tree.children.filter(function (child) { + return child.fromShrinkwrap && + !tree.package.dependencies[child.package.name] && + !tree.package.devDependencies[child.package.name] + }) + var tomarkOnlyInShrinkwrap = childrenOnlyInShrinkwrap.map(function (child) { + return child.package._spec + }) + tomark = union(tomark, tomarkOnlyInShrinkwrap) + + // Don't bother trying to recalc children of failed deps tree.children = tree.children.filter(function (child) { return !child.failed }) + chain([ [asyncMap, tomark, markDeps], [asyncMap, tree.children, function (child, done) { recalculateMetadata(child, log, seen, done) }] @@ -122,13 +155,15 @@ function recalculateMetadata (tree, log, seen, next) { }) } -function addRequiredDep (tree, child) { - if (!isDep(tree, child)) return false - var name = isProdDep(tree, moduleName(child)) ? flatNameFromTree(tree) : '#DEV:' + flatNameFromTree(tree) - replaceModuleName(child.package, '_requiredBy', name) - replaceModule(child, 'requiredBy', tree) - replaceModule(tree, 'requires', child) - return true +function addRequiredDep (tree, child, cb) { + isDep(tree, child, function (childIsDep, childIsProdDep, childIsDevDep) { + if (!childIsDep) return cb(false) + var name = childIsProdDep ? flatNameFromTree(tree) : '#DEV:' + flatNameFromTree(tree) + replaceModuleName(child.package, '_requiredBy', name) + replaceModule(child, 'requiredBy', tree) + replaceModule(tree, 'requires', child) + cb(true) + }) } exports._removeObsoleteDep = removeObsoleteDep @@ -207,10 +242,12 @@ exports.loadRequestedDeps = function (args, tree, saveToDependencies, log, next) // For things the user asked to install, that aren't a dependency (or // won't be when we're done), flag it as "depending" on the user // themselves, so we don't remove it as a dep that no longer exists - if (!addRequiredDep(tree, child)) { - replaceModuleName(child.package, '_requiredBy', '#USER') - } - depLoaded(null, child, tracker) + addRequiredDep(tree, child, function (childIsDep) { + if (!childIsDep) { + replaceModuleName(child.package, '_requiredBy', '#USER') + } + depLoaded(null, child, tracker) + }) })) }, andForEachChild(loadDeps, andFinishTracker(log, next))) } @@ -382,8 +419,7 @@ exports.loadExtraneous.andResolveDeps = function (tree, log, next) { function addDependency (name, versionSpec, tree, log, done) { validate('SSOOF', arguments) var next = andAddParentToErrors(tree, done) - var spec = name + '@' + versionSpec - realizePackageSpecifier(spec, packageRelativePath(tree), iferr(done, function (req) { + childDependencySpecifier(tree, name, versionSpec, iferr(done, function (req) { var child = findRequirement(tree, name, req) if (child) { resolveWithExistingModule(child, tree, log, iferr(next, function (child, log) { @@ -401,11 +437,10 @@ function addDependency (name, versionSpec, tree, log, done) { function resolveWithExistingModule (child, tree, log, next) { validate('OOOF', arguments) - addRequiredDep(tree, child) - - if (tree.parent && child.parent !== tree) updatePhantomChildren(tree.parent, child) - - next(null, child, log) + addRequiredDep(tree, child, function () { + if (tree.parent && child.parent !== tree) updatePhantomChildren(tree.parent, child) + next(null, child, log) + }) } var updatePhantomChildren = exports.updatePhantomChildren = function (current, child) { @@ -482,22 +517,23 @@ function resolveWithNewModule (pkg, tree, log, next) { var replaced = replaceModule(parent, 'children', child) if (replaced) removeObsoleteDep(replaced) - addRequiredDep(tree, child) - pkg._location = flatNameFromTree(child) + addRequiredDep(tree, child, function () { + pkg._location = flatNameFromTree(child) - if (tree.parent && parent !== tree) updatePhantomChildren(tree.parent, child) + if (tree.parent && parent !== tree) updatePhantomChildren(tree.parent, child) - if (pkg._bundled) { - inflateBundled(child, child.children) - } + if (pkg._bundled) { + inflateBundled(child, child.children) + } - if (pkg._shrinkwrap && pkg._shrinkwrap.dependencies) { - return inflateShrinkwrap(child, pkg._shrinkwrap.dependencies, function (er) { - next(er, child, log) - }) - } + if (pkg._shrinkwrap && pkg._shrinkwrap.dependencies) { + return inflateShrinkwrap(child, pkg._shrinkwrap.dependencies, function (er) { + next(er, child, log) + }) + } - next(null, child, log) + next(null, child, log) + }) })) })) } diff --git a/deps/npm/lib/install/inflate-shrinkwrap.js b/deps/npm/lib/install/inflate-shrinkwrap.js index ce22f4e4c5..b38181b9f1 100644 --- a/deps/npm/lib/install/inflate-shrinkwrap.js +++ b/deps/npm/lib/install/inflate-shrinkwrap.js @@ -3,7 +3,9 @@ var url = require('url') var asyncMap = require('slide').asyncMap var validate = require('aproba') var iferr = require('iferr') +var realizePackageSpecifier = require('realize-package-specifier') var fetchPackageMetadata = require('../fetch-package-metadata.js') +var annotateMetadata = require('../fetch-package-metadata.js').annotateMetadata var addShrinkwrap = require('../fetch-package-metadata.js').addShrinkwrap var addBundled = require('../fetch-package-metadata.js').addBundled var inflateBundled = require('./inflate-bundled.js') @@ -32,7 +34,11 @@ var inflateShrinkwrap = module.exports = function (tree, swdeps, finishInflating child.package.version === sw.version)) { if (!child.fromShrinkwrap) child.fromShrinkwrap = spec tree.children.push(child) - return next() + + return realizePackageSpecifier(spec, tree.path, iferr(next, function (requested) { + annotateMetadata(child.package, requested, spec, tree.path) + return inflateShrinkwrap(child, sw.dependencies || {}, next) + })) } fetchPackageMetadata(spec, tree.path, iferr(next, function (pkg) { pkg._from = sw.from || spec diff --git a/deps/npm/lib/ls.js b/deps/npm/lib/ls.js index 4a71c54e1b..d2fe14fb2f 100644 --- a/deps/npm/lib/ls.js +++ b/deps/npm/lib/ls.js @@ -62,7 +62,11 @@ var lsFromTree = ls.fromTree = function (dir, physicalTree, args, silent, cb) { args = args.map(function (a) { var p = npa(a) var name = p.name - var ver = semver.validRange(p.rawSpec) || '' + // When version spec is missing, we'll skip using it when filtering. + // Otherwise, `semver.validRange` would return '*', which won't + // match prerelease versions. + var ver = (p.rawSpec && + (semver.validRange(p.rawSpec) || '')) return [ name, ver, a ] }) } @@ -292,8 +296,11 @@ function filterFound (root, args) { var argName = args[ii][0] var argVersion = args[ii][1] var argRaw = args[ii][2] - if (depName === argName) { + if (depName === argName && argVersion) { found = semver.satisfies(dep.version, argVersion, true) + } else if (depName === argName) { + // If version is missing from arg, just do a name match. + found = true } else if (dep.path === argRaw) { found = true } diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index 4d45165063..9d6cda386a 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -87,7 +87,7 @@ npm.command = c if (commandCache[a]) return commandCache[a] - var cmd = require(__dirname + '/' + a + '.js') + var cmd = require(path.join(__dirname, a + '.js')) commandCache[a] = function () { var args = Array.prototype.slice.call(arguments, 0) @@ -96,6 +96,14 @@ } if (args.length === 1) args.unshift([]) + // Options are prefixed by a hyphen-minus (-, \u2d). + // Other dash-type chars look similar but are invalid. + Array(args[0]).forEach(function (arg) { + if (/^[\u2010-\u2015\u2212\uFE58\uFE63\uFF0D]/.test(arg)) { + log.error('arg', 'Argument starts with non-ascii dash, this is probably invalid:', arg) + } + }) + npm.registry.version = npm.version if (!npm.registry.refer) { npm.registry.refer = [a].concat(args[0]).map(function (arg) { diff --git a/deps/npm/lib/unbuild.js b/deps/npm/lib/unbuild.js index 9bb8d7b665..f5efb1ee6d 100644 --- a/deps/npm/lib/unbuild.js +++ b/deps/npm/lib/unbuild.js @@ -59,7 +59,7 @@ function rmStuff (pkg, folder, cb) { // if it's global, and folder is in {prefix}/node_modules, // then bins are in {prefix}/bin // otherwise, then bins are in folder/../.bin - var parent = path.dirname(folder) + var parent = pkg.name[0] === '@' ? path.dirname(path.dirname(folder)) : path.dirname(folder) var gnm = npm.dir var top = gnm === parent diff --git a/deps/npm/lib/utils/completion/file-completion.js b/deps/npm/lib/utils/completion/file-completion.js index 78777a025e..e16b636a68 100644 --- a/deps/npm/lib/utils/completion/file-completion.js +++ b/deps/npm/lib/utils/completion/file-completion.js @@ -1,7 +1,6 @@ module.exports = fileCompletion var mkdir = require('mkdirp') -var path = require('path') var glob = require('glob') function fileCompletion (root, req, depth, cb) { @@ -18,8 +17,7 @@ function fileCompletion (root, req, depth, cb) { glob(pattern, opts, function (er, files) { if (er) return cb(er) return cb(null, (files || []).map(function (f) { - var tail = f.substr(root.length + 1).replace(/^\//, '') - return path.join(req, tail) + return f.substr(root.length + 1).replace(/^\/|\/$/g, '') })) }) }) diff --git a/deps/npm/lib/utils/error-handler.js b/deps/npm/lib/utils/error-handler.js index 91b180e1b3..6eac7e9577 100644 --- a/deps/npm/lib/utils/error-handler.js +++ b/deps/npm/lib/utils/error-handler.js @@ -78,9 +78,11 @@ function exit (code, noLog) { } }) rollbacks.length = 0 + } else if (code && !noLog) { + writeLogFile(reallyExit) + } else { + rm('npm-debug.log', reallyExit) } - else if (code && !noLog) writeLogFile(reallyExit) - else rm('npm-debug.log', reallyExit) function reallyExit (er) { if (er && !code) code = typeof er.errno === 'number' ? er.errno : 1 diff --git a/deps/npm/lib/utils/escape-arg.js b/deps/npm/lib/utils/escape-arg.js new file mode 100644 index 0000000000..d12ee5edf5 --- /dev/null +++ b/deps/npm/lib/utils/escape-arg.js @@ -0,0 +1,27 @@ +'use strict' +var path = require('path') +var isWindowsShell = require('./is-windows-shell.js') + +/* +Escape the name of an executable suitable for passing to the system shell. + +Windows is easy, wrap in double quotes and you're done, as there's no +facility to create files with quotes in their names. + +Unix-likes are a little more complicated, wrap in single quotes and escape +any single quotes in the filename. +*/ + +module.exports = escapify + +function escapify (str) { + if (isWindowsShell) { + return '"' + path.normalize(str) + '"' + } else { + if (/[^-_.~/\w]/.test(str)) { + return "'" + str.replace(/'/g, "'\"'\"'") + "'" + } else { + return str + } + } +} diff --git a/deps/npm/lib/utils/escape-exec-path.js b/deps/npm/lib/utils/escape-exec-path.js new file mode 100644 index 0000000000..bf94886efa --- /dev/null +++ b/deps/npm/lib/utils/escape-exec-path.js @@ -0,0 +1,30 @@ +'use strict' +var path = require('path') +var isWindowsShell = require('./is-windows-shell.js') + +/* +Escape the name of an executable suitable for passing to the system shell. + +Windows is easy, wrap in double quotes and you're done, as there's no +facility to create files with quotes in their names. + +Unix-likes are a little more complicated, wrap in single quotes and escape +any single quotes in the filename. +*/ + +module.exports = escapify + +function windowsQuotes (str) { + if (!/ /.test(str)) return str + return '"' + str + '"' +} + +function escapify (str) { + if (isWindowsShell) { + return path.normalize(str).split(/\\/).map(windowsQuotes).join('\\') + } else if (/[^-_.~/\w]/.test(str)) { + return "'" + str.replace(/'/g, "'\"'\"'") + "'" + } else { + return str + } +} diff --git a/deps/npm/lib/utils/git.js b/deps/npm/lib/utils/git.js index 2d9da1086e..dc021300ea 100644 --- a/deps/npm/lib/utils/git.js +++ b/deps/npm/lib/utils/git.js @@ -32,14 +32,10 @@ function chainableExec () { return [execGit].concat(args) } -function whichGit (cb) { - return which(git, cb) -} - function whichAndExec (args, options, cb) { assert.equal(typeof cb, 'function', 'no callback provided') // check for git - whichGit(function (err) { + which(git, function (err) { if (err) { err.code = 'ENOGIT' return cb(err) diff --git a/deps/npm/lib/utils/is-windows-bash.js b/deps/npm/lib/utils/is-windows-bash.js new file mode 100644 index 0000000000..bc4ac7db49 --- /dev/null +++ b/deps/npm/lib/utils/is-windows-bash.js @@ -0,0 +1,3 @@ +'use strict' +var isWindows = require('./is-windows.js') +module.exports = isWindows && /^MINGW(32|64)$/.test(process.env.MSYSTEM) diff --git a/deps/npm/lib/utils/is-windows-shell.js b/deps/npm/lib/utils/is-windows-shell.js new file mode 100644 index 0000000000..803bbaa49c --- /dev/null +++ b/deps/npm/lib/utils/is-windows-shell.js @@ -0,0 +1,4 @@ +'use strict' +var isWindows = require('./is-windows.js') +var isWindowsBash = require('./is-windows-bash.js') +module.exports = isWindows && !isWindowsBash diff --git a/deps/npm/lib/utils/is-windows.js b/deps/npm/lib/utils/is-windows.js new file mode 100644 index 0000000000..8a991d54f5 --- /dev/null +++ b/deps/npm/lib/utils/is-windows.js @@ -0,0 +1,2 @@ +'use strict' +module.exports = process.platform === 'win32' diff --git a/deps/npm/lib/utils/lifecycle.js b/deps/npm/lib/utils/lifecycle.js index b5893ff6a4..fd1a59b74c 100644 --- a/deps/npm/lib/utils/lifecycle.js +++ b/deps/npm/lib/utils/lifecycle.js @@ -293,8 +293,10 @@ function makeEnv (data, prefix, env) { prefix = prefix || 'npm_package_' if (!env) { env = {} - for (var i in process.env) if (!i.match(/^npm_/)) { - env[i] = process.env[i] + for (var i in process.env) { + if (!i.match(/^npm_/)) { + env[i] = process.env[i] + } } // npat asks for tap output @@ -311,31 +313,33 @@ function makeEnv (data, prefix, env) { ) } - for (i in data) if (i.charAt(0) !== '_') { - var envKey = (prefix + i).replace(/[^a-zA-Z0-9_]/g, '_') - if (i === 'readme') { - continue - } - if (data[i] && typeof data[i] === 'object') { - try { - // quick and dirty detection for cyclical structures - JSON.stringify(data[i]) - makeEnv(data[i], envKey + '_', env) - } catch (ex) { - // usually these are package objects. - // just get the path and basic details. - var d = data[i] - makeEnv( - { name: d.name, version: d.version, path: d.path }, - envKey + '_', - env - ) + for (i in data) { + if (i.charAt(0) !== '_') { + var envKey = (prefix + i).replace(/[^a-zA-Z0-9_]/g, '_') + if (i === 'readme') { + continue + } + if (data[i] && typeof data[i] === 'object') { + try { + // quick and dirty detection for cyclical structures + JSON.stringify(data[i]) + makeEnv(data[i], envKey + '_', env) + } catch (ex) { + // usually these are package objects. + // just get the path and basic details. + var d = data[i] + makeEnv( + { name: d.name, version: d.version, path: d.path }, + envKey + '_', + env + ) + } + } else { + env[envKey] = String(data[i]) + env[envKey] = env[envKey].indexOf('\n') !== -1 + ? JSON.stringify(env[envKey]) + : env[envKey] } - } else { - env[envKey] = String(data[i]) - env[envKey] = env[envKey].indexOf('\n') !== -1 - ? JSON.stringify(env[envKey]) - : env[envKey] } } diff --git a/deps/npm/lib/utils/link.js b/deps/npm/lib/utils/link.js index d0492e076f..605b77402c 100644 --- a/deps/npm/lib/utils/link.js +++ b/deps/npm/lib/utils/link.js @@ -55,19 +55,15 @@ function link (from, to, gently, abs, cb) { if (npm.config.get('force')) gently = false to = path.resolve(to) - var target = from = path.resolve(from) - if (!abs && process.platform !== 'win32') { - // junctions on windows must be absolute - target = path.relative(path.dirname(to), from) - // if there is no folder in common, then it will be much - // longer, and using a relative link is dumb. - if (target.length >= from.length) target = from - } + var toDir = path.dirname(to) + var absTarget = path.resolve(toDir, from) + var relativeTarget = path.relative(toDir, absTarget) + var target = abs ? absTarget : relativeTarget chain( [ - [ensureFromIsNotSource, from, to], - [fs, 'stat', from], + [ensureFromIsNotSource, absTarget, to], + [fs, 'stat', absTarget], [rm, to, gently], [mkdir, path.dirname(to)], [fs, 'symlink', target, to, 'junction'] diff --git a/deps/npm/lib/utils/module-name.js b/deps/npm/lib/utils/module-name.js index 7ca175487c..649dfac01b 100644 --- a/deps/npm/lib/utils/module-name.js +++ b/deps/npm/lib/utils/module-name.js @@ -11,7 +11,7 @@ function pathToPackageName (dir) { if (dir === '') return '' var name = path.relative(path.resolve(dir, '..'), dir) var scoped = path.relative(path.resolve(dir, '../..'), dir) - if (scoped[0] === '@') return scoped + if (scoped[0] === '@') return scoped.replace(/\\/g, '/') return name } diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 514e8e6213..57199a488b 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -22,7 +22,7 @@ For example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf -npm@3.8.9 /path/to/npm +npm@3.9.3 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 3229d12038..661f4586d7 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 -3.8.9 +3.9.3 .SH DESCRIPTION .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man5/npm-json.5 b/deps/npm/man/man5/npm-json.5 index b2ce56755a..1829c36105 100644 --- a/deps/npm/man/man5/npm-json.5 +++ b/deps/npm/man/man5/npm-json.5 @@ -791,10 +791,10 @@ Unless the user has set the \fBengine\-strict\fP config flag, this field is advisory only will produce warnings when your package is installed as a dependency\. .SH engineStrict .P -\fBThis feature was deprecated with npm 3\.0\.0\fR +\fBThis feature was removed in npm 3\.0\.0\fR .P Prior to npm 3\.0\.0, this feature was used to treat this package as if the -user had set \fBengine\-strict\fP\|\. +user had set \fBengine\-strict\fP\|\. It is no longer used\. .SH os .P You can specify which operating systems your @@ -878,9 +878,9 @@ npm will default some values based on package contents\. If there is a \fBserver\.js\fP file in the root of your package, then npm will default the \fBstart\fP command to \fBnode server\.js\fP\|\. .IP \(bu 2 -\fB"scripts":{"preinstall": "node\-gyp rebuild"}\fP -If there is a \fBbinding\.gyp\fP file in the root of your package, npm will -default the \fBpreinstall\fP command to compile using node\-gyp\. +\fB"scripts":{"install": "node\-gyp rebuild"}\fP +If there is a \fBbinding\.gyp\fP file in the root of your package and you have not defined an \fBinstall\fP or \fBpreinstall\fP script, npm will +default the \fBinstall\fP command to compile using node\-gyp\. .IP \(bu 2 \fB"contributors": [\.\.\.]\fP If there is an \fBAUTHORS\fP file in the root of your package, npm will diff --git a/deps/npm/man/man5/package.json.5 b/deps/npm/man/man5/package.json.5 index b2ce56755a..1829c36105 100644 --- a/deps/npm/man/man5/package.json.5 +++ b/deps/npm/man/man5/package.json.5 @@ -791,10 +791,10 @@ Unless the user has set the \fBengine\-strict\fP config flag, this field is advisory only will produce warnings when your package is installed as a dependency\. .SH engineStrict .P -\fBThis feature was deprecated with npm 3\.0\.0\fR +\fBThis feature was removed in npm 3\.0\.0\fR .P Prior to npm 3\.0\.0, this feature was used to treat this package as if the -user had set \fBengine\-strict\fP\|\. +user had set \fBengine\-strict\fP\|\. It is no longer used\. .SH os .P You can specify which operating systems your @@ -878,9 +878,9 @@ npm will default some values based on package contents\. If there is a \fBserver\.js\fP file in the root of your package, then npm will default the \fBstart\fP command to \fBnode server\.js\fP\|\. .IP \(bu 2 -\fB"scripts":{"preinstall": "node\-gyp rebuild"}\fP -If there is a \fBbinding\.gyp\fP file in the root of your package, npm will -default the \fBpreinstall\fP command to compile using node\-gyp\. +\fB"scripts":{"install": "node\-gyp rebuild"}\fP +If there is a \fBbinding\.gyp\fP file in the root of your package and you have not defined an \fBinstall\fP or \fBpreinstall\fP script, npm will +default the \fBinstall\fP command to compile using node\-gyp\. .IP \(bu 2 \fB"contributors": [\.\.\.]\fP If there is an \fBAUTHORS\fP file in the root of your package, npm will diff --git a/deps/npm/man/man7/npm-scripts.7 b/deps/npm/man/man7/npm-scripts.7 index 7b02bb5a8f..72d4ae06d3 100644 --- a/deps/npm/man/man7/npm-scripts.7 +++ b/deps/npm/man/man7/npm-scripts.7 @@ -92,7 +92,8 @@ If there is a \fBserver\.js\fP file in the root of your package, then npm will default the \fBstart\fP command to \fBnode server\.js\fP\|\. .IP \(bu 2 \fB"install": "node\-gyp rebuild"\fP: -If there is a \fBbinding\.gyp\fP file in the root of your package, npm will +If there is a \fBbinding\.gyp\fP file in the root of your package and you +haven't defined your own \fBinstall\fP or \fBpreinstall\fP scripts, npm will default the \fBinstall\fP command to compile using node\-gyp\. .RE diff --git a/deps/npm/node_modules/fstream-npm/fstream-npm.js b/deps/npm/node_modules/fstream-npm/fstream-npm.js index 8f8114fe89..c3b93214dc 100644 --- a/deps/npm/node_modules/fstream-npm/fstream-npm.js +++ b/deps/npm/node_modules/fstream-npm/fstream-npm.js @@ -99,6 +99,9 @@ Packer.prototype.applyIgnores = function (entry, partial, entryObj) { // license files should never be ignored. if (entry.match(/^(license|licence)(\.[^\.]*)?$/i)) return true + // copyright notice files should never be ignored. + if (entry.match(/^(notice)(\.[^\.]*)?$/i)) return true + // changelogs should never be ignored. if (entry.match(/^(changes|changelog|history)(\.[^\.]*)?$/i)) return true } diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/.npmignore b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/.npmignore deleted file mode 100644 index a843dc44a1..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test/fixtures diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/example/basic.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/example/basic.js deleted file mode 100644 index ff4534289c..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/example/basic.js +++ /dev/null @@ -1,13 +0,0 @@ -var Ignore = require("../") -Ignore({ path: __dirname - , ignoreFiles: [".ignore", ".gitignore"] - }) - .on("child", function (c) { - console.error(c.path.substr(c.root.path.length + 1)) - c.on("ignoreFile", onIgnoreFile) - }) - .on("ignoreFile", onIgnoreFile) - -function onIgnoreFile (e) { - console.error("adding ignore file", e.path) -} diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/index.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/index.js index f8d40f79ac..abe535df32 100644 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/index.js +++ b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/index.js @@ -99,7 +99,7 @@ function expand(str, isTop) { var isOptions = /^(.*,)+(.+)?$/.test(m.body); if (!isSequence && !isOptions) { // {a},b} - if (m.post.match(/,.*}/)) { + if (m.post.match(/,.*\}/)) { str = m.pre + '{' + m.body + escClose + m.post; return expand(str); } diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore index fd4f2b066b..ae5d8c36ac 100644 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +++ b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore @@ -1,2 +1,5 @@ -node_modules -.DS_Store +test +.gitignore +.travis.yml +Makefile +example.js diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml deleted file mode 100644 index 6e5919de39..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - "0.10" diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile deleted file mode 100644 index dd2730cfde..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +++ /dev/null @@ -1,5 +0,0 @@ - -test: - @node_modules/.bin/tape test/*.js - -.PHONY: test diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md index 421f3aa5f9..d6880b2f36 100644 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +++ b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md @@ -1,6 +1,6 @@ # balanced-match -Match balanced string pairs, like `{` and `}` or `` and ``. +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! [![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) [![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) @@ -16,6 +16,7 @@ var balanced = require('balanced-match'); console.log(balanced('{', '}', 'pre{in{nested}}post')); console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); ``` The matches are: @@ -28,6 +29,7 @@ $ node example.js pre: 'pre', body: 'first', post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } ``` ## API diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js deleted file mode 100644 index 9ce76f480a..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +++ /dev/null @@ -1,4 +0,0 @@ -var balanced = require('./'); - -console.log(balanced('{', '}', 'pre{in{nested}}post')); -console.log(balanced('{', '}', 'pre{first}between{second}post')); diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js index 75f3d71cba..4670f7f79f 100644 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +++ b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js @@ -1,5 +1,8 @@ module.exports = balanced; function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + var r = range(a, b, str); return r && { @@ -11,6 +14,11 @@ function balanced(a, b, str) { }; } +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + balanced.range = range; function range(a, b, str) { var begs, beg, left, right, result; diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json index d71e6b979b..9322bb20fe 100644 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +++ b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json @@ -1,38 +1,49 @@ { "_args": [ [ - "balanced-match@^0.3.0", - "/Users/rebecca/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion" + { + "name": "balanced-match", + "raw": "balanced-match@^0.4.1", + "rawSpec": "^0.4.1", + "scope": null, + "spec": ">=0.4.1 <0.5.0", + "type": "range" + }, + "/Users/zkat/Documents/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion" ] ], - "_from": "balanced-match@>=0.3.0 <0.4.0", - "_id": "balanced-match@0.3.0", + "_from": "balanced-match@>=0.4.1 <0.5.0", + "_id": "balanced-match@0.4.1", "_inCache": true, "_installable": true, "_location": "/fstream-npm/fstream-ignore/minimatch/brace-expansion/balanced-match", - "_nodeVersion": "4.2.1", + "_nodeVersion": "6.0.0", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/balanced-match-0.4.1.tgz_1462129663650_0.39764496590942144" + }, "_npmUser": { "email": "julian@juliangruber.com", "name": "juliangruber" }, - "_npmVersion": "2.14.7", + "_npmVersion": "3.8.6", "_phantomChildren": {}, "_requested": { "name": "balanced-match", - "raw": "balanced-match@^0.3.0", - "rawSpec": "^0.3.0", + "raw": "balanced-match@^0.4.1", + "rawSpec": "^0.4.1", "scope": null, - "spec": ">=0.3.0 <0.4.0", + "spec": ">=0.4.1 <0.5.0", "type": "range" }, "_requiredBy": [ "/fstream-npm/fstream-ignore/minimatch/brace-expansion" ], - "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz", - "_shasum": "a91cdd1ebef1a86659e70ff4def01625fc2d6756", + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz", + "_shasum": "19053e2e0748eadb379da6c09d455cf5e1039335", "_shrinkwrap": null, - "_spec": "balanced-match@^0.3.0", - "_where": "/Users/rebecca/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion", + "_spec": "balanced-match@^0.4.1", + "_where": "/Users/zkat/Documents/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion", "author": { "email": "mail@juliangruber.com", "name": "Julian Gruber", @@ -44,28 +55,28 @@ "dependencies": {}, "description": "Match balanced character pairs, like \"{\" and \"}\"", "devDependencies": { - "tape": "~4.2.2" + "tape": "~4.5.0" }, "directories": {}, "dist": { - "shasum": "a91cdd1ebef1a86659e70ff4def01625fc2d6756", - "tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz" + "shasum": "19053e2e0748eadb379da6c09d455cf5e1039335", + "tarball": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz" }, - "gitHead": "a7114b0986554787e90b7ac595a043ca75ea77e5", + "gitHead": "7004b289baaaab6a832f4901735e29d37cc2a863", "homepage": "https://github.com/juliangruber/balanced-match", "keywords": [ - "balanced", "match", - "parse", "regexp", - "test" + "test", + "balanced", + "parse" ], "license": "MIT", "main": "index.js", "maintainers": [ { - "name": "juliangruber", - "email": "julian@juliangruber.com" + "email": "julian@juliangruber.com", + "name": "juliangruber" } ], "name": "balanced-match", @@ -80,19 +91,19 @@ }, "testling": { "browsers": [ - "android-browser/4.2..latest", - "chrome/25..latest", - "chrome/canary", + "ie/8..latest", "firefox/20..latest", "firefox/nightly", - "ie/8..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", + "chrome/25..latest", + "chrome/canary", "opera/12..latest", "opera/next", - "safari/5.1..latest" + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" ], "files": "test/*.js" }, - "version": "0.3.0" + "version": "0.4.1" } diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js deleted file mode 100644 index f5e98e3f2a..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +++ /dev/null @@ -1,84 +0,0 @@ -var test = require('tape'); -var balanced = require('..'); - -test('balanced', function(t) { - t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), { - start: 3, - end: 12, - pre: 'pre', - body: 'in{nest}', - post: 'post' - }); - t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), { - start: 8, - end: 11, - pre: '{{{{{{{{', - body: 'in', - post: 'post' - }); - t.deepEqual(balanced('{', '}', 'pre{body{in}post'), { - start: 8, - end: 11, - pre: 'pre{body', - body: 'in', - post: 'post' - }); - t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), { - start: 4, - end: 13, - pre: 'pre}', - body: 'in{nest}', - post: 'post' - }); - t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), { - start: 3, - end: 8, - pre: 'pre', - body: 'body', - post: 'between{body2}post' - }); - t.notOk(balanced('{', '}', 'nope'), 'should be notOk'); - t.deepEqual(balanced('', '', 'preinnestpost'), { - start: 3, - end: 19, - pre: 'pre', - body: 'innest', - post: 'post' - }); - t.deepEqual(balanced('', '', 'preinnestpost'), { - start: 7, - end: 23, - pre: 'pre', - body: 'innest', - post: 'post' - }); - t.deepEqual(balanced('{{', '}}', 'pre{{{in}}}post'), { - start: 3, - end: 9, - pre: 'pre', - body: '{in}', - post: 'post' - }); - t.deepEqual(balanced('{{{', '}}', 'pre{{{in}}}post'), { - start: 3, - end: 8, - pre: 'pre', - body: 'in', - post: '}post' - }); - t.deepEqual(balanced('{', '}', 'pre{{first}in{second}post'), { - start: 4, - end: 10, - pre: 'pre{', - body: 'first', - post: 'in{second}post' - }); - t.deepEqual(balanced('', 'prepost'), { - start: 3, - end: 4, - pre: 'pre', - body: '', - post: 'post' - }); - t.end(); -}); diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json index 14febd4da6..0a28e3def3 100644 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json +++ b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json @@ -1,21 +1,32 @@ { "_args": [ [ - "brace-expansion@^1.0.0", - "/Users/rebecca/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch" + { + "name": "brace-expansion", + "raw": "brace-expansion@^1.0.0", + "rawSpec": "^1.0.0", + "scope": null, + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/Users/zkat/Documents/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch" ] ], "_from": "brace-expansion@>=1.0.0 <2.0.0", - "_id": "brace-expansion@1.1.2", + "_id": "brace-expansion@1.1.4", "_inCache": true, "_installable": true, "_location": "/fstream-npm/fstream-ignore/minimatch/brace-expansion", - "_nodeVersion": "4.2.1", + "_nodeVersion": "6.0.0", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/brace-expansion-1.1.4.tgz_1462130058897_0.14984136167913675" + }, "_npmUser": { "email": "julian@juliangruber.com", "name": "juliangruber" }, - "_npmVersion": "2.14.7", + "_npmVersion": "3.8.6", "_phantomChildren": {}, "_requested": { "name": "brace-expansion", @@ -28,11 +39,11 @@ "_requiredBy": [ "/fstream-npm/fstream-ignore/minimatch" ], - "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz", - "_shasum": "f21445d0488b658e2771efd870eff51df29f04ef", + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.4.tgz", + "_shasum": "464a204c77f482c085c2a36c456bbfbafb67a127", "_shrinkwrap": null, "_spec": "brace-expansion@^1.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch", + "_where": "/Users/zkat/Documents/code/npm/node_modules/fstream-npm/node_modules/fstream-ignore/node_modules/minimatch", "author": { "email": "mail@juliangruber.com", "name": "Julian Gruber", @@ -42,31 +53,31 @@ "url": "https://github.com/juliangruber/brace-expansion/issues" }, "dependencies": { - "balanced-match": "^0.3.0", + "balanced-match": "^0.4.1", "concat-map": "0.0.1" }, "description": "Brace expansion as known from sh/bash", "devDependencies": { - "tape": "4.2.2" + "tape": "4.5.1" }, "directories": {}, "dist": { - "shasum": "f21445d0488b658e2771efd870eff51df29f04ef", - "tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz" + "shasum": "464a204c77f482c085c2a36c456bbfbafb67a127", + "tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.4.tgz" }, - "gitHead": "b03773a30fa516b1374945b68e9acb6253d595fa", + "gitHead": "1660b75d0bf03b022e7888b576cd5a4080692c1d", "homepage": "https://github.com/juliangruber/brace-expansion", "keywords": [], "license": "MIT", "main": "index.js", "maintainers": [ { - "name": "juliangruber", - "email": "julian@juliangruber.com" + "email": "julian@juliangruber.com", + "name": "juliangruber" }, { - "name": "isaacs", - "email": "isaacs@npmjs.com" + "email": "isaacs@npmjs.com", + "name": "isaacs" } ], "name": "brace-expansion", @@ -82,19 +93,19 @@ }, "testling": { "browsers": [ - "android-browser/4.2..latest", - "chrome/25..latest", - "chrome/canary", + "ie/8..latest", "firefox/20..latest", "firefox/nightly", - "ie/8..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", + "chrome/25..latest", + "chrome/canary", "opera/12..latest", "opera/next", - "safari/5.1..latest" + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" ], "files": "test/*.js" }, - "version": "1.1.2" + "version": "1.1.4" } diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/package.json b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/package.json index ad55dd41f1..e17a18872a 100644 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/package.json +++ b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/package.json @@ -1,60 +1,103 @@ { + "_args": [ + [ + { + "name": "fstream-ignore", + "raw": "fstream-ignore@^1.0.0", + "rawSpec": "^1.0.0", + "scope": null, + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/Users/zkat/Documents/code/npm/node_modules/fstream-npm" + ] + ], + "_from": "fstream-ignore@>=1.0.0 <2.0.0", + "_id": "fstream-ignore@1.0.5", + "_inCache": true, + "_installable": true, + "_location": "/fstream-npm/fstream-ignore", + "_nodeVersion": "5.10.1", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/fstream-ignore-1.0.5.tgz_1463518095640_0.10221575922332704" + }, + "_npmUser": { + "email": "kat@sykosomatic.org", + "name": "zkat" + }, + "_npmVersion": "3.9.1", + "_phantomChildren": {}, + "_requested": { + "name": "fstream-ignore", + "raw": "fstream-ignore@^1.0.0", + "rawSpec": "^1.0.0", + "scope": null, + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/fstream-npm" + ], + "_resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.5.tgz", + "_shasum": "9c31dae34767018fe1d249b24dada67d092da105", + "_shrinkwrap": null, + "_spec": "fstream-ignore@^1.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/fstream-npm", "author": { - "name": "Isaac Z. Schlueter", "email": "i@izs.me", + "name": "Isaac Z. Schlueter", "url": "http://blog.izs.me/" }, - "name": "fstream-ignore", - "description": "A thing for ignoring files based on globs", - "version": "1.0.3", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/fstream-ignore.git" - }, - "main": "ignore.js", - "scripts": { - "test": "tap test/*.js" + "bugs": { + "url": "https://github.com/isaacs/fstream-ignore/issues" }, "dependencies": { "fstream": "^1.0.0", "inherits": "2", "minimatch": "^3.0.0" }, + "description": "A thing for ignoring files based on globs", "devDependencies": { "mkdirp": "", "rimraf": "", - "tap": "^2.2.0" - }, - "license": "ISC", - "gitHead": "86c835eef61049496003f6b90c1e6c1236c92d6a", - "bugs": { - "url": "https://github.com/isaacs/fstream-ignore/issues" - }, - "homepage": "https://github.com/isaacs/fstream-ignore#readme", - "_id": "fstream-ignore@1.0.3", - "_shasum": "4c74d91fa88b22b42f4f86a18a2820dd79d8fcdd", - "_from": "fstream-ignore@>=1.0.0 <2.0.0", - "_npmVersion": "2.14.8", - "_nodeVersion": "4.2.1", - "_npmUser": { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" + "tap": "^5.7.1" }, + "directories": {}, "dist": { - "shasum": "4c74d91fa88b22b42f4f86a18a2820dd79d8fcdd", - "tarball": "http://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.3.tgz" + "shasum": "9c31dae34767018fe1d249b24dada67d092da105", + "tarball": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.5.tgz" }, + "files": [ + "ignore.js" + ], + "gitHead": "1438a1a2c25fee71327c36c86de787a14a53ffd4", + "homepage": "https://github.com/isaacs/fstream-ignore#readme", + "license": "ISC", + "main": "ignore.js", "maintainers": [ { - "name": "isaacs", - "email": "isaacs@npmjs.com" + "email": "i@izs.me", + "name": "isaacs" }, { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" + "email": "ogd@aoaioxxysz.net", + "name": "othiym23" + }, + { + "email": "kat@sykosomatic.org", + "name": "zkat" } ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.3.tgz", - "readme": "ERROR: No README data found!" + "name": "fstream-ignore", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/fstream-ignore.git" + }, + "scripts": { + "test": "tap test/*.js --cov" + }, + "version": "1.0.5" } diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/.ignore b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/.ignore deleted file mode 100644 index 773679d45e..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/.ignore +++ /dev/null @@ -1,2 +0,0 @@ -.gitignore -.*.swp diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/.npmignore b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/.npmignore deleted file mode 100644 index 1b26d0de59..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/.npmignore +++ /dev/null @@ -1 +0,0 @@ -*/a diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/00-setup.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/00-setup.js deleted file mode 100644 index 351bcd10f1..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/00-setup.js +++ /dev/null @@ -1,70 +0,0 @@ -// The test fixtures work like this: -// These dirs are all created: {a,b,c}/{a,b,c}/{a,b,c}/ -// in each one, these files are created: -// {.,}{a,b,c}{a,b,c}{a,b,c} -// -// So, there'll be a/b/c/abc, a/b/c/aba, etc., and dot-versions of each. -// -// Each test then writes their own ignore file rules for their purposes, -// and is responsible for removing them afterwards. - -var mkdirp = require("mkdirp") -var path = require("path") -var i = 0 -var tap = require("tap") -var fs = require("fs") -var rimraf = require("rimraf") -var fixtures = path.resolve(__dirname, "fixtures") - -var chars = ['a', 'b', 'c'] -var dirs = [] - -for (var i = 0; i < 3; i ++) { - for (var j = 0; j < 3; j ++) { - for (var k = 0; k < 3; k ++) { - dirs.push(chars[i] + '/' + chars[j] + '/' + chars[k]) - } - } -} - -var files = [] - -for (var i = 0; i < 3; i ++) { - for (var j = 0; j < 3; j ++) { - for (var k = 0; k < 3; k ++) { - files.push(chars[i] + chars[j] + chars[k]) - files.push('.' + chars[i] + chars[j] + chars[k]) - } - } -} - -tap.test("remove fixtures", function (t) { - rimraf(path.resolve(__dirname, "fixtures"), function (er) { - t.ifError(er, "remove fixtures") - t.end() - }) -}) - -tap.test("create fixtures", function (t) { - dirs.forEach(function (dir) { - dir = path.resolve(fixtures, dir) - t.test("mkdir "+dir, function (t) { - mkdirp(dir, function (er) { - t.ifError(er, "mkdir "+dir) - if (er) return t.end() - - files.forEach(function (file) { - file = path.resolve(dir, file) - t.test("writeFile "+file, function (t) { - fs.writeFile(file, path.basename(file), function (er) { - t.ifError(er, "writing "+file) - t.end() - }) - }) - }) - t.end() - }) - }) - }) - t.end() -}) diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/basic.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/basic.js deleted file mode 100644 index 3718076eed..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/basic.js +++ /dev/null @@ -1,28 +0,0 @@ -var IgnoreFile = require("../") - -// set the ignores just for this test -var c = require("./common.js") -c.ignores({ "a/.basic-ignore": ["b/", "aca"] }) - -// the files that we expect to not see -var notAllowed = - [ /^\/a\/b\/.*/ - , /^\/a\/.*\/aca$/ ] - - -require("tap").test("basic ignore rules", function (t) { - t.pass("start") - - IgnoreFile({ path: __dirname + "/fixtures" - , ignoreFiles: [".basic-ignore"] }) - .on("ignoreFile", function (e) { - console.error("ignore file!", e) - }) - .on("child", function (e) { - var p = e.path.substr(e.root.path.length) - notAllowed.forEach(function (na) { - t.dissimilar(p, na) - }) - }) - .on("close", t.end.bind(t)) -}) diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/common.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/common.js deleted file mode 100644 index 79470eba61..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/common.js +++ /dev/null @@ -1,40 +0,0 @@ -if (require.main === module) { - console.log("1..1") - console.log("ok 1 trivial pass") - return -} - -var fs = require("fs") -var path = require("path") -var rimraf = require("rimraf") - -exports.ignores = ignores -exports.writeIgnoreFile = writeIgnoreFile -exports.writeIgnores = writeIgnores -exports.clearIgnores = clearIgnores - -function writeIgnoreFile (file, rules) { - file = path.resolve(__dirname, "fixtures", file) - if (Array.isArray(rules)) { - rules = rules.join("\n") - } - fs.writeFileSync(file, rules) - console.error(file, rules) -} - -function writeIgnores (set) { - Object.keys(set).forEach(function (f) { - writeIgnoreFile(f, set[f]) - }) -} - -function clearIgnores (set) { - Object.keys(set).forEach(function (file) { - fs.unlinkSync(path.resolve(__dirname, "fixtures", file)) - }) -} - -function ignores (set) { - writeIgnores(set) - process.on("exit", clearIgnores.bind(null, set)) -} diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/ignore-most.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/ignore-most.js deleted file mode 100644 index 43eec4b546..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/ignore-most.js +++ /dev/null @@ -1,41 +0,0 @@ -// ignore most things -var IgnoreFile = require("../") - -// set the ignores just for this test -var c = require("./common.js") -c.ignores({ ".ignore": ["*", "!a/b/c/.abc", "!/c/b/a/cba"] }) - -// the only files we expect to see -var expected = - [ "/a/b/c/.abc" - , "/a" - , "/a/b" - , "/a/b/c" - , "/c/b/a/cba" - , "/c" - , "/c/b" - , "/c/b/a" ] - -require("tap").test("basic ignore rules", function (t) { - t.pass("start") - - IgnoreFile({ path: __dirname + "/fixtures" - , ignoreFiles: [".ignore"] }) - .on("ignoreFile", function (e) { - console.error("ignore file!", e) - }) - .on("child", function (e) { - var p = e.path.substr(e.root.path.length) - var i = expected.indexOf(p) - if (i === -1) { - t.fail("unexpected file found", {file: p}) - } else { - t.pass(p) - expected.splice(i, 1) - } - }) - .on("close", function () { - t.notOk(expected.length, "all expected files should be seen") - t.end() - }) -}) diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/nested-ignores.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/nested-ignores.js deleted file mode 100644 index a9ede59ca7..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/nested-ignores.js +++ /dev/null @@ -1,51 +0,0 @@ -// ignore most things -var IgnoreFile = require("../") - -// set the ignores just for this test -var c = require("./common.js") -c.ignores( - { ".ignore": ["*", "a", "c", "!a/b/c/.abc", "!/c/b/a/cba"] - , "a/.ignore": [ "!*", ".ignore" ] // unignore everything - , "a/a/.ignore": [ "*" ] // re-ignore everything - , "a/b/.ignore": [ "*", "!/c/.abc" ] // original unignore - , "a/c/.ignore": [ "*" ] // ignore everything again - , "c/b/a/.ignore": [ "!cba", "!.cba", "!/a{bc,cb}" ] - }) - -// the only files we expect to see -var expected = - [ "/a" - , "/a/a" - , "/a/b" - , "/a/b/c" - , "/a/b/c/.abc" - , "/a/c" - , "/c" - , "/c/b" - , "/c/b/a" - , "/c/b/a/cba" - , "/c/b/a/.cba" - , "/c/b/a/abc" - , "/c/b/a/acb" ] - -require("tap").test("basic ignore rules", function (t) { - t.pass("start") - - IgnoreFile({ path: __dirname + "/fixtures" - , ignoreFiles: [".ignore"] }) - .on("child", function (e) { - var p = e.path.substr(e.root.path.length) - var i = expected.indexOf(p) - if (i === -1) { - console.log("not ok "+p) - t.fail("unexpected file found", {found: p}) - } else { - t.pass(p) - expected.splice(i, 1) - } - }) - .on("close", function () { - t.deepEqual(expected, [], "all expected files should be seen") - t.end() - }) -}) diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/read-file-order.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/read-file-order.js deleted file mode 100644 index 0d851164f2..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/read-file-order.js +++ /dev/null @@ -1,81 +0,0 @@ -var IgnoreFile = require("../") -, fs = require('fs') - -// set the ignores just for this test -var c = require("./common.js") -c.ignores({ ".gitignore": ["a/b/c/abc"] }) -c.ignores({ ".ignore": ["*", "!a/b/c/abc"] }) - -// the only files we expect to see -var expected = - [ "/a" - , "/a/b" - , "/a/b/c" - , "/a/b/c/abc" ] - -var originalReadFile = fs.readFile -, parallelCount = 0 -, firstCall - -// Overwrite fs.readFile so that when .gitignore and .ignore are read in -// parallel, .ignore will always be read first. -fs.readFile = function (filename, options, callback) { - if (typeof options === 'function') { - callback = options - options = false - } - - parallelCount++ - - process.nextTick(function () { - if (parallelCount > 1) { - if (!firstCall) { - return firstCall = function (cb) { - originalReadFile(filename, options, function (err, data) { - callback(err, data) - if (cb) cb() - }) - } - } - - if (filename.indexOf('.gitignore') !== -1) { - firstCall(function () { - originalReadFile(filename, options, callback) - }) - } else { - originalReadFile(filename, options, function (err, data) { - callback(err, data) - firstCall() - }) - } - } else { - originalReadFile(filename, options, callback) - parallelCount = 0 - } - }) -} - -require("tap").test("read file order", function (t) { - t.pass("start") - - IgnoreFile({ path: __dirname + "/fixtures" - , ignoreFiles: [".gitignore", ".ignore"] }) - .on("ignoreFile", function (e) { - console.error("ignore file!", e) - }) - .on("child", function (e) { - var p = e.path.substr(e.root.path.length) - var i = expected.indexOf(p) - if (i === -1) { - t.fail("unexpected file found", {f: p}) - } else { - t.pass(p) - expected.splice(i, 1) - } - }) - .on("close", function () { - fs.readFile = originalReadFile - t.notOk(expected.length, "all expected files should be seen") - t.end() - }) -}) diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/unignore-child.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/unignore-child.js deleted file mode 100644 index 5812354df7..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/unignore-child.js +++ /dev/null @@ -1,38 +0,0 @@ -// ignore most things -var IgnoreFile = require("../") - -// set the ignores just for this test -var c = require("./common.js") -c.ignores({ ".ignore": ["*", "a", "c", "!a/b/c/.abc", "!/c/b/a/cba"] }) - -// the only files we expect to see -var expected = - [ "/a/b/c/.abc" - , "/a" - , "/a/b" - , "/a/b/c" - , "/c/b/a/cba" - , "/c" - , "/c/b" - , "/c/b/a" ] - -require("tap").test("basic ignore rules", function (t) { - t.pass("start") - - IgnoreFile({ path: __dirname + "/fixtures" - , ignoreFiles: [".ignore"] }) - .on("child", function (e) { - var p = e.path.substr(e.root.path.length) - var i = expected.indexOf(p) - if (i === -1) { - t.fail("unexpected file found", {f: p}) - } else { - t.pass(p) - expected.splice(i, 1) - } - }) - .on("close", function () { - t.notOk(expected.length, "all expected files should be seen") - t.end() - }) -}) diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/zz-cleanup.js b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/zz-cleanup.js deleted file mode 100644 index 82f064a421..0000000000 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/test/zz-cleanup.js +++ /dev/null @@ -1,10 +0,0 @@ -var tap = require("tap") -, rimraf = require("rimraf") -, path = require("path") - -tap.test("remove fixtures", function (t) { - rimraf(path.resolve(__dirname, "fixtures"), function (er) { - t.ifError(er, "remove fixtures") - t.end() - }) -}) diff --git a/deps/npm/node_modules/fstream-npm/package.json b/deps/npm/node_modules/fstream-npm/package.json index 7b5da94c04..0eddd8be09 100644 --- a/deps/npm/node_modules/fstream-npm/package.json +++ b/deps/npm/node_modules/fstream-npm/package.json @@ -1,24 +1,65 @@ { + "_args": [ + [ + { + "name": "fstream-npm", + "raw": "fstream-npm@latest", + "rawSpec": "latest", + "scope": null, + "spec": "latest", + "type": "tag" + }, + "/Users/zkat/Documents/code/npm" + ] + ], + "_from": "fstream-npm@latest", + "_id": "fstream-npm@1.1.0", + "_inCache": true, + "_installable": true, + "_location": "/fstream-npm", + "_nodeVersion": "5.10.1", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/fstream-npm-1.1.0.tgz_1463528747313_0.84859543829225" + }, + "_npmUser": { + "email": "kat@sykosomatic.org", + "name": "zkat" + }, + "_npmVersion": "3.9.1", + "_phantomChildren": { + "fstream": "1.0.9", + "inherits": "2.0.1" + }, + "_requested": { + "name": "fstream-npm", + "raw": "fstream-npm@latest", + "rawSpec": "latest", + "scope": null, + "spec": "latest", + "type": "tag" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/fstream-npm/-/fstream-npm-1.1.0.tgz", + "_shasum": "80e09743485eaa70d57e89d1ff8fafa366cdefea", + "_shrinkwrap": null, + "_spec": "fstream-npm@latest", + "_where": "/Users/zkat/Documents/code/npm", "author": { - "name": "Isaac Z. Schlueter", "email": "i@izs.me", + "name": "Isaac Z. Schlueter", "url": "http://blog.izs.me/" }, - "name": "fstream-npm", - "description": "fstream class for creating npm packages", - "version": "1.0.7", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/fstream-npm.git" - }, - "scripts": { - "test": "standard && tap test/*.js" + "bugs": { + "url": "https://github.com/npm/fstream-npm/issues" }, - "main": "./fstream-npm.js", "dependencies": { "fstream-ignore": "^1.0.0", "inherits": "2" }, + "description": "fstream class for creating npm packages", "devDependencies": { "graceful-fs": "^4.1.2", "mkdirp": "^0.5.1", @@ -26,15 +67,42 @@ "standard": "^4.3.1", "tap": "^1.3.2" }, - "license": "ISC", - "readme": "# fstream-npm\n\nThis is an fstream DirReader class that will read a directory and filter\nthings according to the semantics of what goes in an npm package.\n\nFor example:\n\n```javascript\n// This will print out all the files that would be included\n// by 'npm publish' or 'npm install' of this directory.\n\nvar FN = require(\"fstream-npm\")\nFN({ path: \"./\" })\n .on(\"child\", function (e) {\n console.error(e.path.substr(e.root.path.length + 1))\n })\n```\n\n", - "readmeFilename": "README.md", - "gitHead": "d57b6b24f91156067f73417dd8785c6312bfc75f", - "bugs": { - "url": "https://github.com/npm/fstream-npm/issues" + "directories": {}, + "dist": { + "shasum": "80e09743485eaa70d57e89d1ff8fafa366cdefea", + "tarball": "https://registry.npmjs.org/fstream-npm/-/fstream-npm-1.1.0.tgz" }, + "gitHead": "7df2e946714506f287b0a8125dc05566b840d4b0", "homepage": "https://github.com/npm/fstream-npm#readme", - "_id": "fstream-npm@1.0.7", - "_shasum": "7ed0d1ac13d7686dd9e1bf6ceb8be273bf6d2f86", - "_from": "fstream-npm@>=1.0.7 <1.1.0" + "license": "ISC", + "main": "./fstream-npm.js", + "maintainers": [ + { + "email": "me@re-becca.org", + "name": "iarna" + }, + { + "email": "i@izs.me", + "name": "isaacs" + }, + { + "email": "ogd@aoaioxxysz.net", + "name": "othiym23" + }, + { + "email": "kat@sykosomatic.org", + "name": "zkat" + } + ], + "name": "fstream-npm", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/fstream-npm.git" + }, + "scripts": { + "test": "standard && tap test/*.js" + }, + "version": "1.1.0" } diff --git a/deps/npm/node_modules/graceful-fs/README.md b/deps/npm/node_modules/graceful-fs/README.md index d920aaac9e..d0dcd49254 100644 --- a/deps/npm/node_modules/graceful-fs/README.md +++ b/deps/npm/node_modules/graceful-fs/README.md @@ -9,8 +9,6 @@ resilient to errors. ## Improvements over [fs module](http://api.nodejs.org/fs.html) -graceful-fs: - * Queues up `open` and `readdir` calls, and retries them once something closes if there is an EMFILE error from too many file descriptors. @@ -51,3 +49,85 @@ This should only ever be done at the top-level application layer, in order to delay on EMFILE errors from any fs-using dependencies. You should **not** do this in a library, because it can cause unexpected delays in other parts of the program. + +## Changes + +This module is fairly stable at this point, and used by a lot of +things. That being said, because it implements a subtle behavior +change in a core part of the node API, even modest changes can be +extremely breaking, and the versioning is thus biased towards +bumping the major when in doubt. + +The main change between major versions has been switching between +providing a fully-patched `fs` module vs monkey-patching the node core +builtin, and the approach by which a non-monkey-patched `fs` was +created. + +The goal is to trade `EMFILE` errors for slower fs operations. So, if +you try to open a zillion files, rather than crashing, `open` +operations will be queued up and wait for something else to `close`. + +There are advantages to each approach. Monkey-patching the fs means +that no `EMFILE` errors can possibly occur anywhere in your +application, because everything is using the same core `fs` module, +which is patched. However, it can also obviously cause undesirable +side-effects, especially if the module is loaded multiple times. + +Implementing a separate-but-identical patched `fs` module is more +surgical (and doesn't run the risk of patching multiple times), but +also imposes the challenge of keeping in sync with the core module. + +The current approach loads the `fs` module, and then creates a +lookalike object that has all the same methods, except a few that are +patched. It is safe to use in all versions of Node from 0.8 through +7.0. + +### v4 + +* Do not monkey-patch the fs module. This module may now be used as a + drop-in dep, and users can opt into monkey-patching the fs builtin + if their app requires it. + +### v3 + +* Monkey-patch fs, because the eval approach no longer works on recent + node. +* fixed possible type-error throw if rename fails on windows +* verify that we *never* get EMFILE errors +* Ignore ENOSYS from chmod/chown +* clarify that graceful-fs must be used as a drop-in + +### v2.1.0 + +* Use eval rather than monkey-patching fs. +* readdir: Always sort the results +* win32: requeue a file if error has an OK status + +### v2.0 + +* A return to monkey patching +* wrap process.cwd + +### v1.1 + +* wrap readFile +* Wrap fs.writeFile. +* readdir protection +* Don't clobber the fs builtin +* Handle fs.read EAGAIN errors by trying again +* Expose the curOpen counter +* No-op lchown/lchmod if not implemented +* fs.rename patch only for win32 +* Patch fs.rename to handle AV software on Windows +* Close #4 Chown should not fail on einval or eperm if non-root +* Fix isaacs/fstream#1 Only wrap fs one time +* Fix #3 Start at 1024 max files, then back off on EMFILE +* lutimes that doens't blow up on Linux +* A full on-rewrite using a queue instead of just swallowing the EMFILE error +* Wrap Read/Write streams as well + +### 1.0 + +* Update engines for node 0.6 +* Be lstat-graceful on Windows +* first diff --git a/deps/npm/node_modules/graceful-fs/package.json b/deps/npm/node_modules/graceful-fs/package.json index f8fc8a0ebb..cca5d89f6a 100644 --- a/deps/npm/node_modules/graceful-fs/package.json +++ b/deps/npm/node_modules/graceful-fs/package.json @@ -1,36 +1,37 @@ { "_args": [ [ - "graceful-fs@~4.1.2", + "graceful-fs@~4.1.3", "/Users/rebecca/code/npm" ] ], - "_from": "graceful-fs@>=4.1.2 <4.2.0", - "_id": "graceful-fs@4.1.3", + "_from": "graceful-fs@>=4.1.3 <4.2.0", + "_id": "graceful-fs@4.1.4", "_inCache": true, "_installable": true, "_location": "/graceful-fs", - "_nodeVersion": "4.0.0", + "_nodeVersion": "5.6.0", "_npmOperationalInternal": { - "host": "packages-6-west.internal.npmjs.com", - "tmp": "tmp/graceful-fs-4.1.3.tgz_1454449326495_0.943017533281818" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/graceful-fs-4.1.4.tgz_1462474854900_0.9423982477746904" }, "_npmUser": { "email": "i@izs.me", "name": "isaacs" }, - "_npmVersion": "3.7.0", + "_npmVersion": "3.8.9", "_phantomChildren": {}, "_requested": { "name": "graceful-fs", - "raw": "graceful-fs@~4.1.2", - "rawSpec": "~4.1.2", + "raw": "graceful-fs@~4.1.3", + "rawSpec": "~4.1.3", "scope": null, - "spec": ">=4.1.2 <4.2.0", + "spec": ">=4.1.3 <4.2.0", "type": "range" }, "_requiredBy": [ "/", + "/cmd-shim", "/fs-vacuum", "/fs-write-stream-atomic", "/fstream", @@ -41,17 +42,17 @@ "/read-package-json", "/readdir-scoped-modules", "/sha", - "/standard/standard-engine/eslint/file-entry-cache/flat-cache", - "/standard/standard-engine/eslint/file-entry-cache/flat-cache/read-json-sync", - "/standard/standard-format/esformatter-jsx/babel-core/regenerator/commoner", + "/standard/eslint/file-entry-cache/flat-cache", + "/standard/eslint/file-entry-cache/flat-cache/read-json-sync", + "/tacks", "/tap/nyc/read-pkg/load-json-file", "/tap/nyc/read-pkg/path-type", "/write-file-atomic" ], - "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.3.tgz", - "_shasum": "92033ce11113c41e2628d61fdfa40bc10dc0155c", + "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.4.tgz", + "_shasum": "ef089d2880f033b011823ce5c8fae798da775dbd", "_shrinkwrap": null, - "_spec": "graceful-fs@~4.1.2", + "_spec": "graceful-fs@~4.1.3", "_where": "/Users/rebecca/code/npm", "bugs": { "url": "https://github.com/isaacs/node-graceful-fs/issues" @@ -67,8 +68,8 @@ "test": "test" }, "dist": { - "shasum": "92033ce11113c41e2628d61fdfa40bc10dc0155c", - "tarball": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.3.tgz" + "shasum": "ef089d2880f033b011823ce5c8fae798da775dbd", + "tarball": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.4.tgz" }, "engines": { "node": ">=0.4.0" @@ -79,30 +80,30 @@ "legacy-streams.js", "polyfills.js" ], - "gitHead": "694c56f3aed4aee62d6df169be123d3984f61b85", + "gitHead": "fe8f05ccc2779d1dfa6db6173f3ed64f1e9aa72c", "homepage": "https://github.com/isaacs/node-graceful-fs#readme", "keywords": [ - "EACCESS", - "EAGAIN", - "EINVAL", - "EMFILE", - "EPERM", - "error", - "errors", "fs", - "handling", "module", - "queue", "reading", + "retry", "retries", - "retry" + "queue", + "error", + "errors", + "handling", + "EMFILE", + "EAGAIN", + "EINVAL", + "EPERM", + "EACCESS" ], "license": "ISC", "main": "graceful-fs.js", "maintainers": [ { - "name": "isaacs", - "email": "i@izs.me" + "email": "i@izs.me", + "name": "isaacs" } ], "name": "graceful-fs", @@ -115,5 +116,5 @@ "scripts": { "test": "node test.js | tap -" }, - "version": "4.1.3" + "version": "4.1.4" } diff --git a/deps/npm/node_modules/hosted-git-info/.npmignore b/deps/npm/node_modules/hosted-git-info/.npmignore index 58e97a7875..efab07fb1b 100644 --- a/deps/npm/node_modules/hosted-git-info/.npmignore +++ b/deps/npm/node_modules/hosted-git-info/.npmignore @@ -1,3 +1,2 @@ -*~ -.# -node_modules +test +.travis.yml diff --git a/deps/npm/node_modules/hosted-git-info/.travis.yml b/deps/npm/node_modules/hosted-git-info/.travis.yml deleted file mode 100644 index 7dc6619174..0000000000 --- a/deps/npm/node_modules/hosted-git-info/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "0.11" - - "0.10" -script: "npm test" diff --git a/deps/npm/node_modules/hosted-git-info/package.json b/deps/npm/node_modules/hosted-git-info/package.json index 1f78066ca4..7c8475510e 100644 --- a/deps/npm/node_modules/hosted-git-info/package.json +++ b/deps/npm/node_modules/hosted-git-info/package.json @@ -1,39 +1,103 @@ { - "name": "hosted-git-info", - "version": "2.1.4", - "description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab", - "main": "index.js", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/hosted-git-info.git" + "_args": [ + [ + { + "name": "hosted-git-info", + "raw": "hosted-git-info@latest", + "rawSpec": "latest", + "scope": null, + "spec": "latest", + "type": "tag" + }, + "/Users/zkat/Documents/code/npm" + ] + ], + "_from": "hosted-git-info@latest", + "_id": "hosted-git-info@2.1.5", + "_inCache": true, + "_installable": true, + "_location": "/hosted-git-info", + "_nodeVersion": "5.10.1", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/hosted-git-info-2.1.5.tgz_1463518889246_0.20443619322031736" }, - "keywords": [ - "git", - "github", - "bitbucket", - "gitlab" + "_npmUser": { + "email": "kat@sykosomatic.org", + "name": "zkat" + }, + "_npmVersion": "3.9.1", + "_phantomChildren": {}, + "_requested": { + "name": "hosted-git-info", + "raw": "hosted-git-info@latest", + "rawSpec": "latest", + "scope": null, + "spec": "latest", + "type": "tag" + }, + "_requiredBy": [ + "/", + "/normalize-package-data", + "/npm-package-arg" ], + "_resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.1.5.tgz", + "_shasum": "0ba81d90da2e25ab34a332e6ec77936e1598118b", + "_shrinkwrap": null, + "_spec": "hosted-git-info@latest", + "_where": "/Users/zkat/Documents/code/npm", "author": { - "name": "Rebecca Turner", "email": "me@re-becca.org", + "name": "Rebecca Turner", "url": "http://re-becca.org" }, - "license": "ISC", "bugs": { "url": "https://github.com/npm/hosted-git-info/issues" }, - "homepage": "https://github.com/npm/hosted-git-info", - "scripts": { - "test": "standard && tap test/*.js" - }, + "dependencies": {}, + "description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab", "devDependencies": { "standard": "^3.3.2", "tap": "^0.4.13" }, - "readme": "# hosted-git-info\n\nThis will let you identify and transform various git hosts URLs between\nprotocols. It also can tell you what the URL is for the raw path for\nparticular file for direct access without git.\n\n## Usage\n\n```javascript\nvar hostedGitInfo = require(\"hosted-git-info\")\nvar info = hostedGitInfo.fromUrl(\"git@github.com:npm/hosted-git-info.git\")\n/* info looks like:\n{\n type: \"github\",\n domain: \"github.com\",\n user: \"npm\",\n project: \"hosted-git-info\"\n}\n*/\n```\n\nIf the URL can't be matched with a git host, `null` will be returned. We\ncan match git, ssh and https urls. Additionally, we can match ssh connect\nstrings (`git@github.com:npm/hosted-git-info`) and shortcuts (eg,\n`github:npm/hosted-git-info`). Github specifically, is detected in the case\nof a third, unprefixed, form: `npm/hosted-git-info`.\n\nIf it does match, the returned object has properties of:\n\n* info.type -- The short name of the service\n* info.domain -- The domain for git protocol use\n* info.user -- The name of the user/org on the git host\n* info.project -- The name of the project on the git host\n\nAnd methods of:\n\n* info.file(path)\n\nGiven the path of a file relative to the repository, returns a URL for\ndirectly fetching it from the githost. If no committish was set then\n`master` will be used as the default.\n\nFor example `hostedGitInfo.fromUrl(\"git@github.com:npm/hosted-git-info.git#v1.0.0\").file(\"package.json\")`\nwould return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json`\n\n* info.shortcut()\n\neg, `github:npm/hosted-git-info`\n\n* info.browse()\n\neg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`\n\n* info.bugs()\n\neg, `https://github.com/npm/hosted-git-info/issues`\n\n* info.docs()\n\neg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme`\n\n* info.https()\n\neg, `git+https://github.com/npm/hosted-git-info.git`\n\n* info.sshurl()\n\neg, `git+ssh://git@github.com/npm/hosted-git-info.git`\n\n* info.ssh()\n\neg, `git@github.com:npm/hosted-git-info.git`\n\n* info.path()\n\neg, `npm/hosted-git-info`\n\n* info.getDefaultRepresentation()\n\nReturns the default output type. The default output type is based on the\nstring you passed in to be parsed\n\n* info.toString()\n\nUses the getDefaultRepresentation to call one of the other methods to get a URL for\nthis resource. As such `hostedGitInfo.fromUrl(url).toString()` will give\nyou a normalized version of the URL that still uses the same protocol.\n\nShortcuts will still be returned as shortcuts, but the special case github\nform of `org/project` will be normalized to `github:org/project`.\n\nSSH connect strings will be normalized into `git+ssh` URLs.\n\n\n## Supported hosts\n\nCurrently this supports Github, Bitbucket and Gitlab. Pull requests for\nadditional hosts welcome.\n\n", - "readmeFilename": "README.md", - "gitHead": "9e1a36df8eb050a663713c79e56d89dadba2bd8d", - "_id": "hosted-git-info@2.1.4", - "_shasum": "d9e953b26988be88096c46e926494d9604c300f8", - "_from": "hosted-git-info@>=2.1.4 <2.2.0" + "directories": {}, + "dist": { + "shasum": "0ba81d90da2e25ab34a332e6ec77936e1598118b", + "tarball": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.1.5.tgz" + }, + "gitHead": "4e6bb323a97a57c18e6b4b891527e26154d04fbe", + "homepage": "https://github.com/npm/hosted-git-info", + "keywords": [ + "git", + "github", + "bitbucket", + "gitlab" + ], + "license": "ISC", + "main": "index.js", + "maintainers": [ + { + "email": "me@re-becca.org", + "name": "iarna" + }, + { + "email": "ogd@aoaioxxysz.net", + "name": "othiym23" + }, + { + "email": "kat@sykosomatic.org", + "name": "zkat" + } + ], + "name": "hosted-git-info", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/hosted-git-info.git" + }, + "scripts": { + "test": "standard && tap test/*.js" + }, + "version": "2.1.5" } diff --git a/deps/npm/node_modules/hosted-git-info/test/basic.js b/deps/npm/node_modules/hosted-git-info/test/basic.js deleted file mode 100644 index 0b93f50e20..0000000000 --- a/deps/npm/node_modules/hosted-git-info/test/basic.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict' -var HostedGit = require('../index') -var test = require('tap').test - -test('basic', function (t) { - t.is(HostedGit.fromUrl('https://google.com'), undefined, 'null on failure') - t.is(HostedGit.fromUrl('https://github.com/abc/def').getDefaultRepresentation(), 'https', 'match https urls') - t.is(HostedGit.fromUrl('ssh://git@github.com/abc/def').getDefaultRepresentation(), 'sshurl', 'match ssh urls') - t.is(HostedGit.fromUrl('git+ssh://git@github.com/abc/def').getDefaultRepresentation(), 'sshurl', 'match git+ssh urls') - t.is(HostedGit.fromUrl('git+https://github.com/abc/def').getDefaultRepresentation(), 'https', 'match git+https urls') - t.is(HostedGit.fromUrl('git@github.com:abc/def').getDefaultRepresentation(), 'sshurl', 'match ssh connect strings') - t.is(HostedGit.fromUrl('git://github.com/abc/def').getDefaultRepresentation(), 'git', 'match git urls') - t.is(HostedGit.fromUrl('github:abc/def').getDefaultRepresentation(), 'shortcut', 'match shortcuts') - t.end() -}) diff --git a/deps/npm/node_modules/hosted-git-info/test/bitbucket-https-with-embedded-auth.js b/deps/npm/node_modules/hosted-git-info/test/bitbucket-https-with-embedded-auth.js deleted file mode 100644 index a2feb2f0e1..0000000000 --- a/deps/npm/node_modules/hosted-git-info/test/bitbucket-https-with-embedded-auth.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' -var HostedGit = require('../index') -var test = require('tap').test - -test('Bitbucket HTTPS URLs with embedded auth', function (t) { - t.is( - HostedGit.fromUrl('https://user:pass@bitbucket.org/user/repo.git').toString(), - 'git+https://user:pass@bitbucket.org/user/repo.git', - 'credentials were included in URL' - ) - t.is( - HostedGit.fromUrl('https://user:pass@bitbucket.org/user/repo').toString(), - 'git+https://user:pass@bitbucket.org/user/repo.git', - 'credentials were included in URL' - ) - t.is( - HostedGit.fromUrl('git+https://user:pass@bitbucket.org/user/repo.git').toString(), - 'git+https://user:pass@bitbucket.org/user/repo.git', - 'credentials were included in URL' - ) - t.is( - HostedGit.fromUrl('git+https://user:pass@bitbucket.org/user/repo').toString(), - 'git+https://user:pass@bitbucket.org/user/repo.git', - 'credentials were included in URL' - ) - t.end() -}) diff --git a/deps/npm/node_modules/hosted-git-info/test/bitbucket.js b/deps/npm/node_modules/hosted-git-info/test/bitbucket.js deleted file mode 100644 index 72e4ba113d..0000000000 --- a/deps/npm/node_modules/hosted-git-info/test/bitbucket.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' -var HostedGit = require('../index') -var test = require('tap').test - -test('fromUrl(bitbucket url)', function (t) { - function verify (host, label, branch) { - var hostinfo = HostedGit.fromUrl(host) - var hash = branch ? '#' + branch : '' - t.ok(hostinfo, label) - if (!hostinfo) return - t.is(hostinfo.https(), 'git+https://bitbucket.org/111/222.git' + hash, label + ' -> https') - t.is(hostinfo.browse(), 'https://bitbucket.org/111/222' + (branch ? '/src/' + branch : ''), label + ' -> browse') - t.is(hostinfo.docs(), 'https://bitbucket.org/111/222' + (branch ? '/src/' + branch : '') + '#readme', label + ' -> docs') - t.is(hostinfo.ssh(), 'git@bitbucket.org:111/222.git' + hash, label + ' -> ssh') - t.is(hostinfo.sshurl(), 'git+ssh://git@bitbucket.org/111/222.git' + hash, label + ' -> sshurl') - t.is(hostinfo.shortcut(), 'bitbucket:111/222' + hash, label + ' -> shortcut') - t.is(hostinfo.file('C'), 'https://bitbucket.org/111/222/raw/' + (branch || 'master') + '/C', label + ' -> file') - } - - require('./lib/standard-tests')(verify, 'bitbucket.org', 'bitbucket') - - t.end() -}) diff --git a/deps/npm/node_modules/hosted-git-info/test/gist.js b/deps/npm/node_modules/hosted-git-info/test/gist.js deleted file mode 100644 index cf36d3c8dd..0000000000 --- a/deps/npm/node_modules/hosted-git-info/test/gist.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict' -var HostedGit = require('../index') -var test = require('tap').test - -test('fromUrl(gist url)', function (t) { - function verify (host, label, branch) { - var hostinfo = HostedGit.fromUrl(host) - var hash = branch ? '#' + branch : '' - t.ok(hostinfo, label) - if (!hostinfo) return - t.is(hostinfo.https(), 'git+https://gist.github.com/222.git' + hash, label + ' -> https') - t.is(hostinfo.git(), 'git://gist.github.com/222.git' + hash, label + ' -> git') - t.is(hostinfo.browse(), 'https://gist.github.com/222' + (branch ? '/' + branch : ''), label + ' -> browse') - t.is(hostinfo.bugs(), 'https://gist.github.com/222', label + ' -> bugs') - t.is(hostinfo.docs(), 'https://gist.github.com/222' + (branch ? '/' + branch : ''), label + ' -> docs') - t.is(hostinfo.ssh(), 'git@gist.github.com:/222.git' + hash, label + ' -> ssh') - t.is(hostinfo.sshurl(), 'git+ssh://git@gist.github.com/222.git' + hash, label + ' -> sshurl') - t.is(hostinfo.shortcut(), 'gist:222' + hash, label + ' -> shortcut') - if (hostinfo.user) { - t.is(hostinfo.file('C'), 'https://gist.githubusercontent.com/111/222/raw/' + (branch ? branch + '/' : '') + 'C', label + ' -> file') - } - } - - verify('git@gist.github.com:222.git', 'git@') - var hostinfo = HostedGit.fromUrl('git@gist.github.com:/ef860c7z5e0de3179341.git') - if (t.ok(hostinfo, 'git@hex')) { - t.is(hostinfo.https(), 'git+https://gist.github.com/ef860c7z5e0de3179341.git', 'git@hex -> https') - } - verify('git@gist.github.com:/222.git', 'git@/') - verify('git://gist.github.com/222', 'git') - verify('git://gist.github.com/222.git', 'git.git') - verify('git://gist.github.com/222#branch', 'git#branch', 'branch') - verify('git://gist.github.com/222.git#branch', 'git.git#branch', 'branch') - - require('./lib/standard-tests')(verify, 'gist.github.com', 'gist') - - verify(HostedGit.fromUrl('gist:111/222').toString(), 'round-tripped shortcut') - verify('gist:222', 'shortened shortcut') - - t.end() -}) diff --git a/deps/npm/node_modules/hosted-git-info/test/github.js b/deps/npm/node_modules/hosted-git-info/test/github.js deleted file mode 100644 index 56098a3e39..0000000000 --- a/deps/npm/node_modules/hosted-git-info/test/github.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict' -var HostedGit = require('../index') -var test = require('tap').test - -test('fromUrl(github url)', function (t) { - function verify (host, label, branch) { - var hostinfo = HostedGit.fromUrl(host) - var hash = branch ? '#' + branch : '' - t.ok(hostinfo, label) - if (!hostinfo) return - t.is(hostinfo.https(), 'git+https://github.com/111/222.git' + hash, label + ' -> https') - t.is(hostinfo.git(), 'git://github.com/111/222.git' + hash, label + ' -> git') - t.is(hostinfo.browse(), 'https://github.com/111/222' + (branch ? '/tree/' + branch : ''), label + ' -> browse') - t.is(hostinfo.bugs(), 'https://github.com/111/222/issues', label + ' -> bugs') - t.is(hostinfo.docs(), 'https://github.com/111/222' + (branch ? '/tree/' + branch : '') + '#readme', label + ' -> docs') - t.is(hostinfo.ssh(), 'git@github.com:111/222.git' + hash, label + ' -> ssh') - t.is(hostinfo.sshurl(), 'git+ssh://git@github.com/111/222.git' + hash, label + ' -> sshurl') - t.is(hostinfo.shortcut(), 'github:111/222' + hash, label + ' -> shortcut') - t.is(hostinfo.file('C'), 'https://raw.githubusercontent.com/111/222/' + (branch || 'master') + '/C', label + ' -> file') - } - - // github shorturls - verify('111/222', 'github-short') - verify('111/222#branch', 'github-short#branch', 'branch') - - // insecure protocols - verify('git://github.com/111/222', 'git') - verify('git://github.com/111/222.git', 'git.git') - verify('git://github.com/111/222#branch', 'git#branch', 'branch') - verify('git://github.com/111/222.git#branch', 'git.git#branch', 'branch') - - verify('http://github.com/111/222', 'http') - verify('http://github.com/111/222.git', 'http.git') - verify('http://github.com/111/222#branch', 'http#branch', 'branch') - verify('http://github.com/111/222.git#branch', 'http.git#branch', 'branch') - - require('./lib/standard-tests')(verify, 'github.com', 'github') - - t.end() -}) diff --git a/deps/npm/node_modules/hosted-git-info/test/gitlab.js b/deps/npm/node_modules/hosted-git-info/test/gitlab.js deleted file mode 100644 index 315c9085bd..0000000000 --- a/deps/npm/node_modules/hosted-git-info/test/gitlab.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' -var HostedGit = require('../index') -var test = require('tap').test - -test('fromUrl(gitlab url)', function (t) { - function verify (host, label, branch) { - var hostinfo = HostedGit.fromUrl(host) - var hash = branch ? '#' + branch : '' - t.ok(hostinfo, label) - if (!hostinfo) return - t.is(hostinfo.https(), 'git+https://gitlab.com/111/222.git' + hash, label + ' -> https') - t.is(hostinfo.browse(), 'https://gitlab.com/111/222' + (branch ? '/tree/' + branch : ''), label + ' -> browse') - t.is(hostinfo.docs(), 'https://gitlab.com/111/222' + (branch ? '/tree/' + branch : '') + '#README', label + ' -> docs') - t.is(hostinfo.ssh(), 'git@gitlab.com:111/222.git' + hash, label + ' -> ssh') - t.is(hostinfo.sshurl(), 'git+ssh://git@gitlab.com/111/222.git' + hash, label + ' -> sshurl') - t.is(hostinfo.shortcut(), 'gitlab:111/222' + hash, label + ' -> shortcut') - t.is(hostinfo.file('C'), 'https://gitlab.com/111/222/raw/' + (branch || 'master') + '/C', label + ' -> file') - } - - require('./lib/standard-tests')(verify, 'gitlab.com', 'gitlab') - - t.end() -}) diff --git a/deps/npm/node_modules/hosted-git-info/test/https-with-inline-auth.js b/deps/npm/node_modules/hosted-git-info/test/https-with-inline-auth.js deleted file mode 100644 index 5e2f5b5a38..0000000000 --- a/deps/npm/node_modules/hosted-git-info/test/https-with-inline-auth.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' -var HostedGit = require('../index') -var test = require('tap').test - -test('HTTPS GitHub URL with embedded auth -- generally not a good idea', function (t) { - function verify (host, label, branch) { - var hostinfo = HostedGit.fromUrl(host) - var hash = branch ? '#' + branch : '' - t.ok(hostinfo, label) - if (!hostinfo) return - t.is(hostinfo.https(), 'git+https://user:pass@github.com/111/222.git' + hash, label + ' -> https') - t.is(hostinfo.git(), 'git://user:pass@github.com/111/222.git' + hash, label + ' -> git') - t.is(hostinfo.browse(), 'https://github.com/111/222' + (branch ? '/tree/' + branch : ''), label + ' -> browse') - t.is(hostinfo.bugs(), 'https://github.com/111/222/issues', label + ' -> bugs') - t.is(hostinfo.docs(), 'https://github.com/111/222' + (branch ? '/tree/' + branch : '') + '#readme', label + ' -> docs') - t.is(hostinfo.ssh(), 'git@github.com:111/222.git' + hash, label + ' -> ssh') - t.is(hostinfo.sshurl(), 'git+ssh://git@github.com/111/222.git' + hash, label + ' -> sshurl') - t.is(hostinfo.shortcut(), 'github:111/222' + hash, label + ' -> shortcut') - t.is(hostinfo.file('C'), 'https://user:pass@raw.githubusercontent.com/111/222/' + (branch || 'master') + '/C', label + ' -> file') - } - - // insecure protocols - verify('git://user:pass@github.com/111/222', 'git') - verify('git://user:pass@github.com/111/222.git', 'git.git') - verify('git://user:pass@github.com/111/222#branch', 'git#branch', 'branch') - verify('git://user:pass@github.com/111/222.git#branch', 'git.git#branch', 'branch') - - verify('https://user:pass@github.com/111/222', 'https') - verify('https://user:pass@github.com/111/222.git', 'https.git') - verify('https://user:pass@github.com/111/222#branch', 'https#branch', 'branch') - verify('https://user:pass@github.com/111/222.git#branch', 'https.git#branch', 'branch') - - verify('http://user:pass@github.com/111/222', 'http') - verify('http://user:pass@github.com/111/222.git', 'http.git') - verify('http://user:pass@github.com/111/222#branch', 'http#branch', 'branch') - verify('http://user:pass@github.com/111/222.git#branch', 'http.git#branch', 'branch') - - t.end() -}) diff --git a/deps/npm/node_modules/hosted-git-info/test/lib/standard-tests.js b/deps/npm/node_modules/hosted-git-info/test/lib/standard-tests.js deleted file mode 100644 index 929fcca42e..0000000000 --- a/deps/npm/node_modules/hosted-git-info/test/lib/standard-tests.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' -module.exports = function (verify, domain, shortname) { - verify('https://' + domain + '/111/222', 'https') - verify('https://' + domain + '/111/222.git', 'https.git') - verify('https://' + domain + '/111/222#branch', 'https#branch', 'branch') - verify('https://' + domain + '/111/222.git#branch', 'https.git#branch', 'branch') - - verify('git+https://' + domain + '/111/222', 'git+https') - verify('git+https://' + domain + '/111/222.git', 'git+https.git') - verify('git+https://' + domain + '/111/222#branch', 'git+https#branch', 'branch') - verify('git+https://' + domain + '/111/222.git#branch', 'git+https.git#branch', 'branch') - - verify('git@' + domain + ':111/222', 'ssh') - verify('git@' + domain + ':111/222.git', 'ssh.git') - verify('git@' + domain + ':111/222#branch', 'ssh', 'branch') - verify('git@' + domain + ':111/222.git#branch', 'ssh.git', 'branch') - - verify('git+ssh://git@' + domain + '/111/222', 'ssh url') - verify('git+ssh://git@' + domain + '/111/222.git', 'ssh url.git') - verify('git+ssh://git@' + domain + '/111/222#branch', 'ssh url#branch', 'branch') - verify('git+ssh://git@' + domain + '/111/222.git#branch', 'ssh url.git#branch', 'branch') - - verify(shortname + ':111/222', 'shortcut') - verify(shortname + ':111/222.git', 'shortcut.git') - verify(shortname + ':111/222#branch', 'shortcut#branch', 'branch') - verify(shortname + ':111/222.git#branch', 'shortcut.git#branch', 'branch') -} diff --git a/deps/npm/node_modules/inflight/package.json b/deps/npm/node_modules/inflight/package.json index 48b4c0e160..e8ff95617a 100644 --- a/deps/npm/node_modules/inflight/package.json +++ b/deps/npm/node_modules/inflight/package.json @@ -1,36 +1,113 @@ { - "name": "inflight", - "version": "1.0.4", - "description": "Add callbacks to requests in flight to avoid async duplication", - "main": "inflight.js", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" + "_args": [ + [ + { + "name": "inflight", + "raw": "inflight@latest", + "rawSpec": "latest", + "scope": null, + "spec": "latest", + "type": "tag" + }, + "/Users/zkat/Documents/code/npm" + ] + ], + "_from": "inflight@latest", + "_id": "inflight@1.0.5", + "_inCache": true, + "_installable": true, + "_location": "/inflight", + "_nodeVersion": "5.10.1", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/inflight-1.0.5.tgz_1463529611443_0.00041943578980863094" }, - "devDependencies": { - "tap": "^0.4.10" + "_npmUser": { + "email": "kat@sykosomatic.org", + "name": "zkat" }, - "scripts": { - "test": "tap test.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/inflight.git" + "_npmVersion": "3.9.1", + "_phantomChildren": {}, + "_requested": { + "name": "inflight", + "raw": "inflight@latest", + "rawSpec": "latest", + "scope": null, + "spec": "latest", + "type": "tag" }, + "_requiredBy": [ + "/", + "/glob", + "/init-package-json/glob", + "/node-gyp/glob", + "/read-package-json/glob", + "/standard/eslint/glob", + "/standard/standard-engine/deglob/glob", + "/tap/nyc/glob", + "/tap/nyc/istanbul/fileset/glob", + "/tap/tap-mocha-reporter/glob" + ], + "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz", + "_shasum": "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a", + "_shrinkwrap": null, + "_spec": "inflight@latest", + "_where": "/Users/zkat/Documents/code/npm", "author": { - "name": "Isaac Z. Schlueter", "email": "i@izs.me", + "name": "Isaac Z. Schlueter", "url": "http://blog.izs.me/" }, "bugs": { "url": "https://github.com/isaacs/inflight/issues" }, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "description": "Add callbacks to requests in flight to avoid async duplication", + "devDependencies": { + "tap": "^1.2.0" + }, + "directories": {}, + "dist": { + "shasum": "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a", + "tarball": "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz" + }, + "files": [ + "inflight.js" + ], + "gitHead": "559e37b4f6327fca797fe8d7fe8ed6d9cae08821", "homepage": "https://github.com/isaacs/inflight", "license": "ISC", - "readme": "# inflight\n\nAdd callbacks to requests in flight to avoid async duplication\n\n## USAGE\n\n```javascript\nvar inflight = require('inflight')\n\n// some request that does some stuff\nfunction req(key, callback) {\n // key is any random string. like a url or filename or whatever.\n //\n // will return either a falsey value, indicating that the\n // request for this key is already in flight, or a new callback\n // which when called will call all callbacks passed to inflightk\n // with the same key\n callback = inflight(key, callback)\n\n // If we got a falsey value back, then there's already a req going\n if (!callback) return\n\n // this is where you'd fetch the url or whatever\n // callback is also once()-ified, so it can safely be assigned\n // to multiple events etc. First call wins.\n setTimeout(function() {\n callback(null, key)\n }, 100)\n}\n\n// only assigns a single setTimeout\n// when it dings, all cbs get called\nreq('foo', cb1)\nreq('foo', cb2)\nreq('foo', cb3)\nreq('foo', cb4)\n```\n", - "readmeFilename": "README.md", - "_id": "inflight@1.0.4", - "_shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a", - "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", - "_from": "inflight@>=1.0.4 <1.1.0" + "main": "inflight.js", + "maintainers": [ + { + "email": "me@re-becca.org", + "name": "iarna" + }, + { + "email": "i@izs.me", + "name": "isaacs" + }, + { + "email": "ogd@aoaioxxysz.net", + "name": "othiym23" + }, + { + "email": "kat@sykosomatic.org", + "name": "zkat" + } + ], + "name": "inflight", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/inflight.git" + }, + "scripts": { + "test": "tap test.js" + }, + "version": "1.0.5" } diff --git a/deps/npm/node_modules/inflight/test.js b/deps/npm/node_modules/inflight/test.js deleted file mode 100644 index 2bb75b3881..0000000000 --- a/deps/npm/node_modules/inflight/test.js +++ /dev/null @@ -1,97 +0,0 @@ -var test = require('tap').test -var inf = require('./inflight.js') - - -function req (key, cb) { - cb = inf(key, cb) - if (cb) setTimeout(function () { - cb(key) - cb(key) - }) - return cb -} - -test('basic', function (t) { - var calleda = false - var a = req('key', function (k) { - t.notOk(calleda) - calleda = true - t.equal(k, 'key') - if (calledb) t.end() - }) - t.ok(a, 'first returned cb function') - - var calledb = false - var b = req('key', function (k) { - t.notOk(calledb) - calledb = true - t.equal(k, 'key') - if (calleda) t.end() - }) - - t.notOk(b, 'second should get falsey inflight response') -}) - -test('timing', function (t) { - var expect = [ - 'method one', - 'start one', - 'end one', - 'two', - 'tick', - 'three' - ] - var i = 0 - - function log (m) { - t.equal(m, expect[i], m + ' === ' + expect[i]) - ++i - if (i === expect.length) - t.end() - } - - function method (name, cb) { - log('method ' + name) - process.nextTick(cb) - } - - var one = inf('foo', function () { - log('start one') - var three = inf('foo', function () { - log('three') - }) - if (three) method('three', three) - log('end one') - }) - - method('one', one) - - var two = inf('foo', function () { - log('two') - }) - if (two) method('one', two) - - process.nextTick(log.bind(null, 'tick')) -}) - -test('parameters', function (t) { - t.plan(8) - - var a = inf('key', function (first, second, third) { - t.equal(first, 1) - t.equal(second, 2) - t.equal(third, 3) - }) - t.ok(a, 'first returned cb function') - - var b = inf('key', function (first, second, third) { - t.equal(first, 1) - t.equal(second, 2) - t.equal(third, 3) - }) - t.notOk(b, 'second should get falsey inflight response') - - setTimeout(function () { - a(1, 2, 3) - }) -}) diff --git a/deps/npm/node_modules/init-package-json/init-package-json.js b/deps/npm/node_modules/init-package-json/init-package-json.js index 87c72ccf94..7dc4b0a392 100644 --- a/deps/npm/node_modules/init-package-json/init-package-json.js +++ b/deps/npm/node_modules/init-package-json/init-package-json.js @@ -40,7 +40,7 @@ function init (dir, input, config, cb) { } } - var package = path.resolve(dir, 'package.json') + var packageFile = path.resolve(dir, 'package.json') input = path.resolve(input) var pkg var ctx = { yes: yes(config) } @@ -49,14 +49,14 @@ function init (dir, input, config, cb) { readJson.extraSet = es.filter(function (fn) { return fn.name !== 'authors' && fn.name !== 'mans' }) - readJson(package, function (er, d) { + readJson(packageFile, function (er, d) { readJson.extraSet = es if (er) pkg = {} else pkg = d - ctx.filename = package - ctx.dirname = path.dirname(package) + ctx.filename = packageFile + ctx.dirname = path.dirname(packageFile) ctx.basename = path.basename(ctx.dirname) if (!pkg.version || !semver.valid(pkg.version)) delete pkg.version @@ -80,7 +80,7 @@ function init (dir, input, config, cb) { readJson.extraSet = es.filter(function (fn) { return fn.name !== 'authors' && fn.name !== 'mans' }) - readJson.extras(package, pkg, function (er, pkg) { + readJson.extras(packageFile, pkg, function (er, pkg) { readJson.extraSet = es if (er) return cb(er, pkg) pkg = unParsePeople(pkg) @@ -105,9 +105,9 @@ function init (dir, input, config, cb) { var d = JSON.stringify(pkg, null, 2) + '\n' function write (yes) { - fs.writeFile(package, d, 'utf8', function (er) { + fs.writeFile(packageFile, d, 'utf8', function (er) { if (!er && yes && !config.get('silent')) { - console.log('Wrote to %s:\n\n%s\n', package, d) + console.log('Wrote to %s:\n\n%s\n', packageFile, d) } return cb(er, pkg) }) @@ -115,7 +115,7 @@ function init (dir, input, config, cb) { if (ctx.yes) { return write(true) } - console.log('About to write to %s:\n\n%s\n', package, d) + console.log('About to write to %s:\n\n%s\n', packageFile, d) read({prompt:'Is this ok? ', default: 'yes'}, function (er, ok) { if (!ok || ok.toLowerCase().charAt(0) !== 'y') { console.log('Aborted.') diff --git a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore index fd4f2b066b..ae5d8c36ac 100644 --- a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +++ b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore @@ -1,2 +1,5 @@ -node_modules -.DS_Store +test +.gitignore +.travis.yml +Makefile +example.js diff --git a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml deleted file mode 100644 index 6e5919de39..0000000000 --- a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - "0.10" diff --git a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile deleted file mode 100644 index dd2730cfde..0000000000 --- a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +++ /dev/null @@ -1,5 +0,0 @@ - -test: - @node_modules/.bin/tape test/*.js - -.PHONY: test diff --git a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md index 421f3aa5f9..d6880b2f36 100644 --- a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +++ b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md @@ -1,6 +1,6 @@ # balanced-match -Match balanced string pairs, like `{` and `}` or `` and ``. +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! [![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) [![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) @@ -16,6 +16,7 @@ var balanced = require('balanced-match'); console.log(balanced('{', '}', 'pre{in{nested}}post')); console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); ``` The matches are: @@ -28,6 +29,7 @@ $ node example.js pre: 'pre', body: 'first', post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } ``` ## API diff --git a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js deleted file mode 100644 index 9ce76f480a..0000000000 --- a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +++ /dev/null @@ -1,4 +0,0 @@ -var balanced = require('./'); - -console.log(balanced('{', '}', 'pre{in{nested}}post')); -console.log(balanced('{', '}', 'pre{first}between{second}post')); diff --git a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js index 75f3d71cba..4670f7f79f 100644 --- a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +++ b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js @@ -1,5 +1,8 @@ module.exports = balanced; function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + var r = range(a, b, str); return r && { @@ -11,6 +14,11 @@ function balanced(a, b, str) { }; } +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + balanced.range = range; function range(a, b, str) { var begs, beg, left, right, result; diff --git a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json index 652900ae4c..306b73b343 100644 --- a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +++ b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json @@ -1,40 +1,49 @@ { "_args": [ [ - "balanced-match@^0.3.0", - "/Users/rebecca/code/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion" - ], - [ - "balanced-match@^0.3.0", - "/Users/rebecca/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion" + { + "name": "balanced-match", + "raw": "balanced-match@^0.4.1", + "rawSpec": "^0.4.1", + "scope": null, + "spec": ">=0.4.1 <0.5.0", + "type": "range" + }, + "/Users/zkat/Documents/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion" ] ], - "_from": "balanced-match@>=0.3.0 <0.4.0", - "_id": "balanced-match@0.3.0", + "_from": "balanced-match@>=0.4.1 <0.5.0", + "_id": "balanced-match@0.4.1", "_inCache": true, "_installable": true, "_location": "/init-package-json/glob/minimatch/brace-expansion/balanced-match", - "_nodeVersion": "4.2.1", + "_nodeVersion": "6.0.0", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/balanced-match-0.4.1.tgz_1462129663650_0.39764496590942144" + }, "_npmUser": { "email": "julian@juliangruber.com", "name": "juliangruber" }, - "_npmVersion": "2.14.7", + "_npmVersion": "3.8.6", "_phantomChildren": {}, "_requested": { "name": "balanced-match", - "raw": "balanced-match@^0.3.0", - "rawSpec": "^0.3.0", + "raw": "balanced-match@^0.4.1", + "rawSpec": "^0.4.1", "scope": null, - "spec": ">=0.3.0 <0.4.0", + "spec": ">=0.4.1 <0.5.0", "type": "range" }, "_requiredBy": [ "/init-package-json/glob/minimatch/brace-expansion" ], + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz", + "_shasum": "19053e2e0748eadb379da6c09d455cf5e1039335", "_shrinkwrap": null, - "_spec": "balanced-match@^0.3.0", - "_where": "/Users/rebecca/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion", + "_spec": "balanced-match@^0.4.1", + "_where": "/Users/zkat/Documents/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion", "author": { "email": "mail@juliangruber.com", "name": "Julian Gruber", @@ -46,14 +55,14 @@ "dependencies": {}, "description": "Match balanced character pairs, like \"{\" and \"}\"", "devDependencies": { - "tape": "~4.2.2" + "tape": "~4.5.0" }, "directories": {}, "dist": { - "shasum": "a91cdd1ebef1a86659e70ff4def01625fc2d6756", - "tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz" + "shasum": "19053e2e0748eadb379da6c09d455cf5e1039335", + "tarball": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz" }, - "gitHead": "a7114b0986554787e90b7ac595a043ca75ea77e5", + "gitHead": "7004b289baaaab6a832f4901735e29d37cc2a863", "homepage": "https://github.com/juliangruber/balanced-match", "keywords": [ "match", @@ -96,5 +105,5 @@ ], "files": "test/*.js" }, - "version": "0.3.0" + "version": "0.4.1" } diff --git a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js deleted file mode 100644 index f5e98e3f2a..0000000000 --- a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +++ /dev/null @@ -1,84 +0,0 @@ -var test = require('tape'); -var balanced = require('..'); - -test('balanced', function(t) { - t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), { - start: 3, - end: 12, - pre: 'pre', - body: 'in{nest}', - post: 'post' - }); - t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), { - start: 8, - end: 11, - pre: '{{{{{{{{', - body: 'in', - post: 'post' - }); - t.deepEqual(balanced('{', '}', 'pre{body{in}post'), { - start: 8, - end: 11, - pre: 'pre{body', - body: 'in', - post: 'post' - }); - t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), { - start: 4, - end: 13, - pre: 'pre}', - body: 'in{nest}', - post: 'post' - }); - t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), { - start: 3, - end: 8, - pre: 'pre', - body: 'body', - post: 'between{body2}post' - }); - t.notOk(balanced('{', '}', 'nope'), 'should be notOk'); - t.deepEqual(balanced('', '', 'preinnestpost'), { - start: 3, - end: 19, - pre: 'pre', - body: 'innest', - post: 'post' - }); - t.deepEqual(balanced('', '', 'preinnestpost'), { - start: 7, - end: 23, - pre: 'pre', - body: 'innest', - post: 'post' - }); - t.deepEqual(balanced('{{', '}}', 'pre{{{in}}}post'), { - start: 3, - end: 9, - pre: 'pre', - body: '{in}', - post: 'post' - }); - t.deepEqual(balanced('{{{', '}}', 'pre{{{in}}}post'), { - start: 3, - end: 8, - pre: 'pre', - body: 'in', - post: '}post' - }); - t.deepEqual(balanced('{', '}', 'pre{{first}in{second}post'), { - start: 4, - end: 10, - pre: 'pre{', - body: 'first', - post: 'in{second}post' - }); - t.deepEqual(balanced('', 'prepost'), { - start: 3, - end: 4, - pre: 'pre', - body: '', - post: 'post' - }); - t.end(); -}); diff --git a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json index 1c2bcddd5a..ad188114f9 100644 --- a/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +++ b/deps/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json @@ -1,29 +1,32 @@ { "_args": [ [ - "brace-expansion@^1.0.0", - "/Users/rebecca/code/npm/node_modules/glob/node_modules/minimatch" - ], - [ - "brace-expansion@^1.0.0", - "/Users/rebecca/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch" + { + "name": "brace-expansion", + "raw": "brace-expansion@^1.0.0", + "rawSpec": "^1.0.0", + "scope": null, + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/Users/zkat/Documents/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch" ] ], "_from": "brace-expansion@>=1.0.0 <2.0.0", - "_id": "brace-expansion@1.1.3", + "_id": "brace-expansion@1.1.4", "_inCache": true, "_installable": true, "_location": "/init-package-json/glob/minimatch/brace-expansion", - "_nodeVersion": "5.5.0", + "_nodeVersion": "6.0.0", "_npmOperationalInternal": { - "host": "packages-6-west.internal.npmjs.com", - "tmp": "tmp/brace-expansion-1.1.3.tgz_1455216688668_0.948847763473168" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/brace-expansion-1.1.4.tgz_1462130058897_0.14984136167913675" }, "_npmUser": { "email": "julian@juliangruber.com", "name": "juliangruber" }, - "_npmVersion": "3.3.12", + "_npmVersion": "3.8.6", "_phantomChildren": {}, "_requested": { "name": "brace-expansion", @@ -36,9 +39,11 @@ "_requiredBy": [ "/init-package-json/glob/minimatch" ], + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.4.tgz", + "_shasum": "464a204c77f482c085c2a36c456bbfbafb67a127", "_shrinkwrap": null, "_spec": "brace-expansion@^1.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch", + "_where": "/Users/zkat/Documents/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch", "author": { "email": "mail@juliangruber.com", "name": "Julian Gruber", @@ -48,19 +53,19 @@ "url": "https://github.com/juliangruber/brace-expansion/issues" }, "dependencies": { - "balanced-match": "^0.3.0", + "balanced-match": "^0.4.1", "concat-map": "0.0.1" }, "description": "Brace expansion as known from sh/bash", "devDependencies": { - "tape": "4.4.0" + "tape": "4.5.1" }, "directories": {}, "dist": { - "shasum": "46bff50115d47fc9ab89854abb87d98078a10991", - "tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.3.tgz" + "shasum": "464a204c77f482c085c2a36c456bbfbafb67a127", + "tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.4.tgz" }, - "gitHead": "f0da1bb668e655f67b6b2d660c6e1c19e2a6f231", + "gitHead": "1660b75d0bf03b022e7888b576cd5a4080692c1d", "homepage": "https://github.com/juliangruber/brace-expansion", "keywords": [], "license": "MIT", @@ -102,5 +107,5 @@ ], "files": "test/*.js" }, - "version": "1.1.3" + "version": "1.1.4" } diff --git a/deps/npm/node_modules/init-package-json/package.json b/deps/npm/node_modules/init-package-json/package.json index 21e33c570c..fbca584dd5 100644 --- a/deps/npm/node_modules/init-package-json/package.json +++ b/deps/npm/node_modules/init-package-json/package.json @@ -1,39 +1,54 @@ { "_args": [ [ - "init-package-json@~1.9.3", - "/Users/rebecca/code/npm" + { + "name": "init-package-json", + "raw": "init-package-json@latest", + "rawSpec": "latest", + "scope": null, + "spec": "latest", + "type": "tag" + }, + "/Users/zkat/Documents/code/npm" ] ], - "_from": "init-package-json@>=1.9.3 <1.10.0", - "_id": "init-package-json@1.9.3", + "_from": "init-package-json@latest", + "_id": "init-package-json@1.9.4", "_inCache": true, "_installable": true, "_location": "/init-package-json", - "_nodeVersion": "4.2.2", + "_nodeVersion": "5.10.1", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/init-package-json-1.9.4.tgz_1463610982259_0.011722659226506948" + }, "_npmUser": { - "email": "me@re-becca.org", - "name": "iarna" + "email": "kat@sykosomatic.org", + "name": "zkat" }, - "_npmVersion": "3.5.4", + "_npmVersion": "3.9.1", "_phantomChildren": { + "inflight": "1.0.5", + "inherits": "2.0.1", + "once": "1.3.3", "read": "1.0.7" }, "_requested": { "name": "init-package-json", - "raw": "init-package-json@~1.9.3", - "rawSpec": "~1.9.3", + "raw": "init-package-json@latest", + "rawSpec": "latest", "scope": null, - "spec": ">=1.9.3 <1.10.0", - "type": "range" + "spec": "latest", + "type": "tag" }, "_requiredBy": [ "/" ], - "_shasum": "ca2ff94709b6d9aaad66533c11a0aff645f15c7d", + "_resolved": "https://registry.npmjs.org/init-package-json/-/init-package-json-1.9.4.tgz", + "_shasum": "b4053d0b40f0cf842a41966937cb3dc0f534e856", "_shrinkwrap": null, - "_spec": "init-package-json@~1.9.3", - "_where": "/Users/rebecca/code/npm", + "_spec": "init-package-json@latest", + "_where": "/Users/zkat/Documents/code/npm", "author": { "email": "i@izs.me", "name": "Isaac Z. Schlueter", @@ -60,39 +75,39 @@ }, "directories": {}, "dist": { - "shasum": "ca2ff94709b6d9aaad66533c11a0aff645f15c7d", - "tarball": "http://registry.npmjs.org/init-package-json/-/init-package-json-1.9.3.tgz" + "shasum": "b4053d0b40f0cf842a41966937cb3dc0f534e856", + "tarball": "https://registry.npmjs.org/init-package-json/-/init-package-json-1.9.4.tgz" }, - "gitHead": "12eb24ff2f75f84a4a27436bc6f6cb765cbd9ee2", + "gitHead": "3c34250fa58507056a94f3940ee2a28540f83592", "homepage": "https://github.com/npm/init-package-json#readme", "keywords": [ - "helper", "init", - "package", "package.json", - "prompt", - "start", + "package", + "helper", "wizard", - "wizerd" + "wizerd", + "prompt", + "start" ], "license": "ISC", "main": "init-package-json.js", "maintainers": [ { - "name": "isaacs", - "email": "isaacs@npmjs.com" + "email": "isaacs@npmjs.com", + "name": "isaacs" }, { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" + "email": "ogd@aoaioxxysz.net", + "name": "othiym23" }, { - "name": "iarna", - "email": "me@re-becca.org" + "email": "me@re-becca.org", + "name": "iarna" }, { - "name": "zkat", - "email": "kat@sykosomatic.org" + "email": "kat@sykosomatic.org", + "name": "zkat" } ], "name": "init-package-json", @@ -105,5 +120,5 @@ "scripts": { "test": "tap test/*.js" }, - "version": "1.9.3" + "version": "1.9.4" } diff --git a/deps/npm/node_modules/lodash._baseuniq/LICENSE b/deps/npm/node_modules/lodash._baseuniq/LICENSE index bcbe13d67a..e0c69d5603 100644 --- a/deps/npm/node_modules/lodash._baseuniq/LICENSE +++ b/deps/npm/node_modules/lodash._baseuniq/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -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. +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +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. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/deps/npm/node_modules/lodash._baseuniq/README.md b/deps/npm/node_modules/lodash._baseuniq/README.md index 1d02b801f9..c18dbb6c37 100644 --- a/deps/npm/node_modules/lodash._baseuniq/README.md +++ b/deps/npm/node_modules/lodash._baseuniq/README.md @@ -1,4 +1,4 @@ -# lodash._baseuniq v4.5.1 +# lodash._baseuniq v4.6.0 The internal [lodash](https://lodash.com/) function `baseUniq` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var baseUniq = require('lodash._baseuniq'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.5.1-npm-packages/lodash._baseuniq) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.6.0-npm-packages/lodash._baseuniq) for more details. diff --git a/deps/npm/node_modules/lodash._baseuniq/index.js b/deps/npm/node_modules/lodash._baseuniq/index.js index ffdc06f7b5..8f3094f9be 100644 --- a/deps/npm/node_modules/lodash._baseuniq/index.js +++ b/deps/npm/node_modules/lodash._baseuniq/index.js @@ -1,13 +1,13 @@ /** - * lodash 4.5.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var SetCache = require('lodash._setcache'), - createSet = require('lodash._createset'); +var createSet = require('lodash._createset'), + root = require('lodash._root'); /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -15,6 +15,19 @@ var LARGE_ARRAY_SIZE = 200; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + /** * A specialized version of `_.includes` for arrays without support for * specifying an index to search from. @@ -73,6 +86,18 @@ function baseIndexOf(array, value, fromIndex) { return -1; } +/** + * Checks if a cache value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function cacheHas(cache, key) { + return cache.has(key); +} + /** * Gets the index at which the first occurrence of `NaN` is found in `array`. * @@ -96,11 +121,30 @@ function indexOfNaN(array, fromIndex, fromRight) { } /** - * Converts `set` to an array. + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} + +/** + * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. - * @returns {Array} Returns the converted array. + * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, @@ -112,23 +156,406 @@ function setToArray(set) { return result; } +/** Used for built-in method references. */ +var arrayProto = Array.prototype, + objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var splice = arrayProto.splice; + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'), + nativeCreate = getNative(Object, 'create'); + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + /** - * Checks if `value` is in `cache`. + * Removes `key` and its value from the map. * * @private - * @param {Object} cache The set cache to search. + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values ? values.length : 0; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } +} + +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ -function cacheHas(cache, value) { - var map = cache.__data__; - if (isKeyable(value)) { - var data = map.__data__, - hash = typeof value == 'string' ? data.string : data.hash; +function setCacheHas(value) { + return this.__data__.has(value); +} + +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; - return hash[value] === HASH_UNDEFINED; +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to search. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } } - return map.has(value); + return -1; } /** @@ -169,6 +596,7 @@ function baseUniq(array, iteratee, comparator) { var value = array[index], computed = iteratee ? iteratee(value) : value; + value = (comparator || value !== 0) ? value : 0; if (isCommon && computed === computed) { var seenIndex = seen.length; while (seenIndex--) { @@ -191,6 +619,34 @@ function baseUniq(array, iteratee, comparator) { return result; } +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = object[key]; + return isNative(value) ? value : undefined; +} + /** * Checks if `value` is suitable for use as unique object key. * @@ -200,8 +656,146 @@ function baseUniq(array, iteratee, comparator) { */ function isKeyable(value) { var type = typeof value; - return type == 'number' || type == 'boolean' || - (type == 'string' && value != '__proto__') || value == null; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ +function isNative(value) { + if (!isObject(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); } module.exports = baseUniq; diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/LICENSE b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/LICENSE index bcbe13d67a..e0c69d5603 100644 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/LICENSE +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -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. +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +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. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/README.md b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/README.md index fe6cc9b512..6486d7e85f 100644 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/README.md +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/README.md @@ -1,4 +1,4 @@ -# lodash._createset v4.0.1 +# lodash._createset v4.0.3 The internal [lodash](https://lodash.com/) function `createSet` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var createSet = require('lodash._createset'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.0.1-npm-packages/lodash._createset) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.0.3-npm-packages/lodash._createset) for more details. diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/index.js b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/index.js index 8c85b236d1..9cadd2eeeb 100644 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/index.js +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/index.js @@ -1,20 +1,26 @@ /** - * lodash 4.0.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + /** `Object#toString` result references. */ var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; -/** Used to detect host constructors (Safari > 5). */ +/** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to determine if values are of the language type `Object`. */ @@ -85,6 +91,23 @@ function isHostObject(value) { return result; } +/** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ +function setToArray(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = value; + }); + return result; +} + /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -95,7 +118,8 @@ var funcToString = Function.prototype.toString; var hasOwnProperty = objectProto.hasOwnProperty; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -116,7 +140,7 @@ var Set = getNative(root, 'Set'); * @param {Array} values The values to add to the set. * @returns {Object} Returns the new set. */ -var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) { +var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { return new Set(values); }; @@ -133,14 +157,35 @@ function getNative(object, key) { return isNative(value) ? value : undefined; } +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isFunction(_); @@ -158,11 +203,13 @@ function isFunction(value) { } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. @@ -185,41 +232,16 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - /** * Checks if `value` is a native function. * * @static * @memberOf _ + * @since 3.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. * @example * * _.isNative(Array.prototype.push); @@ -229,14 +251,11 @@ function isObjectLike(value) { * // => false */ function isNative(value) { - if (value == null) { + if (!isObject(value)) { return false; } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); } /** @@ -245,6 +264,7 @@ function isNative(value) { * * @static * @memberOf _ + * @since 2.3.0 * @category Util * @example * diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/package.json b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/package.json index 857e620a91..6b6bebb3d7 100644 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/package.json +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._createset/package.json @@ -2,24 +2,24 @@ "_args": [ [ "lodash._createset@~4.0.0", - "/Users/zkat/Documents/code/npm/node_modules/lodash._baseuniq" + "/Users/rebecca/code/npm/node_modules/lodash._baseuniq" ] ], "_from": "lodash._createset@>=4.0.0 <4.1.0", - "_id": "lodash._createset@4.0.1", + "_id": "lodash._createset@4.0.3", "_inCache": true, "_installable": true, "_location": "/lodash._baseuniq/lodash._createset", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-13-west.internal.npmjs.com", - "tmp": "tmp/lodash._createset-4.0.1.tgz_1456896434807_0.3753381560090929" + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/lodash._createset-4.0.3.tgz_1463062044214_0.7864094290416688" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.14.17", + "_npmVersion": "2.15.5", "_phantomChildren": {}, "_requested": { "name": "lodash._createset", @@ -32,11 +32,11 @@ "_requiredBy": [ "/lodash._baseuniq" ], - "_resolved": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.1.tgz", - "_shasum": "00e891e3dd386c4512fcb1f49060dfa4d02a9819", + "_resolved": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.3.tgz", + "_shasum": "0f4659fbb09d75194fa9e2b88a6644d363c9fe26", "_shrinkwrap": null, "_spec": "lodash._createset@~4.0.0", - "_where": "/Users/zkat/Documents/code/npm/node_modules/lodash._baseuniq", + "_where": "/Users/rebecca/code/npm/node_modules/lodash._baseuniq", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -67,8 +67,8 @@ "devDependencies": {}, "directories": {}, "dist": { - "shasum": "00e891e3dd386c4512fcb1f49060dfa4d02a9819", - "tarball": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.1.tgz" + "shasum": "0f4659fbb09d75194fa9e2b88a6644d363c9fe26", + "tarball": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.3.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -97,5 +97,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.0.1" + "version": "4.0.3" } diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/LICENSE b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/LICENSE new file mode 100644 index 0000000000..bcbe13d67a --- /dev/null +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright 2012-2016 The Dojo Foundation +Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +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/lodash._baseuniq/node_modules/lodash._root/README.md b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/README.md new file mode 100644 index 0000000000..0329abf23d --- /dev/null +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/README.md @@ -0,0 +1,18 @@ +# lodash._root v3.0.1 + +The internal [lodash](https://lodash.com/) function `root` exported as a [Node.js](https://nodejs.org/) module. + +## Installation + +Using npm: +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash._root +``` + +In Node.js: +```js +var root = require('lodash._root'); +``` + +See the [package source](https://github.com/lodash/lodash/blob/3.0.1-npm-packages/lodash._root) for more details. diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/index.js b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/index.js new file mode 100644 index 0000000000..2d8ba0affc --- /dev/null +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/index.js @@ -0,0 +1,59 @@ +/** + * lodash 3.0.1 (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright 2012-2016 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** Used to determine if values are of the language type `Object`. */ +var objectTypes = { + 'function': true, + 'object': true +}; + +/** Detect free variable `exports`. */ +var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) + ? exports + : undefined; + +/** Detect free variable `module`. */ +var freeModule = (objectTypes[typeof module] && module && !module.nodeType) + ? module + : undefined; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); + +/** Detect free variable `self`. */ +var freeSelf = checkGlobal(objectTypes[typeof self] && self); + +/** Detect free variable `window`. */ +var freeWindow = checkGlobal(objectTypes[typeof window] && window); + +/** Detect `this` as the global object. */ +var thisGlobal = checkGlobal(objectTypes[typeof this] && this); + +/** + * Used as a reference to the global object. + * + * The `this` value is used if it's the global object to avoid Greasemonkey's + * restricted `window` object, otherwise the `window` object is used. + */ +var root = freeGlobal || + ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || + freeSelf || thisGlobal || Function('return this')(); + +/** + * Checks if `value` is a global object. + * + * @private + * @param {*} value The value to check. + * @returns {null|Object} Returns `value` if it's a global object, else `null`. + */ +function checkGlobal(value) { + return (value && value.Object === Object) ? value : null; +} + +module.exports = root; diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/package.json b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/package.json new file mode 100644 index 0000000000..561321ef55 --- /dev/null +++ b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._root/package.json @@ -0,0 +1,101 @@ +{ + "_args": [ + [ + "lodash._root@~3.0.0", + "/Users/rebecca/code/npm/node_modules/lodash._baseuniq" + ] + ], + "_from": "lodash._root@>=3.0.0 <3.1.0", + "_id": "lodash._root@3.0.1", + "_inCache": true, + "_installable": true, + "_location": "/lodash._baseuniq/lodash._root", + "_nodeVersion": "5.5.0", + "_npmOperationalInternal": { + "host": "packages-6-west.internal.npmjs.com", + "tmp": "tmp/lodash._root-3.0.1.tgz_1455615057559_0.24128212919458747" + }, + "_npmUser": { + "email": "john.david.dalton@gmail.com", + "name": "jdalton" + }, + "_npmVersion": "2.14.18", + "_phantomChildren": {}, + "_requested": { + "name": "lodash._root", + "raw": "lodash._root@~3.0.0", + "rawSpec": "~3.0.0", + "scope": null, + "spec": ">=3.0.0 <3.1.0", + "type": "range" + }, + "_requiredBy": [ + "/lodash._baseuniq" + ], + "_resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "_shasum": "fba1c4524c19ee9a5f8136b4609f017cf4ded692", + "_shrinkwrap": null, + "_spec": "lodash._root@~3.0.0", + "_where": "/Users/rebecca/code/npm/node_modules/lodash._baseuniq", + "author": { + "email": "john.david.dalton@gmail.com", + "name": "John-David Dalton", + "url": "http://allyoucanleet.com/" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "contributors": [ + { + "email": "john.david.dalton@gmail.com", + "name": "John-David Dalton", + "url": "http://allyoucanleet.com/" + }, + { + "email": "blaine@iceddev.com", + "name": "Blaine Bublitz", + "url": "https://github.com/phated" + }, + { + "email": "mathias@qiwi.be", + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + } + ], + "dependencies": {}, + "description": "The internal lodash function `root` exported as a module.", + "devDependencies": {}, + "directories": {}, + "dist": { + "shasum": "fba1c4524c19ee9a5f8136b4609f017cf4ded692", + "tarball": "http://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz" + }, + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "maintainers": [ + { + "email": "john.david.dalton@gmail.com", + "name": "jdalton" + }, + { + "email": "mathias@qiwi.be", + "name": "mathias" + }, + { + "email": "blaine.bublitz@gmail.com", + "name": "phated" + } + ], + "name": "lodash._root", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "version": "3.0.1" +} diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/LICENSE b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/LICENSE deleted file mode 100644 index bcbe13d67a..0000000000 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, -DocumentCloud and Investigative Reporters & Editors - -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/lodash._baseuniq/node_modules/lodash._setcache/README.md b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/README.md deleted file mode 100644 index 696e7cd135..0000000000 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# lodash._setcache v4.1.1 - -The internal [lodash](https://lodash.com/) function `SetCache` exported as a [Node.js](https://nodejs.org/) module. - -## Installation - -Using npm: -```bash -$ {sudo -H} npm i -g npm -$ npm i --save lodash._setcache -``` - -In Node.js: -```js -var SetCache = require('lodash._setcache'); -``` - -See the [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash._setcache) for more details. diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/index.js b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/index.js deleted file mode 100644 index dd96de49f1..0000000000 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/index.js +++ /dev/null @@ -1,588 +0,0 @@ -/** - * lodash 4.1.1 (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; - -/** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** Used to determine if values are of the language type `Object`. */ -var objectTypes = { - 'function': true, - 'object': true -}; - -/** Detect free variable `exports`. */ -var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) - ? exports - : undefined; - -/** Detect free variable `module`. */ -var freeModule = (objectTypes[typeof module] && module && !module.nodeType) - ? module - : undefined; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || - ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || - freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** Used for built-in method references. */ -var arrayProto = Array.prototype, - objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** Built-in value references. */ -var splice = arrayProto.splice; - -/* Built-in method references that are verified to be native. */ -var Map = getNative(root, 'Map'), - nativeCreate = getNative(Object, 'create'); - -/** - * Creates an hash object. - * - * @private - * @constructor - * @returns {Object} Returns the new hash object. - */ -function Hash() {} - -/** - * Removes `key` and its value from the hash. - * - * @private - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function hashDelete(hash, key) { - return hashHas(hash, key) && delete hash[key]; -} - -/** - * Gets the hash value for `key`. - * - * @private - * @param {Object} hash The hash to query. - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function hashGet(hash, key) { - if (nativeCreate) { - var result = hash[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(hash, key) ? hash[key] : undefined; -} - -/** - * Checks if a hash value for `key` exists. - * - * @private - * @param {Object} hash The hash to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function hashHas(hash, key) { - return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key); -} - -/** - * Sets the hash `key` to `value`. - * - * @private - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - */ -function hashSet(hash, key, value) { - hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; -} - -/** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ -function MapCache(values) { - var index = -1, - length = values ? values.length : 0; - - this.clear(); - while (++index < length) { - var entry = values[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ -function mapClear() { - this.__data__ = { - 'hash': new Hash, - 'map': Map ? new Map : [], - 'string': new Hash - }; -} - -/** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function mapDelete(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashDelete(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map['delete'](key) : assocDelete(data.map, key); -} - -/** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function mapGet(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashGet(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.get(key) : assocGet(data.map, key); -} - -/** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function mapHas(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashHas(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.has(key) : assocHas(data.map, key); -} - -/** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache object. - */ -function mapSet(key, value) { - var data = this.__data__; - if (isKeyable(key)) { - hashSet(typeof key == 'string' ? data.string : data.hash, key, value); - } else if (Map) { - data.map.set(key, value); - } else { - assocSet(data.map, key, value); - } - return this; -} - -/** - * - * Creates a set cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ -function SetCache(values) { - var index = -1, - length = values ? values.length : 0; - - this.__data__ = new MapCache; - while (++index < length) { - this.push(values[index]); - } -} - -/** - * Adds `value` to the set cache. - * - * @private - * @name push - * @memberOf SetCache - * @param {*} value The value to cache. - */ -function cachePush(value) { - var map = this.__data__; - if (isKeyable(value)) { - var data = map.__data__, - hash = typeof value == 'string' ? data.string : data.hash; - - hash[value] = HASH_UNDEFINED; - } - else { - map.set(value, HASH_UNDEFINED); - } -} - -/** - * Removes `key` and its value from the associative array. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function assocDelete(array, key) { - var index = assocIndexOf(array, key); - if (index < 0) { - return false; - } - var lastIndex = array.length - 1; - if (index == lastIndex) { - array.pop(); - } else { - splice.call(array, index, 1); - } - return true; -} - -/** - * Gets the associative array value for `key`. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function assocGet(array, key) { - var index = assocIndexOf(array, key); - return index < 0 ? undefined : array[index][1]; -} - -/** - * Checks if an associative array value for `key` exists. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function assocHas(array, key) { - return assocIndexOf(array, key) > -1; -} - -/** - * Gets the index at which the first occurrence of `key` is found in `array` - * of key-value pairs. - * - * @private - * @param {Array} array The array to search. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; -} - -/** - * Sets the associative array `key` to `value`. - * - * @private - * @param {Array} array The array to modify. - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - */ -function assocSet(array, key, value) { - var index = assocIndexOf(array, key); - if (index < 0) { - array.push([key, value]); - } else { - array[index][1] = value; - } -} - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object[key]; - return isNative(value) ? value : undefined; -} - -/** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ -function isKeyable(value) { - var type = typeof value; - return type == 'number' || type == 'boolean' || - (type == 'string' && value != '__proto__') || value == null; -} - -/** - * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'user': 'fred' }; - * var other = { 'user': 'fred' }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ -function eq(value, other) { - return value === other || (value !== value && other !== other); -} - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); -} - -// Avoid inheriting from `Object.prototype` when possible. -Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; - -// Add functions to the `MapCache`. -MapCache.prototype.clear = mapClear; -MapCache.prototype['delete'] = mapDelete; -MapCache.prototype.get = mapGet; -MapCache.prototype.has = mapHas; -MapCache.prototype.set = mapSet; - -// Add functions to the `SetCache`. -SetCache.prototype.push = cachePush; - -module.exports = SetCache; diff --git a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/package.json b/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/package.json deleted file mode 100644 index 2fedb703b4..0000000000 --- a/deps/npm/node_modules/lodash._baseuniq/node_modules/lodash._setcache/package.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "_args": [ - [ - "lodash._setcache@~4.1.0", - "/Users/zkat/Documents/code/npm/node_modules/lodash._baseuniq" - ] - ], - "_from": "lodash._setcache@>=4.1.0 <4.2.0", - "_id": "lodash._setcache@4.1.1", - "_inCache": true, - "_installable": true, - "_location": "/lodash._baseuniq/lodash._setcache", - "_nodeVersion": "5.5.0", - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash._setcache-4.1.1.tgz_1456896443505_0.39592266851104796" - }, - "_npmUser": { - "email": "john.david.dalton@gmail.com", - "name": "jdalton" - }, - "_npmVersion": "2.14.17", - "_phantomChildren": {}, - "_requested": { - "name": "lodash._setcache", - "raw": "lodash._setcache@~4.1.0", - "rawSpec": "~4.1.0", - "scope": null, - "spec": ">=4.1.0 <4.2.0", - "type": "range" - }, - "_requiredBy": [ - "/lodash._baseuniq" - ], - "_resolved": "https://registry.npmjs.org/lodash._setcache/-/lodash._setcache-4.1.1.tgz", - "_shasum": "338f47e49f21ba8bb89e621e7815d781bd4dbd97", - "_shrinkwrap": null, - "_spec": "lodash._setcache@~4.1.0", - "_where": "/Users/zkat/Documents/code/npm/node_modules/lodash._baseuniq", - "author": { - "email": "john.david.dalton@gmail.com", - "name": "John-David Dalton", - "url": "http://allyoucanleet.com/" - }, - "bugs": { - "url": "https://github.com/lodash/lodash/issues" - }, - "contributors": [ - { - "email": "john.david.dalton@gmail.com", - "name": "John-David Dalton", - "url": "http://allyoucanleet.com/" - }, - { - "email": "blaine.bublitz@gmail.com", - "name": "Blaine Bublitz", - "url": "https://github.com/phated" - }, - { - "email": "mathias@qiwi.be", - "name": "Mathias Bynens", - "url": "https://mathiasbynens.be/" - } - ], - "dependencies": {}, - "description": "The internal lodash function `SetCache` exported as a module.", - "devDependencies": {}, - "directories": {}, - "dist": { - "shasum": "338f47e49f21ba8bb89e621e7815d781bd4dbd97", - "tarball": "https://registry.npmjs.org/lodash._setcache/-/lodash._setcache-4.1.1.tgz" - }, - "homepage": "https://lodash.com/", - "icon": "https://lodash.com/icon.svg", - "license": "MIT", - "maintainers": [ - { - "email": "john.david.dalton@gmail.com", - "name": "jdalton" - }, - { - "email": "mathias@qiwi.be", - "name": "mathias" - }, - { - "email": "blaine.bublitz@gmail.com", - "name": "phated" - } - ], - "name": "lodash._setcache", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/lodash/lodash.git" - }, - "scripts": { - "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" - }, - "version": "4.1.1" -} diff --git a/deps/npm/node_modules/lodash._baseuniq/package.json b/deps/npm/node_modules/lodash._baseuniq/package.json index f4cffe5507..f25616330a 100644 --- a/deps/npm/node_modules/lodash._baseuniq/package.json +++ b/deps/npm/node_modules/lodash._baseuniq/package.json @@ -1,44 +1,42 @@ { "_args": [ [ - "lodash._baseuniq@4.5.1", - "/Users/zkat/Documents/code/npm" + "lodash._baseuniq@latest", + "/Users/rebecca/code/npm" ] ], - "_from": "lodash._baseuniq@4.5.1", - "_id": "lodash._baseuniq@4.5.1", + "_from": "lodash._baseuniq@latest", + "_id": "lodash._baseuniq@4.6.0", "_inCache": true, "_installable": true, "_location": "/lodash._baseuniq", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash._baseuniq-4.5.1.tgz_1459310621859_0.6014031588565558" + "tmp": "tmp/lodash._baseuniq-4.6.0.tgz_1463062037853_0.04403974884189665" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.15.1", + "_npmVersion": "2.15.5", "_phantomChildren": {}, "_requested": { "name": "lodash._baseuniq", - "raw": "lodash._baseuniq@4.5.1", - "rawSpec": "4.5.1", + "raw": "lodash._baseuniq@latest", + "rawSpec": "latest", "scope": null, - "spec": "4.5.1", - "type": "version" + "spec": "latest", + "type": "tag" }, "_requiredBy": [ - "/", - "/lodash.union", - "/lodash.uniq" + "/" ], - "_resolved": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.5.1.tgz", - "_shasum": "1980430c2e64ee86df6dd35794e1a301b2ab74de", + "_resolved": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz", + "_shasum": "0ebb44e456814af7905c6212fa2c9b2d51b841e8", "_shrinkwrap": null, - "_spec": "lodash._baseuniq@4.5.1", - "_where": "/Users/zkat/Documents/code/npm", + "_spec": "lodash._baseuniq@latest", + "_where": "/Users/rebecca/code/npm", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -66,14 +64,14 @@ ], "dependencies": { "lodash._createset": "~4.0.0", - "lodash._setcache": "~4.1.0" + "lodash._root": "~3.0.0" }, "description": "The internal lodash function `baseUniq` exported as a module.", "devDependencies": {}, "directories": {}, "dist": { - "shasum": "1980430c2e64ee86df6dd35794e1a301b2ab74de", - "tarball": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.5.1.tgz" + "shasum": "0ebb44e456814af7905c6212fa2c9b2d51b841e8", + "tarball": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -102,5 +100,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.5.1" + "version": "4.6.0" } diff --git a/deps/npm/node_modules/lodash.keys/README.md b/deps/npm/node_modules/lodash.keys/README.md index 76cafbed3e..5c9c49c627 100644 --- a/deps/npm/node_modules/lodash.keys/README.md +++ b/deps/npm/node_modules/lodash.keys/README.md @@ -1,4 +1,4 @@ -# lodash.keys v4.0.6 +# lodash.keys v4.0.7 The [lodash](https://lodash.com/) method `_.keys` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var keys = require('lodash.keys'); ``` -See the [documentation](https://lodash.com/docs#keys) or [package source](https://github.com/lodash/lodash/blob/4.0.6-npm-packages/lodash.keys) for more details. +See the [documentation](https://lodash.com/docs#keys) or [package source](https://github.com/lodash/lodash/blob/4.0.7-npm-packages/lodash.keys) for more details. diff --git a/deps/npm/node_modules/lodash.keys/index.js b/deps/npm/node_modules/lodash.keys/index.js index 5861b0ffe3..39530dfc6f 100644 --- a/deps/npm/node_modules/lodash.keys/index.js +++ b/deps/npm/node_modules/lodash.keys/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.0.6 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -38,20 +38,6 @@ function baseTimes(n, iteratee) { return result; } -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; - length = length == null ? MAX_SAFE_INTEGER : length; - return value > -1 && value % 1 == 0 && value < length; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -59,7 +45,8 @@ var objectProto = Object.prototype; var hasOwnProperty = objectProto.hasOwnProperty; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -104,7 +91,7 @@ function baseKeys(object) { * * @private * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { @@ -153,6 +140,21 @@ function indexKeys(object) { return null; } +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + /** * Checks if `value` is likely a prototype object. * @@ -335,8 +337,9 @@ function isLength(value) { } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ diff --git a/deps/npm/node_modules/lodash.keys/package.json b/deps/npm/node_modules/lodash.keys/package.json index fb34e2b8f6..0308e51443 100644 --- a/deps/npm/node_modules/lodash.keys/package.json +++ b/deps/npm/node_modules/lodash.keys/package.json @@ -1,41 +1,41 @@ { "_args": [ [ - "lodash.keys@~4.0.5", + "lodash.keys@latest", "/Users/rebecca/code/npm" ] ], - "_from": "lodash.keys@>=4.0.5 <4.1.0", - "_id": "lodash.keys@4.0.6", + "_from": "lodash.keys@latest", + "_id": "lodash.keys@4.0.7", "_inCache": true, "_installable": true, "_location": "/lodash.keys", - "_nodeVersion": "5.9.1", + "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash.keys-4.0.6.tgz_1459655434754_0.30223311693407595" + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/lodash.keys-4.0.7.tgz_1463062346790_0.19413627637550235" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.15.2", + "_npmVersion": "2.15.5", "_phantomChildren": {}, "_requested": { "name": "lodash.keys", - "raw": "lodash.keys@~4.0.5", - "rawSpec": "~4.0.5", + "raw": "lodash.keys@latest", + "rawSpec": "latest", "scope": null, - "spec": ">=4.0.5 <4.1.0", - "type": "range" + "spec": "latest", + "type": "tag" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-4.0.6.tgz", - "_shasum": "2087692c58b0e44e88658108da8ad66f417867ac", + "_resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-4.0.7.tgz", + "_shasum": "30e1b3bd98e54d6a0611991812685b6bc47cb63b", "_shrinkwrap": null, - "_spec": "lodash.keys@~4.0.5", + "_spec": "lodash.keys@latest", "_where": "/Users/rebecca/code/npm", "author": { "email": "john.david.dalton@gmail.com", @@ -67,8 +67,8 @@ "devDependencies": {}, "directories": {}, "dist": { - "shasum": "2087692c58b0e44e88658108da8ad66f417867ac", - "tarball": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-4.0.6.tgz" + "shasum": "30e1b3bd98e54d6a0611991812685b6bc47cb63b", + "tarball": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-4.0.7.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -101,5 +101,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.0.6" + "version": "4.0.7" } diff --git a/deps/npm/node_modules/lodash.union/README.md b/deps/npm/node_modules/lodash.union/README.md index 4c1f4c7366..5a4fb54a9e 100644 --- a/deps/npm/node_modules/lodash.union/README.md +++ b/deps/npm/node_modules/lodash.union/README.md @@ -1,4 +1,4 @@ -# lodash.union v4.3.0 +# lodash.union v4.4.0 The [lodash](https://lodash.com/) method `_.union` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var union = require('lodash.union'); ``` -See the [documentation](https://lodash.com/docs#union) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.union) for more details. +See the [documentation](https://lodash.com/docs#union) or [package source](https://github.com/lodash/lodash/blob/4.4.0-npm-packages/lodash.union) for more details. diff --git a/deps/npm/node_modules/lodash.union/index.js b/deps/npm/node_modules/lodash.union/index.js index 9bc9475d2c..5aa425b775 100644 --- a/deps/npm/node_modules/lodash.union/index.js +++ b/deps/npm/node_modules/lodash.union/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.3.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -32,7 +32,7 @@ var objectToString = objectProto.toString; * * @private * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { diff --git a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/README.md b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/README.md index bfa8eb7f4a..2c839ab728 100644 --- a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/README.md +++ b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/README.md @@ -1,4 +1,4 @@ -# lodash._baseflatten v4.2.0 +# lodash._baseflatten v4.2.1 The internal [lodash](https://lodash.com/) function `baseFlatten` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var baseFlatten = require('lodash._baseflatten'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash._baseflatten) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.2.1-npm-packages/lodash._baseflatten) for more details. diff --git a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/index.js b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/index.js index 0daaa01622..de0df103f4 100644 --- a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/index.js +++ b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.2.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -89,7 +89,7 @@ function baseFlatten(array, depth, predicate, isStrict, result) { * * @private * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { @@ -118,7 +118,7 @@ var getLength = baseProperty('length'); * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. */ function isFlattenable(value) { - return isArrayLikeObject(value) && (isArray(value) || isArguments(value)); + return isArray(value) || isArguments(value); } /** diff --git a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/package.json b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/package.json index cf8df940c5..cd710c8b3a 100644 --- a/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/package.json +++ b/deps/npm/node_modules/lodash.union/node_modules/lodash._baseflatten/package.json @@ -6,20 +6,20 @@ ] ], "_from": "lodash._baseflatten@>=4.2.0 <4.3.0", - "_id": "lodash._baseflatten@4.2.0", + "_id": "lodash._baseflatten@4.2.1", "_inCache": true, "_installable": true, "_location": "/lodash.union/lodash._baseflatten", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash._baseflatten-4.2.0.tgz_1460126652696_0.20245859795249999" + "tmp": "tmp/lodash._baseflatten-4.2.1.tgz_1463062009548_0.7446099303197116" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.15.3", + "_npmVersion": "2.15.5", "_phantomChildren": {}, "_requested": { "name": "lodash._baseflatten", @@ -32,8 +32,8 @@ "_requiredBy": [ "/lodash.union" ], - "_resolved": "https://registry.npmjs.org/lodash._baseflatten/-/lodash._baseflatten-4.2.0.tgz", - "_shasum": "66b4fa38645051392d4c0393ff41a3c7e2295f64", + "_resolved": "https://registry.npmjs.org/lodash._baseflatten/-/lodash._baseflatten-4.2.1.tgz", + "_shasum": "54acad5e6ef53532a5b8269c0ad725470cfd9208", "_shrinkwrap": null, "_spec": "lodash._baseflatten@~4.2.0", "_where": "/Users/rebecca/code/npm/node_modules/lodash.union", @@ -67,8 +67,8 @@ "devDependencies": {}, "directories": {}, "dist": { - "shasum": "66b4fa38645051392d4c0393ff41a3c7e2295f64", - "tarball": "https://registry.npmjs.org/lodash._baseflatten/-/lodash._baseflatten-4.2.0.tgz" + "shasum": "54acad5e6ef53532a5b8269c0ad725470cfd9208", + "tarball": "https://registry.npmjs.org/lodash._baseflatten/-/lodash._baseflatten-4.2.1.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -97,5 +97,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.2.0" + "version": "4.2.1" } diff --git a/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/README.md b/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/README.md index 5f1febeff5..5342ca4452 100644 --- a/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/README.md +++ b/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/README.md @@ -1,4 +1,4 @@ -# lodash.rest v4.0.2 +# lodash.rest v4.0.3 The [lodash](https://lodash.com/) method `_.rest` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var rest = require('lodash.rest'); ``` -See the [documentation](https://lodash.com/docs#rest) or [package source](https://github.com/lodash/lodash/blob/4.0.2-npm-packages/lodash.rest) for more details. +See the [documentation](https://lodash.com/docs#rest) or [package source](https://github.com/lodash/lodash/blob/4.0.3-npm-packages/lodash.rest) for more details. diff --git a/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/index.js b/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/index.js index 4e1cdb99ba..2315786410 100644 --- a/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/index.js +++ b/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.0.2 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -42,7 +42,7 @@ var freeParseInt = parseInt; * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. - * @param {...*} args The arguments to invoke `func` with. + * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { @@ -60,7 +60,8 @@ function apply(func, thisArg, args) { var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -149,8 +150,9 @@ function isFunction(value) { } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ @@ -228,6 +230,41 @@ function isSymbol(value) { (isObjectLike(value) && objectToString.call(value) == symbolTag); } +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ +function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; +} + /** * Converts `value` to an integer. * @@ -242,7 +279,7 @@ function isSymbol(value) { * @returns {number} Returns the converted integer. * @example * - * _.toInteger(3); + * _.toInteger(3.2); * // => 3 * * _.toInteger(Number.MIN_VALUE); @@ -251,20 +288,14 @@ function isSymbol(value) { * _.toInteger(Infinity); * // => 1.7976931348623157e+308 * - * _.toInteger('3'); + * _.toInteger('3.2'); * // => 3 */ function toInteger(value) { - if (!value) { - return value === 0 ? value : 0; - } - value = toNumber(value); - if (value === INFINITY || value === -INFINITY) { - var sign = (value < 0 ? -1 : 1); - return sign * MAX_INTEGER; - } - var remainder = value % 1; - return value === value ? (remainder ? value - remainder : value) : 0; + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; } /** @@ -278,8 +309,8 @@ function toInteger(value) { * @returns {number} Returns the number. * @example * - * _.toNumber(3); - * // => 3 + * _.toNumber(3.2); + * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 @@ -287,8 +318,8 @@ function toInteger(value) { * _.toNumber(Infinity); * // => Infinity * - * _.toNumber('3'); - * // => 3 + * _.toNumber('3.2'); + * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { diff --git a/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/package.json b/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/package.json index 7c79f9509d..416db6c858 100644 --- a/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/package.json +++ b/deps/npm/node_modules/lodash.union/node_modules/lodash.rest/package.json @@ -6,20 +6,20 @@ ] ], "_from": "lodash.rest@>=4.0.0 <5.0.0", - "_id": "lodash.rest@4.0.2", + "_id": "lodash.rest@4.0.3", "_inCache": true, "_installable": true, "_location": "/lodash.union/lodash.rest", - "_nodeVersion": "5.9.1", + "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash.rest-4.0.2.tgz_1459655529260_0.05724348593503237" + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/lodash.rest-4.0.3.tgz_1463062507321_0.6458017621189356" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.15.2", + "_npmVersion": "2.15.5", "_phantomChildren": {}, "_requested": { "name": "lodash.rest", @@ -32,8 +32,8 @@ "_requiredBy": [ "/lodash.union" ], - "_resolved": "https://registry.npmjs.org/lodash.rest/-/lodash.rest-4.0.2.tgz", - "_shasum": "a15a7daa9cbd45e223ef5ba5d38e87dd02eac6bd", + "_resolved": "https://registry.npmjs.org/lodash.rest/-/lodash.rest-4.0.3.tgz", + "_shasum": "4c1c32c40028087250fabf70d42e0151548f48c5", "_shrinkwrap": null, "_spec": "lodash.rest@^4.0.0", "_where": "/Users/rebecca/code/npm/node_modules/lodash.union", @@ -67,8 +67,8 @@ "devDependencies": {}, "directories": {}, "dist": { - "shasum": "a15a7daa9cbd45e223ef5ba5d38e87dd02eac6bd", - "tarball": "https://registry.npmjs.org/lodash.rest/-/lodash.rest-4.0.2.tgz" + "shasum": "4c1c32c40028087250fabf70d42e0151548f48c5", + "tarball": "https://registry.npmjs.org/lodash.rest/-/lodash.rest-4.0.3.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -101,5 +101,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.0.2" + "version": "4.0.3" } diff --git a/deps/npm/node_modules/lodash.union/package.json b/deps/npm/node_modules/lodash.union/package.json index 41472cc99d..4e89c1da97 100644 --- a/deps/npm/node_modules/lodash.union/package.json +++ b/deps/npm/node_modules/lodash.union/package.json @@ -1,41 +1,41 @@ { "_args": [ [ - "lodash.union@~4.3.0", + "lodash.union@latest", "/Users/rebecca/code/npm" ] ], - "_from": "lodash.union@>=4.3.0 <4.4.0", - "_id": "lodash.union@4.3.0", + "_from": "lodash.union@latest", + "_id": "lodash.union@4.4.0", "_inCache": true, "_installable": true, "_location": "/lodash.union", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash.union-4.3.0.tgz_1460126989680_0.062147664139047265" + "tmp": "tmp/lodash.union-4.4.0.tgz_1463062655004_0.2674572637770325" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.15.3", + "_npmVersion": "2.15.5", "_phantomChildren": {}, "_requested": { "name": "lodash.union", - "raw": "lodash.union@~4.3.0", - "rawSpec": "~4.3.0", + "raw": "lodash.union@latest", + "rawSpec": "latest", "scope": null, - "spec": ">=4.3.0 <4.4.0", - "type": "range" + "spec": "latest", + "type": "tag" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.3.0.tgz", - "_shasum": "9da994773c563838fc4785c459d5a0dbe18305b8", + "_resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.4.0.tgz", + "_shasum": "22be23b4c84b49d0436e573949ad1d4a48c7fa38", "_shrinkwrap": null, - "_spec": "lodash.union@~4.3.0", + "_spec": "lodash.union@latest", "_where": "/Users/rebecca/code/npm", "author": { "email": "john.david.dalton@gmail.com", @@ -64,15 +64,15 @@ ], "dependencies": { "lodash._baseflatten": "~4.2.0", - "lodash._baseuniq": "~4.5.0", + "lodash._baseuniq": "~4.6.0", "lodash.rest": "^4.0.0" }, "description": "The lodash method `_.union` exported as a module.", "devDependencies": {}, "directories": {}, "dist": { - "shasum": "9da994773c563838fc4785c459d5a0dbe18305b8", - "tarball": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.3.0.tgz" + "shasum": "22be23b4c84b49d0436e573949ad1d4a48c7fa38", + "tarball": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.4.0.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -105,5 +105,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.3.0" + "version": "4.4.0" } diff --git a/deps/npm/node_modules/lodash.uniq/LICENSE b/deps/npm/node_modules/lodash.uniq/LICENSE index bcbe13d67a..e0c69d5603 100644 --- a/deps/npm/node_modules/lodash.uniq/LICENSE +++ b/deps/npm/node_modules/lodash.uniq/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -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. +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +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. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/deps/npm/node_modules/lodash.uniq/README.md b/deps/npm/node_modules/lodash.uniq/README.md index 31e7c591ea..f1d83df5e5 100644 --- a/deps/npm/node_modules/lodash.uniq/README.md +++ b/deps/npm/node_modules/lodash.uniq/README.md @@ -1,4 +1,4 @@ -# lodash.uniq v4.2.1 +# lodash.uniq v4.3.0 The [lodash](https://lodash.com/) method `_.uniq` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var uniq = require('lodash.uniq'); ``` -See the [documentation](https://lodash.com/docs#uniq) or [package source](https://github.com/lodash/lodash/blob/4.2.1-npm-packages/lodash.uniq) for more details. +See the [documentation](https://lodash.com/docs#uniq) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.uniq) for more details. diff --git a/deps/npm/node_modules/lodash.uniq/index.js b/deps/npm/node_modules/lodash.uniq/index.js index 567c6ece6a..d1a25d8091 100644 --- a/deps/npm/node_modules/lodash.uniq/index.js +++ b/deps/npm/node_modules/lodash.uniq/index.js @@ -1,21 +1,22 @@ /** - * lodash 4.2.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseUniq = require('lodash._baseuniq'); /** * Creates a duplicate-free version of an array, using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each element - * is kept. + * for equality comparisons, in which only the first occurrence of each + * element is kept. * * @static * @memberOf _ + * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. diff --git a/deps/npm/node_modules/lodash.uniq/package.json b/deps/npm/node_modules/lodash.uniq/package.json index 2823bb8d2c..4ee8486f49 100644 --- a/deps/npm/node_modules/lodash.uniq/package.json +++ b/deps/npm/node_modules/lodash.uniq/package.json @@ -1,42 +1,42 @@ { "_args": [ [ - "lodash.uniq@4.2.1", - "/Users/zkat/Documents/code/npm" + "lodash.uniq@latest", + "/Users/rebecca/code/npm" ] ], - "_from": "lodash.uniq@4.2.1", - "_id": "lodash.uniq@4.2.1", + "_from": "lodash.uniq@latest", + "_id": "lodash.uniq@4.3.0", "_inCache": true, "_installable": true, "_location": "/lodash.uniq", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash.uniq-4.2.1.tgz_1459310991318_0.029993396950885653" + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/lodash.uniq-4.3.0.tgz_1463062659727_0.9107886834535748" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.15.1", + "_npmVersion": "2.15.5", "_phantomChildren": {}, "_requested": { "name": "lodash.uniq", - "raw": "lodash.uniq@4.2.1", - "rawSpec": "4.2.1", + "raw": "lodash.uniq@latest", + "rawSpec": "latest", "scope": null, - "spec": "4.2.1", - "type": "version" + "spec": "latest", + "type": "tag" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.2.1.tgz", - "_shasum": "4210d4b90647ee24211b469aed0ef84902069743", + "_resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.3.0.tgz", + "_shasum": "dcad810876841447d8f3ec662323c86a6d938227", "_shrinkwrap": null, - "_spec": "lodash.uniq@4.2.1", - "_where": "/Users/zkat/Documents/code/npm", + "_spec": "lodash.uniq@latest", + "_where": "/Users/rebecca/code/npm", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -63,14 +63,14 @@ } ], "dependencies": { - "lodash._baseuniq": "~4.5.0" + "lodash._baseuniq": "~4.6.0" }, "description": "The lodash method `_.uniq` exported as a module.", "devDependencies": {}, "directories": {}, "dist": { - "shasum": "4210d4b90647ee24211b469aed0ef84902069743", - "tarball": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.2.1.tgz" + "shasum": "dcad810876841447d8f3ec662323c86a6d938227", + "tarball": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.3.0.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -103,5 +103,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.2.1" + "version": "4.3.0" } diff --git a/deps/npm/node_modules/lodash.without/LICENSE b/deps/npm/node_modules/lodash.without/LICENSE index bcbe13d67a..e0c69d5603 100644 --- a/deps/npm/node_modules/lodash.without/LICENSE +++ b/deps/npm/node_modules/lodash.without/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -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. +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +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. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/deps/npm/node_modules/lodash.without/README.md b/deps/npm/node_modules/lodash.without/README.md index 3299e4c531..dd02c51c7c 100644 --- a/deps/npm/node_modules/lodash.without/README.md +++ b/deps/npm/node_modules/lodash.without/README.md @@ -1,4 +1,4 @@ -# lodash.without v4.1.2 +# lodash.without v4.2.0 The [lodash](https://lodash.com/) method `_.without` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var without = require('lodash.without'); ``` -See the [documentation](https://lodash.com/docs#without) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.without) for more details. +See the [documentation](https://lodash.com/docs#without) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.without) for more details. diff --git a/deps/npm/node_modules/lodash.without/index.js b/deps/npm/node_modules/lodash.without/index.js index f9ed54a01c..7c6954106b 100644 --- a/deps/npm/node_modules/lodash.without/index.js +++ b/deps/npm/node_modules/lodash.without/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.1.2 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseDifference = require('lodash._basedifference'), rest = require('lodash.rest'); @@ -20,7 +20,8 @@ var funcTag = '[object Function]', var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -30,7 +31,7 @@ var objectToString = objectProto.toString; * * @private * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { @@ -41,8 +42,9 @@ function baseProperty(key) { /** * Gets the "length" property value of `object`. * - * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * that affects Safari on at least iOS 8.1-8.3 ARM64. + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. @@ -57,10 +59,12 @@ var getLength = baseProperty('length'); * * @static * @memberOf _ + * @since 0.1.0 * @category Array - * @param {Array} array The array to filter. + * @param {Array} array The array to inspect. * @param {...*} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.xor * @example * * _.without([1, 2, 1, 3], 1, 2); @@ -79,6 +83,7 @@ var without = rest(function(array, values) { * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -106,9 +111,11 @@ function isArrayLike(value) { * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); @@ -132,9 +139,11 @@ function isArrayLikeObject(value) { * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isFunction(_); @@ -154,13 +163,16 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. * @example * * _.isLength(3); @@ -181,11 +193,13 @@ function isLength(value) { } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. @@ -214,6 +228,7 @@ function isObject(value) { * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/LICENSE b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/LICENSE index bcbe13d67a..e0c69d5603 100644 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/LICENSE +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -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. +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +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. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/README.md b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/README.md index 0ff2f16607..7426607e97 100644 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/README.md +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/README.md @@ -1,4 +1,4 @@ -# lodash._basedifference v4.4.1 +# lodash._basedifference v4.5.0 The internal [lodash](https://lodash.com/) function `baseDifference` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var baseDifference = require('lodash._basedifference'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash._basedifference) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.5.0-npm-packages/lodash._basedifference) for more details. diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/index.js b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/index.js index 5fa779dfdd..39b916c9be 100644 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/index.js +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/index.js @@ -1,12 +1,12 @@ /** - * lodash 4.4.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var SetCache = require('lodash._setcache'); +var root = require('lodash._root'); /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -14,6 +14,19 @@ var LARGE_ARRAY_SIZE = 200; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + /** * A specialized version of `_.includes` for arrays without support for * specifying an index to search from. @@ -97,7 +110,7 @@ function baseIndexOf(array, value, fromIndex) { * * @private * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new capped function. */ function baseUnary(func) { return function(value) { @@ -105,6 +118,18 @@ function baseUnary(func) { }; } +/** + * Checks if a cache value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function cacheHas(cache, key) { + return cache.has(key); +} + /** * Gets the index at which the first occurrence of `NaN` is found in `array`. * @@ -128,27 +153,429 @@ function indexOfNaN(array, fromIndex, fromRight) { } /** - * Checks if `value` is in `cache`. + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} + +/** Used for built-in method references. */ +var arrayProto = Array.prototype, + objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = Function.prototype.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var splice = arrayProto.splice; + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'), + nativeCreate = getNative(Object, 'create'); + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. * * @private - * @param {Object} cache The set cache to search. + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values ? values.length : 0; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } +} + +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ -function cacheHas(cache, value) { - var map = cache.__data__; - if (isKeyable(value)) { - var data = map.__data__, - hash = typeof value == 'string' ? data.string : data.hash; +function setCacheHas(value) { + return this.__data__.has(value); +} + +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; - return hash[value] === HASH_UNDEFINED; +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to search. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } } - return map.has(value); + return -1; } /** - * The base implementation of methods like `_.difference` without support for - * excluding multiple arrays or iteratee shorthands. + * The base implementation of methods like `_.difference` without support + * for excluding multiple arrays or iteratee shorthands. * * @private * @param {Array} array The array to inspect. @@ -185,6 +612,7 @@ function baseDifference(array, values, iteratee, comparator) { var value = array[index], computed = iteratee ? iteratee(value) : value; + value = (comparator || value !== 0) ? value : 0; if (isCommon && computed === computed) { var valuesIndex = valuesLength; while (valuesIndex--) { @@ -201,6 +629,34 @@ function baseDifference(array, values, iteratee, comparator) { return result; } +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = object[key]; + return isNative(value) ? value : undefined; +} + /** * Checks if `value` is suitable for use as unique object key. * @@ -210,8 +666,146 @@ function baseDifference(array, values, iteratee, comparator) { */ function isKeyable(value) { var type = typeof value; - return type == 'number' || type == 'boolean' || - (type == 'string' && value != '__proto__') || value == null; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'user': 'fred' }; + * var other = { 'user': 'fred' }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ +function isNative(value) { + if (!isObject(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); } module.exports = baseDifference; diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/LICENSE b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/LICENSE new file mode 100644 index 0000000000..bcbe13d67a --- /dev/null +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright 2012-2016 The Dojo Foundation +Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +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/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/README.md b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/README.md new file mode 100644 index 0000000000..0329abf23d --- /dev/null +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/README.md @@ -0,0 +1,18 @@ +# lodash._root v3.0.1 + +The internal [lodash](https://lodash.com/) function `root` exported as a [Node.js](https://nodejs.org/) module. + +## Installation + +Using npm: +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash._root +``` + +In Node.js: +```js +var root = require('lodash._root'); +``` + +See the [package source](https://github.com/lodash/lodash/blob/3.0.1-npm-packages/lodash._root) for more details. diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/index.js b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/index.js new file mode 100644 index 0000000000..2d8ba0affc --- /dev/null +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/index.js @@ -0,0 +1,59 @@ +/** + * lodash 3.0.1 (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright 2012-2016 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** Used to determine if values are of the language type `Object`. */ +var objectTypes = { + 'function': true, + 'object': true +}; + +/** Detect free variable `exports`. */ +var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) + ? exports + : undefined; + +/** Detect free variable `module`. */ +var freeModule = (objectTypes[typeof module] && module && !module.nodeType) + ? module + : undefined; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); + +/** Detect free variable `self`. */ +var freeSelf = checkGlobal(objectTypes[typeof self] && self); + +/** Detect free variable `window`. */ +var freeWindow = checkGlobal(objectTypes[typeof window] && window); + +/** Detect `this` as the global object. */ +var thisGlobal = checkGlobal(objectTypes[typeof this] && this); + +/** + * Used as a reference to the global object. + * + * The `this` value is used if it's the global object to avoid Greasemonkey's + * restricted `window` object, otherwise the `window` object is used. + */ +var root = freeGlobal || + ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || + freeSelf || thisGlobal || Function('return this')(); + +/** + * Checks if `value` is a global object. + * + * @private + * @param {*} value The value to check. + * @returns {null|Object} Returns `value` if it's a global object, else `null`. + */ +function checkGlobal(value) { + return (value && value.Object === Object) ? value : null; +} + +module.exports = root; diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/package.json b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/package.json new file mode 100644 index 0000000000..5d911a87e3 --- /dev/null +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._root/package.json @@ -0,0 +1,101 @@ +{ + "_args": [ + [ + "lodash._root@~3.0.0", + "/Users/rebecca/code/npm/node_modules/lodash.without/node_modules/lodash._basedifference" + ] + ], + "_from": "lodash._root@>=3.0.0 <3.1.0", + "_id": "lodash._root@3.0.1", + "_inCache": true, + "_installable": true, + "_location": "/lodash.without/lodash._basedifference/lodash._root", + "_nodeVersion": "5.5.0", + "_npmOperationalInternal": { + "host": "packages-6-west.internal.npmjs.com", + "tmp": "tmp/lodash._root-3.0.1.tgz_1455615057559_0.24128212919458747" + }, + "_npmUser": { + "email": "john.david.dalton@gmail.com", + "name": "jdalton" + }, + "_npmVersion": "2.14.18", + "_phantomChildren": {}, + "_requested": { + "name": "lodash._root", + "raw": "lodash._root@~3.0.0", + "rawSpec": "~3.0.0", + "scope": null, + "spec": ">=3.0.0 <3.1.0", + "type": "range" + }, + "_requiredBy": [ + "/lodash.without/lodash._basedifference" + ], + "_resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "_shasum": "fba1c4524c19ee9a5f8136b4609f017cf4ded692", + "_shrinkwrap": null, + "_spec": "lodash._root@~3.0.0", + "_where": "/Users/rebecca/code/npm/node_modules/lodash.without/node_modules/lodash._basedifference", + "author": { + "email": "john.david.dalton@gmail.com", + "name": "John-David Dalton", + "url": "http://allyoucanleet.com/" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "contributors": [ + { + "email": "john.david.dalton@gmail.com", + "name": "John-David Dalton", + "url": "http://allyoucanleet.com/" + }, + { + "email": "blaine@iceddev.com", + "name": "Blaine Bublitz", + "url": "https://github.com/phated" + }, + { + "email": "mathias@qiwi.be", + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + } + ], + "dependencies": {}, + "description": "The internal lodash function `root` exported as a module.", + "devDependencies": {}, + "directories": {}, + "dist": { + "shasum": "fba1c4524c19ee9a5f8136b4609f017cf4ded692", + "tarball": "http://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz" + }, + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "maintainers": [ + { + "email": "john.david.dalton@gmail.com", + "name": "jdalton" + }, + { + "email": "mathias@qiwi.be", + "name": "mathias" + }, + { + "email": "blaine.bublitz@gmail.com", + "name": "phated" + } + ], + "name": "lodash._root", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "version": "3.0.1" +} diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/LICENSE b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/LICENSE deleted file mode 100644 index bcbe13d67a..0000000000 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, -DocumentCloud and Investigative Reporters & Editors - -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/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/README.md b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/README.md deleted file mode 100644 index 696e7cd135..0000000000 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# lodash._setcache v4.1.1 - -The internal [lodash](https://lodash.com/) function `SetCache` exported as a [Node.js](https://nodejs.org/) module. - -## Installation - -Using npm: -```bash -$ {sudo -H} npm i -g npm -$ npm i --save lodash._setcache -``` - -In Node.js: -```js -var SetCache = require('lodash._setcache'); -``` - -See the [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash._setcache) for more details. diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/index.js b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/index.js deleted file mode 100644 index dd96de49f1..0000000000 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/index.js +++ /dev/null @@ -1,588 +0,0 @@ -/** - * lodash 4.1.1 (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation - * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ - -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; - -/** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - -/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to detect host constructors (Safari > 5). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** Used to determine if values are of the language type `Object`. */ -var objectTypes = { - 'function': true, - 'object': true -}; - -/** Detect free variable `exports`. */ -var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) - ? exports - : undefined; - -/** Detect free variable `module`. */ -var freeModule = (objectTypes[typeof module] && module && !module.nodeType) - ? module - : undefined; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || - ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || - freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** Used for built-in method references. */ -var arrayProto = Array.prototype, - objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** Built-in value references. */ -var splice = arrayProto.splice; - -/* Built-in method references that are verified to be native. */ -var Map = getNative(root, 'Map'), - nativeCreate = getNative(Object, 'create'); - -/** - * Creates an hash object. - * - * @private - * @constructor - * @returns {Object} Returns the new hash object. - */ -function Hash() {} - -/** - * Removes `key` and its value from the hash. - * - * @private - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function hashDelete(hash, key) { - return hashHas(hash, key) && delete hash[key]; -} - -/** - * Gets the hash value for `key`. - * - * @private - * @param {Object} hash The hash to query. - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function hashGet(hash, key) { - if (nativeCreate) { - var result = hash[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(hash, key) ? hash[key] : undefined; -} - -/** - * Checks if a hash value for `key` exists. - * - * @private - * @param {Object} hash The hash to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function hashHas(hash, key) { - return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key); -} - -/** - * Sets the hash `key` to `value`. - * - * @private - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - */ -function hashSet(hash, key, value) { - hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; -} - -/** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ -function MapCache(values) { - var index = -1, - length = values ? values.length : 0; - - this.clear(); - while (++index < length) { - var entry = values[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ -function mapClear() { - this.__data__ = { - 'hash': new Hash, - 'map': Map ? new Map : [], - 'string': new Hash - }; -} - -/** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function mapDelete(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashDelete(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map['delete'](key) : assocDelete(data.map, key); -} - -/** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function mapGet(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashGet(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.get(key) : assocGet(data.map, key); -} - -/** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function mapHas(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashHas(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.has(key) : assocHas(data.map, key); -} - -/** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache object. - */ -function mapSet(key, value) { - var data = this.__data__; - if (isKeyable(key)) { - hashSet(typeof key == 'string' ? data.string : data.hash, key, value); - } else if (Map) { - data.map.set(key, value); - } else { - assocSet(data.map, key, value); - } - return this; -} - -/** - * - * Creates a set cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ -function SetCache(values) { - var index = -1, - length = values ? values.length : 0; - - this.__data__ = new MapCache; - while (++index < length) { - this.push(values[index]); - } -} - -/** - * Adds `value` to the set cache. - * - * @private - * @name push - * @memberOf SetCache - * @param {*} value The value to cache. - */ -function cachePush(value) { - var map = this.__data__; - if (isKeyable(value)) { - var data = map.__data__, - hash = typeof value == 'string' ? data.string : data.hash; - - hash[value] = HASH_UNDEFINED; - } - else { - map.set(value, HASH_UNDEFINED); - } -} - -/** - * Removes `key` and its value from the associative array. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function assocDelete(array, key) { - var index = assocIndexOf(array, key); - if (index < 0) { - return false; - } - var lastIndex = array.length - 1; - if (index == lastIndex) { - array.pop(); - } else { - splice.call(array, index, 1); - } - return true; -} - -/** - * Gets the associative array value for `key`. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function assocGet(array, key) { - var index = assocIndexOf(array, key); - return index < 0 ? undefined : array[index][1]; -} - -/** - * Checks if an associative array value for `key` exists. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function assocHas(array, key) { - return assocIndexOf(array, key) > -1; -} - -/** - * Gets the index at which the first occurrence of `key` is found in `array` - * of key-value pairs. - * - * @private - * @param {Array} array The array to search. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; -} - -/** - * Sets the associative array `key` to `value`. - * - * @private - * @param {Array} array The array to modify. - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - */ -function assocSet(array, key, value) { - var index = assocIndexOf(array, key); - if (index < 0) { - array.push([key, value]); - } else { - array[index][1] = value; - } -} - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = object[key]; - return isNative(value) ? value : undefined; -} - -/** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ -function isKeyable(value) { - var type = typeof value; - return type == 'number' || type == 'boolean' || - (type == 'string' && value != '__proto__') || value == null; -} - -/** - * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'user': 'fred' }; - * var other = { 'user': 'fred' }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ -function eq(value, other) { - return value === other || (value !== value && other !== other); -} - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Checks if `value` is a native function. - * - * @static - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ -function isNative(value) { - if (value == null) { - return false; - } - if (isFunction(value)) { - return reIsNative.test(funcToString.call(value)); - } - return isObjectLike(value) && - (isHostObject(value) ? reIsNative : reIsHostCtor).test(value); -} - -// Avoid inheriting from `Object.prototype` when possible. -Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; - -// Add functions to the `MapCache`. -MapCache.prototype.clear = mapClear; -MapCache.prototype['delete'] = mapDelete; -MapCache.prototype.get = mapGet; -MapCache.prototype.has = mapHas; -MapCache.prototype.set = mapSet; - -// Add functions to the `SetCache`. -SetCache.prototype.push = cachePush; - -module.exports = SetCache; diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/package.json b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/package.json deleted file mode 100644 index 217a0b8d9b..0000000000 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/node_modules/lodash._setcache/package.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "_args": [ - [ - "lodash._setcache@^4.0.0", - "/Users/rebecca/code/npm/node_modules/lodash.without/node_modules/lodash._basedifference" - ] - ], - "_from": "lodash._setcache@>=4.0.0 <5.0.0", - "_id": "lodash._setcache@4.1.1", - "_inCache": true, - "_installable": true, - "_location": "/lodash.without/lodash._basedifference/lodash._setcache", - "_nodeVersion": "5.5.0", - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash._setcache-4.1.1.tgz_1456896443505_0.39592266851104796" - }, - "_npmUser": { - "email": "john.david.dalton@gmail.com", - "name": "jdalton" - }, - "_npmVersion": "2.14.17", - "_phantomChildren": {}, - "_requested": { - "name": "lodash._setcache", - "raw": "lodash._setcache@^4.0.0", - "rawSpec": "^4.0.0", - "scope": null, - "spec": ">=4.0.0 <5.0.0", - "type": "range" - }, - "_requiredBy": [ - "/lodash.without/lodash._basedifference" - ], - "_resolved": "https://registry.npmjs.org/lodash._setcache/-/lodash._setcache-4.1.1.tgz", - "_shasum": "338f47e49f21ba8bb89e621e7815d781bd4dbd97", - "_shrinkwrap": null, - "_spec": "lodash._setcache@^4.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/lodash.without/node_modules/lodash._basedifference", - "author": { - "email": "john.david.dalton@gmail.com", - "name": "John-David Dalton", - "url": "http://allyoucanleet.com/" - }, - "bugs": { - "url": "https://github.com/lodash/lodash/issues" - }, - "contributors": [ - { - "email": "john.david.dalton@gmail.com", - "name": "John-David Dalton", - "url": "http://allyoucanleet.com/" - }, - { - "email": "blaine.bublitz@gmail.com", - "name": "Blaine Bublitz", - "url": "https://github.com/phated" - }, - { - "email": "mathias@qiwi.be", - "name": "Mathias Bynens", - "url": "https://mathiasbynens.be/" - } - ], - "dependencies": {}, - "description": "The internal lodash function `SetCache` exported as a module.", - "devDependencies": {}, - "directories": {}, - "dist": { - "shasum": "338f47e49f21ba8bb89e621e7815d781bd4dbd97", - "tarball": "http://registry.npmjs.org/lodash._setcache/-/lodash._setcache-4.1.1.tgz" - }, - "homepage": "https://lodash.com/", - "icon": "https://lodash.com/icon.svg", - "license": "MIT", - "maintainers": [ - { - "email": "john.david.dalton@gmail.com", - "name": "jdalton" - }, - { - "email": "mathias@qiwi.be", - "name": "mathias" - }, - { - "email": "blaine.bublitz@gmail.com", - "name": "phated" - } - ], - "name": "lodash._setcache", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/lodash/lodash.git" - }, - "scripts": { - "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" - }, - "version": "4.1.1" -} diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/package.json b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/package.json index 5442d0abf9..59b0190020 100644 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/package.json +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash._basedifference/package.json @@ -1,42 +1,42 @@ { "_args": [ [ - "lodash._basedifference@~4.4.0", - "/Users/zkat/Documents/code/npm/node_modules/lodash.without" + "lodash._basedifference@~4.5.0", + "/Users/rebecca/code/npm/node_modules/lodash.without" ] ], - "_from": "lodash._basedifference@>=4.4.0 <4.5.0", - "_id": "lodash._basedifference@4.4.1", + "_from": "lodash._basedifference@>=4.5.0 <4.6.0", + "_id": "lodash._basedifference@4.5.0", "_inCache": true, "_installable": true, "_location": "/lodash.without/lodash._basedifference", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash._basedifference-4.4.1.tgz_1459310599651_0.6456912821158767" + "tmp": "tmp/lodash._basedifference-4.5.0.tgz_1463061998825_0.9310404139105231" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.15.1", + "_npmVersion": "2.15.5", "_phantomChildren": {}, "_requested": { "name": "lodash._basedifference", - "raw": "lodash._basedifference@~4.4.0", - "rawSpec": "~4.4.0", + "raw": "lodash._basedifference@~4.5.0", + "rawSpec": "~4.5.0", "scope": null, - "spec": ">=4.4.0 <4.5.0", + "spec": ">=4.5.0 <4.6.0", "type": "range" }, "_requiredBy": [ "/lodash.without" ], - "_resolved": "https://registry.npmjs.org/lodash._basedifference/-/lodash._basedifference-4.4.1.tgz", - "_shasum": "537bde6fd0f3eeec28e37288dd51459765181b4d", + "_resolved": "https://registry.npmjs.org/lodash._basedifference/-/lodash._basedifference-4.5.0.tgz", + "_shasum": "56ea7d601367bfa46cd7de115dc3daeb18837938", "_shrinkwrap": null, - "_spec": "lodash._basedifference@~4.4.0", - "_where": "/Users/zkat/Documents/code/npm/node_modules/lodash.without", + "_spec": "lodash._basedifference@~4.5.0", + "_where": "/Users/rebecca/code/npm/node_modules/lodash.without", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -63,14 +63,14 @@ } ], "dependencies": { - "lodash._setcache": "~4.1.0" + "lodash._root": "~3.0.0" }, "description": "The internal lodash function `baseDifference` exported as a module.", "devDependencies": {}, "directories": {}, "dist": { - "shasum": "537bde6fd0f3eeec28e37288dd51459765181b4d", - "tarball": "https://registry.npmjs.org/lodash._basedifference/-/lodash._basedifference-4.4.1.tgz" + "shasum": "56ea7d601367bfa46cd7de115dc3daeb18837938", + "tarball": "https://registry.npmjs.org/lodash._basedifference/-/lodash._basedifference-4.5.0.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -99,5 +99,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.4.1" + "version": "4.5.0" } diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/LICENSE b/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/LICENSE index b054ca5a3a..e0c69d5603 100644 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/LICENSE +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/LICENSE @@ -1,7 +1,17 @@ -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Copyright jQuery Foundation and other contributors + +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + 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 @@ -20,3 +30,18 @@ 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. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/README.md b/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/README.md index 8924e9d7f4..5342ca4452 100644 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/README.md +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/README.md @@ -1,4 +1,4 @@ -# lodash.rest v4.0.1 +# lodash.rest v4.0.3 The [lodash](https://lodash.com/) method `_.rest` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var rest = require('lodash.rest'); ``` -See the [documentation](https://lodash.com/docs#rest) or [package source](https://github.com/lodash/lodash/blob/4.0.1-npm-packages/lodash.rest) for more details. +See the [documentation](https://lodash.com/docs#rest) or [package source](https://github.com/lodash/lodash/blob/4.0.3-npm-packages/lodash.rest) for more details. diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/index.js b/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/index.js index 289de31723..2315786410 100644 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/index.js +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.0.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as the `TypeError` message for "Functions" methods. */ @@ -17,7 +17,8 @@ var INFINITY = 1 / 0, /** `Object#toString` result references. */ var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g; @@ -41,7 +42,7 @@ var freeParseInt = parseInt; * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. - * @param {...*} args The arguments to invoke `func` with. + * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { @@ -59,7 +60,8 @@ function apply(func, thisArg, args) { var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -69,12 +71,15 @@ var nativeMax = Math.max; /** * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as an array. + * created function and arguments from `start` and beyond provided as + * an array. * - * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters). + * **Note:** This method is based on the + * [rest parameter](https://mdn.io/rest_parameters). * * @static * @memberOf _ + * @since 4.0.0 * @category Function * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. @@ -123,9 +128,11 @@ function rest(func, start) { * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isFunction(_); @@ -136,18 +143,20 @@ function rest(func, start) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. @@ -171,30 +180,80 @@ function isObject(value) { } /** - * Converts `value` to an integer. + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true * - * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 * @category Lang * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. + * @returns {number} Returns the converted number. * @example * - * _.toInteger(3); - * // => 3 + * _.toFinite(3.2); + * // => 3.2 * - * _.toInteger(Number.MIN_VALUE); - * // => 0 + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 * - * _.toInteger(Infinity); + * _.toFinite(Infinity); * // => 1.7976931348623157e+308 * - * _.toInteger('3'); - * // => 3 + * _.toFinite('3.2'); + * // => 3.2 */ -function toInteger(value) { +function toFinite(value) { if (!value) { return value === 0 ? value : 0; } @@ -203,8 +262,40 @@ function toInteger(value) { var sign = (value < 0 ? -1 : 1); return sign * MAX_INTEGER; } - var remainder = value % 1; - return value === value ? (remainder ? value - remainder : value) : 0; + return value === value ? value : 0; +} + +/** + * Converts `value` to an integer. + * + * **Note:** This function is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ +function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; } /** @@ -212,13 +303,14 @@ function toInteger(value) { * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * - * _.toNumber(3); - * // => 3 + * _.toNumber(3.2); + * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 @@ -226,10 +318,16 @@ function toInteger(value) { * _.toNumber(Infinity); * // => Infinity * - * _.toNumber('3'); - * // => 3 + * _.toNumber('3.2'); + * // => 3.2 */ function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } if (isObject(value)) { var other = isFunction(value.valueOf) ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; diff --git a/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/package.json b/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/package.json index f368b23412..3564a655cb 100644 --- a/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/package.json +++ b/deps/npm/node_modules/lodash.without/node_modules/lodash.rest/package.json @@ -6,20 +6,20 @@ ] ], "_from": "lodash.rest@>=4.0.0 <5.0.0", - "_id": "lodash.rest@4.0.1", + "_id": "lodash.rest@4.0.3", "_inCache": true, "_installable": true, "_location": "/lodash.without/lodash.rest", - "_nodeVersion": "5.4.0", + "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-5-east.internal.npmjs.com", - "tmp": "tmp/lodash.rest-4.0.1.tgz_1454484670768_0.6682933256961405" + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/lodash.rest-4.0.3.tgz_1463062507321_0.6458017621189356" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.14.15", + "_npmVersion": "2.15.5", "_phantomChildren": {}, "_requested": { "name": "lodash.rest", @@ -32,8 +32,8 @@ "_requiredBy": [ "/lodash.without" ], - "_resolved": "https://registry.npmjs.org/lodash.rest/-/lodash.rest-4.0.1.tgz", - "_shasum": "cbecbb84e68e499a1b242baf9b27bb63ef4dd980", + "_resolved": "https://registry.npmjs.org/lodash.rest/-/lodash.rest-4.0.3.tgz", + "_shasum": "4c1c32c40028087250fabf70d42e0151548f48c5", "_shrinkwrap": null, "_spec": "lodash.rest@^4.0.0", "_where": "/Users/rebecca/code/npm/node_modules/lodash.without", @@ -47,18 +47,18 @@ }, "contributors": [ { - "name": "John-David Dalton", "email": "john.david.dalton@gmail.com", + "name": "John-David Dalton", "url": "http://allyoucanleet.com/" }, { + "email": "blaine.bublitz@gmail.com", "name": "Blaine Bublitz", - "email": "blaine@iceddev.com", "url": "https://github.com/phated" }, { - "name": "Mathias Bynens", "email": "mathias@qiwi.be", + "name": "Mathias Bynens", "url": "https://mathiasbynens.be/" } ], @@ -67,8 +67,8 @@ "devDependencies": {}, "directories": {}, "dist": { - "shasum": "cbecbb84e68e499a1b242baf9b27bb63ef4dd980", - "tarball": "http://registry.npmjs.org/lodash.rest/-/lodash.rest-4.0.1.tgz" + "shasum": "4c1c32c40028087250fabf70d42e0151548f48c5", + "tarball": "https://registry.npmjs.org/lodash.rest/-/lodash.rest-4.0.3.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -79,16 +79,16 @@ "license": "MIT", "maintainers": [ { - "name": "jdalton", - "email": "john.david.dalton@gmail.com" + "email": "john.david.dalton@gmail.com", + "name": "jdalton" }, { - "name": "mathias", - "email": "mathias@qiwi.be" + "email": "mathias@qiwi.be", + "name": "mathias" }, { - "name": "phated", - "email": "blaine@iceddev.com" + "email": "blaine@iceddev.com", + "name": "phated" } ], "name": "lodash.rest", @@ -101,5 +101,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.0.1" + "version": "4.0.3" } diff --git a/deps/npm/node_modules/lodash.without/package.json b/deps/npm/node_modules/lodash.without/package.json index ac1b49c274..0aac3a5cb6 100644 --- a/deps/npm/node_modules/lodash.without/package.json +++ b/deps/npm/node_modules/lodash.without/package.json @@ -1,42 +1,42 @@ { "_args": [ [ - "lodash.without@4.1.2", - "/Users/zkat/Documents/code/npm" + "lodash.without@latest", + "/Users/rebecca/code/npm" ] ], - "_from": "lodash.without@4.1.2", - "_id": "lodash.without@4.1.2", + "_from": "lodash.without@latest", + "_id": "lodash.without@4.2.0", "_inCache": true, "_installable": true, "_location": "/lodash.without", "_nodeVersion": "5.5.0", "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/lodash.without-4.1.2.tgz_1459311008459_0.16177126462571323" + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/lodash.without-4.2.0.tgz_1463062688060_0.9002856267616153" }, "_npmUser": { "email": "john.david.dalton@gmail.com", "name": "jdalton" }, - "_npmVersion": "2.15.1", + "_npmVersion": "2.15.5", "_phantomChildren": {}, "_requested": { "name": "lodash.without", - "raw": "lodash.without@4.1.2", - "rawSpec": "4.1.2", + "raw": "lodash.without@latest", + "rawSpec": "latest", "scope": null, - "spec": "4.1.2", - "type": "version" + "spec": "latest", + "type": "tag" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.1.2.tgz", - "_shasum": "c68b1981e1b001bd87eef7487dba0af267846229", + "_resolved": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.2.0.tgz", + "_shasum": "f89ec9a8ee2d7ec14f8a9cad72a3f5ee12c5a4a6", "_shrinkwrap": null, - "_spec": "lodash.without@4.1.2", - "_where": "/Users/zkat/Documents/code/npm", + "_spec": "lodash.without@latest", + "_where": "/Users/rebecca/code/npm", "author": { "email": "john.david.dalton@gmail.com", "name": "John-David Dalton", @@ -63,15 +63,15 @@ } ], "dependencies": { - "lodash._basedifference": "~4.4.0", + "lodash._basedifference": "~4.5.0", "lodash.rest": "^4.0.0" }, "description": "The lodash method `_.without` exported as a module.", "devDependencies": {}, "directories": {}, "dist": { - "shasum": "c68b1981e1b001bd87eef7487dba0af267846229", - "tarball": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.1.2.tgz" + "shasum": "f89ec9a8ee2d7ec14f8a9cad72a3f5ee12c5a4a6", + "tarball": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.2.0.tgz" }, "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -104,5 +104,5 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "version": "4.1.2" + "version": "4.2.0" } diff --git a/deps/npm/node_modules/npm-package-arg/package.json b/deps/npm/node_modules/npm-package-arg/package.json index 4d544a7939..1044852bcd 100644 --- a/deps/npm/node_modules/npm-package-arg/package.json +++ b/deps/npm/node_modules/npm-package-arg/package.json @@ -1,8 +1,8 @@ { "_args": [ [ - "npm-package-arg@~4.1.0", - "/Users/rebecca/code/npm" + "npm-package-arg@4.1.1", + "/Users/zkat/Documents/code/npm" ] ], "_from": "npm-package-arg@>=4.1.0 <4.2.0", @@ -23,11 +23,11 @@ "_phantomChildren": {}, "_requested": { "name": "npm-package-arg", - "raw": "npm-package-arg@~4.1.0", - "rawSpec": "~4.1.0", + "raw": "npm-package-arg@4.1.1", + "rawSpec": "4.1.1", "scope": null, - "spec": ">=4.1.0 <4.2.0", - "type": "range" + "spec": "4.1.1", + "type": "version" }, "_requiredBy": [ "/", @@ -38,8 +38,8 @@ "_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-4.1.1.tgz", "_shasum": "86d9dca985b4c5e5d59772dfd5de6919998a495a", "_shrinkwrap": null, - "_spec": "npm-package-arg@~4.1.0", - "_where": "/Users/rebecca/code/npm", + "_spec": "npm-package-arg@4.1.1", + "_where": "/Users/zkat/Documents/code/npm", "author": { "email": "i@izs.me", "name": "Isaac Z. Schlueter", diff --git a/deps/npm/node_modules/read-package-tree/package.json b/deps/npm/node_modules/read-package-tree/package.json index 4691dae1d2..d1acb0ef06 100644 --- a/deps/npm/node_modules/read-package-tree/package.json +++ b/deps/npm/node_modules/read-package-tree/package.json @@ -1,10 +1,56 @@ { - "name": "read-package-tree", - "version": "5.1.2", - "description": "Read the contents of node_modules.", - "main": "rpt.js", - "directories": { - "test": "test" + "_args": [ + [ + { + "name": "read-package-tree", + "raw": "read-package-tree@~5.1.3", + "rawSpec": "~5.1.3", + "scope": null, + "spec": ">=5.1.3 <5.2.0", + "type": "range" + }, + "/Users/rebecca/code/npm" + ] + ], + "_from": "read-package-tree@>=5.1.3 <5.2.0", + "_id": "read-package-tree@5.1.4", + "_inCache": true, + "_installable": true, + "_location": "/read-package-tree", + "_nodeVersion": "4.4.0", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/read-package-tree-5.1.4.tgz_1463682709793_0.6651253618765622" + }, + "_npmUser": { + "email": "me@re-becca.org", + "name": "iarna" + }, + "_npmVersion": "3.9.2", + "_phantomChildren": {}, + "_requested": { + "name": "read-package-tree", + "raw": "read-package-tree@~5.1.3", + "rawSpec": "~5.1.3", + "scope": null, + "spec": ">=5.1.3 <5.2.0", + "type": "range" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/read-package-tree/-/read-package-tree-5.1.4.tgz", + "_shasum": "bb6e465f913d4259a9534c87b1d5c508fe8eb078", + "_shrinkwrap": null, + "_spec": "read-package-tree@~5.1.3", + "_where": "/Users/rebecca/code/npm", + "author": { + "email": "i@izs.me", + "name": "Isaac Z. Schlueter", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/npm/read-package-tree/issues" }, "dependencies": { "debuglog": "^1.0.1", @@ -13,50 +59,42 @@ "read-package-json": "^2.0.0", "readdir-scoped-modules": "^1.0.0" }, + "description": "Read the contents of node_modules.", "devDependencies": { "archy": "0", + "tacks": "^1.2.1", "tap": "^1.2.0" }, - "scripts": { - "test": "tap test/*.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/npm/read-package-tree.git" - }, - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "ISC", - "bugs": { - "url": "https://github.com/npm/read-package-tree/issues" - }, - "homepage": "https://github.com/npm/read-package-tree", - "gitHead": "2ed40c4654804f2a5ddb7b0b2c509080731eea6b", - "_id": "read-package-tree@5.1.2", - "_shasum": "e3a488792f40cf470819f01a610e719d64f09094", - "_from": "read-package-tree@>=5.1.2 <5.2.0", - "_npmVersion": "2.13.3", - "_nodeVersion": "0.12.7", - "_npmUser": { - "name": "iarna", - "email": "me@re-becca.org" + "directories": { + "test": "test" }, "dist": { - "shasum": "e3a488792f40cf470819f01a610e719d64f09094", - "tarball": "http://registry.npmjs.org/read-package-tree/-/read-package-tree-5.1.2.tgz" + "shasum": "bb6e465f913d4259a9534c87b1d5c508fe8eb078", + "tarball": "https://registry.npmjs.org/read-package-tree/-/read-package-tree-5.1.4.tgz" }, + "gitHead": "eb24d2508da745233af93769596ff1d963f801be", + "homepage": "https://github.com/npm/read-package-tree", + "license": "ISC", + "main": "rpt.js", "maintainers": [ { - "name": "isaacs", - "email": "i@izs.me" + "email": "i@izs.me", + "name": "isaacs" }, { - "name": "iarna", - "email": "me@re-becca.org" + "email": "me@re-becca.org", + "name": "iarna" } ], - "_resolved": "https://registry.npmjs.org/read-package-tree/-/read-package-tree-5.1.2.tgz" + "name": "read-package-tree", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/read-package-tree.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "5.1.4" } diff --git a/deps/npm/node_modules/read-package-tree/rpt.js b/deps/npm/node_modules/read-package-tree/rpt.js index acd91bd8c0..5229897632 100644 --- a/deps/npm/node_modules/read-package-tree/rpt.js +++ b/deps/npm/node_modules/read-package-tree/rpt.js @@ -6,6 +6,23 @@ var once = require('once') var readdir = require('readdir-scoped-modules') var debug = require('debuglog')('rpt') +function asyncForEach (items, todo, done) { + var remaining = items.length + if (remaining === 0) return done() + var seenErr + items.forEach(function (item) { + todo(item, handleComplete) + }) + function handleComplete (err) { + if (seenErr) return + if (err) { + seenErr = true + return done(err) + } + if (--remaining === 0) done() + } +} + function dpath (p) { if (!p) return '' if (p.indexOf(process.cwd()) === 0) { @@ -77,30 +94,47 @@ Link.prototype.realpath = '' function loadNode (logical, physical, cache, cb) { debug('loadNode', dpath(logical)) - fs.realpath(physical, function (er, real) { + return fs.realpath(physical, thenReadPackageJson) + + var realpath + function thenReadPackageJson (er, real) { if (er) return cb(er) debug('realpath l=%j p=%j real=%j', dpath(logical), dpath(physical), dpath(real)) - var pj = path.resolve(real, 'package.json') - rpj(pj, function (er, pkg) { - pkg = pkg || null - var node - if (physical === real) { - node = new Node(pkg, logical, physical, er, cache) - } else { - node = new Link(pkg, logical, physical, real, er, cache) - } - - cb(null, node) - }) - }) + var pj = path.join(real, 'package.json') + realpath = real + return rpj(pj, thenCreateNode) + } + function thenCreateNode (er, pkg) { + pkg = pkg || null + var node + if (physical === realpath) { + node = new Node(pkg, logical, physical, er, cache) + } else { + node = new Link(pkg, logical, physical, realpath, er, cache) + } + + cb(null, node) + } } function loadChildren (node, cache, filterWith, cb) { debug('loadChildren', dpath(node.path)) - // don't let it be called more than once + // needed 'cause we process all kids async-like and errors + // short circuit, so we have to be sure that after an error + // the cbs from other kids don't result in calling cb a second + // (or more) time. cb = once(cb) - var nm = path.resolve(node.path, 'node_modules') - readdir(nm, function (er, kids) { + var nm = path.join(node.path, 'node_modules') + var rm + return fs.realpath(path.join(node.path, 'node_modules'), thenReaddir) + + function thenReaddir (er, real_nm) { + if (er) return cb(null, node) + rm = real_nm + readdir(nm, thenLoadKids) + } + + function thenLoadKids (er, kids) { // If there are no children, that's fine, just return if (er) return cb(null, node) @@ -108,26 +142,25 @@ function loadChildren (node, cache, filterWith, cb) { return kid[0] !== '.' && (!filterWith || filterWith(node, kid)) }) - var l = kids . length - if (l === 0) return cb(null, node) - - kids.forEach(function (kid) { - var kidPath = path.resolve(nm, kid) - var kidRealPath = path.resolve(node.realpath,'node_modules',kid) - loadNode(kidPath, kidRealPath, cache, then) - }) - - function then (er, kid) { - if (er) return cb(er) - + asyncForEach(kids, thenLoadNode, thenSortChildren) + } + function thenLoadNode (kid, done) { + var kidPath = path.join(nm, kid) + var kidRealPath = path.join(rm, kid) + loadNode(kidPath, kidRealPath, cache, andAddNode(done)) + } + function andAddNode (done) { + return function (er, kid) { + if (er) return done(er) node.children.push(kid) kid.parent = node - if (--l === 0) { - sortChildren(node) - return cb(null, node) - } + done() } - }) + } + function thenSortChildren (er) { + sortChildren(node) + cb(er, node) + } } function sortChildren (node) { @@ -147,27 +180,25 @@ function loadTree (node, did, cache, filterWith, cb) { did[node.realpath] = true + // needed 'cause we process all kids async-like and errors + // short circuit, so we have to be sure that after an error + // the cbs from other kids don't result in calling cb a second + // (or more) time. cb = once(cb) - loadChildren(node, cache, filterWith, function (er, node) { + return loadChildren(node, cache, filterWith, thenProcessChildren) + + function thenProcessChildren (er, node) { if (er) return cb(er) var kids = node.children.filter(function (kid) { return !did[kid.realpath] }) - var l = kids.length - if (l === 0) return cb(null, node) - - kids.forEach(function (kid, index) { - loadTree(kid, did, cache, filterWith, then) - }) - - function then (er, kid) { - if (er) return cb(er) - - if (--l === 0) cb(null, node) - } - }) + return asyncForEach(kids, loadTreeForKid, cb) + } + function loadTreeForKid (kid, done) { + loadTree(kid, did, cache, filterWith, done) + } } function rpt (root, filterWith, cb) { @@ -175,16 +206,27 @@ function rpt (root, filterWith, cb) { cb = filterWith filterWith = null } - fs.realpath(root, function (er, realRoot) { + var cache = Object.create(null) + var topErr + var tree + return fs.realpath(root, thenLoadNode) + + function thenLoadNode (er, realRoot) { if (er) return cb(er) debug('rpt', dpath(realRoot)) - var cache = Object.create(null) - loadNode(root, realRoot, cache, function (er, node) { - // if there's an error, it's fine, as long as we got a node - if (!node) return cb(er) - loadTree(node, {}, cache, filterWith, function (lter, tree) { - cb(er && er.code !== 'ENOENT' ? er : lter, tree) - }) - }) - }) + loadNode(root, realRoot, cache, thenLoadTree) + } + function thenLoadTree(er, node) { + // even if there's an error, it's fine, as long as we got a node + if (node) { + topErr = er + tree = node + loadTree(node, {}, cache, filterWith, thenHandleErrors) + } else { + cb(er) + } + } + function thenHandleErrors (er) { + cb(topErr && topErr.code !== 'ENOENT' ? topErr : er, tree) + } } diff --git a/deps/npm/node_modules/read-package-tree/test/symlinked-node-modules.js b/deps/npm/node_modules/read-package-tree/test/symlinked-node-modules.js new file mode 100644 index 0000000000..31149240bd --- /dev/null +++ b/deps/npm/node_modules/read-package-tree/test/symlinked-node-modules.js @@ -0,0 +1,70 @@ +'use strict' +var path = require('path') +var test = require('tap').test +var rpt = require('../rpt.js') +var Tacks = require('tacks') +var File = Tacks.File +var Symlink = Tacks.Symlink +var Dir = Tacks.Dir + +var workdir = path.join(__dirname, path.basename(__filename, '.js')) +var fixture = new Tacks(Dir({ + bar: Dir({ + 'package.json': File({ + name: 'bar', + version: '1.0.0' + }) + }), + 'linked-node-modules': Dir({ + bar: Symlink('../bar'), + foo: Dir({ + 'package.json': File({ + name: 'foo', + version: '1.0.0' + }) + }) + }), + example: Dir({ + node_modules: Symlink('../linked-node-modules/'), + 'package.json': File({ + name: 'example', + version: '1.0.0', + }) + }) +})) + +function setup () { + cleanup() + fixture.create(workdir) +} + +function cleanup () { + fixture.remove(workdir) +} + +test('setup', function (t) { + setup() + t.done() +}) +test('symlinked-node-modules', function (t) { + rpt(path.join(workdir, 'example'), function (err, tree) { + t.ifError(err) + t.is(tree.children.length, 2) + var childrenShouldBe = { + 'foo': {isLink: false}, + 'bar': {isLink: true} + } + tree.children.forEach(function (child) { + var name = child.package.name + t.is(child.isLink, childrenShouldBe[name].isLink, + 'is' + (childrenShouldBe[name].isLink ? '' : 'Not') + 'Link ' + + path.relative(workdir, child.path) + " + " + + path.relative(workdir, child.realpath)) + }) + t.done() + }) +}) +test('cleanup', function (t) { + cleanup() + t.done() +}) \ No newline at end of file diff --git a/deps/npm/node_modules/readable-stream/README.md b/deps/npm/node_modules/readable-stream/README.md index c4e4a34a7a..ae9e3363c8 100644 --- a/deps/npm/node_modules/readable-stream/README.md +++ b/deps/npm/node_modules/readable-stream/README.md @@ -1,6 +1,6 @@ # readable-stream -***Node-core v5.9.1 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream) +***Node-core v6.1.0 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream) [![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) @@ -16,7 +16,7 @@ npm install --save readable-stream ***Node-core streams for userland*** This package is a mirror of the Streams2 and Streams3 implementations in -Node-core, including [documentation](doc/stream.markdown). +Node-core, including [documentation](doc/stream.md). If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html). diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/base.css b/deps/npm/node_modules/readable-stream/coverage/lcov-report/base.css new file mode 100644 index 0000000000..417c7adc95 --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov-report/base.css @@ -0,0 +1,212 @@ +body, html { + margin:0; padding: 0; + height: 100%; +} +body { + font-family: Helvetica Neue, Helvetica, Arial; + font-size: 14px; + color:#333; +} +.small { font-size: 12px; } +*, *:after, *:before { + -webkit-box-sizing:border-box; + -moz-box-sizing:border-box; + box-sizing:border-box; + } +h1 { font-size: 20px; margin: 0;} +h2 { font-size: 14px; } +pre { + font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; + margin: 0; + padding: 0; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; +} +a { color:#0074D9; text-decoration:none; } +a:hover { text-decoration:underline; } +.strong { font-weight: bold; } +.space-top1 { padding: 10px 0 0 0; } +.pad2y { padding: 20px 0; } +.pad1y { padding: 10px 0; } +.pad2x { padding: 0 20px; } +.pad2 { padding: 20px; } +.pad1 { padding: 10px; } +.space-left2 { padding-left:55px; } +.space-right2 { padding-right:20px; } +.center { text-align:center; } +.clearfix { display:block; } +.clearfix:after { + content:''; + display:block; + height:0; + clear:both; + visibility:hidden; + } +.fl { float: left; } +@media only screen and (max-width:640px) { + .col3 { width:100%; max-width:100%; } + .hide-mobile { display:none!important; } +} + +.quiet { + color: #7f7f7f; + color: rgba(0,0,0,0.5); +} +.quiet a { opacity: 0.7; } + +.fraction { + font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; + font-size: 10px; + color: #555; + background: #E8E8E8; + padding: 4px 5px; + border-radius: 3px; + vertical-align: middle; +} + +div.path a:link, div.path a:visited { color: #333; } +table.coverage { + border-collapse: collapse; + margin: 10px 0 0 0; + padding: 0; +} + +table.coverage td { + margin: 0; + padding: 0; + vertical-align: top; +} +table.coverage td.line-count { + text-align: right; + padding: 0 5px 0 20px; +} +table.coverage td.line-coverage { + text-align: right; + padding-right: 10px; + min-width:20px; +} + +table.coverage td span.cline-any { + display: inline-block; + padding: 0 5px; + width: 100%; +} +.missing-if-branch { + display: inline-block; + margin-right: 5px; + border-radius: 3px; + position: relative; + padding: 0 4px; + background: #333; + color: yellow; +} + +.skip-if-branch { + display: none; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: #ccc; + color: white; +} +.missing-if-branch .typ, .skip-if-branch .typ { + color: inherit !important; +} +.coverage-summary { + border-collapse: collapse; + width: 100%; +} +.coverage-summary tr { border-bottom: 1px solid #bbb; } +.keyline-all { border: 1px solid #ddd; } +.coverage-summary td, .coverage-summary th { padding: 10px; } +.coverage-summary tbody { border: 1px solid #bbb; } +.coverage-summary td { border-right: 1px solid #bbb; } +.coverage-summary td:last-child { border-right: none; } +.coverage-summary th { + text-align: left; + font-weight: normal; + white-space: nowrap; +} +.coverage-summary th.file { border-right: none !important; } +.coverage-summary th.pct { } +.coverage-summary th.pic, +.coverage-summary th.abs, +.coverage-summary td.pct, +.coverage-summary td.abs { text-align: right; } +.coverage-summary td.file { white-space: nowrap; } +.coverage-summary td.pic { min-width: 120px !important; } +.coverage-summary tfoot td { } + +.coverage-summary .sorter { + height: 10px; + width: 7px; + display: inline-block; + margin-left: 0.5em; + background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; +} +.coverage-summary .sorted .sorter { + background-position: 0 -20px; +} +.coverage-summary .sorted-desc .sorter { + background-position: 0 -10px; +} +.status-line { height: 10px; } +/* dark red */ +.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } +.low .chart { border:1px solid #C21F39 } +/* medium red */ +.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } +/* light red */ +.low, .cline-no { background:#FCE1E5 } +/* light green */ +.high, .cline-yes { background:rgb(230,245,208) } +/* medium green */ +.cstat-yes { background:rgb(161,215,106) } +/* dark green */ +.status-line.high, .high .cover-fill { background:rgb(77,146,33) } +.high .chart { border:1px solid rgb(77,146,33) } + + +.medium .chart { border:1px solid #666; } +.medium .cover-fill { background: #666; } + +.cbranch-no { background: yellow !important; color: #111; } + +.cstat-skip { background: #ddd; color: #111; } +.fstat-skip { background: #ddd; color: #111 !important; } +.cbranch-skip { background: #ddd !important; color: #111; } + +span.cline-neutral { background: #eaeaea; } +.medium { background: #eaeaea; } + +.cover-fill, .cover-empty { + display:inline-block; + height: 12px; +} +.chart { + line-height: 0; +} +.cover-empty { + background: white; +} +.cover-full { + border-right: none !important; +} +pre.prettyprint { + border: none !important; + padding: 0 !important; + margin: 0 !important; +} +.com { color: #999 !important; } +.ignore-none { color: #999; font-weight: normal; } + +.wrapper { + min-height: 100%; + height: auto !important; + height: 100%; + margin: 0 auto -48px; +} +.footer, .push { + height: 48px; +} diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/index.html b/deps/npm/node_modules/readable-stream/coverage/lcov-report/index.html new file mode 100644 index 0000000000..a812194c17 --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov-report/index.html @@ -0,0 +1,93 @@ + + + + Code coverage report for All files + + + + + + + +
    +
    +

    + / +

    +
    +
    + 90.63% + Statements + 851/939 +
    +
    + 87.94% + Branches + 496/564 +
    +
    + 86.54% + Functions + 90/104 +
    +
    + 92.73% + Lines + 765/825 +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FileStatementsBranchesFunctionsLines
    lib/
    90.63%851/93987.94%496/56486.54%90/10492.73%765/825
    +
    +
    + + + + + + + diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_duplex.js.html b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_duplex.js.html new file mode 100644 index 0000000000..a3f1208b41 --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_duplex.js.html @@ -0,0 +1,287 @@ + + + + Code coverage report for lib/_stream_duplex.js + + + + + + + +
    +
    +

    + all files / lib/ _stream_duplex.js +

    +
    +
    + 69.23% + Statements + 27/39 +
    +
    + 68.18% + Branches + 15/22 +
    +
    + 40% + Functions + 2/5 +
    +
    + 75.76% + Lines + 25/33 +
    +
    +
    +
    +
    
    +
    +
    1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75  +  +  +  +  +  +  +  +  +49× +  +  +  +  +  +  +  +49× +  +  +49× +  +  +  +49× +49× +  +  +49× +49× +  +49× +  +49× +49× +392× +392× +  +  +49× +25× +  +25× +25× +  +25× +  +25× +  +25× +25× +  +25× +  +  +  +49× +  +  +18× +  +  +  +  +  +  +49× +  +  +  +49× +  +  +  + 
    // a duplex stream is just a stream that is both readable and writable.
    +// Since JS doesn't have multiple prototypal inheritance, this class
    +// prototypally inherits from Readable, and then parasitically from
    +// Writable.
    + 
    +'use strict';
    + 
    +/*<replacement>*/
    + 
    +var objectKeys = Object.keys || function (obj) {
    +  var keys = [];
    +  for (var key in obj) {
    +    keys.push(key);
    +  }return keys;
    +};
    +/*</replacement>*/
    + 
    +module.exports = Duplex;
    + 
    +/*<replacement>*/
    +var processNextTick = require('process-nextick-args');
    +/*</replacement>*/
    + 
    +/*<replacement>*/
    +var util = require('core-util-is');
    +util.inherits = require('inherits');
    +/*</replacement>*/
    + 
    +var Readable = require('./_stream_readable');
    +var Writable = require('./_stream_writable');
    + 
    +util.inherits(Duplex, Readable);
    + 
    +var keys = objectKeys(Writable.prototype);
    +for (var v = 0; v < keys.length; v++) {
    +  var method = keys[v];
    +  if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
    +}
    + 
    +function Duplex(options) {
    +  Iif (!(this instanceof Duplex)) return new Duplex(options);
    + 
    +  Readable.call(this, options);
    +  Writable.call(this, options);
    + 
    +  Iif (options && options.readable === false) this.readable = false;
    + 
    +  Iif (options && options.writable === false) this.writable = false;
    + 
    +  this.allowHalfOpen = true;
    +  Iif (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
    + 
    +  this.once('end', onend);
    +}
    + 
    +// the no-half-open enforcer
    +function onend() {
    +  // if we allow half-open state, or if the writable side ended,
    +  // then we're ok.
    +  Eif (this.allowHalfOpen || this._writableState.ended) return;
    + 
    +  // no more data can be written.
    +  // But allow more writes to happen in this tick.
    +  processNextTick(onEndNT, this);
    +}
    + 
    +function onEndNT(self) {
    +  self.end();
    +}
    + 
    +function forEach(xs, f) {
    +  for (var i = 0, l = xs.length; i < l; i++) {
    +    f(xs[i], i);
    +  }
    +}
    +
    +
    + + + + + + + diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_passthrough.js.html b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_passthrough.js.html new file mode 100644 index 0000000000..3ca02ae767 --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_passthrough.js.html @@ -0,0 +1,140 @@ + + + + Code coverage report for lib/_stream_passthrough.js + + + + + + + +
    +
    +

    + all files / lib/ _stream_passthrough.js +

    +
    +
    + 90.91% + Statements + 10/11 +
    +
    + 50% + Branches + 1/2 +
    +
    + 100% + Functions + 2/2 +
    +
    + 100% + Lines + 10/10 +
    +
    +
    +
    +
    
    +
    +
    1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26  +  +  +  +  +  +49× +  +49× +  +  +49× +49× +  +  +49× +  +49× + +  + +  +  +49× +59× + 
    // a passthrough stream.
    +// basically just the most minimal sort of Transform stream.
    +// Every written chunk gets output as-is.
    + 
    +'use strict';
    + 
    +module.exports = PassThrough;
    + 
    +var Transform = require('./_stream_transform');
    + 
    +/*<replacement>*/
    +var util = require('core-util-is');
    +util.inherits = require('inherits');
    +/*</replacement>*/
    + 
    +util.inherits(PassThrough, Transform);
    + 
    +function PassThrough(options) {
    +  Iif (!(this instanceof PassThrough)) return new PassThrough(options);
    + 
    +  Transform.call(this, options);
    +}
    + 
    +PassThrough.prototype._transform = function (chunk, encoding, cb) {
    +  cb(null, chunk);
    +};
    +
    +
    + + + + + + + diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_readable.js.html b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_readable.js.html new file mode 100644 index 0000000000..fb9f1d0cbe --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_readable.js.html @@ -0,0 +1,2741 @@ + + + + Code coverage report for lib/_stream_readable.js + + + + + + + +
    +
    +

    + all files / lib/ _stream_readable.js +

    +
    +
    + 89.29% + Statements + 467/523 +
    +
    + 87.22% + Branches + 307/352 +
    +
    + 86.79% + Functions + 46/53 +
    +
    + 90.73% + Lines + 411/453 +
    +
    +
    +
    +
    
    +
    +
    1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651 +652 +653 +654 +655 +656 +657 +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671 +672 +673 +674 +675 +676 +677 +678 +679 +680 +681 +682 +683 +684 +685 +686 +687 +688 +689 +690 +691 +692 +693 +694 +695 +696 +697 +698 +699 +700 +701 +702 +703 +704 +705 +706 +707 +708 +709 +710 +711 +712 +713 +714 +715 +716 +717 +718 +719 +720 +721 +722 +723 +724 +725 +726 +727 +728 +729 +730 +731 +732 +733 +734 +735 +736 +737 +738 +739 +740 +741 +742 +743 +744 +745 +746 +747 +748 +749 +750 +751 +752 +753 +754 +755 +756 +757 +758 +759 +760 +761 +762 +763 +764 +765 +766 +767 +768 +769 +770 +771 +772 +773 +774 +775 +776 +777 +778 +779 +780 +781 +782 +783 +784 +785 +786 +787 +788 +789 +790 +791 +792 +793 +794 +795 +796 +797 +798 +799 +800 +801 +802 +803 +804 +805 +806 +807 +808 +809 +810 +811 +812 +813 +814 +815 +816 +817 +818 +819 +820 +821 +822 +823 +824 +825 +826 +827 +828 +829 +830 +831 +832 +833 +834 +835 +836 +837 +838 +839 +840 +841 +842 +843 +844 +845 +846 +847 +848 +849 +850 +851 +852 +853 +854 +855 +856 +857 +858 +859 +860 +861 +862 +863 +864 +865 +866 +867 +868 +869 +870 +871 +872 +873 +874 +875 +876 +877 +878 +879 +880 +881 +882 +883 +884 +885 +886 +887 +888 +889 +890 +891 +892 +893  +  +49× +  +  +49× +  +  +  +49× +  +  +49× +  +  +49× +  +49× +269× +  +  +  +  +49× +49× +49× +49× +  +49× +  +  +  +  +49× +  +49× +  +  +  +49× +49× +  +  +  +49× +49× +49× +49× +  +  +  +  +  +49× +  +49× +  +49× +  +49× +38× +  +  +  +  +  +  +38× +  +  +49× +49× +82× +  +82× +  +  +  +82× +  +82× +  +  +  +82× +82× +82× +  +  +82× +  +82× +82× +82× +82× +82× +82× +82× +82× +  +  +  +  +  +82× +  +  +  +82× +82× +82× +82× +  +  +  +  +82× +  +  +  +82× +  +  +82× +  +  +82× +  +82× +82× +82× +10× +10× +10× +  +  +  +49× +49× +84× +  +84× +  +82× +  +  +82× +  +82× +  +82× +  +  +  +  +  +  +49× +276927× +  +276927× +37× +37× +10× +10× +  +  +  +276927× +  +  +  +49× +41× +41× +  +  +49× + +  +  +49× +276968× +276968× +  +276968× +67× +67× +276901× +276883× + + +276882× + + +  +276881× +276881× +23× +23× +  +  +276881× +  +  +  +276881× +  +276875× +108× +108× +  +  +276767× +276767× +  +276767× +  +  +  +276881× +  +18× + +  +  +276966× +  +  +  +  +  +  +  +  +  +49× +276966× +  +  +  +49× + + + + +  +  +  +49× +49× + +  +  +  + + + + + + + +  + +  +  +49× +554235× +  +553951× +  +553860× +  +421× +  +  +553439× +  +  +  +  +  +2087× +  +  +2087× +1711× +1697× +1697× +  +14× +  +  +  +376× +  +  +  +49× +277657× +277657× +277657× +  +277657× +  +  +  +  +277657× + + + +  +  +277651× +  +  +277651× +279× +279× +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +277372× +277372× +  +  +277372× +277365× +277365× +  +  +  +  +277372× +556× +556× +  +  +277372× +276809× +276809× +276809× +  +276809× +  +276809× +276809× +  +  +  +  +277372× +  +277372× +277372× +  +277372× +276627× +276627× +  +  +277372× +  +  +  +277372× +  +  +277372× +  +277372× +  +277372× +  +  +49× +276968× +276968× +  +  +276968× +  +  +49× +67× +59× +14× +14× + + +  +  +59× +  +  +59× +  +  +  +  +  +49× +276722× +276722× +276722× +1123× +1123× +1123× +  +  +  +49× +1123× +1123× +1123× +  +  +  +  +  +  +  +  +49× +276881× +225× +225× +  +  +  +49× +225× +225× +275597× +275597× +275597× +  +275571× +  +225× +  +  +  +  +  +  +49× +  +  +  +49× +38× +38× +  +38× +  +37× +37× +  + + +  +  +  +  +38× +38× +  +38× +  +38× +38× +  +38× +49× +25× +25× +24× +  +  +  +49× +12× +12× +  +  +  +  +  +  +38× +38× +  +38× +49× +24× +  +24× +24× +24× +24× +24× +24× +24× +24× +  +24× +  +  +  +  +  +  +24× +  +  +38× +49× +395× +395× +395× +  +  +  +  +264× +263× +263× +  +264× +  +  +  +  +  +49× + + + + +  +  +  +38× +  +  +49× +  +  +  +38× +49× + + + +  +38× +  +49× +11× +11× +  +  +  +38× +  +  +38× +12× +12× +  +  +38× +  +  +49× +38× +265× +265× +265× +265× +263× +263× +  +  +  +  +49× +27× +  +  +27× +  +  +24× +  +24× +  +24× +  +  +24× +24× +24× +24× +24× +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +49× +226× +  +  +  +226× +36× +  +  +226× +38× +38× +28× +28× +28× +28× +25× + + +  +  +  +  +226× +  +49× +  +49× +25× +25× +  +  +  +  +49× +57× +57× +56× +56× +56× +  +57× +  +  +49× +56× +42× +42× +  +  +  +49× +42× +38× +38× +  +  +42× +42× +42× +42× +  +  +49× +272× +272× +270× +270× +270× +  +272× +  +  +49× +1428× +1428× +1428× +345× +395× +  +  +  +  +  +  +  +49× + + +  + + + + +  +  +  +  + +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +16× +  +  +  +  +  +  +  +  +  + + + +  +  +  +  + +  +  +  +  +  +  +  + +  +  +  +49× +  +  +  +49× +757× +757× +757× +757× +757× +  +  +757× +  +753× +  +280× +280× +  +  +434× +  +  +114× +114× +114× +320× +  +264× +  +  +  +56× +  +56× +56× +186× +186× +  +186× +  +186× +  +186× +  +  +  +  +753× +  +  +49× +316× +  +  +  +316× +  +316× +314× +314× +  +  +  +49× +  +314× +54× +54× +54× +  +  +  +49× + + +  +  +  +49× + + +  +  + 
    'use strict';
    + 
    +module.exports = Readable;
    + 
    +/*<replacement>*/
    +var processNextTick = require('process-nextick-args');
    +/*</replacement>*/
    + 
    +/*<replacement>*/
    +var isArray = require('isarray');
    +/*</replacement>*/
    + 
    +Readable.ReadableState = ReadableState;
    + 
    +/*<replacement>*/
    +var EE = require('events').EventEmitter;
    + 
    +var EElistenerCount = function (emitter, type) {
    +  return emitter.listeners(type).length;
    +};
    +/*</replacement>*/
    + 
    +/*<replacement>*/
    +var Stream;
    +(function () {
    +  try {
    +    Stream = require('st' + 'ream');
    +  } catch (_) {} finally {
    +    Iif (!Stream) Stream = require('events').EventEmitter;
    +  }
    +})();
    +/*</replacement>*/
    + 
    +var Buffer = require('buffer').Buffer;
    +/*<replacement>*/
    +var bufferShim = require('buffer-shims');
    +/*</replacement>*/
    + 
    +/*<replacement>*/
    +var util = require('core-util-is');
    +util.inherits = require('inherits');
    +/*</replacement>*/
    + 
    +/*<replacement>*/
    +var debugUtil = require('util');
    +var debug = void 0;
    +Eif (debugUtil && debugUtil.debuglog) {
    +  debug = debugUtil.debuglog('stream');
    +} else {
    +  debug = function () {};
    +}
    +/*</replacement>*/
    + 
    +var StringDecoder;
    + 
    +util.inherits(Readable, Stream);
    + 
    +var hasPrependListener = typeof EE.prototype.prependListener === 'function';
    + 
    +function prependListener(emitter, event, fn) {
    +  Iif (hasPrependListener) return emitter.prependListener(event, fn);
    + 
    +  // This is a brutally ugly hack to make sure that our error handler
    +  // is attached before any userland ones.  NEVER DO THIS. This is here
    +  // only because this code needs to continue to work with older versions
    +  // of Node.js that do not include the prependListener() method. The goal
    +  // is to eventually remove this hack.
    +  if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else Iif (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
    +}
    + 
    +var Duplex;
    +function ReadableState(options, stream) {
    +  Duplex = Duplex || require('./_stream_duplex');
    + 
    +  options = options || {};
    + 
    +  // object stream flag. Used to make read(n) ignore n and to
    +  // make all the buffer merging and length checks go away
    +  this.objectMode = !!options.objectMode;
    + 
    +  if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
    + 
    +  // the point at which it stops calling _read() to fill the buffer
    +  // Note: 0 is a valid value, means "don't call _read preemptively ever"
    +  var hwm = options.highWaterMark;
    +  var defaultHwm = this.objectMode ? 16 : 16 * 1024;
    +  this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
    + 
    +  // cast to ints.
    +  this.highWaterMark = ~ ~this.highWaterMark;
    + 
    +  this.buffer = [];
    +  this.length = 0;
    +  this.pipes = null;
    +  this.pipesCount = 0;
    +  this.flowing = null;
    +  this.ended = false;
    +  this.endEmitted = false;
    +  this.reading = false;
    + 
    +  // a flag to be able to tell if the onwrite cb is called immediately,
    +  // or on a later tick.  We set this to true at first, because any
    +  // actions that shouldn't happen until "later" should generally also
    +  // not happen before the first write call.
    +  this.sync = true;
    + 
    +  // whenever we return null, then we set a flag to say
    +  // that we're awaiting a 'readable' event emission.
    +  this.needReadable = false;
    +  this.emittedReadable = false;
    +  this.readableListening = false;
    +  this.resumeScheduled = false;
    + 
    +  // Crypto is kind of old and crusty.  Historically, its default string
    +  // encoding is 'binary' so we have to make this configurable.
    +  // Everything else in the universe uses 'utf8', though.
    +  this.defaultEncoding = options.defaultEncoding || 'utf8';
    + 
    +  // when piping, we only care about 'readable' events that happen
    +  // after read()ing all the bytes and not getting any pushback.
    +  this.ranOut = false;
    + 
    +  // the number of writers that are awaiting a drain event in .pipe()s
    +  this.awaitDrain = 0;
    + 
    +  // if true, a maybeReadMore has been scheduled
    +  this.readingMore = false;
    + 
    +  this.decoder = null;
    +  this.encoding = null;
    +  if (options.encoding) {
    +    if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
    +    this.decoder = new StringDecoder(options.encoding);
    +    this.encoding = options.encoding;
    +  }
    +}
    + 
    +var Duplex;
    +function Readable(options) {
    +  Duplex = Duplex || require('./_stream_duplex');
    + 
    +  if (!(this instanceof Readable)) return new Readable(options);
    + 
    +  this._readableState = new ReadableState(options, this);
    + 
    +  // legacy
    +  this.readable = true;
    + 
    +  if (options && typeof options.read === 'function') this._read = options.read;
    + 
    +  Stream.call(this);
    +}
    + 
    +// Manually shove something into the read() buffer.
    +// This returns true if the highWaterMark has not been hit yet,
    +// similar to how Writable.write() returns true if you should
    +// write() some more.
    +Readable.prototype.push = function (chunk, encoding) {
    +  var state = this._readableState;
    + 
    +  if (!state.objectMode && typeof chunk === 'string') {
    +    encoding = encoding || state.defaultEncoding;
    +    if (encoding !== state.encoding) {
    +      chunk = bufferShim.from(chunk, encoding);
    +      encoding = '';
    +    }
    +  }
    + 
    +  return readableAddChunk(this, state, chunk, encoding, false);
    +};
    + 
    +// Unshift should *always* be something directly out of read()
    +Readable.prototype.unshift = function (chunk) {
    +  var state = this._readableState;
    +  return readableAddChunk(this, state, chunk, '', true);
    +};
    + 
    +Readable.prototype.isPaused = function () {
    +  return this._readableState.flowing === false;
    +};
    + 
    +function readableAddChunk(stream, state, chunk, encoding, addToFront) {
    +  var er = chunkInvalid(state, chunk);
    +  Iif (er) {
    +    stream.emit('error', er);
    +  } else if (chunk === null) {
    +    state.reading = false;
    +    onEofChunk(stream, state);
    +  } else if (state.objectMode || chunk && chunk.length > 0) {
    +    if (state.ended && !addToFront) {
    +      var e = new Error('stream.push() after EOF');
    +      stream.emit('error', e);
    +    } else if (state.endEmitted && addToFront) {
    +      var _e = new Error('stream.unshift() after end event');
    +      stream.emit('error', _e);
    +    } else {
    +      var skipAdd;
    +      if (state.decoder && !addToFront && !encoding) {
    +        chunk = state.decoder.write(chunk);
    +        skipAdd = !state.objectMode && chunk.length === 0;
    +      }
    + 
    +      if (!addToFront) state.reading = false;
    + 
    +      // Don't add to the buffer if we've decoded to an empty string chunk and
    +      // we're not in object mode
    +      if (!skipAdd) {
    +        // if we want the data now, just emit it.
    +        if (state.flowing && state.length === 0 && !state.sync) {
    +          stream.emit('data', chunk);
    +          stream.read(0);
    +        } else {
    +          // update the buffer info.
    +          state.length += state.objectMode ? 1 : chunk.length;
    +          if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
    + 
    +          if (state.needReadable) emitReadable(stream);
    +        }
    +      }
    + 
    +      maybeReadMore(stream, state);
    +    }
    +  } else if (!addToFront) {
    +    state.reading = false;
    +  }
    + 
    +  return needMoreData(state);
    +}
    + 
    +// if it's past the high water mark, we can push in some more.
    +// Also, if we have no data yet, we can stand some
    +// more bytes.  This is to work around cases where hwm=0,
    +// such as the repl.  Also, if the push() triggered a
    +// readable event, and the user called read(largeNumber) such that
    +// needReadable was set, then we ought to push more, so that another
    +// 'readable' event will be triggered.
    +function needMoreData(state) {
    +  return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
    +}
    + 
    +// backwards compatibility.
    +Readable.prototype.setEncoding = function (enc) {
    +  if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
    +  this._readableState.decoder = new StringDecoder(enc);
    +  this._readableState.encoding = enc;
    +  return this;
    +};
    + 
    +// Don't raise the hwm > 8MB
    +var MAX_HWM = 0x800000;
    +function computeNewHighWaterMark(n) {
    +  Iif (n >= MAX_HWM) {
    +    n = MAX_HWM;
    +  } else {
    +    // Get the next highest power of 2
    +    n--;
    +    n |= n >>> 1;
    +    n |= n >>> 2;
    +    n |= n >>> 4;
    +    n |= n >>> 8;
    +    n |= n >>> 16;
    +    n++;
    +  }
    +  return n;
    +}
    + 
    +function howMuchToRead(n, state) {
    +  if (state.length === 0 && state.ended) return 0;
    + 
    +  if (state.objectMode) return n === 0 ? 0 : 1;
    + 
    +  if (n === null || isNaN(n)) {
    +    // only flow one buffer at a time
    +    if (state.flowing && state.buffer.length) return state.buffer[0].length;else return state.length;
    +  }
    + 
    +  if (n <= 0) return 0;
    + 
    +  // If we're asking for more than the target buffer level,
    +  // then raise the water mark.  Bump up to the next highest
    +  // power of 2, to prevent increasing it excessively in tiny
    +  // amounts.
    +  if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
    + 
    +  // don't have that much.  return null, unless we've ended.
    +  if (n > state.length) {
    +    if (!state.ended) {
    +      state.needReadable = true;
    +      return 0;
    +    } else {
    +      return state.length;
    +    }
    +  }
    + 
    +  return n;
    +}
    + 
    +// you can override either this method, or the async _read(n) below.
    +Readable.prototype.read = function (n) {
    +  debug('read', n);
    +  var state = this._readableState;
    +  var nOrig = n;
    + 
    +  if (typeof n !== 'number' || n > 0) state.emittedReadable = false;
    + 
    +  // if we're doing read(0) to trigger a readable event, but we
    +  // already have a bunch of data in the buffer, then just trigger
    +  // the 'readable' event and move on.
    +  if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
    +    debug('read: emitReadable', state.length, state.ended);
    +    if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
    +    return null;
    +  }
    + 
    +  n = howMuchToRead(n, state);
    + 
    +  // if we've ended, and we're now clear, then finish it up.
    +  if (n === 0 && state.ended) {
    +    if (state.length === 0) endReadable(this);
    +    return null;
    +  }
    + 
    +  // All the actual chunk generation logic needs to be
    +  // *below* the call to _read.  The reason is that in certain
    +  // synthetic stream cases, such as passthrough streams, _read
    +  // may be a completely synchronous operation which may change
    +  // the state of the read buffer, providing enough data when
    +  // before there was *not* enough.
    +  //
    +  // So, the steps are:
    +  // 1. Figure out what the state of things will be after we do
    +  // a read from the buffer.
    +  //
    +  // 2. If that resulting state will trigger a _read, then call _read.
    +  // Note that this may be asynchronous, or synchronous.  Yes, it is
    +  // deeply ugly to write APIs this way, but that still doesn't mean
    +  // that the Readable class should behave improperly, as streams are
    +  // designed to be sync/async agnostic.
    +  // Take note if the _read call is sync or async (ie, if the read call
    +  // has returned yet), so that we know whether or not it's safe to emit
    +  // 'readable' etc.
    +  //
    +  // 3. Actually pull the requested chunks out of the buffer and return.
    + 
    +  // if we need a readable event, then we need to do some reading.
    +  var doRead = state.needReadable;
    +  debug('need readable', doRead);
    + 
    +  // if we currently have less than the highWaterMark, then also read some
    +  if (state.length === 0 || state.length - n < state.highWaterMark) {
    +    doRead = true;
    +    debug('length less than watermark', doRead);
    +  }
    + 
    +  // however, if we've ended, then there's no point, and if we're already
    +  // reading, then it's unnecessary.
    +  if (state.ended || state.reading) {
    +    doRead = false;
    +    debug('reading or ended', doRead);
    +  }
    + 
    +  if (doRead) {
    +    debug('do read');
    +    state.reading = true;
    +    state.sync = true;
    +    // if the length is currently zero, then we *need* a readable event.
    +    if (state.length === 0) state.needReadable = true;
    +    // call internal read method
    +    this._read(state.highWaterMark);
    +    state.sync = false;
    +  }
    + 
    +  // If _read pushed data synchronously, then `reading` will be false,
    +  // and we need to re-evaluate how much data we can return to the user.
    +  if (doRead && !state.reading) n = howMuchToRead(nOrig, state);
    + 
    +  var ret;
    +  if (n > 0) ret = fromList(n, state);else ret = null;
    + 
    +  if (ret === null) {
    +    state.needReadable = true;
    +    n = 0;
    +  }
    + 
    +  state.length -= n;
    + 
    +  // If we have nothing in the buffer, then we want to know
    +  // as soon as we *do* get something into the buffer.
    +  if (state.length === 0 && !state.ended) state.needReadable = true;
    + 
    +  // If we tried to read() past the EOF, then emit end on the next tick.
    +  if (nOrig !== n && state.ended && state.length === 0) endReadable(this);
    + 
    +  if (ret !== null) this.emit('data', ret);
    + 
    +  return ret;
    +};
    + 
    +function chunkInvalid(state, chunk) {
    +  var er = null;
    +  Iif (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
    +    er = new TypeError('Invalid non-string/buffer chunk');
    +  }
    +  return er;
    +}
    + 
    +function onEofChunk(stream, state) {
    +  if (state.ended) return;
    +  if (state.decoder) {
    +    var chunk = state.decoder.end();
    +    if (chunk && chunk.length) {
    +      state.buffer.push(chunk);
    +      state.length += state.objectMode ? 1 : chunk.length;
    +    }
    +  }
    +  state.ended = true;
    + 
    +  // emit 'readable' now to make sure it gets picked up.
    +  emitReadable(stream);
    +}
    + 
    +// Don't emit readable right away in sync mode, because this can trigger
    +// another read() call => stack overflow.  This way, it might trigger
    +// a nextTick recursion warning, but that's not so bad.
    +function emitReadable(stream) {
    +  var state = stream._readableState;
    +  state.needReadable = false;
    +  if (!state.emittedReadable) {
    +    debug('emitReadable', state.flowing);
    +    state.emittedReadable = true;
    +    if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
    +  }
    +}
    + 
    +function emitReadable_(stream) {
    +  debug('emit readable');
    +  stream.emit('readable');
    +  flow(stream);
    +}
    + 
    +// at this point, the user has presumably seen the 'readable' event,
    +// and called read() to consume some data.  that may have triggered
    +// in turn another _read(n) call, in which case reading = true if
    +// it's in progress.
    +// However, if we're not ended, or reading, and the length < hwm,
    +// then go ahead and try to read some more preemptively.
    +function maybeReadMore(stream, state) {
    +  if (!state.readingMore) {
    +    state.readingMore = true;
    +    processNextTick(maybeReadMore_, stream, state);
    +  }
    +}
    + 
    +function maybeReadMore_(stream, state) {
    +  var len = state.length;
    +  while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
    +    debug('maybeReadMore read 0');
    +    stream.read(0);
    +    if (len === state.length)
    +      // didn't get any data, stop spinning.
    +      break;else len = state.length;
    +  }
    +  state.readingMore = false;
    +}
    + 
    +// abstract method.  to be overridden in specific implementation classes.
    +// call cb(er, data) where data is <= n in length.
    +// for virtual (non-string, non-buffer) streams, "length" is somewhat
    +// arbitrary, and perhaps not very meaningful.
    +Readable.prototype._read = function (n) {
    +  this.emit('error', new Error('not implemented'));
    +};
    + 
    +Readable.prototype.pipe = function (dest, pipeOpts) {
    +  var src = this;
    +  var state = this._readableState;
    + 
    +  switch (state.pipesCount) {
    +    case 0:
    +      state.pipes = dest;
    +      break;
    +    case 1:
    +      state.pipes = [state.pipes, dest];
    +      break;
    +    default:
    +      state.pipes.push(dest);
    +      break;
    +  }
    +  state.pipesCount += 1;
    +  debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
    + 
    +  var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
    + 
    +  var endFn = doEnd ? onend : cleanup;
    +  if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
    + 
    +  dest.on('unpipe', onunpipe);
    +  function onunpipe(readable) {
    +    debug('onunpipe');
    +    if (readable === src) {
    +      cleanup();
    +    }
    +  }
    + 
    +  function onend() {
    +    debug('onend');
    +    dest.end();
    +  }
    + 
    +  // when the dest drains, it reduces the awaitDrain counter
    +  // on the source.  This would be more elegant with a .once()
    +  // handler in flow(), but adding and removing repeatedly is
    +  // too slow.
    +  var ondrain = pipeOnDrain(src);
    +  dest.on('drain', ondrain);
    + 
    +  var cleanedUp = false;
    +  function cleanup() {
    +    debug('cleanup');
    +    // cleanup event handlers once the pipe is broken
    +    dest.removeListener('close', onclose);
    +    dest.removeListener('finish', onfinish);
    +    dest.removeListener('drain', ondrain);
    +    dest.removeListener('error', onerror);
    +    dest.removeListener('unpipe', onunpipe);
    +    src.removeListener('end', onend);
    +    src.removeListener('end', cleanup);
    +    src.removeListener('data', ondata);
    + 
    +    cleanedUp = true;
    + 
    +    // if the reader is waiting for a drain event from this
    +    // specific writer, then it would cause it to never start
    +    // flowing again.
    +    // So, if this is awaiting a drain, then we just call it now.
    +    // If we don't know, then assume that we are waiting for one.
    +    if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
    +  }
    + 
    +  src.on('data', ondata);
    +  function ondata(chunk) {
    +    debug('ondata');
    +    var ret = dest.write(chunk);
    +    if (false === ret) {
    +      // If the user unpiped during `dest.write()`, it is possible
    +      // to get stuck in a permanently paused state if that write
    +      // also returned false.
    +      // => Check whether `dest` is still a piping destination.
    +      if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
    +        debug('false write response, pause', src._readableState.awaitDrain);
    +        src._readableState.awaitDrain++;
    +      }
    +      src.pause();
    +    }
    +  }
    + 
    +  // if the dest has an error, then stop piping into it.
    +  // however, don't suppress the throwing behavior for this.
    +  function onerror(er) {
    +    debug('onerror', er);
    +    unpipe();
    +    dest.removeListener('error', onerror);
    +    if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
    +  }
    + 
    +  // Make sure our error handler is attached before userland ones.
    +  prependListener(dest, 'error', onerror);
    + 
    +  // Both close and finish should trigger unpipe, but only once.
    +  function onclose() {
    +    dest.removeListener('finish', onfinish);
    +    unpipe();
    +  }
    +  dest.once('close', onclose);
    +  function onfinish() {
    +    debug('onfinish');
    +    dest.removeListener('close', onclose);
    +    unpipe();
    +  }
    +  dest.once('finish', onfinish);
    + 
    +  function unpipe() {
    +    debug('unpipe');
    +    src.unpipe(dest);
    +  }
    + 
    +  // tell the dest that it's being piped to
    +  dest.emit('pipe', src);
    + 
    +  // start the flow if it hasn't been started already.
    +  if (!state.flowing) {
    +    debug('pipe resume');
    +    src.resume();
    +  }
    + 
    +  return dest;
    +};
    + 
    +function pipeOnDrain(src) {
    +  return function () {
    +    var state = src._readableState;
    +    debug('pipeOnDrain', state.awaitDrain);
    +    if (state.awaitDrain) state.awaitDrain--;
    +    if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
    +      state.flowing = true;
    +      flow(src);
    +    }
    +  };
    +}
    + 
    +Readable.prototype.unpipe = function (dest) {
    +  var state = this._readableState;
    + 
    +  // if we're not piping anywhere, then do nothing.
    +  if (state.pipesCount === 0) return this;
    + 
    +  // just one destination.  most common case.
    +  Eif (state.pipesCount === 1) {
    +    // passed in one, but it's not the right one.
    +    Iif (dest && dest !== state.pipes) return this;
    + 
    +    Iif (!dest) dest = state.pipes;
    + 
    +    // got a match.
    +    state.pipes = null;
    +    state.pipesCount = 0;
    +    state.flowing = false;
    +    Eif (dest) dest.emit('unpipe', this);
    +    return this;
    +  }
    + 
    +  // slow case. multiple pipe destinations.
    + 
    +  if (!dest) {
    +    // remove all.
    +    var dests = state.pipes;
    +    var len = state.pipesCount;
    +    state.pipes = null;
    +    state.pipesCount = 0;
    +    state.flowing = false;
    + 
    +    for (var _i = 0; _i < len; _i++) {
    +      dests[_i].emit('unpipe', this);
    +    }return this;
    +  }
    + 
    +  // try to find the right one.
    +  var i = indexOf(state.pipes, dest);
    +  if (i === -1) return this;
    + 
    +  state.pipes.splice(i, 1);
    +  state.pipesCount -= 1;
    +  if (state.pipesCount === 1) state.pipes = state.pipes[0];
    + 
    +  dest.emit('unpipe', this);
    + 
    +  return this;
    +};
    + 
    +// set up data events if they are asked for
    +// Ensure readable listeners eventually get something
    +Readable.prototype.on = function (ev, fn) {
    +  var res = Stream.prototype.on.call(this, ev, fn);
    + 
    +  // If listening to data, and it has not explicitly been paused,
    +  // then call resume to start the flow of data on the next tick.
    +  if (ev === 'data' && false !== this._readableState.flowing) {
    +    this.resume();
    +  }
    + 
    +  if (ev === 'readable' && !this._readableState.endEmitted) {
    +    var state = this._readableState;
    +    if (!state.readableListening) {
    +      state.readableListening = true;
    +      state.emittedReadable = false;
    +      state.needReadable = true;
    +      if (!state.reading) {
    +        processNextTick(nReadingNextTick, this);
    +      } else if (state.length) {
    +        emitReadable(this, state);
    +      }
    +    }
    +  }
    + 
    +  return res;
    +};
    +Readable.prototype.addListener = Readable.prototype.on;
    + 
    +function nReadingNextTick(self) {
    +  debug('readable nexttick read 0');
    +  self.read(0);
    +}
    + 
    +// pause() and resume() are remnants of the legacy readable stream API
    +// If the user uses them, then switch into old mode.
    +Readable.prototype.resume = function () {
    +  var state = this._readableState;
    +  if (!state.flowing) {
    +    debug('resume');
    +    state.flowing = true;
    +    resume(this, state);
    +  }
    +  return this;
    +};
    + 
    +function resume(stream, state) {
    +  if (!state.resumeScheduled) {
    +    state.resumeScheduled = true;
    +    processNextTick(resume_, stream, state);
    +  }
    +}
    + 
    +function resume_(stream, state) {
    +  if (!state.reading) {
    +    debug('resume read 0');
    +    stream.read(0);
    +  }
    + 
    +  state.resumeScheduled = false;
    +  stream.emit('resume');
    +  flow(stream);
    +  if (state.flowing && !state.reading) stream.read(0);
    +}
    + 
    +Readable.prototype.pause = function () {
    +  debug('call pause flowing=%j', this._readableState.flowing);
    +  if (false !== this._readableState.flowing) {
    +    debug('pause');
    +    this._readableState.flowing = false;
    +    this.emit('pause');
    +  }
    +  return this;
    +};
    + 
    +function flow(stream) {
    +  var state = stream._readableState;
    +  debug('flow', state.flowing);
    +  if (state.flowing) {
    +    do {
    +      var chunk = stream.read();
    +    } while (null !== chunk && state.flowing);
    +  }
    +}
    + 
    +// wrap an old-style stream as the async data source.
    +// This is *not* part of the readable stream interface.
    +// It is an ugly unfortunate mess of history.
    +Readable.prototype.wrap = function (stream) {
    +  var state = this._readableState;
    +  var paused = false;
    + 
    +  var self = this;
    +  stream.on('end', function () {
    +    debug('wrapped end');
    +    Iif (state.decoder && !state.ended) {
    +      var chunk = state.decoder.end();
    +      if (chunk && chunk.length) self.push(chunk);
    +    }
    + 
    +    self.push(null);
    +  });
    + 
    +  stream.on('data', function (chunk) {
    +    debug('wrapped data');
    +    if (state.decoder) chunk = state.decoder.write(chunk);
    + 
    +    // don't skip over falsy values in objectMode
    +    if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
    + 
    +    var ret = self.push(chunk);
    +    if (!ret) {
    +      paused = true;
    +      stream.pause();
    +    }
    +  });
    + 
    +  // proxy all the other methods.
    +  // important when wrapping filters and duplexes.
    +  for (var i in stream) {
    +    Iif (this[i] === undefined && typeof stream[i] === 'function') {
    +      this[i] = function (method) {
    +        return function () {
    +          return stream[method].apply(stream, arguments);
    +        };
    +      }(i);
    +    }
    +  }
    + 
    +  // proxy certain important events.
    +  var events = ['error', 'close', 'destroy', 'pause', 'resume'];
    +  forEach(events, function (ev) {
    +    stream.on(ev, self.emit.bind(self, ev));
    +  });
    + 
    +  // when we try to consume some more bytes, simply unpause the
    +  // underlying stream.
    +  self._read = function (n) {
    +    debug('wrapped _read', n);
    +    if (paused) {
    +      paused = false;
    +      stream.resume();
    +    }
    +  };
    + 
    +  return self;
    +};
    + 
    +// exposed for testing purposes only.
    +Readable._fromList = fromList;
    + 
    +// Pluck off n bytes from an array of buffers.
    +// Length is the combined lengths of all the buffers in the list.
    +function fromList(n, state) {
    +  var list = state.buffer;
    +  var length = state.length;
    +  var stringMode = !!state.decoder;
    +  var objectMode = !!state.objectMode;
    +  var ret;
    + 
    +  // nothing in the list, definitely empty.
    +  if (list.length === 0) return null;
    + 
    +  Iif (length === 0) ret = null;else if (objectMode) ret = list.shift();else if (!n || n >= length) {
    +    // read it all, truncate the array.
    +    if (stringMode) ret = list.join('');else if (list.length === 1) ret = list[0];else ret = Buffer.concat(list, length);
    +    list.length = 0;
    +  } else {
    +    // read just some of it.
    +    if (n < list[0].length) {
    +      // just take a part of the first list item.
    +      // slice is the same for buffers and strings.
    +      var buf = list[0];
    +      ret = buf.slice(0, n);
    +      list[0] = buf.slice(n);
    +    } else if (n === list[0].length) {
    +      // first list is a perfect match
    +      ret = list.shift();
    +    } else {
    +      // complex case.
    +      // we have enough to cover it, but it spans past the first buffer.
    +      if (stringMode) ret = '';else ret = bufferShim.allocUnsafe(n);
    + 
    +      var c = 0;
    +      for (var i = 0, l = list.length; i < l && c < n; i++) {
    +        var _buf = list[0];
    +        var cpy = Math.min(n - c, _buf.length);
    + 
    +        if (stringMode) ret += _buf.slice(0, cpy);else _buf.copy(ret, c, 0, cpy);
    + 
    +        if (cpy < _buf.length) list[0] = _buf.slice(cpy);else list.shift();
    + 
    +        c += cpy;
    +      }
    +    }
    +  }
    + 
    +  return ret;
    +}
    + 
    +function endReadable(stream) {
    +  var state = stream._readableState;
    + 
    +  // If we get here before consuming all the bytes, then that is a
    +  // bug in node.  Should never happen.
    +  Iif (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
    + 
    +  if (!state.endEmitted) {
    +    state.ended = true;
    +    processNextTick(endReadableNT, state, stream);
    +  }
    +}
    + 
    +function endReadableNT(state, stream) {
    +  // Check that we didn't get one last unshift.
    +  if (!state.endEmitted && state.length === 0) {
    +    state.endEmitted = true;
    +    stream.readable = false;
    +    stream.emit('end');
    +  }
    +}
    + 
    +function forEach(xs, f) {
    +  for (var i = 0, l = xs.length; i < l; i++) {
    +    f(xs[i], i);
    +  }
    +}
    + 
    +function indexOf(xs, x) {
    +  for (var i = 0, l = xs.length; i < l; i++) {
    +    if (xs[i] === x) return i;
    +  }
    +  return -1;
    +}
    +
    +
    + + + + + + + diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_transform.js.html b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_transform.js.html new file mode 100644 index 0000000000..3542da4f63 --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_transform.js.html @@ -0,0 +1,602 @@ + + + + Code coverage report for lib/_stream_transform.js + + + + + + + +
    +
    +

    + all files / lib/ _stream_transform.js +

    +
    +
    + 92.11% + Statements + 70/76 +
    +
    + 84.21% + Branches + 32/38 +
    +
    + 90.91% + Functions + 10/11 +
    +
    + 98.48% + Lines + 65/66 +
    +
    +
    +
    +
    
    +
    +
    1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +49× +  +49× +  +  +49× +49× +  +  +49× +  +49× +24× +116× +  +  +24× +24× +24× +24× +24× +  +  +49× +116× +116× +  +116× +  +116× +  +116× +116× +  +116× +  +116× +  +116× +116× +116× +113× +  +  +  +49× +24× +  +24× +  +24× +  +  +24× +  +  +24× +  +  +  +  +24× +  +24× +13× +  +13× +  +  +24× +19× + +17× +  +  +  +49× +127× +127× +  +  +  +  +  +  +  +  +  +  +  +  +49× +  +  +  +49× +117× +117× +117× +117× +117× +117× +117× +  +  +  +  +  +  +49× +310× +  +310× +116× +116× +  +  +  +194× +  +  +  +49× +19× +  +  +  +19× +19× +  +19× +  +19× +  +19× + 
    // a transform stream is a readable/writable stream where you do
    +// something with the data.  Sometimes it's called a "filter",
    +// but that's not a great name for it, since that implies a thing where
    +// some bits pass through, and others are simply ignored.  (That would
    +// be a valid example of a transform, of course.)
    +//
    +// While the output is causally related to the input, it's not a
    +// necessarily symmetric or synchronous transformation.  For example,
    +// a zlib stream might take multiple plain-text writes(), and then
    +// emit a single compressed chunk some time in the future.
    +//
    +// Here's how this works:
    +//
    +// The Transform stream has all the aspects of the readable and writable
    +// stream classes.  When you write(chunk), that calls _write(chunk,cb)
    +// internally, and returns false if there's a lot of pending writes
    +// buffered up.  When you call read(), that calls _read(n) until
    +// there's enough pending readable data buffered up.
    +//
    +// In a transform stream, the written data is placed in a buffer.  When
    +// _read(n) is called, it transforms the queued up data, calling the
    +// buffered _write cb's as it consumes chunks.  If consuming a single
    +// written chunk would result in multiple output chunks, then the first
    +// outputted bit calls the readcb, and subsequent chunks just go into
    +// the read buffer, and will cause it to emit 'readable' if necessary.
    +//
    +// This way, back-pressure is actually determined by the reading side,
    +// since _read has to be called to start processing a new chunk.  However,
    +// a pathological inflate type of transform can cause excessive buffering
    +// here.  For example, imagine a stream where every byte of input is
    +// interpreted as an integer from 0-255, and then results in that many
    +// bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in
    +// 1kb of data being output.  In this case, you could write a very small
    +// amount of input, and end up with a very large amount of output.  In
    +// such a pathological inflating mechanism, there'd be no way to tell
    +// the system to stop doing the transform.  A single 4MB write could
    +// cause the system to run out of memory.
    +//
    +// However, even in such a pathological case, only a single written chunk
    +// would be consumed, and then the rest would wait (un-transformed) until
    +// the results of the previous transformed chunk were consumed.
    + 
    +'use strict';
    + 
    +module.exports = Transform;
    + 
    +var Duplex = require('./_stream_duplex');
    + 
    +/*<replacement>*/
    +var util = require('core-util-is');
    +util.inherits = require('inherits');
    +/*</replacement>*/
    + 
    +util.inherits(Transform, Duplex);
    + 
    +function TransformState(stream) {
    +  this.afterTransform = function (er, data) {
    +    return afterTransform(stream, er, data);
    +  };
    + 
    +  this.needTransform = false;
    +  this.transforming = false;
    +  this.writecb = null;
    +  this.writechunk = null;
    +  this.writeencoding = null;
    +}
    + 
    +function afterTransform(stream, er, data) {
    +  var ts = stream._transformState;
    +  ts.transforming = false;
    + 
    +  var cb = ts.writecb;
    + 
    +  Iif (!cb) return stream.emit('error', new Error('no writecb in Transform class'));
    + 
    +  ts.writechunk = null;
    +  ts.writecb = null;
    + 
    +  if (data !== null && data !== undefined) stream.push(data);
    + 
    +  cb(er);
    + 
    +  var rs = stream._readableState;
    +  rs.reading = false;
    +  if (rs.needReadable || rs.length < rs.highWaterMark) {
    +    stream._read(rs.highWaterMark);
    +  }
    +}
    + 
    +function Transform(options) {
    +  Iif (!(this instanceof Transform)) return new Transform(options);
    + 
    +  Duplex.call(this, options);
    + 
    +  this._transformState = new TransformState(this);
    + 
    +  // when the writable side finishes, then flush out anything remaining.
    +  var stream = this;
    + 
    +  // start out asking for a readable event once data is transformed.
    +  this._readableState.needReadable = true;
    + 
    +  // we have implemented the _read method, and done the other things
    +  // that Readable wants before the first _read call, so unset the
    +  // sync guard flag.
    +  this._readableState.sync = false;
    + 
    +  if (options) {
    +    if (typeof options.transform === 'function') this._transform = options.transform;
    + 
    +    if (typeof options.flush === 'function') this._flush = options.flush;
    +  }
    + 
    +  this.once('prefinish', function () {
    +    if (typeof this._flush === 'function') this._flush(function (er) {
    +      done(stream, er);
    +    });else done(stream);
    +  });
    +}
    + 
    +Transform.prototype.push = function (chunk, encoding) {
    +  this._transformState.needTransform = false;
    +  return Duplex.prototype.push.call(this, chunk, encoding);
    +};
    + 
    +// This is the part where you do stuff!
    +// override this function in implementation classes.
    +// 'chunk' is an input chunk.
    +//
    +// Call `push(newChunk)` to pass along transformed output
    +// to the readable side.  You may call 'push' zero or more times.
    +//
    +// Call `cb(err)` when you are done with this chunk.  If you pass
    +// an error, then that'll put the hurt on the whole operation.  If you
    +// never call cb(), then you'll never get another chunk.
    +Transform.prototype._transform = function (chunk, encoding, cb) {
    +  throw new Error('Not implemented');
    +};
    + 
    +Transform.prototype._write = function (chunk, encoding, cb) {
    +  var ts = this._transformState;
    +  ts.writecb = cb;
    +  ts.writechunk = chunk;
    +  ts.writeencoding = encoding;
    +  Eif (!ts.transforming) {
    +    var rs = this._readableState;
    +    if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
    +  }
    +};
    + 
    +// Doesn't matter what the args are here.
    +// _transform does all the work.
    +// That we got here means that the readable side wants more data.
    +Transform.prototype._read = function (n) {
    +  var ts = this._transformState;
    + 
    +  if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
    +    ts.transforming = true;
    +    this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
    +  } else {
    +    // mark that we need a transform, so that any data that comes in
    +    // will get processed, now that we've asked for it.
    +    ts.needTransform = true;
    +  }
    +};
    + 
    +function done(stream, er) {
    +  Iif (er) return stream.emit('error', er);
    + 
    +  // if there's nothing in the write buffer, then that means
    +  // that nothing more will ever be provided
    +  var ws = stream._writableState;
    +  var ts = stream._transformState;
    + 
    +  Iif (ws.length) throw new Error('Calling transform done when ws.length != 0');
    + 
    +  Iif (ts.transforming) throw new Error('Calling transform done when still transforming');
    + 
    +  return stream.push(null);
    +}
    +
    +
    + + + + + + + diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_writable.js.html b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_writable.js.html new file mode 100644 index 0000000000..0b200c9e09 --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/_stream_writable.js.html @@ -0,0 +1,1640 @@ + + + + Code coverage report for lib/_stream_writable.js + + + + + + + +
    +
    +

    + all files / lib/ _stream_writable.js +

    +
    +
    + 95.52% + Statements + 277/290 +
    +
    + 94% + Branches + 141/150 +
    +
    + 90.91% + Functions + 30/33 +
    +
    + 96.58% + Lines + 254/263 +
    +
    +
    +
    +
    
    +
    +
    1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526  +  +  +  +  +  +49× +  +  +49× +  +  +  +49× +  +  +49× +  +  +49× +49× +  +  +  +49× +  +  +  +  +  +49× +49× +49× +49× +  +49× +  +  +  +  +49× +  +49× +  +  +49× +  +49× +  +49× +2305× +2305× +2305× +2305× +  +  +49× +49× +96× +  +96× +  +  +  +96× +  +96× +  +  +  +  +96× +96× +96× +  +  +96× +  +96× +  +96× +  +96× +  +96× +  +  +  +  +96× +96× +  +  +  +  +96× +  +  +  +  +96× +  +  +96× +  +  +96× +  +  +  +  +  +96× +  +  +  +  +96× +  +  +96× +4574× +  +  +  +96× +  +  +96× +  +96× +96× +  +  +  +96× +  +  +  +96× +  +  +96× +  +  +96× +  +  +  +96× +  +  +49× + + + + + +  + +  +  +49× +49× +49× +  +  +  +  +  +  +  +49× +49× +97× +  +  +  +97× +  +96× +  +  +96× +  +96× +50× +  +50× +  +  +96× +  +  +  +49× + +  +  +49× + +  + + +  +  +  +  +  +  +  +49× +4625× +4625× +  +  +  +4625× + +4623× + +  +4625× + + + +  +4623× +  +  +49× +4626× +4626× +  +4626× +59× +59× +  +  +4626× +  +4626× +  +4626× +4621× +4621× +  +  +4624× +  +  +49× +13× +  +13× +  +  +49× +13× +  +13× +13× +  +13× +  +  +  +49× +  + + + + +  +  +49× +4621× +2273× +  +4621× +  +  +  +  +  +49× +4621× +  +4621× +4621× +  +4621× +  +4621× +  +4621× +  +4621× +2305× +2305× +2305× +2265× +  +40× +  +2305× +  +2316× +  +  +4621× +  +  +49× +4582× +4582× +4582× +4582× +4582× +4582× +  +  +49× +  +  +  +  +  +  +  +49× +4574× +4574× +4574× +4574× +  +  +49× +4574× +4574× +4574× +  +4574× +  +4574× +  +4574× +  +4574× +2254× +  +  +4574× +  +2230× +  +  +2344× +  +  +  +  +49× +4574× +4574× +4574× +4574× +  +  +  +  +  +49× +4557× +27× +27× +  +  +  +  +49× +2263× +2263× +  +2263× +  + + + + +  + + +42× +42× +42× +  +  + +  +  +  + + + +  +  +  + +  +  +  +2254× +2257× +2257× +2257× +2257× +  +2257× +2257× +  +  +  +  +2257× +2252× +  +  +  +2254× +  +  +2263× +2263× +2263× +  +  +49× +  +  +  +49× +  +49× +65× +  +65× +11× +11× +11× +54× + + +  +  +65× +  +  +65× + + +  +  +  +65× +  +  +49× +9209× +  +  +49× +125× +57× +57× +  +  +  +49× +4635× +4635× +125× +57× +57× +57× +  +68× +  +  +4635× +  +  +49× +61× +61× +61× +13× +  +61× +61× +  +  +  +  +49× +105× +  +105× +105× +  +105× + + + +40× +40× +40× +40× +  + + +  +  +  +  + 
    // A bit simpler than readable streams.
    +// Implement an async ._write(chunk, encoding, cb), and it'll handle all
    +// the drain event emission and buffering.
    + 
    +'use strict';
    + 
    +module.exports = Writable;
    + 
    +/*<replacement>*/
    +var processNextTick = require('process-nextick-args');
    +/*</replacement>*/
    + 
    +/*<replacement>*/
    +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
    +/*</replacement>*/
    + 
    +Writable.WritableState = WritableState;
    + 
    +/*<replacement>*/
    +var util = require('core-util-is');
    +util.inherits = require('inherits');
    +/*</replacement>*/
    + 
    +/*<replacement>*/
    +var internalUtil = {
    +  deprecate: require('util-deprecate')
    +};
    +/*</replacement>*/
    + 
    +/*<replacement>*/
    +var Stream;
    +(function () {
    +  try {
    +    Stream = require('st' + 'ream');
    +  } catch (_) {} finally {
    +    Iif (!Stream) Stream = require('events').EventEmitter;
    +  }
    +})();
    +/*</replacement>*/
    + 
    +var Buffer = require('buffer').Buffer;
    +/*<replacement>*/
    +var bufferShim = require('buffer-shims');
    +/*</replacement>*/
    + 
    +util.inherits(Writable, Stream);
    + 
    +function nop() {}
    + 
    +function WriteReq(chunk, encoding, cb) {
    +  this.chunk = chunk;
    +  this.encoding = encoding;
    +  this.callback = cb;
    +  this.next = null;
    +}
    + 
    +var Duplex;
    +function WritableState(options, stream) {
    +  Duplex = Duplex || require('./_stream_duplex');
    + 
    +  options = options || {};
    + 
    +  // object stream flag to indicate whether or not this stream
    +  // contains buffers or objects.
    +  this.objectMode = !!options.objectMode;
    + 
    +  if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
    + 
    +  // the point at which write() starts returning false
    +  // Note: 0 is a valid value, means that we always return false if
    +  // the entire buffer is not flushed immediately on write()
    +  var hwm = options.highWaterMark;
    +  var defaultHwm = this.objectMode ? 16 : 16 * 1024;
    +  this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
    + 
    +  // cast to ints.
    +  this.highWaterMark = ~ ~this.highWaterMark;
    + 
    +  this.needDrain = false;
    +  // at the start of calling end()
    +  this.ending = false;
    +  // when end() has been called, and returned
    +  this.ended = false;
    +  // when 'finish' is emitted
    +  this.finished = false;
    + 
    +  // should we decode strings into buffers before passing to _write?
    +  // this is here so that some node-core streams can optimize string
    +  // handling at a lower level.
    +  var noDecode = options.decodeStrings === false;
    +  this.decodeStrings = !noDecode;
    + 
    +  // Crypto is kind of old and crusty.  Historically, its default string
    +  // encoding is 'binary' so we have to make this configurable.
    +  // Everything else in the universe uses 'utf8', though.
    +  this.defaultEncoding = options.defaultEncoding || 'utf8';
    + 
    +  // not an actual buffer we keep track of, but a measurement
    +  // of how much we're waiting to get pushed to some underlying
    +  // socket or file.
    +  this.length = 0;
    + 
    +  // a flag to see when we're in the middle of a write.
    +  this.writing = false;
    + 
    +  // when true all writes will be buffered until .uncork() call
    +  this.corked = 0;
    + 
    +  // a flag to be able to tell if the onwrite cb is called immediately,
    +  // or on a later tick.  We set this to true at first, because any
    +  // actions that shouldn't happen until "later" should generally also
    +  // not happen before the first write call.
    +  this.sync = true;
    + 
    +  // a flag to know if we're processing previously buffered items, which
    +  // may call the _write() callback in the same tick, so that we don't
    +  // end up in an overlapped onwrite situation.
    +  this.bufferProcessing = false;
    + 
    +  // the callback that's passed to _write(chunk,cb)
    +  this.onwrite = function (er) {
    +    onwrite(stream, er);
    +  };
    + 
    +  // the callback that the user supplies to write(chunk,encoding,cb)
    +  this.writecb = null;
    + 
    +  // the amount that is being written when _write is called.
    +  this.writelen = 0;
    + 
    +  this.bufferedRequest = null;
    +  this.lastBufferedRequest = null;
    + 
    +  // number of pending user-supplied write callbacks
    +  // this must be 0 before 'finish' can be emitted
    +  this.pendingcb = 0;
    + 
    +  // emit prefinish if the only thing we're waiting for is _write cbs
    +  // This is relevant for synchronous Transform streams
    +  this.prefinished = false;
    + 
    +  // True if the error was already emitted and should not be thrown again
    +  this.errorEmitted = false;
    + 
    +  // count buffered requests
    +  this.bufferedRequestCount = 0;
    + 
    +  // allocate the first CorkedRequest, there is always
    +  // one allocated and free to use, and we maintain at most two
    +  this.corkedRequestsFree = new CorkedRequest(this);
    +}
    + 
    +WritableState.prototype.getBuffer = function writableStateGetBuffer() {
    +  var current = this.bufferedRequest;
    +  var out = [];
    +  while (current) {
    +    out.push(current);
    +    current = current.next;
    +  }
    +  return out;
    +};
    + 
    +(function () {
    +  try {
    +    Object.defineProperty(WritableState.prototype, 'buffer', {
    +      get: internalUtil.deprecate(function () {
    +        return this.getBuffer();
    +      }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
    +    });
    +  } catch (_) {}
    +})();
    + 
    +var Duplex;
    +function Writable(options) {
    +  Duplex = Duplex || require('./_stream_duplex');
    + 
    +  // Writable ctor is applied to Duplexes, though they're not
    +  // instanceof Writable, they're instanceof Readable.
    +  if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);
    + 
    +  this._writableState = new WritableState(options, this);
    + 
    +  // legacy.
    +  this.writable = true;
    + 
    +  if (options) {
    +    if (typeof options.write === 'function') this._write = options.write;
    + 
    +    if (typeof options.writev === 'function') this._writev = options.writev;
    +  }
    + 
    +  Stream.call(this);
    +}
    + 
    +// Otherwise people can pipe Writable streams, which is just wrong.
    +Writable.prototype.pipe = function () {
    +  this.emit('error', new Error('Cannot pipe, not readable'));
    +};
    + 
    +function writeAfterEnd(stream, cb) {
    +  var er = new Error('write after end');
    +  // TODO: defer error events consistently everywhere, not just the cb
    +  stream.emit('error', er);
    +  processNextTick(cb, er);
    +}
    + 
    +// If we get something that is not a buffer, string, null, or undefined,
    +// and we're not in objectMode, then that's an error.
    +// Otherwise stream chunks are all considered to be of length=1, and the
    +// watermarks determine how many objects to keep in the buffer, rather than
    +// how many bytes or characters.
    +function validChunk(stream, state, chunk, cb) {
    +  var valid = true;
    +  var er = false;
    +  // Always throw error if a null is written
    +  // if we are not in object mode then throw
    +  // if it is not a buffer, string, or undefined.
    +  if (chunk === null) {
    +    er = new TypeError('May not write null values to stream');
    +  } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
    +    er = new TypeError('Invalid non-string/buffer chunk');
    +  }
    +  if (er) {
    +    stream.emit('error', er);
    +    processNextTick(cb, er);
    +    valid = false;
    +  }
    +  return valid;
    +}
    + 
    +Writable.prototype.write = function (chunk, encoding, cb) {
    +  var state = this._writableState;
    +  var ret = false;
    + 
    +  if (typeof encoding === 'function') {
    +    cb = encoding;
    +    encoding = null;
    +  }
    + 
    +  if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
    + 
    +  if (typeof cb !== 'function') cb = nop;
    + 
    +  if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
    +    state.pendingcb++;
    +    ret = writeOrBuffer(this, state, chunk, encoding, cb);
    +  }
    + 
    +  return ret;
    +};
    + 
    +Writable.prototype.cork = function () {
    +  var state = this._writableState;
    + 
    +  state.corked++;
    +};
    + 
    +Writable.prototype.uncork = function () {
    +  var state = this._writableState;
    + 
    +  Eif (state.corked) {
    +    state.corked--;
    + 
    +    if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
    +  }
    +};
    + 
    +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
    +  // node::ParseEncoding() requires lower case.
    +  if (typeof encoding === 'string') encoding = encoding.toLowerCase();
    +  if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
    +  this._writableState.defaultEncoding = encoding;
    +  return this;
    +};
    + 
    +function decodeChunk(state, chunk, encoding) {
    +  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
    +    chunk = bufferShim.from(chunk, encoding);
    +  }
    +  return chunk;
    +}
    + 
    +// if we're already writing something, then just put this
    +// in the queue, and wait our turn.  Otherwise, call _write
    +// If we return false, then we need a drain event, so set that flag.
    +function writeOrBuffer(stream, state, chunk, encoding, cb) {
    +  chunk = decodeChunk(state, chunk, encoding);
    + 
    +  if (Buffer.isBuffer(chunk)) encoding = 'buffer';
    +  var len = state.objectMode ? 1 : chunk.length;
    + 
    +  state.length += len;
    + 
    +  var ret = state.length < state.highWaterMark;
    +  // we must ensure that previous needDrain will not be reset to false.
    +  if (!ret) state.needDrain = true;
    + 
    +  if (state.writing || state.corked) {
    +    var last = state.lastBufferedRequest;
    +    state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
    +    if (last) {
    +      last.next = state.lastBufferedRequest;
    +    } else {
    +      state.bufferedRequest = state.lastBufferedRequest;
    +    }
    +    state.bufferedRequestCount += 1;
    +  } else {
    +    doWrite(stream, state, false, len, chunk, encoding, cb);
    +  }
    + 
    +  return ret;
    +}
    + 
    +function doWrite(stream, state, writev, len, chunk, encoding, cb) {
    +  state.writelen = len;
    +  state.writecb = cb;
    +  state.writing = true;
    +  state.sync = true;
    +  if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
    +  state.sync = false;
    +}
    + 
    +function onwriteError(stream, state, sync, er, cb) {
    +  --state.pendingcb;
    +  if (sync) processNextTick(cb, er);else cb(er);
    + 
    +  stream._writableState.errorEmitted = true;
    +  stream.emit('error', er);
    +}
    + 
    +function onwriteStateUpdate(state) {
    +  state.writing = false;
    +  state.writecb = null;
    +  state.length -= state.writelen;
    +  state.writelen = 0;
    +}
    + 
    +function onwrite(stream, er) {
    +  var state = stream._writableState;
    +  var sync = state.sync;
    +  var cb = state.writecb;
    + 
    +  onwriteStateUpdate(state);
    + 
    +  Iif (er) onwriteError(stream, state, sync, er, cb);else {
    +    // Check if we're actually ready to finish, but don't emit yet
    +    var finished = needFinish(state);
    + 
    +    if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
    +      clearBuffer(stream, state);
    +    }
    + 
    +    if (sync) {
    +      /*<replacement>*/
    +      asyncWrite(afterWrite, stream, state, finished, cb);
    +      /*</replacement>*/
    +    } else {
    +        afterWrite(stream, state, finished, cb);
    +      }
    +  }
    +}
    + 
    +function afterWrite(stream, state, finished, cb) {
    +  if (!finished) onwriteDrain(stream, state);
    +  state.pendingcb--;
    +  cb();
    +  finishMaybe(stream, state);
    +}
    + 
    +// Must force callback to be called on nextTick, so that we don't
    +// emit 'drain' before the write() consumer gets the 'false' return
    +// value, and has a chance to attach a 'drain' listener.
    +function onwriteDrain(stream, state) {
    +  if (state.length === 0 && state.needDrain) {
    +    state.needDrain = false;
    +    stream.emit('drain');
    +  }
    +}
    + 
    +// if there's something in the buffer waiting, then process it
    +function clearBuffer(stream, state) {
    +  state.bufferProcessing = true;
    +  var entry = state.bufferedRequest;
    + 
    +  if (stream._writev && entry && entry.next) {
    +    // Fast case, write everything using _writev()
    +    var l = state.bufferedRequestCount;
    +    var buffer = new Array(l);
    +    var holder = state.corkedRequestsFree;
    +    holder.entry = entry;
    + 
    +    var count = 0;
    +    while (entry) {
    +      buffer[count] = entry;
    +      entry = entry.next;
    +      count += 1;
    +    }
    + 
    +    doWrite(stream, state, true, state.length, buffer, '', holder.finish);
    + 
    +    // doWrite is almost always async, defer these to save a bit of time
    +    // as the hot path ends with doWrite
    +    state.pendingcb++;
    +    state.lastBufferedRequest = null;
    +    Iif (holder.next) {
    +      state.corkedRequestsFree = holder.next;
    +      holder.next = null;
    +    } else {
    +      state.corkedRequestsFree = new CorkedRequest(state);
    +    }
    +  } else {
    +    // Slow case, write chunks one-by-one
    +    while (entry) {
    +      var chunk = entry.chunk;
    +      var encoding = entry.encoding;
    +      var cb = entry.callback;
    +      var len = state.objectMode ? 1 : chunk.length;
    + 
    +      doWrite(stream, state, false, len, chunk, encoding, cb);
    +      entry = entry.next;
    +      // if we didn't call the onwrite immediately, then
    +      // it means that we need to wait until it does.
    +      // also, that means that the chunk and cb are currently
    +      // being processed, so move the buffer counter past them.
    +      if (state.writing) {
    +        break;
    +      }
    +    }
    + 
    +    if (entry === null) state.lastBufferedRequest = null;
    +  }
    + 
    +  state.bufferedRequestCount = 0;
    +  state.bufferedRequest = entry;
    +  state.bufferProcessing = false;
    +}
    + 
    +Writable.prototype._write = function (chunk, encoding, cb) {
    +  cb(new Error('not implemented'));
    +};
    + 
    +Writable.prototype._writev = null;
    + 
    +Writable.prototype.end = function (chunk, encoding, cb) {
    +  var state = this._writableState;
    + 
    +  if (typeof chunk === 'function') {
    +    cb = chunk;
    +    chunk = null;
    +    encoding = null;
    +  } else if (typeof encoding === 'function') {
    +    cb = encoding;
    +    encoding = null;
    +  }
    + 
    +  if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
    + 
    +  // .end() fully uncorks
    +  if (state.corked) {
    +    state.corked = 1;
    +    this.uncork();
    +  }
    + 
    +  // ignore unnecessary end() calls.
    +  if (!state.ending && !state.finished) endWritable(this, state, cb);
    +};
    + 
    +function needFinish(state) {
    +  return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
    +}
    + 
    +function prefinish(stream, state) {
    +  if (!state.prefinished) {
    +    state.prefinished = true;
    +    stream.emit('prefinish');
    +  }
    +}
    + 
    +function finishMaybe(stream, state) {
    +  var need = needFinish(state);
    +  if (need) {
    +    if (state.pendingcb === 0) {
    +      prefinish(stream, state);
    +      state.finished = true;
    +      stream.emit('finish');
    +    } else {
    +      prefinish(stream, state);
    +    }
    +  }
    +  return need;
    +}
    + 
    +function endWritable(stream, state, cb) {
    +  state.ending = true;
    +  finishMaybe(stream, state);
    +  if (cb) {
    +    if (state.finished) processNextTick(cb);else stream.once('finish', cb);
    +  }
    +  state.ended = true;
    +  stream.writable = false;
    +}
    + 
    +// It seems a linked list but it is not
    +// there will be only 2 of these for each stream
    +function CorkedRequest(state) {
    +  var _this = this;
    + 
    +  this.next = null;
    +  this.entry = null;
    + 
    +  this.finish = function (err) {
    +    var entry = _this.entry;
    +    _this.entry = null;
    +    while (entry) {
    +      var cb = entry.callback;
    +      state.pendingcb--;
    +      cb(err);
    +      entry = entry.next;
    +    }
    +    Eif (state.corkedRequestsFree) {
    +      state.corkedRequestsFree.next = _this;
    +    } else {
    +      state.corkedRequestsFree = _this;
    +    }
    +  };
    +}
    +
    +
    + + + + + + + diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/index.html b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/index.html new file mode 100644 index 0000000000..5240d877ea --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov-report/lib/index.html @@ -0,0 +1,145 @@ + + + + Code coverage report for lib/ + + + + + + + +
    +
    +

    + all files lib/ +

    +
    +
    + 90.63% + Statements + 851/939 +
    +
    + 87.94% + Branches + 496/564 +
    +
    + 86.54% + Functions + 90/104 +
    +
    + 92.73% + Lines + 765/825 +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FileStatementsBranchesFunctionsLines
    _stream_duplex.js
    69.23%27/3968.18%15/2240%2/575.76%25/33
    _stream_passthrough.js
    90.91%10/1150%1/2100%2/2100%10/10
    _stream_readable.js
    89.29%467/52387.22%307/35286.79%46/5390.73%411/453
    _stream_transform.js
    92.11%70/7684.21%32/3890.91%10/1198.48%65/66
    _stream_writable.js
    95.52%277/29094%141/15090.91%30/3396.58%254/263
    +
    +
    + + + + + + + diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/prettify.css b/deps/npm/node_modules/readable-stream/coverage/lcov-report/prettify.css new file mode 100644 index 0000000000..b317a7cda3 --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/prettify.js b/deps/npm/node_modules/readable-stream/coverage/lcov-report/prettify.js new file mode 100644 index 0000000000..ef51e03866 --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov-report/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/sort-arrow-sprite.png b/deps/npm/node_modules/readable-stream/coverage/lcov-report/sort-arrow-sprite.png new file mode 100644 index 0000000000..03f704a609 Binary files /dev/null and b/deps/npm/node_modules/readable-stream/coverage/lcov-report/sort-arrow-sprite.png differ diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov-report/sorter.js b/deps/npm/node_modules/readable-stream/coverage/lcov-report/sorter.js new file mode 100644 index 0000000000..6c5034e403 --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov-report/sorter.js @@ -0,0 +1,158 @@ +var addSorting = (function () { + "use strict"; + var cols, + currentSort = { + index: 0, + desc: false + }; + + // returns the summary table element + function getTable() { return document.querySelector('.coverage-summary'); } + // returns the thead element of the summary table + function getTableHeader() { return getTable().querySelector('thead tr'); } + // returns the tbody element of the summary table + function getTableBody() { return getTable().querySelector('tbody'); } + // returns the th element for nth column + function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } + + // loads all columns + function loadColumns() { + var colNodes = getTableHeader().querySelectorAll('th'), + colNode, + cols = [], + col, + i; + + for (i = 0; i < colNodes.length; i += 1) { + colNode = colNodes[i]; + col = { + key: colNode.getAttribute('data-col'), + sortable: !colNode.getAttribute('data-nosort'), + type: colNode.getAttribute('data-type') || 'string' + }; + cols.push(col); + if (col.sortable) { + col.defaultDescSort = col.type === 'number'; + colNode.innerHTML = colNode.innerHTML + ''; + } + } + return cols; + } + // attaches a data attribute to every tr element with an object + // of data values keyed by column name + function loadRowData(tableRow) { + var tableCols = tableRow.querySelectorAll('td'), + colNode, + col, + data = {}, + i, + val; + for (i = 0; i < tableCols.length; i += 1) { + colNode = tableCols[i]; + col = cols[i]; + val = colNode.getAttribute('data-value'); + if (col.type === 'number') { + val = Number(val); + } + data[col.key] = val; + } + return data; + } + // loads all row data + function loadData() { + var rows = getTableBody().querySelectorAll('tr'), + i; + + for (i = 0; i < rows.length; i += 1) { + rows[i].data = loadRowData(rows[i]); + } + } + // sorts the table using the data for the ith column + function sortByIndex(index, desc) { + var key = cols[index].key, + sorter = function (a, b) { + a = a.data[key]; + b = b.data[key]; + return a < b ? -1 : a > b ? 1 : 0; + }, + finalSorter = sorter, + tableBody = document.querySelector('.coverage-summary tbody'), + rowNodes = tableBody.querySelectorAll('tr'), + rows = [], + i; + + if (desc) { + finalSorter = function (a, b) { + return -1 * sorter(a, b); + }; + } + + for (i = 0; i < rowNodes.length; i += 1) { + rows.push(rowNodes[i]); + tableBody.removeChild(rowNodes[i]); + } + + rows.sort(finalSorter); + + for (i = 0; i < rows.length; i += 1) { + tableBody.appendChild(rows[i]); + } + } + // removes sort indicators for current column being sorted + function removeSortIndicators() { + var col = getNthColumn(currentSort.index), + cls = col.className; + + cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); + col.className = cls; + } + // adds sort indicators for current column being sorted + function addSortIndicators() { + getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; + } + // adds event listeners for all sorter widgets + function enableUI() { + var i, + el, + ithSorter = function ithSorter(i) { + var col = cols[i]; + + return function () { + var desc = col.defaultDescSort; + + if (currentSort.index === i) { + desc = !currentSort.desc; + } + sortByIndex(i, desc); + removeSortIndicators(); + currentSort.index = i; + currentSort.desc = desc; + addSortIndicators(); + }; + }; + for (i =0 ; i < cols.length; i += 1) { + if (cols[i].sortable) { + // add the click event handler on the th so users + // dont have to click on those tiny arrows + el = getNthColumn(i).querySelector('.sorter').parentElement; + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } + } + } + } + // adds sorting functionality to the UI + return function () { + if (!getTable()) { + return; + } + cols = loadColumns(); + loadData(cols); + addSortIndicators(); + enableUI(); + }; +})(); + +window.addEventListener('load', addSorting); diff --git a/deps/npm/node_modules/readable-stream/coverage/lcov.info b/deps/npm/node_modules/readable-stream/coverage/lcov.info new file mode 100644 index 0000000000..d0012ea3cb --- /dev/null +++ b/deps/npm/node_modules/readable-stream/coverage/lcov.info @@ -0,0 +1,1642 @@ +TN: +SF:/Users/cmetcalf/projects/readable-stream/lib/_stream_readable.js +FN:18,(anonymous_1) +FN:25,(anonymous_2) +FN:50,(anonymous_3) +FN:60,prependListener +FN:72,ReadableState +FN:139,Readable +FN:158,(anonymous_7) +FN:173,(anonymous_8) +FN:178,(anonymous_9) +FN:182,readableAddChunk +FN:237,needMoreData +FN:242,(anonymous_12) +FN:251,computeNewHighWaterMark +FN:267,howMuchToRead +FN:299,(anonymous_15) +FN:399,chunkInvalid +FN:407,onEofChunk +FN:425,emitReadable +FN:435,emitReadable_ +FN:447,maybeReadMore +FN:454,maybeReadMore_ +FN:470,(anonymous_22) +FN:474,(anonymous_23) +FN:498,onunpipe +FN:505,onend +FN:518,cleanup +FN:541,ondata +FN:559,onerror +FN:570,onclose +FN:575,onfinish +FN:582,unpipe +FN:599,pipeOnDrain +FN:600,(anonymous_33) +FN:611,(anonymous_34) +FN:662,(anonymous_35) +FN:689,nReadingNextTick +FN:696,(anonymous_37) +FN:706,resume +FN:713,resume_ +FN:725,(anonymous_40) +FN:735,flow +FN:748,(anonymous_42) +FN:753,(anonymous_43) +FN:763,(anonymous_44) +FN:781,(anonymous_45) +FN:782,(anonymous_46) +FN:791,(anonymous_47) +FN:797,(anonymous_48) +FN:813,fromList +FN:860,endReadable +FN:873,endReadableNT +FN:882,forEach +FN:888,indexOf +FNF:53 +FNH:46 +FNDA:269,(anonymous_1) +FNDA:49,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:38,prependListener +FNDA:82,ReadableState +FNDA:84,Readable +FNDA:276927,(anonymous_7) +FNDA:41,(anonymous_8) +FNDA:4,(anonymous_9) +FNDA:276968,readableAddChunk +FNDA:276966,needMoreData +FNDA:5,(anonymous_12) +FNDA:4,computeNewHighWaterMark +FNDA:554235,howMuchToRead +FNDA:277657,(anonymous_15) +FNDA:276968,chunkInvalid +FNDA:67,onEofChunk +FNDA:276722,emitReadable +FNDA:1123,emitReadable_ +FNDA:276881,maybeReadMore +FNDA:225,maybeReadMore_ +FNDA:0,(anonymous_22) +FNDA:38,(anonymous_23) +FNDA:25,onunpipe +FNDA:12,onend +FNDA:24,cleanup +FNDA:395,ondata +FNDA:5,onerror +FNDA:0,onclose +FNDA:6,onfinish +FNDA:11,unpipe +FNDA:38,pipeOnDrain +FNDA:265,(anonymous_33) +FNDA:27,(anonymous_34) +FNDA:226,(anonymous_35) +FNDA:25,nReadingNextTick +FNDA:57,(anonymous_37) +FNDA:56,resume +FNDA:42,resume_ +FNDA:272,(anonymous_40) +FNDA:1428,flow +FNDA:1,(anonymous_42) +FNDA:1,(anonymous_43) +FNDA:0,(anonymous_44) +FNDA:0,(anonymous_45) +FNDA:0,(anonymous_46) +FNDA:5,(anonymous_47) +FNDA:0,(anonymous_48) +FNDA:757,fromList +FNDA:316,endReadable +FNDA:314,endReadableNT +FNDA:1,forEach +FNDA:2,indexOf +DA:3,49 +DA:6,49 +DA:10,49 +DA:13,49 +DA:16,49 +DA:18,49 +DA:19,269 +DA:24,49 +DA:25,49 +DA:26,49 +DA:27,49 +DA:29,49 +DA:34,49 +DA:36,49 +DA:40,49 +DA:41,49 +DA:45,49 +DA:46,49 +DA:47,49 +DA:48,49 +DA:50,0 +DA:54,49 +DA:56,49 +DA:58,49 +DA:60,49 +DA:61,38 +DA:68,38 +DA:71,49 +DA:72,49 +DA:73,82 +DA:75,82 +DA:79,82 +DA:81,82 +DA:85,82 +DA:86,82 +DA:87,82 +DA:90,82 +DA:92,82 +DA:93,82 +DA:94,82 +DA:95,82 +DA:96,82 +DA:97,82 +DA:98,82 +DA:99,82 +DA:105,82 +DA:109,82 +DA:110,82 +DA:111,82 +DA:112,82 +DA:117,82 +DA:121,82 +DA:124,82 +DA:127,82 +DA:129,82 +DA:130,82 +DA:131,82 +DA:132,10 +DA:133,10 +DA:134,10 +DA:138,49 +DA:139,49 +DA:140,84 +DA:142,84 +DA:144,82 +DA:147,82 +DA:149,82 +DA:151,82 +DA:158,49 +DA:159,276927 +DA:161,276927 +DA:162,37 +DA:163,37 +DA:164,10 +DA:165,10 +DA:169,276927 +DA:173,49 +DA:174,41 +DA:175,41 +DA:178,49 +DA:179,4 +DA:182,49 +DA:183,276968 +DA:184,276968 +DA:185,0 +DA:186,276968 +DA:187,67 +DA:188,67 +DA:189,276901 +DA:190,276883 +DA:191,1 +DA:192,1 +DA:193,276882 +DA:194,1 +DA:195,1 +DA:197,276881 +DA:198,276881 +DA:199,23 +DA:200,23 +DA:203,276881 +DA:207,276881 +DA:209,276875 +DA:210,108 +DA:211,108 +DA:214,276767 +DA:215,276767 +DA:217,276767 +DA:221,276881 +DA:223,18 +DA:224,9 +DA:227,276966 +DA:237,49 +DA:238,276966 +DA:242,49 +DA:243,5 +DA:244,5 +DA:245,5 +DA:246,5 +DA:250,49 +DA:251,49 +DA:252,4 +DA:253,0 +DA:256,4 +DA:257,4 +DA:258,4 +DA:259,4 +DA:260,4 +DA:261,4 +DA:262,4 +DA:264,4 +DA:267,49 +DA:268,554235 +DA:270,553951 +DA:272,553860 +DA:274,421 +DA:277,553439 +DA:283,2087 +DA:286,2087 +DA:287,1711 +DA:288,1697 +DA:289,1697 +DA:291,14 +DA:295,376 +DA:299,49 +DA:300,277657 +DA:301,277657 +DA:302,277657 +DA:304,277657 +DA:309,277657 +DA:310,6 +DA:311,6 +DA:312,6 +DA:315,277651 +DA:318,277651 +DA:319,279 +DA:320,279 +DA:346,277372 +DA:347,277372 +DA:350,277372 +DA:351,277365 +DA:352,277365 +DA:357,277372 +DA:358,556 +DA:359,556 +DA:362,277372 +DA:363,276809 +DA:364,276809 +DA:365,276809 +DA:367,276809 +DA:369,276809 +DA:370,276809 +DA:375,277372 +DA:377,277372 +DA:378,277372 +DA:380,277372 +DA:381,276627 +DA:382,276627 +DA:385,277372 +DA:389,277372 +DA:392,277372 +DA:394,277372 +DA:396,277372 +DA:399,49 +DA:400,276968 +DA:401,276968 +DA:402,0 +DA:404,276968 +DA:407,49 +DA:408,67 +DA:409,59 +DA:410,14 +DA:411,14 +DA:412,4 +DA:413,4 +DA:416,59 +DA:419,59 +DA:425,49 +DA:426,276722 +DA:427,276722 +DA:428,276722 +DA:429,1123 +DA:430,1123 +DA:431,1123 +DA:435,49 +DA:436,1123 +DA:437,1123 +DA:438,1123 +DA:447,49 +DA:448,276881 +DA:449,225 +DA:450,225 +DA:454,49 +DA:455,225 +DA:456,225 +DA:457,275597 +DA:458,275597 +DA:459,275597 +DA:461,275571 +DA:463,225 +DA:470,49 +DA:471,0 +DA:474,49 +DA:475,38 +DA:476,38 +DA:478,38 +DA:480,37 +DA:481,37 +DA:483,1 +DA:484,1 +DA:486,0 +DA:487,0 +DA:489,38 +DA:490,38 +DA:492,38 +DA:494,38 +DA:495,38 +DA:497,38 +DA:498,49 +DA:499,25 +DA:500,25 +DA:501,24 +DA:505,49 +DA:506,12 +DA:507,12 +DA:514,38 +DA:515,38 +DA:517,38 +DA:518,49 +DA:519,24 +DA:521,24 +DA:522,24 +DA:523,24 +DA:524,24 +DA:525,24 +DA:526,24 +DA:527,24 +DA:528,24 +DA:530,24 +DA:537,24 +DA:540,38 +DA:541,49 +DA:542,395 +DA:543,395 +DA:544,395 +DA:549,264 +DA:550,263 +DA:551,263 +DA:553,264 +DA:559,49 +DA:560,5 +DA:561,5 +DA:562,5 +DA:563,5 +DA:567,38 +DA:570,49 +DA:571,0 +DA:572,0 +DA:574,38 +DA:575,49 +DA:576,6 +DA:577,6 +DA:578,6 +DA:580,38 +DA:582,49 +DA:583,11 +DA:584,11 +DA:588,38 +DA:591,38 +DA:592,12 +DA:593,12 +DA:596,38 +DA:599,49 +DA:600,38 +DA:601,265 +DA:602,265 +DA:603,265 +DA:604,265 +DA:605,263 +DA:606,263 +DA:611,49 +DA:612,27 +DA:615,27 +DA:618,24 +DA:620,24 +DA:622,24 +DA:625,24 +DA:626,24 +DA:627,24 +DA:628,24 +DA:629,24 +DA:634,0 +DA:636,0 +DA:637,0 +DA:638,0 +DA:639,0 +DA:640,0 +DA:642,0 +DA:643,0 +DA:644,0 +DA:648,0 +DA:649,0 +DA:651,0 +DA:652,0 +DA:653,0 +DA:655,0 +DA:657,0 +DA:662,49 +DA:663,226 +DA:667,226 +DA:668,36 +DA:671,226 +DA:672,38 +DA:673,38 +DA:674,28 +DA:675,28 +DA:676,28 +DA:677,28 +DA:678,25 +DA:679,3 +DA:680,1 +DA:685,226 +DA:687,49 +DA:689,49 +DA:690,25 +DA:691,25 +DA:696,49 +DA:697,57 +DA:698,57 +DA:699,56 +DA:700,56 +DA:701,56 +DA:703,57 +DA:706,49 +DA:707,56 +DA:708,42 +DA:709,42 +DA:713,49 +DA:714,42 +DA:715,38 +DA:716,38 +DA:719,42 +DA:720,42 +DA:721,42 +DA:722,42 +DA:725,49 +DA:726,272 +DA:727,272 +DA:728,270 +DA:729,270 +DA:730,270 +DA:732,272 +DA:735,49 +DA:736,1428 +DA:737,1428 +DA:738,1428 +DA:739,345 +DA:740,395 +DA:748,49 +DA:749,1 +DA:750,1 +DA:752,1 +DA:753,1 +DA:754,1 +DA:755,1 +DA:756,0 +DA:757,0 +DA:760,1 +DA:763,1 +DA:764,0 +DA:765,0 +DA:768,0 +DA:770,0 +DA:771,0 +DA:772,0 +DA:773,0 +DA:779,1 +DA:780,16 +DA:781,0 +DA:782,0 +DA:783,0 +DA:790,1 +DA:791,1 +DA:792,5 +DA:797,1 +DA:798,0 +DA:799,0 +DA:800,0 +DA:801,0 +DA:805,1 +DA:809,49 +DA:813,49 +DA:814,757 +DA:815,757 +DA:816,757 +DA:817,757 +DA:818,757 +DA:821,757 +DA:823,753 +DA:825,280 +DA:826,280 +DA:829,434 +DA:832,114 +DA:833,114 +DA:834,114 +DA:835,320 +DA:837,264 +DA:841,56 +DA:843,56 +DA:844,56 +DA:845,186 +DA:846,186 +DA:848,186 +DA:850,186 +DA:852,186 +DA:857,753 +DA:860,49 +DA:861,316 +DA:865,316 +DA:867,316 +DA:868,314 +DA:869,314 +DA:873,49 +DA:875,314 +DA:876,54 +DA:877,54 +DA:878,54 +DA:882,49 +DA:883,1 +DA:884,5 +DA:888,49 +DA:889,2 +DA:890,3 +DA:892,0 +LF:453 +LH:411 +BRDA:29,1,0,0 +BRDA:29,1,1,49 +BRDA:47,2,0,49 +BRDA:47,2,1,0 +BRDA:47,3,0,49 +BRDA:47,3,1,49 +BRDA:61,4,0,0 +BRDA:61,4,1,38 +BRDA:68,5,0,33 +BRDA:68,5,1,5 +BRDA:68,6,0,38 +BRDA:68,6,1,38 +BRDA:68,7,0,0 +BRDA:68,7,1,5 +BRDA:73,8,0,82 +BRDA:73,8,1,0 +BRDA:75,9,0,82 +BRDA:75,9,1,40 +BRDA:81,10,0,25 +BRDA:81,10,1,57 +BRDA:81,11,0,25 +BRDA:81,11,1,17 +BRDA:86,12,0,19 +BRDA:86,12,1,63 +BRDA:87,13,0,15 +BRDA:87,13,1,67 +BRDA:87,14,0,82 +BRDA:87,14,1,67 +BRDA:117,15,0,82 +BRDA:117,15,1,82 +BRDA:131,16,0,10 +BRDA:131,16,1,72 +BRDA:132,17,0,6 +BRDA:132,17,1,4 +BRDA:140,18,0,84 +BRDA:140,18,1,39 +BRDA:142,19,0,2 +BRDA:142,19,1,82 +BRDA:149,20,0,1 +BRDA:149,20,1,81 +BRDA:149,21,0,82 +BRDA:149,21,1,42 +BRDA:161,22,0,37 +BRDA:161,22,1,276890 +BRDA:161,23,0,276927 +BRDA:161,23,1,276819 +BRDA:162,24,0,37 +BRDA:162,24,1,37 +BRDA:163,25,0,10 +BRDA:163,25,1,27 +BRDA:184,26,0,0 +BRDA:184,26,1,276968 +BRDA:186,27,0,67 +BRDA:186,27,1,276901 +BRDA:189,28,0,276883 +BRDA:189,28,1,18 +BRDA:189,29,0,276901 +BRDA:189,29,1,276810 +BRDA:189,29,2,276810 +BRDA:190,30,0,1 +BRDA:190,30,1,276882 +BRDA:190,31,0,276883 +BRDA:190,31,1,3 +BRDA:193,32,0,1 +BRDA:193,32,1,276881 +BRDA:193,33,0,276882 +BRDA:193,33,1,1 +BRDA:198,34,0,23 +BRDA:198,34,1,276858 +BRDA:198,35,0,276881 +BRDA:198,35,1,50 +BRDA:198,35,2,50 +BRDA:200,36,0,23 +BRDA:200,36,1,23 +BRDA:203,37,0,276850 +BRDA:203,37,1,31 +BRDA:207,38,0,276875 +BRDA:207,38,1,6 +BRDA:209,39,0,108 +BRDA:209,39,1,276767 +BRDA:209,40,0,276875 +BRDA:209,40,1,152 +BRDA:209,40,2,143 +BRDA:214,41,0,51 +BRDA:214,41,1,276716 +BRDA:215,42,0,31 +BRDA:215,42,1,276736 +BRDA:217,43,0,276660 +BRDA:217,43,1,107 +BRDA:223,44,0,9 +BRDA:223,44,1,9 +BRDA:238,45,0,276966 +BRDA:238,45,1,276896 +BRDA:238,45,2,276704 +BRDA:238,45,3,64 +BRDA:243,46,0,1 +BRDA:243,46,1,4 +BRDA:252,47,0,0 +BRDA:252,47,1,4 +BRDA:268,48,0,284 +BRDA:268,48,1,553951 +BRDA:268,49,0,554235 +BRDA:268,49,1,715 +BRDA:270,50,0,91 +BRDA:270,50,1,553860 +BRDA:270,51,0,46 +BRDA:270,51,1,45 +BRDA:272,52,0,421 +BRDA:272,52,1,553439 +BRDA:272,53,0,553860 +BRDA:272,53,1,553860 +BRDA:274,54,0,304 +BRDA:274,54,1,117 +BRDA:274,55,0,421 +BRDA:274,55,1,353 +BRDA:277,56,0,551352 +BRDA:277,56,1,2087 +BRDA:283,57,0,4 +BRDA:283,57,1,2083 +BRDA:286,58,0,1711 +BRDA:286,58,1,376 +BRDA:287,59,0,1697 +BRDA:287,59,1,14 +BRDA:304,60,0,1859 +BRDA:304,60,1,275798 +BRDA:304,61,0,277657 +BRDA:304,61,1,277162 +BRDA:309,62,0,6 +BRDA:309,62,1,277651 +BRDA:309,63,0,277657 +BRDA:309,63,1,275798 +BRDA:309,63,2,275735 +BRDA:309,63,3,275734 +BRDA:311,64,0,4 +BRDA:311,64,1,2 +BRDA:311,65,0,6 +BRDA:311,65,1,4 +BRDA:318,66,0,279 +BRDA:318,66,1,277372 +BRDA:318,67,0,277651 +BRDA:318,67,1,277088 +BRDA:319,68,0,277 +BRDA:319,68,1,2 +BRDA:350,69,0,277365 +BRDA:350,69,1,7 +BRDA:350,70,0,277372 +BRDA:350,70,1,276947 +BRDA:357,71,0,556 +BRDA:357,71,1,276816 +BRDA:357,72,0,277372 +BRDA:357,72,1,277056 +BRDA:362,73,0,276809 +BRDA:362,73,1,563 +BRDA:367,74,0,349 +BRDA:367,74,1,276460 +BRDA:375,75,0,276584 +BRDA:375,75,1,788 +BRDA:375,76,0,277372 +BRDA:375,76,1,276809 +BRDA:378,77,0,749 +BRDA:378,77,1,276623 +BRDA:380,78,0,276627 +BRDA:380,78,1,745 +BRDA:389,79,0,454 +BRDA:389,79,1,276918 +BRDA:389,80,0,277372 +BRDA:389,80,1,492 +BRDA:392,81,0,35 +BRDA:392,81,1,277337 +BRDA:392,82,0,277372 +BRDA:392,82,1,1242 +BRDA:392,82,2,307 +BRDA:394,83,0,745 +BRDA:394,83,1,276627 +BRDA:401,84,0,0 +BRDA:401,84,1,276968 +BRDA:401,85,0,276968 +BRDA:401,85,1,185 +BRDA:401,85,2,131 +BRDA:401,85,3,64 +BRDA:401,85,4,64 +BRDA:408,86,0,8 +BRDA:408,86,1,59 +BRDA:409,87,0,14 +BRDA:409,87,1,45 +BRDA:411,88,0,4 +BRDA:411,88,1,10 +BRDA:411,89,0,14 +BRDA:411,89,1,4 +BRDA:413,90,0,0 +BRDA:413,90,1,4 +BRDA:428,91,0,1123 +BRDA:428,91,1,275599 +BRDA:431,92,0,1003 +BRDA:431,92,1,120 +BRDA:448,93,0,225 +BRDA:448,93,1,276656 +BRDA:456,94,0,275796 +BRDA:456,94,1,275697 +BRDA:456,94,2,275647 +BRDA:456,94,3,275626 +BRDA:459,95,0,26 +BRDA:459,95,1,275571 +BRDA:478,96,0,37 +BRDA:478,96,1,1 +BRDA:478,96,2,0 +BRDA:492,97,0,38 +BRDA:492,97,1,1 +BRDA:492,97,2,37 +BRDA:492,97,3,36 +BRDA:494,98,0,36 +BRDA:494,98,1,2 +BRDA:495,99,0,1 +BRDA:495,99,1,37 +BRDA:500,100,0,24 +BRDA:500,100,1,1 +BRDA:537,101,0,1 +BRDA:537,101,1,23 +BRDA:537,102,0,24 +BRDA:537,102,1,1 +BRDA:537,102,2,1 +BRDA:544,103,0,264 +BRDA:544,103,1,131 +BRDA:549,104,0,263 +BRDA:549,104,1,1 +BRDA:549,105,0,264 +BRDA:549,105,1,262 +BRDA:549,105,2,3 +BRDA:549,105,3,2 +BRDA:549,105,4,263 +BRDA:563,106,0,2 +BRDA:563,106,1,3 +BRDA:591,107,0,12 +BRDA:591,107,1,26 +BRDA:603,108,0,261 +BRDA:603,108,1,4 +BRDA:604,109,0,263 +BRDA:604,109,1,2 +BRDA:604,110,0,265 +BRDA:604,110,1,264 +BRDA:615,111,0,3 +BRDA:615,111,1,24 +BRDA:618,112,0,24 +BRDA:618,112,1,0 +BRDA:620,113,0,0 +BRDA:620,113,1,24 +BRDA:620,114,0,24 +BRDA:620,114,1,24 +BRDA:622,115,0,0 +BRDA:622,115,1,24 +BRDA:628,116,0,24 +BRDA:628,116,1,0 +BRDA:634,117,0,0 +BRDA:634,117,1,0 +BRDA:649,118,0,0 +BRDA:649,118,1,0 +BRDA:653,119,0,0 +BRDA:653,119,1,0 +BRDA:667,120,0,36 +BRDA:667,120,1,190 +BRDA:667,121,0,226 +BRDA:667,121,1,48 +BRDA:671,122,0,38 +BRDA:671,122,1,188 +BRDA:671,123,0,226 +BRDA:671,123,1,38 +BRDA:673,124,0,28 +BRDA:673,124,1,10 +BRDA:677,125,0,25 +BRDA:677,125,1,3 +BRDA:679,126,0,1 +BRDA:679,126,1,2 +BRDA:698,127,0,56 +BRDA:698,127,1,1 +BRDA:707,128,0,42 +BRDA:707,128,1,14 +BRDA:714,129,0,38 +BRDA:714,129,1,4 +BRDA:722,130,0,12 +BRDA:722,130,1,30 +BRDA:722,131,0,42 +BRDA:722,131,1,27 +BRDA:727,132,0,270 +BRDA:727,132,1,2 +BRDA:738,133,0,345 +BRDA:738,133,1,1083 +BRDA:741,134,0,395 +BRDA:741,134,1,310 +BRDA:755,135,0,0 +BRDA:755,135,1,1 +BRDA:755,136,0,1 +BRDA:755,136,1,0 +BRDA:757,137,0,0 +BRDA:757,137,1,0 +BRDA:757,138,0,0 +BRDA:757,138,1,0 +BRDA:765,139,0,0 +BRDA:765,139,1,0 +BRDA:768,140,0,0 +BRDA:768,140,1,0 +BRDA:768,141,0,0 +BRDA:768,141,1,0 +BRDA:768,141,2,0 +BRDA:768,142,0,0 +BRDA:768,142,1,0 +BRDA:768,143,0,0 +BRDA:768,143,1,0 +BRDA:768,143,2,0 +BRDA:771,144,0,0 +BRDA:771,144,1,0 +BRDA:780,145,0,0 +BRDA:780,145,1,16 +BRDA:780,146,0,16 +BRDA:780,146,1,1 +BRDA:799,147,0,0 +BRDA:799,147,1,0 +BRDA:821,148,0,4 +BRDA:821,148,1,753 +BRDA:823,149,0,0 +BRDA:823,149,1,753 +BRDA:823,150,0,39 +BRDA:823,150,1,714 +BRDA:823,151,0,280 +BRDA:823,151,1,434 +BRDA:823,152,0,714 +BRDA:823,152,1,714 +BRDA:825,153,0,21 +BRDA:825,153,1,259 +BRDA:825,154,0,66 +BRDA:825,154,1,193 +BRDA:829,155,0,114 +BRDA:829,155,1,320 +BRDA:835,156,0,264 +BRDA:835,156,1,56 +BRDA:841,157,0,1 +BRDA:841,157,1,55 +BRDA:844,158,0,242 +BRDA:844,158,1,219 +BRDA:848,159,0,2 +BRDA:848,159,1,184 +BRDA:850,160,0,39 +BRDA:850,160,1,147 +BRDA:865,161,0,0 +BRDA:865,161,1,316 +BRDA:867,162,0,314 +BRDA:867,162,1,2 +BRDA:875,163,0,54 +BRDA:875,163,1,260 +BRDA:875,164,0,314 +BRDA:875,164,1,54 +BRDA:890,165,0,2 +BRDA:890,165,1,1 +BRF:352 +BRH:307 +end_of_record +TN: +SF:/Users/cmetcalf/projects/readable-stream/lib/_stream_writable.js +FN:32,(anonymous_1) +FN:48,nop +FN:50,WriteReq +FN:58,WritableState +FN:121,(anonymous_5) +FN:153,writableStateGetBuffer +FN:163,(anonymous_7) +FN:166,(anonymous_8) +FN:174,Writable +FN:196,(anonymous_10) +FN:200,writeAfterEnd +FN:212,validChunk +FN:231,(anonymous_13) +FN:252,(anonymous_14) +FN:258,(anonymous_15) +FN:268,setDefaultEncoding +FN:276,decodeChunk +FN:286,writeOrBuffer +FN:314,doWrite +FN:323,onwriteError +FN:331,onwriteStateUpdate +FN:338,onwrite +FN:363,afterWrite +FN:373,onwriteDrain +FN:381,clearBuffer +FN:438,(anonymous_26) +FN:444,(anonymous_27) +FN:468,needFinish +FN:472,prefinish +FN:479,finishMaybe +FN:493,endWritable +FN:505,CorkedRequest +FN:511,(anonymous_33) +FNF:33 +FNH:30 +FNDA:49,(anonymous_1) +FNDA:2512,nop +FNDA:2305,WriteReq +FNDA:96,WritableState +FNDA:4574,(anonymous_5) +FNDA:1,writableStateGetBuffer +FNDA:49,(anonymous_7) +FNDA:0,(anonymous_8) +FNDA:97,Writable +FNDA:1,(anonymous_10) +FNDA:1,writeAfterEnd +FNDA:4625,validChunk +FNDA:4626,(anonymous_13) +FNDA:13,(anonymous_14) +FNDA:13,(anonymous_15) +FNDA:3,setDefaultEncoding +FNDA:4621,decodeChunk +FNDA:4621,writeOrBuffer +FNDA:4582,doWrite +FNDA:0,onwriteError +FNDA:4574,onwriteStateUpdate +FNDA:4574,onwrite +FNDA:4574,afterWrite +FNDA:4557,onwriteDrain +FNDA:2263,clearBuffer +FNDA:0,(anonymous_26) +FNDA:65,(anonymous_27) +FNDA:9209,needFinish +FNDA:125,prefinish +FNDA:4635,finishMaybe +FNDA:61,endWritable +FNDA:105,CorkedRequest +FNDA:8,(anonymous_33) +DA:7,49 +DA:10,49 +DA:14,49 +DA:17,49 +DA:20,49 +DA:21,49 +DA:25,49 +DA:31,49 +DA:32,49 +DA:33,49 +DA:34,49 +DA:36,49 +DA:41,49 +DA:43,49 +DA:46,49 +DA:48,49 +DA:50,49 +DA:51,2305 +DA:52,2305 +DA:53,2305 +DA:54,2305 +DA:57,49 +DA:58,49 +DA:59,96 +DA:61,96 +DA:65,96 +DA:67,96 +DA:72,96 +DA:73,96 +DA:74,96 +DA:77,96 +DA:79,96 +DA:81,96 +DA:83,96 +DA:85,96 +DA:90,96 +DA:91,96 +DA:96,96 +DA:101,96 +DA:104,96 +DA:107,96 +DA:113,96 +DA:118,96 +DA:121,96 +DA:122,4574 +DA:126,96 +DA:129,96 +DA:131,96 +DA:132,96 +DA:136,96 +DA:140,96 +DA:143,96 +DA:146,96 +DA:150,96 +DA:153,49 +DA:154,1 +DA:155,1 +DA:156,1 +DA:157,5 +DA:158,5 +DA:160,1 +DA:163,49 +DA:164,49 +DA:165,49 +DA:167,0 +DA:173,49 +DA:174,49 +DA:175,97 +DA:179,97 +DA:181,96 +DA:184,96 +DA:186,96 +DA:187,50 +DA:189,50 +DA:192,96 +DA:196,49 +DA:197,1 +DA:200,49 +DA:201,1 +DA:203,1 +DA:204,1 +DA:212,49 +DA:213,4625 +DA:214,4625 +DA:218,4625 +DA:219,2 +DA:220,4623 +DA:221,2 +DA:223,4625 +DA:224,4 +DA:225,2 +DA:226,2 +DA:228,4623 +DA:231,49 +DA:232,4626 +DA:233,4626 +DA:235,4626 +DA:236,59 +DA:237,59 +DA:240,4626 +DA:242,4626 +DA:244,4626 +DA:245,4621 +DA:246,4621 +DA:249,4624 +DA:252,49 +DA:253,13 +DA:255,13 +DA:258,49 +DA:259,13 +DA:261,13 +DA:262,13 +DA:264,13 +DA:268,49 +DA:270,3 +DA:271,3 +DA:272,2 +DA:273,2 +DA:276,49 +DA:277,4621 +DA:278,2273 +DA:280,4621 +DA:286,49 +DA:287,4621 +DA:289,4621 +DA:290,4621 +DA:292,4621 +DA:294,4621 +DA:296,4621 +DA:298,4621 +DA:299,2305 +DA:300,2305 +DA:301,2305 +DA:302,2265 +DA:304,40 +DA:306,2305 +DA:308,2316 +DA:311,4621 +DA:314,49 +DA:315,4582 +DA:316,4582 +DA:317,4582 +DA:318,4582 +DA:319,4582 +DA:320,4582 +DA:323,49 +DA:324,0 +DA:325,0 +DA:327,0 +DA:328,0 +DA:331,49 +DA:332,4574 +DA:333,4574 +DA:334,4574 +DA:335,4574 +DA:338,49 +DA:339,4574 +DA:340,4574 +DA:341,4574 +DA:343,4574 +DA:345,4574 +DA:347,4574 +DA:349,4574 +DA:350,2254 +DA:353,4574 +DA:355,2230 +DA:358,2344 +DA:363,49 +DA:364,4574 +DA:365,4574 +DA:366,4574 +DA:367,4574 +DA:373,49 +DA:374,4557 +DA:375,27 +DA:376,27 +DA:381,49 +DA:382,2263 +DA:383,2263 +DA:385,2263 +DA:387,9 +DA:388,9 +DA:389,9 +DA:390,9 +DA:392,9 +DA:393,9 +DA:394,42 +DA:395,42 +DA:396,42 +DA:399,9 +DA:403,9 +DA:404,9 +DA:405,9 +DA:406,0 +DA:407,0 +DA:409,9 +DA:413,2254 +DA:414,2257 +DA:415,2257 +DA:416,2257 +DA:417,2257 +DA:419,2257 +DA:420,2257 +DA:425,2257 +DA:426,2252 +DA:430,2254 +DA:433,2263 +DA:434,2263 +DA:435,2263 +DA:438,49 +DA:439,0 +DA:442,49 +DA:444,49 +DA:445,65 +DA:447,65 +DA:448,11 +DA:449,11 +DA:450,11 +DA:451,54 +DA:452,1 +DA:453,1 +DA:456,65 +DA:459,65 +DA:460,5 +DA:461,5 +DA:465,65 +DA:468,49 +DA:469,9209 +DA:472,49 +DA:473,125 +DA:474,57 +DA:475,57 +DA:479,49 +DA:480,4635 +DA:481,4635 +DA:482,125 +DA:483,57 +DA:484,57 +DA:485,57 +DA:487,68 +DA:490,4635 +DA:493,49 +DA:494,61 +DA:495,61 +DA:496,61 +DA:497,13 +DA:499,61 +DA:500,61 +DA:505,49 +DA:506,105 +DA:508,105 +DA:509,105 +DA:511,105 +DA:512,8 +DA:513,8 +DA:514,8 +DA:515,40 +DA:516,40 +DA:517,40 +DA:518,40 +DA:520,8 +DA:521,8 +DA:523,0 +LF:263 +LH:254 +BRDA:14,1,0,0 +BRDA:14,1,1,49 +BRDA:14,2,0,49 +BRDA:14,2,1,49 +BRDA:36,3,0,0 +BRDA:36,3,1,49 +BRDA:59,4,0,96 +BRDA:59,4,1,0 +BRDA:61,5,0,96 +BRDA:61,5,1,46 +BRDA:67,6,0,25 +BRDA:67,6,1,71 +BRDA:67,7,0,25 +BRDA:67,7,1,17 +BRDA:73,8,0,23 +BRDA:73,8,1,73 +BRDA:74,9,0,8 +BRDA:74,9,1,88 +BRDA:74,10,0,96 +BRDA:74,10,1,88 +BRDA:96,11,0,96 +BRDA:96,11,1,96 +BRDA:175,12,0,97 +BRDA:175,12,1,28 +BRDA:179,13,0,1 +BRDA:179,13,1,96 +BRDA:179,14,0,97 +BRDA:179,14,1,26 +BRDA:186,15,0,50 +BRDA:186,15,1,46 +BRDA:187,16,0,1 +BRDA:187,16,1,49 +BRDA:189,17,0,1 +BRDA:189,17,1,49 +BRDA:218,18,0,2 +BRDA:218,18,1,4623 +BRDA:220,19,0,2 +BRDA:220,19,1,4621 +BRDA:220,20,0,4623 +BRDA:220,20,1,2425 +BRDA:220,20,2,61 +BRDA:220,20,3,61 +BRDA:223,21,0,4 +BRDA:223,21,1,4621 +BRDA:235,22,0,59 +BRDA:235,22,1,4567 +BRDA:240,23,0,2198 +BRDA:240,23,1,2428 +BRDA:240,24,0,2301 +BRDA:240,24,1,127 +BRDA:242,25,0,2527 +BRDA:242,25,1,2099 +BRDA:244,26,0,1 +BRDA:244,26,1,4625 +BRDA:244,27,0,4621 +BRDA:244,27,1,2 +BRDA:261,28,0,13 +BRDA:261,28,1,0 +BRDA:264,29,0,9 +BRDA:264,29,1,4 +BRDA:264,30,0,13 +BRDA:264,30,1,13 +BRDA:264,30,2,9 +BRDA:264,30,3,9 +BRDA:264,30,4,9 +BRDA:270,31,0,2 +BRDA:270,31,1,1 +BRDA:271,32,0,1 +BRDA:271,32,1,2 +BRDA:277,33,0,2273 +BRDA:277,33,1,2348 +BRDA:277,34,0,4621 +BRDA:277,34,1,4547 +BRDA:277,34,2,4467 +BRDA:289,35,0,4471 +BRDA:289,35,1,150 +BRDA:290,36,0,74 +BRDA:290,36,1,4547 +BRDA:296,37,0,177 +BRDA:296,37,1,4444 +BRDA:298,38,0,2305 +BRDA:298,38,1,2316 +BRDA:298,39,0,4621 +BRDA:298,39,1,2358 +BRDA:301,40,0,2265 +BRDA:301,40,1,40 +BRDA:319,41,0,9 +BRDA:319,41,1,4573 +BRDA:325,42,0,0 +BRDA:325,42,1,0 +BRDA:345,43,0,0 +BRDA:345,43,1,4574 +BRDA:349,44,0,2254 +BRDA:349,44,1,2320 +BRDA:349,45,0,4574 +BRDA:349,45,1,4557 +BRDA:349,45,2,4557 +BRDA:349,45,3,4544 +BRDA:353,46,0,2230 +BRDA:353,46,1,2344 +BRDA:364,47,0,4557 +BRDA:364,47,1,17 +BRDA:374,48,0,27 +BRDA:374,48,1,4530 +BRDA:374,49,0,4557 +BRDA:374,49,1,2302 +BRDA:385,50,0,9 +BRDA:385,50,1,2254 +BRDA:385,51,0,2263 +BRDA:385,51,1,9 +BRDA:385,51,2,9 +BRDA:405,52,0,0 +BRDA:405,52,1,9 +BRDA:417,53,0,4 +BRDA:417,53,1,2253 +BRDA:425,54,0,2252 +BRDA:425,54,1,5 +BRDA:430,55,0,29 +BRDA:430,55,1,2225 +BRDA:447,56,0,11 +BRDA:447,56,1,54 +BRDA:451,57,0,1 +BRDA:451,57,1,53 +BRDA:456,58,0,10 +BRDA:456,58,1,55 +BRDA:456,59,0,65 +BRDA:456,59,1,54 +BRDA:459,60,0,5 +BRDA:459,60,1,60 +BRDA:465,61,0,61 +BRDA:465,61,1,4 +BRDA:465,62,0,65 +BRDA:465,62,1,61 +BRDA:469,63,0,9209 +BRDA:469,63,1,420 +BRDA:469,63,2,149 +BRDA:469,63,3,146 +BRDA:469,63,4,145 +BRDA:473,64,0,57 +BRDA:473,64,1,68 +BRDA:481,65,0,125 +BRDA:481,65,1,4510 +BRDA:482,66,0,57 +BRDA:482,66,1,68 +BRDA:496,67,0,13 +BRDA:496,67,1,48 +BRDA:497,68,0,1 +BRDA:497,68,1,12 +BRDA:520,69,0,8 +BRDA:520,69,1,0 +BRF:150 +BRH:141 +end_of_record +TN: +SF:/Users/cmetcalf/projects/readable-stream/lib/_stream_duplex.js +FN:10,(anonymous_1) +FN:40,Duplex +FN:57,onend +FN:67,onEndNT +FN:71,forEach +FNF:5 +FNH:2 +FNDA:0,(anonymous_1) +FNDA:25,Duplex +FNDA:18,onend +FNDA:0,onEndNT +FNDA:0,forEach +DA:10,49 +DA:11,0 +DA:12,0 +DA:13,0 +DA:14,0 +DA:18,49 +DA:21,49 +DA:25,49 +DA:26,49 +DA:29,49 +DA:30,49 +DA:32,49 +DA:34,49 +DA:35,49 +DA:36,392 +DA:37,392 +DA:40,49 +DA:41,25 +DA:43,25 +DA:44,25 +DA:46,25 +DA:48,25 +DA:50,25 +DA:51,25 +DA:53,25 +DA:57,49 +DA:60,18 +DA:64,0 +DA:67,49 +DA:68,0 +DA:71,49 +DA:72,0 +DA:73,0 +LF:33 +LH:25 +BRDA:10,1,0,49 +BRDA:10,1,1,0 +BRDA:37,2,0,343 +BRDA:37,2,1,49 +BRDA:41,3,0,0 +BRDA:41,3,1,25 +BRDA:46,4,0,0 +BRDA:46,4,1,25 +BRDA:46,5,0,25 +BRDA:46,5,1,13 +BRDA:48,6,0,0 +BRDA:48,6,1,25 +BRDA:48,7,0,25 +BRDA:48,7,1,13 +BRDA:51,8,0,0 +BRDA:51,8,1,25 +BRDA:51,9,0,25 +BRDA:51,9,1,13 +BRDA:60,10,0,18 +BRDA:60,10,1,0 +BRDA:60,11,0,18 +BRDA:60,11,1,0 +BRF:22 +BRH:15 +end_of_record +TN: +SF:/Users/cmetcalf/projects/readable-stream/lib/_stream_transform.js +FN:56,TransformState +FN:57,(anonymous_2) +FN:68,afterTransform +FN:90,Transform +FN:114,(anonymous_5) +FN:115,(anonymous_6) +FN:121,(anonymous_7) +FN:136,(anonymous_8) +FN:140,(anonymous_9) +FN:154,(anonymous_10) +FN:167,done +FNF:11 +FNH:10 +FNDA:24,TransformState +FNDA:116,(anonymous_2) +FNDA:116,afterTransform +FNDA:24,Transform +FNDA:19,(anonymous_5) +FNDA:2,(anonymous_6) +FNDA:127,(anonymous_7) +FNDA:0,(anonymous_8) +FNDA:117,(anonymous_9) +FNDA:310,(anonymous_10) +FNDA:19,done +DA:45,49 +DA:47,49 +DA:50,49 +DA:51,49 +DA:54,49 +DA:56,49 +DA:57,24 +DA:58,116 +DA:61,24 +DA:62,24 +DA:63,24 +DA:64,24 +DA:65,24 +DA:68,49 +DA:69,116 +DA:70,116 +DA:72,116 +DA:74,116 +DA:76,116 +DA:77,116 +DA:79,116 +DA:81,116 +DA:83,116 +DA:84,116 +DA:85,116 +DA:86,113 +DA:90,49 +DA:91,24 +DA:93,24 +DA:95,24 +DA:98,24 +DA:101,24 +DA:106,24 +DA:108,24 +DA:109,13 +DA:111,13 +DA:114,24 +DA:115,19 +DA:116,2 +DA:117,17 +DA:121,49 +DA:122,127 +DA:123,127 +DA:136,49 +DA:137,0 +DA:140,49 +DA:141,117 +DA:142,117 +DA:143,117 +DA:144,117 +DA:145,117 +DA:146,117 +DA:147,117 +DA:154,49 +DA:155,310 +DA:157,310 +DA:158,116 +DA:159,116 +DA:163,194 +DA:167,49 +DA:168,19 +DA:172,19 +DA:173,19 +DA:175,19 +DA:177,19 +DA:179,19 +LF:66 +LH:65 +BRDA:74,1,0,0 +BRDA:74,1,1,116 +BRDA:79,2,0,61 +BRDA:79,2,1,55 +BRDA:79,3,0,116 +BRDA:79,3,1,116 +BRDA:85,4,0,113 +BRDA:85,4,1,3 +BRDA:85,5,0,116 +BRDA:85,5,1,55 +BRDA:91,6,0,0 +BRDA:91,6,1,24 +BRDA:108,7,0,13 +BRDA:108,7,1,11 +BRDA:109,8,0,1 +BRDA:109,8,1,12 +BRDA:111,9,0,1 +BRDA:111,9,1,12 +BRDA:115,10,0,2 +BRDA:115,10,1,17 +BRDA:145,11,0,117 +BRDA:145,11,1,0 +BRDA:147,12,0,116 +BRDA:147,12,1,1 +BRDA:147,13,0,117 +BRDA:147,13,1,33 +BRDA:147,13,2,11 +BRDA:157,14,0,116 +BRDA:157,14,1,194 +BRDA:157,15,0,310 +BRDA:157,15,1,152 +BRDA:157,15,2,152 +BRDA:168,16,0,0 +BRDA:168,16,1,19 +BRDA:175,17,0,0 +BRDA:175,17,1,19 +BRDA:177,18,0,0 +BRDA:177,18,1,19 +BRF:38 +BRH:32 +end_of_record +TN: +SF:/Users/cmetcalf/projects/readable-stream/lib/_stream_passthrough.js +FN:18,PassThrough +FN:24,(anonymous_2) +FNF:2 +FNH:2 +FNDA:8,PassThrough +FNDA:59,(anonymous_2) +DA:7,49 +DA:9,49 +DA:12,49 +DA:13,49 +DA:16,49 +DA:18,49 +DA:19,8 +DA:21,8 +DA:24,49 +DA:25,59 +LF:10 +LH:10 +BRDA:19,1,0,0 +BRDA:19,1,1,8 +BRF:2 +BRH:1 +end_of_record diff --git a/deps/npm/node_modules/readable-stream/doc/stream.markdown b/deps/npm/node_modules/readable-stream/doc/stream.markdown deleted file mode 100644 index ecf997a3f5..0000000000 --- a/deps/npm/node_modules/readable-stream/doc/stream.markdown +++ /dev/null @@ -1,1761 +0,0 @@ -# Stream - - Stability: 2 - Stable - -A stream is an abstract interface implemented by various objects in -Node.js. For example a [request to an HTTP server][http-incoming-message] is a -stream, as is [`process.stdout`][]. Streams are readable, writable, or both. All -streams are instances of [`EventEmitter`][]. - -You can load the Stream base classes by doing `require('stream')`. -There are base classes provided for [Readable][] streams, [Writable][] -streams, [Duplex][] streams, and [Transform][] streams. - -This document is split up into 3 sections: - -1. The first section explains the parts of the API that you need to be - aware of to use streams in your programs. -2. The second section explains the parts of the API that you need to - use if you implement your own custom streams yourself. The API is designed to - make this easy for you to do. -3. The third section goes into more depth about how streams work, - including some of the internal mechanisms and functions that you - should probably not modify unless you definitely know what you are - doing. - - -## API for Stream Consumers - - - -Streams can be either [Readable][], [Writable][], or both ([Duplex][]). - -All streams are EventEmitters, but they also have other custom methods -and properties depending on whether they are Readable, Writable, or -Duplex. - -If a stream is both Readable and Writable, then it implements all of -the methods and events. So, a [Duplex][] or [Transform][] stream is -fully described by this API, though their implementation may be -somewhat different. - -It is not necessary to implement Stream interfaces in order to consume -streams in your programs. If you **are** implementing streaming -interfaces in your own program, please also refer to -[API for Stream Implementors][]. - -Almost all Node.js programs, no matter how simple, use Streams in some -way. Here is an example of using Streams in an Node.js program: - -```js -const http = require('http'); - -var server = http.createServer( (req, res) => { - // req is an http.IncomingMessage, which is a Readable Stream - // res is an http.ServerResponse, which is a Writable Stream - - var body = ''; - // we want to get the data as utf8 strings - // If you don't set an encoding, then you'll get Buffer objects - req.setEncoding('utf8'); - - // Readable streams emit 'data' events once a listener is added - req.on('data', (chunk) => { - body += chunk; - }); - - // the end event tells you that you have entire body - req.on('end', () => { - try { - var data = JSON.parse(body); - } catch (er) { - // uh oh! bad json! - res.statusCode = 400; - return res.end(`error: ${er.message}`); - } - - // write back something interesting to the user: - res.write(typeof data); - res.end(); - }); -}); - -server.listen(1337); - -// $ curl localhost:1337 -d '{}' -// object -// $ curl localhost:1337 -d '"foo"' -// string -// $ curl localhost:1337 -d 'not json' -// error: Unexpected token o -``` - -### Class: stream.Duplex - -Duplex streams are streams that implement both the [Readable][] and -[Writable][] interfaces. - -Examples of Duplex streams include: - -* [TCP sockets][] -* [zlib streams][zlib] -* [crypto streams][crypto] - -### Class: stream.Readable - - - -The Readable stream interface is the abstraction for a *source* of -data that you are reading from. In other words, data comes *out* of a -Readable stream. - -A Readable stream will not start emitting data until you indicate that -you are ready to receive it. - -Readable streams have two "modes": a **flowing mode** and a **paused -mode**. When in flowing mode, data is read from the underlying system -and provided to your program as fast as possible. In paused mode, you -must explicitly call [`stream.read()`][stream-read] to get chunks of data out. -Streams start out in paused mode. - -**Note**: If no data event handlers are attached, and there are no -[`stream.pipe()`][] destinations, and the stream is switched into flowing -mode, then data will be lost. - -You can switch to flowing mode by doing any of the following: - -* Adding a [`'data'`][] event handler to listen for data. -* Calling the [`stream.resume()`][stream-resume] method to explicitly open the - flow. -* Calling the [`stream.pipe()`][] method to send the data to a [Writable][]. - -You can switch back to paused mode by doing either of the following: - -* If there are no pipe destinations, by calling the - [`stream.pause()`][stream-pause] method. -* If there are pipe destinations, by removing any [`'data'`][] event - handlers, and removing all pipe destinations by calling the - [`stream.unpipe()`][] method. - -Note that, for backwards compatibility reasons, removing [`'data'`][] -event handlers will **not** automatically pause the stream. Also, if -there are piped destinations, then calling [`stream.pause()`][stream-pause] will -not guarantee that the stream will *remain* paused once those -destinations drain and ask for more data. - -Examples of readable streams include: - -* [HTTP responses, on the client][http-incoming-message] -* [HTTP requests, on the server][http-incoming-message] -* [fs read streams][] -* [zlib streams][zlib] -* [crypto streams][crypto] -* [TCP sockets][] -* [child process stdout and stderr][] -* [`process.stdin`][] - -#### Event: 'close' - -Emitted when the stream and any of its underlying resources (a file -descriptor, for example) have been closed. The event indicates that -no more events will be emitted, and no further computation will occur. - -Not all streams will emit the `'close'` event. - -#### Event: 'data' - -* `chunk` {Buffer|String} The chunk of data. - -Attaching a `'data'` event listener to a stream that has not been -explicitly paused will switch the stream into flowing mode. Data will -then be passed as soon as it is available. - -If you just want to get all the data out of the stream as fast as -possible, this is the best way to do so. - -```js -var readable = getReadableStreamSomehow(); -readable.on('data', (chunk) => { - console.log('got %d bytes of data', chunk.length); -}); -``` - -#### Event: 'end' - -This event fires when there will be no more data to read. - -Note that the `'end'` event **will not fire** unless the data is -completely consumed. This can be done by switching into flowing mode, -or by calling [`stream.read()`][stream-read] repeatedly until you get to the -end. - -```js -var readable = getReadableStreamSomehow(); -readable.on('data', (chunk) => { - console.log('got %d bytes of data', chunk.length); -}); -readable.on('end', () => { - console.log('there will be no more data.'); -}); -``` - -#### Event: 'error' - -* {Error Object} - -Emitted if there was an error receiving data. - -#### Event: 'readable' - -When a chunk of data can be read from the stream, it will emit a -`'readable'` event. - -In some cases, listening for a `'readable'` event will cause some data -to be read into the internal buffer from the underlying system, if it -hadn't already. - -```javascript -var readable = getReadableStreamSomehow(); -readable.on('readable', () => { - // there is some data to read now -}); -``` - -Once the internal buffer is drained, a `'readable'` event will fire -again when more data is available. - -The `'readable'` event is not emitted in the "flowing" mode with the -sole exception of the last one, on end-of-stream. - -The `'readable'` event indicates that the stream has new information: -either new data is available or the end of the stream has been reached. -In the former case, [`stream.read()`][stream-read] will return that data. In the -latter case, [`stream.read()`][stream-read] will return null. For instance, in -the following example, `foo.txt` is an empty file: - -```js -const fs = require('fs'); -var rr = fs.createReadStream('foo.txt'); -rr.on('readable', () => { - console.log('readable:', rr.read()); -}); -rr.on('end', () => { - console.log('end'); -}); -``` - -The output of running this script is: - -``` -$ node test.js -readable: null -end -``` - -#### readable.isPaused() - -* Return: {Boolean} - -This method returns whether or not the `readable` has been **explicitly** -paused by client code (using [`stream.pause()`][stream-pause] without a -corresponding [`stream.resume()`][stream-resume]). - -```js -var readable = new stream.Readable - -readable.isPaused() // === false -readable.pause() -readable.isPaused() // === true -readable.resume() -readable.isPaused() // === false -``` - -#### readable.pause() - -* Return: `this` - -This method will cause a stream in flowing mode to stop emitting -[`'data'`][] events, switching out of flowing mode. Any data that becomes -available will remain in the internal buffer. - -```js -var readable = getReadableStreamSomehow(); -readable.on('data', (chunk) => { - console.log('got %d bytes of data', chunk.length); - readable.pause(); - console.log('there will be no more data for 1 second'); - setTimeout(() => { - console.log('now data will start flowing again'); - readable.resume(); - }, 1000); -}); -``` - -#### readable.pipe(destination[, options]) - -* `destination` {stream.Writable} The destination for writing data -* `options` {Object} Pipe options - * `end` {Boolean} End the writer when the reader ends. Default = `true` - -This method pulls all the data out of a readable stream, and writes it -to the supplied destination, automatically managing the flow so that -the destination is not overwhelmed by a fast readable stream. - -Multiple destinations can be piped to safely. - -```js -var readable = getReadableStreamSomehow(); -var writable = fs.createWriteStream('file.txt'); -// All the data from readable goes into 'file.txt' -readable.pipe(writable); -``` - -This function returns the destination stream, so you can set up pipe -chains like so: - -```js -var r = fs.createReadStream('file.txt'); -var z = zlib.createGzip(); -var w = fs.createWriteStream('file.txt.gz'); -r.pipe(z).pipe(w); -``` - -For example, emulating the Unix `cat` command: - -```js -process.stdin.pipe(process.stdout); -``` - -By default [`stream.end()`][stream-end] is called on the destination when the -source stream emits [`'end'`][], so that `destination` is no longer writable. -Pass `{ end: false }` as `options` to keep the destination stream open. - -This keeps `writer` open so that "Goodbye" can be written at the -end. - -```js -reader.pipe(writer, { end: false }); -reader.on('end', () => { - writer.end('Goodbye\n'); -}); -``` - -Note that [`process.stderr`][] and [`process.stdout`][] are never closed until -the process exits, regardless of the specified options. - -#### readable.read([size]) - -* `size` {Number} Optional argument to specify how much data to read. -* Return {String|Buffer|Null} - -The `read()` method pulls some data out of the internal buffer and -returns it. If there is no data available, then it will return -`null`. - -If you pass in a `size` argument, then it will return that many -bytes. If `size` bytes are not available, then it will return `null`, -unless we've ended, in which case it will return the data remaining -in the buffer. - -If you do not specify a `size` argument, then it will return all the -data in the internal buffer. - -This method should only be called in paused mode. In flowing mode, -this method is called automatically until the internal buffer is -drained. - -```js -var readable = getReadableStreamSomehow(); -readable.on('readable', () => { - var chunk; - while (null !== (chunk = readable.read())) { - console.log('got %d bytes of data', chunk.length); - } -}); -``` - -If this method returns a data chunk, then it will also trigger the -emission of a [`'data'`][] event. - -Note that calling [`stream.read([size])`][stream-read] after the [`'end'`][] -event has been triggered will return `null`. No runtime error will be raised. - -#### readable.resume() - -* Return: `this` - -This method will cause the readable stream to resume emitting [`'data'`][] -events. - -This method will switch the stream into flowing mode. If you do *not* -want to consume the data from a stream, but you *do* want to get to -its [`'end'`][] event, you can call [`stream.resume()`][stream-resume] to open -the flow of data. - -```js -var readable = getReadableStreamSomehow(); -readable.resume(); -readable.on('end', () => { - console.log('got to the end, but did not read anything'); -}); -``` - -#### readable.setEncoding(encoding) - -* `encoding` {String} The encoding to use. -* Return: `this` - -Call this function to cause the stream to return strings of the specified -encoding instead of Buffer objects. For example, if you do -`readable.setEncoding('utf8')`, then the output data will be interpreted as -UTF-8 data, and returned as strings. If you do `readable.setEncoding('hex')`, -then the data will be encoded in hexadecimal string format. - -This properly handles multi-byte characters that would otherwise be -potentially mangled if you simply pulled the Buffers directly and -called [`buf.toString(encoding)`][] on them. If you want to read the data -as strings, always use this method. - -Also you can disable any encoding at all with `readable.setEncoding(null)`. -This approach is very useful if you deal with binary data or with large -multi-byte strings spread out over multiple chunks. - -```js -var readable = getReadableStreamSomehow(); -readable.setEncoding('utf8'); -readable.on('data', (chunk) => { - assert.equal(typeof chunk, 'string'); - console.log('got %d characters of string data', chunk.length); -}); -``` - -#### readable.unpipe([destination]) - -* `destination` {stream.Writable} Optional specific stream to unpipe - -This method will remove the hooks set up for a previous [`stream.pipe()`][] -call. - -If the destination is not specified, then all pipes are removed. - -If the destination is specified, but no pipe is set up for it, then -this is a no-op. - -```js -var readable = getReadableStreamSomehow(); -var writable = fs.createWriteStream('file.txt'); -// All the data from readable goes into 'file.txt', -// but only for the first second -readable.pipe(writable); -setTimeout(() => { - console.log('stop writing to file.txt'); - readable.unpipe(writable); - console.log('manually close the file stream'); - writable.end(); -}, 1000); -``` - -#### readable.unshift(chunk) - -* `chunk` {Buffer|String} Chunk of data to unshift onto the read queue - -This is useful in certain cases where a stream is being consumed by a -parser, which needs to "un-consume" some data that it has -optimistically pulled out of the source, so that the stream can be -passed on to some other party. - -Note that `stream.unshift(chunk)` cannot be called after the [`'end'`][] event -has been triggered; a runtime error will be raised. - -If you find that you must often call `stream.unshift(chunk)` in your -programs, consider implementing a [Transform][] stream instead. (See [API -for Stream Implementors][].) - -```js -// Pull off a header delimited by \n\n -// use unshift() if we get too much -// Call the callback with (error, header, stream) -const StringDecoder = require('string_decoder').StringDecoder; -function parseHeader(stream, callback) { - stream.on('error', callback); - stream.on('readable', onReadable); - var decoder = new StringDecoder('utf8'); - var header = ''; - function onReadable() { - var chunk; - while (null !== (chunk = stream.read())) { - var str = decoder.write(chunk); - if (str.match(/\n\n/)) { - // found the header boundary - var split = str.split(/\n\n/); - header += split.shift(); - var remaining = split.join('\n\n'); - var buf = new Buffer(remaining, 'utf8'); - if (buf.length) - stream.unshift(buf); - stream.removeListener('error', callback); - stream.removeListener('readable', onReadable); - // now the body of the message can be read from the stream. - callback(null, header, stream); - } else { - // still reading the header. - header += str; - } - } - } -} -``` - -Note that, unlike [`stream.push(chunk)`][stream-push], `stream.unshift(chunk)` -will not end the reading process by resetting the internal reading state of the -stream. This can cause unexpected results if `unshift()` is called during a -read (i.e. from within a [`stream._read()`][stream-_read] implementation on a -custom stream). Following the call to `unshift()` with an immediate -[`stream.push('')`][stream-push] will reset the reading state appropriately, -however it is best to simply avoid calling `unshift()` while in the process of -performing a read. - -#### readable.wrap(stream) - -* `stream` {Stream} An "old style" readable stream - -Versions of Node.js prior to v0.10 had streams that did not implement the -entire Streams API as it is today. (See [Compatibility][] for -more information.) - -If you are using an older Node.js library that emits [`'data'`][] events and -has a [`stream.pause()`][stream-pause] method that is advisory only, then you -can use the `wrap()` method to create a [Readable][] stream that uses the old -stream as its data source. - -You will very rarely ever need to call this function, but it exists -as a convenience for interacting with old Node.js programs and libraries. - -For example: - -```js -const OldReader = require('./old-api-module.js').OldReader; -const Readable = require('stream').Readable; -const oreader = new OldReader; -const myReader = new Readable().wrap(oreader); - -myReader.on('readable', () => { - myReader.read(); // etc. -}); -``` - -### Class: stream.Transform - -Transform streams are [Duplex][] streams where the output is in some way -computed from the input. They implement both the [Readable][] and -[Writable][] interfaces. - -Examples of Transform streams include: - -* [zlib streams][zlib] -* [crypto streams][crypto] - -### Class: stream.Writable - - - -The Writable stream interface is an abstraction for a *destination* -that you are writing data *to*. - -Examples of writable streams include: - -* [HTTP requests, on the client][] -* [HTTP responses, on the server][] -* [fs write streams][] -* [zlib streams][zlib] -* [crypto streams][crypto] -* [TCP sockets][] -* [child process stdin][] -* [`process.stdout`][], [`process.stderr`][] - -#### Event: 'drain' - -If a [`stream.write(chunk)`][stream-write] call returns `false`, then the -`'drain'` event will indicate when it is appropriate to begin writing more data -to the stream. - -```js -// Write the data to the supplied writable stream one million times. -// Be attentive to back-pressure. -function writeOneMillionTimes(writer, data, encoding, callback) { - var i = 1000000; - write(); - function write() { - var ok = true; - do { - i -= 1; - if (i === 0) { - // last time! - writer.write(data, encoding, callback); - } else { - // see if we should continue, or wait - // don't pass the callback, because we're not done yet. - ok = writer.write(data, encoding); - } - } while (i > 0 && ok); - if (i > 0) { - // had to stop early! - // write some more once it drains - writer.once('drain', write); - } - } -} -``` - -#### Event: 'error' - -* {Error} - -Emitted if there was an error when writing or piping data. - -#### Event: 'finish' - -When the [`stream.end()`][stream-end] method has been called, and all data has -been flushed to the underlying system, this event is emitted. - -```javascript -var writer = getWritableStreamSomehow(); -for (var i = 0; i < 100; i ++) { - writer.write('hello, #${i}!\n'); -} -writer.end('this is the end\n'); -writer.on('finish', () => { - console.error('all writes are now complete.'); -}); -``` - -#### Event: 'pipe' - -* `src` {stream.Readable} source stream that is piping to this writable - -This is emitted whenever the [`stream.pipe()`][] method is called on a readable -stream, adding this writable to its set of destinations. - -```js -var writer = getWritableStreamSomehow(); -var reader = getReadableStreamSomehow(); -writer.on('pipe', (src) => { - console.error('something is piping into the writer'); - assert.equal(src, reader); -}); -reader.pipe(writer); -``` - -#### Event: 'unpipe' - -* `src` {[Readable][] Stream} The source stream that - [unpiped][`stream.unpipe()`] this writable - -This is emitted whenever the [`stream.unpipe()`][] method is called on a -readable stream, removing this writable from its set of destinations. - -```js -var writer = getWritableStreamSomehow(); -var reader = getReadableStreamSomehow(); -writer.on('unpipe', (src) => { - console.error('something has stopped piping into the writer'); - assert.equal(src, reader); -}); -reader.pipe(writer); -reader.unpipe(writer); -``` - -#### writable.cork() - -Forces buffering of all writes. - -Buffered data will be flushed either at [`stream.uncork()`][] or at -[`stream.end()`][stream-end] call. - -#### writable.end([chunk][, encoding][, callback]) - -* `chunk` {String|Buffer} Optional data to write -* `encoding` {String} The encoding, if `chunk` is a String -* `callback` {Function} Optional callback for when the stream is finished - -Call this method when no more data will be written to the stream. If supplied, -the callback is attached as a listener on the [`'finish'`][] event. - -Calling [`stream.write()`][stream-write] after calling -[`stream.end()`][stream-end] will raise an error. - -```js -// write 'hello, ' and then end with 'world!' -var file = fs.createWriteStream('example.txt'); -file.write('hello, '); -file.end('world!'); -// writing more now is not allowed! -``` - -#### writable.setDefaultEncoding(encoding) - -* `encoding` {String} The new default encoding - -Sets the default encoding for a writable stream. - -#### writable.uncork() - -Flush all data, buffered since [`stream.cork()`][] call. - -#### writable.write(chunk[, encoding][, callback]) - -* `chunk` {String|Buffer} The data to write -* `encoding` {String} The encoding, if `chunk` is a String -* `callback` {Function} Callback for when this chunk of data is flushed -* Returns: {Boolean} `true` if the data was handled completely. - -This method writes some data to the underlying system, and calls the -supplied callback once the data has been fully handled. If an error -occurs, the callback may or may not be called with the error as its -first argument. To detect write errors, listen for the `'error'` event. - -The return value indicates if you should continue writing right now. -If the data had to be buffered internally, then it will return -`false`. Otherwise, it will return `true`. - -This return value is strictly advisory. You MAY continue to write, -even if it returns `false`. However, writes will be buffered in -memory, so it is best not to do this excessively. Instead, wait for -the [`'drain'`][] event before writing more data. - - -## API for Stream Implementors - - - -To implement any sort of stream, the pattern is the same: - -1. Extend the appropriate parent class in your own subclass. (The - [`util.inherits()`][] method is particularly helpful for this.) -2. Call the appropriate parent class constructor in your constructor, - to be sure that the internal mechanisms are set up properly. -3. Implement one or more specific methods, as detailed below. - -The class to extend and the method(s) to implement depend on the sort -of stream class you are writing: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    Use-case

    -
    -

    Class

    -
    -

    Method(s) to implement

    -
    -

    Reading only

    -
    -

    [Readable](#stream_class_stream_readable_1)

    -
    -

    [_read][stream-_read]

    -
    -

    Writing only

    -
    -

    [Writable](#stream_class_stream_writable_1)

    -
    -

    [_write][stream-_write], [_writev][stream-_writev]

    -
    -

    Reading and writing

    -
    -

    [Duplex](#stream_class_stream_duplex_1)

    -
    -

    [_read][stream-_read], [_write][stream-_write], [_writev][stream-_writev]

    -
    -

    Operate on written data, then read the result

    -
    -

    [Transform](#stream_class_stream_transform_1)

    -
    -

    [_transform][stream-_transform], [_flush][stream-_flush]

    -
    - -In your implementation code, it is very important to never call the methods -described in [API for Stream Consumers][]. Otherwise, you can potentially cause -adverse side effects in programs that consume your streaming interfaces. - -### Class: stream.Duplex - - - -A "duplex" stream is one that is both Readable and Writable, such as a TCP -socket connection. - -Note that `stream.Duplex` is an abstract class designed to be extended -with an underlying implementation of the [`stream._read(size)`][stream-_read] -and [`stream._write(chunk, encoding, callback)`][stream-_write] methods as you -would with a Readable or Writable stream class. - -Since JavaScript doesn't have multiple prototypal inheritance, this class -prototypally inherits from Readable, and then parasitically from Writable. It is -thus up to the user to implement both the low-level -[`stream._read(n)`][stream-_read] method as well as the low-level -[`stream._write(chunk, encoding, callback)`][stream-_write] method on extension -duplex classes. - -#### new stream.Duplex(options) - -* `options` {Object} Passed to both Writable and Readable - constructors. Also has the following fields: - * `allowHalfOpen` {Boolean} Default = `true`. If set to `false`, then - the stream will automatically end the readable side when the - writable side ends and vice versa. - * `readableObjectMode` {Boolean} Default = `false`. Sets `objectMode` - for readable side of the stream. Has no effect if `objectMode` - is `true`. - * `writableObjectMode` {Boolean} Default = `false`. Sets `objectMode` - for writable side of the stream. Has no effect if `objectMode` - is `true`. - -In classes that extend the Duplex class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -### Class: stream.PassThrough - -This is a trivial implementation of a [Transform][] stream that simply -passes the input bytes across to the output. Its purpose is mainly -for examples and testing, but there are occasionally use cases where -it can come in handy as a building block for novel sorts of streams. - -### Class: stream.Readable - - - -`stream.Readable` is an abstract class designed to be extended with an -underlying implementation of the [`stream._read(size)`][stream-_read] method. - -Please see [API for Stream Consumers][] for how to consume -streams in your programs. What follows is an explanation of how to -implement Readable streams in your programs. - -#### new stream.Readable([options]) - -* `options` {Object} - * `highWaterMark` {Number} The maximum number of bytes to store in - the internal buffer before ceasing to read from the underlying - resource. Default = `16384` (16kb), or `16` for `objectMode` streams - * `encoding` {String} If specified, then buffers will be decoded to - strings using the specified encoding. Default = `null` - * `objectMode` {Boolean} Whether this stream should behave - as a stream of objects. Meaning that [`stream.read(n)`][stream-read] returns - a single value instead of a Buffer of size n. Default = `false` - * `read` {Function} Implementation for the [`stream._read()`][stream-_read] - method. - -In classes that extend the Readable class, make sure to call the -Readable constructor so that the buffering settings can be properly -initialized. - -#### readable.\_read(size) - -* `size` {Number} Number of bytes to read asynchronously - -Note: **Implement this method, but do NOT call it directly.** - -This method is prefixed with an underscore because it is internal to the -class that defines it and should only be called by the internal Readable -class methods. All Readable stream implementations must provide a \_read -method to fetch data from the underlying resource. - -When `_read()` is called, if data is available from the resource, the `_read()` -implementation should start pushing that data into the read queue by calling -[`this.push(dataChunk)`][stream-push]. `_read()` should continue reading from -the resource and pushing data until push returns `false`, at which point it -should stop reading from the resource. Only when `_read()` is called again after -it has stopped should it start reading more data from the resource and pushing -that data onto the queue. - -Note: once the `_read()` method is called, it will not be called again until -the [`stream.push()`][stream-push] method is called. - -The `size` argument is advisory. Implementations where a "read" is a -single call that returns data can use this to know how much data to -fetch. Implementations where that is not relevant, such as TCP or -TLS, may ignore this argument, and simply provide data whenever it -becomes available. There is no need, for example to "wait" until -`size` bytes are available before calling [`stream.push(chunk)`][stream-push]. - -#### readable.push(chunk[, encoding]) - - -* `chunk` {Buffer|Null|String} Chunk of data to push into the read queue -* `encoding` {String} Encoding of String chunks. Must be a valid - Buffer encoding, such as `'utf8'` or `'ascii'` -* return {Boolean} Whether or not more pushes should be performed - -Note: **This method should be called by Readable implementors, NOT -by consumers of Readable streams.** - -If a value other than null is passed, The `push()` method adds a chunk of data -into the queue for subsequent stream processors to consume. If `null` is -passed, it signals the end of the stream (EOF), after which no more data -can be written. - -The data added with `push()` can be pulled out by calling the -[`stream.read()`][stream-read] method when the [`'readable'`][] event fires. - -This API is designed to be as flexible as possible. For example, -you may be wrapping a lower-level source which has some sort of -pause/resume mechanism, and a data callback. In those cases, you -could wrap the low-level source object by doing something like this: - -```js -// source is an object with readStop() and readStart() methods, -// and an `ondata` member that gets called when it has data, and -// an `onend` member that gets called when the data is over. - -util.inherits(SourceWrapper, Readable); - -function SourceWrapper(options) { - Readable.call(this, options); - - this._source = getLowlevelSourceObject(); - - // Every time there's data, we push it into the internal buffer. - this._source.ondata = (chunk) => { - // if push() returns false, then we need to stop reading from source - if (!this.push(chunk)) - this._source.readStop(); - }; - - // When the source ends, we push the EOF-signaling `null` chunk - this._source.onend = () => { - this.push(null); - }; -} - -// _read will be called when the stream wants to pull more data in -// the advisory size argument is ignored in this case. -SourceWrapper.prototype._read = function(size) { - this._source.readStart(); -}; -``` - -#### Example: A Counting Stream - - - -This is a basic example of a Readable stream. It emits the numerals -from 1 to 1,000,000 in ascending order, and then ends. - -```js -const Readable = require('stream').Readable; -const util = require('util'); -util.inherits(Counter, Readable); - -function Counter(opt) { - Readable.call(this, opt); - this._max = 1000000; - this._index = 1; -} - -Counter.prototype._read = function() { - var i = this._index++; - if (i > this._max) - this.push(null); - else { - var str = '' + i; - var buf = new Buffer(str, 'ascii'); - this.push(buf); - } -}; -``` - -#### Example: SimpleProtocol v1 (Sub-optimal) - -This is similar to the `parseHeader` function described -[here](#stream_readable_unshift_chunk), but implemented as a custom stream. -Also, note that this implementation does not convert the incoming data to a -string. - -However, this would be better implemented as a [Transform][] stream. See -[SimpleProtocol v2][] for a better implementation. - -```js -// A parser for a simple data protocol. -// The "header" is a JSON object, followed by 2 \n characters, and -// then a message body. -// -// NOTE: This can be done more simply as a Transform stream! -// Using Readable directly for this is sub-optimal. See the -// alternative example below under the Transform section. - -const Readable = require('stream').Readable; -const util = require('util'); - -util.inherits(SimpleProtocol, Readable); - -function SimpleProtocol(source, options) { - if (!(this instanceof SimpleProtocol)) - return new SimpleProtocol(source, options); - - Readable.call(this, options); - this._inBody = false; - this._sawFirstCr = false; - - // source is a readable stream, such as a socket or file - this._source = source; - - source.on('end', () => { - this.push(null); - }); - - // give it a kick whenever the source is readable - // read(0) will not consume any bytes - source.on('readable', () => { - this.read(0); - }); - - this._rawHeader = []; - this.header = null; -} - -SimpleProtocol.prototype._read = function(n) { - if (!this._inBody) { - var chunk = this._source.read(); - - // if the source doesn't have data, we don't have data yet. - if (chunk === null) - return this.push(''); - - // check if the chunk has a \n\n - var split = -1; - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === 10) { // '\n' - if (this._sawFirstCr) { - split = i; - break; - } else { - this._sawFirstCr = true; - } - } else { - this._sawFirstCr = false; - } - } - - if (split === -1) { - // still waiting for the \n\n - // stash the chunk, and try again. - this._rawHeader.push(chunk); - this.push(''); - } else { - this._inBody = true; - var h = chunk.slice(0, split); - this._rawHeader.push(h); - var header = Buffer.concat(this._rawHeader).toString(); - try { - this.header = JSON.parse(header); - } catch (er) { - this.emit('error', new Error('invalid simple protocol data')); - return; - } - // now, because we got some extra data, unshift the rest - // back into the read queue so that our consumer will see it. - var b = chunk.slice(split); - this.unshift(b); - // calling unshift by itself does not reset the reading state - // of the stream; since we're inside _read, doing an additional - // push('') will reset the state appropriately. - this.push(''); - - // and let them know that we are done parsing the header. - this.emit('header', this.header); - } - } else { - // from there on, just provide the data to our consumer. - // careful not to push(null), since that would indicate EOF. - var chunk = this._source.read(); - if (chunk) this.push(chunk); - } -}; - -// Usage: -// var parser = new SimpleProtocol(source); -// Now parser is a readable stream that will emit 'header' -// with the parsed header data. -``` - -### Class: stream.Transform - -A "transform" stream is a duplex stream where the output is causally -connected in some way to the input, such as a [zlib][] stream or a -[crypto][] stream. - -There is no requirement that the output be the same size as the input, -the same number of chunks, or arrive at the same time. For example, a -Hash stream will only ever have a single chunk of output which is -provided when the input is ended. A zlib stream will produce output -that is either much smaller or much larger than its input. - -Rather than implement the [`stream._read()`][stream-_read] and -[`stream._write()`][stream-_write] methods, Transform classes must implement the -[`stream._transform()`][stream-_transform] method, and may optionally -also implement the [`stream._flush()`][stream-_flush] method. (See below.) - -#### new stream.Transform([options]) - -* `options` {Object} Passed to both Writable and Readable - constructors. Also has the following fields: - * `transform` {Function} Implementation for the - [`stream._transform()`][stream-_transform] method. - * `flush` {Function} Implementation for the [`stream._flush()`][stream-_flush] - method. - -In classes that extend the Transform class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -#### Events: 'finish' and 'end' - -The [`'finish'`][] and [`'end'`][] events are from the parent Writable -and Readable classes respectively. The `'finish'` event is fired after -[`stream.end()`][stream-end] is called and all chunks have been processed by -[`stream._transform()`][stream-_transform], `'end'` is fired after all data has -been output which is after the callback in [`stream._flush()`][stream-_flush] -has been called. - -#### transform.\_flush(callback) - -* `callback` {Function} Call this function (optionally with an error - argument) when you are done flushing any remaining data. - -Note: **This function MUST NOT be called directly.** It MAY be implemented -by child classes, and if so, will be called by the internal Transform -class methods only. - -In some cases, your transform operation may need to emit a bit more -data at the end of the stream. For example, a `Zlib` compression -stream will store up some internal state so that it can optimally -compress the output. At the end, however, it needs to do the best it -can with what is left, so that the data will be complete. - -In those cases, you can implement a `_flush()` method, which will be -called at the very end, after all the written data is consumed, but -before emitting [`'end'`][] to signal the end of the readable side. Just -like with [`stream._transform()`][stream-_transform], call -`transform.push(chunk)` zero or more times, as appropriate, and call `callback` -when the flush operation is complete. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -#### transform.\_transform(chunk, encoding, callback) - -* `chunk` {Buffer|String} The chunk to be transformed. Will **always** - be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then this is the - encoding type. If chunk is a buffer, then this is the special - value - 'buffer', ignore it in this case. -* `callback` {Function} Call this function (optionally with an error - argument and data) when you are done processing the supplied chunk. - -Note: **This function MUST NOT be called directly.** It should be -implemented by child classes, and called by the internal Transform -class methods only. - -All Transform stream implementations must provide a `_transform()` -method to accept input and produce output. - -`_transform()` should do whatever has to be done in this specific -Transform class, to handle the bytes being written, and pass them off -to the readable portion of the interface. Do asynchronous I/O, -process things, and so on. - -Call `transform.push(outputChunk)` 0 or more times to generate output -from this input chunk, depending on how much data you want to output -as a result of this chunk. - -Call the callback function only when the current chunk is completely -consumed. Note that there may or may not be output as a result of any -particular input chunk. If you supply a second argument to the callback -it will be passed to the push method. In other words the following are -equivalent: - -```js -transform.prototype._transform = function (data, encoding, callback) { - this.push(data); - callback(); -}; - -transform.prototype._transform = function (data, encoding, callback) { - callback(null, data); -}; -``` - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -#### Example: `SimpleProtocol` parser v2 - -The example [here](#stream_example_simpleprotocol_v1_sub_optimal) of a simple -protocol parser can be implemented simply by using the higher level -[Transform][] stream class, similar to the `parseHeader` and `SimpleProtocol -v1` examples. - -In this example, rather than providing the input as an argument, it -would be piped into the parser, which is a more idiomatic Node.js stream -approach. - -```javascript -const util = require('util'); -const Transform = require('stream').Transform; -util.inherits(SimpleProtocol, Transform); - -function SimpleProtocol(options) { - if (!(this instanceof SimpleProtocol)) - return new SimpleProtocol(options); - - Transform.call(this, options); - this._inBody = false; - this._sawFirstCr = false; - this._rawHeader = []; - this.header = null; -} - -SimpleProtocol.prototype._transform = function(chunk, encoding, done) { - if (!this._inBody) { - // check if the chunk has a \n\n - var split = -1; - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === 10) { // '\n' - if (this._sawFirstCr) { - split = i; - break; - } else { - this._sawFirstCr = true; - } - } else { - this._sawFirstCr = false; - } - } - - if (split === -1) { - // still waiting for the \n\n - // stash the chunk, and try again. - this._rawHeader.push(chunk); - } else { - this._inBody = true; - var h = chunk.slice(0, split); - this._rawHeader.push(h); - var header = Buffer.concat(this._rawHeader).toString(); - try { - this.header = JSON.parse(header); - } catch (er) { - this.emit('error', new Error('invalid simple protocol data')); - return; - } - // and let them know that we are done parsing the header. - this.emit('header', this.header); - - // now, because we got some extra data, emit this first. - this.push(chunk.slice(split)); - } - } else { - // from there on, just provide the data to our consumer as-is. - this.push(chunk); - } - done(); -}; - -// Usage: -// var parser = new SimpleProtocol(); -// source.pipe(parser) -// Now parser is a readable stream that will emit 'header' -// with the parsed header data. -``` - -### Class: stream.Writable - - - -`stream.Writable` is an abstract class designed to be extended with an -underlying implementation of the -[`stream._write(chunk, encoding, callback)`][stream-_write] method. - -Please see [API for Stream Consumers][] for how to consume -writable streams in your programs. What follows is an explanation of -how to implement Writable streams in your programs. - -#### new stream.Writable([options]) - -* `options` {Object} - * `highWaterMark` {Number} Buffer level when - [`stream.write()`][stream-write] starts returning `false`. Default = `16384` - (16kb), or `16` for `objectMode` streams. - * `decodeStrings` {Boolean} Whether or not to decode strings into - Buffers before passing them to [`stream._write()`][stream-_write]. - Default = `true` - * `objectMode` {Boolean} Whether or not the - [`stream.write(anyObj)`][stream-write] is a valid operation. If set you can - write arbitrary data instead of only `Buffer` / `String` data. - Default = `false` - * `write` {Function} Implementation for the - [`stream._write()`][stream-_write] method. - * `writev` {Function} Implementation for the - [`stream._writev()`][stream-_writev] method. - -In classes that extend the Writable class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -#### writable.\_write(chunk, encoding, callback) - -* `chunk` {Buffer|String} The chunk to be written. Will **always** - be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then this is the - encoding type. If chunk is a buffer, then this is the special - value - 'buffer', ignore it in this case. -* `callback` {Function} Call this function (optionally with an error - argument) when you are done processing the supplied chunk. - -All Writable stream implementations must provide a -[`stream._write()`][stream-_write] method to send data to the underlying -resource. - -Note: **This function MUST NOT be called directly.** It should be -implemented by child classes, and called by the internal Writable -class methods only. - -Call the callback using the standard `callback(error)` pattern to -signal that the write completed successfully or with an error. - -If the `decodeStrings` flag is set in the constructor options, then -`chunk` may be a string rather than a Buffer, and `encoding` will -indicate the sort of string that it is. This is to support -implementations that have an optimized handling for certain string -data encodings. If you do not explicitly set the `decodeStrings` -option to `false`, then you can safely ignore the `encoding` argument, -and assume that `chunk` will always be a Buffer. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -#### writable.\_writev(chunks, callback) - -* `chunks` {Array} The chunks to be written. Each chunk has following - format: `{ chunk: ..., encoding: ... }`. -* `callback` {Function} Call this function (optionally with an error - argument) when you are done processing the supplied chunks. - -Note: **This function MUST NOT be called directly.** It may be -implemented by child classes, and called by the internal Writable -class methods only. - -This function is completely optional to implement. In most cases it is -unnecessary. If implemented, it will be called with all the chunks -that are buffered in the write queue. - - -## Simplified Constructor API - - - -In simple cases there is now the added benefit of being able to construct a -stream without inheritance. - -This can be done by passing the appropriate methods as constructor options: - -Examples: - -### Duplex - -```js -var duplex = new stream.Duplex({ - read: function(n) { - // sets this._read under the hood - - // push data onto the read queue, passing null - // will signal the end of the stream (EOF) - this.push(chunk); - }, - write: function(chunk, encoding, next) { - // sets this._write under the hood - - // An optional error can be passed as the first argument - next() - } -}); - -// or - -var duplex = new stream.Duplex({ - read: function(n) { - // sets this._read under the hood - - // push data onto the read queue, passing null - // will signal the end of the stream (EOF) - this.push(chunk); - }, - writev: function(chunks, next) { - // sets this._writev under the hood - - // An optional error can be passed as the first argument - next() - } -}); -``` - -### Readable - -```js -var readable = new stream.Readable({ - read: function(n) { - // sets this._read under the hood - - // push data onto the read queue, passing null - // will signal the end of the stream (EOF) - this.push(chunk); - } -}); -``` - -### Transform - -```js -var transform = new stream.Transform({ - transform: function(chunk, encoding, next) { - // sets this._transform under the hood - - // generate output as many times as needed - // this.push(chunk); - - // call when the current chunk is consumed - next(); - }, - flush: function(done) { - // sets this._flush under the hood - - // generate output as many times as needed - // this.push(chunk); - - done(); - } -}); -``` - -### Writable - -```js -var writable = new stream.Writable({ - write: function(chunk, encoding, next) { - // sets this._write under the hood - - // An optional error can be passed as the first argument - next() - } -}); - -// or - -var writable = new stream.Writable({ - writev: function(chunks, next) { - // sets this._writev under the hood - - // An optional error can be passed as the first argument - next() - } -}); -``` - -## Streams: Under the Hood - - - -### Buffering - - - -Both Writable and Readable streams will buffer data on an internal -object which can be retrieved from `_writableState.getBuffer()` or -`_readableState.buffer`, respectively. - -The amount of data that will potentially be buffered depends on the -`highWaterMark` option which is passed into the constructor. - -Buffering in Readable streams happens when the implementation calls -[`stream.push(chunk)`][stream-push]. If the consumer of the Stream does not -call [`stream.read()`][stream-read], then the data will sit in the internal -queue until it is consumed. - -Buffering in Writable streams happens when the user calls -[`stream.write(chunk)`][stream-write] repeatedly, even when it returns `false`. - -The purpose of streams, especially with the [`stream.pipe()`][] method, is to -limit the buffering of data to acceptable levels, so that sources and -destinations of varying speed will not overwhelm the available memory. - -### Compatibility with Older Node.js Versions - - - -In versions of Node.js prior to v0.10, the Readable stream interface was -simpler, but also less powerful and less useful. - -* Rather than waiting for you to call the [`stream.read()`][stream-read] method, - [`'data'`][] events would start emitting immediately. If you needed to do - some I/O to decide how to handle data, then you had to store the chunks - in some kind of buffer so that they would not be lost. -* The [`stream.pause()`][stream-pause] method was advisory, rather than - guaranteed. This meant that you still had to be prepared to receive - [`'data'`][] events even when the stream was in a paused state. - -In Node.js v0.10, the [Readable][] class was added. -For backwards compatibility with older Node.js programs, Readable streams -switch into "flowing mode" when a [`'data'`][] event handler is added, or -when the [`stream.resume()`][stream-resume] method is called. The effect is -that, even if you are not using the new [`stream.read()`][stream-read] method -and [`'readable'`][] event, you no longer have to worry about losing -[`'data'`][] chunks. - -Most programs will continue to function normally. However, this -introduces an edge case in the following conditions: - -* No [`'data'`][] event handler is added. -* The [`stream.resume()`][stream-resume] method is never called. -* The stream is not piped to any writable destination. - -For example, consider the following code: - -```js -// WARNING! BROKEN! -net.createServer((socket) => { - - // we add an 'end' method, but never consume the data - socket.on('end', () => { - // It will never get here. - socket.end('I got your message (but didnt read it)\n'); - }); - -}).listen(1337); -``` - -In versions of Node.js prior to v0.10, the incoming message data would be -simply discarded. However, in Node.js v0.10 and beyond, -the socket will remain paused forever. - -The workaround in this situation is to call the -[`stream.resume()`][stream-resume] method to start the flow of data: - -```js -// Workaround -net.createServer((socket) => { - - socket.on('end', () => { - socket.end('I got your message (but didnt read it)\n'); - }); - - // start the flow of data, discarding it. - socket.resume(); - -}).listen(1337); -``` - -In addition to new Readable streams switching into flowing mode, -pre-v0.10 style streams can be wrapped in a Readable class using the -[`stream.wrap()`][] method. - - -### Object Mode - - - -Normally, Streams operate on Strings and Buffers exclusively. - -Streams that are in **object mode** can emit generic JavaScript values -other than Buffers and Strings. - -A Readable stream in object mode will always return a single item from -a call to [`stream.read(size)`][stream-read], regardless of what the size -argument is. - -A Writable stream in object mode will always ignore the `encoding` -argument to [`stream.write(data, encoding)`][stream-write]. - -The special value `null` still retains its special value for object -mode streams. That is, for object mode readable streams, `null` as a -return value from [`stream.read()`][stream-read] indicates that there is no more -data, and [`stream.push(null)`][stream-push] will signal the end of stream data -(`EOF`). - -No streams in Node.js core are object mode streams. This pattern is only -used by userland streaming libraries. - -You should set `objectMode` in your stream child class constructor on -the options object. Setting `objectMode` mid-stream is not safe. - -For Duplex streams `objectMode` can be set exclusively for readable or -writable side with `readableObjectMode` and `writableObjectMode` -respectively. These options can be used to implement parsers and -serializers with Transform streams. - -```js -const util = require('util'); -const StringDecoder = require('string_decoder').StringDecoder; -const Transform = require('stream').Transform; -util.inherits(JSONParseStream, Transform); - -// Gets \n-delimited JSON string data, and emits the parsed objects -function JSONParseStream() { - if (!(this instanceof JSONParseStream)) - return new JSONParseStream(); - - Transform.call(this, { readableObjectMode : true }); - - this._buffer = ''; - this._decoder = new StringDecoder('utf8'); -} - -JSONParseStream.prototype._transform = function(chunk, encoding, cb) { - this._buffer += this._decoder.write(chunk); - // split on newlines - var lines = this._buffer.split(/\r?\n/); - // keep the last partial line buffered - this._buffer = lines.pop(); - for (var l = 0; l < lines.length; l++) { - var line = lines[l]; - try { - var obj = JSON.parse(line); - } catch (er) { - this.emit('error', er); - return; - } - // push the parsed object out to the readable consumer - this.push(obj); - } - cb(); -}; - -JSONParseStream.prototype._flush = function(cb) { - // Just handle any leftover - var rem = this._buffer.trim(); - if (rem) { - try { - var obj = JSON.parse(rem); - } catch (er) { - this.emit('error', er); - return; - } - // push the parsed object out to the readable consumer - this.push(obj); - } - cb(); -}; -``` - -### `stream.read(0)` - -There are some cases where you want to trigger a refresh of the -underlying readable stream mechanisms, without actually consuming any -data. In that case, you can call `stream.read(0)`, which will always -return null. - -If the internal read buffer is below the `highWaterMark`, and the -stream is not currently reading, then calling `stream.read(0)` will trigger -a low-level [`stream._read()`][stream-_read] call. - -There is almost never a need to do this. However, you will see some -cases in Node.js's internals where this is done, particularly in the -Readable stream class internals. - -### `stream.push('')` - -Pushing a zero-byte string or Buffer (when not in [Object mode][]) has an -interesting side effect. Because it *is* a call to -[`stream.push()`][stream-push], it will end the `reading` process. However, it -does *not* add any data to the readable buffer, so there's nothing for -a user to consume. - -Very rarely, there are cases where you have no data to provide now, -but the consumer of your stream (or, perhaps, another bit of your own -code) will know when to check again, by calling [`stream.read(0)`][stream-read]. -In those cases, you *may* call `stream.push('')`. - -So far, the only use case for this functionality is in the -[`tls.CryptoStream`][] class, which is deprecated in Node.js/io.js v1.0. If you -find that you have to use `stream.push('')`, please consider another -approach, because it almost certainly indicates that something is -horribly wrong. - -[`'data'`]: #stream_event_data -[`'drain'`]: #stream_event_drain -[`'end'`]: #stream_event_end -[`'finish'`]: #stream_event_finish -[`'readable'`]: #stream_event_readable -[`buf.toString(encoding)`]: https://nodejs.org/docs/v5.9.1/api/buffer.html#buffer_buf_tostring_encoding_start_end -[`EventEmitter`]: https://nodejs.org/docs/v5.9.1/api/events.html#events_class_eventemitter -[`process.stderr`]: https://nodejs.org/docs/v5.9.1/api/process.html#process_process_stderr -[`process.stdin`]: https://nodejs.org/docs/v5.9.1/api/process.html#process_process_stdin -[`process.stdout`]: https://nodejs.org/docs/v5.9.1/api/process.html#process_process_stdout -[`stream.cork()`]: #stream_writable_cork -[`stream.pipe()`]: #stream_readable_pipe_destination_options -[`stream.uncork()`]: #stream_writable_uncork -[`stream.unpipe()`]: #stream_readable_unpipe_destination -[`stream.wrap()`]: #stream_readable_wrap_stream -[`tls.CryptoStream`]: https://nodejs.org/docs/v5.9.1/api/tls.html#tls_class_cryptostream -[`util.inherits()`]: https://nodejs.org/docs/v5.9.1/api/util.html#util_util_inherits_constructor_superconstructor -[API for Stream Consumers]: #stream_api_for_stream_consumers -[API for Stream Implementors]: #stream_api_for_stream_implementors -[child process stdin]: https://nodejs.org/docs/v5.9.1/api/child_process.html#child_process_child_stdin -[child process stdout and stderr]: https://nodejs.org/docs/v5.9.1/api/child_process.html#child_process_child_stdout -[Compatibility]: #stream_compatibility_with_older_node_js_versions -[crypto]: crypto.html -[Duplex]: #stream_class_stream_duplex -[fs read streams]: https://nodejs.org/docs/v5.9.1/api/fs.html#fs_class_fs_readstream -[fs write streams]: https://nodejs.org/docs/v5.9.1/api/fs.html#fs_class_fs_writestream -[HTTP requests, on the client]: https://nodejs.org/docs/v5.9.1/api/http.html#http_class_http_clientrequest -[HTTP responses, on the server]: https://nodejs.org/docs/v5.9.1/api/http.html#http_class_http_serverresponse -[http-incoming-message]: https://nodejs.org/docs/v5.9.1/api/http.html#http_class_http_incomingmessage -[Object mode]: #stream_object_mode -[Readable]: #stream_class_stream_readable -[SimpleProtocol v2]: #stream_example_simpleprotocol_parser_v2 -[stream-_flush]: #stream_transform_flush_callback -[stream-_read]: #stream_readable_read_size_1 -[stream-_transform]: #stream_transform_transform_chunk_encoding_callback -[stream-_write]: #stream_writable_write_chunk_encoding_callback_1 -[stream-_writev]: #stream_writable_writev_chunks_callback -[stream-end]: #stream_writable_end_chunk_encoding_callback -[stream-pause]: #stream_readable_pause -[stream-push]: #stream_readable_push_chunk_encoding -[stream-read]: #stream_readable_read_size -[stream-resume]: #stream_readable_resume -[stream-write]: #stream_writable_write_chunk_encoding_callback -[TCP sockets]: https://nodejs.org/docs/v5.9.1/api/net.html#net_class_net_socket -[Transform]: #stream_class_stream_transform -[Writable]: #stream_class_stream_writable -[zlib]: zlib.html diff --git a/deps/npm/node_modules/readable-stream/doc/stream.md b/deps/npm/node_modules/readable-stream/doc/stream.md new file mode 100644 index 0000000000..c907ca0e7b --- /dev/null +++ b/deps/npm/node_modules/readable-stream/doc/stream.md @@ -0,0 +1,1772 @@ +# Stream + + Stability: 2 - Stable + +A stream is an abstract interface implemented by various objects in +Node.js. For example a [request to an HTTP server][http-incoming-message] is a +stream, as is [`process.stdout`][]. Streams are readable, writable, or both. All +streams are instances of [`EventEmitter`][]. + +You can load the Stream base classes by doing `require('stream')`. +There are base classes provided for [Readable][] streams, [Writable][] +streams, [Duplex][] streams, and [Transform][] streams. + +This document is split up into 3 sections: + +1. The first section explains the parts of the API that you need to be + aware of to use streams in your programs. +2. The second section explains the parts of the API that you need to + use if you implement your own custom streams yourself. The API is designed to + make this easy for you to do. +3. The third section goes into more depth about how streams work, + including some of the internal mechanisms and functions that you + should probably not modify unless you definitely know what you are + doing. + + +## API for Stream Consumers + + + +Streams can be either [Readable][], [Writable][], or both ([Duplex][]). + +All streams are EventEmitters, but they also have other custom methods +and properties depending on whether they are Readable, Writable, or +Duplex. + +If a stream is both Readable and Writable, then it implements all of +the methods and events. So, a [Duplex][] or [Transform][] stream is +fully described by this API, though their implementation may be +somewhat different. + +It is not necessary to implement Stream interfaces in order to consume +streams in your programs. If you **are** implementing streaming +interfaces in your own program, please also refer to +[API for Stream Implementors][]. + +Almost all Node.js programs, no matter how simple, use Streams in some +way. Here is an example of using Streams in an Node.js program: + +```js +const http = require('http'); + +var server = http.createServer( (req, res) => { + // req is an http.IncomingMessage, which is a Readable Stream + // res is an http.ServerResponse, which is a Writable Stream + + var body = ''; + // we want to get the data as utf8 strings + // If you don't set an encoding, then you'll get Buffer objects + req.setEncoding('utf8'); + + // Readable streams emit 'data' events once a listener is added + req.on('data', (chunk) => { + body += chunk; + }); + + // the end event tells you that you have entire body + req.on('end', () => { + try { + var data = JSON.parse(body); + } catch (er) { + // uh oh! bad json! + res.statusCode = 400; + return res.end(`error: ${er.message}`); + } + + // write back something interesting to the user: + res.write(typeof data); + res.end(); + }); +}); + +server.listen(1337); + +// $ curl localhost:1337 -d '{}' +// object +// $ curl localhost:1337 -d '"foo"' +// string +// $ curl localhost:1337 -d 'not json' +// error: Unexpected token o +``` + +### Class: stream.Duplex + +Duplex streams are streams that implement both the [Readable][] and +[Writable][] interfaces. + +Examples of Duplex streams include: + +* [TCP sockets][] +* [zlib streams][zlib] +* [crypto streams][crypto] + +### Class: stream.Readable + + + +The Readable stream interface is the abstraction for a *source* of +data that you are reading from. In other words, data comes *out* of a +Readable stream. + +A Readable stream will not start emitting data until you indicate that +you are ready to receive it. + +Readable streams have two "modes": a **flowing mode** and a **paused +mode**. When in flowing mode, data is read from the underlying system +and provided to your program as fast as possible. In paused mode, you +must explicitly call [`stream.read()`][stream-read] to get chunks of data out. +Streams start out in paused mode. + +**Note**: If no data event handlers are attached, and there are no +[`stream.pipe()`][] destinations, and the stream is switched into flowing +mode, then data will be lost. + +You can switch to flowing mode by doing any of the following: + +* Adding a [`'data'`][] event handler to listen for data. +* Calling the [`stream.resume()`][stream-resume] method to explicitly open the + flow. +* Calling the [`stream.pipe()`][] method to send the data to a [Writable][]. + +You can switch back to paused mode by doing either of the following: + +* If there are no pipe destinations, by calling the + [`stream.pause()`][stream-pause] method. +* If there are pipe destinations, by removing any [`'data'`][] event + handlers, and removing all pipe destinations by calling the + [`stream.unpipe()`][] method. + +Note that, for backwards compatibility reasons, removing [`'data'`][] +event handlers will **not** automatically pause the stream. Also, if +there are piped destinations, then calling [`stream.pause()`][stream-pause] will +not guarantee that the stream will *remain* paused once those +destinations drain and ask for more data. + +Examples of readable streams include: + +* [HTTP responses, on the client][http-incoming-message] +* [HTTP requests, on the server][http-incoming-message] +* [fs read streams][] +* [zlib streams][zlib] +* [crypto streams][crypto] +* [TCP sockets][] +* [child process stdout and stderr][] +* [`process.stdin`][] + +#### Event: 'close' + +Emitted when the stream and any of its underlying resources (a file +descriptor, for example) have been closed. The event indicates that +no more events will be emitted, and no further computation will occur. + +Not all streams will emit the `'close'` event as the `'close'` event is +optional. + +#### Event: 'data' + +* `chunk` {Buffer|String} The chunk of data. + +Attaching a `'data'` event listener to a stream that has not been +explicitly paused will switch the stream into flowing mode. Data will +then be passed as soon as it is available. + +If you just want to get all the data out of the stream as fast as +possible, this is the best way to do so. + +```js +var readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log('got %d bytes of data', chunk.length); +}); +``` + +#### Event: 'end' + +This event fires when there will be no more data to read. + +Note that the `'end'` event **will not fire** unless the data is +completely consumed. This can be done by switching into flowing mode, +or by calling [`stream.read()`][stream-read] repeatedly until you get to the +end. + +```js +var readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log('got %d bytes of data', chunk.length); +}); +readable.on('end', () => { + console.log('there will be no more data.'); +}); +``` + +#### Event: 'error' + +* {Error} + +Emitted if there was an error receiving data. + +#### Event: 'readable' + +When a chunk of data can be read from the stream, it will emit a +`'readable'` event. + +In some cases, listening for a `'readable'` event will cause some data +to be read into the internal buffer from the underlying system, if it +hadn't already. + +```javascript +var readable = getReadableStreamSomehow(); +readable.on('readable', () => { + // there is some data to read now +}); +``` + +Once the internal buffer is drained, a `'readable'` event will fire +again when more data is available. + +The `'readable'` event is not emitted in the "flowing" mode with the +sole exception of the last one, on end-of-stream. + +The `'readable'` event indicates that the stream has new information: +either new data is available or the end of the stream has been reached. +In the former case, [`stream.read()`][stream-read] will return that data. In the +latter case, [`stream.read()`][stream-read] will return null. For instance, in +the following example, `foo.txt` is an empty file: + +```js +const fs = require('fs'); +var rr = fs.createReadStream('foo.txt'); +rr.on('readable', () => { + console.log('readable:', rr.read()); +}); +rr.on('end', () => { + console.log('end'); +}); +``` + +The output of running this script is: + +``` +$ node test.js +readable: null +end +``` + +#### readable.isPaused() + +* Return: {Boolean} + +This method returns whether or not the `readable` has been **explicitly** +paused by client code (using [`stream.pause()`][stream-pause] without a +corresponding [`stream.resume()`][stream-resume]). + +```js +var readable = new stream.Readable + +readable.isPaused() // === false +readable.pause() +readable.isPaused() // === true +readable.resume() +readable.isPaused() // === false +``` + +#### readable.pause() + +* Return: `this` + +This method will cause a stream in flowing mode to stop emitting +[`'data'`][] events, switching out of flowing mode. Any data that becomes +available will remain in the internal buffer. + +```js +var readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log('got %d bytes of data', chunk.length); + readable.pause(); + console.log('there will be no more data for 1 second'); + setTimeout(() => { + console.log('now data will start flowing again'); + readable.resume(); + }, 1000); +}); +``` + +#### readable.pipe(destination[, options]) + +* `destination` {stream.Writable} The destination for writing data +* `options` {Object} Pipe options + * `end` {Boolean} End the writer when the reader ends. Default = `true` + +This method pulls all the data out of a readable stream, and writes it +to the supplied destination, automatically managing the flow so that +the destination is not overwhelmed by a fast readable stream. + +Multiple destinations can be piped to safely. + +```js +var readable = getReadableStreamSomehow(); +var writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt' +readable.pipe(writable); +``` + +This function returns the destination stream, so you can set up pipe +chains like so: + +```js +var r = fs.createReadStream('file.txt'); +var z = zlib.createGzip(); +var w = fs.createWriteStream('file.txt.gz'); +r.pipe(z).pipe(w); +``` + +For example, emulating the Unix `cat` command: + +```js +process.stdin.pipe(process.stdout); +``` + +By default [`stream.end()`][stream-end] is called on the destination when the +source stream emits [`'end'`][], so that `destination` is no longer writable. +Pass `{ end: false }` as `options` to keep the destination stream open. + +This keeps `writer` open so that "Goodbye" can be written at the +end. + +```js +reader.pipe(writer, { end: false }); +reader.on('end', () => { + writer.end('Goodbye\n'); +}); +``` + +Note that [`process.stderr`][] and [`process.stdout`][] are never closed until +the process exits, regardless of the specified options. + +#### readable.read([size]) + +* `size` {Number} Optional argument to specify how much data to read. +* Return {String|Buffer|Null} + +The `read()` method pulls some data out of the internal buffer and +returns it. If there is no data available, then it will return +`null`. + +If you pass in a `size` argument, then it will return that many +bytes. If `size` bytes are not available, then it will return `null`, +unless we've ended, in which case it will return the data remaining +in the buffer. + +If you do not specify a `size` argument, then it will return all the +data in the internal buffer. + +This method should only be called in paused mode. In flowing mode, +this method is called automatically until the internal buffer is +drained. + +```js +var readable = getReadableStreamSomehow(); +readable.on('readable', () => { + var chunk; + while (null !== (chunk = readable.read())) { + console.log('got %d bytes of data', chunk.length); + } +}); +``` + +If this method returns a data chunk, then it will also trigger the +emission of a [`'data'`][] event. + +Note that calling [`stream.read([size])`][stream-read] after the [`'end'`][] +event has been triggered will return `null`. No runtime error will be raised. + +#### readable.resume() + +* Return: `this` + +This method will cause the readable stream to resume emitting [`'data'`][] +events. + +This method will switch the stream into flowing mode. If you do *not* +want to consume the data from a stream, but you *do* want to get to +its [`'end'`][] event, you can call [`stream.resume()`][stream-resume] to open +the flow of data. + +```js +var readable = getReadableStreamSomehow(); +readable.resume(); +readable.on('end', () => { + console.log('got to the end, but did not read anything'); +}); +``` + +#### readable.setEncoding(encoding) + +* `encoding` {String} The encoding to use. +* Return: `this` + +Call this function to cause the stream to return strings of the specified +encoding instead of Buffer objects. For example, if you do +`readable.setEncoding('utf8')`, then the output data will be interpreted as +UTF-8 data, and returned as strings. If you do `readable.setEncoding('hex')`, +then the data will be encoded in hexadecimal string format. + +This properly handles multi-byte characters that would otherwise be +potentially mangled if you simply pulled the Buffers directly and +called [`buf.toString(encoding)`][] on them. If you want to read the data +as strings, always use this method. + +Also you can disable any encoding at all with `readable.setEncoding(null)`. +This approach is very useful if you deal with binary data or with large +multi-byte strings spread out over multiple chunks. + +```js +var readable = getReadableStreamSomehow(); +readable.setEncoding('utf8'); +readable.on('data', (chunk) => { + assert.equal(typeof chunk, 'string'); + console.log('got %d characters of string data', chunk.length); +}); +``` + +#### readable.unpipe([destination]) + +* `destination` {stream.Writable} Optional specific stream to unpipe + +This method will remove the hooks set up for a previous [`stream.pipe()`][] +call. + +If the destination is not specified, then all pipes are removed. + +If the destination is specified, but no pipe is set up for it, then +this is a no-op. + +```js +var readable = getReadableStreamSomehow(); +var writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt', +// but only for the first second +readable.pipe(writable); +setTimeout(() => { + console.log('stop writing to file.txt'); + readable.unpipe(writable); + console.log('manually close the file stream'); + writable.end(); +}, 1000); +``` + +#### readable.unshift(chunk) + +* `chunk` {Buffer|String} Chunk of data to unshift onto the read queue + +This is useful in certain cases where a stream is being consumed by a +parser, which needs to "un-consume" some data that it has +optimistically pulled out of the source, so that the stream can be +passed on to some other party. + +Note that `stream.unshift(chunk)` cannot be called after the [`'end'`][] event +has been triggered; a runtime error will be raised. + +If you find that you must often call `stream.unshift(chunk)` in your +programs, consider implementing a [Transform][] stream instead. (See [API +for Stream Implementors][].) + +```js +// Pull off a header delimited by \n\n +// use unshift() if we get too much +// Call the callback with (error, header, stream) +const StringDecoder = require('string_decoder').StringDecoder; +function parseHeader(stream, callback) { + stream.on('error', callback); + stream.on('readable', onReadable); + var decoder = new StringDecoder('utf8'); + var header = ''; + function onReadable() { + var chunk; + while (null !== (chunk = stream.read())) { + var str = decoder.write(chunk); + if (str.match(/\n\n/)) { + // found the header boundary + var split = str.split(/\n\n/); + header += split.shift(); + var remaining = split.join('\n\n'); + var buf = Buffer.from(remaining, 'utf8'); + if (buf.length) + stream.unshift(buf); + stream.removeListener('error', callback); + stream.removeListener('readable', onReadable); + // now the body of the message can be read from the stream. + callback(null, header, stream); + } else { + // still reading the header. + header += str; + } + } + } +} +``` + +Note that, unlike [`stream.push(chunk)`][stream-push], `stream.unshift(chunk)` +will not end the reading process by resetting the internal reading state of the +stream. This can cause unexpected results if `unshift()` is called during a +read (i.e. from within a [`stream._read()`][stream-_read] implementation on a +custom stream). Following the call to `unshift()` with an immediate +[`stream.push('')`][stream-push] will reset the reading state appropriately, +however it is best to simply avoid calling `unshift()` while in the process of +performing a read. + +#### readable.wrap(stream) + +* `stream` {Stream} An "old style" readable stream + +Versions of Node.js prior to v0.10 had streams that did not implement the +entire Streams API as it is today. (See [Compatibility][] for +more information.) + +If you are using an older Node.js library that emits [`'data'`][] events and +has a [`stream.pause()`][stream-pause] method that is advisory only, then you +can use the `wrap()` method to create a [Readable][] stream that uses the old +stream as its data source. + +You will very rarely ever need to call this function, but it exists +as a convenience for interacting with old Node.js programs and libraries. + +For example: + +```js +const OldReader = require('./old-api-module.js').OldReader; +const Readable = require('stream').Readable; +const oreader = new OldReader; +const myReader = new Readable().wrap(oreader); + +myReader.on('readable', () => { + myReader.read(); // etc. +}); +``` + +### Class: stream.Transform + +Transform streams are [Duplex][] streams where the output is in some way +computed from the input. They implement both the [Readable][] and +[Writable][] interfaces. + +Examples of Transform streams include: + +* [zlib streams][zlib] +* [crypto streams][crypto] + +### Class: stream.Writable + + + +The Writable stream interface is an abstraction for a *destination* +that you are writing data *to*. + +Examples of writable streams include: + +* [HTTP requests, on the client][] +* [HTTP responses, on the server][] +* [fs write streams][] +* [zlib streams][zlib] +* [crypto streams][crypto] +* [TCP sockets][] +* [child process stdin][] +* [`process.stdout`][], [`process.stderr`][] + +#### Event: 'close' + +Emitted when the stream and any of its underlying resources (a file descriptor, +for example) have been closed. The event indicates that no more events will be +emitted, and no further computation will occur. + +Not all streams will emit the `'close'` event as the `'close'` event is +optional. + +#### Event: 'drain' + +If a [`stream.write(chunk)`][stream-write] call returns `false`, then the +`'drain'` event will indicate when it is appropriate to begin writing more data +to the stream. + +```js +// Write the data to the supplied writable stream one million times. +// Be attentive to back-pressure. +function writeOneMillionTimes(writer, data, encoding, callback) { + var i = 1000000; + write(); + function write() { + var ok = true; + do { + i -= 1; + if (i === 0) { + // last time! + writer.write(data, encoding, callback); + } else { + // see if we should continue, or wait + // don't pass the callback, because we're not done yet. + ok = writer.write(data, encoding); + } + } while (i > 0 && ok); + if (i > 0) { + // had to stop early! + // write some more once it drains + writer.once('drain', write); + } + } +} +``` + +#### Event: 'error' + +* {Error} + +Emitted if there was an error when writing or piping data. + +#### Event: 'finish' + +When the [`stream.end()`][stream-end] method has been called, and all data has +been flushed to the underlying system, this event is emitted. + +```javascript +var writer = getWritableStreamSomehow(); +for (var i = 0; i < 100; i ++) { + writer.write('hello, #${i}!\n'); +} +writer.end('this is the end\n'); +writer.on('finish', () => { + console.error('all writes are now complete.'); +}); +``` + +#### Event: 'pipe' + +* `src` {stream.Readable} source stream that is piping to this writable + +This is emitted whenever the [`stream.pipe()`][] method is called on a readable +stream, adding this writable to its set of destinations. + +```js +var writer = getWritableStreamSomehow(); +var reader = getReadableStreamSomehow(); +writer.on('pipe', (src) => { + console.error('something is piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +``` + +#### Event: 'unpipe' + +* `src` {[Readable][] Stream} The source stream that + [unpiped][`stream.unpipe()`] this writable + +This is emitted whenever the [`stream.unpipe()`][] method is called on a +readable stream, removing this writable from its set of destinations. + +```js +var writer = getWritableStreamSomehow(); +var reader = getReadableStreamSomehow(); +writer.on('unpipe', (src) => { + console.error('something has stopped piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +reader.unpipe(writer); +``` + +#### writable.cork() + +Forces buffering of all writes. + +Buffered data will be flushed either at [`stream.uncork()`][] or at +[`stream.end()`][stream-end] call. + +#### writable.end([chunk][, encoding][, callback]) + +* `chunk` {String|Buffer} Optional data to write +* `encoding` {String} The encoding, if `chunk` is a String +* `callback` {Function} Optional callback for when the stream is finished + +Call this method when no more data will be written to the stream. If supplied, +the callback is attached as a listener on the [`'finish'`][] event. + +Calling [`stream.write()`][stream-write] after calling +[`stream.end()`][stream-end] will raise an error. + +```js +// write 'hello, ' and then end with 'world!' +var file = fs.createWriteStream('example.txt'); +file.write('hello, '); +file.end('world!'); +// writing more now is not allowed! +``` + +#### writable.setDefaultEncoding(encoding) + +* `encoding` {String} The new default encoding +* Return: `this` + +Sets the default encoding for a writable stream. + +#### writable.uncork() + +Flush all data, buffered since [`stream.cork()`][] call. + +#### writable.write(chunk[, encoding][, callback]) + +* `chunk` {String|Buffer} The data to write +* `encoding` {String} The encoding, if `chunk` is a String +* `callback` {Function} Callback for when this chunk of data is flushed +* Returns: {Boolean} `true` if the data was handled completely. + +This method writes some data to the underlying system, and calls the +supplied callback once the data has been fully handled. If an error +occurs, the callback may or may not be called with the error as its +first argument. To detect write errors, listen for the `'error'` event. + +The return value indicates if you should continue writing right now. +If the data had to be buffered internally, then it will return +`false`. Otherwise, it will return `true`. + +This return value is strictly advisory. You MAY continue to write, +even if it returns `false`. However, writes will be buffered in +memory, so it is best not to do this excessively. Instead, wait for +the [`'drain'`][] event before writing more data. + + +## API for Stream Implementors + + + +To implement any sort of stream, the pattern is the same: + +1. Extend the appropriate parent class in your own subclass. (The + [`util.inherits()`][] method is particularly helpful for this.) +2. Call the appropriate parent class constructor in your constructor, + to be sure that the internal mechanisms are set up properly. +3. Implement one or more specific methods, as detailed below. + +The class to extend and the method(s) to implement depend on the sort +of stream class you are writing: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    Use-case

    +
    +

    Class

    +
    +

    Method(s) to implement

    +
    +

    Reading only

    +
    +

    [Readable](#stream_class_stream_readable_1)

    +
    +

    [_read][stream-_read]

    +
    +

    Writing only

    +
    +

    [Writable](#stream_class_stream_writable_1)

    +
    +

    [_write][stream-_write], [_writev][stream-_writev]

    +
    +

    Reading and writing

    +
    +

    [Duplex](#stream_class_stream_duplex_1)

    +
    +

    [_read][stream-_read], [_write][stream-_write], [_writev][stream-_writev]

    +
    +

    Operate on written data, then read the result

    +
    +

    [Transform](#stream_class_stream_transform_1)

    +
    +

    [_transform][stream-_transform], [_flush][stream-_flush]

    +
    + +In your implementation code, it is very important to never call the methods +described in [API for Stream Consumers][]. Otherwise, you can potentially cause +adverse side effects in programs that consume your streaming interfaces. + +### Class: stream.Duplex + + + +A "duplex" stream is one that is both Readable and Writable, such as a TCP +socket connection. + +Note that `stream.Duplex` is an abstract class designed to be extended +with an underlying implementation of the [`stream._read(size)`][stream-_read] +and [`stream._write(chunk, encoding, callback)`][stream-_write] methods as you +would with a Readable or Writable stream class. + +Since JavaScript doesn't have multiple prototypal inheritance, this class +prototypally inherits from Readable, and then parasitically from Writable. It is +thus up to the user to implement both the low-level +[`stream._read(n)`][stream-_read] method as well as the low-level +[`stream._write(chunk, encoding, callback)`][stream-_write] method on extension +duplex classes. + +#### new stream.Duplex(options) + +* `options` {Object} Passed to both Writable and Readable + constructors. Also has the following fields: + * `allowHalfOpen` {Boolean} Default = `true`. If set to `false`, then + the stream will automatically end the readable side when the + writable side ends and vice versa. + * `readableObjectMode` {Boolean} Default = `false`. Sets `objectMode` + for readable side of the stream. Has no effect if `objectMode` + is `true`. + * `writableObjectMode` {Boolean} Default = `false`. Sets `objectMode` + for writable side of the stream. Has no effect if `objectMode` + is `true`. + +In classes that extend the Duplex class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +### Class: stream.PassThrough + +This is a trivial implementation of a [Transform][] stream that simply +passes the input bytes across to the output. Its purpose is mainly +for examples and testing, but there are occasionally use cases where +it can come in handy as a building block for novel sorts of streams. + +### Class: stream.Readable + + + +`stream.Readable` is an abstract class designed to be extended with an +underlying implementation of the [`stream._read(size)`][stream-_read] method. + +Please see [API for Stream Consumers][] for how to consume +streams in your programs. What follows is an explanation of how to +implement Readable streams in your programs. + +#### new stream.Readable([options]) + +* `options` {Object} + * `highWaterMark` {Number} The maximum number of bytes to store in + the internal buffer before ceasing to read from the underlying + resource. Default = `16384` (16kb), or `16` for `objectMode` streams + * `encoding` {String} If specified, then buffers will be decoded to + strings using the specified encoding. Default = `null` + * `objectMode` {Boolean} Whether this stream should behave + as a stream of objects. Meaning that [`stream.read(n)`][stream-read] returns + a single value instead of a Buffer of size n. Default = `false` + * `read` {Function} Implementation for the [`stream._read()`][stream-_read] + method. + +In classes that extend the Readable class, make sure to call the +Readable constructor so that the buffering settings can be properly +initialized. + +#### readable.\_read(size) + +* `size` {Number} Number of bytes to read asynchronously + +Note: **Implement this method, but do NOT call it directly.** + +This method is prefixed with an underscore because it is internal to the +class that defines it and should only be called by the internal Readable +class methods. All Readable stream implementations must provide a \_read +method to fetch data from the underlying resource. + +When `_read()` is called, if data is available from the resource, the `_read()` +implementation should start pushing that data into the read queue by calling +[`this.push(dataChunk)`][stream-push]. `_read()` should continue reading from +the resource and pushing data until push returns `false`, at which point it +should stop reading from the resource. Only when `_read()` is called again after +it has stopped should it start reading more data from the resource and pushing +that data onto the queue. + +Note: once the `_read()` method is called, it will not be called again until +the [`stream.push()`][stream-push] method is called. + +The `size` argument is advisory. Implementations where a "read" is a +single call that returns data can use this to know how much data to +fetch. Implementations where that is not relevant, such as TCP or +TLS, may ignore this argument, and simply provide data whenever it +becomes available. There is no need, for example to "wait" until +`size` bytes are available before calling [`stream.push(chunk)`][stream-push]. + +#### readable.push(chunk[, encoding]) + + +* `chunk` {Buffer|Null|String} Chunk of data to push into the read queue +* `encoding` {String} Encoding of String chunks. Must be a valid + Buffer encoding, such as `'utf8'` or `'ascii'` +* return {Boolean} Whether or not more pushes should be performed + +Note: **This method should be called by Readable implementors, NOT +by consumers of Readable streams.** + +If a value other than null is passed, The `push()` method adds a chunk of data +into the queue for subsequent stream processors to consume. If `null` is +passed, it signals the end of the stream (EOF), after which no more data +can be written. + +The data added with `push()` can be pulled out by calling the +[`stream.read()`][stream-read] method when the [`'readable'`][] event fires. + +This API is designed to be as flexible as possible. For example, +you may be wrapping a lower-level source which has some sort of +pause/resume mechanism, and a data callback. In those cases, you +could wrap the low-level source object by doing something like this: + +```js +// source is an object with readStop() and readStart() methods, +// and an `ondata` member that gets called when it has data, and +// an `onend` member that gets called when the data is over. + +util.inherits(SourceWrapper, Readable); + +function SourceWrapper(options) { + Readable.call(this, options); + + this._source = getLowlevelSourceObject(); + + // Every time there's data, we push it into the internal buffer. + this._source.ondata = (chunk) => { + // if push() returns false, then we need to stop reading from source + if (!this.push(chunk)) + this._source.readStop(); + }; + + // When the source ends, we push the EOF-signaling `null` chunk + this._source.onend = () => { + this.push(null); + }; +} + +// _read will be called when the stream wants to pull more data in +// the advisory size argument is ignored in this case. +SourceWrapper.prototype._read = function(size) { + this._source.readStart(); +}; +``` + +#### Example: A Counting Stream + + + +This is a basic example of a Readable stream. It emits the numerals +from 1 to 1,000,000 in ascending order, and then ends. + +```js +const Readable = require('stream').Readable; +const util = require('util'); +util.inherits(Counter, Readable); + +function Counter(opt) { + Readable.call(this, opt); + this._max = 1000000; + this._index = 1; +} + +Counter.prototype._read = function() { + var i = this._index++; + if (i > this._max) + this.push(null); + else { + var str = '' + i; + var buf = Buffer.from(str, 'ascii'); + this.push(buf); + } +}; +``` + +#### Example: SimpleProtocol v1 (Sub-optimal) + +This is similar to the `parseHeader` function described +[here](#stream_readable_unshift_chunk), but implemented as a custom stream. +Also, note that this implementation does not convert the incoming data to a +string. + +However, this would be better implemented as a [Transform][] stream. See +[SimpleProtocol v2][] for a better implementation. + +```js +// A parser for a simple data protocol. +// The "header" is a JSON object, followed by 2 \n characters, and +// then a message body. +// +// NOTE: This can be done more simply as a Transform stream! +// Using Readable directly for this is sub-optimal. See the +// alternative example below under the Transform section. + +const Readable = require('stream').Readable; +const util = require('util'); + +util.inherits(SimpleProtocol, Readable); + +function SimpleProtocol(source, options) { + if (!(this instanceof SimpleProtocol)) + return new SimpleProtocol(source, options); + + Readable.call(this, options); + this._inBody = false; + this._sawFirstCr = false; + + // source is a readable stream, such as a socket or file + this._source = source; + + source.on('end', () => { + this.push(null); + }); + + // give it a kick whenever the source is readable + // read(0) will not consume any bytes + source.on('readable', () => { + this.read(0); + }); + + this._rawHeader = []; + this.header = null; +} + +SimpleProtocol.prototype._read = function(n) { + if (!this._inBody) { + var chunk = this._source.read(); + + // if the source doesn't have data, we don't have data yet. + if (chunk === null) + return this.push(''); + + // check if the chunk has a \n\n + var split = -1; + for (var i = 0; i < chunk.length; i++) { + if (chunk[i] === 10) { // '\n' + if (this._sawFirstCr) { + split = i; + break; + } else { + this._sawFirstCr = true; + } + } else { + this._sawFirstCr = false; + } + } + + if (split === -1) { + // still waiting for the \n\n + // stash the chunk, and try again. + this._rawHeader.push(chunk); + this.push(''); + } else { + this._inBody = true; + var h = chunk.slice(0, split); + this._rawHeader.push(h); + var header = Buffer.concat(this._rawHeader).toString(); + try { + this.header = JSON.parse(header); + } catch (er) { + this.emit('error', new Error('invalid simple protocol data')); + return; + } + // now, because we got some extra data, unshift the rest + // back into the read queue so that our consumer will see it. + var b = chunk.slice(split); + this.unshift(b); + // calling unshift by itself does not reset the reading state + // of the stream; since we're inside _read, doing an additional + // push('') will reset the state appropriately. + this.push(''); + + // and let them know that we are done parsing the header. + this.emit('header', this.header); + } + } else { + // from there on, just provide the data to our consumer. + // careful not to push(null), since that would indicate EOF. + var chunk = this._source.read(); + if (chunk) this.push(chunk); + } +}; + +// Usage: +// var parser = new SimpleProtocol(source); +// Now parser is a readable stream that will emit 'header' +// with the parsed header data. +``` + +### Class: stream.Transform + +A "transform" stream is a duplex stream where the output is causally +connected in some way to the input, such as a [zlib][] stream or a +[crypto][] stream. + +There is no requirement that the output be the same size as the input, +the same number of chunks, or arrive at the same time. For example, a +Hash stream will only ever have a single chunk of output which is +provided when the input is ended. A zlib stream will produce output +that is either much smaller or much larger than its input. + +Rather than implement the [`stream._read()`][stream-_read] and +[`stream._write()`][stream-_write] methods, Transform classes must implement the +[`stream._transform()`][stream-_transform] method, and may optionally +also implement the [`stream._flush()`][stream-_flush] method. (See below.) + +#### new stream.Transform([options]) + +* `options` {Object} Passed to both Writable and Readable + constructors. Also has the following fields: + * `transform` {Function} Implementation for the + [`stream._transform()`][stream-_transform] method. + * `flush` {Function} Implementation for the [`stream._flush()`][stream-_flush] + method. + +In classes that extend the Transform class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +#### Events: 'finish' and 'end' + +The [`'finish'`][] and [`'end'`][] events are from the parent Writable +and Readable classes respectively. The `'finish'` event is fired after +[`stream.end()`][stream-end] is called and all chunks have been processed by +[`stream._transform()`][stream-_transform], `'end'` is fired after all data has +been output which is after the callback in [`stream._flush()`][stream-_flush] +has been called. + +#### transform.\_flush(callback) + +* `callback` {Function} Call this function (optionally with an error + argument) when you are done flushing any remaining data. + +Note: **This function MUST NOT be called directly.** It MAY be implemented +by child classes, and if so, will be called by the internal Transform +class methods only. + +In some cases, your transform operation may need to emit a bit more +data at the end of the stream. For example, a `Zlib` compression +stream will store up some internal state so that it can optimally +compress the output. At the end, however, it needs to do the best it +can with what is left, so that the data will be complete. + +In those cases, you can implement a `_flush()` method, which will be +called at the very end, after all the written data is consumed, but +before emitting [`'end'`][] to signal the end of the readable side. Just +like with [`stream._transform()`][stream-_transform], call +`transform.push(chunk)` zero or more times, as appropriate, and call `callback` +when the flush operation is complete. + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### transform.\_transform(chunk, encoding, callback) + +* `chunk` {Buffer|String} The chunk to be transformed. Will **always** + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` {String} If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` {Function} Call this function (optionally with an error + argument and data) when you are done processing the supplied chunk. + +Note: **This function MUST NOT be called directly.** It should be +implemented by child classes, and called by the internal Transform +class methods only. + +All Transform stream implementations must provide a `_transform()` +method to accept input and produce output. + +`_transform()` should do whatever has to be done in this specific +Transform class, to handle the bytes being written, and pass them off +to the readable portion of the interface. Do asynchronous I/O, +process things, and so on. + +Call `transform.push(outputChunk)` 0 or more times to generate output +from this input chunk, depending on how much data you want to output +as a result of this chunk. + +Call the callback function only when the current chunk is completely +consumed. Note that there may or may not be output as a result of any +particular input chunk. If you supply a second argument to the callback +it will be passed to the push method. In other words the following are +equivalent: + +```js +transform.prototype._transform = function (data, encoding, callback) { + this.push(data); + callback(); +}; + +transform.prototype._transform = function (data, encoding, callback) { + callback(null, data); +}; +``` + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### Example: `SimpleProtocol` parser v2 + +The example [here](#stream_example_simpleprotocol_v1_sub_optimal) of a simple +protocol parser can be implemented simply by using the higher level +[Transform][] stream class, similar to the `parseHeader` and `SimpleProtocol +v1` examples. + +In this example, rather than providing the input as an argument, it +would be piped into the parser, which is a more idiomatic Node.js stream +approach. + +```javascript +const util = require('util'); +const Transform = require('stream').Transform; +util.inherits(SimpleProtocol, Transform); + +function SimpleProtocol(options) { + if (!(this instanceof SimpleProtocol)) + return new SimpleProtocol(options); + + Transform.call(this, options); + this._inBody = false; + this._sawFirstCr = false; + this._rawHeader = []; + this.header = null; +} + +SimpleProtocol.prototype._transform = function(chunk, encoding, done) { + if (!this._inBody) { + // check if the chunk has a \n\n + var split = -1; + for (var i = 0; i < chunk.length; i++) { + if (chunk[i] === 10) { // '\n' + if (this._sawFirstCr) { + split = i; + break; + } else { + this._sawFirstCr = true; + } + } else { + this._sawFirstCr = false; + } + } + + if (split === -1) { + // still waiting for the \n\n + // stash the chunk, and try again. + this._rawHeader.push(chunk); + } else { + this._inBody = true; + var h = chunk.slice(0, split); + this._rawHeader.push(h); + var header = Buffer.concat(this._rawHeader).toString(); + try { + this.header = JSON.parse(header); + } catch (er) { + this.emit('error', new Error('invalid simple protocol data')); + return; + } + // and let them know that we are done parsing the header. + this.emit('header', this.header); + + // now, because we got some extra data, emit this first. + this.push(chunk.slice(split)); + } + } else { + // from there on, just provide the data to our consumer as-is. + this.push(chunk); + } + done(); +}; + +// Usage: +// var parser = new SimpleProtocol(); +// source.pipe(parser) +// Now parser is a readable stream that will emit 'header' +// with the parsed header data. +``` + +### Class: stream.Writable + + + +`stream.Writable` is an abstract class designed to be extended with an +underlying implementation of the +[`stream._write(chunk, encoding, callback)`][stream-_write] method. + +Please see [API for Stream Consumers][] for how to consume +writable streams in your programs. What follows is an explanation of +how to implement Writable streams in your programs. + +#### new stream.Writable([options]) + +* `options` {Object} + * `highWaterMark` {Number} Buffer level when + [`stream.write()`][stream-write] starts returning `false`. Default = `16384` + (16kb), or `16` for `objectMode` streams. + * `decodeStrings` {Boolean} Whether or not to decode strings into + Buffers before passing them to [`stream._write()`][stream-_write]. + Default = `true` + * `objectMode` {Boolean} Whether or not the + [`stream.write(anyObj)`][stream-write] is a valid operation. If set you can + write arbitrary data instead of only `Buffer` / `String` data. + Default = `false` + * `write` {Function} Implementation for the + [`stream._write()`][stream-_write] method. + * `writev` {Function} Implementation for the + [`stream._writev()`][stream-_writev] method. + +In classes that extend the Writable class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +#### writable.\_write(chunk, encoding, callback) + +* `chunk` {Buffer|String} The chunk to be written. Will **always** + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` {String} If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` {Function} Call this function (optionally with an error + argument) when you are done processing the supplied chunk. + +All Writable stream implementations must provide a +[`stream._write()`][stream-_write] method to send data to the underlying +resource. + +Note: **This function MUST NOT be called directly.** It should be +implemented by child classes, and called by the internal Writable +class methods only. + +Call the callback using the standard `callback(error)` pattern to +signal that the write completed successfully or with an error. + +If the `decodeStrings` flag is set in the constructor options, then +`chunk` may be a string rather than a Buffer, and `encoding` will +indicate the sort of string that it is. This is to support +implementations that have an optimized handling for certain string +data encodings. If you do not explicitly set the `decodeStrings` +option to `false`, then you can safely ignore the `encoding` argument, +and assume that `chunk` will always be a Buffer. + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### writable.\_writev(chunks, callback) + +* `chunks` {Array} The chunks to be written. Each chunk has following + format: `{ chunk: ..., encoding: ... }`. +* `callback` {Function} Call this function (optionally with an error + argument) when you are done processing the supplied chunks. + +Note: **This function MUST NOT be called directly.** It may be +implemented by child classes, and called by the internal Writable +class methods only. + +This function is completely optional to implement. In most cases it is +unnecessary. If implemented, it will be called with all the chunks +that are buffered in the write queue. + + +## Simplified Constructor API + + + +In simple cases there is now the added benefit of being able to construct a +stream without inheritance. + +This can be done by passing the appropriate methods as constructor options: + +Examples: + +### Duplex + +```js +var duplex = new stream.Duplex({ + read: function(n) { + // sets this._read under the hood + + // push data onto the read queue, passing null + // will signal the end of the stream (EOF) + this.push(chunk); + }, + write: function(chunk, encoding, next) { + // sets this._write under the hood + + // An optional error can be passed as the first argument + next() + } +}); + +// or + +var duplex = new stream.Duplex({ + read: function(n) { + // sets this._read under the hood + + // push data onto the read queue, passing null + // will signal the end of the stream (EOF) + this.push(chunk); + }, + writev: function(chunks, next) { + // sets this._writev under the hood + + // An optional error can be passed as the first argument + next() + } +}); +``` + +### Readable + +```js +var readable = new stream.Readable({ + read: function(n) { + // sets this._read under the hood + + // push data onto the read queue, passing null + // will signal the end of the stream (EOF) + this.push(chunk); + } +}); +``` + +### Transform + +```js +var transform = new stream.Transform({ + transform: function(chunk, encoding, next) { + // sets this._transform under the hood + + // generate output as many times as needed + // this.push(chunk); + + // call when the current chunk is consumed + next(); + }, + flush: function(done) { + // sets this._flush under the hood + + // generate output as many times as needed + // this.push(chunk); + + done(); + } +}); +``` + +### Writable + +```js +var writable = new stream.Writable({ + write: function(chunk, encoding, next) { + // sets this._write under the hood + + // An optional error can be passed as the first argument + next() + } +}); + +// or + +var writable = new stream.Writable({ + writev: function(chunks, next) { + // sets this._writev under the hood + + // An optional error can be passed as the first argument + next() + } +}); +``` + +## Streams: Under the Hood + + + +### Buffering + + + +Both Writable and Readable streams will buffer data on an internal +object which can be retrieved from `_writableState.getBuffer()` or +`_readableState.buffer`, respectively. + +The amount of data that will potentially be buffered depends on the +`highWaterMark` option which is passed into the constructor. + +Buffering in Readable streams happens when the implementation calls +[`stream.push(chunk)`][stream-push]. If the consumer of the Stream does not +call [`stream.read()`][stream-read], then the data will sit in the internal +queue until it is consumed. + +Buffering in Writable streams happens when the user calls +[`stream.write(chunk)`][stream-write] repeatedly, even when it returns `false`. + +The purpose of streams, especially with the [`stream.pipe()`][] method, is to +limit the buffering of data to acceptable levels, so that sources and +destinations of varying speed will not overwhelm the available memory. + +### Compatibility with Older Node.js Versions + + + +In versions of Node.js prior to v0.10, the Readable stream interface was +simpler, but also less powerful and less useful. + +* Rather than waiting for you to call the [`stream.read()`][stream-read] method, + [`'data'`][] events would start emitting immediately. If you needed to do + some I/O to decide how to handle data, then you had to store the chunks + in some kind of buffer so that they would not be lost. +* The [`stream.pause()`][stream-pause] method was advisory, rather than + guaranteed. This meant that you still had to be prepared to receive + [`'data'`][] events even when the stream was in a paused state. + +In Node.js v0.10, the [Readable][] class was added. +For backwards compatibility with older Node.js programs, Readable streams +switch into "flowing mode" when a [`'data'`][] event handler is added, or +when the [`stream.resume()`][stream-resume] method is called. The effect is +that, even if you are not using the new [`stream.read()`][stream-read] method +and [`'readable'`][] event, you no longer have to worry about losing +[`'data'`][] chunks. + +Most programs will continue to function normally. However, this +introduces an edge case in the following conditions: + +* No [`'data'`][] event handler is added. +* The [`stream.resume()`][stream-resume] method is never called. +* The stream is not piped to any writable destination. + +For example, consider the following code: + +```js +// WARNING! BROKEN! +net.createServer((socket) => { + + // we add an 'end' method, but never consume the data + socket.on('end', () => { + // It will never get here. + socket.end('I got your message (but didnt read it)\n'); + }); + +}).listen(1337); +``` + +In versions of Node.js prior to v0.10, the incoming message data would be +simply discarded. However, in Node.js v0.10 and beyond, +the socket will remain paused forever. + +The workaround in this situation is to call the +[`stream.resume()`][stream-resume] method to start the flow of data: + +```js +// Workaround +net.createServer((socket) => { + + socket.on('end', () => { + socket.end('I got your message (but didnt read it)\n'); + }); + + // start the flow of data, discarding it. + socket.resume(); + +}).listen(1337); +``` + +In addition to new Readable streams switching into flowing mode, +pre-v0.10 style streams can be wrapped in a Readable class using the +[`stream.wrap()`][] method. + + +### Object Mode + + + +Normally, Streams operate on Strings and Buffers exclusively. + +Streams that are in **object mode** can emit generic JavaScript values +other than Buffers and Strings. + +A Readable stream in object mode will always return a single item from +a call to [`stream.read(size)`][stream-read], regardless of what the size +argument is. + +A Writable stream in object mode will always ignore the `encoding` +argument to [`stream.write(data, encoding)`][stream-write]. + +The special value `null` still retains its special value for object +mode streams. That is, for object mode readable streams, `null` as a +return value from [`stream.read()`][stream-read] indicates that there is no more +data, and [`stream.push(null)`][stream-push] will signal the end of stream data +(`EOF`). + +No streams in Node.js core are object mode streams. This pattern is only +used by userland streaming libraries. + +You should set `objectMode` in your stream child class constructor on +the options object. Setting `objectMode` mid-stream is not safe. + +For Duplex streams `objectMode` can be set exclusively for readable or +writable side with `readableObjectMode` and `writableObjectMode` +respectively. These options can be used to implement parsers and +serializers with Transform streams. + +```js +const util = require('util'); +const StringDecoder = require('string_decoder').StringDecoder; +const Transform = require('stream').Transform; +util.inherits(JSONParseStream, Transform); + +// Gets \n-delimited JSON string data, and emits the parsed objects +function JSONParseStream() { + if (!(this instanceof JSONParseStream)) + return new JSONParseStream(); + + Transform.call(this, { readableObjectMode : true }); + + this._buffer = ''; + this._decoder = new StringDecoder('utf8'); +} + +JSONParseStream.prototype._transform = function(chunk, encoding, cb) { + this._buffer += this._decoder.write(chunk); + // split on newlines + var lines = this._buffer.split(/\r?\n/); + // keep the last partial line buffered + this._buffer = lines.pop(); + for (var l = 0; l < lines.length; l++) { + var line = lines[l]; + try { + var obj = JSON.parse(line); + } catch (er) { + this.emit('error', er); + return; + } + // push the parsed object out to the readable consumer + this.push(obj); + } + cb(); +}; + +JSONParseStream.prototype._flush = function(cb) { + // Just handle any leftover + var rem = this._buffer.trim(); + if (rem) { + try { + var obj = JSON.parse(rem); + } catch (er) { + this.emit('error', er); + return; + } + // push the parsed object out to the readable consumer + this.push(obj); + } + cb(); +}; +``` + +### `stream.read(0)` + +There are some cases where you want to trigger a refresh of the +underlying readable stream mechanisms, without actually consuming any +data. In that case, you can call `stream.read(0)`, which will always +return null. + +If the internal read buffer is below the `highWaterMark`, and the +stream is not currently reading, then calling `stream.read(0)` will trigger +a low-level [`stream._read()`][stream-_read] call. + +There is almost never a need to do this. However, you will see some +cases in Node.js's internals where this is done, particularly in the +Readable stream class internals. + +### `stream.push('')` + +Pushing a zero-byte string or Buffer (when not in [Object mode][]) has an +interesting side effect. Because it *is* a call to +[`stream.push()`][stream-push], it will end the `reading` process. However, it +does *not* add any data to the readable buffer, so there's nothing for +a user to consume. + +Very rarely, there are cases where you have no data to provide now, +but the consumer of your stream (or, perhaps, another bit of your own +code) will know when to check again, by calling [`stream.read(0)`][stream-read]. +In those cases, you *may* call `stream.push('')`. + +So far, the only use case for this functionality is in the +[`tls.CryptoStream`][] class, which is deprecated in Node.js/io.js v1.0. If you +find that you have to use `stream.push('')`, please consider another +approach, because it almost certainly indicates that something is +horribly wrong. + +[`'data'`]: #stream_event_data +[`'drain'`]: #stream_event_drain +[`'end'`]: #stream_event_end +[`'finish'`]: #stream_event_finish +[`'readable'`]: #stream_event_readable +[`buf.toString(encoding)`]: https://nodejs.org/docs/v6.1.0/api/buffer.html#buffer_buf_tostring_encoding_start_end +[`EventEmitter`]: https://nodejs.org/docs/v6.1.0/api/events.html#events_class_eventemitter +[`process.stderr`]: https://nodejs.org/docs/v6.1.0/api/process.html#process_process_stderr +[`process.stdin`]: https://nodejs.org/docs/v6.1.0/api/process.html#process_process_stdin +[`process.stdout`]: https://nodejs.org/docs/v6.1.0/api/process.html#process_process_stdout +[`stream.cork()`]: #stream_writable_cork +[`stream.pipe()`]: #stream_readable_pipe_destination_options +[`stream.uncork()`]: #stream_writable_uncork +[`stream.unpipe()`]: #stream_readable_unpipe_destination +[`stream.wrap()`]: #stream_readable_wrap_stream +[`tls.CryptoStream`]: https://nodejs.org/docs/v6.1.0/api/tls.html#tls_class_cryptostream +[`util.inherits()`]: https://nodejs.org/docs/v6.1.0/api/util.html#util_util_inherits_constructor_superconstructor +[API for Stream Consumers]: #stream_api_for_stream_consumers +[API for Stream Implementors]: #stream_api_for_stream_implementors +[child process stdin]: https://nodejs.org/docs/v6.1.0/api/child_process.html#child_process_child_stdin +[child process stdout and stderr]: https://nodejs.org/docs/v6.1.0/api/child_process.html#child_process_child_stdout +[Compatibility]: #stream_compatibility_with_older_node_js_versions +[crypto]: crypto.html +[Duplex]: #stream_class_stream_duplex +[fs read streams]: https://nodejs.org/docs/v6.1.0/api/fs.html#fs_class_fs_readstream +[fs write streams]: https://nodejs.org/docs/v6.1.0/api/fs.html#fs_class_fs_writestream +[HTTP requests, on the client]: https://nodejs.org/docs/v6.1.0/api/http.html#http_class_http_clientrequest +[HTTP responses, on the server]: https://nodejs.org/docs/v6.1.0/api/http.html#http_class_http_serverresponse +[http-incoming-message]: https://nodejs.org/docs/v6.1.0/api/http.html#http_class_http_incomingmessage +[Object mode]: #stream_object_mode +[Readable]: #stream_class_stream_readable +[SimpleProtocol v2]: #stream_example_simpleprotocol_parser_v2 +[stream-_flush]: #stream_transform_flush_callback +[stream-_read]: #stream_readable_read_size_1 +[stream-_transform]: #stream_transform_transform_chunk_encoding_callback +[stream-_write]: #stream_writable_write_chunk_encoding_callback_1 +[stream-_writev]: #stream_writable_writev_chunks_callback +[stream-end]: #stream_writable_end_chunk_encoding_callback +[stream-pause]: #stream_readable_pause +[stream-push]: #stream_readable_push_chunk_encoding +[stream-read]: #stream_readable_read_size +[stream-resume]: #stream_readable_resume +[stream-write]: #stream_writable_write_chunk_encoding_callback +[TCP sockets]: https://nodejs.org/docs/v6.1.0/api/net.html#net_class_net_socket +[Transform]: #stream_class_stream_transform +[Writable]: #stream_class_stream_writable +[zlib]: zlib.html diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_readable.js b/deps/npm/node_modules/readable-stream/lib/_stream_readable.js index 54a9d5c553..79914fa684 100644 --- a/deps/npm/node_modules/readable-stream/lib/_stream_readable.js +++ b/deps/npm/node_modules/readable-stream/lib/_stream_readable.js @@ -10,15 +10,11 @@ var processNextTick = require('process-nextick-args'); var isArray = require('isarray'); /**/ -/**/ -var Buffer = require('buffer').Buffer; -/**/ - Readable.ReadableState = ReadableState; -var EE = require('events'); - /**/ +var EE = require('events').EventEmitter; + var EElistenerCount = function (emitter, type) { return emitter.listeners(type).length; }; @@ -36,6 +32,9 @@ var Stream; /**/ var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ /**/ var util = require('core-util-is'); @@ -44,7 +43,7 @@ util.inherits = require('inherits'); /**/ var debugUtil = require('util'); -var debug = undefined; +var debug = void 0; if (debugUtil && debugUtil.debuglog) { debug = debugUtil.debuglog('stream'); } else { @@ -56,6 +55,19 @@ var StringDecoder; util.inherits(Readable, Stream); +var hasPrependListener = typeof EE.prototype.prependListener === 'function'; + +function prependListener(emitter, event, fn) { + if (hasPrependListener) return emitter.prependListener(event, fn); + + // This is a brutally ugly hack to make sure that our error handler + // is attached before any userland ones. NEVER DO THIS. This is here + // only because this code needs to continue to work with older versions + // of Node.js that do not include the prependListener() method. The goal + // is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} + var Duplex; function ReadableState(options, stream) { Duplex = Duplex || require('./_stream_duplex'); @@ -149,7 +161,7 @@ Readable.prototype.push = function (chunk, encoding) { if (!state.objectMode && typeof chunk === 'string') { encoding = encoding || state.defaultEncoding; if (encoding !== state.encoding) { - chunk = new Buffer(chunk, encoding); + chunk = bufferShim.from(chunk, encoding); encoding = ''; } } @@ -179,8 +191,8 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) { var e = new Error('stream.push() after EOF'); stream.emit('error', e); } else if (state.endEmitted && addToFront) { - var e = new Error('stream.unshift() after end event'); - stream.emit('error', e); + var _e = new Error('stream.unshift() after end event'); + stream.emit('error', _e); } else { var skipAdd; if (state.decoder && !addToFront && !encoding) { @@ -533,7 +545,8 @@ Readable.prototype.pipe = function (dest, pipeOpts) { // If the user unpiped during `dest.write()`, it is possible // to get stuck in a permanently paused state if that write // also returned false. - if (state.pipesCount === 1 && state.pipes[0] === dest && src.listenerCount('data') === 1 && !cleanedUp) { + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { debug('false write response, pause', src._readableState.awaitDrain); src._readableState.awaitDrain++; } @@ -549,9 +562,9 @@ Readable.prototype.pipe = function (dest, pipeOpts) { dest.removeListener('error', onerror); if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); } - // This is a brutally ugly hack to make sure that our error handler - // is attached before any userland ones. NEVER DO THIS. - if (!dest._events || !dest._events.error) dest.on('error', onerror);else if (isArray(dest._events.error)) dest._events.error.unshift(onerror);else dest._events.error = [onerror, dest._events.error]; + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. function onclose() { @@ -825,16 +838,16 @@ function fromList(n, state) { } else { // complex case. // we have enough to cover it, but it spans past the first buffer. - if (stringMode) ret = '';else ret = new Buffer(n); + if (stringMode) ret = '';else ret = bufferShim.allocUnsafe(n); var c = 0; for (var i = 0, l = list.length; i < l && c < n; i++) { - var buf = list[0]; - var cpy = Math.min(n - c, buf.length); + var _buf = list[0]; + var cpy = Math.min(n - c, _buf.length); - if (stringMode) ret += buf.slice(0, cpy);else buf.copy(ret, c, 0, cpy); + if (stringMode) ret += _buf.slice(0, cpy);else _buf.copy(ret, c, 0, cpy); - if (cpy < buf.length) list[0] = buf.slice(cpy);else list.shift(); + if (cpy < _buf.length) list[0] = _buf.slice(cpy);else list.shift(); c += cpy; } @@ -849,7 +862,7 @@ function endReadable(stream) { // If we get here before consuming all the bytes, then that is a // bug in node. Should never happen. - if (state.length > 0) throw new Error('endReadable called on non-empty stream'); + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); if (!state.endEmitted) { state.ended = true; diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_transform.js b/deps/npm/node_modules/readable-stream/lib/_stream_transform.js index 625cdc1769..dbc996ede6 100644 --- a/deps/npm/node_modules/readable-stream/lib/_stream_transform.js +++ b/deps/npm/node_modules/readable-stream/lib/_stream_transform.js @@ -134,7 +134,7 @@ Transform.prototype.push = function (chunk, encoding) { // an error, then that'll put the hurt on the whole operation. If you // never call cb(), then you'll never get another chunk. Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('not implemented'); + throw new Error('Not implemented'); }; Transform.prototype._write = function (chunk, encoding, cb) { @@ -172,9 +172,9 @@ function done(stream, er) { var ws = stream._writableState; var ts = stream._transformState; - if (ws.length) throw new Error('calling transform done when ws.length != 0'); + if (ws.length) throw new Error('Calling transform done when ws.length != 0'); - if (ts.transforming) throw new Error('calling transform done when still transforming'); + if (ts.transforming) throw new Error('Calling transform done when still transforming'); return stream.push(null); } \ No newline at end of file diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_writable.js b/deps/npm/node_modules/readable-stream/lib/_stream_writable.js index 95916c992a..ed5efcbd20 100644 --- a/deps/npm/node_modules/readable-stream/lib/_stream_writable.js +++ b/deps/npm/node_modules/readable-stream/lib/_stream_writable.js @@ -14,10 +14,6 @@ var processNextTick = require('process-nextick-args'); var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; /**/ -/**/ -var Buffer = require('buffer').Buffer; -/**/ - Writable.WritableState = WritableState; /**/ @@ -43,6 +39,9 @@ var Stream; /**/ var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ util.inherits(Writable, Stream); @@ -146,10 +145,9 @@ function WritableState(options, stream) { // count buffered requests this.bufferedRequestCount = 0; - // create the two objects needed to store the corked requests - // they are not a linked list, as no new elements are inserted in there + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two this.corkedRequestsFree = new CorkedRequest(this); - this.corkedRequestsFree.next = new CorkedRequest(this); } WritableState.prototype.getBuffer = function writableStateGetBuffer() { @@ -196,7 +194,7 @@ function Writable(options) { // Otherwise people can pipe Writable streams, which is just wrong. Writable.prototype.pipe = function () { - this.emit('error', new Error('Cannot pipe. Not readable.')); + this.emit('error', new Error('Cannot pipe, not readable')); }; function writeAfterEnd(stream, cb) { @@ -213,9 +211,16 @@ function writeAfterEnd(stream, cb) { // how many bytes or characters. function validChunk(stream, state, chunk, cb) { var valid = true; - - if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { - var er = new TypeError('Invalid non-string/buffer chunk'); + var er = false; + // Always throw error if a null is written + // if we are not in object mode then throw + // if it is not a buffer, string, or undefined. + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { stream.emit('error', er); processNextTick(cb, er); valid = false; @@ -265,11 +270,12 @@ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { if (typeof encoding === 'string') encoding = encoding.toLowerCase(); if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); this._writableState.defaultEncoding = encoding; + return this; }; function decodeChunk(state, chunk, encoding) { if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = new Buffer(chunk, encoding); + chunk = bufferShim.from(chunk, encoding); } return chunk; } @@ -392,12 +398,16 @@ function clearBuffer(stream, state) { doWrite(stream, state, true, state.length, buffer, '', holder.finish); - // doWrite is always async, defer these to save a bit of time + // doWrite is almost always async, defer these to save a bit of time // as the hot path ends with doWrite state.pendingcb++; state.lastBufferedRequest = null; - state.corkedRequestsFree = holder.next; - holder.next = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } } else { // Slow case, write chunks one-by-one while (entry) { diff --git a/deps/npm/node_modules/readable-stream/node_modules/buffer-shims/index.js b/deps/npm/node_modules/readable-stream/node_modules/buffer-shims/index.js new file mode 100644 index 0000000000..1cab4c05e1 --- /dev/null +++ b/deps/npm/node_modules/readable-stream/node_modules/buffer-shims/index.js @@ -0,0 +1,108 @@ +'use strict'; + +var buffer = require('buffer'); +var Buffer = buffer.Buffer; +var SlowBuffer = buffer.SlowBuffer; +var MAX_LEN = buffer.kMaxLength || 2147483647; +exports.alloc = function alloc(size, fill, encoding) { + if (typeof Buffer.alloc === 'function') { + return Buffer.alloc(size, fill, encoding); + } + if (typeof encoding === 'number') { + throw new TypeError('encoding must not be number'); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + var enc = encoding; + var _fill = fill; + if (_fill === undefined) { + enc = undefined; + _fill = 0; + } + var buf = new Buffer(size); + if (typeof _fill === 'string') { + var fillBuf = new Buffer(_fill, enc); + var flen = fillBuf.length; + var i = -1; + while (++i < size) { + buf[i] = fillBuf[i % flen]; + } + } else { + buf.fill(_fill); + } + return buf; +} +exports.allocUnsafe = function allocUnsafe(size) { + if (typeof Buffer.allocUnsafe === 'function') { + return Buffer.allocUnsafe(size); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + return new Buffer(size); +} +exports.from = function from(value, encodingOrOffset, length) { + if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) { + return Buffer.from(value, encodingOrOffset, length); + } + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number'); + } + if (typeof value === 'string') { + return new Buffer(value, encodingOrOffset); + } + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + var offset = encodingOrOffset; + if (arguments.length === 1) { + return new Buffer(value); + } + if (typeof offset === 'undefined') { + offset = 0; + } + var len = length; + if (typeof len === 'undefined') { + len = value.byteLength - offset; + } + if (offset >= value.byteLength) { + throw new RangeError('\'offset\' is out of bounds'); + } + if (len > value.byteLength - offset) { + throw new RangeError('\'length\' is out of bounds'); + } + return new Buffer(value.slice(offset, offset + len)); + } + if (Buffer.isBuffer(value)) { + var out = new Buffer(value.length); + value.copy(out, 0, 0, value.length); + return out; + } + if (value) { + if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) { + return new Buffer(value); + } + if (value.type === 'Buffer' && Array.isArray(value.data)) { + return new Buffer(value.data); + } + } + + throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.'); +} +exports.allocUnsafeSlow = function allocUnsafeSlow(size) { + if (typeof Buffer.allocUnsafeSlow === 'function') { + return Buffer.allocUnsafeSlow(size); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size >= MAX_LEN) { + throw new RangeError('size is too large'); + } + return new SlowBuffer(size); +} diff --git a/deps/npm/node_modules/readable-stream/node_modules/buffer-shims/license.md b/deps/npm/node_modules/readable-stream/node_modules/buffer-shims/license.md new file mode 100644 index 0000000000..01cfaefe2f --- /dev/null +++ b/deps/npm/node_modules/readable-stream/node_modules/buffer-shims/license.md @@ -0,0 +1,19 @@ +# Copyright (c) 2016 Calvin Metcalf + +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/readable-stream/node_modules/buffer-shims/package.json b/deps/npm/node_modules/readable-stream/node_modules/buffer-shims/package.json new file mode 100644 index 0000000000..1a9a8e0aee --- /dev/null +++ b/deps/npm/node_modules/readable-stream/node_modules/buffer-shims/package.json @@ -0,0 +1,84 @@ +{ + "_args": [ + [ + { + "name": "buffer-shims", + "raw": "buffer-shims@^1.0.0", + "rawSpec": "^1.0.0", + "scope": null, + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/Users/zkat/Documents/code/npm/node_modules/readable-stream" + ] + ], + "_from": "buffer-shims@>=1.0.0 <2.0.0", + "_id": "buffer-shims@1.0.0", + "_inCache": true, + "_installable": true, + "_location": "/readable-stream/buffer-shims", + "_nodeVersion": "5.11.0", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/buffer-shims-1.0.0.tgz_1462560889323_0.8640750856138766" + }, + "_npmUser": { + "email": "calvin.metcalf@gmail.com", + "name": "cwmma" + }, + "_npmVersion": "3.8.6", + "_phantomChildren": {}, + "_requested": { + "name": "buffer-shims", + "raw": "buffer-shims@^1.0.0", + "rawSpec": "^1.0.0", + "scope": null, + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/readable-stream" + ], + "_resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "_shasum": "9978ce317388c649ad8793028c3477ef044a8b51", + "_shrinkwrap": null, + "_spec": "buffer-shims@^1.0.0", + "_where": "/Users/zkat/Documents/code/npm/node_modules/readable-stream", + "bugs": { + "url": "https://github.com/calvinmetcalf/buffer-shims/issues" + }, + "dependencies": {}, + "description": "some shims for node buffers", + "devDependencies": { + "tape": "^4.5.1" + }, + "directories": {}, + "dist": { + "shasum": "9978ce317388c649ad8793028c3477ef044a8b51", + "tarball": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz" + }, + "files": [ + "index.js" + ], + "gitHead": "ea89b3857ab5b8203957922a84e9a48cf4c47e0a", + "homepage": "https://github.com/calvinmetcalf/buffer-shims#readme", + "license": "MIT", + "main": "index.js", + "maintainers": [ + { + "email": "calvin.metcalf@gmail.com", + "name": "cwmma" + } + ], + "name": "buffer-shims", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/calvinmetcalf/buffer-shims.git" + }, + "scripts": { + "test": "tape test/*.js" + }, + "version": "1.0.0" +} diff --git a/deps/npm/node_modules/readable-stream/node_modules/buffer-shims/readme.md b/deps/npm/node_modules/readable-stream/node_modules/buffer-shims/readme.md new file mode 100644 index 0000000000..7ea6475e28 --- /dev/null +++ b/deps/npm/node_modules/readable-stream/node_modules/buffer-shims/readme.md @@ -0,0 +1,21 @@ +buffer-shims +=== + +functions to make sure the new buffer methods work in older browsers. + +```js +var bufferShim = require('buffer-shims'); +bufferShim.from('foo'); +bufferShim.alloc(9, 'cafeface', 'hex'); +bufferShim.allocUnsafe(15); +bufferShim.allocUnsafeSlow(21); +``` + +should just use the original in newer nodes and on older nodes uses fallbacks. + +Known Issues +=== +- this does not patch the buffer object, only the constructor stuff +- it's actually a polyfill + +![](https://i.imgur.com/zxII3jJ.gif) diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/index.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/index.js deleted file mode 100644 index c1fb0077e9..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/index.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; -var through = require('through2'); -var falafel = require('falafel'); - -module.exports = apply; -var regex = /process\s*\.\s*browser/; -function apply() { - var buffers = []; - - return through(function(chunk, enc, next) { - buffers.push(chunk); - next(); - }, function(next) { - var string = Buffer.concat(buffers).toString(); - if (!string.match(regex)) { - this.push(string); - return next(); - } - var resp = falafel(string, { - ecmaVersion: 6, - allowReturnOutsideFunction: true - }, function (node) { - - if ( - node.type === 'MemberExpression' && - node.object && node.property && - node.object.name === 'process' - && node.property.name === 'browser' && - !(node.parent ? node.parent.operator === '=' && node.parent.left === node : true) - ) { - node.update('true'); - } - }); - this.push(resp.toString()); - next(); - }); -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/.travis.yml b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/.travis.yml deleted file mode 100644 index eba42c8b2d..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - 0.12 diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/array.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/array.js deleted file mode 100644 index c805d5192f..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/array.js +++ /dev/null @@ -1,14 +0,0 @@ -var falafel = require('../'); - -var src = '(' + function () { - var xs = [ 1, 2, [ 3, 4 ] ]; - var ys = [ 5, 6 ]; - console.dir([ xs, ys ]); -} + ')()'; - -var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } -}); -console.log(output); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/keyword.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/keyword.js deleted file mode 100644 index b7cdd4a544..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/keyword.js +++ /dev/null @@ -1,16 +0,0 @@ -var falafel = require('../'); -var src = 'console.log(beep "boop", "BOOP");'; - -function isKeyword (id) { - if (id === 'beep') return true; -} - -var output = falafel(src, { isKeyword: isKeyword }, function (node) { - if (node.type === 'UnaryExpression' - && node.operator === 'beep') { - node.update( - 'String(' + node.argument.source() + ').toUpperCase()' - ); - } -}); -console.log(output); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/prompt.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/prompt.js deleted file mode 100644 index a1062a03f4..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/example/prompt.js +++ /dev/null @@ -1,49 +0,0 @@ -var falafel = require('../'); -var vm = require('vm'); - -var termExps = [ - 'Identifier', - 'CallExpression', - 'BinaryExpression', - 'UpdateExpression', - 'UnaryExpression' -].reduce(function (acc, key) { acc[key] = true; return acc }, {}); - -function terminated (node) { - for (var p = node; p.parent; p = p.parent) { - if (termExps[p.type]) return true; - } - return false; -} - -var src = '{"a":[2,~9,prompt(":d")],"b":4,"c":prompt("beep"),"d":6}'; - -var offsets = []; -var output = falafel('(' + src + ')', function (node) { - var isLeaf = node.parent - && !terminated(node.parent) && terminated(node) - ; - - if (isLeaf) { - var s = node.source(); - var prompted = false; - var res = vm.runInNewContext('(' + s + ')', { - prompt : function (x) { - setTimeout(function () { - node.update(x.toUpperCase()); - }, Math.random() * 50); - prompted = true; - } - }); - if (!prompted) { - var s_ = JSON.stringify(res); - node.update(s_); - } - } -}); - -setTimeout(function () { - console.log(src); - console.log('---'); - console.log(output); -}, 200); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/index.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/index.js deleted file mode 100644 index 5fd572f773..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/index.js +++ /dev/null @@ -1,79 +0,0 @@ -var parse = require('acorn').parse; -var isArray = require('isarray'); -var objectKeys = require('object-keys'); -var forEach = require('foreach'); - -module.exports = function (src, opts, fn) { - if (typeof opts === 'function') { - fn = opts; - opts = {}; - } - if (src && typeof src === 'object' && src.constructor.name === 'Buffer') { - src = src.toString(); - } - else if (src && typeof src === 'object') { - opts = src; - src = opts.source; - delete opts.source; - } - src = src === undefined ? opts.source : src; - if (typeof src !== 'string') src = String(src); - if (opts.parser) parse = opts.parser.parse; - var ast = parse(src, opts); - - var result = { - chunks : src.split(''), - toString : function () { return result.chunks.join('') }, - inspect : function () { return result.toString() } - }; - var index = 0; - - (function walk (node, parent) { - insertHelpers(node, parent, result.chunks); - - forEach(objectKeys(node), function (key) { - if (key === 'parent') return; - - var child = node[key]; - if (isArray(child)) { - forEach(child, function (c) { - if (c && typeof c.type === 'string') { - walk(c, node); - } - }); - } - else if (child && typeof child.type === 'string') { - walk(child, node); - } - }); - fn(node); - })(ast, undefined); - - return result; -}; - -function insertHelpers (node, parent, chunks) { - node.parent = parent; - - node.source = function () { - return chunks.slice(node.start, node.end).join(''); - }; - - if (node.update && typeof node.update === 'object') { - var prev = node.update; - forEach(objectKeys(prev), function (key) { - update[key] = prev[key]; - }); - node.update = update; - } - else { - node.update = update; - } - - function update (s) { - chunks[node.start] = s; - for (var i = node.start + 1; i < node.end; i++) { - chunks[i] = ''; - } - } -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.editorconfig b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.editorconfig deleted file mode 100644 index c14d5c67b4..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.editorconfig +++ /dev/null @@ -1,7 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -insert_final_newline = true diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.gitattributes b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.gitattributes deleted file mode 100644 index fcadb2cf97..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text eol=lf diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.npmignore b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.npmignore deleted file mode 100644 index ecba2911d2..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -/.tern-port -/test -/local diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.tern-project b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.tern-project deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.tern-project +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.travis.yml b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.travis.yml deleted file mode 100644 index ffb9f710ac..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/.travis.yml +++ /dev/null @@ -1,2 +0,0 @@ -language: node_js -node_js: '0.10' diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/AUTHORS b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/AUTHORS deleted file mode 100644 index 0fb284bb55..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/AUTHORS +++ /dev/null @@ -1,38 +0,0 @@ -List of Acorn contributors. Updated before every release. - -Adrian Rakovsky -Alistair Braidwood -Andres Suarez -Aparajita Fishman -Arian Stolwijk -Artem Govorov -Brandon Mills -Charles Hughes -Conrad Irwin -David Bonnet -Forbes Lindesay -Gilad Peleg -impinball -Ingvar Stepanyan -Jiaxing Wang -Johannes Herr -Jürg Lehni -keeyipchan -krator -Marijn Haverbeke -Martin Carlberg -Mathias Bynens -Mathieu 'p01' Henri -Max Schaefer -Max Zerzouri -Mihai Bazon -Mike Rennie -Nick Fitzgerald -Oskar Schöldström -Paul Harper -Peter Rust -PlNG -r-e-d -Rich Harris -Sebastian McKenzie -zsjforcn diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/LICENSE b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/LICENSE deleted file mode 100644 index d4c7fc5838..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2012-2014 by various contributors (see AUTHORS) - -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/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/README.md b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/README.md deleted file mode 100644 index ce1ec34770..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/README.md +++ /dev/null @@ -1,377 +0,0 @@ -# Acorn - -[![Build Status](https://travis-ci.org/marijnh/acorn.svg?branch=master)](https://travis-ci.org/marijnh/acorn) -[![NPM version](https://img.shields.io/npm/v/acorn.svg)](https://www.npmjs.org/package/acorn) -[Author funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png?force)](https://marijnhaverbeke.nl/fund/) - -A tiny, fast JavaScript parser, written completely in JavaScript. - -## Installation - -The easiest way to install acorn is with [`npm`][npm]. - -[npm]: http://npmjs.org - -```sh -npm install acorn -``` - -Alternately, download the source. - -```sh -git clone https://github.com/marijnh/acorn.git -``` - -## Components - -When run in a CommonJS (node.js) or AMD environment, exported values -appear in the interfaces exposed by the individual files, as usual. -When loaded in the browser (Acorn works in any JS-enabled browser more -recent than IE5) without any kind of module management, a single -global object `acorn` will be defined, and all the exported properties -will be added to that. - -### Main parser - -This is implemented in `dist/acorn.js`, and is what you get when you -`require("acorn")` in node.js. - -**parse**`(input, options)` is used to parse a JavaScript program. -The `input` parameter is a string, `options` can be undefined or an -object setting some of the options listed below. The return value will -be an abstract syntax tree object as specified by the -[Mozilla Parser API][mozapi]. - -When encountering a syntax error, the parser will raise a -`SyntaxError` object with a meaningful message. The error object will -have a `pos` property that indicates the character offset at which the -error occurred, and a `loc` object that contains a `{line, column}` -object referring to that same position. - -[mozapi]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API - -- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be - either 3, 5, or 6. This influences support for strict mode, the set - of reserved words, and support for new syntax features. Default is 5. - -- **sourceType**: Indicate the mode the code should be parsed in. Can be - either `"script"` or `"module"`. - -- **onInsertedSemicolon**: If given a callback, that callback will be - called whenever a missing semicolon is inserted by the parser. The - callback will be given the character offset of the point where the - semicolon is inserted as argument, and if `locations` is on, also a - `{line, column}` object representing this position. - -- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing - commas. - -- **allowReserved**: If `false`, using a reserved word will generate - an error. Defaults to `true`. When given the value `"never"`, - reserved words and keywords can also not be used as property names - (as in Internet Explorer's old parser). - -- **allowReturnOutsideFunction**: By default, a return statement at - the top level raises an error. Set this to `true` to accept such - code. - -- **allowImportExportEverywhere**: By default, `import` and `export` - declarations can only appear at a program's top level. Setting this - option to `true` allows them anywhere where a statement is allowed. - -- **allowHashBang**: When this is enabled (off by default), if the - code starts with the characters `#!` (as in a shellscript), the - first line will be treated as a comment. - -- **locations**: When `true`, each node has a `loc` object attached - with `start` and `end` subobjects, each of which contains the - one-based line and zero-based column numbers in `{line, column}` - form. Default is `false`. - -- **onToken**: If a function is passed for this option, each found - token will be passed in same format as `tokenize()` returns. - - If array is passed, each found token is pushed to it. - - Note that you are not allowed to call the parser from the - callback—that will corrupt its internal state. - -- **onComment**: If a function is passed for this option, whenever a - comment is encountered the function will be called with the - following parameters: - - - `block`: `true` if the comment is a block comment, false if it - is a line comment. - - `text`: The content of the comment. - - `start`: Character offset of the start of the comment. - - `end`: Character offset of the end of the comment. - - When the `locations` options is on, the `{line, column}` locations - of the comment’s start and end are passed as two additional - parameters. - - If array is passed for this option, each found comment is pushed - to it as object in Esprima format: - - ```javascript - { - "type": "Line" | "Block", - "value": "comment text", - "range": ..., - "loc": ... - } - ``` - - Note that you are not allowed to call the parser from the - callback—that will corrupt its internal state. - -- **ranges**: Nodes have their start and end characters offsets - recorded in `start` and `end` properties (directly on the node, - rather than the `loc` object, which holds line/column data. To also - add a [semi-standardized][range] "range" property holding a - `[start, end]` array with the same numbers, set the `ranges` option - to `true`. - -- **program**: It is possible to parse multiple files into a single - AST by passing the tree produced by parsing the first file as the - `program` option in subsequent parses. This will add the toplevel - forms of the parsed file to the "Program" (top) node of an existing - parse tree. - -- **sourceFile**: When the `locations` option is `true`, you can pass - this option to add a `source` attribute in every node’s `loc` - object. Note that the contents of this option are not examined or - processed in any way; you are free to use whatever format you - choose. - -- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property - will be added directly to the nodes, rather than the `loc` object. - -- **preserveParens**: If this option is `true`, parenthesized expressions - are represented by (non-standard) `ParenthesizedExpression` nodes - that have a single `expression` property containing the expression - inside parentheses. - -[range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 - -**parseExpressionAt**`(input, offset, options)` will parse a single -expression in a string, and return its AST. It will not complain if -there is more of the string left after the expression. - -**getLineInfo**`(input, offset)` can be used to get a `{line, -column}` object for a given program string and character offset. - -**tokenizer**`(input, options)` returns an object with a `getToken` -method that can be called repeatedly to get the next token, a `{start, -end, type, value}` object (with added `loc` property when the -`locations` option is enabled and `range` property when the `ranges` -option is enabled). When the token's type is `tokTypes.eof`, you -should stop calling the method, since it will keep returning that same -token forever. - -In ES6 environment, returned result can be used as any other -protocol-compliant iterable: - -```javascript -for (let token of acorn.tokenize(str)) { - // iterate over the tokens -} - -// transform code to array of tokens: -var tokens = [...acorn.tokenize(str)]; -``` - -**tokTypes** holds an object mapping names to the token type objects -that end up in the `type` properties of tokens. - -#### Note on using with [Escodegen][escodegen] - -Escodegen supports generating comments from AST, attached in -Esprima-specific format. In order to simulate same format in -Acorn, consider following example: - -```javascript -var comments = [], tokens = []; - -var ast = acorn.parse('var x = 42; // answer', { - // collect ranges for each node - ranges: true, - // collect comments in Esprima's format - onComment: comments, - // collect token ranges - onToken: tokens -}); - -// attach comments using collected information -escodegen.attachComments(ast, comments, tokens); - -// generate code -console.log(escodegen.generate(ast, {comment: true})); -// > 'var x = 42; // answer' -``` - -[escodegen]: https://github.com/Constellation/escodegen - -#### Using Acorn in an environment with a Content Security Policy - -Some contexts, such as Chrome Web Apps, disallow run-time code evaluation. -Acorn uses `new Function` to generate fast functions that test whether -a word is in a given set, and will trigger a security error when used -in a context with such a -[Content Security Policy](http://www.html5rocks.com/en/tutorials/security/content-security-policy/#eval-too) -(see [#90](https://github.com/marijnh/acorn/issues/90) and -[#123](https://github.com/marijnh/acorn/issues/123)). - -The `dist/acorn_csp.js` file in the distribution (which is built -by the `bin/without_eval` script) has the generated code inlined, and -can thus run without evaluating anything. - -### dist/acorn_loose.js ### - -This file implements an error-tolerant parser. It exposes a single -function. - -**parse_dammit**`(input, options)` takes the same arguments and -returns the same syntax tree as the `parse` function in `acorn.js`, -but never raises an error, and will do its best to parse syntactically -invalid code in as meaningful a way as it can. It'll insert identifier -nodes with name `"✖"` as placeholders in places where it can't make -sense of the input. Depends on `acorn.js`, because it uses the same -tokenizer. - -### dist/walk.js ### - -Implements an abstract syntax tree walker. Will store its interface in -`acorn.walk` when loaded without a module system. - -**simple**`(node, visitors, base, state)` does a 'simple' walk over -a tree. `node` should be the AST node to walk, and `visitors` an -object with properties whose names correspond to node types in the -[Mozilla Parser API][mozapi]. The properties should contain functions -that will be called with the node object and, if applicable the state -at that point. The last two arguments are optional. `base` is a walker -algorithm, and `state` is a start state. The default walker will -simply visit all statements and expressions and not produce a -meaningful state. (An example of a use of state it to track scope at -each point in the tree.) - -**ancestor**`(node, visitors, base, state)` does a 'simple' walk over -a tree, building up an array of ancestor nodes (including the current node) -and passing the array to callbacks in the `state` parameter. - -**recursive**`(node, state, functions, base)` does a 'recursive' -walk, where the walker functions are responsible for continuing the -walk on the child nodes of their target node. `state` is the start -state, and `functions` should contain an object that maps node types -to walker functions. Such functions are called with `(node, state, c)` -arguments, and can cause the walk to continue on a sub-node by calling -the `c` argument on it with `(node, state)` arguments. The optional -`base` argument provides the fallback walker functions for node types -that aren't handled in the `functions` object. If not given, the -default walkers will be used. - -**make**`(functions, base)` builds a new walker object by using the -walker functions in `functions` and filling in the missing ones by -taking defaults from `base`. - -**findNodeAt**`(node, start, end, test, base, state)` tries to -locate a node in a tree at the given start and/or end offsets, which -satisfies the predicate `test`. `start` end `end` can be either `null` -(as wildcard) or a number. `test` may be a string (indicating a node -type) or a function that takes `(nodeType, node)` arguments and -returns a boolean indicating whether this node is interesting. `base` -and `state` are optional, and can be used to specify a custom walker. -Nodes are tested from inner to outer, so if two nodes match the -boundaries, the inner one will be preferred. - -**findNodeAround**`(node, pos, test, base, state)` is a lot like -`findNodeAt`, but will match any node that exists 'around' (spanning) -the given position. - -**findNodeAfter**`(node, pos, test, base, state)` is similar to -`findNodeAround`, but will match all nodes *after* the given position -(testing outer nodes before inner nodes). - -## Command line interface - -The `bin/acorn` utility can be used to parse a file from the command -line. It accepts as arguments its input file and the following -options: - -- `--ecma3|--ecma5|--ecma6`: Sets the ECMAScript version to parse. Default is - version 5. - -- `--locations`: Attaches a "loc" object to each node with "start" and - "end" subobjects, each of which contains the one-based line and - zero-based column numbers in `{line, column}` form. - -- `--allow-hash-bang`: If the code starts with the characters #! (as in a shellscript), the first line will be treated as a comment. - -- `--compact`: No whitespace is used in the AST output. - -- `--silent`: Do not output the AST, just return the exit status. - -- `--help`: Print the usage information and quit. - -The utility spits out the syntax tree as JSON data. - -## Build system - -Acorn is written in ECMAScript 6, as a set of small modules, in the -project's `src` directory, and compiled down to bigger ECMAScript 3 -files in `dist` using [Browserify](http://browserify.org) and -[Babel](http://babeljs.io/). If you are already using Babel, you can -consider including the modules directly. - -The command-line test runner (`npm test`) uses the ES6 modules. The -browser-based test page (`test/index.html`) uses the compiled modules. -The `bin/build-acorn.js` script builds the latter from the former. - -If you are working on Acorn, you'll probably want to try the code out -directly, without an intermediate build step. In your scripts, you can -register the Babel require shim like this: - - require("babelify/node_modules/babel-core/register") - -That will allow you to directly `require` the ES6 modules. - -## Plugins - -Acorn is designed support allow plugins which, within reasonable -bounds, redefine the way the parser works. Plugins can add new token -types and new tokenizer contexts (if necessary), and extend methods in -the parser object. This is not a clean, elegant API—using it requires -an understanding of Acorn's internals, and plugins are likely to break -whenever those internals are significantly changed. But still, it is -_possible_, in this way, to create parsers for JavaScript dialects -without forking all of Acorn. And in principle it is even possible to -combine such plugins, so that if you have, for example, a plugin for -parsing types and a plugin for parsing JSX-style XML literals, you -could load them both and parse code with both JSX tags and types. - -A plugin should register itself by adding a property to -`acorn.plugins`, which holds a function. Calling `acorn.parse`, a -`plugin` option can be passed, holding an object mapping plugin names -to configuration values (or just `true` for plugins that don't take -options). After the parser object has been created, the initialization -functions for the chosen plugins are called with `(parser, -configValue)` arguments. They are expected to use the `parser.extend` -method to extend parser methods. For example, the `readToken` method -could be extended like this: - -```javascript -parser.extend("readToken", function(nextMethod) { - return function(code) { - console.log("Reading a token!") - return nextMethod.call(this, code) - } -}) -``` - -The `nextMethod` argument passed to `extend`'s second argument is the -previous value of this method, and should usually be called through to -whenever the extended method does not handle the call itself. - -There is a proof-of-concept JSX plugin in the [`jsx` -branch](https://github.com/marijnh/acorn/tree/jsx) branch of the -Github repository. diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/acorn b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/acorn deleted file mode 100755 index 76d8178b27..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/acorn +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env node - -var path = require("path"); -var fs = require("fs"); -var acorn = require("../dist/acorn.js"); - -var infile, parsed, tokens, options = {}, silent = false, compact = false, tokenize = false; - -function help(status) { - var print = (status == 0) ? console.log : console.error; - print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6]"); - print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--help] [--] infile"); - process.exit(status); -} - -for (var i = 2; i < process.argv.length; ++i) { - var arg = process.argv[i]; - if (arg[0] != "-" && !infile) infile = arg; - else if (arg == "--" && !infile && i + 2 == process.argv.length) infile = process.argv[++i]; - else if (arg == "--ecma3") options.ecmaVersion = 3; - else if (arg == "--ecma5") options.ecmaVersion = 5; - else if (arg == "--ecma6") options.ecmaVersion = 6; - else if (arg == "--ecma7") options.ecmaVersion = 7; - else if (arg == "--locations") options.locations = true; - else if (arg == "--allow-hash-bang") options.allowHashBang = true; - else if (arg == "--silent") silent = true; - else if (arg == "--compact") compact = true; - else if (arg == "--help") help(0); - else if (arg == "--tokenize") tokenize = true; - else help(1); -} - -try { - var code = fs.readFileSync(infile, "utf8"); - - if (!tokenize) - parsed = acorn.parse(code, options); - else { - var get = acorn.tokenize(code, options); - tokens = []; - while (true) { - var token = get(); - tokens.push(token); - if (token.type.type == "eof") - break; - } - } -} catch(e) { - console.log(e.message); - process.exit(1); -} - -if (!silent) - console.log(JSON.stringify(tokenize ? tokens : parsed, null, compact ? null : 2)); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/build-acorn.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/build-acorn.js deleted file mode 100644 index a97b757541..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/build-acorn.js +++ /dev/null @@ -1,51 +0,0 @@ -var fs = require("fs"), path = require("path") -var stream = require("stream") - -var browserify = require("browserify") -var babelify = require("babelify").configure({loose: "all"}) - -process.chdir(path.resolve(__dirname, "..")) - -browserify({standalone: "acorn"}) - .plugin(require('browserify-derequire')) - .transform(babelify) - .require("./src/index.js", {entry: true}) - .bundle() - .on("error", function (err) { console.log("Error: " + err.message) }) - .pipe(fs.createWriteStream("dist/acorn.js")) - -function acornShim(file) { - var tr = new stream.Transform - if (file == path.resolve(__dirname, "../src/index.js")) { - var sent = false - tr._transform = function(chunk, _, callback) { - if (!sent) { - sent = true - callback(null, "module.exports = typeof acorn != 'undefined' ? acorn : _dereq_(\"./acorn\")") - } else { - callback() - } - } - } else { - tr._transform = function(chunk, _, callback) { callback(null, chunk) } - } - return tr -} - -browserify({standalone: "acorn.loose"}) - .plugin(require('browserify-derequire')) - .transform(acornShim) - .transform(babelify) - .require("./src/loose/index.js", {entry: true}) - .bundle() - .on("error", function (err) { console.log("Error: " + err.message) }) - .pipe(fs.createWriteStream("dist/acorn_loose.js")) - -browserify({standalone: "acorn.walk"}) - .plugin(require('browserify-derequire')) - .transform(acornShim) - .transform(babelify) - .require("./src/walk/index.js", {entry: true}) - .bundle() - .on("error", function (err) { console.log("Error: " + err.message) }) - .pipe(fs.createWriteStream("dist/walk.js")) diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/generate-identifier-regex.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/generate-identifier-regex.js deleted file mode 100644 index 0d7c50fc38..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/generate-identifier-regex.js +++ /dev/null @@ -1,47 +0,0 @@ -// Note: run `npm install unicode-7.0.0` first. - -// Which Unicode version should be used? -var version = '7.0.0'; - -var start = require('unicode-' + version + '/properties/ID_Start/code-points') - .filter(function(ch) { return ch > 127; }); -var cont = [0x200c, 0x200d].concat(require('unicode-' + version + '/properties/ID_Continue/code-points') - .filter(function(ch) { return ch > 127 && start.indexOf(ch) == -1; })); - -function pad(str, width) { - while (str.length < width) str = "0" + str; - return str; -} - -function esc(code) { - var hex = code.toString(16); - if (hex.length <= 2) return "\\x" + pad(hex, 2); - else return "\\u" + pad(hex, 4); -} - -function generate(chars) { - var astral = [], re = ""; - for (var i = 0, at = 0x10000; i < chars.length; i++) { - var from = chars[i], to = from; - while (i < chars.length - 1 && chars[i + 1] == to + 1) { - i++; - to++; - } - if (to <= 0xffff) { - if (from == to) re += esc(from); - else if (from + 1 == to) re += esc(from) + esc(to); - else re += esc(from) + "-" + esc(to); - } else { - astral.push(from - at, to - from); - at = to; - } - } - return {nonASCII: re, astral: astral}; -} - -var startData = generate(start), contData = generate(cont); - -console.log(" var nonASCIIidentifierStartChars = \"" + startData.nonASCII + "\";"); -console.log(" var nonASCIIidentifierChars = \"" + contData.nonASCII + "\";"); -console.log(" var astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";"); -console.log(" var astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";"); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/prepublish.sh b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/prepublish.sh deleted file mode 100755 index 879834da67..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/prepublish.sh +++ /dev/null @@ -1,2 +0,0 @@ -node bin/build-acorn.js -node bin/without_eval > dist/acorn_csp.js diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/update_authors.sh b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/update_authors.sh deleted file mode 100755 index 466c8db586..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/update_authors.sh +++ /dev/null @@ -1,6 +0,0 @@ -# Combine existing list of authors with everyone known in git, sort, add header. -tail --lines=+3 AUTHORS > AUTHORS.tmp -git log --format='%aN' | grep -v abraidwood >> AUTHORS.tmp -echo -e "List of Acorn contributors. Updated before every release.\n" > AUTHORS -sort -u AUTHORS.tmp >> AUTHORS -rm -f AUTHORS.tmp diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/without_eval b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/without_eval deleted file mode 100755 index 4331e7070c..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/bin/without_eval +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env node - -var fs = require("fs") - -var acornSrc = fs.readFileSync(require.resolve("../dist/acorn"), "utf8") -var acorn = require("../dist/acorn"), walk = require("../dist/walk") - -var ast = acorn.parse(acornSrc) -var touchups = [], uses = [] - -var makePred - -walk.simple(ast, { - FunctionDeclaration: function(node) { - if (node.id.name == "makePredicate") { - makePred = node - touchups.push({text: "// Removed to create an eval-free library", from: node.start, to: node.end}) - } - }, - ObjectExpression: function(node) { - node.properties.forEach(function(prop) { - if (prop.value.type == "CallExpression" && - prop.value.callee.name == "makePredicate") - uses.push(prop.value) - }) - } -}) - -var results = [] -var dryRun = acornSrc.slice(0, makePred.end) + "; makePredicate = (function(mp) {" + - "return function(words) { var r = mp(words); predicates.push(r); return r }})(makePredicate);" + - acornSrc.slice(makePred.end) -;(new Function("predicates", dryRun))(results) - -uses.forEach(function (node, i) { - touchups.push({text: results[i].toString(), from: node.start, to: node.end}) -}) - -var result = "", pos = 0 -touchups.sort(function(a, b) { return a.from - b.from }) -touchups.forEach(function(touchup) { - result += acornSrc.slice(pos, touchup.from) - result += touchup.text - pos = touchup.to -}) -result += acornSrc.slice(pos) - -process.stdout.write(result) diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/dist/.keep b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/dist/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/dist/acorn.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/dist/acorn.js deleted file mode 100644 index 1f1b6f2432..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/node_modules/acorn/dist/acorn.js +++ /dev/null @@ -1,4014 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.acorn = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = _dereq_('./support/isBuffer'); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = _dereq_('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":4,"_process":3,"inherits":2}],6:[function(_dereq_,module,exports){ -// A recursive descent parser operates by defining functions for all -// syntactic elements, and recursively calling those, each function -// advancing the input stream and returning an AST node. Precedence -// of constructs (for example, the fact that `!x[1]` means `!(x[1])` -// instead of `(!x)[1]` is handled by the fact that the parser -// function that parses unary prefix operators is called first, and -// in turn calls the function that parses `[]` subscripts — that -// way, it'll receive the node for `x[1]` already parsed, and wraps -// *that* in the unary operator node. -// -// Acorn uses an [operator precedence parser][opp] to handle binary -// operator precedence, because it is much more compact than using -// the technique outlined above, which uses different, nesting -// functions to specify precedence, for all of the ten binary -// precedence levels that JavaScript defines. -// -// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser - -"use strict"; - -var tt = _dereq_("./tokentype").types; - -var Parser = _dereq_("./state").Parser; - -var reservedWords = _dereq_("./identifier").reservedWords; - -var has = _dereq_("./util").has; - -var pp = Parser.prototype; - -// Check if property name clashes with already added. -// Object/class getters and setters are not allowed to clash — -// either with each other or with an init property — and in -// strict mode, init properties are also not allowed to be repeated. - -pp.checkPropClash = function (prop, propHash) { - if (this.options.ecmaVersion >= 6) return; - var key = prop.key, - name = undefined; - switch (key.type) { - case "Identifier": - name = key.name;break; - case "Literal": - name = String(key.value);break; - default: - return; - } - var kind = prop.kind || "init", - other = undefined; - if (has(propHash, name)) { - other = propHash[name]; - var isGetSet = kind !== "init"; - if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init)) this.raise(key.start, "Redefinition of property"); - } else { - other = propHash[name] = { - init: false, - get: false, - set: false - }; - } - other[kind] = true; -}; - -// ### Expression parsing - -// These nest, from the most general expression type at the top to -// 'atomic', nondivisible expression types at the bottom. Most of -// the functions will simply let the function(s) below them parse, -// and, *if* the syntactic construct they handle is present, wrap -// the AST node that the inner parser gave them in another node. - -// Parse a full expression. The optional arguments are used to -// forbid the `in` operator (in for loops initalization expressions) -// and provide reference for storing '=' operator inside shorthand -// property assignment in contexts where both object expression -// and object pattern might appear (so it's possible to raise -// delayed syntax error at correct position). - -pp.parseExpression = function (noIn, refShorthandDefaultPos) { - var startPos = this.start, - startLoc = this.startLoc; - var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos); - if (this.type === tt.comma) { - var node = this.startNodeAt(startPos, startLoc); - node.expressions = [expr]; - while (this.eat(tt.comma)) node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos)); - return this.finishNode(node, "SequenceExpression"); - } - return expr; -}; - -// Parse an assignment expression. This includes applications of -// operators like `+=`. - -pp.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse) { - if (this.type == tt._yield && this.inGenerator) return this.parseYield(); - - var failOnShorthandAssign = undefined; - if (!refShorthandDefaultPos) { - refShorthandDefaultPos = { start: 0 }; - failOnShorthandAssign = true; - } else { - failOnShorthandAssign = false; - } - var startPos = this.start, - startLoc = this.startLoc; - if (this.type == tt.parenL || this.type == tt.name) this.potentialArrowAt = this.start; - var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos); - if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc); - if (this.type.isAssign) { - var node = this.startNodeAt(startPos, startLoc); - node.operator = this.value; - node.left = this.type === tt.eq ? this.toAssignable(left) : left; - refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly - this.checkLVal(left); - this.next(); - node.right = this.parseMaybeAssign(noIn); - return this.finishNode(node, "AssignmentExpression"); - } else if (failOnShorthandAssign && refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); - } - return left; -}; - -// Parse a ternary conditional (`?:`) operator. - -pp.parseMaybeConditional = function (noIn, refShorthandDefaultPos) { - var startPos = this.start, - startLoc = this.startLoc; - var expr = this.parseExprOps(noIn, refShorthandDefaultPos); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; - if (this.eat(tt.question)) { - var node = this.startNodeAt(startPos, startLoc); - node.test = expr; - node.consequent = this.parseMaybeAssign(); - this.expect(tt.colon); - node.alternate = this.parseMaybeAssign(noIn); - return this.finishNode(node, "ConditionalExpression"); - } - return expr; -}; - -// Start the precedence parser. - -pp.parseExprOps = function (noIn, refShorthandDefaultPos) { - var startPos = this.start, - startLoc = this.startLoc; - var expr = this.parseMaybeUnary(refShorthandDefaultPos); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; - return this.parseExprOp(expr, startPos, startLoc, -1, noIn); -}; - -// Parse binary operators with the operator precedence parsing -// algorithm. `left` is the left-hand side of the operator. -// `minPrec` provides context that allows the function to stop and -// defer further parser to one of its callers when it encounters an -// operator that has a lower precedence than the set it is parsing. - -pp.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) { - var prec = this.type.binop; - if (Array.isArray(leftStartPos)) { - if (this.options.locations && noIn === undefined) { - // shift arguments to left by one - noIn = minPrec; - minPrec = leftStartLoc; - // flatten leftStartPos - leftStartLoc = leftStartPos[1]; - leftStartPos = leftStartPos[0]; - } - } - if (prec != null && (!noIn || this.type !== tt._in)) { - if (prec > minPrec) { - var node = this.startNodeAt(leftStartPos, leftStartLoc); - node.left = left; - node.operator = this.value; - var op = this.type; - this.next(); - var startPos = this.start, - startLoc = this.startLoc; - node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, prec, noIn); - this.finishNode(node, op === tt.logicalOR || op === tt.logicalAND ? "LogicalExpression" : "BinaryExpression"); - return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn); - } - } - return left; -}; - -// Parse unary operators, both prefix and postfix. - -pp.parseMaybeUnary = function (refShorthandDefaultPos) { - if (this.type.prefix) { - var node = this.startNode(), - update = this.type === tt.incDec; - node.operator = this.value; - node.prefix = true; - this.next(); - node.argument = this.parseMaybeUnary(); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start); - if (update) this.checkLVal(node.argument);else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") this.raise(node.start, "Deleting local variable in strict mode"); - return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); - } - var startPos = this.start, - startLoc = this.startLoc; - var expr = this.parseExprSubscripts(refShorthandDefaultPos); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; - while (this.type.postfix && !this.canInsertSemicolon()) { - var node = this.startNodeAt(startPos, startLoc); - node.operator = this.value; - node.prefix = false; - node.argument = expr; - this.checkLVal(expr); - this.next(); - expr = this.finishNode(node, "UpdateExpression"); - } - return expr; -}; - -// Parse call, dot, and `[]`-subscript expressions. - -pp.parseExprSubscripts = function (refShorthandDefaultPos) { - var startPos = this.start, - startLoc = this.startLoc; - var expr = this.parseExprAtom(refShorthandDefaultPos); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; - return this.parseSubscripts(expr, startPos, startLoc); -}; - -pp.parseSubscripts = function (base, startPos, startLoc, noCalls) { - if (Array.isArray(startPos)) { - if (this.options.locations && noCalls === undefined) { - // shift arguments to left by one - noCalls = startLoc; - // flatten startPos - startLoc = startPos[1]; - startPos = startPos[0]; - } - } - for (;;) { - if (this.eat(tt.dot)) { - var node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.property = this.parseIdent(true); - node.computed = false; - base = this.finishNode(node, "MemberExpression"); - } else if (this.eat(tt.bracketL)) { - var node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.property = this.parseExpression(); - node.computed = true; - this.expect(tt.bracketR); - base = this.finishNode(node, "MemberExpression"); - } else if (!noCalls && this.eat(tt.parenL)) { - var node = this.startNodeAt(startPos, startLoc); - node.callee = base; - node.arguments = this.parseExprList(tt.parenR, false); - base = this.finishNode(node, "CallExpression"); - } else if (this.type === tt.backQuote) { - var node = this.startNodeAt(startPos, startLoc); - node.tag = base; - node.quasi = this.parseTemplate(); - base = this.finishNode(node, "TaggedTemplateExpression"); - } else { - return base; - } - } -}; - -// Parse an atomic expression — either a single token that is an -// expression, an expression started by a keyword like `function` or -// `new`, or an expression wrapped in punctuation like `()`, `[]`, -// or `{}`. - -pp.parseExprAtom = function (refShorthandDefaultPos) { - var node = undefined, - canBeArrow = this.potentialArrowAt == this.start; - switch (this.type) { - case tt._this: - case tt._super: - var type = this.type === tt._this ? "ThisExpression" : "Super"; - node = this.startNode(); - this.next(); - return this.finishNode(node, type); - - case tt._yield: - if (this.inGenerator) this.unexpected(); - - case tt.name: - var startPos = this.start, - startLoc = this.startLoc; - var id = this.parseIdent(this.type !== tt.name); - if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id]); - return id; - - case tt.regexp: - var value = this.value; - node = this.parseLiteral(value.value); - node.regex = { pattern: value.pattern, flags: value.flags }; - return node; - - case tt.num:case tt.string: - return this.parseLiteral(this.value); - - case tt._null:case tt._true:case tt._false: - node = this.startNode(); - node.value = this.type === tt._null ? null : this.type === tt._true; - node.raw = this.type.keyword; - this.next(); - return this.finishNode(node, "Literal"); - - case tt.parenL: - return this.parseParenAndDistinguishExpression(canBeArrow); - - case tt.bracketL: - node = this.startNode(); - this.next(); - // check whether this is array comprehension or regular array - if (this.options.ecmaVersion >= 7 && this.type === tt._for) { - return this.parseComprehension(node, false); - } - node.elements = this.parseExprList(tt.bracketR, true, true, refShorthandDefaultPos); - return this.finishNode(node, "ArrayExpression"); - - case tt.braceL: - return this.parseObj(false, refShorthandDefaultPos); - - case tt._function: - node = this.startNode(); - this.next(); - return this.parseFunction(node, false); - - case tt._class: - return this.parseClass(this.startNode(), false); - - case tt._new: - return this.parseNew(); - - case tt.backQuote: - return this.parseTemplate(); - - default: - this.unexpected(); - } -}; - -pp.parseLiteral = function (value) { - var node = this.startNode(); - node.value = value; - node.raw = this.input.slice(this.start, this.end); - this.next(); - return this.finishNode(node, "Literal"); -}; - -pp.parseParenExpression = function () { - this.expect(tt.parenL); - var val = this.parseExpression(); - this.expect(tt.parenR); - return val; -}; - -pp.parseParenAndDistinguishExpression = function (canBeArrow) { - var startPos = this.start, - startLoc = this.startLoc, - val = undefined; - if (this.options.ecmaVersion >= 6) { - this.next(); - - if (this.options.ecmaVersion >= 7 && this.type === tt._for) { - return this.parseComprehension(this.startNodeAt(startPos, startLoc), true); - } - - var innerStartPos = this.start, - innerStartLoc = this.startLoc; - var exprList = [], - first = true; - var refShorthandDefaultPos = { start: 0 }, - spreadStart = undefined, - innerParenStart = undefined; - while (this.type !== tt.parenR) { - first ? first = false : this.expect(tt.comma); - if (this.type === tt.ellipsis) { - spreadStart = this.start; - exprList.push(this.parseParenItem(this.parseRest())); - break; - } else { - if (this.type === tt.parenL && !innerParenStart) { - innerParenStart = this.start; - } - exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem)); - } - } - var innerEndPos = this.start, - innerEndLoc = this.startLoc; - this.expect(tt.parenR); - - if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) { - if (innerParenStart) this.unexpected(innerParenStart); - return this.parseParenArrowList(startPos, startLoc, exprList); - } - - if (!exprList.length) this.unexpected(this.lastTokStart); - if (spreadStart) this.unexpected(spreadStart); - if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start); - - if (exprList.length > 1) { - val = this.startNodeAt(innerStartPos, innerStartLoc); - val.expressions = exprList; - this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); - } else { - val = exprList[0]; - } - } else { - val = this.parseParenExpression(); - } - - if (this.options.preserveParens) { - var par = this.startNodeAt(startPos, startLoc); - par.expression = val; - return this.finishNode(par, "ParenthesizedExpression"); - } else { - return val; - } -}; - -pp.parseParenItem = function (item) { - return item; -}; - -pp.parseParenArrowList = function (startPos, startLoc, exprList) { - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList); -}; - -// New's precedence is slightly tricky. It must allow its argument -// to be a `[]` or dot subscript expression, but not a call — at -// least, not without wrapping it in parentheses. Thus, it uses the - -var empty = []; - -pp.parseNew = function () { - var node = this.startNode(); - var meta = this.parseIdent(true); - if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) { - node.meta = meta; - node.property = this.parseIdent(true); - if (node.property.name !== "target") this.raise(node.property.start, "The only valid meta property for new is new.target"); - return this.finishNode(node, "MetaProperty"); - } - var startPos = this.start, - startLoc = this.startLoc; - node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true); - if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, false);else node.arguments = empty; - return this.finishNode(node, "NewExpression"); -}; - -// Parse template expression. - -pp.parseTemplateElement = function () { - var elem = this.startNode(); - elem.value = { - raw: this.input.slice(this.start, this.end), - cooked: this.value - }; - this.next(); - elem.tail = this.type === tt.backQuote; - return this.finishNode(elem, "TemplateElement"); -}; - -pp.parseTemplate = function () { - var node = this.startNode(); - this.next(); - node.expressions = []; - var curElt = this.parseTemplateElement(); - node.quasis = [curElt]; - while (!curElt.tail) { - this.expect(tt.dollarBraceL); - node.expressions.push(this.parseExpression()); - this.expect(tt.braceR); - node.quasis.push(curElt = this.parseTemplateElement()); - } - this.next(); - return this.finishNode(node, "TemplateLiteral"); -}; - -// Parse an object literal or binding pattern. - -pp.parseObj = function (isPattern, refShorthandDefaultPos) { - var node = this.startNode(), - first = true, - propHash = {}; - node.properties = []; - this.next(); - while (!this.eat(tt.braceR)) { - if (!first) { - this.expect(tt.comma); - if (this.afterTrailingComma(tt.braceR)) break; - } else first = false; - - var prop = this.startNode(), - isGenerator = undefined, - startPos = undefined, - startLoc = undefined; - if (this.options.ecmaVersion >= 6) { - prop.method = false; - prop.shorthand = false; - if (isPattern || refShorthandDefaultPos) { - startPos = this.start; - startLoc = this.startLoc; - } - if (!isPattern) isGenerator = this.eat(tt.star); - } - this.parsePropertyName(prop); - this.parsePropertyValue(prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos); - this.checkPropClash(prop, propHash); - node.properties.push(this.finishNode(prop, "Property")); - } - return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); -}; - -pp.parsePropertyValue = function (prop, isPattern, isGenerator, startPos, startLoc, refShorthandDefaultPos) { - if (this.eat(tt.colon)) { - prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos); - prop.kind = "init"; - } else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) { - if (isPattern) this.unexpected(); - prop.kind = "init"; - prop.method = true; - prop.value = this.parseMethod(isGenerator); - } else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.type != tt.comma && this.type != tt.braceR)) { - if (isGenerator || isPattern) this.unexpected(); - prop.kind = prop.key.name; - this.parsePropertyName(prop); - prop.value = this.parseMethod(false); - } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { - prop.kind = "init"; - if (isPattern) { - if (this.isKeyword(prop.key.name) || this.strict && (reservedWords.strictBind(prop.key.name) || reservedWords.strict(prop.key.name)) || !this.options.allowReserved && this.isReservedWord(prop.key.name)) this.raise(prop.key.start, "Binding " + prop.key.name); - prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key); - } else if (this.type === tt.eq && refShorthandDefaultPos) { - if (!refShorthandDefaultPos.start) refShorthandDefaultPos.start = this.start; - prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key); - } else { - prop.value = prop.key; - } - prop.shorthand = true; - } else this.unexpected(); -}; - -pp.parsePropertyName = function (prop) { - if (this.options.ecmaVersion >= 6) { - if (this.eat(tt.bracketL)) { - prop.computed = true; - prop.key = this.parseMaybeAssign(); - this.expect(tt.bracketR); - return prop.key; - } else { - prop.computed = false; - } - } - return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true); -}; - -// Initialize empty function node. - -pp.initFunction = function (node) { - node.id = null; - if (this.options.ecmaVersion >= 6) { - node.generator = false; - node.expression = false; - } -}; - -// Parse object or class method. - -pp.parseMethod = function (isGenerator) { - var node = this.startNode(); - this.initFunction(node); - this.expect(tt.parenL); - node.params = this.parseBindingList(tt.parenR, false, false); - var allowExpressionBody = undefined; - if (this.options.ecmaVersion >= 6) { - node.generator = isGenerator; - allowExpressionBody = true; - } else { - allowExpressionBody = false; - } - this.parseFunctionBody(node, allowExpressionBody); - return this.finishNode(node, "FunctionExpression"); -}; - -// Parse arrow function expression with given parameters. - -pp.parseArrowExpression = function (node, params) { - this.initFunction(node); - node.params = this.toAssignableList(params, true); - this.parseFunctionBody(node, true); - return this.finishNode(node, "ArrowFunctionExpression"); -}; - -// Parse function body and check parameters. - -pp.parseFunctionBody = function (node, allowExpression) { - var isExpression = allowExpression && this.type !== tt.braceL; - - if (isExpression) { - node.body = this.parseMaybeAssign(); - node.expression = true; - } else { - // Start a new scope with regard to labels and the `inFunction` - // flag (restore them to their old value afterwards). - var oldInFunc = this.inFunction, - oldInGen = this.inGenerator, - oldLabels = this.labels; - this.inFunction = true;this.inGenerator = node.generator;this.labels = []; - node.body = this.parseBlock(true); - node.expression = false; - this.inFunction = oldInFunc;this.inGenerator = oldInGen;this.labels = oldLabels; - } - - // If this is a strict mode function, verify that argument names - // are not repeated, and it does not try to bind the words `eval` - // or `arguments`. - if (this.strict || !isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) { - var nameHash = {}, - oldStrict = this.strict; - this.strict = true; - if (node.id) this.checkLVal(node.id, true); - for (var i = 0; i < node.params.length; i++) { - this.checkLVal(node.params[i], true, nameHash); - }this.strict = oldStrict; - } -}; - -// Parses a comma-separated list of expressions, and returns them as -// an array. `close` is the token type that ends the list, and -// `allowEmpty` can be turned on to allow subsequent commas with -// nothing in between them to be parsed as `null` (which is needed -// for array literals). - -pp.parseExprList = function (close, allowTrailingComma, allowEmpty, refShorthandDefaultPos) { - var elts = [], - first = true; - while (!this.eat(close)) { - if (!first) { - this.expect(tt.comma); - if (allowTrailingComma && this.afterTrailingComma(close)) break; - } else first = false; - - if (allowEmpty && this.type === tt.comma) { - elts.push(null); - } else { - if (this.type === tt.ellipsis) elts.push(this.parseSpread(refShorthandDefaultPos));else elts.push(this.parseMaybeAssign(false, refShorthandDefaultPos)); - } - } - return elts; -}; - -// Parse the next token as an identifier. If `liberal` is true (used -// when parsing properties), it will also convert keywords into -// identifiers. - -pp.parseIdent = function (liberal) { - var node = this.startNode(); - if (liberal && this.options.allowReserved == "never") liberal = false; - if (this.type === tt.name) { - if (!liberal && (!this.options.allowReserved && this.isReservedWord(this.value) || this.strict && reservedWords.strict(this.value) && (this.options.ecmaVersion >= 6 || this.input.slice(this.start, this.end).indexOf("\\") == -1))) this.raise(this.start, "The keyword '" + this.value + "' is reserved"); - node.name = this.value; - } else if (liberal && this.type.keyword) { - node.name = this.type.keyword; - } else { - this.unexpected(); - } - this.next(); - return this.finishNode(node, "Identifier"); -}; - -// Parses yield expression inside generator. - -pp.parseYield = function () { - var node = this.startNode(); - this.next(); - if (this.type == tt.semi || this.canInsertSemicolon() || this.type != tt.star && !this.type.startsExpr) { - node.delegate = false; - node.argument = null; - } else { - node.delegate = this.eat(tt.star); - node.argument = this.parseMaybeAssign(); - } - return this.finishNode(node, "YieldExpression"); -}; - -// Parses array and generator comprehensions. - -pp.parseComprehension = function (node, isGenerator) { - node.blocks = []; - while (this.type === tt._for) { - var block = this.startNode(); - this.next(); - this.expect(tt.parenL); - block.left = this.parseBindingAtom(); - this.checkLVal(block.left, true); - this.expectContextual("of"); - block.right = this.parseExpression(); - this.expect(tt.parenR); - node.blocks.push(this.finishNode(block, "ComprehensionBlock")); - } - node.filter = this.eat(tt._if) ? this.parseParenExpression() : null; - node.body = this.parseExpression(); - this.expect(isGenerator ? tt.parenR : tt.bracketR); - node.generator = isGenerator; - return this.finishNode(node, "ComprehensionExpression"); -}; - -},{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],7:[function(_dereq_,module,exports){ - - -// Test whether a given character code starts an identifier. - -"use strict"; - -exports.isIdentifierStart = isIdentifierStart; - -// Test whether a given character is part of an identifier. - -exports.isIdentifierChar = isIdentifierChar; -exports.__esModule = true; -// This is a trick taken from Esprima. It turns out that, on -// non-Chrome browsers, to check whether a string is in a set, a -// predicate containing a big ugly `switch` statement is faster than -// a regular expression, and on Chrome the two are about on par. -// This function uses `eval` (non-lexical) to produce such a -// predicate from a space-separated string of words. -// -// It starts by sorting the words by length. - -function makePredicate(words) { - words = words.split(" "); - var f = "", - cats = []; - out: for (var i = 0; i < words.length; ++i) { - for (var j = 0; j < cats.length; ++j) { - if (cats[j][0].length == words[i].length) { - cats[j].push(words[i]); - continue out; - } - }cats.push([words[i]]); - } - function compareTo(arr) { - if (arr.length == 1) { - return f += "return str === " + JSON.stringify(arr[0]) + ";"; - }f += "switch(str){"; - for (var i = 0; i < arr.length; ++i) { - f += "case " + JSON.stringify(arr[i]) + ":"; - }f += "return true}return false;"; - } - - // When there are more than three length categories, an outer - // switch first dispatches on the lengths, to save on comparisons. - - if (cats.length > 3) { - cats.sort(function (a, b) { - return b.length - a.length; - }); - f += "switch(str.length){"; - for (var i = 0; i < cats.length; ++i) { - var cat = cats[i]; - f += "case " + cat[0].length + ":"; - compareTo(cat); - } - f += "}" - - // Otherwise, simply generate a flat `switch` statement. - - ; - } else { - compareTo(words); - } - return new Function("str", f); -} - -// Reserved word lists for various dialects of the language - -var reservedWords = { - 3: makePredicate("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile"), - 5: makePredicate("class enum extends super const export import"), - 6: makePredicate("enum await"), - strict: makePredicate("implements interface let package private protected public static yield"), - strictBind: makePredicate("eval arguments") -}; - -exports.reservedWords = reservedWords; -// And the keywords - -var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"; - -var keywords = { - 5: makePredicate(ecma5AndLessKeywords), - 6: makePredicate(ecma5AndLessKeywords + " let const class extends export import yield super") -}; - -exports.keywords = keywords; -// ## Character categories - -// Big ugly regular expressions that match characters in the -// whitespace, identifier, and identifier-start categories. These -// are only applied when a character is found to actually have a -// code point above 128. -// Generated by `tools/generate-identifier-regex.js`. - -var nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ"; -var nonASCIIidentifierChars = "‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_"; - -var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); -var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); - -nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; - -// These are a run-length and offset encoded representation of the -// >0xffff code points that are a valid part of identifiers. The -// offset starts at 0x10000, and each pair of numbers represents an -// offset to the next range, and then a size of the range. They were -// generated by tools/generate-identifier-regex.js -var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 99, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 98, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 955, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 38, 17, 2, 24, 133, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 32, 4, 287, 47, 21, 1, 2, 0, 185, 46, 82, 47, 21, 0, 60, 42, 502, 63, 32, 0, 449, 56, 1288, 920, 104, 110, 2962, 1070, 13266, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 16481, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 1340, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 16355, 541]; -var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 16, 9, 83, 11, 168, 11, 6, 9, 8, 2, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 316, 19, 13, 9, 214, 6, 3, 8, 112, 16, 16, 9, 82, 12, 9, 9, 535, 9, 20855, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 4305, 6, 792618, 239]; - -// This has a complexity linear to the value of the code. The -// assumption is that looking up astral identifier characters is -// rare. -function isInAstralSet(code, set) { - var pos = 65536; - for (var i = 0; i < set.length; i += 2) { - pos += set[i]; - if (pos > code) { - return false; - }pos += set[i + 1]; - if (pos >= code) { - return true; - } - } -} -function isIdentifierStart(code, astral) { - if (code < 65) { - return code === 36; - }if (code < 91) { - return true; - }if (code < 97) { - return code === 95; - }if (code < 123) { - return true; - }if (code <= 65535) { - return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code)); - }if (astral === false) { - return false; - }return isInAstralSet(code, astralIdentifierStartCodes); -} - -function isIdentifierChar(code, astral) { - if (code < 48) { - return code === 36; - }if (code < 58) { - return true; - }if (code < 65) { - return false; - }if (code < 91) { - return true; - }if (code < 97) { - return code === 95; - }if (code < 123) { - return true; - }if (code <= 65535) { - return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code)); - }if (astral === false) { - return false; - }return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); -} - -},{}],8:[function(_dereq_,module,exports){ -"use strict"; - -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; - -// The `getLineInfo` function is mostly useful when the -// `locations` option is off (for performance reasons) and you -// want to find the line/column position for a given character -// offset. `input` should be the code string that the offset refers -// into. - -exports.getLineInfo = getLineInfo; -exports.__esModule = true; - -var Parser = _dereq_("./state").Parser; - -var lineBreakG = _dereq_("./whitespace").lineBreakG; - -var deprecate = _dereq_("util").deprecate; - -// These are used when `options.locations` is on, for the -// `startLoc` and `endLoc` properties. - -var Position = exports.Position = (function () { - function Position(line, col) { - _classCallCheck(this, Position); - - this.line = line; - this.column = col; - } - - Position.prototype.offset = function offset(n) { - return new Position(this.line, this.column + n); - }; - - return Position; -})(); - -var SourceLocation = exports.SourceLocation = function SourceLocation(p, start, end) { - _classCallCheck(this, SourceLocation); - - this.start = start; - this.end = end; - if (p.sourceFile !== null) this.source = p.sourceFile; -}; - -function getLineInfo(input, offset) { - for (var line = 1, cur = 0;;) { - lineBreakG.lastIndex = cur; - var match = lineBreakG.exec(input); - if (match && match.index < offset) { - ++line; - cur = match.index + match[0].length; - } else { - return new Position(line, offset - cur); - } - } -} - -var pp = Parser.prototype; - -// This function is used to raise exceptions on parse errors. It -// takes an offset integer (into the current `input`) to indicate -// the location of the error, attaches the position to the end -// of the error message, and then raises a `SyntaxError` with that -// message. - -pp.raise = function (pos, message) { - var loc = getLineInfo(this.input, pos); - message += " (" + loc.line + ":" + loc.column + ")"; - var err = new SyntaxError(message); - err.pos = pos;err.loc = loc;err.raisedAt = this.pos; - throw err; -}; - -pp.curPosition = function () { - return new Position(this.curLine, this.pos - this.lineStart); -}; - -pp.markPosition = function () { - return this.options.locations ? [this.start, this.startLoc] : this.start; -}; - -},{"./state":13,"./whitespace":19,"util":5}],9:[function(_dereq_,module,exports){ -"use strict"; - -var tt = _dereq_("./tokentype").types; - -var Parser = _dereq_("./state").Parser; - -var reservedWords = _dereq_("./identifier").reservedWords; - -var has = _dereq_("./util").has; - -var pp = Parser.prototype; - -// Convert existing expression atom to assignable pattern -// if possible. - -pp.toAssignable = function (node, isBinding) { - if (this.options.ecmaVersion >= 6 && node) { - switch (node.type) { - case "Identifier": - case "ObjectPattern": - case "ArrayPattern": - case "AssignmentPattern": - break; - - case "ObjectExpression": - node.type = "ObjectPattern"; - for (var i = 0; i < node.properties.length; i++) { - var prop = node.properties[i]; - if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter"); - this.toAssignable(prop.value, isBinding); - } - break; - - case "ArrayExpression": - node.type = "ArrayPattern"; - this.toAssignableList(node.elements, isBinding); - break; - - case "AssignmentExpression": - if (node.operator === "=") { - node.type = "AssignmentPattern"; - } else { - this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); - } - break; - - case "ParenthesizedExpression": - node.expression = this.toAssignable(node.expression, isBinding); - break; - - case "MemberExpression": - if (!isBinding) break; - - default: - this.raise(node.start, "Assigning to rvalue"); - } - } - return node; -}; - -// Convert list of expression atoms to binding list. - -pp.toAssignableList = function (exprList, isBinding) { - var end = exprList.length; - if (end) { - var last = exprList[end - 1]; - if (last && last.type == "RestElement") { - --end; - } else if (last && last.type == "SpreadElement") { - last.type = "RestElement"; - var arg = last.argument; - this.toAssignable(arg, isBinding); - if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") this.unexpected(arg.start); - --end; - } - } - for (var i = 0; i < end; i++) { - var elt = exprList[i]; - if (elt) this.toAssignable(elt, isBinding); - } - return exprList; -}; - -// Parses spread element. - -pp.parseSpread = function (refShorthandDefaultPos) { - var node = this.startNode(); - this.next(); - node.argument = this.parseMaybeAssign(refShorthandDefaultPos); - return this.finishNode(node, "SpreadElement"); -}; - -pp.parseRest = function () { - var node = this.startNode(); - this.next(); - node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected(); - return this.finishNode(node, "RestElement"); -}; - -// Parses lvalue (assignable) atom. - -pp.parseBindingAtom = function () { - if (this.options.ecmaVersion < 6) return this.parseIdent(); - switch (this.type) { - case tt.name: - return this.parseIdent(); - - case tt.bracketL: - var node = this.startNode(); - this.next(); - node.elements = this.parseBindingList(tt.bracketR, true, true); - return this.finishNode(node, "ArrayPattern"); - - case tt.braceL: - return this.parseObj(true); - - default: - this.unexpected(); - } -}; - -pp.parseBindingList = function (close, allowEmpty, allowTrailingComma) { - var elts = [], - first = true; - while (!this.eat(close)) { - if (first) first = false;else this.expect(tt.comma); - if (allowEmpty && this.type === tt.comma) { - elts.push(null); - } else if (allowTrailingComma && this.afterTrailingComma(close)) { - break; - } else if (this.type === tt.ellipsis) { - var rest = this.parseRest(); - this.parseBindingListItem(rest); - elts.push(rest); - this.expect(close); - break; - } else { - var elem = this.parseMaybeDefault(this.start, this.startLoc); - this.parseBindingListItem(elem); - elts.push(elem); - } - } - return elts; -}; - -pp.parseBindingListItem = function (param) { - return param; -}; - -// Parses assignment pattern around given atom if possible. - -pp.parseMaybeDefault = function (startPos, startLoc, left) { - if (Array.isArray(startPos)) { - if (this.options.locations && noCalls === undefined) { - // shift arguments to left by one - left = startLoc; - // flatten startPos - startLoc = startPos[1]; - startPos = startPos[0]; - } - } - left = left || this.parseBindingAtom(); - if (!this.eat(tt.eq)) return left; - var node = this.startNodeAt(startPos, startLoc); - node.operator = "="; - node.left = left; - node.right = this.parseMaybeAssign(); - return this.finishNode(node, "AssignmentPattern"); -}; - -// Verify that a node is an lval — something that can be assigned -// to. - -pp.checkLVal = function (expr, isBinding, checkClashes) { - switch (expr.type) { - case "Identifier": - if (this.strict && (reservedWords.strictBind(expr.name) || reservedWords.strict(expr.name))) this.raise(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); - if (checkClashes) { - if (has(checkClashes, expr.name)) this.raise(expr.start, "Argument name clash in strict mode"); - checkClashes[expr.name] = true; - } - break; - - case "MemberExpression": - if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression"); - break; - - case "ObjectPattern": - for (var i = 0; i < expr.properties.length; i++) { - this.checkLVal(expr.properties[i].value, isBinding, checkClashes); - }break; - - case "ArrayPattern": - for (var i = 0; i < expr.elements.length; i++) { - var elem = expr.elements[i]; - if (elem) this.checkLVal(elem, isBinding, checkClashes); - } - break; - - case "AssignmentPattern": - this.checkLVal(expr.left, isBinding, checkClashes); - break; - - case "RestElement": - this.checkLVal(expr.argument, isBinding, checkClashes); - break; - - case "ParenthesizedExpression": - this.checkLVal(expr.expression, isBinding, checkClashes); - break; - - default: - this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue"); - } -}; - -},{"./identifier":7,"./state":13,"./tokentype":17,"./util":18}],10:[function(_dereq_,module,exports){ -"use strict"; - -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; - -exports.__esModule = true; - -var Parser = _dereq_("./state").Parser; - -var SourceLocation = _dereq_("./location").SourceLocation; - -// Start an AST node, attaching a start offset. - -var pp = Parser.prototype; - -var Node = exports.Node = function Node() { - _classCallCheck(this, Node); -}; - -pp.startNode = function () { - var node = new Node(); - node.start = this.start; - if (this.options.locations) node.loc = new SourceLocation(this, this.startLoc); - if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile; - if (this.options.ranges) node.range = [this.start, 0]; - return node; -}; - -pp.startNodeAt = function (pos, loc) { - var node = new Node(); - if (Array.isArray(pos)) { - if (this.options.locations && loc === undefined) { - // flatten pos - loc = pos[1]; - pos = pos[0]; - } - } - node.start = pos; - if (this.options.locations) node.loc = new SourceLocation(this, loc); - if (this.options.directSourceFile) node.sourceFile = this.options.directSourceFile; - if (this.options.ranges) node.range = [pos, 0]; - return node; -}; - -// Finish an AST node, adding `type` and `end` properties. - -pp.finishNode = function (node, type) { - node.type = type; - node.end = this.lastTokEnd; - if (this.options.locations) node.loc.end = this.lastTokEndLoc; - if (this.options.ranges) node.range[1] = this.lastTokEnd; - return node; -}; - -// Finish node at given position - -pp.finishNodeAt = function (node, type, pos, loc) { - node.type = type; - if (Array.isArray(pos)) { - if (this.options.locations && loc === undefined) { - // flatten pos - loc = pos[1]; - pos = pos[0]; - } - } - node.end = pos; - if (this.options.locations) node.loc.end = loc; - if (this.options.ranges) node.range[1] = pos; - return node; -}; - -},{"./location":8,"./state":13}],11:[function(_dereq_,module,exports){ - - -// Interpret and default an options object - -"use strict"; - -exports.getOptions = getOptions; -exports.__esModule = true; - -var _util = _dereq_("./util"); - -var has = _util.has; -var isArray = _util.isArray; - -var SourceLocation = _dereq_("./location").SourceLocation; - -// A second optional argument can be given to further configure -// the parser process. These options are recognized: - -var defaultOptions = { - // `ecmaVersion` indicates the ECMAScript version to parse. Must - // be either 3, or 5, or 6. This influences support for strict - // mode, the set of reserved words, support for getters and - // setters and other features. - ecmaVersion: 5, - // Source type ("script" or "module") for different semantics - sourceType: "script", - // `onInsertedSemicolon` can be a callback that will be called - // when a semicolon is automatically inserted. It will be passed - // th position of the comma as an offset, and if `locations` is - // enabled, it is given the location as a `{line, column}` object - // as second argument. - onInsertedSemicolon: null, - // `onTrailingComma` is similar to `onInsertedSemicolon`, but for - // trailing commas. - onTrailingComma: null, - // By default, reserved words are not enforced. Disable - // `allowReserved` to enforce them. When this option has the - // value "never", reserved words and keywords can also not be - // used as property names. - allowReserved: true, - // When enabled, a return at the top level is not considered an - // error. - allowReturnOutsideFunction: false, - // When enabled, import/export statements are not constrained to - // appearing at the top of the program. - allowImportExportEverywhere: false, - // When enabled, hashbang directive in the beginning of file - // is allowed and treated as a line comment. - allowHashBang: false, - // When `locations` is on, `loc` properties holding objects with - // `start` and `end` properties in `{line, column}` form (with - // line being 1-based and column 0-based) will be attached to the - // nodes. - locations: false, - // A function can be passed as `onToken` option, which will - // cause Acorn to call that function with object in the same - // format as tokenize() returns. Note that you are not - // allowed to call the parser from the callback—that will - // corrupt its internal state. - onToken: null, - // A function can be passed as `onComment` option, which will - // cause Acorn to call that function with `(block, text, start, - // end)` parameters whenever a comment is skipped. `block` is a - // boolean indicating whether this is a block (`/* */`) comment, - // `text` is the content of the comment, and `start` and `end` are - // character offsets that denote the start and end of the comment. - // When the `locations` option is on, two more parameters are - // passed, the full `{line, column}` locations of the start and - // end of the comments. Note that you are not allowed to call the - // parser from the callback—that will corrupt its internal state. - onComment: null, - // Nodes have their start and end characters offsets recorded in - // `start` and `end` properties (directly on the node, rather than - // the `loc` object, which holds line/column data. To also add a - // [semi-standardized][range] `range` property holding a `[start, - // end]` array with the same numbers, set the `ranges` option to - // `true`. - // - // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 - ranges: false, - // It is possible to parse multiple files into a single AST by - // passing the tree produced by parsing the first file as - // `program` option in subsequent parses. This will add the - // toplevel forms of the parsed file to the `Program` (top) node - // of an existing parse tree. - program: null, - // When `locations` is on, you can pass this to record the source - // file in every node's `loc` object. - sourceFile: null, - // This value, if given, is stored in every node, whether - // `locations` is on or off. - directSourceFile: null, - // When enabled, parenthesized expressions are represented by - // (non-standard) ParenthesizedExpression nodes - preserveParens: false, - plugins: {} -};exports.defaultOptions = defaultOptions; - -function getOptions(opts) { - var options = {}; - for (var opt in defaultOptions) { - options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]; - }if (isArray(options.onToken)) { - (function () { - var tokens = options.onToken; - options.onToken = function (token) { - return tokens.push(token); - }; - })(); - } - if (isArray(options.onComment)) options.onComment = pushComment(options, options.onComment); - - return options; -} - -function pushComment(options, array) { - return function (block, text, start, end, startLoc, endLoc) { - var comment = { - type: block ? "Block" : "Line", - value: text, - start: start, - end: end - }; - if (options.locations) comment.loc = new SourceLocation(this, startLoc, endLoc); - if (options.ranges) comment.range = [start, end]; - array.push(comment); - }; -} - -},{"./location":8,"./util":18}],12:[function(_dereq_,module,exports){ -"use strict"; - -var tt = _dereq_("./tokentype").types; - -var Parser = _dereq_("./state").Parser; - -var lineBreak = _dereq_("./whitespace").lineBreak; - -var pp = Parser.prototype; - -// ## Parser utilities - -// Test whether a statement node is the string literal `"use strict"`. - -pp.isUseStrict = function (stmt) { - return this.options.ecmaVersion >= 5 && stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && stmt.expression.value === "use strict"; -}; - -// Predicate that tests whether the next token is of the given -// type, and if yes, consumes it as a side effect. - -pp.eat = function (type) { - if (this.type === type) { - this.next(); - return true; - } else { - return false; - } -}; - -// Tests whether parsed token is a contextual keyword. - -pp.isContextual = function (name) { - return this.type === tt.name && this.value === name; -}; - -// Consumes contextual keyword if possible. - -pp.eatContextual = function (name) { - return this.value === name && this.eat(tt.name); -}; - -// Asserts that following token is given contextual keyword. - -pp.expectContextual = function (name) { - if (!this.eatContextual(name)) this.unexpected(); -}; - -// Test whether a semicolon can be inserted at the current position. - -pp.canInsertSemicolon = function () { - return this.type === tt.eof || this.type === tt.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); -}; - -pp.insertSemicolon = function () { - if (this.canInsertSemicolon()) { - if (this.options.onInsertedSemicolon) this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); - return true; - } -}; - -// Consume a semicolon, or, failing that, see if we are allowed to -// pretend that there is a semicolon at this position. - -pp.semicolon = function () { - if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected(); -}; - -pp.afterTrailingComma = function (tokType) { - if (this.type == tokType) { - if (this.options.onTrailingComma) this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); - this.next(); - return true; - } -}; - -// Expect a token of a given type. If found, consume it, otherwise, -// raise an unexpected token error. - -pp.expect = function (type) { - this.eat(type) || this.unexpected(); -}; - -// Raise an unexpected token error. - -pp.unexpected = function (pos) { - this.raise(pos != null ? pos : this.start, "Unexpected token"); -}; - -},{"./state":13,"./tokentype":17,"./whitespace":19}],13:[function(_dereq_,module,exports){ -"use strict"; - -exports.Parser = Parser; -exports.__esModule = true; - -var _identifier = _dereq_("./identifier"); - -var reservedWords = _identifier.reservedWords; -var keywords = _identifier.keywords; - -var tt = _dereq_("./tokentype").types; - -var lineBreak = _dereq_("./whitespace").lineBreak; - -function Parser(options, input, startPos) { - this.options = options; - this.sourceFile = this.options.sourceFile || null; - this.isKeyword = keywords[this.options.ecmaVersion >= 6 ? 6 : 5]; - this.isReservedWord = reservedWords[this.options.ecmaVersion]; - this.input = input; - - // Load plugins - this.loadPlugins(this.options.plugins); - - // Set up token state - - // The current position of the tokenizer in the input. - if (startPos) { - this.pos = startPos; - this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos)); - this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length; - } else { - this.pos = this.lineStart = 0; - this.curLine = 1; - } - - // Properties of the current token: - // Its type - this.type = tt.eof; - // For tokens that include more information than their type, the value - this.value = null; - // Its start and end offset - this.start = this.end = this.pos; - // And, if locations are used, the {line, column} object - // corresponding to those offsets - this.startLoc = this.endLoc = null; - - // Position information for the previous token - this.lastTokEndLoc = this.lastTokStartLoc = null; - this.lastTokStart = this.lastTokEnd = this.pos; - - // The context stack is used to superficially track syntactic - // context to predict whether a regular expression is allowed in a - // given position. - this.context = this.initialContext(); - this.exprAllowed = true; - - // Figure out if it's a module code. - this.strict = this.inModule = this.options.sourceType === "module"; - - // Used to signify the start of a potential arrow function - this.potentialArrowAt = -1; - - // Flags to track whether we are in a function, a generator. - this.inFunction = this.inGenerator = false; - // Labels in scope. - this.labels = []; - - // If enabled, skip leading hashbang line. - if (this.pos === 0 && this.options.allowHashBang && this.input.slice(0, 2) === "#!") this.skipLineComment(2); -} - -Parser.prototype.extend = function (name, f) { - this[name] = f(this[name]); -}; - -// Registered plugins - -var plugins = {}; - -exports.plugins = plugins; -Parser.prototype.loadPlugins = function (plugins) { - for (var _name in plugins) { - var plugin = exports.plugins[_name]; - if (!plugin) throw new Error("Plugin '" + _name + "' not found"); - plugin(this, plugins[_name]); - } -}; - -},{"./identifier":7,"./tokentype":17,"./whitespace":19}],14:[function(_dereq_,module,exports){ -"use strict"; - -var tt = _dereq_("./tokentype").types; - -var Parser = _dereq_("./state").Parser; - -var lineBreak = _dereq_("./whitespace").lineBreak; - -var pp = Parser.prototype; - -// ### Statement parsing - -// Parse a program. Initializes the parser, reads any number of -// statements, and wraps them in a Program node. Optionally takes a -// `program` argument. If present, the statements will be appended -// to its body instead of creating a new node. - -pp.parseTopLevel = function (node) { - var first = true; - if (!node.body) node.body = []; - while (this.type !== tt.eof) { - var stmt = this.parseStatement(true, true); - node.body.push(stmt); - if (first && this.isUseStrict(stmt)) this.setStrict(true); - first = false; - } - this.next(); - if (this.options.ecmaVersion >= 6) { - node.sourceType = this.options.sourceType; - } - return this.finishNode(node, "Program"); -}; - -var loopLabel = { kind: "loop" }, - switchLabel = { kind: "switch" }; - -// Parse a single statement. -// -// If expecting a statement and finding a slash operator, parse a -// regular expression literal. This is to handle cases like -// `if (foo) /blah/.exec(foo)`, where looking at the previous token -// does not help. - -pp.parseStatement = function (declaration, topLevel) { - var starttype = this.type, - node = this.startNode(); - - // Most types of statements are recognized by the keyword they - // start with. Many are trivial to parse, some require a bit of - // complexity. - - switch (starttype) { - case tt._break:case tt._continue: - return this.parseBreakContinueStatement(node, starttype.keyword); - case tt._debugger: - return this.parseDebuggerStatement(node); - case tt._do: - return this.parseDoStatement(node); - case tt._for: - return this.parseForStatement(node); - case tt._function: - if (!declaration && this.options.ecmaVersion >= 6) this.unexpected(); - return this.parseFunctionStatement(node); - case tt._class: - if (!declaration) this.unexpected(); - return this.parseClass(node, true); - case tt._if: - return this.parseIfStatement(node); - case tt._return: - return this.parseReturnStatement(node); - case tt._switch: - return this.parseSwitchStatement(node); - case tt._throw: - return this.parseThrowStatement(node); - case tt._try: - return this.parseTryStatement(node); - case tt._let:case tt._const: - if (!declaration) this.unexpected(); // NOTE: falls through to _var - case tt._var: - return this.parseVarStatement(node, starttype); - case tt._while: - return this.parseWhileStatement(node); - case tt._with: - return this.parseWithStatement(node); - case tt.braceL: - return this.parseBlock(); - case tt.semi: - return this.parseEmptyStatement(node); - case tt._export: - case tt._import: - if (!this.options.allowImportExportEverywhere) { - if (!topLevel) this.raise(this.start, "'import' and 'export' may only appear at the top level"); - if (!this.inModule) this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); - } - return starttype === tt._import ? this.parseImport(node) : this.parseExport(node); - - // If the statement does not start with a statement keyword or a - // brace, it's an ExpressionStatement or LabeledStatement. We - // simply start parsing an expression, and afterwards, if the - // next token is a colon and the expression was a simple - // Identifier node, we switch to interpreting it as a label. - default: - var maybeName = this.value, - expr = this.parseExpression(); - if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon)) return this.parseLabeledStatement(node, maybeName, expr);else return this.parseExpressionStatement(node, expr); - } -}; - -pp.parseBreakContinueStatement = function (node, keyword) { - var isBreak = keyword == "break"; - this.next(); - if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null;else if (this.type !== tt.name) this.unexpected();else { - node.label = this.parseIdent(); - this.semicolon(); - } - - // Verify that there is an actual destination to break or - // continue to. - for (var i = 0; i < this.labels.length; ++i) { - var lab = this.labels[i]; - if (node.label == null || lab.name === node.label.name) { - if (lab.kind != null && (isBreak || lab.kind === "loop")) break; - if (node.label && isBreak) break; - } - } - if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword); - return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); -}; - -pp.parseDebuggerStatement = function (node) { - this.next(); - this.semicolon(); - return this.finishNode(node, "DebuggerStatement"); -}; - -pp.parseDoStatement = function (node) { - this.next(); - this.labels.push(loopLabel); - node.body = this.parseStatement(false); - this.labels.pop(); - this.expect(tt._while); - node.test = this.parseParenExpression(); - if (this.options.ecmaVersion >= 6) this.eat(tt.semi);else this.semicolon(); - return this.finishNode(node, "DoWhileStatement"); -}; - -// Disambiguating between a `for` and a `for`/`in` or `for`/`of` -// loop is non-trivial. Basically, we have to parse the init `var` -// statement or expression, disallowing the `in` operator (see -// the second parameter to `parseExpression`), and then check -// whether the next token is `in` or `of`. When there is no init -// part (semicolon immediately after the opening parenthesis), it -// is a regular `for` loop. - -pp.parseForStatement = function (node) { - this.next(); - this.labels.push(loopLabel); - this.expect(tt.parenL); - if (this.type === tt.semi) return this.parseFor(node, null); - if (this.type === tt._var || this.type === tt._let || this.type === tt._const) { - var _init = this.startNode(), - varKind = this.type; - this.next(); - this.parseVar(_init, true, varKind); - this.finishNode(_init, "VariableDeclaration"); - if ((this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && _init.declarations.length === 1 && !(varKind !== tt._var && _init.declarations[0].init)) return this.parseForIn(node, _init); - return this.parseFor(node, _init); - } - var refShorthandDefaultPos = { start: 0 }; - var init = this.parseExpression(true, refShorthandDefaultPos); - if (this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) { - this.toAssignable(init); - this.checkLVal(init); - return this.parseForIn(node, init); - } else if (refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); - } - return this.parseFor(node, init); -}; - -pp.parseFunctionStatement = function (node) { - this.next(); - return this.parseFunction(node, true); -}; - -pp.parseIfStatement = function (node) { - this.next(); - node.test = this.parseParenExpression(); - node.consequent = this.parseStatement(false); - node.alternate = this.eat(tt._else) ? this.parseStatement(false) : null; - return this.finishNode(node, "IfStatement"); -}; - -pp.parseReturnStatement = function (node) { - if (!this.inFunction && !this.options.allowReturnOutsideFunction) this.raise(this.start, "'return' outside of function"); - this.next(); - - // In `return` (and `break`/`continue`), the keywords with - // optional arguments, we eagerly look for a semicolon or the - // possibility to insert one. - - if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null;else { - node.argument = this.parseExpression();this.semicolon(); - } - return this.finishNode(node, "ReturnStatement"); -}; - -pp.parseSwitchStatement = function (node) { - this.next(); - node.discriminant = this.parseParenExpression(); - node.cases = []; - this.expect(tt.braceL); - this.labels.push(switchLabel); - - // Statements under must be grouped (by label) in SwitchCase - // nodes. `cur` is used to keep the node that we are currently - // adding statements to. - - for (var cur, sawDefault; this.type != tt.braceR;) { - if (this.type === tt._case || this.type === tt._default) { - var isCase = this.type === tt._case; - if (cur) this.finishNode(cur, "SwitchCase"); - node.cases.push(cur = this.startNode()); - cur.consequent = []; - this.next(); - if (isCase) { - cur.test = this.parseExpression(); - } else { - if (sawDefault) this.raise(this.lastTokStart, "Multiple default clauses"); - sawDefault = true; - cur.test = null; - } - this.expect(tt.colon); - } else { - if (!cur) this.unexpected(); - cur.consequent.push(this.parseStatement(true)); - } - } - if (cur) this.finishNode(cur, "SwitchCase"); - this.next(); // Closing brace - this.labels.pop(); - return this.finishNode(node, "SwitchStatement"); -}; - -pp.parseThrowStatement = function (node) { - this.next(); - if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) this.raise(this.lastTokEnd, "Illegal newline after throw"); - node.argument = this.parseExpression(); - this.semicolon(); - return this.finishNode(node, "ThrowStatement"); -}; - -// Reused empty array added for node fields that are always empty. - -var empty = []; - -pp.parseTryStatement = function (node) { - this.next(); - node.block = this.parseBlock(); - node.handler = null; - if (this.type === tt._catch) { - var clause = this.startNode(); - this.next(); - this.expect(tt.parenL); - clause.param = this.parseBindingAtom(); - this.checkLVal(clause.param, true); - this.expect(tt.parenR); - clause.guard = null; - clause.body = this.parseBlock(); - node.handler = this.finishNode(clause, "CatchClause"); - } - node.guardedHandlers = empty; - node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null; - if (!node.handler && !node.finalizer) this.raise(node.start, "Missing catch or finally clause"); - return this.finishNode(node, "TryStatement"); -}; - -pp.parseVarStatement = function (node, kind) { - this.next(); - this.parseVar(node, false, kind); - this.semicolon(); - return this.finishNode(node, "VariableDeclaration"); -}; - -pp.parseWhileStatement = function (node) { - this.next(); - node.test = this.parseParenExpression(); - this.labels.push(loopLabel); - node.body = this.parseStatement(false); - this.labels.pop(); - return this.finishNode(node, "WhileStatement"); -}; - -pp.parseWithStatement = function (node) { - if (this.strict) this.raise(this.start, "'with' in strict mode"); - this.next(); - node.object = this.parseParenExpression(); - node.body = this.parseStatement(false); - return this.finishNode(node, "WithStatement"); -}; - -pp.parseEmptyStatement = function (node) { - this.next(); - return this.finishNode(node, "EmptyStatement"); -}; - -pp.parseLabeledStatement = function (node, maybeName, expr) { - for (var i = 0; i < this.labels.length; ++i) { - if (this.labels[i].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared"); - }var kind = this.type.isLoop ? "loop" : this.type === tt._switch ? "switch" : null; - this.labels.push({ name: maybeName, kind: kind }); - node.body = this.parseStatement(true); - this.labels.pop(); - node.label = expr; - return this.finishNode(node, "LabeledStatement"); -}; - -pp.parseExpressionStatement = function (node, expr) { - node.expression = expr; - this.semicolon(); - return this.finishNode(node, "ExpressionStatement"); -}; - -// Parse a semicolon-enclosed block of statements, handling `"use -// strict"` declarations when `allowStrict` is true (used for -// function bodies). - -pp.parseBlock = function (allowStrict) { - var node = this.startNode(), - first = true, - oldStrict = undefined; - node.body = []; - this.expect(tt.braceL); - while (!this.eat(tt.braceR)) { - var stmt = this.parseStatement(true); - node.body.push(stmt); - if (first && allowStrict && this.isUseStrict(stmt)) { - oldStrict = this.strict; - this.setStrict(this.strict = true); - } - first = false; - } - if (oldStrict === false) this.setStrict(false); - return this.finishNode(node, "BlockStatement"); -}; - -// Parse a regular `for` loop. The disambiguation code in -// `parseStatement` will already have parsed the init statement or -// expression. - -pp.parseFor = function (node, init) { - node.init = init; - this.expect(tt.semi); - node.test = this.type === tt.semi ? null : this.parseExpression(); - this.expect(tt.semi); - node.update = this.type === tt.parenR ? null : this.parseExpression(); - this.expect(tt.parenR); - node.body = this.parseStatement(false); - this.labels.pop(); - return this.finishNode(node, "ForStatement"); -}; - -// Parse a `for`/`in` and `for`/`of` loop, which are almost -// same from parser's perspective. - -pp.parseForIn = function (node, init) { - var type = this.type === tt._in ? "ForInStatement" : "ForOfStatement"; - this.next(); - node.left = init; - node.right = this.parseExpression(); - this.expect(tt.parenR); - node.body = this.parseStatement(false); - this.labels.pop(); - return this.finishNode(node, type); -}; - -// Parse a list of variable declarations. - -pp.parseVar = function (node, isFor, kind) { - node.declarations = []; - node.kind = kind.keyword; - for (;;) { - var decl = this.startNode(); - this.parseVarId(decl); - if (this.eat(tt.eq)) { - decl.init = this.parseMaybeAssign(isFor); - } else if (kind === tt._const && !(this.type === tt._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) { - this.unexpected(); - } else if (decl.id.type != "Identifier" && !(isFor && (this.type === tt._in || this.isContextual("of")))) { - this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value"); - } else { - decl.init = null; - } - node.declarations.push(this.finishNode(decl, "VariableDeclarator")); - if (!this.eat(tt.comma)) break; - } - return node; -}; - -pp.parseVarId = function (decl) { - decl.id = this.parseBindingAtom(); - this.checkLVal(decl.id, true); -}; - -// Parse a function declaration or literal (depending on the -// `isStatement` parameter). - -pp.parseFunction = function (node, isStatement, allowExpressionBody) { - this.initFunction(node); - if (this.options.ecmaVersion >= 6) node.generator = this.eat(tt.star); - if (isStatement || this.type === tt.name) node.id = this.parseIdent(); - this.parseFunctionParams(node); - this.parseFunctionBody(node, allowExpressionBody); - return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression"); -}; - -pp.parseFunctionParams = function (node) { - this.expect(tt.parenL); - node.params = this.parseBindingList(tt.parenR, false, false); -}; - -// Parse a class declaration or literal (depending on the -// `isStatement` parameter). - -pp.parseClass = function (node, isStatement) { - this.next(); - this.parseClassId(node, isStatement); - this.parseClassSuper(node); - var classBody = this.startNode(); - var hadConstructor = false; - classBody.body = []; - this.expect(tt.braceL); - while (!this.eat(tt.braceR)) { - if (this.eat(tt.semi)) continue; - var method = this.startNode(); - var isGenerator = this.eat(tt.star); - var isMaybeStatic = this.type === tt.name && this.value === "static"; - this.parsePropertyName(method); - method["static"] = isMaybeStatic && this.type !== tt.parenL; - if (method["static"]) { - if (isGenerator) this.unexpected(); - isGenerator = this.eat(tt.star); - this.parsePropertyName(method); - } - method.kind = "method"; - if (!method.computed) { - var key = method.key; - - var isGetSet = false; - if (!isGenerator && key.type === "Identifier" && this.type !== tt.parenL && (key.name === "get" || key.name === "set")) { - isGetSet = true; - method.kind = key.name; - key = this.parsePropertyName(method); - } - if (!method["static"] && (key.type === "Identifier" && key.name === "constructor" || key.type === "Literal" && key.value === "constructor")) { - if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class"); - if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier"); - if (isGenerator) this.raise(key.start, "Constructor can't be a generator"); - method.kind = "constructor"; - hadConstructor = true; - } - } - this.parseClassMethod(classBody, method, isGenerator); - } - node.body = this.finishNode(classBody, "ClassBody"); - return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); -}; - -pp.parseClassMethod = function (classBody, method, isGenerator) { - method.value = this.parseMethod(isGenerator); - classBody.body.push(this.finishNode(method, "MethodDefinition")); -}; - -pp.parseClassId = function (node, isStatement) { - node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null; -}; - -pp.parseClassSuper = function (node) { - node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null; -}; - -// Parses module export declaration. - -pp.parseExport = function (node) { - this.next(); - // export * from '...' - if (this.eat(tt.star)) { - this.expectContextual("from"); - node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected(); - this.semicolon(); - return this.finishNode(node, "ExportAllDeclaration"); - } - if (this.eat(tt._default)) { - // export default ... - var expr = this.parseMaybeAssign(); - var needsSemi = true; - if (expr.type == "FunctionExpression" || expr.type == "ClassExpression") { - needsSemi = false; - if (expr.id) { - expr.type = expr.type == "FunctionExpression" ? "FunctionDeclaration" : "ClassDeclaration"; - } - } - node.declaration = expr; - if (needsSemi) this.semicolon(); - return this.finishNode(node, "ExportDefaultDeclaration"); - } - // export var|const|let|function|class ... - if (this.shouldParseExportStatement()) { - node.declaration = this.parseStatement(true); - node.specifiers = []; - node.source = null; - } else { - // export { x, y as z } [from '...'] - node.declaration = null; - node.specifiers = this.parseExportSpecifiers(); - if (this.eatContextual("from")) { - node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected(); - } else { - node.source = null; - } - this.semicolon(); - } - return this.finishNode(node, "ExportNamedDeclaration"); -}; - -pp.shouldParseExportStatement = function () { - return this.type.keyword; -}; - -// Parses a comma-separated list of module exports. - -pp.parseExportSpecifiers = function () { - var nodes = [], - first = true; - // export { x, y as z } [from '...'] - this.expect(tt.braceL); - while (!this.eat(tt.braceR)) { - if (!first) { - this.expect(tt.comma); - if (this.afterTrailingComma(tt.braceR)) break; - } else first = false; - - var node = this.startNode(); - node.local = this.parseIdent(this.type === tt._default); - node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local; - nodes.push(this.finishNode(node, "ExportSpecifier")); - } - return nodes; -}; - -// Parses import declaration. - -pp.parseImport = function (node) { - this.next(); - // import '...' - if (this.type === tt.string) { - node.specifiers = empty; - node.source = this.parseExprAtom(); - node.kind = ""; - } else { - node.specifiers = this.parseImportSpecifiers(); - this.expectContextual("from"); - node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected(); - } - this.semicolon(); - return this.finishNode(node, "ImportDeclaration"); -}; - -// Parses a comma-separated list of module imports. - -pp.parseImportSpecifiers = function () { - var nodes = [], - first = true; - if (this.type === tt.name) { - // import defaultObj, { x, y as z } from '...' - var node = this.startNode(); - node.local = this.parseIdent(); - this.checkLVal(node.local, true); - nodes.push(this.finishNode(node, "ImportDefaultSpecifier")); - if (!this.eat(tt.comma)) return nodes; - } - if (this.type === tt.star) { - var node = this.startNode(); - this.next(); - this.expectContextual("as"); - node.local = this.parseIdent(); - this.checkLVal(node.local, true); - nodes.push(this.finishNode(node, "ImportNamespaceSpecifier")); - return nodes; - } - this.expect(tt.braceL); - while (!this.eat(tt.braceR)) { - if (!first) { - this.expect(tt.comma); - if (this.afterTrailingComma(tt.braceR)) break; - } else first = false; - - var node = this.startNode(); - node.imported = this.parseIdent(true); - node.local = this.eatContextual("as") ? this.parseIdent() : node.imported; - this.checkLVal(node.local, true); - nodes.push(this.finishNode(node, "ImportSpecifier")); - } - return nodes; -}; - -},{"./state":13,"./tokentype":17,"./whitespace":19}],15:[function(_dereq_,module,exports){ -"use strict"; - -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; - -exports.__esModule = true; -// The algorithm used to determine whether a regexp can appear at a -// given point in the program is loosely based on sweet.js' approach. -// See https://github.com/mozilla/sweet.js/wiki/design - -var Parser = _dereq_("./state").Parser; - -var tt = _dereq_("./tokentype").types; - -var lineBreak = _dereq_("./whitespace").lineBreak; - -var TokContext = exports.TokContext = function TokContext(token, isExpr, preserveSpace, override) { - _classCallCheck(this, TokContext); - - this.token = token; - this.isExpr = isExpr; - this.preserveSpace = preserveSpace; - this.override = override; -}; - -var types = { - b_stat: new TokContext("{", false), - b_expr: new TokContext("{", true), - b_tmpl: new TokContext("${", true), - p_stat: new TokContext("(", false), - p_expr: new TokContext("(", true), - q_tmpl: new TokContext("`", true, true, function (p) { - return p.readTmplToken(); - }), - f_expr: new TokContext("function", true) -}; - -exports.types = types; -var pp = Parser.prototype; - -pp.initialContext = function () { - return [types.b_stat]; -}; - -pp.braceIsBlock = function (prevType) { - var parent = undefined; - if (prevType === tt.colon && (parent = this.curContext()).token == "{") return !parent.isExpr; - if (prevType === tt._return) return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); - if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof) return true; - if (prevType == tt.braceL) return this.curContext() === types.b_stat; - return !this.exprAllowed; -}; - -pp.updateContext = function (prevType) { - var update = undefined, - type = this.type; - if (type.keyword && prevType == tt.dot) this.exprAllowed = false;else if (update = type.updateContext) update.call(this, prevType);else this.exprAllowed = type.beforeExpr; -}; - -// Token-specific context update code - -tt.parenR.updateContext = tt.braceR.updateContext = function () { - if (this.context.length == 1) { - this.exprAllowed = true; - return; - } - var out = this.context.pop(); - if (out === types.b_stat && this.curContext() === types.f_expr) { - this.context.pop(); - this.exprAllowed = false; - } else if (out === types.b_tmpl) { - this.exprAllowed = true; - } else { - this.exprAllowed = !out.isExpr; - } -}; - -tt.braceL.updateContext = function (prevType) { - this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr); - this.exprAllowed = true; -}; - -tt.dollarBraceL.updateContext = function () { - this.context.push(types.b_tmpl); - this.exprAllowed = true; -}; - -tt.parenL.updateContext = function (prevType) { - var statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while; - this.context.push(statementParens ? types.p_stat : types.p_expr); - this.exprAllowed = true; -}; - -tt.incDec.updateContext = function () {}; - -tt._function.updateContext = function () { - if (this.curContext() !== types.b_stat) this.context.push(types.f_expr); - this.exprAllowed = false; -}; - -tt.backQuote.updateContext = function () { - if (this.curContext() === types.q_tmpl) this.context.pop();else this.context.push(types.q_tmpl); - this.exprAllowed = false; -}; - -// tokExprAllowed stays unchanged - -},{"./state":13,"./tokentype":17,"./whitespace":19}],16:[function(_dereq_,module,exports){ -"use strict"; - -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; - -exports.__esModule = true; - -var _identifier = _dereq_("./identifier"); - -var isIdentifierStart = _identifier.isIdentifierStart; -var isIdentifierChar = _identifier.isIdentifierChar; - -var _tokentype = _dereq_("./tokentype"); - -var tt = _tokentype.types; -var keywordTypes = _tokentype.keywords; - -var Parser = _dereq_("./state").Parser; - -var SourceLocation = _dereq_("./location").SourceLocation; - -var _whitespace = _dereq_("./whitespace"); - -var lineBreak = _whitespace.lineBreak; -var lineBreakG = _whitespace.lineBreakG; -var isNewLine = _whitespace.isNewLine; -var nonASCIIwhitespace = _whitespace.nonASCIIwhitespace; - -// Object type used to represent tokens. Note that normally, tokens -// simply exist as properties on the parser object. This is only -// used for the onToken callback and the external tokenizer. - -var Token = exports.Token = function Token(p) { - _classCallCheck(this, Token); - - this.type = p.type; - this.value = p.value; - this.start = p.start; - this.end = p.end; - if (p.options.locations) this.loc = new SourceLocation(p, p.startLoc, p.endLoc); - if (p.options.ranges) this.range = [p.start, p.end]; -}; - -// ## Tokenizer - -var pp = Parser.prototype; - -// Are we running under Rhino? -var isRhino = typeof Packages !== "undefined"; - -// Move to the next token - -pp.next = function () { - if (this.options.onToken) this.options.onToken(new Token(this)); - - this.lastTokEnd = this.end; - this.lastTokStart = this.start; - this.lastTokEndLoc = this.endLoc; - this.lastTokStartLoc = this.startLoc; - this.nextToken(); -}; - -pp.getToken = function () { - this.next(); - return new Token(this); -}; - -// If we're in an ES6 environment, make parsers iterable -if (typeof Symbol !== "undefined") pp[Symbol.iterator] = function () { - var self = this; - return { next: function next() { - var token = self.getToken(); - return { - done: token.type === tt.eof, - value: token - }; - } }; -}; - -// Toggle strict mode. Re-reads the next number or string to please -// pedantic tests (`"use strict"; 010;` should fail). - -pp.setStrict = function (strict) { - this.strict = strict; - if (this.type !== tt.num && this.type !== tt.string) return; - this.pos = this.start; - if (this.options.locations) { - while (this.pos < this.lineStart) { - this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1; - --this.curLine; - } - } - this.nextToken(); -}; - -pp.curContext = function () { - return this.context[this.context.length - 1]; -}; - -// Read a single token, updating the parser object's token-related -// properties. - -pp.nextToken = function () { - var curContext = this.curContext(); - if (!curContext || !curContext.preserveSpace) this.skipSpace(); - - this.start = this.pos; - if (this.options.locations) this.startLoc = this.curPosition(); - if (this.pos >= this.input.length) return this.finishToken(tt.eof); - - if (curContext.override) return curContext.override(this);else this.readToken(this.fullCharCodeAtPos()); -}; - -pp.readToken = function (code) { - // Identifier or keyword. '\uXXXX' sequences are allowed in - // identifiers, so '\' also dispatches to that. - if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */) return this.readWord(); - - return this.getTokenFromCode(code); -}; - -pp.fullCharCodeAtPos = function () { - var code = this.input.charCodeAt(this.pos); - if (code <= 55295 || code >= 57344) return code; - var next = this.input.charCodeAt(this.pos + 1); - return (code << 10) + next - 56613888; -}; - -pp.skipBlockComment = function () { - var startLoc = this.options.onComment && this.options.locations && this.curPosition(); - var start = this.pos, - end = this.input.indexOf("*/", this.pos += 2); - if (end === -1) this.raise(this.pos - 2, "Unterminated comment"); - this.pos = end + 2; - if (this.options.locations) { - lineBreakG.lastIndex = start; - var match = undefined; - while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) { - ++this.curLine; - this.lineStart = match.index + match[0].length; - } - } - if (this.options.onComment) this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos, startLoc, this.options.locations && this.curPosition()); -}; - -pp.skipLineComment = function (startSkip) { - var start = this.pos; - var startLoc = this.options.onComment && this.options.locations && this.curPosition(); - var ch = this.input.charCodeAt(this.pos += startSkip); - while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) { - ++this.pos; - ch = this.input.charCodeAt(this.pos); - } - if (this.options.onComment) this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos, startLoc, this.options.locations && this.curPosition()); -}; - -// Called at the start of the parse and after every token. Skips -// whitespace and comments, and. - -pp.skipSpace = function () { - while (this.pos < this.input.length) { - var ch = this.input.charCodeAt(this.pos); - if (ch === 32) { - // ' ' - ++this.pos; - } else if (ch === 13) { - ++this.pos; - var next = this.input.charCodeAt(this.pos); - if (next === 10) { - ++this.pos; - } - if (this.options.locations) { - ++this.curLine; - this.lineStart = this.pos; - } - } else if (ch === 10 || ch === 8232 || ch === 8233) { - ++this.pos; - if (this.options.locations) { - ++this.curLine; - this.lineStart = this.pos; - } - } else if (ch > 8 && ch < 14) { - ++this.pos; - } else if (ch === 47) { - // '/' - var next = this.input.charCodeAt(this.pos + 1); - if (next === 42) { - // '*' - this.skipBlockComment(); - } else if (next === 47) { - // '/' - this.skipLineComment(2); - } else break; - } else if (ch === 160) { - // '\xa0' - ++this.pos; - } else if (ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { - ++this.pos; - } else { - break; - } - } -}; - -// Called at the end of every token. Sets `end`, `val`, and -// maintains `context` and `exprAllowed`, and skips the space after -// the token, so that the next one's `start` will point at the -// right position. - -pp.finishToken = function (type, val) { - this.end = this.pos; - if (this.options.locations) this.endLoc = this.curPosition(); - var prevType = this.type; - this.type = type; - this.value = val; - - this.updateContext(prevType); -}; - -// ### Token reading - -// This is the function that is called to fetch the next token. It -// is somewhat obscure, because it works in character codes rather -// than characters, and because operator parsing has been inlined -// into it. -// -// All in the name of speed. -// -pp.readToken_dot = function () { - var next = this.input.charCodeAt(this.pos + 1); - if (next >= 48 && next <= 57) return this.readNumber(true); - var next2 = this.input.charCodeAt(this.pos + 2); - if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { - // 46 = dot '.' - this.pos += 3; - return this.finishToken(tt.ellipsis); - } else { - ++this.pos; - return this.finishToken(tt.dot); - } -}; - -pp.readToken_slash = function () { - // '/' - var next = this.input.charCodeAt(this.pos + 1); - if (this.exprAllowed) { - ++this.pos;return this.readRegexp(); - } - if (next === 61) return this.finishOp(tt.assign, 2); - return this.finishOp(tt.slash, 1); -}; - -pp.readToken_mult_modulo = function (code) { - // '%*' - var next = this.input.charCodeAt(this.pos + 1); - if (next === 61) return this.finishOp(tt.assign, 2); - return this.finishOp(code === 42 ? tt.star : tt.modulo, 1); -}; - -pp.readToken_pipe_amp = function (code) { - // '|&' - var next = this.input.charCodeAt(this.pos + 1); - if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2); - if (next === 61) return this.finishOp(tt.assign, 2); - return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1); -}; - -pp.readToken_caret = function () { - // '^' - var next = this.input.charCodeAt(this.pos + 1); - if (next === 61) return this.finishOp(tt.assign, 2); - return this.finishOp(tt.bitwiseXOR, 1); -}; - -pp.readToken_plus_min = function (code) { - // '+-' - var next = this.input.charCodeAt(this.pos + 1); - if (next === code) { - if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 && lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) { - // A `-->` line comment - this.skipLineComment(3); - this.skipSpace(); - return this.nextToken(); - } - return this.finishOp(tt.incDec, 2); - } - if (next === 61) return this.finishOp(tt.assign, 2); - return this.finishOp(tt.plusMin, 1); -}; - -pp.readToken_lt_gt = function (code) { - // '<>' - var next = this.input.charCodeAt(this.pos + 1); - var size = 1; - if (next === code) { - size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; - if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1); - return this.finishOp(tt.bitShift, size); - } - if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && this.input.charCodeAt(this.pos + 3) == 45) { - if (this.inModule) this.unexpected(); - // `` line comment - this.skipLineComment(3); - this.skipSpace(); - return this.nextToken(); - } - return this.finishOp(tt.incDec, 2); - } - if (next === 61) return this.finishOp(tt.assign, 2); - return this.finishOp(tt.plusMin, 1); -}; - -pp.readToken_lt_gt = function (code) { - // '<>' - var next = this.input.charCodeAt(this.pos + 1); - var size = 1; - if (next === code) { - size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; - if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1); - return this.finishOp(tt.bitShift, size); - } - if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && this.input.charCodeAt(this.pos + 3) == 45) { - if (this.inModule) this.unexpected(); - // `` line comment - this.skipLineComment(3) - this.skipSpace() - return this.nextToken() - } - return this.finishOp(tt.incDec, 2) - } - if (next === 61) return this.finishOp(tt.assign, 2) - return this.finishOp(tt.plusMin, 1) -} - -pp.readToken_lt_gt = function(code) { // '<>' - let next = this.input.charCodeAt(this.pos + 1) - let size = 1 - if (next === code) { - size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2 - if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1) - return this.finishOp(tt.bitShift, size) - } - if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && - this.input.charCodeAt(this.pos + 3) == 45) { - if (this.inModule) this.unexpected() - // `' is a single-line comment - index += 3; - skipSingleLineComment(3); - } else { - break; - } - } else if (ch === 0x3C) { // U+003C is '<' - if (source.slice(index + 1, index + 4) === '!--') { - ++index; // `<` - ++index; // `!` - ++index; // `-` - ++index; // `-` - skipSingleLineComment(4); - } else { - break; - } - } else { - break; - } - } - } - - function scanHexEscape(prefix) { - var i, len, ch, code = 0; - - len = (prefix === 'u') ? 4 : 2; - for (i = 0; i < len; ++i) { - if (index < length && isHexDigit(source[index])) { - ch = source[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else { - return ''; - } - } - return String.fromCharCode(code); - } - - function scanUnicodeCodePointEscape() { - var ch, code; - - ch = source[index]; - code = 0; - - // At least, one hex digit is required. - if (ch === '}') { - throwUnexpectedToken(); - } - - while (index < length) { - ch = source[index++]; - if (!isHexDigit(ch)) { - break; - } - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - if (code > 0x10FFFF || ch !== '}') { - throwUnexpectedToken(); - } - - return fromCodePoint(code); - } - - function codePointAt(i) { - var cp, first, second; - - cp = source.charCodeAt(i); - if (cp >= 0xD800 && cp <= 0xDBFF) { - second = source.charCodeAt(i + 1); - if (second >= 0xDC00 && second <= 0xDFFF) { - first = cp; - cp = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - } - } - - return cp; - } - - function getComplexIdentifier() { - var cp, ch, id; - - cp = codePointAt(index); - id = fromCodePoint(cp); - index += id.length; - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (cp === 0x5C) { - if (source.charCodeAt(index) !== 0x75) { - throwUnexpectedToken(); - } - ++index; - if (source[index] === '{') { - ++index; - ch = scanUnicodeCodePointEscape(); - } else { - ch = scanHexEscape('u'); - cp = ch.charCodeAt(0); - if (!ch || ch === '\\' || !isIdentifierStart(cp)) { - throwUnexpectedToken(); - } - } - id = ch; - } - - while (index < length) { - cp = codePointAt(index); - if (!isIdentifierPart(cp)) { - break; - } - ch = fromCodePoint(cp); - id += ch; - index += ch.length; - - // '\u' (U+005C, U+0075) denotes an escaped character. - if (cp === 0x5C) { - id = id.substr(0, id.length - 1); - if (source.charCodeAt(index) !== 0x75) { - throwUnexpectedToken(); - } - ++index; - if (source[index] === '{') { - ++index; - ch = scanUnicodeCodePointEscape(); - } else { - ch = scanHexEscape('u'); - cp = ch.charCodeAt(0); - if (!ch || ch === '\\' || !isIdentifierPart(cp)) { - throwUnexpectedToken(); - } - } - id += ch; - } - } - - return id; - } - - function getIdentifier() { - var start, ch; - - start = index++; - while (index < length) { - ch = source.charCodeAt(index); - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getComplexIdentifier(); - } else if (ch >= 0xD800 && ch < 0xDFFF) { - // Need to handle surrogate pairs. - index = start; - return getComplexIdentifier(); - } - if (isIdentifierPart(ch)) { - ++index; - } else { - break; - } - } - - return source.slice(start, index); - } - - function scanIdentifier() { - var start, id, type; - - start = index; - - // Backslash (U+005C) starts an escaped character. - id = (source.charCodeAt(index) === 0x5C) ? getComplexIdentifier() : getIdentifier(); - - // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - if (id.length === 1) { - type = Token.Identifier; - } else if (isKeyword(id)) { - type = Token.Keyword; - } else if (id === 'null') { - type = Token.NullLiteral; - } else if (id === 'true' || id === 'false') { - type = Token.BooleanLiteral; - } else { - type = Token.Identifier; - } - - return { - type: type, - value: id, - lineNumber: lineNumber, - lineStart: lineStart, - start: start, - end: index - }; - } - - - // ECMA-262 11.7 Punctuators - - function scanPunctuator() { - var token, str; - - token = { - type: Token.Punctuator, - value: '', - lineNumber: lineNumber, - lineStart: lineStart, - start: index, - end: index - }; - - // Check for most common single-character punctuators. - str = source[index]; - switch (str) { - - case '(': - if (extra.tokenize) { - extra.openParenToken = extra.tokenValues.length; - } - ++index; - break; - - case '{': - if (extra.tokenize) { - extra.openCurlyToken = extra.tokenValues.length; - } - state.curlyStack.push('{'); - ++index; - break; - - case '.': - ++index; - if (source[index] === '.' && source[index + 1] === '.') { - // Spread operator: ... - index += 2; - str = '...'; - } - break; - - case '}': - ++index; - state.curlyStack.pop(); - break; - case ')': - case ';': - case ',': - case '[': - case ']': - case ':': - case '?': - case '~': - ++index; - break; - - default: - // 4-character punctuator. - str = source.substr(index, 4); - if (str === '>>>=') { - index += 4; - } else { - - // 3-character punctuators. - str = str.substr(0, 3); - if (str === '===' || str === '!==' || str === '>>>' || - str === '<<=' || str === '>>=') { - index += 3; - } else { - - // 2-character punctuators. - str = str.substr(0, 2); - if (str === '&&' || str === '||' || str === '==' || str === '!=' || - str === '+=' || str === '-=' || str === '*=' || str === '/=' || - str === '++' || str === '--' || str === '<<' || str === '>>' || - str === '&=' || str === '|=' || str === '^=' || str === '%=' || - str === '<=' || str === '>=' || str === '=>') { - index += 2; - } else { - - // 1-character punctuators. - str = source[index]; - if ('<>=!+-*%&|^/'.indexOf(str) >= 0) { - ++index; - } - } - } - } - } - - if (index === token.start) { - throwUnexpectedToken(); - } - - token.end = index; - token.value = str; - return token; - } - - // ECMA-262 11.8.3 Numeric Literals - - function scanHexLiteral(start) { - var number = ''; - - while (index < length) { - if (!isHexDigit(source[index])) { - break; - } - number += source[index++]; - } - - if (number.length === 0) { - throwUnexpectedToken(); - } - - if (isIdentifierStart(source.charCodeAt(index))) { - throwUnexpectedToken(); - } - - return { - type: Token.NumericLiteral, - value: parseInt('0x' + number, 16), - lineNumber: lineNumber, - lineStart: lineStart, - start: start, - end: index - }; - } - - function scanBinaryLiteral(start) { - var ch, number; - - number = ''; - - while (index < length) { - ch = source[index]; - if (ch !== '0' && ch !== '1') { - break; - } - number += source[index++]; - } - - if (number.length === 0) { - // only 0b or 0B - throwUnexpectedToken(); - } - - if (index < length) { - ch = source.charCodeAt(index); - /* istanbul ignore else */ - if (isIdentifierStart(ch) || isDecimalDigit(ch)) { - throwUnexpectedToken(); - } - } - - return { - type: Token.NumericLiteral, - value: parseInt(number, 2), - lineNumber: lineNumber, - lineStart: lineStart, - start: start, - end: index - }; - } - - function scanOctalLiteral(prefix, start) { - var number, octal; - - if (isOctalDigit(prefix)) { - octal = true; - number = '0' + source[index++]; - } else { - octal = false; - ++index; - number = ''; - } - - while (index < length) { - if (!isOctalDigit(source[index])) { - break; - } - number += source[index++]; - } - - if (!octal && number.length === 0) { - // only 0o or 0O - throwUnexpectedToken(); - } - - if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { - throwUnexpectedToken(); - } - - return { - type: Token.NumericLiteral, - value: parseInt(number, 8), - octal: octal, - lineNumber: lineNumber, - lineStart: lineStart, - start: start, - end: index - }; - } - - function isImplicitOctalLiteral() { - var i, ch; - - // Implicit octal, unless there is a non-octal digit. - // (Annex B.1.1 on Numeric Literals) - for (i = index + 1; i < length; ++i) { - ch = source[i]; - if (ch === '8' || ch === '9') { - return false; - } - if (!isOctalDigit(ch)) { - return true; - } - } - - return true; - } - - function scanNumericLiteral() { - var number, start, ch; - - ch = source[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), - 'Numeric literal must start with a decimal digit or a decimal point'); - - start = index; - number = ''; - if (ch !== '.') { - number = source[index++]; - ch = source[index]; - - // Hex number starts with '0x'. - // Octal number starts with '0'. - // Octal number in ES6 starts with '0o'. - // Binary number in ES6 starts with '0b'. - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - if (ch === 'b' || ch === 'B') { - ++index; - return scanBinaryLiteral(start); - } - if (ch === 'o' || ch === 'O') { - return scanOctalLiteral(ch, start); - } - - if (isOctalDigit(ch)) { - if (isImplicitOctalLiteral()) { - return scanOctalLiteral(ch, start); - } - } - } - - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - ch = source[index]; - } - - if (ch === '.') { - number += source[index++]; - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - ch = source[index]; - } - - if (ch === 'e' || ch === 'E') { - number += source[index++]; - - ch = source[index]; - if (ch === '+' || ch === '-') { - number += source[index++]; - } - if (isDecimalDigit(source.charCodeAt(index))) { - while (isDecimalDigit(source.charCodeAt(index))) { - number += source[index++]; - } - } else { - throwUnexpectedToken(); - } - } - - if (isIdentifierStart(source.charCodeAt(index))) { - throwUnexpectedToken(); - } - - return { - type: Token.NumericLiteral, - value: parseFloat(number), - lineNumber: lineNumber, - lineStart: lineStart, - start: start, - end: index - }; - } - - // ECMA-262 11.8.4 String Literals - - function scanStringLiteral() { - var str = '', quote, start, ch, unescaped, octToDec, octal = false; - - quote = source[index]; - assert((quote === '\'' || quote === '"'), - 'String literal must starts with a quote'); - - start = index; - ++index; - - while (index < length) { - ch = source[index++]; - - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source[index++]; - if (!ch || !isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'u': - case 'x': - if (source[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else { - unescaped = scanHexEscape(ch); - if (!unescaped) { - throw throwUnexpectedToken(); - } - str += unescaped; - } - break; - case 'n': - str += '\n'; - break; - case 'r': - str += '\r'; - break; - case 't': - str += '\t'; - break; - case 'b': - str += '\b'; - break; - case 'f': - str += '\f'; - break; - case 'v': - str += '\x0B'; - break; - case '8': - case '9': - str += ch; - tolerateUnexpectedToken(); - break; - - default: - if (isOctalDigit(ch)) { - octToDec = octalToDecimal(ch); - - octal = octToDec.octal || octal; - str += String.fromCharCode(octToDec.code); - } else { - str += ch; - } - break; - } - } else { - ++lineNumber; - if (ch === '\r' && source[index] === '\n') { - ++index; - } - lineStart = index; - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - break; - } else { - str += ch; - } - } - - if (quote !== '') { - index = start; - throwUnexpectedToken(); - } - - return { - type: Token.StringLiteral, - value: str, - octal: octal, - lineNumber: startLineNumber, - lineStart: startLineStart, - start: start, - end: index - }; - } - - // ECMA-262 11.8.6 Template Literal Lexical Components - - function scanTemplate() { - var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped; - - terminated = false; - tail = false; - start = index; - head = (source[index] === '`'); - rawOffset = 2; - - ++index; - - while (index < length) { - ch = source[index++]; - if (ch === '`') { - rawOffset = 1; - tail = true; - terminated = true; - break; - } else if (ch === '$') { - if (source[index] === '{') { - state.curlyStack.push('${'); - ++index; - terminated = true; - break; - } - cooked += ch; - } else if (ch === '\\') { - ch = source[index++]; - if (!isLineTerminator(ch.charCodeAt(0))) { - switch (ch) { - case 'n': - cooked += '\n'; - break; - case 'r': - cooked += '\r'; - break; - case 't': - cooked += '\t'; - break; - case 'u': - case 'x': - if (source[index] === '{') { - ++index; - cooked += scanUnicodeCodePointEscape(); - } else { - restore = index; - unescaped = scanHexEscape(ch); - if (unescaped) { - cooked += unescaped; - } else { - index = restore; - cooked += ch; - } - } - break; - case 'b': - cooked += '\b'; - break; - case 'f': - cooked += '\f'; - break; - case 'v': - cooked += '\v'; - break; - - default: - if (ch === '0') { - if (isDecimalDigit(source.charCodeAt(index))) { - // Illegal: \01 \02 and so on - throwError(Messages.TemplateOctalLiteral); - } - cooked += '\0'; - } else if (isOctalDigit(ch)) { - // Illegal: \1 \2 - throwError(Messages.TemplateOctalLiteral); - } else { - cooked += ch; - } - break; - } - } else { - ++lineNumber; - if (ch === '\r' && source[index] === '\n') { - ++index; - } - lineStart = index; - } - } else if (isLineTerminator(ch.charCodeAt(0))) { - ++lineNumber; - if (ch === '\r' && source[index] === '\n') { - ++index; - } - lineStart = index; - cooked += '\n'; - } else { - cooked += ch; - } - } - - if (!terminated) { - throwUnexpectedToken(); - } - - if (!head) { - state.curlyStack.pop(); - } - - return { - type: Token.Template, - value: { - cooked: cooked, - raw: source.slice(start + 1, index - rawOffset) - }, - head: head, - tail: tail, - lineNumber: lineNumber, - lineStart: lineStart, - start: start, - end: index - }; - } - - // ECMA-262 11.8.5 Regular Expression Literals - - function testRegExp(pattern, flags) { - // The BMP character to use as a replacement for astral symbols when - // translating an ES6 "u"-flagged pattern to an ES5-compatible - // approximation. - // Note: replacing with '\uFFFF' enables false positives in unlikely - // scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid - // pattern that would not be detected by this substitution. - var astralSubstitute = '\uFFFF', - tmp = pattern; - - if (flags.indexOf('u') >= 0) { - tmp = tmp - // Replace every Unicode escape sequence with the equivalent - // BMP character or a constant ASCII code point in the case of - // astral symbols. (See the above note on `astralSubstitute` - // for more information.) - .replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) { - var codePoint = parseInt($1 || $2, 16); - if (codePoint > 0x10FFFF) { - throwUnexpectedToken(null, Messages.InvalidRegExp); - } - if (codePoint <= 0xFFFF) { - return String.fromCharCode(codePoint); - } - return astralSubstitute; - }) - // Replace each paired surrogate with a single ASCII symbol to - // avoid throwing on regular expressions that are only valid in - // combination with the "u" flag. - .replace( - /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, - astralSubstitute - ); - } - - // First, detect invalid regular expressions. - try { - RegExp(tmp); - } catch (e) { - throwUnexpectedToken(null, Messages.InvalidRegExp); - } - - // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; - } - } - - function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - - ch = source[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source[index++]; - - classMarker = false; - terminated = false; - while (index < length) { - ch = source[index++]; - str += ch; - if (ch === '\\') { - ch = source[index++]; - // ECMA-262 7.8.5 - if (isLineTerminator(ch.charCodeAt(0))) { - throwUnexpectedToken(null, Messages.UnterminatedRegExp); - } - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) { - throwUnexpectedToken(null, Messages.UnterminatedRegExp); - } else if (classMarker) { - if (ch === ']') { - classMarker = false; - } - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') { - classMarker = true; - } - } - } - - if (!terminated) { - throwUnexpectedToken(null, Messages.UnterminatedRegExp); - } - - // Exclude leading and trailing slash. - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; - } - - function scanRegExpFlags() { - var ch, str, flags, restore; - - str = ''; - flags = ''; - while (index < length) { - ch = source[index]; - if (!isIdentifierPart(ch.charCodeAt(0))) { - break; - } - - ++index; - if (ch === '\\' && index < length) { - ch = source[index]; - if (ch === 'u') { - ++index; - restore = index; - ch = scanHexEscape('u'); - if (ch) { - flags += ch; - for (str += '\\u'; restore < index; ++restore) { - str += source[restore]; - } - } else { - index = restore; - flags += 'u'; - str += '\\u'; - } - tolerateUnexpectedToken(); - } else { - str += '\\'; - tolerateUnexpectedToken(); - } - } else { - flags += ch; - str += ch; - } - } - - return { - value: flags, - literal: str - }; - } - - function scanRegExp() { - var start, body, flags, value; - scanning = true; - - lookahead = null; - skipComment(); - start = index; - - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - scanning = false; - if (extra.tokenize) { - return { - type: Token.RegularExpression, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - lineNumber: lineNumber, - lineStart: lineStart, - start: start, - end: index - }; - } - - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index - }; - } - - function collectRegex() { - var pos, loc, regex, token; - - skipComment(); - - pos = index; - loc = { - start: { - line: lineNumber, - column: index - lineStart - } - }; - - regex = scanRegExp(); - - loc.end = { - line: lineNumber, - column: index - lineStart - }; - - /* istanbul ignore next */ - if (!extra.tokenize) { - // Pop the previous token, which is likely '/' or '/=' - if (extra.tokens.length > 0) { - token = extra.tokens[extra.tokens.length - 1]; - if (token.range[0] === pos && token.type === 'Punctuator') { - if (token.value === '/' || token.value === '/=') { - extra.tokens.pop(); - } - } - } - - extra.tokens.push({ - type: 'RegularExpression', - value: regex.literal, - regex: regex.regex, - range: [pos, index], - loc: loc - }); - } - - return regex; - } - - function isIdentifierName(token) { - return token.type === Token.Identifier || - token.type === Token.Keyword || - token.type === Token.BooleanLiteral || - token.type === Token.NullLiteral; - } - - // Using the following algorithm: - // https://github.com/mozilla/sweet.js/wiki/design - - function advanceSlash() { - var regex, previous, check; - - function testKeyword(value) { - return value && (value.length > 1) && (value[0] >= 'a') && (value[0] <= 'z'); - } - - previous = extra.tokenValues[extra.tokens.length - 1]; - regex = (previous !== null); - - switch (previous) { - case 'this': - case ']': - regex = false; - break; - - case ')': - check = extra.tokenValues[extra.openParenToken - 1]; - regex = (check === 'if' || check === 'while' || check === 'for' || check === 'with'); - break; - - case '}': - // Dividing a function by anything makes little sense, - // but we have to check for that. - regex = false; - if (testKeyword(extra.tokenValues[extra.openCurlyToken - 3])) { - // Anonymous function, e.g. function(){} /42 - check = extra.tokenValues[extra.openCurlyToken - 4]; - regex = check ? (FnExprTokens.indexOf(check) < 0) : false; - } else if (testKeyword(extra.tokenValues[extra.openCurlyToken - 4])) { - // Named function, e.g. function f(){} /42/ - check = extra.tokenValues[extra.openCurlyToken - 5]; - regex = check ? (FnExprTokens.indexOf(check) < 0) : true; - } - } - - return regex ? collectRegex() : scanPunctuator(); - } - - function advance() { - var cp, token; - - if (index >= length) { - return { - type: Token.EOF, - lineNumber: lineNumber, - lineStart: lineStart, - start: index, - end: index - }; - } - - cp = source.charCodeAt(index); - - if (isIdentifierStart(cp)) { - token = scanIdentifier(); - if (strict && isStrictModeReservedWord(token.value)) { - token.type = Token.Keyword; - } - return token; - } - - // Very common: ( and ) and ; - if (cp === 0x28 || cp === 0x29 || cp === 0x3B) { - return scanPunctuator(); - } - - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (cp === 0x27 || cp === 0x22) { - return scanStringLiteral(); - } - - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (cp === 0x2E) { - if (isDecimalDigit(source.charCodeAt(index + 1))) { - return scanNumericLiteral(); - } - return scanPunctuator(); - } - - if (isDecimalDigit(cp)) { - return scanNumericLiteral(); - } - - // Slash (/) U+002F can also start a regex. - if (extra.tokenize && cp === 0x2F) { - return advanceSlash(); - } - - // Template literals start with ` (U+0060) for template head - // or } (U+007D) for template middle or template tail. - if (cp === 0x60 || (cp === 0x7D && state.curlyStack[state.curlyStack.length - 1] === '${')) { - return scanTemplate(); - } - - // Possible identifier start in a surrogate pair. - if (cp >= 0xD800 && cp < 0xDFFF) { - cp = codePointAt(index); - if (isIdentifierStart(cp)) { - return scanIdentifier(); - } - } - - return scanPunctuator(); - } - - function collectToken() { - var loc, token, value, entry; - - loc = { - start: { - line: lineNumber, - column: index - lineStart - } - }; - - token = advance(); - loc.end = { - line: lineNumber, - column: index - lineStart - }; - - if (token.type !== Token.EOF) { - value = source.slice(token.start, token.end); - entry = { - type: TokenName[token.type], - value: value, - range: [token.start, token.end], - loc: loc - }; - if (token.regex) { - entry.regex = { - pattern: token.regex.pattern, - flags: token.regex.flags - }; - } - if (extra.tokenValues) { - extra.tokenValues.push((entry.type === 'Punctuator' || entry.type === 'Keyword') ? entry.value : null); - } - if (extra.tokenize) { - if (!extra.range) { - delete entry.range; - } - if (!extra.loc) { - delete entry.loc; - } - if (extra.delegate) { - entry = extra.delegate(entry); - } - } - extra.tokens.push(entry); - } - - return token; - } - - function lex() { - var token; - scanning = true; - - lastIndex = index; - lastLineNumber = lineNumber; - lastLineStart = lineStart; - - skipComment(); - - token = lookahead; - - startIndex = index; - startLineNumber = lineNumber; - startLineStart = lineStart; - - lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance(); - scanning = false; - return token; - } - - function peek() { - scanning = true; - - skipComment(); - - lastIndex = index; - lastLineNumber = lineNumber; - lastLineStart = lineStart; - - startIndex = index; - startLineNumber = lineNumber; - startLineStart = lineStart; - - lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance(); - scanning = false; - } - - function Position() { - this.line = startLineNumber; - this.column = startIndex - startLineStart; - } - - function SourceLocation() { - this.start = new Position(); - this.end = null; - } - - function WrappingSourceLocation(startToken) { - this.start = { - line: startToken.lineNumber, - column: startToken.start - startToken.lineStart - }; - this.end = null; - } - - function Node() { - if (extra.range) { - this.range = [startIndex, 0]; - } - if (extra.loc) { - this.loc = new SourceLocation(); - } - } - - function WrappingNode(startToken) { - if (extra.range) { - this.range = [startToken.start, 0]; - } - if (extra.loc) { - this.loc = new WrappingSourceLocation(startToken); - } - } - - WrappingNode.prototype = Node.prototype = { - - processComment: function () { - var lastChild, - innerComments, - leadingComments, - trailingComments, - bottomRight = extra.bottomRightStack, - i, - comment, - last = bottomRight[bottomRight.length - 1]; - - if (this.type === Syntax.Program) { - if (this.body.length > 0) { - return; - } - } - /** - * patch innnerComments for properties empty block - * `function a() {/** comments **\/}` - */ - - if (this.type === Syntax.BlockStatement && this.body.length === 0) { - innerComments = []; - for (i = extra.leadingComments.length - 1; i >= 0; --i) { - comment = extra.leadingComments[i]; - if (this.range[1] >= comment.range[1]) { - innerComments.unshift(comment); - extra.leadingComments.splice(i, 1); - extra.trailingComments.splice(i, 1); - } - } - if (innerComments.length) { - this.innerComments = innerComments; - //bottomRight.push(this); - return; - } - } - - if (extra.trailingComments.length > 0) { - trailingComments = []; - for (i = extra.trailingComments.length - 1; i >= 0; --i) { - comment = extra.trailingComments[i]; - if (comment.range[0] >= this.range[1]) { - trailingComments.unshift(comment); - extra.trailingComments.splice(i, 1); - } - } - extra.trailingComments = []; - } else { - if (last && last.trailingComments && last.trailingComments[0].range[0] >= this.range[1]) { - trailingComments = last.trailingComments; - delete last.trailingComments; - } - } - - // Eating the stack. - while (last && last.range[0] >= this.range[0]) { - lastChild = bottomRight.pop(); - last = bottomRight[bottomRight.length - 1]; - } - - if (lastChild) { - if (lastChild.leadingComments) { - leadingComments = []; - for (i = lastChild.leadingComments.length - 1; i >= 0; --i) { - comment = lastChild.leadingComments[i]; - if (comment.range[1] <= this.range[0]) { - leadingComments.unshift(comment); - lastChild.leadingComments.splice(i, 1); - } - } - - if (!lastChild.leadingComments.length) { - lastChild.leadingComments = undefined; - } - } - } else if (extra.leadingComments.length > 0) { - leadingComments = []; - for (i = extra.leadingComments.length - 1; i >= 0; --i) { - comment = extra.leadingComments[i]; - if (comment.range[1] <= this.range[0]) { - leadingComments.unshift(comment); - extra.leadingComments.splice(i, 1); - } - } - } - - - if (leadingComments && leadingComments.length > 0) { - this.leadingComments = leadingComments; - } - if (trailingComments && trailingComments.length > 0) { - this.trailingComments = trailingComments; - } - - bottomRight.push(this); - }, - - finish: function () { - if (extra.range) { - this.range[1] = lastIndex; - } - if (extra.loc) { - this.loc.end = { - line: lastLineNumber, - column: lastIndex - lastLineStart - }; - if (extra.source) { - this.loc.source = extra.source; - } - } - - if (extra.attachComment) { - this.processComment(); - } - }, - - finishArrayExpression: function (elements) { - this.type = Syntax.ArrayExpression; - this.elements = elements; - this.finish(); - return this; - }, - - finishArrayPattern: function (elements) { - this.type = Syntax.ArrayPattern; - this.elements = elements; - this.finish(); - return this; - }, - - finishArrowFunctionExpression: function (params, defaults, body, expression) { - this.type = Syntax.ArrowFunctionExpression; - this.id = null; - this.params = params; - this.defaults = defaults; - this.body = body; - this.generator = false; - this.expression = expression; - this.finish(); - return this; - }, - - finishAssignmentExpression: function (operator, left, right) { - this.type = Syntax.AssignmentExpression; - this.operator = operator; - this.left = left; - this.right = right; - this.finish(); - return this; - }, - - finishAssignmentPattern: function (left, right) { - this.type = Syntax.AssignmentPattern; - this.left = left; - this.right = right; - this.finish(); - return this; - }, - - finishBinaryExpression: function (operator, left, right) { - this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression; - this.operator = operator; - this.left = left; - this.right = right; - this.finish(); - return this; - }, - - finishBlockStatement: function (body) { - this.type = Syntax.BlockStatement; - this.body = body; - this.finish(); - return this; - }, - - finishBreakStatement: function (label) { - this.type = Syntax.BreakStatement; - this.label = label; - this.finish(); - return this; - }, - - finishCallExpression: function (callee, args) { - this.type = Syntax.CallExpression; - this.callee = callee; - this.arguments = args; - this.finish(); - return this; - }, - - finishCatchClause: function (param, body) { - this.type = Syntax.CatchClause; - this.param = param; - this.body = body; - this.finish(); - return this; - }, - - finishClassBody: function (body) { - this.type = Syntax.ClassBody; - this.body = body; - this.finish(); - return this; - }, - - finishClassDeclaration: function (id, superClass, body) { - this.type = Syntax.ClassDeclaration; - this.id = id; - this.superClass = superClass; - this.body = body; - this.finish(); - return this; - }, - - finishClassExpression: function (id, superClass, body) { - this.type = Syntax.ClassExpression; - this.id = id; - this.superClass = superClass; - this.body = body; - this.finish(); - return this; - }, - - finishConditionalExpression: function (test, consequent, alternate) { - this.type = Syntax.ConditionalExpression; - this.test = test; - this.consequent = consequent; - this.alternate = alternate; - this.finish(); - return this; - }, - - finishContinueStatement: function (label) { - this.type = Syntax.ContinueStatement; - this.label = label; - this.finish(); - return this; - }, - - finishDebuggerStatement: function () { - this.type = Syntax.DebuggerStatement; - this.finish(); - return this; - }, - - finishDoWhileStatement: function (body, test) { - this.type = Syntax.DoWhileStatement; - this.body = body; - this.test = test; - this.finish(); - return this; - }, - - finishEmptyStatement: function () { - this.type = Syntax.EmptyStatement; - this.finish(); - return this; - }, - - finishExpressionStatement: function (expression) { - this.type = Syntax.ExpressionStatement; - this.expression = expression; - this.finish(); - return this; - }, - - finishForStatement: function (init, test, update, body) { - this.type = Syntax.ForStatement; - this.init = init; - this.test = test; - this.update = update; - this.body = body; - this.finish(); - return this; - }, - - finishForOfStatement: function (left, right, body) { - this.type = Syntax.ForOfStatement; - this.left = left; - this.right = right; - this.body = body; - this.finish(); - return this; - }, - - finishForInStatement: function (left, right, body) { - this.type = Syntax.ForInStatement; - this.left = left; - this.right = right; - this.body = body; - this.each = false; - this.finish(); - return this; - }, - - finishFunctionDeclaration: function (id, params, defaults, body, generator) { - this.type = Syntax.FunctionDeclaration; - this.id = id; - this.params = params; - this.defaults = defaults; - this.body = body; - this.generator = generator; - this.expression = false; - this.finish(); - return this; - }, - - finishFunctionExpression: function (id, params, defaults, body, generator) { - this.type = Syntax.FunctionExpression; - this.id = id; - this.params = params; - this.defaults = defaults; - this.body = body; - this.generator = generator; - this.expression = false; - this.finish(); - return this; - }, - - finishIdentifier: function (name) { - this.type = Syntax.Identifier; - this.name = name; - this.finish(); - return this; - }, - - finishIfStatement: function (test, consequent, alternate) { - this.type = Syntax.IfStatement; - this.test = test; - this.consequent = consequent; - this.alternate = alternate; - this.finish(); - return this; - }, - - finishLabeledStatement: function (label, body) { - this.type = Syntax.LabeledStatement; - this.label = label; - this.body = body; - this.finish(); - return this; - }, - - finishLiteral: function (token) { - this.type = Syntax.Literal; - this.value = token.value; - this.raw = source.slice(token.start, token.end); - if (token.regex) { - this.regex = token.regex; - } - this.finish(); - return this; - }, - - finishMemberExpression: function (accessor, object, property) { - this.type = Syntax.MemberExpression; - this.computed = accessor === '['; - this.object = object; - this.property = property; - this.finish(); - return this; - }, - - finishMetaProperty: function (meta, property) { - this.type = Syntax.MetaProperty; - this.meta = meta; - this.property = property; - this.finish(); - return this; - }, - - finishNewExpression: function (callee, args) { - this.type = Syntax.NewExpression; - this.callee = callee; - this.arguments = args; - this.finish(); - return this; - }, - - finishObjectExpression: function (properties) { - this.type = Syntax.ObjectExpression; - this.properties = properties; - this.finish(); - return this; - }, - - finishObjectPattern: function (properties) { - this.type = Syntax.ObjectPattern; - this.properties = properties; - this.finish(); - return this; - }, - - finishPostfixExpression: function (operator, argument) { - this.type = Syntax.UpdateExpression; - this.operator = operator; - this.argument = argument; - this.prefix = false; - this.finish(); - return this; - }, - - finishProgram: function (body, sourceType) { - this.type = Syntax.Program; - this.body = body; - this.sourceType = sourceType; - this.finish(); - return this; - }, - - finishProperty: function (kind, key, computed, value, method, shorthand) { - this.type = Syntax.Property; - this.key = key; - this.computed = computed; - this.value = value; - this.kind = kind; - this.method = method; - this.shorthand = shorthand; - this.finish(); - return this; - }, - - finishRestElement: function (argument) { - this.type = Syntax.RestElement; - this.argument = argument; - this.finish(); - return this; - }, - - finishReturnStatement: function (argument) { - this.type = Syntax.ReturnStatement; - this.argument = argument; - this.finish(); - return this; - }, - - finishSequenceExpression: function (expressions) { - this.type = Syntax.SequenceExpression; - this.expressions = expressions; - this.finish(); - return this; - }, - - finishSpreadElement: function (argument) { - this.type = Syntax.SpreadElement; - this.argument = argument; - this.finish(); - return this; - }, - - finishSwitchCase: function (test, consequent) { - this.type = Syntax.SwitchCase; - this.test = test; - this.consequent = consequent; - this.finish(); - return this; - }, - - finishSuper: function () { - this.type = Syntax.Super; - this.finish(); - return this; - }, - - finishSwitchStatement: function (discriminant, cases) { - this.type = Syntax.SwitchStatement; - this.discriminant = discriminant; - this.cases = cases; - this.finish(); - return this; - }, - - finishTaggedTemplateExpression: function (tag, quasi) { - this.type = Syntax.TaggedTemplateExpression; - this.tag = tag; - this.quasi = quasi; - this.finish(); - return this; - }, - - finishTemplateElement: function (value, tail) { - this.type = Syntax.TemplateElement; - this.value = value; - this.tail = tail; - this.finish(); - return this; - }, - - finishTemplateLiteral: function (quasis, expressions) { - this.type = Syntax.TemplateLiteral; - this.quasis = quasis; - this.expressions = expressions; - this.finish(); - return this; - }, - - finishThisExpression: function () { - this.type = Syntax.ThisExpression; - this.finish(); - return this; - }, - - finishThrowStatement: function (argument) { - this.type = Syntax.ThrowStatement; - this.argument = argument; - this.finish(); - return this; - }, - - finishTryStatement: function (block, handler, finalizer) { - this.type = Syntax.TryStatement; - this.block = block; - this.guardedHandlers = []; - this.handlers = handler ? [handler] : []; - this.handler = handler; - this.finalizer = finalizer; - this.finish(); - return this; - }, - - finishUnaryExpression: function (operator, argument) { - this.type = (operator === '++' || operator === '--') ? Syntax.UpdateExpression : Syntax.UnaryExpression; - this.operator = operator; - this.argument = argument; - this.prefix = true; - this.finish(); - return this; - }, - - finishVariableDeclaration: function (declarations) { - this.type = Syntax.VariableDeclaration; - this.declarations = declarations; - this.kind = 'var'; - this.finish(); - return this; - }, - - finishLexicalDeclaration: function (declarations, kind) { - this.type = Syntax.VariableDeclaration; - this.declarations = declarations; - this.kind = kind; - this.finish(); - return this; - }, - - finishVariableDeclarator: function (id, init) { - this.type = Syntax.VariableDeclarator; - this.id = id; - this.init = init; - this.finish(); - return this; - }, - - finishWhileStatement: function (test, body) { - this.type = Syntax.WhileStatement; - this.test = test; - this.body = body; - this.finish(); - return this; - }, - - finishWithStatement: function (object, body) { - this.type = Syntax.WithStatement; - this.object = object; - this.body = body; - this.finish(); - return this; - }, - - finishExportSpecifier: function (local, exported) { - this.type = Syntax.ExportSpecifier; - this.exported = exported || local; - this.local = local; - this.finish(); - return this; - }, - - finishImportDefaultSpecifier: function (local) { - this.type = Syntax.ImportDefaultSpecifier; - this.local = local; - this.finish(); - return this; - }, - - finishImportNamespaceSpecifier: function (local) { - this.type = Syntax.ImportNamespaceSpecifier; - this.local = local; - this.finish(); - return this; - }, - - finishExportNamedDeclaration: function (declaration, specifiers, src) { - this.type = Syntax.ExportNamedDeclaration; - this.declaration = declaration; - this.specifiers = specifiers; - this.source = src; - this.finish(); - return this; - }, - - finishExportDefaultDeclaration: function (declaration) { - this.type = Syntax.ExportDefaultDeclaration; - this.declaration = declaration; - this.finish(); - return this; - }, - - finishExportAllDeclaration: function (src) { - this.type = Syntax.ExportAllDeclaration; - this.source = src; - this.finish(); - return this; - }, - - finishImportSpecifier: function (local, imported) { - this.type = Syntax.ImportSpecifier; - this.local = local || imported; - this.imported = imported; - this.finish(); - return this; - }, - - finishImportDeclaration: function (specifiers, src) { - this.type = Syntax.ImportDeclaration; - this.specifiers = specifiers; - this.source = src; - this.finish(); - return this; - }, - - finishYieldExpression: function (argument, delegate) { - this.type = Syntax.YieldExpression; - this.argument = argument; - this.delegate = delegate; - this.finish(); - return this; - } - }; - - - function recordError(error) { - var e, existing; - - for (e = 0; e < extra.errors.length; e++) { - existing = extra.errors[e]; - // Prevent duplicated error. - /* istanbul ignore next */ - if (existing.index === error.index && existing.message === error.message) { - return; - } - } - - extra.errors.push(error); - } - - function constructError(msg, column) { - var error = new Error(msg); - try { - throw error; - } catch (base) { - /* istanbul ignore else */ - if (Object.create && Object.defineProperty) { - error = Object.create(base); - Object.defineProperty(error, 'column', { value: column }); - } - } finally { - return error; - } - } - - function createError(line, pos, description) { - var msg, column, error; - - msg = 'Line ' + line + ': ' + description; - column = pos - (scanning ? lineStart : lastLineStart) + 1; - error = constructError(msg, column); - error.lineNumber = line; - error.description = description; - error.index = pos; - return error; - } - - // Throw an exception - - function throwError(messageFormat) { - var args, msg; - - args = Array.prototype.slice.call(arguments, 1); - msg = messageFormat.replace(/%(\d)/g, - function (whole, idx) { - assert(idx < args.length, 'Message reference must be in range'); - return args[idx]; - } - ); - - throw createError(lastLineNumber, lastIndex, msg); - } - - function tolerateError(messageFormat) { - var args, msg, error; - - args = Array.prototype.slice.call(arguments, 1); - /* istanbul ignore next */ - msg = messageFormat.replace(/%(\d)/g, - function (whole, idx) { - assert(idx < args.length, 'Message reference must be in range'); - return args[idx]; - } - ); - - error = createError(lineNumber, lastIndex, msg); - if (extra.errors) { - recordError(error); - } else { - throw error; - } - } - - // Throw an exception because of the token. - - function unexpectedTokenError(token, message) { - var value, msg = message || Messages.UnexpectedToken; - - if (token) { - if (!message) { - msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS : - (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier : - (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber : - (token.type === Token.StringLiteral) ? Messages.UnexpectedString : - (token.type === Token.Template) ? Messages.UnexpectedTemplate : - Messages.UnexpectedToken; - - if (token.type === Token.Keyword) { - if (isFutureReservedWord(token.value)) { - msg = Messages.UnexpectedReserved; - } else if (strict && isStrictModeReservedWord(token.value)) { - msg = Messages.StrictReservedWord; - } - } - } - - value = (token.type === Token.Template) ? token.value.raw : token.value; - } else { - value = 'ILLEGAL'; - } - - msg = msg.replace('%0', value); - - return (token && typeof token.lineNumber === 'number') ? - createError(token.lineNumber, token.start, msg) : - createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg); - } - - function throwUnexpectedToken(token, message) { - throw unexpectedTokenError(token, message); - } - - function tolerateUnexpectedToken(token, message) { - var error = unexpectedTokenError(token, message); - if (extra.errors) { - recordError(error); - } else { - throw error; - } - } - - // Expect the next token to match the specified punctuator. - // If not, an exception will be thrown. - - function expect(value) { - var token = lex(); - if (token.type !== Token.Punctuator || token.value !== value) { - throwUnexpectedToken(token); - } - } - - /** - * @name expectCommaSeparator - * @description Quietly expect a comma when in tolerant mode, otherwise delegates - * to expect(value) - * @since 2.0 - */ - function expectCommaSeparator() { - var token; - - if (extra.errors) { - token = lookahead; - if (token.type === Token.Punctuator && token.value === ',') { - lex(); - } else if (token.type === Token.Punctuator && token.value === ';') { - lex(); - tolerateUnexpectedToken(token); - } else { - tolerateUnexpectedToken(token, Messages.UnexpectedToken); - } - } else { - expect(','); - } - } - - // Expect the next token to match the specified keyword. - // If not, an exception will be thrown. - - function expectKeyword(keyword) { - var token = lex(); - if (token.type !== Token.Keyword || token.value !== keyword) { - throwUnexpectedToken(token); - } - } - - // Return true if the next token matches the specified punctuator. - - function match(value) { - return lookahead.type === Token.Punctuator && lookahead.value === value; - } - - // Return true if the next token matches the specified keyword - - function matchKeyword(keyword) { - return lookahead.type === Token.Keyword && lookahead.value === keyword; - } - - // Return true if the next token matches the specified contextual keyword - // (where an identifier is sometimes a keyword depending on the context) - - function matchContextualKeyword(keyword) { - return lookahead.type === Token.Identifier && lookahead.value === keyword; - } - - // Return true if the next token is an assignment operator - - function matchAssign() { - var op; - - if (lookahead.type !== Token.Punctuator) { - return false; - } - op = lookahead.value; - return op === '=' || - op === '*=' || - op === '/=' || - op === '%=' || - op === '+=' || - op === '-=' || - op === '<<=' || - op === '>>=' || - op === '>>>=' || - op === '&=' || - op === '^=' || - op === '|='; - } - - function consumeSemicolon() { - // Catch the very common case first: immediately a semicolon (U+003B). - if (source.charCodeAt(startIndex) === 0x3B || match(';')) { - lex(); - return; - } - - if (hasLineTerminator) { - return; - } - - // FIXME(ikarienator): this is seemingly an issue in the previous location info convention. - lastIndex = startIndex; - lastLineNumber = startLineNumber; - lastLineStart = startLineStart; - - if (lookahead.type !== Token.EOF && !match('}')) { - throwUnexpectedToken(lookahead); - } - } - - // Cover grammar support. - // - // When an assignment expression position starts with an left parenthesis, the determination of the type - // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead) - // or the first comma. This situation also defers the determination of all the expressions nested in the pair. - // - // There are three productions that can be parsed in a parentheses pair that needs to be determined - // after the outermost pair is closed. They are: - // - // 1. AssignmentExpression - // 2. BindingElements - // 3. AssignmentTargets - // - // In order to avoid exponential backtracking, we use two flags to denote if the production can be - // binding element or assignment target. - // - // The three productions have the relationship: - // - // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression - // - // with a single exception that CoverInitializedName when used directly in an Expression, generates - // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the - // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair. - // - // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not - // effect the current flags. This means the production the parser parses is only used as an expression. Therefore - // the CoverInitializedName check is conducted. - // - // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates - // the flags outside of the parser. This means the production the parser parses is used as a part of a potential - // pattern. The CoverInitializedName check is deferred. - function isolateCoverGrammar(parser) { - var oldIsBindingElement = isBindingElement, - oldIsAssignmentTarget = isAssignmentTarget, - oldFirstCoverInitializedNameError = firstCoverInitializedNameError, - result; - isBindingElement = true; - isAssignmentTarget = true; - firstCoverInitializedNameError = null; - result = parser(); - if (firstCoverInitializedNameError !== null) { - throwUnexpectedToken(firstCoverInitializedNameError); - } - isBindingElement = oldIsBindingElement; - isAssignmentTarget = oldIsAssignmentTarget; - firstCoverInitializedNameError = oldFirstCoverInitializedNameError; - return result; - } - - function inheritCoverGrammar(parser) { - var oldIsBindingElement = isBindingElement, - oldIsAssignmentTarget = isAssignmentTarget, - oldFirstCoverInitializedNameError = firstCoverInitializedNameError, - result; - isBindingElement = true; - isAssignmentTarget = true; - firstCoverInitializedNameError = null; - result = parser(); - isBindingElement = isBindingElement && oldIsBindingElement; - isAssignmentTarget = isAssignmentTarget && oldIsAssignmentTarget; - firstCoverInitializedNameError = oldFirstCoverInitializedNameError || firstCoverInitializedNameError; - return result; - } - - // ECMA-262 13.3.3 Destructuring Binding Patterns - - function parseArrayPattern(params, kind) { - var node = new Node(), elements = [], rest, restNode; - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else { - if (match('...')) { - restNode = new Node(); - lex(); - params.push(lookahead); - rest = parseVariableIdentifier(kind); - elements.push(restNode.finishRestElement(rest)); - break; - } else { - elements.push(parsePatternWithDefault(params, kind)); - } - if (!match(']')) { - expect(','); - } - } - - } - - expect(']'); - - return node.finishArrayPattern(elements); - } - - function parsePropertyPattern(params, kind) { - var node = new Node(), key, keyToken, computed = match('['), init; - if (lookahead.type === Token.Identifier) { - keyToken = lookahead; - key = parseVariableIdentifier(); - if (match('=')) { - params.push(keyToken); - lex(); - init = parseAssignmentExpression(); - - return node.finishProperty( - 'init', key, false, - new WrappingNode(keyToken).finishAssignmentPattern(key, init), false, true); - } else if (!match(':')) { - params.push(keyToken); - return node.finishProperty('init', key, false, key, false, true); - } - } else { - key = parseObjectPropertyKey(); - } - expect(':'); - init = parsePatternWithDefault(params, kind); - return node.finishProperty('init', key, computed, init, false, false); - } - - function parseObjectPattern(params, kind) { - var node = new Node(), properties = []; - - expect('{'); - - while (!match('}')) { - properties.push(parsePropertyPattern(params, kind)); - if (!match('}')) { - expect(','); - } - } - - lex(); - - return node.finishObjectPattern(properties); - } - - function parsePattern(params, kind) { - if (match('[')) { - return parseArrayPattern(params, kind); - } else if (match('{')) { - return parseObjectPattern(params, kind); - } else if (matchKeyword('let')) { - if (kind === 'const' || kind === 'let') { - tolerateUnexpectedToken(lookahead, Messages.UnexpectedToken); - } - } - - params.push(lookahead); - return parseVariableIdentifier(kind); - } - - function parsePatternWithDefault(params, kind) { - var startToken = lookahead, pattern, previousAllowYield, right; - pattern = parsePattern(params, kind); - if (match('=')) { - lex(); - previousAllowYield = state.allowYield; - state.allowYield = true; - right = isolateCoverGrammar(parseAssignmentExpression); - state.allowYield = previousAllowYield; - pattern = new WrappingNode(startToken).finishAssignmentPattern(pattern, right); - } - return pattern; - } - - // ECMA-262 12.2.5 Array Initializer - - function parseArrayInitializer() { - var elements = [], node = new Node(), restSpread; - - expect('['); - - while (!match(']')) { - if (match(',')) { - lex(); - elements.push(null); - } else if (match('...')) { - restSpread = new Node(); - lex(); - restSpread.finishSpreadElement(inheritCoverGrammar(parseAssignmentExpression)); - - if (!match(']')) { - isAssignmentTarget = isBindingElement = false; - expect(','); - } - elements.push(restSpread); - } else { - elements.push(inheritCoverGrammar(parseAssignmentExpression)); - - if (!match(']')) { - expect(','); - } - } - } - - lex(); - - return node.finishArrayExpression(elements); - } - - // ECMA-262 12.2.6 Object Initializer - - function parsePropertyFunction(node, paramInfo, isGenerator) { - var previousStrict, body; - - isAssignmentTarget = isBindingElement = false; - - previousStrict = strict; - body = isolateCoverGrammar(parseFunctionSourceElements); - - if (strict && paramInfo.firstRestricted) { - tolerateUnexpectedToken(paramInfo.firstRestricted, paramInfo.message); - } - if (strict && paramInfo.stricted) { - tolerateUnexpectedToken(paramInfo.stricted, paramInfo.message); - } - - strict = previousStrict; - return node.finishFunctionExpression(null, paramInfo.params, paramInfo.defaults, body, isGenerator); - } - - function parsePropertyMethodFunction() { - var params, method, node = new Node(), - previousAllowYield = state.allowYield; - - state.allowYield = false; - params = parseParams(); - state.allowYield = previousAllowYield; - - state.allowYield = false; - method = parsePropertyFunction(node, params, false); - state.allowYield = previousAllowYield; - - return method; - } - - function parseObjectPropertyKey() { - var token, node = new Node(), expr; - - token = lex(); - - // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - - switch (token.type) { - case Token.StringLiteral: - case Token.NumericLiteral: - if (strict && token.octal) { - tolerateUnexpectedToken(token, Messages.StrictOctalLiteral); - } - return node.finishLiteral(token); - case Token.Identifier: - case Token.BooleanLiteral: - case Token.NullLiteral: - case Token.Keyword: - return node.finishIdentifier(token.value); - case Token.Punctuator: - if (token.value === '[') { - expr = isolateCoverGrammar(parseAssignmentExpression); - expect(']'); - return expr; - } - break; - } - throwUnexpectedToken(token); - } - - function lookaheadPropertyName() { - switch (lookahead.type) { - case Token.Identifier: - case Token.StringLiteral: - case Token.BooleanLiteral: - case Token.NullLiteral: - case Token.NumericLiteral: - case Token.Keyword: - return true; - case Token.Punctuator: - return lookahead.value === '['; - } - return false; - } - - // This function is to try to parse a MethodDefinition as defined in 14.3. But in the case of object literals, - // it might be called at a position where there is in fact a short hand identifier pattern or a data property. - // This can only be determined after we consumed up to the left parentheses. - // - // In order to avoid back tracking, it returns `null` if the position is not a MethodDefinition and the caller - // is responsible to visit other options. - function tryParseMethodDefinition(token, key, computed, node) { - var value, options, methodNode, params, - previousAllowYield = state.allowYield; - - if (token.type === Token.Identifier) { - // check for `get` and `set`; - - if (token.value === 'get' && lookaheadPropertyName()) { - computed = match('['); - key = parseObjectPropertyKey(); - methodNode = new Node(); - expect('('); - expect(')'); - - state.allowYield = false; - value = parsePropertyFunction(methodNode, { - params: [], - defaults: [], - stricted: null, - firstRestricted: null, - message: null - }, false); - state.allowYield = previousAllowYield; - - return node.finishProperty('get', key, computed, value, false, false); - } else if (token.value === 'set' && lookaheadPropertyName()) { - computed = match('['); - key = parseObjectPropertyKey(); - methodNode = new Node(); - expect('('); - - options = { - params: [], - defaultCount: 0, - defaults: [], - firstRestricted: null, - paramSet: {} - }; - if (match(')')) { - tolerateUnexpectedToken(lookahead); - } else { - state.allowYield = false; - parseParam(options); - state.allowYield = previousAllowYield; - if (options.defaultCount === 0) { - options.defaults = []; - } - } - expect(')'); - - state.allowYield = false; - value = parsePropertyFunction(methodNode, options, false); - state.allowYield = previousAllowYield; - - return node.finishProperty('set', key, computed, value, false, false); - } - } else if (token.type === Token.Punctuator && token.value === '*' && lookaheadPropertyName()) { - computed = match('['); - key = parseObjectPropertyKey(); - methodNode = new Node(); - - state.allowYield = true; - params = parseParams(); - state.allowYield = previousAllowYield; - - state.allowYield = false; - value = parsePropertyFunction(methodNode, params, true); - state.allowYield = previousAllowYield; - - return node.finishProperty('init', key, computed, value, true, false); - } - - if (key && match('(')) { - value = parsePropertyMethodFunction(); - return node.finishProperty('init', key, computed, value, true, false); - } - - // Not a MethodDefinition. - return null; - } - - function parseObjectProperty(hasProto) { - var token = lookahead, node = new Node(), computed, key, maybeMethod, proto, value; - - computed = match('['); - if (match('*')) { - lex(); - } else { - key = parseObjectPropertyKey(); - } - maybeMethod = tryParseMethodDefinition(token, key, computed, node); - if (maybeMethod) { - return maybeMethod; - } - - if (!key) { - throwUnexpectedToken(lookahead); - } - - // Check for duplicated __proto__ - if (!computed) { - proto = (key.type === Syntax.Identifier && key.name === '__proto__') || - (key.type === Syntax.Literal && key.value === '__proto__'); - if (hasProto.value && proto) { - tolerateError(Messages.DuplicateProtoProperty); - } - hasProto.value |= proto; - } - - if (match(':')) { - lex(); - value = inheritCoverGrammar(parseAssignmentExpression); - return node.finishProperty('init', key, computed, value, false, false); - } - - if (token.type === Token.Identifier) { - if (match('=')) { - firstCoverInitializedNameError = lookahead; - lex(); - value = isolateCoverGrammar(parseAssignmentExpression); - return node.finishProperty('init', key, computed, - new WrappingNode(token).finishAssignmentPattern(key, value), false, true); - } - return node.finishProperty('init', key, computed, key, false, true); - } - - throwUnexpectedToken(lookahead); - } - - function parseObjectInitializer() { - var properties = [], hasProto = {value: false}, node = new Node(); - - expect('{'); - - while (!match('}')) { - properties.push(parseObjectProperty(hasProto)); - - if (!match('}')) { - expectCommaSeparator(); - } - } - - expect('}'); - - return node.finishObjectExpression(properties); - } - - function reinterpretExpressionAsPattern(expr) { - var i; - switch (expr.type) { - case Syntax.Identifier: - case Syntax.MemberExpression: - case Syntax.RestElement: - case Syntax.AssignmentPattern: - break; - case Syntax.SpreadElement: - expr.type = Syntax.RestElement; - reinterpretExpressionAsPattern(expr.argument); - break; - case Syntax.ArrayExpression: - expr.type = Syntax.ArrayPattern; - for (i = 0; i < expr.elements.length; i++) { - if (expr.elements[i] !== null) { - reinterpretExpressionAsPattern(expr.elements[i]); - } - } - break; - case Syntax.ObjectExpression: - expr.type = Syntax.ObjectPattern; - for (i = 0; i < expr.properties.length; i++) { - reinterpretExpressionAsPattern(expr.properties[i].value); - } - break; - case Syntax.AssignmentExpression: - expr.type = Syntax.AssignmentPattern; - reinterpretExpressionAsPattern(expr.left); - break; - default: - // Allow other node type for tolerant parsing. - break; - } - } - - // ECMA-262 12.2.9 Template Literals - - function parseTemplateElement(option) { - var node, token; - - if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) { - throwUnexpectedToken(); - } - - node = new Node(); - token = lex(); - - return node.finishTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail); - } - - function parseTemplateLiteral() { - var quasi, quasis, expressions, node = new Node(); - - quasi = parseTemplateElement({ head: true }); - quasis = [quasi]; - expressions = []; - - while (!quasi.tail) { - expressions.push(parseExpression()); - quasi = parseTemplateElement({ head: false }); - quasis.push(quasi); - } - - return node.finishTemplateLiteral(quasis, expressions); - } - - // ECMA-262 12.2.10 The Grouping Operator - - function parseGroupExpression() { - var expr, expressions, startToken, i, params = []; - - expect('('); - - if (match(')')) { - lex(); - if (!match('=>')) { - expect('=>'); - } - return { - type: PlaceHolders.ArrowParameterPlaceHolder, - params: [], - rawParams: [] - }; - } - - startToken = lookahead; - if (match('...')) { - expr = parseRestElement(params); - expect(')'); - if (!match('=>')) { - expect('=>'); - } - return { - type: PlaceHolders.ArrowParameterPlaceHolder, - params: [expr] - }; - } - - isBindingElement = true; - expr = inheritCoverGrammar(parseAssignmentExpression); - - if (match(',')) { - isAssignmentTarget = false; - expressions = [expr]; - - while (startIndex < length) { - if (!match(',')) { - break; - } - lex(); - - if (match('...')) { - if (!isBindingElement) { - throwUnexpectedToken(lookahead); - } - expressions.push(parseRestElement(params)); - expect(')'); - if (!match('=>')) { - expect('=>'); - } - isBindingElement = false; - for (i = 0; i < expressions.length; i++) { - reinterpretExpressionAsPattern(expressions[i]); - } - return { - type: PlaceHolders.ArrowParameterPlaceHolder, - params: expressions - }; - } - - expressions.push(inheritCoverGrammar(parseAssignmentExpression)); - } - - expr = new WrappingNode(startToken).finishSequenceExpression(expressions); - } - - - expect(')'); - - if (match('=>')) { - if (expr.type === Syntax.Identifier && expr.name === 'yield') { - return { - type: PlaceHolders.ArrowParameterPlaceHolder, - params: [expr] - }; - } - - if (!isBindingElement) { - throwUnexpectedToken(lookahead); - } - - if (expr.type === Syntax.SequenceExpression) { - for (i = 0; i < expr.expressions.length; i++) { - reinterpretExpressionAsPattern(expr.expressions[i]); - } - } else { - reinterpretExpressionAsPattern(expr); - } - - expr = { - type: PlaceHolders.ArrowParameterPlaceHolder, - params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr] - }; - } - isBindingElement = false; - return expr; - } - - - // ECMA-262 12.2 Primary Expressions - - function parsePrimaryExpression() { - var type, token, expr, node; - - if (match('(')) { - isBindingElement = false; - return inheritCoverGrammar(parseGroupExpression); - } - - if (match('[')) { - return inheritCoverGrammar(parseArrayInitializer); - } - - if (match('{')) { - return inheritCoverGrammar(parseObjectInitializer); - } - - type = lookahead.type; - node = new Node(); - - if (type === Token.Identifier) { - if (state.sourceType === 'module' && lookahead.value === 'await') { - tolerateUnexpectedToken(lookahead); - } - expr = node.finishIdentifier(lex().value); - } else if (type === Token.StringLiteral || type === Token.NumericLiteral) { - isAssignmentTarget = isBindingElement = false; - if (strict && lookahead.octal) { - tolerateUnexpectedToken(lookahead, Messages.StrictOctalLiteral); - } - expr = node.finishLiteral(lex()); - } else if (type === Token.Keyword) { - if (!strict && state.allowYield && matchKeyword('yield')) { - return parseNonComputedProperty(); - } - if (!strict && matchKeyword('let')) { - return node.finishIdentifier(lex().value); - } - isAssignmentTarget = isBindingElement = false; - if (matchKeyword('function')) { - return parseFunctionExpression(); - } - if (matchKeyword('this')) { - lex(); - return node.finishThisExpression(); - } - if (matchKeyword('class')) { - return parseClassExpression(); - } - throwUnexpectedToken(lex()); - } else if (type === Token.BooleanLiteral) { - isAssignmentTarget = isBindingElement = false; - token = lex(); - token.value = (token.value === 'true'); - expr = node.finishLiteral(token); - } else if (type === Token.NullLiteral) { - isAssignmentTarget = isBindingElement = false; - token = lex(); - token.value = null; - expr = node.finishLiteral(token); - } else if (match('/') || match('/=')) { - isAssignmentTarget = isBindingElement = false; - index = startIndex; - - if (typeof extra.tokens !== 'undefined') { - token = collectRegex(); - } else { - token = scanRegExp(); - } - lex(); - expr = node.finishLiteral(token); - } else if (type === Token.Template) { - expr = parseTemplateLiteral(); - } else { - throwUnexpectedToken(lex()); - } - - return expr; - } - - // ECMA-262 12.3 Left-Hand-Side Expressions - - function parseArguments() { - var args = [], expr; - - expect('('); - - if (!match(')')) { - while (startIndex < length) { - if (match('...')) { - expr = new Node(); - lex(); - expr.finishSpreadElement(isolateCoverGrammar(parseAssignmentExpression)); - } else { - expr = isolateCoverGrammar(parseAssignmentExpression); - } - args.push(expr); - if (match(')')) { - break; - } - expectCommaSeparator(); - } - } - - expect(')'); - - return args; - } - - function parseNonComputedProperty() { - var token, node = new Node(); - - token = lex(); - - if (!isIdentifierName(token)) { - throwUnexpectedToken(token); - } - - return node.finishIdentifier(token.value); - } - - function parseNonComputedMember() { - expect('.'); - - return parseNonComputedProperty(); - } - - function parseComputedMember() { - var expr; - - expect('['); - - expr = isolateCoverGrammar(parseExpression); - - expect(']'); - - return expr; - } - - // ECMA-262 12.3.3 The new Operator - - function parseNewExpression() { - var callee, args, node = new Node(); - - expectKeyword('new'); - - if (match('.')) { - lex(); - if (lookahead.type === Token.Identifier && lookahead.value === 'target') { - if (state.inFunctionBody) { - lex(); - return node.finishMetaProperty('new', 'target'); - } - } - throwUnexpectedToken(lookahead); - } - - callee = isolateCoverGrammar(parseLeftHandSideExpression); - args = match('(') ? parseArguments() : []; - - isAssignmentTarget = isBindingElement = false; - - return node.finishNewExpression(callee, args); - } - - // ECMA-262 12.3.4 Function Calls - - function parseLeftHandSideExpressionAllowCall() { - var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn; - - startToken = lookahead; - state.allowIn = true; - - if (matchKeyword('super') && state.inFunctionBody) { - expr = new Node(); - lex(); - expr = expr.finishSuper(); - if (!match('(') && !match('.') && !match('[')) { - throwUnexpectedToken(lookahead); - } - } else { - expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression); - } - - for (;;) { - if (match('.')) { - isBindingElement = false; - isAssignmentTarget = true; - property = parseNonComputedMember(); - expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property); - } else if (match('(')) { - isBindingElement = false; - isAssignmentTarget = false; - args = parseArguments(); - expr = new WrappingNode(startToken).finishCallExpression(expr, args); - } else if (match('[')) { - isBindingElement = false; - isAssignmentTarget = true; - property = parseComputedMember(); - expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property); - } else if (lookahead.type === Token.Template && lookahead.head) { - quasi = parseTemplateLiteral(); - expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi); - } else { - break; - } - } - state.allowIn = previousAllowIn; - - return expr; - } - - // ECMA-262 12.3 Left-Hand-Side Expressions - - function parseLeftHandSideExpression() { - var quasi, expr, property, startToken; - assert(state.allowIn, 'callee of new expression always allow in keyword.'); - - startToken = lookahead; - - if (matchKeyword('super') && state.inFunctionBody) { - expr = new Node(); - lex(); - expr = expr.finishSuper(); - if (!match('[') && !match('.')) { - throwUnexpectedToken(lookahead); - } - } else { - expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression); - } - - for (;;) { - if (match('[')) { - isBindingElement = false; - isAssignmentTarget = true; - property = parseComputedMember(); - expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property); - } else if (match('.')) { - isBindingElement = false; - isAssignmentTarget = true; - property = parseNonComputedMember(); - expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property); - } else if (lookahead.type === Token.Template && lookahead.head) { - quasi = parseTemplateLiteral(); - expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi); - } else { - break; - } - } - return expr; - } - - // ECMA-262 12.4 Postfix Expressions - - function parsePostfixExpression() { - var expr, token, startToken = lookahead; - - expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall); - - if (!hasLineTerminator && lookahead.type === Token.Punctuator) { - if (match('++') || match('--')) { - // ECMA-262 11.3.1, 11.3.2 - if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { - tolerateError(Messages.StrictLHSPostfix); - } - - if (!isAssignmentTarget) { - tolerateError(Messages.InvalidLHSInAssignment); - } - - isAssignmentTarget = isBindingElement = false; - - token = lex(); - expr = new WrappingNode(startToken).finishPostfixExpression(token.value, expr); - } - } - - return expr; - } - - // ECMA-262 12.5 Unary Operators - - function parseUnaryExpression() { - var token, expr, startToken; - - if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) { - expr = parsePostfixExpression(); - } else if (match('++') || match('--')) { - startToken = lookahead; - token = lex(); - expr = inheritCoverGrammar(parseUnaryExpression); - // ECMA-262 11.4.4, 11.4.5 - if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { - tolerateError(Messages.StrictLHSPrefix); - } - - if (!isAssignmentTarget) { - tolerateError(Messages.InvalidLHSInAssignment); - } - expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); - isAssignmentTarget = isBindingElement = false; - } else if (match('+') || match('-') || match('~') || match('!')) { - startToken = lookahead; - token = lex(); - expr = inheritCoverGrammar(parseUnaryExpression); - expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); - isAssignmentTarget = isBindingElement = false; - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { - startToken = lookahead; - token = lex(); - expr = inheritCoverGrammar(parseUnaryExpression); - expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr); - if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) { - tolerateError(Messages.StrictDelete); - } - isAssignmentTarget = isBindingElement = false; - } else { - expr = parsePostfixExpression(); - } - - return expr; - } - - function binaryPrecedence(token, allowIn) { - var prec = 0; - - if (token.type !== Token.Punctuator && token.type !== Token.Keyword) { - return 0; - } - - switch (token.value) { - case '||': - prec = 1; - break; - - case '&&': - prec = 2; - break; - - case '|': - prec = 3; - break; - - case '^': - prec = 4; - break; - - case '&': - prec = 5; - break; - - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - prec = 7; - break; - - case 'in': - prec = allowIn ? 7 : 0; - break; - - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - - case '+': - case '-': - prec = 9; - break; - - case '*': - case '/': - case '%': - prec = 11; - break; - - default: - break; - } - - return prec; - } - - // ECMA-262 12.6 Multiplicative Operators - // ECMA-262 12.7 Additive Operators - // ECMA-262 12.8 Bitwise Shift Operators - // ECMA-262 12.9 Relational Operators - // ECMA-262 12.10 Equality Operators - // ECMA-262 12.11 Binary Bitwise Operators - // ECMA-262 12.12 Binary Logical Operators - - function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - - marker = lookahead; - left = inheritCoverGrammar(parseUnaryExpression); - - token = lookahead; - prec = binaryPrecedence(token, state.allowIn); - if (prec === 0) { - return left; - } - isAssignmentTarget = isBindingElement = false; - token.prec = prec; - lex(); - - markers = [marker, lookahead]; - right = isolateCoverGrammar(parseUnaryExpression); - - stack = [left, token, right]; - - while ((prec = binaryPrecedence(lookahead, state.allowIn)) > 0) { - - // Reduce: make a binary expression from the three topmost entries. - while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) { - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = new WrappingNode(markers[markers.length - 1]).finishBinaryExpression(operator, left, right); - stack.push(expr); - } - - // Shift. - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = isolateCoverGrammar(parseUnaryExpression); - stack.push(expr); - } - - // Final reduce to clean-up the stack. - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while (i > 1) { - expr = new WrappingNode(markers.pop()).finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - - return expr; - } - - - // ECMA-262 12.13 Conditional Operator - - function parseConditionalExpression() { - var expr, previousAllowIn, consequent, alternate, startToken; - - startToken = lookahead; - - expr = inheritCoverGrammar(parseBinaryExpression); - if (match('?')) { - lex(); - previousAllowIn = state.allowIn; - state.allowIn = true; - consequent = isolateCoverGrammar(parseAssignmentExpression); - state.allowIn = previousAllowIn; - expect(':'); - alternate = isolateCoverGrammar(parseAssignmentExpression); - - expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate); - isAssignmentTarget = isBindingElement = false; - } - - return expr; - } - - // ECMA-262 14.2 Arrow Function Definitions - - function parseConciseBody() { - if (match('{')) { - return parseFunctionSourceElements(); - } - return isolateCoverGrammar(parseAssignmentExpression); - } - - function checkPatternParam(options, param) { - var i; - switch (param.type) { - case Syntax.Identifier: - validateParam(options, param, param.name); - break; - case Syntax.RestElement: - checkPatternParam(options, param.argument); - break; - case Syntax.AssignmentPattern: - checkPatternParam(options, param.left); - break; - case Syntax.ArrayPattern: - for (i = 0; i < param.elements.length; i++) { - if (param.elements[i] !== null) { - checkPatternParam(options, param.elements[i]); - } - } - break; - case Syntax.YieldExpression: - break; - default: - assert(param.type === Syntax.ObjectPattern, 'Invalid type'); - for (i = 0; i < param.properties.length; i++) { - checkPatternParam(options, param.properties[i].value); - } - break; - } - } - function reinterpretAsCoverFormalsList(expr) { - var i, len, param, params, defaults, defaultCount, options, token; - - defaults = []; - defaultCount = 0; - params = [expr]; - - switch (expr.type) { - case Syntax.Identifier: - break; - case PlaceHolders.ArrowParameterPlaceHolder: - params = expr.params; - break; - default: - return null; - } - - options = { - paramSet: {} - }; - - for (i = 0, len = params.length; i < len; i += 1) { - param = params[i]; - switch (param.type) { - case Syntax.AssignmentPattern: - params[i] = param.left; - if (param.right.type === Syntax.YieldExpression) { - if (param.right.argument) { - throwUnexpectedToken(lookahead); - } - param.right.type = Syntax.Identifier; - param.right.name = 'yield'; - delete param.right.argument; - delete param.right.delegate; - } - defaults.push(param.right); - ++defaultCount; - checkPatternParam(options, param.left); - break; - default: - checkPatternParam(options, param); - params[i] = param; - defaults.push(null); - break; - } - } - - if (strict || !state.allowYield) { - for (i = 0, len = params.length; i < len; i += 1) { - param = params[i]; - if (param.type === Syntax.YieldExpression) { - throwUnexpectedToken(lookahead); - } - } - } - - if (options.message === Messages.StrictParamDupe) { - token = strict ? options.stricted : options.firstRestricted; - throwUnexpectedToken(token, options.message); - } - - if (defaultCount === 0) { - defaults = []; - } - - return { - params: params, - defaults: defaults, - stricted: options.stricted, - firstRestricted: options.firstRestricted, - message: options.message - }; - } - - function parseArrowFunctionExpression(options, node) { - var previousStrict, previousAllowYield, body; - - if (hasLineTerminator) { - tolerateUnexpectedToken(lookahead); - } - expect('=>'); - - previousStrict = strict; - previousAllowYield = state.allowYield; - state.allowYield = true; - - body = parseConciseBody(); - - if (strict && options.firstRestricted) { - throwUnexpectedToken(options.firstRestricted, options.message); - } - if (strict && options.stricted) { - tolerateUnexpectedToken(options.stricted, options.message); - } - - strict = previousStrict; - state.allowYield = previousAllowYield; - - return node.finishArrowFunctionExpression(options.params, options.defaults, body, body.type !== Syntax.BlockStatement); - } - - // ECMA-262 14.4 Yield expression - - function parseYieldExpression() { - var argument, expr, delegate, previousAllowYield; - - argument = null; - expr = new Node(); - delegate = false; - - expectKeyword('yield'); - - if (!hasLineTerminator) { - previousAllowYield = state.allowYield; - state.allowYield = false; - delegate = match('*'); - if (delegate) { - lex(); - argument = parseAssignmentExpression(); - } else { - if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) { - argument = parseAssignmentExpression(); - } - } - state.allowYield = previousAllowYield; - } - - return expr.finishYieldExpression(argument, delegate); - } - - // ECMA-262 12.14 Assignment Operators - - function parseAssignmentExpression() { - var token, expr, right, list, startToken; - - startToken = lookahead; - token = lookahead; - - if (!state.allowYield && matchKeyword('yield')) { - return parseYieldExpression(); - } - - expr = parseConditionalExpression(); - - if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) { - isAssignmentTarget = isBindingElement = false; - list = reinterpretAsCoverFormalsList(expr); - - if (list) { - firstCoverInitializedNameError = null; - return parseArrowFunctionExpression(list, new WrappingNode(startToken)); - } - - return expr; - } - - if (matchAssign()) { - if (!isAssignmentTarget) { - tolerateError(Messages.InvalidLHSInAssignment); - } - - // ECMA-262 12.1.1 - if (strict && expr.type === Syntax.Identifier) { - if (isRestrictedWord(expr.name)) { - tolerateUnexpectedToken(token, Messages.StrictLHSAssignment); - } - if (isStrictModeReservedWord(expr.name)) { - tolerateUnexpectedToken(token, Messages.StrictReservedWord); - } - } - - if (!match('=')) { - isAssignmentTarget = isBindingElement = false; - } else { - reinterpretExpressionAsPattern(expr); - } - - token = lex(); - right = isolateCoverGrammar(parseAssignmentExpression); - expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right); - firstCoverInitializedNameError = null; - } - - return expr; - } - - // ECMA-262 12.15 Comma Operator - - function parseExpression() { - var expr, startToken = lookahead, expressions; - - expr = isolateCoverGrammar(parseAssignmentExpression); - - if (match(',')) { - expressions = [expr]; - - while (startIndex < length) { - if (!match(',')) { - break; - } - lex(); - expressions.push(isolateCoverGrammar(parseAssignmentExpression)); - } - - expr = new WrappingNode(startToken).finishSequenceExpression(expressions); - } - - return expr; - } - - // ECMA-262 13.2 Block - - function parseStatementListItem() { - if (lookahead.type === Token.Keyword) { - switch (lookahead.value) { - case 'export': - if (state.sourceType !== 'module') { - tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration); - } - return parseExportDeclaration(); - case 'import': - if (state.sourceType !== 'module') { - tolerateUnexpectedToken(lookahead, Messages.IllegalImportDeclaration); - } - return parseImportDeclaration(); - case 'const': - return parseLexicalDeclaration({inFor: false}); - case 'function': - return parseFunctionDeclaration(new Node()); - case 'class': - return parseClassDeclaration(); - } - } - - if (matchKeyword('let') && isLexicalDeclaration()) { - return parseLexicalDeclaration({inFor: false}); - } - - return parseStatement(); - } - - function parseStatementList() { - var list = []; - while (startIndex < length) { - if (match('}')) { - break; - } - list.push(parseStatementListItem()); - } - - return list; - } - - function parseBlock() { - var block, node = new Node(); - - expect('{'); - - block = parseStatementList(); - - expect('}'); - - return node.finishBlockStatement(block); - } - - // ECMA-262 13.3.2 Variable Statement - - function parseVariableIdentifier(kind) { - var token, node = new Node(); - - token = lex(); - - if (token.type === Token.Keyword && token.value === 'yield') { - if (strict) { - tolerateUnexpectedToken(token, Messages.StrictReservedWord); - } if (!state.allowYield) { - throwUnexpectedToken(token); - } - } else if (token.type !== Token.Identifier) { - if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) { - tolerateUnexpectedToken(token, Messages.StrictReservedWord); - } else { - if (strict || token.value !== 'let' || kind !== 'var') { - throwUnexpectedToken(token); - } - } - } else if (state.sourceType === 'module' && token.type === Token.Identifier && token.value === 'await') { - tolerateUnexpectedToken(token); - } - - return node.finishIdentifier(token.value); - } - - function parseVariableDeclaration(options) { - var init = null, id, node = new Node(), params = []; - - id = parsePattern(params, 'var'); - - // ECMA-262 12.2.1 - if (strict && isRestrictedWord(id.name)) { - tolerateError(Messages.StrictVarName); - } - - if (match('=')) { - lex(); - init = isolateCoverGrammar(parseAssignmentExpression); - } else if (id.type !== Syntax.Identifier && !options.inFor) { - expect('='); - } - - return node.finishVariableDeclarator(id, init); - } - - function parseVariableDeclarationList(options) { - var opt, list; - - opt = { inFor: options.inFor }; - list = [parseVariableDeclaration(opt)]; - - while (match(',')) { - lex(); - list.push(parseVariableDeclaration(opt)); - } - - return list; - } - - function parseVariableStatement(node) { - var declarations; - - expectKeyword('var'); - - declarations = parseVariableDeclarationList({ inFor: false }); - - consumeSemicolon(); - - return node.finishVariableDeclaration(declarations); - } - - // ECMA-262 13.3.1 Let and Const Declarations - - function parseLexicalBinding(kind, options) { - var init = null, id, node = new Node(), params = []; - - id = parsePattern(params, kind); - - // ECMA-262 12.2.1 - if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) { - tolerateError(Messages.StrictVarName); - } - - if (kind === 'const') { - if (!matchKeyword('in') && !matchContextualKeyword('of')) { - expect('='); - init = isolateCoverGrammar(parseAssignmentExpression); - } - } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) { - expect('='); - init = isolateCoverGrammar(parseAssignmentExpression); - } - - return node.finishVariableDeclarator(id, init); - } - - function parseBindingList(kind, options) { - var list = [parseLexicalBinding(kind, options)]; - - while (match(',')) { - lex(); - list.push(parseLexicalBinding(kind, options)); - } - - return list; - } - - - function tokenizerState() { - return { - index: index, - lineNumber: lineNumber, - lineStart: lineStart, - hasLineTerminator: hasLineTerminator, - lastIndex: lastIndex, - lastLineNumber: lastLineNumber, - lastLineStart: lastLineStart, - startIndex: startIndex, - startLineNumber: startLineNumber, - startLineStart: startLineStart, - lookahead: lookahead, - tokenCount: extra.tokens ? extra.tokens.length : 0 - }; - } - - function resetTokenizerState(ts) { - index = ts.index; - lineNumber = ts.lineNumber; - lineStart = ts.lineStart; - hasLineTerminator = ts.hasLineTerminator; - lastIndex = ts.lastIndex; - lastLineNumber = ts.lastLineNumber; - lastLineStart = ts.lastLineStart; - startIndex = ts.startIndex; - startLineNumber = ts.startLineNumber; - startLineStart = ts.startLineStart; - lookahead = ts.lookahead; - if (extra.tokens) { - extra.tokens.splice(ts.tokenCount, extra.tokens.length); - } - } - - function isLexicalDeclaration() { - var lexical, ts; - - ts = tokenizerState(); - - lex(); - lexical = (lookahead.type === Token.Identifier) || match('[') || match('{') || - matchKeyword('let') || matchKeyword('yield'); - - resetTokenizerState(ts); - - return lexical; - } - - function parseLexicalDeclaration(options) { - var kind, declarations, node = new Node(); - - kind = lex().value; - assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const'); - - declarations = parseBindingList(kind, options); - - consumeSemicolon(); - - return node.finishLexicalDeclaration(declarations, kind); - } - - function parseRestElement(params) { - var param, node = new Node(); - - lex(); - - if (match('{')) { - throwError(Messages.ObjectPatternAsRestParameter); - } - - params.push(lookahead); - - param = parseVariableIdentifier(); - - if (match('=')) { - throwError(Messages.DefaultRestParameter); - } - - if (!match(')')) { - throwError(Messages.ParameterAfterRestParameter); - } - - return node.finishRestElement(param); - } - - // ECMA-262 13.4 Empty Statement - - function parseEmptyStatement(node) { - expect(';'); - return node.finishEmptyStatement(); - } - - // ECMA-262 12.4 Expression Statement - - function parseExpressionStatement(node) { - var expr = parseExpression(); - consumeSemicolon(); - return node.finishExpressionStatement(expr); - } - - // ECMA-262 13.6 If statement - - function parseIfStatement(node) { - var test, consequent, alternate; - - expectKeyword('if'); - - expect('('); - - test = parseExpression(); - - expect(')'); - - consequent = parseStatement(); - - if (matchKeyword('else')) { - lex(); - alternate = parseStatement(); - } else { - alternate = null; - } - - return node.finishIfStatement(test, consequent, alternate); - } - - // ECMA-262 13.7 Iteration Statements - - function parseDoWhileStatement(node) { - var body, test, oldInIteration; - - expectKeyword('do'); - - oldInIteration = state.inIteration; - state.inIteration = true; - - body = parseStatement(); - - state.inIteration = oldInIteration; - - expectKeyword('while'); - - expect('('); - - test = parseExpression(); - - expect(')'); - - if (match(';')) { - lex(); - } - - return node.finishDoWhileStatement(body, test); - } - - function parseWhileStatement(node) { - var test, body, oldInIteration; - - expectKeyword('while'); - - expect('('); - - test = parseExpression(); - - expect(')'); - - oldInIteration = state.inIteration; - state.inIteration = true; - - body = parseStatement(); - - state.inIteration = oldInIteration; - - return node.finishWhileStatement(test, body); - } - - function parseForStatement(node) { - var init, forIn, initSeq, initStartToken, test, update, left, right, kind, declarations, - body, oldInIteration, previousAllowIn = state.allowIn; - - init = test = update = null; - forIn = true; - - expectKeyword('for'); - - expect('('); - - if (match(';')) { - lex(); - } else { - if (matchKeyword('var')) { - init = new Node(); - lex(); - - state.allowIn = false; - declarations = parseVariableDeclarationList({ inFor: true }); - state.allowIn = previousAllowIn; - - if (declarations.length === 1 && matchKeyword('in')) { - init = init.finishVariableDeclaration(declarations); - lex(); - left = init; - right = parseExpression(); - init = null; - } else if (declarations.length === 1 && declarations[0].init === null && matchContextualKeyword('of')) { - init = init.finishVariableDeclaration(declarations); - lex(); - left = init; - right = parseAssignmentExpression(); - init = null; - forIn = false; - } else { - init = init.finishVariableDeclaration(declarations); - expect(';'); - } - } else if (matchKeyword('const') || matchKeyword('let')) { - init = new Node(); - kind = lex().value; - - if (!strict && lookahead.value === 'in') { - init = init.finishIdentifier(kind); - lex(); - left = init; - right = parseExpression(); - init = null; - } else { - state.allowIn = false; - declarations = parseBindingList(kind, {inFor: true}); - state.allowIn = previousAllowIn; - - if (declarations.length === 1 && declarations[0].init === null && matchKeyword('in')) { - init = init.finishLexicalDeclaration(declarations, kind); - lex(); - left = init; - right = parseExpression(); - init = null; - } else if (declarations.length === 1 && declarations[0].init === null && matchContextualKeyword('of')) { - init = init.finishLexicalDeclaration(declarations, kind); - lex(); - left = init; - right = parseAssignmentExpression(); - init = null; - forIn = false; - } else { - consumeSemicolon(); - init = init.finishLexicalDeclaration(declarations, kind); - } - } - } else { - initStartToken = lookahead; - state.allowIn = false; - init = inheritCoverGrammar(parseAssignmentExpression); - state.allowIn = previousAllowIn; - - if (matchKeyword('in')) { - if (!isAssignmentTarget) { - tolerateError(Messages.InvalidLHSInForIn); - } - - lex(); - reinterpretExpressionAsPattern(init); - left = init; - right = parseExpression(); - init = null; - } else if (matchContextualKeyword('of')) { - if (!isAssignmentTarget) { - tolerateError(Messages.InvalidLHSInForLoop); - } - - lex(); - reinterpretExpressionAsPattern(init); - left = init; - right = parseAssignmentExpression(); - init = null; - forIn = false; - } else { - if (match(',')) { - initSeq = [init]; - while (match(',')) { - lex(); - initSeq.push(isolateCoverGrammar(parseAssignmentExpression)); - } - init = new WrappingNode(initStartToken).finishSequenceExpression(initSeq); - } - expect(';'); - } - } - } - - if (typeof left === 'undefined') { - - if (!match(';')) { - test = parseExpression(); - } - expect(';'); - - if (!match(')')) { - update = parseExpression(); - } - } - - expect(')'); - - oldInIteration = state.inIteration; - state.inIteration = true; - - body = isolateCoverGrammar(parseStatement); - - state.inIteration = oldInIteration; - - return (typeof left === 'undefined') ? - node.finishForStatement(init, test, update, body) : - forIn ? node.finishForInStatement(left, right, body) : - node.finishForOfStatement(left, right, body); - } - - // ECMA-262 13.8 The continue statement - - function parseContinueStatement(node) { - var label = null, key; - - expectKeyword('continue'); - - // Optimize the most common form: 'continue;'. - if (source.charCodeAt(startIndex) === 0x3B) { - lex(); - - if (!state.inIteration) { - throwError(Messages.IllegalContinue); - } - - return node.finishContinueStatement(null); - } - - if (hasLineTerminator) { - if (!state.inIteration) { - throwError(Messages.IllegalContinue); - } - - return node.finishContinueStatement(null); - } - - if (lookahead.type === Token.Identifier) { - label = parseVariableIdentifier(); - - key = '$' + label.name; - if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) { - throwError(Messages.UnknownLabel, label.name); - } - } - - consumeSemicolon(); - - if (label === null && !state.inIteration) { - throwError(Messages.IllegalContinue); - } - - return node.finishContinueStatement(label); - } - - // ECMA-262 13.9 The break statement - - function parseBreakStatement(node) { - var label = null, key; - - expectKeyword('break'); - - // Catch the very common case first: immediately a semicolon (U+003B). - if (source.charCodeAt(lastIndex) === 0x3B) { - lex(); - - if (!(state.inIteration || state.inSwitch)) { - throwError(Messages.IllegalBreak); - } - - return node.finishBreakStatement(null); - } - - if (hasLineTerminator) { - if (!(state.inIteration || state.inSwitch)) { - throwError(Messages.IllegalBreak); - } - } else if (lookahead.type === Token.Identifier) { - label = parseVariableIdentifier(); - - key = '$' + label.name; - if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) { - throwError(Messages.UnknownLabel, label.name); - } - } - - consumeSemicolon(); - - if (label === null && !(state.inIteration || state.inSwitch)) { - throwError(Messages.IllegalBreak); - } - - return node.finishBreakStatement(label); - } - - // ECMA-262 13.10 The return statement - - function parseReturnStatement(node) { - var argument = null; - - expectKeyword('return'); - - if (!state.inFunctionBody) { - tolerateError(Messages.IllegalReturn); - } - - // 'return' followed by a space and an identifier is very common. - if (source.charCodeAt(lastIndex) === 0x20) { - if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) { - argument = parseExpression(); - consumeSemicolon(); - return node.finishReturnStatement(argument); - } - } - - if (hasLineTerminator) { - // HACK - return node.finishReturnStatement(null); - } - - if (!match(';')) { - if (!match('}') && lookahead.type !== Token.EOF) { - argument = parseExpression(); - } - } - - consumeSemicolon(); - - return node.finishReturnStatement(argument); - } - - // ECMA-262 13.11 The with statement - - function parseWithStatement(node) { - var object, body; - - if (strict) { - tolerateError(Messages.StrictModeWith); - } - - expectKeyword('with'); - - expect('('); - - object = parseExpression(); - - expect(')'); - - body = parseStatement(); - - return node.finishWithStatement(object, body); - } - - // ECMA-262 13.12 The switch statement - - function parseSwitchCase() { - var test, consequent = [], statement, node = new Node(); - - if (matchKeyword('default')) { - lex(); - test = null; - } else { - expectKeyword('case'); - test = parseExpression(); - } - expect(':'); - - while (startIndex < length) { - if (match('}') || matchKeyword('default') || matchKeyword('case')) { - break; - } - statement = parseStatementListItem(); - consequent.push(statement); - } - - return node.finishSwitchCase(test, consequent); - } - - function parseSwitchStatement(node) { - var discriminant, cases, clause, oldInSwitch, defaultFound; - - expectKeyword('switch'); - - expect('('); - - discriminant = parseExpression(); - - expect(')'); - - expect('{'); - - cases = []; - - if (match('}')) { - lex(); - return node.finishSwitchStatement(discriminant, cases); - } - - oldInSwitch = state.inSwitch; - state.inSwitch = true; - defaultFound = false; - - while (startIndex < length) { - if (match('}')) { - break; - } - clause = parseSwitchCase(); - if (clause.test === null) { - if (defaultFound) { - throwError(Messages.MultipleDefaultsInSwitch); - } - defaultFound = true; - } - cases.push(clause); - } - - state.inSwitch = oldInSwitch; - - expect('}'); - - return node.finishSwitchStatement(discriminant, cases); - } - - // ECMA-262 13.14 The throw statement - - function parseThrowStatement(node) { - var argument; - - expectKeyword('throw'); - - if (hasLineTerminator) { - throwError(Messages.NewlineAfterThrow); - } - - argument = parseExpression(); - - consumeSemicolon(); - - return node.finishThrowStatement(argument); - } - - // ECMA-262 13.15 The try statement - - function parseCatchClause() { - var param, params = [], paramMap = {}, key, i, body, node = new Node(); - - expectKeyword('catch'); - - expect('('); - if (match(')')) { - throwUnexpectedToken(lookahead); - } - - param = parsePattern(params); - for (i = 0; i < params.length; i++) { - key = '$' + params[i].value; - if (Object.prototype.hasOwnProperty.call(paramMap, key)) { - tolerateError(Messages.DuplicateBinding, params[i].value); - } - paramMap[key] = true; - } - - // ECMA-262 12.14.1 - if (strict && isRestrictedWord(param.name)) { - tolerateError(Messages.StrictCatchVariable); - } - - expect(')'); - body = parseBlock(); - return node.finishCatchClause(param, body); - } - - function parseTryStatement(node) { - var block, handler = null, finalizer = null; - - expectKeyword('try'); - - block = parseBlock(); - - if (matchKeyword('catch')) { - handler = parseCatchClause(); - } - - if (matchKeyword('finally')) { - lex(); - finalizer = parseBlock(); - } - - if (!handler && !finalizer) { - throwError(Messages.NoCatchOrFinally); - } - - return node.finishTryStatement(block, handler, finalizer); - } - - // ECMA-262 13.16 The debugger statement - - function parseDebuggerStatement(node) { - expectKeyword('debugger'); - - consumeSemicolon(); - - return node.finishDebuggerStatement(); - } - - // 13 Statements - - function parseStatement() { - var type = lookahead.type, - expr, - labeledBody, - key, - node; - - if (type === Token.EOF) { - throwUnexpectedToken(lookahead); - } - - if (type === Token.Punctuator && lookahead.value === '{') { - return parseBlock(); - } - isAssignmentTarget = isBindingElement = true; - node = new Node(); - - if (type === Token.Punctuator) { - switch (lookahead.value) { - case ';': - return parseEmptyStatement(node); - case '(': - return parseExpressionStatement(node); - default: - break; - } - } else if (type === Token.Keyword) { - switch (lookahead.value) { - case 'break': - return parseBreakStatement(node); - case 'continue': - return parseContinueStatement(node); - case 'debugger': - return parseDebuggerStatement(node); - case 'do': - return parseDoWhileStatement(node); - case 'for': - return parseForStatement(node); - case 'function': - return parseFunctionDeclaration(node); - case 'if': - return parseIfStatement(node); - case 'return': - return parseReturnStatement(node); - case 'switch': - return parseSwitchStatement(node); - case 'throw': - return parseThrowStatement(node); - case 'try': - return parseTryStatement(node); - case 'var': - return parseVariableStatement(node); - case 'while': - return parseWhileStatement(node); - case 'with': - return parseWithStatement(node); - default: - break; - } - } - - expr = parseExpression(); - - // ECMA-262 12.12 Labelled Statements - if ((expr.type === Syntax.Identifier) && match(':')) { - lex(); - - key = '$' + expr.name; - if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) { - throwError(Messages.Redeclaration, 'Label', expr.name); - } - - state.labelSet[key] = true; - labeledBody = parseStatement(); - delete state.labelSet[key]; - return node.finishLabeledStatement(expr, labeledBody); - } - - consumeSemicolon(); - - return node.finishExpressionStatement(expr); - } - - // ECMA-262 14.1 Function Definition - - function parseFunctionSourceElements() { - var statement, body = [], token, directive, firstRestricted, - oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, - node = new Node(); - - expect('{'); - - while (startIndex < length) { - if (lookahead.type !== Token.StringLiteral) { - break; - } - token = lookahead; - - statement = parseStatementListItem(); - body.push(statement); - if (statement.expression.type !== Syntax.Literal) { - // this is not directive - break; - } - directive = source.slice(token.start + 1, token.end - 1); - if (directive === 'use strict') { - strict = true; - if (firstRestricted) { - tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral); - } - } else { - if (!firstRestricted && token.octal) { - firstRestricted = token; - } - } - } - - oldLabelSet = state.labelSet; - oldInIteration = state.inIteration; - oldInSwitch = state.inSwitch; - oldInFunctionBody = state.inFunctionBody; - - state.labelSet = {}; - state.inIteration = false; - state.inSwitch = false; - state.inFunctionBody = true; - - while (startIndex < length) { - if (match('}')) { - break; - } - body.push(parseStatementListItem()); - } - - expect('}'); - - state.labelSet = oldLabelSet; - state.inIteration = oldInIteration; - state.inSwitch = oldInSwitch; - state.inFunctionBody = oldInFunctionBody; - - return node.finishBlockStatement(body); - } - - function validateParam(options, param, name) { - var key = '$' + name; - if (strict) { - if (isRestrictedWord(name)) { - options.stricted = param; - options.message = Messages.StrictParamName; - } - if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { - options.stricted = param; - options.message = Messages.StrictParamDupe; - } - } else if (!options.firstRestricted) { - if (isRestrictedWord(name)) { - options.firstRestricted = param; - options.message = Messages.StrictParamName; - } else if (isStrictModeReservedWord(name)) { - options.firstRestricted = param; - options.message = Messages.StrictReservedWord; - } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { - options.stricted = param; - options.message = Messages.StrictParamDupe; - } - } - options.paramSet[key] = true; - } - - function parseParam(options) { - var token, param, params = [], i, def; - - token = lookahead; - if (token.value === '...') { - param = parseRestElement(params); - validateParam(options, param.argument, param.argument.name); - options.params.push(param); - options.defaults.push(null); - return false; - } - - param = parsePatternWithDefault(params); - for (i = 0; i < params.length; i++) { - validateParam(options, params[i], params[i].value); - } - - if (param.type === Syntax.AssignmentPattern) { - def = param.right; - param = param.left; - ++options.defaultCount; - } - - options.params.push(param); - options.defaults.push(def); - - return !match(')'); - } - - function parseParams(firstRestricted) { - var options; - - options = { - params: [], - defaultCount: 0, - defaults: [], - firstRestricted: firstRestricted - }; - - expect('('); - - if (!match(')')) { - options.paramSet = {}; - while (startIndex < length) { - if (!parseParam(options)) { - break; - } - expect(','); - } - } - - expect(')'); - - if (options.defaultCount === 0) { - options.defaults = []; - } - - return { - params: options.params, - defaults: options.defaults, - stricted: options.stricted, - firstRestricted: options.firstRestricted, - message: options.message - }; - } - - function parseFunctionDeclaration(node, identifierIsOptional) { - var id = null, params = [], defaults = [], body, token, stricted, tmp, firstRestricted, message, previousStrict, - isGenerator, previousAllowYield; - - previousAllowYield = state.allowYield; - - expectKeyword('function'); - - isGenerator = match('*'); - if (isGenerator) { - lex(); - } - - if (!identifierIsOptional || !match('(')) { - token = lookahead; - id = parseVariableIdentifier(); - if (strict) { - if (isRestrictedWord(token.value)) { - tolerateUnexpectedToken(token, Messages.StrictFunctionName); - } - } else { - if (isRestrictedWord(token.value)) { - firstRestricted = token; - message = Messages.StrictFunctionName; - } else if (isStrictModeReservedWord(token.value)) { - firstRestricted = token; - message = Messages.StrictReservedWord; - } - } - } - - state.allowYield = !isGenerator; - tmp = parseParams(firstRestricted); - params = tmp.params; - defaults = tmp.defaults; - stricted = tmp.stricted; - firstRestricted = tmp.firstRestricted; - if (tmp.message) { - message = tmp.message; - } - - - previousStrict = strict; - body = parseFunctionSourceElements(); - if (strict && firstRestricted) { - throwUnexpectedToken(firstRestricted, message); - } - if (strict && stricted) { - tolerateUnexpectedToken(stricted, message); - } - - strict = previousStrict; - state.allowYield = previousAllowYield; - - return node.finishFunctionDeclaration(id, params, defaults, body, isGenerator); - } - - function parseFunctionExpression() { - var token, id = null, stricted, firstRestricted, message, tmp, - params = [], defaults = [], body, previousStrict, node = new Node(), - isGenerator, previousAllowYield; - - previousAllowYield = state.allowYield; - - expectKeyword('function'); - - isGenerator = match('*'); - if (isGenerator) { - lex(); - } - - state.allowYield = !isGenerator; - if (!match('(')) { - token = lookahead; - id = (!strict && !isGenerator && matchKeyword('yield')) ? parseNonComputedProperty() : parseVariableIdentifier(); - if (strict) { - if (isRestrictedWord(token.value)) { - tolerateUnexpectedToken(token, Messages.StrictFunctionName); - } - } else { - if (isRestrictedWord(token.value)) { - firstRestricted = token; - message = Messages.StrictFunctionName; - } else if (isStrictModeReservedWord(token.value)) { - firstRestricted = token; - message = Messages.StrictReservedWord; - } - } - } - - tmp = parseParams(firstRestricted); - params = tmp.params; - defaults = tmp.defaults; - stricted = tmp.stricted; - firstRestricted = tmp.firstRestricted; - if (tmp.message) { - message = tmp.message; - } - - previousStrict = strict; - body = parseFunctionSourceElements(); - if (strict && firstRestricted) { - throwUnexpectedToken(firstRestricted, message); - } - if (strict && stricted) { - tolerateUnexpectedToken(stricted, message); - } - strict = previousStrict; - state.allowYield = previousAllowYield; - - return node.finishFunctionExpression(id, params, defaults, body, isGenerator); - } - - // ECMA-262 14.5 Class Definitions - - function parseClassBody() { - var classBody, token, isStatic, hasConstructor = false, body, method, computed, key; - - classBody = new Node(); - - expect('{'); - body = []; - while (!match('}')) { - if (match(';')) { - lex(); - } else { - method = new Node(); - token = lookahead; - isStatic = false; - computed = match('['); - if (match('*')) { - lex(); - } else { - key = parseObjectPropertyKey(); - if (key.name === 'static' && (lookaheadPropertyName() || match('*'))) { - token = lookahead; - isStatic = true; - computed = match('['); - if (match('*')) { - lex(); - } else { - key = parseObjectPropertyKey(); - } - } - } - method = tryParseMethodDefinition(token, key, computed, method); - if (method) { - method['static'] = isStatic; // jscs:ignore requireDotNotation - if (method.kind === 'init') { - method.kind = 'method'; - } - if (!isStatic) { - if (!method.computed && (method.key.name || method.key.value.toString()) === 'constructor') { - if (method.kind !== 'method' || !method.method || method.value.generator) { - throwUnexpectedToken(token, Messages.ConstructorSpecialMethod); - } - if (hasConstructor) { - throwUnexpectedToken(token, Messages.DuplicateConstructor); - } else { - hasConstructor = true; - } - method.kind = 'constructor'; - } - } else { - if (!method.computed && (method.key.name || method.key.value.toString()) === 'prototype') { - throwUnexpectedToken(token, Messages.StaticPrototype); - } - } - method.type = Syntax.MethodDefinition; - delete method.method; - delete method.shorthand; - body.push(method); - } else { - throwUnexpectedToken(lookahead); - } - } - } - lex(); - return classBody.finishClassBody(body); - } - - function parseClassDeclaration(identifierIsOptional) { - var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict; - strict = true; - - expectKeyword('class'); - - if (!identifierIsOptional || lookahead.type === Token.Identifier) { - id = parseVariableIdentifier(); - } - - if (matchKeyword('extends')) { - lex(); - superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall); - } - classBody = parseClassBody(); - strict = previousStrict; - - return classNode.finishClassDeclaration(id, superClass, classBody); - } - - function parseClassExpression() { - var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict; - strict = true; - - expectKeyword('class'); - - if (lookahead.type === Token.Identifier) { - id = parseVariableIdentifier(); - } - - if (matchKeyword('extends')) { - lex(); - superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall); - } - classBody = parseClassBody(); - strict = previousStrict; - - return classNode.finishClassExpression(id, superClass, classBody); - } - - // ECMA-262 15.2 Modules - - function parseModuleSpecifier() { - var node = new Node(); - - if (lookahead.type !== Token.StringLiteral) { - throwError(Messages.InvalidModuleSpecifier); - } - return node.finishLiteral(lex()); - } - - // ECMA-262 15.2.3 Exports - - function parseExportSpecifier() { - var exported, local, node = new Node(), def; - if (matchKeyword('default')) { - // export {default} from 'something'; - def = new Node(); - lex(); - local = def.finishIdentifier('default'); - } else { - local = parseVariableIdentifier(); - } - if (matchContextualKeyword('as')) { - lex(); - exported = parseNonComputedProperty(); - } - return node.finishExportSpecifier(local, exported); - } - - function parseExportNamedDeclaration(node) { - var declaration = null, - isExportFromIdentifier, - src = null, specifiers = []; - - // non-default export - if (lookahead.type === Token.Keyword) { - // covers: - // export var f = 1; - switch (lookahead.value) { - case 'let': - case 'const': - declaration = parseLexicalDeclaration({inFor: false}); - return node.finishExportNamedDeclaration(declaration, specifiers, null); - case 'var': - case 'class': - case 'function': - declaration = parseStatementListItem(); - return node.finishExportNamedDeclaration(declaration, specifiers, null); - } - } - - expect('{'); - while (!match('}')) { - isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default'); - specifiers.push(parseExportSpecifier()); - if (!match('}')) { - expect(','); - if (match('}')) { - break; - } - } - } - expect('}'); - - if (matchContextualKeyword('from')) { - // covering: - // export {default} from 'foo'; - // export {foo} from 'foo'; - lex(); - src = parseModuleSpecifier(); - consumeSemicolon(); - } else if (isExportFromIdentifier) { - // covering: - // export {default}; // missing fromClause - throwError(lookahead.value ? - Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); - } else { - // cover - // export {foo}; - consumeSemicolon(); - } - return node.finishExportNamedDeclaration(declaration, specifiers, src); - } - - function parseExportDefaultDeclaration(node) { - var declaration = null, - expression = null; - - // covers: - // export default ... - expectKeyword('default'); - - if (matchKeyword('function')) { - // covers: - // export default function foo () {} - // export default function () {} - declaration = parseFunctionDeclaration(new Node(), true); - return node.finishExportDefaultDeclaration(declaration); - } - if (matchKeyword('class')) { - declaration = parseClassDeclaration(true); - return node.finishExportDefaultDeclaration(declaration); - } - - if (matchContextualKeyword('from')) { - throwError(Messages.UnexpectedToken, lookahead.value); - } - - // covers: - // export default {}; - // export default []; - // export default (1 + 2); - if (match('{')) { - expression = parseObjectInitializer(); - } else if (match('[')) { - expression = parseArrayInitializer(); - } else { - expression = parseAssignmentExpression(); - } - consumeSemicolon(); - return node.finishExportDefaultDeclaration(expression); - } - - function parseExportAllDeclaration(node) { - var src; - - // covers: - // export * from 'foo'; - expect('*'); - if (!matchContextualKeyword('from')) { - throwError(lookahead.value ? - Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); - } - lex(); - src = parseModuleSpecifier(); - consumeSemicolon(); - - return node.finishExportAllDeclaration(src); - } - - function parseExportDeclaration() { - var node = new Node(); - if (state.inFunctionBody) { - throwError(Messages.IllegalExportDeclaration); - } - - expectKeyword('export'); - - if (matchKeyword('default')) { - return parseExportDefaultDeclaration(node); - } - if (match('*')) { - return parseExportAllDeclaration(node); - } - return parseExportNamedDeclaration(node); - } - - // ECMA-262 15.2.2 Imports - - function parseImportSpecifier() { - // import {} ...; - var local, imported, node = new Node(); - - imported = parseNonComputedProperty(); - if (matchContextualKeyword('as')) { - lex(); - local = parseVariableIdentifier(); - } - - return node.finishImportSpecifier(local, imported); - } - - function parseNamedImports() { - var specifiers = []; - // {foo, bar as bas} - expect('{'); - while (!match('}')) { - specifiers.push(parseImportSpecifier()); - if (!match('}')) { - expect(','); - if (match('}')) { - break; - } - } - } - expect('}'); - return specifiers; - } - - function parseImportDefaultSpecifier() { - // import ...; - var local, node = new Node(); - - local = parseNonComputedProperty(); - - return node.finishImportDefaultSpecifier(local); - } - - function parseImportNamespaceSpecifier() { - // import <* as foo> ...; - var local, node = new Node(); - - expect('*'); - if (!matchContextualKeyword('as')) { - throwError(Messages.NoAsAfterImportNamespace); - } - lex(); - local = parseNonComputedProperty(); - - return node.finishImportNamespaceSpecifier(local); - } - - function parseImportDeclaration() { - var specifiers = [], src, node = new Node(); - - if (state.inFunctionBody) { - throwError(Messages.IllegalImportDeclaration); - } - - expectKeyword('import'); - - if (lookahead.type === Token.StringLiteral) { - // import 'foo'; - src = parseModuleSpecifier(); - } else { - - if (match('{')) { - // import {bar} - specifiers = specifiers.concat(parseNamedImports()); - } else if (match('*')) { - // import * as foo - specifiers.push(parseImportNamespaceSpecifier()); - } else if (isIdentifierName(lookahead) && !matchKeyword('default')) { - // import foo - specifiers.push(parseImportDefaultSpecifier()); - if (match(',')) { - lex(); - if (match('*')) { - // import foo, * as foo - specifiers.push(parseImportNamespaceSpecifier()); - } else if (match('{')) { - // import foo, {bar} - specifiers = specifiers.concat(parseNamedImports()); - } else { - throwUnexpectedToken(lookahead); - } - } - } else { - throwUnexpectedToken(lex()); - } - - if (!matchContextualKeyword('from')) { - throwError(lookahead.value ? - Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); - } - lex(); - src = parseModuleSpecifier(); - } - - consumeSemicolon(); - return node.finishImportDeclaration(specifiers, src); - } - - // ECMA-262 15.1 Scripts - - function parseScriptBody() { - var statement, body = [], token, directive, firstRestricted; - - while (startIndex < length) { - token = lookahead; - if (token.type !== Token.StringLiteral) { - break; - } - - statement = parseStatementListItem(); - body.push(statement); - if (statement.expression.type !== Syntax.Literal) { - // this is not directive - break; - } - directive = source.slice(token.start + 1, token.end - 1); - if (directive === 'use strict') { - strict = true; - if (firstRestricted) { - tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral); - } - } else { - if (!firstRestricted && token.octal) { - firstRestricted = token; - } - } - } - - while (startIndex < length) { - statement = parseStatementListItem(); - /* istanbul ignore if */ - if (typeof statement === 'undefined') { - break; - } - body.push(statement); - } - return body; - } - - function parseProgram() { - var body, node; - - peek(); - node = new Node(); - - body = parseScriptBody(); - return node.finishProgram(body, state.sourceType); - } - - function filterTokenLocation() { - var i, entry, token, tokens = []; - - for (i = 0; i < extra.tokens.length; ++i) { - entry = extra.tokens[i]; - token = { - type: entry.type, - value: entry.value - }; - if (entry.regex) { - token.regex = { - pattern: entry.regex.pattern, - flags: entry.regex.flags - }; - } - if (extra.range) { - token.range = entry.range; - } - if (extra.loc) { - token.loc = entry.loc; - } - tokens.push(token); - } - - extra.tokens = tokens; - } - - function tokenize(code, options, delegate) { - var toString, - tokens; - - toString = String; - if (typeof code !== 'string' && !(code instanceof String)) { - code = toString(code); - } - - source = code; - index = 0; - lineNumber = (source.length > 0) ? 1 : 0; - lineStart = 0; - startIndex = index; - startLineNumber = lineNumber; - startLineStart = lineStart; - length = source.length; - lookahead = null; - state = { - allowIn: true, - allowYield: true, - labelSet: {}, - inFunctionBody: false, - inIteration: false, - inSwitch: false, - lastCommentStart: -1, - curlyStack: [] - }; - - extra = {}; - - // Options matching. - options = options || {}; - - // Of course we collect tokens here. - options.tokens = true; - extra.tokens = []; - extra.tokenValues = []; - extra.tokenize = true; - extra.delegate = delegate; - - // The following two fields are necessary to compute the Regex tokens. - extra.openParenToken = -1; - extra.openCurlyToken = -1; - - extra.range = (typeof options.range === 'boolean') && options.range; - extra.loc = (typeof options.loc === 'boolean') && options.loc; - - if (typeof options.comment === 'boolean' && options.comment) { - extra.comments = []; - } - if (typeof options.tolerant === 'boolean' && options.tolerant) { - extra.errors = []; - } - - try { - peek(); - if (lookahead.type === Token.EOF) { - return extra.tokens; - } - - lex(); - while (lookahead.type !== Token.EOF) { - try { - lex(); - } catch (lexError) { - if (extra.errors) { - recordError(lexError); - // We have to break on the first error - // to avoid infinite loops. - break; - } else { - throw lexError; - } - } - } - - tokens = extra.tokens; - if (typeof extra.errors !== 'undefined') { - tokens.errors = extra.errors; - } - } catch (e) { - throw e; - } finally { - extra = {}; - } - return tokens; - } - - function parse(code, options) { - var program, toString; - - toString = String; - if (typeof code !== 'string' && !(code instanceof String)) { - code = toString(code); - } - - source = code; - index = 0; - lineNumber = (source.length > 0) ? 1 : 0; - lineStart = 0; - startIndex = index; - startLineNumber = lineNumber; - startLineStart = lineStart; - length = source.length; - lookahead = null; - state = { - allowIn: true, - allowYield: true, - labelSet: {}, - inFunctionBody: false, - inIteration: false, - inSwitch: false, - lastCommentStart: -1, - curlyStack: [], - sourceType: 'script' - }; - strict = false; - - extra = {}; - if (typeof options !== 'undefined') { - extra.range = (typeof options.range === 'boolean') && options.range; - extra.loc = (typeof options.loc === 'boolean') && options.loc; - extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment; - - if (extra.loc && options.source !== null && options.source !== undefined) { - extra.source = toString(options.source); - } - - if (typeof options.tokens === 'boolean' && options.tokens) { - extra.tokens = []; - } - if (typeof options.comment === 'boolean' && options.comment) { - extra.comments = []; - } - if (typeof options.tolerant === 'boolean' && options.tolerant) { - extra.errors = []; - } - if (extra.attachComment) { - extra.range = true; - extra.comments = []; - extra.bottomRightStack = []; - extra.trailingComments = []; - extra.leadingComments = []; - } - if (options.sourceType === 'module') { - // very restrictive condition for now - state.sourceType = options.sourceType; - strict = true; - } - } - - try { - program = parseProgram(); - if (typeof extra.comments !== 'undefined') { - program.comments = extra.comments; - } - if (typeof extra.tokens !== 'undefined') { - filterTokenLocation(); - program.tokens = extra.tokens; - } - if (typeof extra.errors !== 'undefined') { - program.errors = extra.errors; - } - } catch (e) { - throw e; - } finally { - extra = {}; - } - - return program; - } - - // Sync with *.json manifests. - exports.version = '2.7.2'; - - exports.tokenize = tokenize; - - exports.parse = parse; - - // Deep copy. - /* istanbul ignore next */ - exports.Syntax = (function () { - var name, types = {}; - - if (typeof Object.create === 'function') { - types = Object.create(null); - } - - for (name in Syntax) { - if (Syntax.hasOwnProperty(name)) { - types[name] = Syntax[name]; - } - } - - if (typeof Object.freeze === 'function') { - Object.freeze(types); - } - - return types; - }()); - -})); -/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/esprima/package.json b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/esprima/package.json deleted file mode 100644 index 58bb445e18..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/esprima/package.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "_args": [ - [ - "esprima@~2.7.1", - "/Users/rebecca/code/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast" - ] - ], - "_from": "esprima@>=2.7.1 <2.8.0", - "_id": "esprima@2.7.2", - "_inCache": true, - "_installable": true, - "_location": "/readable-stream/unreachable-branch-transform/recast/esprima", - "_nodeVersion": "4.2.2", - "_npmOperationalInternal": { - "host": "packages-9-west.internal.npmjs.com", - "tmp": "tmp/esprima-2.7.2.tgz_1454477276067_0.014412595424801111" - }, - "_npmUser": { - "email": "ariya.hidayat@gmail.com", - "name": "ariya" - }, - "_npmVersion": "2.14.7", - "_phantomChildren": {}, - "_requested": { - "name": "esprima", - "raw": "esprima@~2.7.1", - "rawSpec": "~2.7.1", - "scope": null, - "spec": ">=2.7.1 <2.8.0", - "type": "range" - }, - "_requiredBy": [ - "/readable-stream/unreachable-branch-transform/recast" - ], - "_resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.2.tgz", - "_shasum": "f43be543609984eae44c933ac63352a6af35f339", - "_shrinkwrap": null, - "_spec": "esprima@~2.7.1", - "_where": "/Users/rebecca/code/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast", - "author": { - "email": "ariya.hidayat@gmail.com", - "name": "Ariya Hidayat" - }, - "bin": { - "esparse": "./bin/esparse.js", - "esvalidate": "./bin/esvalidate.js" - }, - "bugs": { - "url": "https://github.com/jquery/esprima/issues" - }, - "dependencies": {}, - "description": "ECMAScript parsing infrastructure for multipurpose analysis", - "devDependencies": { - "codecov.io": "~0.1.6", - "escomplex-js": "1.2.0", - "eslint": "~1.7.2", - "everything.js": "~1.0.3", - "glob": "^5.0.15", - "istanbul": "~0.4.0", - "jscs": "~2.3.5", - "json-diff": "~0.3.1", - "karma": "^0.13.11", - "karma-chrome-launcher": "^0.2.1", - "karma-detect-browsers": "^2.0.2", - "karma-firefox-launcher": "^0.1.6", - "karma-ie-launcher": "^0.2.0", - "karma-mocha": "^0.2.0", - "karma-safari-launcher": "^0.1.1", - "karma-sauce-launcher": "^0.2.14", - "lodash": "^3.10.0", - "mocha": "^2.3.3", - "node-tick-processor": "~0.0.2", - "regenerate": "~1.2.1", - "temp": "~0.8.3", - "unicode-7.0.0": "~0.1.5" - }, - "directories": {}, - "dist": { - "shasum": "f43be543609984eae44c933ac63352a6af35f339", - "tarball": "http://registry.npmjs.org/esprima/-/esprima-2.7.2.tgz" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "bin", - "unit-tests.js", - "esprima.js" - ], - "gitHead": "eb05a03b18b8433ab1ebeabea635a949219cd75e", - "homepage": "http://esprima.org", - "keywords": [ - "ast", - "ecmascript", - "javascript", - "parser", - "syntax" - ], - "license": "BSD-2-Clause", - "main": "esprima.js", - "maintainers": [ - { - "email": "ariya.hidayat@gmail.com", - "name": "ariya" - } - ], - "name": "esprima", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/jquery/esprima.git" - }, - "scripts": { - "all-tests": "npm run generate-fixtures && npm run unit-tests && npm run grammar-tests && npm run regression-tests", - "analyze-coverage": "istanbul cover test/unit-tests.js", - "appveyor": "npm run all-tests && npm run browser-tests && npm run dynamic-analysis", - "benchmark": "node test/benchmarks.js", - "benchmark-quick": "node test/benchmarks.js quick", - "browser-tests": "npm run generate-fixtures && cd test && karma start --single-run", - "check-coverage": "istanbul check-coverage --statement 100 --branch 100 --function 100", - "check-version": "node test/check-version.js", - "circleci": "npm test && npm run codecov && npm run downstream", - "codecov": "istanbul report cobertura && codecov < ./coverage/cobertura-coverage.xml", - "complexity": "node test/check-complexity.js", - "downstream": "node test/downstream.js", - "droneio": "npm test && npm run saucelabs-evergreen && npm run saucelabs-ie && npm run saucelabs-safari", - "dynamic-analysis": "npm run analyze-coverage && npm run check-coverage", - "eslint": "node node_modules/eslint/bin/eslint.js -c .lintrc esprima.js", - "generate-fixtures": "node tools/generate-fixtures.js", - "generate-regex": "node tools/generate-identifier-regex.js", - "grammar-tests": "node test/grammar-tests.js", - "jscs": "jscs -p crockford esprima.js && jscs -p crockford test/*.js", - "profile": "node --prof test/profile.js && mv isolate*.log v8.log && node-tick-processor", - "regression-tests": "node test/regression-tests.js", - "saucelabs-evergreen": "cd test && karma start saucelabs-evergreen.conf.js", - "saucelabs-ie": "cd test && karma start saucelabs-ie.conf.js", - "saucelabs-safari": "cd test && karma start saucelabs-safari.conf.js", - "static-analysis": "npm run check-version && npm run jscs && npm run eslint && npm run complexity", - "test": "npm run all-tests && npm run static-analysis && npm run dynamic-analysis", - "travis": "npm test", - "unit-tests": "node test/unit-tests.js" - }, - "version": "2.7.2" -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/.travis.yml b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/.travis.yml deleted file mode 100644 index ed05f88d50..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - "0.11" - - "0.10" - - "0.8" - - "0.6" diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/LICENSE b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/LICENSE deleted file mode 100644 index 6c2f144b1c..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2014 Ben Newman - -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/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/README.md b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/README.md deleted file mode 100644 index a8990aa6e2..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/README.md +++ /dev/null @@ -1,246 +0,0 @@ -private [![Build Status](https://travis-ci.org/benjamn/private.png?branch=master)](https://travis-ci.org/benjamn/private) -=== - -A general-purpose utility for associating truly private state with any JavaScript object. - -Installation ---- - -From NPM: - - npm install private - -From GitHub: - - cd path/to/node_modules - git clone git://github.com/benjamn/private.git - cd private - npm install . - -Usage ---- -**Get or create a secret object associated with any (non-frozen) object:** -```js -var getSecret = require("private").makeAccessor(); -var obj = Object.create(null); // any kind of object works -getSecret(obj).totallySafeProperty = "p455w0rd"; - -console.log(Object.keys(obj)); // [] -console.log(Object.getOwnPropertyNames(obj)); // [] -console.log(getSecret(obj)); // { totallySafeProperty: "p455w0rd" } -``` -Now, only code that has a reference to both `getSecret` and `obj` can possibly access `.totallySafeProperty`. - -*Importantly, no global references to the secret object are retained by the `private` package, so as soon as `obj` gets garbage collected, the secret will be reclaimed as well. In other words, you don't have to worry about memory leaks.* - -**Create a unique property name that cannot be enumerated or guessed:** -```js -var secretKey = require("private").makeUniqueKey(); -var obj = Object.create(null); // any kind of object works - -Object.defineProperty(obj, secretKey, { - value: { totallySafeProperty: "p455w0rd" }, - enumerable: false // optional; non-enumerability is the default -}); - -Object.defineProperty(obj, "nonEnumerableProperty", { - value: "anyone can guess my name", - enumerable: false -}); - -console.log(obj[secretKey].totallySafeProperty); // p455w0rd -console.log(obj.nonEnumerableProperty); // "anyone can guess my name" -console.log(Object.keys(obj)); // [] -console.log(Object.getOwnPropertyNames(obj)); // ["nonEnumerableProperty"] - -for (var key in obj) { - console.log(key); // never called -} -``` -Because these keys are non-enumerable, you can't discover them using a `for`-`in` loop. Because `secretKey` is a long string of random characters, you would have a lot of trouble guessing it. And because the `private` module wraps `Object.getOwnPropertyNames` to exclude the keys it generates, you can't even use that interface to discover it. - -Unless you have access to the value of the `secretKey` property name, there is no way to access the value associated with it. So your only responsibility as secret-keeper is to avoid handing out the value of `secretKey` to untrusted code. - -Think of this style as a home-grown version of the first style. Note, however, that it requires a full implementation of ES5's `Object.defineProperty` method in order to make any safety guarantees, whereas the first example will provide safety even in environments that do not support `Object.defineProperty`. - -Rationale ---- - -In JavaScript, the only data that are truly private are local variables -whose values do not *leak* from the scope in which they were defined. - -This notion of *closure privacy* is powerful, and it readily provides some -of the benefits of traditional data privacy, a la Java or C++: -```js -function MyClass(secret) { - this.increment = function() { - return ++secret; - }; -} - -var mc = new MyClass(3); -console.log(mc.increment()); // 4 -``` -You can learn something about `secret` by calling `.increment()`, and you -can increase its value by one as many times as you like, but you can never -decrease its value, because it is completely inaccessible except through -the `.increment` method. And if the `.increment` method were not -available, it would be as if no `secret` variable had ever been declared, -as far as you could tell. - -This style breaks down as soon as you want to inherit methods from the -prototype of a class: -```js -function MyClass(secret) { - this.secret = secret; -} - -MyClass.prototype.increment = function() { - return ++this.secret; -}; -``` -The only way to communicate between the `MyClass` constructor and the -`.increment` method in this example is to manipulate shared properties of -`this`. Unfortunately `this.secret` is now exposed to unlicensed -modification: -```js -var mc = new MyClass(6); -console.log(mc.increment()); // 7 -mc.secret -= Infinity; -console.log(mc.increment()); // -Infinity -mc.secret = "Go home JavaScript, you're drunk."; -mc.increment(); // NaN -``` -Another problem with closure privacy is that it only lends itself to -per-instance privacy, whereas the `private` keyword in most -object-oriented languages indicates that the data member in question is -visible to all instances of the same class. - -Suppose you have a `Node` class with a notion of parents and children: -```js -function Node() { - var parent; - var children = []; - - this.getParent = function() { - return parent; - }; - - this.appendChild = function(child) { - children.push(child); - child.parent = this; // Can this be made to work? - }; -} -``` -The desire here is to allow other `Node` objects to manipulate the value -returned by `.getParent()`, but otherwise disallow any modification of the -`parent` variable. You could expose a `.setParent` function, but then -anyone could call it, and you might as well give up on the getter/setter -pattern. - -This module solves both of these problems. - -Usage ---- - -Let's revisit the `Node` example from above: -```js -var p = require("private").makeAccessor(); - -function Node() { - var privates = p(this); - var children = []; - - this.getParent = function() { - return privates.parent; - }; - - this.appendChild = function(child) { - children.push(child); - var cp = p(child); - if (cp.parent) - cp.parent.removeChild(child); - cp.parent = this; - return child; - }; -} -``` -Now, in order to access the private data of a `Node` object, you need to -have access to the unique `p` function that is being used here. This is -already an improvement over the previous example, because it allows -restricted access by other `Node` instances, but can it help with the -`Node.prototype` problem too? - -Yes it can! -```js -var p = require("private").makeAccessor(); - -function Node() { - p(this).children = []; -} - -var Np = Node.prototype; - -Np.getParent = function() { - return p(this).parent; -}; - -Np.appendChild = function(child) { - p(this).children.push(child); - var cp = p(child); - if (cp.parent) - cp.parent.removeChild(child); - cp.parent = this; - return child; -}; -``` -Because `p` is in scope not only within the `Node` constructor but also -within `Node` methods, we can finally avoid redefining methods every time -the `Node` constructor is called. - -Now, you might be wondering how you can restrict access to `p` so that no -untrusted code is able to call it. The answer is to use your favorite -module pattern, be it CommonJS, AMD `define`, or even the old -Immediately-Invoked Function Expression: -```js -var Node = (function() { - var p = require("private").makeAccessor(); - - function Node() { - p(this).children = []; - } - - var Np = Node.prototype; - - Np.getParent = function() { - return p(this).parent; - }; - - Np.appendChild = function(child) { - p(this).children.push(child); - var cp = p(child); - if (cp.parent) - cp.parent.removeChild(child); - cp.parent = this; - return child; - }; - - return Node; -}()); - -var parent = new Node; -var child = new Node; -parent.appendChild(child); -assert.strictEqual(child.getParent(), parent); -``` -Because this version of `p` never leaks from the enclosing function scope, -only `Node` objects have access to it. - -So, you see, the claim I made at the beginning of this README remains -true: - -> In JavaScript, the only data that are truly private are local variables -> whose values do not *leak* from the scope in which they were defined. - -It just so happens that closure privacy is sufficient to implement a -privacy model similar to that provided by other languages. diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/package.json b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/package.json deleted file mode 100644 index 3d787aa56a..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "_args": [ - [ - "private@~0.1.5", - "/Users/rebecca/code/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast" - ] - ], - "_from": "private@>=0.1.5 <0.2.0", - "_id": "private@0.1.6", - "_inCache": true, - "_installable": true, - "_location": "/readable-stream/unreachable-branch-transform/recast/private", - "_npmUser": { - "email": "bn@cs.stanford.edu", - "name": "benjamn" - }, - "_npmVersion": "1.4.14", - "_phantomChildren": {}, - "_requested": { - "name": "private", - "raw": "private@~0.1.5", - "rawSpec": "~0.1.5", - "scope": null, - "spec": ">=0.1.5 <0.2.0", - "type": "range" - }, - "_requiredBy": [ - "/readable-stream/unreachable-branch-transform/recast" - ], - "_resolved": "https://registry.npmjs.org/private/-/private-0.1.6.tgz", - "_shasum": "55c6a976d0f9bafb9924851350fe47b9b5fbb7c1", - "_shrinkwrap": null, - "_spec": "private@~0.1.5", - "_where": "/Users/rebecca/code/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast", - "author": { - "email": "bn@cs.stanford.edu", - "name": "Ben Newman" - }, - "bugs": { - "url": "https://github.com/benjamn/private/issues" - }, - "dependencies": {}, - "description": "Utility for associating truly private state with any JavaScript object", - "devDependencies": {}, - "directories": {}, - "dist": { - "shasum": "55c6a976d0f9bafb9924851350fe47b9b5fbb7c1", - "tarball": "http://registry.npmjs.org/private/-/private-0.1.6.tgz" - }, - "engines": { - "node": ">= 0.6" - }, - "gitHead": "8df9e34c8f66a5e634a1024dba3ea16704d5178d", - "homepage": "http://github.com/benjamn/private", - "keywords": [ - "private", - "access control", - "access modifiers", - "encapsulation", - "secret", - "state", - "privilege", - "scope", - "es5" - ], - "license": "MIT", - "main": "private.js", - "maintainers": [ - { - "email": "bn@cs.stanford.edu", - "name": "benjamn" - } - ], - "name": "private", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/benjamn/private.git" - }, - "scripts": { - "test": "node test/run.js" - }, - "version": "0.1.6" -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/private.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/private.js deleted file mode 100644 index 20bed57eeb..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/private.js +++ /dev/null @@ -1,129 +0,0 @@ -"use strict"; - -var originalObject = Object; -var originalDefProp = Object.defineProperty; -var originalCreate = Object.create; - -function defProp(obj, name, value) { - if (originalDefProp) try { - originalDefProp.call(originalObject, obj, name, { value: value }); - } catch (definePropertyIsBrokenInIE8) { - obj[name] = value; - } else { - obj[name] = value; - } -} - -// For functions that will be invoked using .call or .apply, we need to -// define those methods on the function objects themselves, rather than -// inheriting them from Function.prototype, so that a malicious or clumsy -// third party cannot interfere with the functionality of this module by -// redefining Function.prototype.call or .apply. -function makeSafeToCall(fun) { - if (fun) { - defProp(fun, "call", fun.call); - defProp(fun, "apply", fun.apply); - } - return fun; -} - -makeSafeToCall(originalDefProp); -makeSafeToCall(originalCreate); - -var hasOwn = makeSafeToCall(Object.prototype.hasOwnProperty); -var numToStr = makeSafeToCall(Number.prototype.toString); -var strSlice = makeSafeToCall(String.prototype.slice); - -var cloner = function(){}; -function create(prototype) { - if (originalCreate) { - return originalCreate.call(originalObject, prototype); - } - cloner.prototype = prototype || null; - return new cloner; -} - -var rand = Math.random; -var uniqueKeys = create(null); - -function makeUniqueKey() { - // Collisions are highly unlikely, but this module is in the business of - // making guarantees rather than safe bets. - do var uniqueKey = internString(strSlice.call(numToStr.call(rand(), 36), 2)); - while (hasOwn.call(uniqueKeys, uniqueKey)); - return uniqueKeys[uniqueKey] = uniqueKey; -} - -function internString(str) { - var obj = {}; - obj[str] = true; - return Object.keys(obj)[0]; -} - -// External users might find this function useful, but it is not necessary -// for the typical use of this module. -defProp(exports, "makeUniqueKey", makeUniqueKey); - -// Object.getOwnPropertyNames is the only way to enumerate non-enumerable -// properties, so if we wrap it to ignore our secret keys, there should be -// no way (except guessing) to access those properties. -var originalGetOPNs = Object.getOwnPropertyNames; -Object.getOwnPropertyNames = function getOwnPropertyNames(object) { - for (var names = originalGetOPNs(object), - src = 0, - dst = 0, - len = names.length; - src < len; - ++src) { - if (!hasOwn.call(uniqueKeys, names[src])) { - if (src > dst) { - names[dst] = names[src]; - } - ++dst; - } - } - names.length = dst; - return names; -}; - -function defaultCreatorFn(object) { - return create(null); -} - -function makeAccessor(secretCreatorFn) { - var brand = makeUniqueKey(); - var passkey = create(null); - - secretCreatorFn = secretCreatorFn || defaultCreatorFn; - - function register(object) { - var secret; // Created lazily. - - function vault(key, forget) { - // Only code that has access to the passkey can retrieve (or forget) - // the secret object. - if (key === passkey) { - return forget - ? secret = null - : secret || (secret = secretCreatorFn(object)); - } - } - - defProp(object, brand, vault); - } - - function accessor(object) { - if (!hasOwn.call(object, brand)) - register(object); - return object[brand](passkey); - } - - accessor.forget = function(object) { - if (hasOwn.call(object, brand)) - object[brand](passkey, true); - }; - - return accessor; -} - -defProp(exports, "makeAccessor", makeAccessor); diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/test/run.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/test/run.js deleted file mode 100644 index dc3c888f06..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/private/test/run.js +++ /dev/null @@ -1,68 +0,0 @@ -var assert = require("assert"); -var makeAccessor = require("../private").makeAccessor; -var acc1 = makeAccessor(); -var obj = {}; -var hasOwn = obj.hasOwnProperty; - -acc1(obj).foo = 42; -assert.deepEqual(obj, {}); -assert.deepEqual(acc1(obj), { foo: 42 }); -assert.deepEqual(acc1(acc1(obj)), {}); -assert.deepEqual(acc1(obj), { foo: 42 }); -assert.deepEqual(Object.keys(acc1(obj)), ["foo"]); -assert.strictEqual(Object.getOwnPropertyNames(acc1(obj)).length, 1); -assert.strictEqual(Object.getOwnPropertyNames(acc1(acc1(obj))).length, 0); -acc1(obj).bar = "baz"; -assert.deepEqual(acc1(obj), { foo: 42, bar: "baz" }); -delete acc1(obj).foo; -assert.deepEqual(acc1(obj), { bar: "baz" }); - -try { - acc1(42); - throw new Error("threw wrong error"); -} catch (err) { - assert.ok(err); -} - -var acc2 = makeAccessor(); -assert.notStrictEqual(acc1, acc2); -assert.notStrictEqual(acc1(obj), acc2(obj)); -assert.deepEqual(acc2(obj), {}); -assert.strictEqual(Object.getOwnPropertyNames(obj).length, 0); -assert.strictEqual(Object.keys(obj).length, 0); -acc2(obj).bar = "asdf"; -assert.deepEqual(acc2(obj), { bar: "asdf" }); - -acc2.forget(obj); -acc2(obj).bar = "asdf"; -var oldSecret = acc2(obj); -assert.strictEqual(oldSecret.bar, "asdf"); -acc2.forget(obj); -var newSecret = acc2(obj); -assert.notStrictEqual(oldSecret, newSecret); -assert.ok(hasOwn.call(oldSecret, "bar")); -assert.ok(!hasOwn.call(newSecret, "bar")); -newSecret.bar = "zxcv"; -assert.strictEqual(oldSecret.bar, "asdf"); -assert.strictEqual(acc2(obj).bar, "zxcv"); - -function creatorFn(object) { - return { self: object }; -} - -var acc3 = makeAccessor(creatorFn); - -acc3(obj).xxx = "yyy"; -assert.deepEqual(acc3(obj), { - self: obj, - xxx: "yyy" -}); - -acc3.forget(obj); -assert.deepEqual(acc3(obj), { - self: obj -}); - -var green = "\033[32m"; -var reset = "\033[0m"; -console.log(green + "ALL PASS" + reset); diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/README.md b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/README.md deleted file mode 100644 index 8922fe8b0e..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/README.md +++ /dev/null @@ -1,729 +0,0 @@ -# Source Map - -[![Build Status](https://travis-ci.org/mozilla/source-map.png?branch=master)](https://travis-ci.org/mozilla/source-map) - -[![NPM](https://nodei.co/npm/source-map.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/source-map) - -This is a library to generate and consume the source map format -[described here][format]. - -[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit - -## Use with Node - - $ npm install source-map - -## Use on the Web - - - --------------------------------------------------------------------------------- - - - - - -## Table of Contents - -- [Examples](#examples) - - [Consuming a source map](#consuming-a-source-map) - - [Generating a source map](#generating-a-source-map) - - [With SourceNode (high level API)](#with-sourcenode-high-level-api) - - [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api) -- [API](#api) - - [SourceMapConsumer](#sourcemapconsumer) - - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap) - - [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans) - - [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition) - - [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition) - - [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition) - - [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources) - - [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing) - - [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order) - - [SourceMapGenerator](#sourcemapgenerator) - - [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap) - - [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer) - - [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping) - - [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent) - - [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath) - - [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring) - - [SourceNode](#sourcenode) - - [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name) - - [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath) - - [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk) - - [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk) - - [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent) - - [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn) - - [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn) - - [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep) - - [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement) - - [SourceNode.prototype.toString()](#sourcenodeprototypetostring) - - [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap) - - - -## Examples - -### Consuming a source map - -```js -var rawSourceMap = { - version: 3, - file: 'min.js', - names: ['bar', 'baz', 'n'], - sources: ['one.js', 'two.js'], - sourceRoot: 'http://example.com/www/js/', - mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA' -}; - -var smc = new SourceMapConsumer(rawSourceMap); - -console.log(smc.sources); -// [ 'http://example.com/www/js/one.js', -// 'http://example.com/www/js/two.js' ] - -console.log(smc.originalPositionFor({ - line: 2, - column: 28 -})); -// { source: 'http://example.com/www/js/two.js', -// line: 2, -// column: 10, -// name: 'n' } - -console.log(smc.generatedPositionFor({ - source: 'http://example.com/www/js/two.js', - line: 2, - column: 10 -})); -// { line: 2, column: 28 } - -smc.eachMapping(function (m) { - // ... -}); -``` - -### Generating a source map - -In depth guide: -[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/) - -#### With SourceNode (high level API) - -```js -function compile(ast) { - switch (ast.type) { - case 'BinaryExpression': - return new SourceNode( - ast.location.line, - ast.location.column, - ast.location.source, - [compile(ast.left), " + ", compile(ast.right)] - ); - case 'Literal': - return new SourceNode( - ast.location.line, - ast.location.column, - ast.location.source, - String(ast.value) - ); - // ... - default: - throw new Error("Bad AST"); - } -} - -var ast = parse("40 + 2", "add.js"); -console.log(compile(ast).toStringWithSourceMap({ - file: 'add.js' -})); -// { code: '40 + 2', -// map: [object SourceMapGenerator] } -``` - -#### With SourceMapGenerator (low level API) - -```js -var map = new SourceMapGenerator({ - file: "source-mapped.js" -}); - -map.addMapping({ - generated: { - line: 10, - column: 35 - }, - source: "foo.js", - original: { - line: 33, - column: 2 - }, - name: "christopher" -}); - -console.log(map.toString()); -// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}' -``` - -## API - -Get a reference to the module: - -```js -// Node.js -var sourceMap = require('source-map'); - -// Browser builds -var sourceMap = window.sourceMap; - -// Inside Firefox -const sourceMap = require("devtools/toolkit/sourcemap/source-map.js"); -``` - -### SourceMapConsumer - -A SourceMapConsumer instance represents a parsed source map which we can query -for information about the original file positions by giving it a file position -in the generated source. - -#### new SourceMapConsumer(rawSourceMap) - -The only parameter is the raw source map (either as a string which can be -`JSON.parse`'d, or an object). According to the spec, source maps have the -following attributes: - -* `version`: Which version of the source map spec this map is following. - -* `sources`: An array of URLs to the original source files. - -* `names`: An array of identifiers which can be referenced by individual - mappings. - -* `sourceRoot`: Optional. The URL root from which all sources are relative. - -* `sourcesContent`: Optional. An array of contents of the original source files. - -* `mappings`: A string of base64 VLQs which contain the actual mappings. - -* `file`: Optional. The generated filename this source map is associated with. - -```js -var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData); -``` - -#### SourceMapConsumer.prototype.computeColumnSpans() - -Compute the last column for each generated mapping. The last column is -inclusive. - -```js -// Before: -consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1 }, -// { line: 2, -// column: 10 }, -// { line: 2, -// column: 20 } ] - -consumer.computeColumnSpans(); - -// After: -consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1, -// lastColumn: 9 }, -// { line: 2, -// column: 10, -// lastColumn: 19 }, -// { line: 2, -// column: 20, -// lastColumn: Infinity } ] - -``` - -#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition) - -Returns the original source, line, and column information for the generated -source's line and column positions provided. The only argument is an object with -the following properties: - -* `line`: The line number in the generated source. - -* `column`: The column number in the generated source. - -* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or - `SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest - element that is smaller than or greater than the one we are searching for, - respectively, if the exact element cannot be found. Defaults to - `SourceMapConsumer.GREATEST_LOWER_BOUND`. - -and an object is returned with the following properties: - -* `source`: The original source file, or null if this information is not - available. - -* `line`: The line number in the original source, or null if this information is - not available. - -* `column`: The column number in the original source, or null or null if this - information is not available. - -* `name`: The original identifier, or null if this information is not available. - -```js -consumer.originalPositionFor({ line: 2, column: 10 }) -// { source: 'foo.coffee', -// line: 2, -// column: 2, -// name: null } - -consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 }) -// { source: null, -// line: null, -// column: null, -// name: null } -``` - -#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition) - -Returns the generated line and column information for the original source, -line, and column positions provided. The only argument is an object with -the following properties: - -* `source`: The filename of the original source. - -* `line`: The line number in the original source. - -* `column`: The column number in the original source. - -and an object is returned with the following properties: - -* `line`: The line number in the generated source, or null. - -* `column`: The column number in the generated source, or null. - -```js -consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 }) -// { line: 1, -// column: 56 } -``` - -#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition) - -Returns all generated line and column information for the original source, line, -and column provided. If no column is provided, returns all mappings -corresponding to a either the line we are searching for or the next closest line -that has any mappings. Otherwise, returns all mappings corresponding to the -given line and either the column we are searching for or the next closest column -that has any offsets. - -The only argument is an object with the following properties: - -* `source`: The filename of the original source. - -* `line`: The line number in the original source. - -* `column`: Optional. The column number in the original source. - -and an array of objects is returned, each with the following properties: - -* `line`: The line number in the generated source, or null. - -* `column`: The column number in the generated source, or null. - -```js -consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1 }, -// { line: 2, -// column: 10 }, -// { line: 2, -// column: 20 } ] -``` - -#### SourceMapConsumer.prototype.hasContentsOfAllSources() - -Return true if we have the embedded source content for every source listed in -the source map, false otherwise. - -In other words, if this method returns `true`, then -`consumer.sourceContentFor(s)` will succeed for every source `s` in -`consumer.sources`. - -```js -// ... -if (consumer.hasContentsOfAllSources()) { - consumerReadyCallback(consumer); -} else { - fetchSources(consumer, consumerReadyCallback); -} -// ... -``` - -#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing]) - -Returns the original source content for the source provided. The only -argument is the URL of the original source file. - -If the source content for the given source is not found, then an error is -thrown. Optionally, pass `true` as the second param to have `null` returned -instead. - -```js -consumer.sources -// [ "my-cool-lib.clj" ] - -consumer.sourceContentFor("my-cool-lib.clj") -// "..." - -consumer.sourceContentFor("this is not in the source map"); -// Error: "this is not in the source map" is not in the source map - -consumer.sourceContentFor("this is not in the source map", true); -// null -``` - -#### SourceMapConsumer.prototype.eachMapping(callback, context, order) - -Iterate over each mapping between an original source/line/column and a -generated line/column in this source map. - -* `callback`: The function that is called with each mapping. Mappings have the - form `{ source, generatedLine, generatedColumn, originalLine, originalColumn, - name }` - -* `context`: Optional. If specified, this object will be the value of `this` - every time that `callback` is called. - -* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or - `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over - the mappings sorted by the generated file's line/column order or the - original's source/line/column order, respectively. Defaults to - `SourceMapConsumer.GENERATED_ORDER`. - -```js -consumer.eachMapping(function (m) { console.log(m); }) -// ... -// { source: 'illmatic.js', -// generatedLine: 1, -// generatedColumn: 0, -// originalLine: 1, -// originalColumn: 0, -// name: null } -// { source: 'illmatic.js', -// generatedLine: 2, -// generatedColumn: 0, -// originalLine: 2, -// originalColumn: 0, -// name: null } -// ... -``` -### SourceMapGenerator - -An instance of the SourceMapGenerator represents a source map which is being -built incrementally. - -#### new SourceMapGenerator([startOfSourceMap]) - -You may pass an object with the following properties: - -* `file`: The filename of the generated source that this source map is - associated with. - -* `sourceRoot`: A root for all relative URLs in this source map. - -* `skipValidation`: Optional. When `true`, disables validation of mappings as - they are added. This can improve performance but should be used with - discretion, as a last resort. Even then, one should avoid using this flag when - running tests, if possible. - -```js -var generator = new sourceMap.SourceMapGenerator({ - file: "my-generated-javascript-file.js", - sourceRoot: "http://example.com/app/js/" -}); -``` - -#### SourceMapGenerator.fromSourceMap(sourceMapConsumer) - -Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance. - -* `sourceMapConsumer` The SourceMap. - -```js -var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer); -``` - -#### SourceMapGenerator.prototype.addMapping(mapping) - -Add a single mapping from original source line and column to the generated -source's line and column for this source map being created. The mapping object -should have the following properties: - -* `generated`: An object with the generated line and column positions. - -* `original`: An object with the original line and column positions. - -* `source`: The original source file (relative to the sourceRoot). - -* `name`: An optional original token name for this mapping. - -```js -generator.addMapping({ - source: "module-one.scm", - original: { line: 128, column: 0 }, - generated: { line: 3, column: 456 } -}) -``` - -#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent) - -Set the source content for an original source file. - -* `sourceFile` the URL of the original source file. - -* `sourceContent` the content of the source file. - -```js -generator.setSourceContent("module-one.scm", - fs.readFileSync("path/to/module-one.scm")) -``` - -#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]]) - -Applies a SourceMap for a source file to the SourceMap. -Each mapping to the supplied source file is rewritten using the -supplied SourceMap. Note: The resolution for the resulting mappings -is the minimum of this map and the supplied map. - -* `sourceMapConsumer`: The SourceMap to be applied. - -* `sourceFile`: Optional. The filename of the source file. - If omitted, sourceMapConsumer.file will be used, if it exists. - Otherwise an error will be thrown. - -* `sourceMapPath`: Optional. The dirname of the path to the SourceMap - to be applied. If relative, it is relative to the SourceMap. - - This parameter is needed when the two SourceMaps aren't in the same - directory, and the SourceMap to be applied contains relative source - paths. If so, those relative source paths need to be rewritten - relative to the SourceMap. - - If omitted, it is assumed that both SourceMaps are in the same directory, - thus not needing any rewriting. (Supplying `'.'` has the same effect.) - -#### SourceMapGenerator.prototype.toString() - -Renders the source map being generated to a string. - -```js -generator.toString() -// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}' -``` - -### SourceNode - -SourceNodes provide a way to abstract over interpolating and/or concatenating -snippets of generated JavaScript source code, while maintaining the line and -column information associated between those snippets and the original source -code. This is useful as the final intermediate representation a compiler might -use before outputting the generated JS and source map. - -#### new SourceNode([line, column, source[, chunk[, name]]]) - -* `line`: The original line number associated with this source node, or null if - it isn't associated with an original line. - -* `column`: The original column number associated with this source node, or null - if it isn't associated with an original column. - -* `source`: The original source's filename; null if no filename is provided. - -* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see - below. - -* `name`: Optional. The original identifier. - -```js -var node = new SourceNode(1, 2, "a.cpp", [ - new SourceNode(3, 4, "b.cpp", "extern int status;\n"), - new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"), - new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"), -]); -``` - -#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath]) - -Creates a SourceNode from generated code and a SourceMapConsumer. - -* `code`: The generated code - -* `sourceMapConsumer` The SourceMap for the generated code - -* `relativePath` The optional path that relative sources in `sourceMapConsumer` - should be relative to. - -```js -var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map")); -var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"), - consumer); -``` - -#### SourceNode.prototype.add(chunk) - -Add a chunk of generated JS to this source node. - -* `chunk`: A string snippet of generated JS code, another instance of - `SourceNode`, or an array where each member is one of those things. - -```js -node.add(" + "); -node.add(otherNode); -node.add([leftHandOperandNode, " + ", rightHandOperandNode]); -``` - -#### SourceNode.prototype.prepend(chunk) - -Prepend a chunk of generated JS to this source node. - -* `chunk`: A string snippet of generated JS code, another instance of - `SourceNode`, or an array where each member is one of those things. - -```js -node.prepend("/** Build Id: f783haef86324gf **/\n\n"); -``` - -#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent) - -Set the source content for a source file. This will be added to the -`SourceMap` in the `sourcesContent` field. - -* `sourceFile`: The filename of the source file - -* `sourceContent`: The content of the source file - -```js -node.setSourceContent("module-one.scm", - fs.readFileSync("path/to/module-one.scm")) -``` - -#### SourceNode.prototype.walk(fn) - -Walk over the tree of JS snippets in this node and its children. The walking -function is called once for each snippet of JS and is passed that snippet and -the its original associated source's line/column location. - -* `fn`: The traversal function. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.walk(function (code, loc) { console.log("WALK:", code, loc); }) -// WALK: uno { source: 'b.js', line: 3, column: 4, name: null } -// WALK: dos { source: 'a.js', line: 1, column: 2, name: null } -// WALK: tres { source: 'a.js', line: 1, column: 2, name: null } -// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null } -``` - -#### SourceNode.prototype.walkSourceContents(fn) - -Walk over the tree of SourceNodes. The walking function is called for each -source file content and is passed the filename and source content. - -* `fn`: The traversal function. - -```js -var a = new SourceNode(1, 2, "a.js", "generated from a"); -a.setSourceContent("a.js", "original a"); -var b = new SourceNode(1, 2, "b.js", "generated from b"); -b.setSourceContent("b.js", "original b"); -var c = new SourceNode(1, 2, "c.js", "generated from c"); -c.setSourceContent("c.js", "original c"); - -var node = new SourceNode(null, null, null, [a, b, c]); -node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); }) -// WALK: a.js : original a -// WALK: b.js : original b -// WALK: c.js : original c -``` - -#### SourceNode.prototype.join(sep) - -Like `Array.prototype.join` except for SourceNodes. Inserts the separator -between each of this source node's children. - -* `sep`: The separator. - -```js -var lhs = new SourceNode(1, 2, "a.rs", "my_copy"); -var operand = new SourceNode(3, 4, "a.rs", "="); -var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()"); - -var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]); -var joinedNode = node.join(" "); -``` - -#### SourceNode.prototype.replaceRight(pattern, replacement) - -Call `String.prototype.replace` on the very right-most source snippet. Useful -for trimming white space from the end of a source node, etc. - -* `pattern`: The pattern to replace. - -* `replacement`: The thing to replace the pattern with. - -```js -// Trim trailing white space. -node.replaceRight(/\s*$/, ""); -``` - -#### SourceNode.prototype.toString() - -Return the string representation of this source node. Walks over the tree and -concatenates all the various snippets together to one string. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.toString() -// 'unodostresquatro' -``` - -#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap]) - -Returns the string representation of this tree of source nodes, plus a -SourceMapGenerator which contains all the mappings between the generated and -original sources. - -The arguments are the same as those to `new SourceMapGenerator`. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.toStringWithSourceMap({ file: "my-output-file.js" }) -// { code: 'unodostresquatro', -// map: [object SourceMapGenerator] } -``` diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.debug.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.debug.js deleted file mode 100644 index dc091643f4..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.debug.js +++ /dev/null @@ -1,3006 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["sourceMap"] = factory(); - else - root["sourceMap"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - /* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ - exports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; - exports.SourceNode = __webpack_require__(10).SourceNode; - - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var base64VLQ = __webpack_require__(2); - var util = __webpack_require__(4); - var ArraySet = __webpack_require__(5).ArraySet; - var MappingList = __webpack_require__(6).MappingList; - - /** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ - function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } - - if (source != null && !this._sources.has(source)) { - this._sources.add(source); - } - - if (name != null && !this._names.has(name)) { - this._names.add(name); - } - - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; - - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = {}; - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; - - /** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; - - /** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - result += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - result += ','; - } - } - - result += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; - - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - result += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; - - // lines are stored 0-based in SourceMap spec version 3 - result += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; - - result += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - result += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } - } - - return result; - }; - - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, - key) - ? this._sourcesContents[key] - : null; - }, this); - }; - - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - - return map; - }; - - /** - * Render the source map being generated to a string. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - - exports.SourceMapGenerator = SourceMapGenerator; - } - - -/***/ }, -/* 2 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - { - var base64 = __webpack_require__(3); - - // A single base 64 digit can contain 6 bits of data. For the base 64 variable - // length quantities we use in the source map spec, the first bit is the sign, - // the next four bits are the actual value, and the 6th bit is the - // continuation bit. The continuation bit tells us whether there are more - // digits in this value following this digit. - // - // Continuation - // | Sign - // | | - // V V - // 101011 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var VLQ_CONTINUATION_BIT = VLQ_BASE; - - /** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ - function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; - } - - /** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); - - return encoded; - }; - - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; - } - - -/***/ }, -/* 3 */ -/***/ function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); - - /** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ - exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; - } - throw new TypeError("Must be between 0 and 63: " + number); - }; - - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; - }; - } - - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - /** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ - function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; - - function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; - } - exports.urlParse = urlParse; - - function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; - } - exports.urlGenerate = urlGenerate; - - /** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consequtive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); - - if (path === '') { - path = isAbsolute ? '/' : '.'; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; - } - exports.normalize = normalize; - - /** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ - function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } - - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } - - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; - } - exports.join = join; - - exports.isAbsolute = function (aPath) { - return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); - }; - - /** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ - function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ''); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } - - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } - - ++level; - } - - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); - } - exports.relative = relative; - - /** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ - function toSetString(aStr) { - return '$' + aStr; - } - exports.toSetString = toSetString; - - function fromSetString(aStr) { - return aStr.substr(1); - } - exports.fromSetString = fromSetString; - - /** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ - function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByOriginalPositions = compareByOriginalPositions; - - /** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ - function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - - cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - - function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - - if (aStr1 > aStr2) { - return 1; - } - - return -1; - } - - /** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ - function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; - } - - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var util = __webpack_require__(4); - - /** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ - function ArraySet() { - this._array = []; - this._set = {}; - } - - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; - }; - - /** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number - */ - ArraySet.prototype.size = function ArraySet_size() { - return Object.getOwnPropertyNames(this._set).length; - }; - - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = util.toSetString(aStr); - var isDuplicate = this._set.hasOwnProperty(sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - this._set[sStr] = idx; - } - }; - - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - var sStr = util.toSetString(aStr); - return this._set.hasOwnProperty(sStr); - }; - - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - var sStr = util.toSetString(aStr); - if (this._set.hasOwnProperty(sStr)) { - return this._set[sStr]; - } - throw new Error('"' + aStr + '" is not in the set.'); - }; - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); - }; - - /** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; - - exports.ArraySet = ArraySet; - } - - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var util = __webpack_require__(4); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; - } - - /** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; - } - - /** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } - }; - - /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; - - exports.MappingList = MappingList; - } - - -/***/ }, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var util = __webpack_require__(4); - var binarySearch = __webpack_require__(8); - var ArraySet = __webpack_require__(5).ArraySet; - var base64VLQ = __webpack_require__(2); - var quickSort = __webpack_require__(9).quickSort; - - function SourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap) - : new BasicSourceMapConsumer(sourceMap); - } - - SourceMapConsumer.fromSourceMap = function(aSourceMap) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap); - } - - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; - - // `__generatedMappings` and `__originalMappings` are arrays that hold the - // parsed mapping coordinates from the source map's "mappings" attribute. They - // are lazily instantiated, accessed via the `_generatedMappings` and - // `_originalMappings` getters respectively, and we only parse the mappings - // and create these arrays once queried for a source location. We jump through - // these hoops because there can be many thousands of mappings, and parsing - // them is expensive, so we only want to do it if we must. - // - // Each object in the arrays is of the form: - // - // { - // generatedLine: The line number in the generated code, - // generatedColumn: The column number in the generated code, - // source: The path to the original source file that generated this - // chunk of code, - // originalLine: The line number in the original source that - // corresponds to this chunk of generated code, - // originalColumn: The column number in the original source that - // corresponds to this chunk of generated code, - // name: The name of the original symbol which generated this chunk of - // code. - // } - // - // All properties except for `generatedLine` and `generatedColumn` can be - // `null`. - // - // `_generatedMappings` is ordered by the generated positions. - // - // `_originalMappings` is ordered by the original positions. - - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } - }); - - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } - }); - - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - if (source != null && sourceRoot != null) { - source = util.join(sourceRoot, source); - } - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; - - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: Optional. the column number in the original source. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; - - if (this.sourceRoot != null) { - needle.source = util.relative(this.sourceRoot, needle.source); - } - if (!this._sources.has(needle.source)) { - return []; - } - needle.source = this._sources.indexOf(needle.source); - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - - exports.SourceMapConsumer = SourceMapConsumer; - - /** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The only parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ - function BasicSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - sources = sources - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names, true); - this._sources = ArraySet.fromArray(sources, true); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @returns BasicSourceMapConsumer - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (s) { - return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; - }, this); - } - }); - - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - cachedSegments[str] = segment; - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); - } - } - } - - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); - } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - if (this.sourceRoot != null) { - source = util.join(this.sourceRoot, source); - } - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } - } - - return { - source: null, - line: null, - column: null, - name: null - }; - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - if (this.sourceRoot != null) { - aSource = util.relative(this.sourceRoot, aSource); - } - - if (this._sources.has(aSource)) { - return this.sourcesContent[this._sources.indexOf(aSource)]; - } - - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + aSource)) { - return this.sourcesContent[this._sources.indexOf("/" + aSource)]; - } - } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - if (this.sourceRoot != null) { - source = util.relative(this.sourceRoot, source); - } - if (!this._sources.has(source)) { - return { - line: null, - column: null, - lastColumn: null - }; - } - source = this._sources.indexOf(source); - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - - exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - - /** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The only parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ - function IndexedSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; - - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map')) - } - }); - } - - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - } - return sources; - } - }); - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - - return { - line: null, - column: null - }; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - if (section.consumer.sourceRoot !== null) { - source = util.join(section.consumer.sourceRoot, source); - } - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - } - - -/***/ }, -/* 8 */ -/***/ function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - exports.GREATEST_LOWER_BOUND = 1; - exports.LEAST_UPPER_BOUND = 2; - - /** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ - function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } - - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; - } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } - - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } - } - } - - /** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ - exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } - - return index; - }; - } - - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } - } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); - }; - } - - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - var util = __webpack_require__(4); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var NEWLINE_CODE = 10; - - // Private symbol for identifying `SourceNode`s when multiple versions of - // the source-map library are loaded. This MUST NOT CHANGE across - // versions! - var isSourceNode = "$$$isSourceNode$$$"; - - /** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ - function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); - } - - /** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are removed from this array, by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var shiftNextLine = function() { - var lineContents = remainingLines.shift(); - // The last line of a file might not have a newline. - var newLine = remainingLines.shift() || ""; - return lineContents + newLine; - }; - - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[0]; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[0] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[0]; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[0] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLines.length > 0) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.join("")); - } - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; - - /** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } - }; - - /** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; - }; - - /** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; - }; - - /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ - SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; - - /** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; - - /** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - - return { code: generated.code, map: map }; - }; - - exports.SourceNode = SourceNode; - } - - -/***/ } -/******/ ]) -}); -; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCAzMzE2M2Q1YTFmMDY1MDk5Y2MwYiIsIndlYnBhY2s6Ly8vLi9zb3VyY2UtbWFwLmpzIiwid2VicGFj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ICAgICAgICAgICAgY29sdW1uOiBtYXBwaW5nLmdlbmVyYXRlZENvbHVtblxuICAgICAgICAgIH1cbiAgICAgICAgfTtcblxuICAgICAgICBpZiAobWFwcGluZy5zb3VyY2UgIT0gbnVsbCkge1xuICAgICAgICAgIG5ld01hcHBpbmcuc291cmNlID0gbWFwcGluZy5zb3VyY2U7XG4gICAgICAgICAgaWYgKHNvdXJjZVJvb3QgIT0gbnVsbCkge1xuICAgICAgICAgICAgbmV3TWFwcGluZy5zb3VyY2UgPSB1dGlsLnJlbGF0aXZlKHNvdXJjZVJvb3QsIG5ld01hcHBpbmcuc291cmNlKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBuZXdNYXBwaW5nLm9yaWdpbmFsID0ge1xuICAgICAgICAgICAgbGluZTogbWFwcGluZy5vcmlnaW5hbExpbmUsXG4gICAgICAgICAgICBjb2x1bW46IG1hcHBpbmcub3JpZ2luYWxDb2x1bW5cbiAgICAgICAgICB9O1xuXG4gICAgICAgICAgaWYgKG1hcHBpbmcubmFtZSAhPSBudWxsKSB7XG4gICAgICAgICAgICBuZXdNYXBwaW5nLm5hbWUgPSBtYXBwaW5nLm5hbWU7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZ2VuZXJhdG9yLmFkZE1hcHBpbmcobmV3TWFwcGluZyk7XG4gICAgICB9KTtcbiAgICAgIGFTb3VyY2VNYXBDb25zdW1lci5zb3VyY2VzLmZvckVhY2goZnVuY3Rpb24gKHNvdXJjZUZpbGUpIHtcbiAgICAgICAgdmFyIGNvbnRlbnQgPSBhU291cmNlTWFwQ29uc3VtZXIuc291cmNlQ29udGVudEZvcihzb3VyY2VGaWxlKTtcbiAgICAgICAgaWYgKGNvbnRlbnQgIT0gbnVsbCkge1xuICAgICAgICAgIGdlbmVyYXRvci5zZXRTb3VyY2VDb250ZW50KHNvdXJjZUZpbGUsIGNvbnRlbnQpO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICAgIHJldHVybi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luYWxMaW5lLFxuICAgICAgICAgICAgY29sdW1uOiBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uXG4gICAgICAgICAgfSk7XG4gICAgICAgICAgaWYgKG9yaWdpbmFsLnNvdXJjZSAhPSBudWxsKSB7XG4gICAgICAgICAgICAvLyBDb3B5IG1hcHBpbmdcbiAgICAgICAgICAgIG1hcHBpbmcuc291cmNlID0gb3JpZ2luYWwuc291cmNlO1xuICAgICAgICAgICAgaWYgKGFTb3VyY2VNYXBQYXRoICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgbWFwcGluZy5zb3VyY2UgPSB1dGlsLmpvaW4oYVNvdXJjZU1hcFBhdGgsIG1hcHBpbmcuc291cmNlKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHNvdXJjZVJvb3QgIT0gbnVsbCkge1xuICAgICAgICAgICAgICBtYXBwaW5nLnNvdXJjZSA9IHV0aWwucmVsYXRpdmUoc291cmNlUm9vdCwgbWFwcGluZy5zb3VyY2UpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbWFwcGluZy5vcmlnaW5hbExpbmUgPSBvcmlnaW5hbC5saW5lO1xuICAgICAgICAgICAgbWFwcGluZy5vcmlnaW5hbENvbHVtbiA9IG9yaWdpbmFsLmNvbHVtbjtcbiAgICAgICAgICAgIGlmIChvcmlnaW5hbC5uYW1lICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgbWFwcGluZy5uYW1lID0gb3JpZ2luYWwubmFtZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgc291cmNlID0gbWFwcGluZy5zb3VyY2U7XG4gICAgICAgIGlmIChzb3VyY2UgIT0gbnVsbCAmJiAhbmV3U291cmNlcy5oYXMoc291cmNlKSkge1xuICAgICAgICAgIG5ld1NvdXJjZXMuYWRkKHNvdXJjZSk7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgbmFtZSA9IG1hcHBpbmcubmFtZT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xuICAgICAgICByZXN1bHQgKz0gYmFzZTY0VkxRLmVuY29kZShtYXBwaW5nLmdlbmVyYXRlZENvbHVtblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHByZXZpb3VzR2VuZXJhdGVkQ29sdW1uKTtcbiAgICAgICAgcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4gPSBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbjtcblxuICAgICAgICBpZiAobWFwcGluZy5zb3VyY2UgIT0gbnVsbCkge1xuICAgICAgICAgIHNvdXJjZUlkeCA9IHRoaXMuX3NvdXJjZXMuaW5kZXhPZihtYXBwaW5nLnNvdXJjZSk7XG4gICAgICAgICAgcmVzdWx0ICs9IGJhc2U2NFZMUS5lbmNvZGUoc291cmNlSWR4IC0gcHJldmlvdXNTb3VyY2UpO1xuICAgICAgICAgIHByZXZpb3VzU291cmNlID0gc291cmNlSWR4O1xuXG4gICAgICAgICAgLy8gbGluZXMgYXJlIHN0b3JlZCAwLWJhc2VkIGluIFNvdXJjZU1hcCBzcGVjIHZlcnNpb24gM1xuICAgICAgICAgIHJlc3VsdCArPSBiYXNlNjRWTFEuZW5jb2RlKG1hcHBpbmcub3JpZ2luYWxMaW5lIC0gMVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gcHJldmlvdXNPcmlnaW5hbExpbmUpO1xuICAgICAgICAgIHByZXZpb3VzT3JpZ2luYWxMaW5lID0gbWFwcGluZy5vcmlnaW5hbExpbmUgLSAxO1xuXG4gICAgICAgICAgcmVzdWx0ICs9IGJhc2U2NFZMUS5lbmNvZGUobWFwcGluZy5vcmlnaW5hbENvbHVtblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gcHJldmlvdXNPcmlnaW5hbENvbHVtbik7XG4gICAgICAgICAgcHJldmlvdXNPcmlnaW5hbENvbHVtbiA9IG1hcHBpbmcub3JpZ2luYWxDb2x1bW47XG5cbiAgICAgICAgICBpZiAobWFwcGluZy5uYW1lICE9IG51bGwpIHtcbiAgICAgICAgICAgIG5hbWVJZHggPSB0aGlzLl9uYW1lcy5pbmRleE9mKG1hcHBpbmcubmFtZSk7XG4gICAgICAgICAgICByZXN1bHQgKz0gYmFzZTY0VkxRLmVuY29kZShuYW1lSWR4IC0gcHJldmlvdXNOYW1lKTtcbiAgICAgICAgICAgIHByZXZpb3VzTmFtZSA9IG5hbWVJZHg7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfTtcblxuICBTb3VyY2VNYXBHZW5lcmF0b3IucHJvdG90eXBlLl9nZW5lcmF0ZVNvdXJjZXNDb250ZW50ID1cbiAgICBmdW5jdGlvbiBTb3VyY2VNYXBHZW5lcmF0b3JfZ2VuZXJhdGVTb3VyY2VzQ29udGVudChhU291cmNlcywgYVNvdXJjZVJvb3QpIHtcbiAgICAgIHJldHVybiBhU291cmNlcy5tYXAoZnVuY3Rpb24gKHNvdXJjZSkge1xuICAgICAgICBpZiAoIXRoaXMuX3NvdXJjZXNDb250ZW50cykge1xuICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIGlmIChhU291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICAgICAgc291cmNlID0gdXRpbC5yZWxhdGl2ZShhU291cmNlUm9vdCwgc291cmNlKTtcbiAgICAgICAgfVxuICAgICAgICB2YXIga2V5ID0gdXRpbC50b1NldFN0cmluZyhzb3VyY2UpO1xuICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHRoaXMuX3NvdXJjZXNDb250ZW50cyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXkpXG4gICAgICAgICAgPyB0aGlzLl9zb3VyY2VzQ29udGVudHNba2V5XVxuICAgICAgICAgIDogbnVsbDtcbiAgICAgIH0sIH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zIGZpbmQgdGhlIGxhc3QgbWFwcGluZyBmb3JcbiAgICAgIC8vIHRoZSBnaXZlbiBsaW5lLCBwcm92aWRlZCBzdWNoIGEgbWFwcGluZyBleGlzdHMuXG4gICAgICB2YXIgbmVlZGxlID0ge1xuICAgICAgICBzb3VyY2U6IHV0aWwuZ2V0QXJnKGFBcmdzLCAnc291cmNlJyksXG4gICAgICAgIG9yaWdpbmFsTGluZTogbGluZSxcbiAgICAgICAgb3JpZ2luYWxDb2x1bW46IHV0aWwuZ2V0QXJnKGFBcmdzLCAnY29sdW1uJywgMClcbiAgICAgIH07XG5cbiAgICAgIGlmICh0aGlzLnNvdXJjZVJvb3QgIT0gbnVsbCkge1xuICAgICAgICBuZWVkbGUuc291cmNlID0gdXRpbC5yZWxhdGl2ZSh0aGlzLnNvdXJjZVJvb3QsIG5lZWRsZS5zb3VyY2UpO1xuICAgICAgfVxuICAgICAgaWYgKCF0aGlzLl9zb3VyY2VzLmhhcyhuZWVkbGUuc291cmNlKSkge1xuICAgICAgICByZXR1cm4gW107XG4gICAgICB9XG4gICAgICBuZWVkbGUuc291cmNlID0gdGhpcy5fc291cmNlcy5pbmRleE9mKG5lZWRsZS5zb3VyY2UpO1xuXG4gICAgICB2YXIgbWFwcGluZ3MgPSBbXTtcblxuICAgICAgdmFyIGluZGV4ID0gdGhpcy5fZmluZE1hcHBpbmcobmVlZGxlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fb3JpZ2luYWxNYXBwaW5ncyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwib3JpZ2luYWxMaW5lXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm9yaWdpbmFsQ29sdW1uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1dGlsLmNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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NTb3VyY2VNYXBDb25zdW1lciBmcm9tIGEgU291cmNlTWFwR2VuZXJhdG9yLlxuICAgKlxuICAgKiBAcGFyYW0gU291cmNlTWFwR2VuZXJhdG9yIGFTb3VyY2VNYXBcbiAgICogICAgICAgIFRoZSBzb3VyY2UgbWFwIHRoYXQgd2lsbCBiZSBjb25zdW1lZC5cbiAgICogQHJldHVybnMgQmFzaWNTb3VyY2VNYXBDb25zdW1lclxuICAgKi9cbiAgQmFzaWNTb3VyY2VNYXBDb25zdW1lci5mcm9tU291cmNlTWFwID1cbiAgICBmdW5jdGlvbiBTb3VyY2VNYXBDb25zdW1lcl9mcm9tU291cmNlTWFwKGFTb3VyY2VNYXApIHtcbiAgICAgIHZhciBzbWMgPSBPYmplY3QuY3JlYXRlKEJhc2ljU291cmNlTWFwQ29uc3VtZXIucHJvdG90eXBlKTtcblxuICAgICAgdmFyIG5hbWVzID0gc21jLl9uYW1lcyA9IEFycmF5U2V0LmZyb21BcnJheShhU291cmNlTWFwLl9uYW1lcy50b0FycmF5KCksIHRydWUpO1xuICAgICAgdmFyIHNvdXJjZXMgPSBzbWMuX3NvdXJjZXMgPSBBcnJheVNldC5mcm9tQXJyYXkoYVNvdXJjZU1hcC5fc291cmNlcy50b0FycmF5KCksIHRydWUpO1xuICAgICAgc21jLnNvdXJjZVJvb3QgPSBhU291cmNlTWFwLl9zb3VyY2VSb290O1xuICAgICAgc21jLnNvdXJjZXNDb250ZW50ID0gYVNvdXJjZU1hcC5fZ2VuZXJhdGVTb3VyY2VzQ29udGVudChzbWMuX3NvdXJjZXMudG9BcnJheSgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzbWMuc291cmNlUm9vdCk7XG4gICAgICBzbWMuZmlsZSA9IGFTb3VyY2VNYXAuX2ZpbGU7XG5cbiAgICAgIC8vIEJlY2F1c2Ugd2UgYXJlIG1vZGlmeWluZyB0aGUgZW50cmllcyAoYnkgY29ud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IGJ1dCBubyBsaW5lIGFuZCBjb2x1bW4nKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID09PSAzKSB7XG4gICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignRm91bmQgYSBzb3VyY2UgYW5kIGxpbmUsIGJ1dCBubyBjb2x1bW4nKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY2FjaGVkU2VnbWVudHNbc3RyXSA9IHNlZ21lbnQ7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgLy8gR2VuZXJhdGVkIGNvbHVtbi5cbiAgICAgICAgICBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbiA9IHByZXZpb3VzR2VuZXJhdGVkQ29sdW1uICsgc2VnbWVudFswXTtcbiAgICAgICAgICBwcmV2aW91c0dlbmVyYXRlZENvbHVtbiA9IG1hcHBpbmcuZ2VuZXJhdGVkQ29sdW1uO1xuXG4gICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID4gMSkge1xuICAgICAgICAgICAgLy8gT3JpZ2luYWwgc291cmNlLlxuICAgICAgICAgICAgbWFwcGluZy5zb3VyY2UgPSBwcmV2aW91c1NvdXJjZSArIHNlZ21lbnRbMV07XG4gICAgICAgICAgICBwcmV2aW91c1NvdXJjZSArPSBzZWdtZW50WzFdO1xuXG4gICAgICAgICAgICAvLyBPcmlnaW5hbCBsaW5lLlxuICAgICAgICAgICAgbWFwcGluZy5vcmlnaW5hbExpbmUgPSBwcmV2aW91c09yaWdpbmFsTGluZSArIHNlZ21lbnRbMl07XG4gICAgICAgICAgICBwcmV2aW91c09yaWdpbmFsTGluZSA9IG1hcHBpbmcub3JpZ2luYWxMaW5lO1xuICAgICAgICAgICAgLy8gTGluZXMgYXJlIHN0b3JlZCAwLWJhc2VkXG4gICAgICAgICAgICBtYXBwaW5nLm9yaWdpbmFsTGluZSArPSAxO1xuXG4gICAgICAgICAgICAvLyBPcmlnaW5hbCBjb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Muc291cmNlUm9vdCwgc291cmNlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgdmFyIG5hbWUgPSB1dGlsLmdldEFyZyhtYXBwaW5nLCAnbmFtZScsIG51bGwpO1xuICAgICAgICAgIGlmIChuYW1lICE9PSBudWxsKSB7XG4gICAgICAgICAgICBuYW1lID0gdGhpcy5fbmFtZXMuYXQobmFtZSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBzb3VyY2U6IHNvdXJjZSxcbiAgICAgICAgICAgIGxpbmU6IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdvcmlnaW5hbExpbmUnLCBudWxsKSxcbiAgICAgICAgICAgIGNvbHVtbjogdXRpbC5nZXRBcmcobWFwcGluZywgJ29yaWdpbmFsQ29sdW1uJywgbnVsbCksXG4gICAgICAgICAgICBuYW1lOiBuYW1lXG4gICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICByZXR1cm4ge1xuICAgICAgICBzb3VyY2U6IG51bGwsXG4gICAgICAgIGxpbmU6IG51bGwsXG4gICAgICAgIGNvbHVtbjogbnVsbCxcbiAgICAgICAgbmFtZTogbnVsbFxuICAgICAgfTtcbiAgICB9O1xuXG4gIC8qKlxuICAgKiBSZXR1cm4gdHJ1ZSBpZiB3ZSBoYXZlIHRoZSBzb3VyY2UgY29udGVudCBmb3IgZXZlcnkgc291cmNlIGluIHRoZSBzb3VyY2VcbiAgICogbWFwLCBmYWxzZSBvdGhlcndpc2UuXG4gICAqL1xuICBCYXNpY1NvdXJjZU1hcENvbnN1bWVyLnByb3RvdHlwZS5oYXNDb250ZW50c09mQWxsU291cmNlcyA9XG4gICAgZnVuY3Rpb24gQmFzaWNTb3VyY2VNYXBDb25zdW1lcl9oYXNDb250ZW50c09mQWxsU291cmNlcygpIHtcbiAgICAgIGlmICghdGhpcy5zb3VyY2VzQ29udGVudCkge1xuICAgICAgICByZXR1cm4g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AgICAgaWYgKCF0aGlzLl9zb3VyY2VzLmhhcyhzb3VyY2UpKSB7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgbGluZTogbnVsbCxcbiAgICAgICAgICBjb2x1bW46IG51bGwsXG4gICAgICAgICAgbGFzdENvbHVtbjogbnVsbFxuICAgICAgICB9O1xuICAgICAgfVxuICAgICAgc291cmNlID0gdGhpcy5fc291cmNlcy5pbmRleE9mKHNvdXJjZSk7XG5cbiAgICAgIHZhciBuZWVkbGUgPSB7XG4gICAgICAgIHNvdXJjZTogc291cmNlLFxuICAgICAgICBvcmlnaW5hbExpbmU6IHV0aWwuZ2V0QXJnKGFBcmdzLCAnbGluZScpLFxuICAgICAgICBvcmlnaW5hbENvbHVtbjogdXRpbC5nZXRBcmcoYUFyZ3MsICdjb2x1bW4nKVxuICAgICAgfTtcblxuICAgICAgdmFyIGluZGV4ID0gdGhpcy5fZmluZE1hcHBpbmcoXG4gICAgICAgIG5lZWRsZSxcbiAgICAgICAgdGhpcy5fb3JpZ2luYWxNYXBwaW5ncyxcbiAgICAgICAgXCJvcmlnaW5hbExpbmVcIixcbiAgICAgICAgXCJvcmlnaW5hbENvbHVtblwiLFxuICAgICAgICB1dGlsLmNvbXBhcmVCeU9yaWdpbmFsUG9zaXRpb25zLFxuICAgICAgICB1dGlsLmdldEFyZyhhQXJncywgJ2JpYXMnLCBTb3VyY2VNYXBDb25zdW1lci5HUkVBVEVTVF9MT1dFUl9CT1VORClcbiAgICAgICk7XG5cbiAgICAgIGlmIChpbmRleCA+PSAwKSB7XG4gICAgICAgIHZhciBtYXBwaW5nID0gdGhpcy5fb3JpZ2luYWxNYXBwaW5nc1tpbmRleF07XG5cbiAgICAgICAgaWYgKG1hcHBpbmcuc291cmNlID09PSBuZWVkbGUuc291cmNlKSB7XG4gICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIGxpbmU6IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICdnZW5lcmF0ZWRMaW5lJywgb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bnkgbWFwcGluZ1xuICAgICAgICBub2RlLmFkZChyZW1haW5pbmdMaW5lcy5qb2luKFwiXCIpKTtcbiAgICAgIH1cblxuICAgICAgLy8gQ29weSBzb3VyY2VzQ29udGVudCBpbnRvIFNvdXJjZU5vZGVcbiAgICAgIGFTb3VyY2VNYXBDb25zdW1lci5zb3VyY2VzLmZvckVhY2goZnVuY3Rpb24gKHNvdXJjZUZpbGUpIHtcbiAgICAgICAgdmFyIGNvbnRlbnQgPSBhU291cmNlTWFwQ29uc3VtZXIuc291cmNlQ29udGVudEZvcihzb3VyY2VGaWxlKTtcbiAgICAgICAgaWYgKGNvbnRlbnQgIT0gbnVsbCkge1xuICAgICAgICAgIGlmIChhUmVsYXRpdmVQYXRoICE9IG51bGwpIHtcbiAgICAgICAgICAgIHNvdXJjZUZpbGUgPSB1dGlsLmpvaW4oYVJlbGF0aXZlUGF0aCwgc291cmNlRmlsZSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIG5vZGUuc2V0U291cmNlQ29udGVudChzb3VyY2VGaWxlLCBjb250ZW50KTtcbiAgICAgICAgfVxuICAgICAgfSk7XG5cbiAgICAgIHJldHVybiBub2RlO1xuXG4gICAgICBmdW5jdGlvbiBhZGRNYXBwaW5nV2l0aENvZGUobWFwcGluZywgY29kZSkge1xuICAgICAgICBpZiAobWFwcGluZyA9PT0gbnVsbCB8fCBtYXBwaW5nLnNvdXJjZSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgbm9kZS5hZGQoY29kZSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgdmFyIHNvdXJjZSA9IGFSZWxhdGl2ZVBhdGhcbiAgICAgICAgICAgID8gdXRpbC5qb2luKGFSZWxhdGl2ZVBhdGgsIG1hcHBpbmcuc291cmNlKVxuICAgICAgICAgICAgOiBtYXBwaW5nLnNvdXJjZTtcbiAgICAgICAgICBub2RlLmFkZChuZXcgU291cmNlTm9kZShtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcHBpbmcubmFtZSkpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfTtcblxuICAvKipcbiAgICogQWRkIGEgY2h1bmsgb2YgZ2VuZXJhdGVkIEpTIHRvIHRoaXMgc291cmNlIG5vZGUuXG4gICAqXG4gICAqIEBwYXJhbSBhQ2h1bmsgQSBzdHJpbmcgc25pcHBldCBvZiBnZW5lcmF0ZWQgSlMgY29kZSwgYW5vdGhlciBpbnN0YW5jZSBvZlxuICAgKiAgICAgICAgU291cmNlTm9kZSwgb3IgYW4gYXJyYXkgd2hlcmUgZWFjaCBtZW1iZXIgaXMgb25lIG9mIHRob3NlIHRoaW5ncy5cbiAgICovXG4gIFNvdXJjZU5vZGUucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIFNvdXJjZU5vZGVfYWRkKGFDaHVuaykge1xuICAgIGlmIChBcnJheS5pc0FycmF5KGFDaHVuaykpIHtcbiAgICAgIGFDaHVuay5mb3JFYWNoKGZ1bmN0aW9uIChjaHVuaykge1xuICAgICAgICB0aGlzLmFkZChjaHVuayk7XG4gICAgICB9LCB0aGlzKTtcbiAgICB9XG4gICAgZWxzZSBpZiAoYUNodW5rW2lzU291cmNlTm9kZV0gfHwgdHlwZW9mIGFDaHVuayA9PT0gXCJzdHJpbmdcIikge1xuICAgICAgaWYgKGFDaHVuaykge1xuICAgICAgICB0aGlzLmNoaWxkcmVuLnB1c2goYUNodW5rKTtcbiAgICAgIH1cbiAgICB9XG4gICAgZWxzZSB7XG4gICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKFxuICAgICAgICBcIkV4cGVjdGVkIGEgU291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b2x1bW5cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBuYW1lOiBvcmlnaW5hbC5uYW1lXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgbGFzdE9yaWdpbmFsU291cmNlID0gb3JpZ2luYWwuc291cmNlO1xuICAgICAgICBsYXN0T3JpZ2luYWxMaW5lID0gb3JpZ2luYWwubGluZTtcbiAgICAgICAgbGFzdE9yaWdpbmFsQ29sdW1uID0gb3JpZ2luYWwuY29sdW1uO1xuICAgICAgICBsYXN0T3JpZ2luYWxOYW1lID0gb3JpZ2luYWwubmFtZTtcbiAgICAgICAgc291cmNlTWFwcGluZ0FjdGl2ZSA9IHRydWU7XG4gICAgICB9IGVsc2UgaWYgKHNvdXJjZU1hcHBpbmdBY3RpdmUpIHtcbiAgICAgICAgbWFwLmFkZE1hcHBpbmcoe1xuICAgICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgICAgbGluZTogZ2VuZXJhdGVkLmxpbmUsXG4gICAgICAgICAgICBjb2x1bW46IGdlbmVyYXRlZC5jb2x1bW5cbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICBsYXN0T3JpZ2luYWxTb3VyY2UgPSBudWxsO1xuICAgICAgICBzb3VyY2VNYXBwaW5nQWN0aXZlID0gZmFsc2U7XG4gICAgICB9XG4gICAgICBmb3IgKHZhciBpZHggPSAwLCBsZW5ndGggPSBjaHVuay5sZW5ndGg7IGlkeCA8IGxlbmd0aDsgaWR4KyspIHtcbiAgICAgICAgaWYgKGNodW5rLmNoYXJDb2RlQXQoaWR4KSA9PT0gTkVXTElORV9DT0RFKSB7XG4gICAgICAgICAgZ2VuZXJhdGVkLmxpbmUrKztcbiAgICAgICAgICBnZW5lcmF0ZWQuY29sdW1uID0gMDtcbiAgICAgICAgICAvLyBNYXBwaW5ncyBlbmQgYXQgZW9sXG4gICAgICAgICAgaWYgKGlkeCArIDEgPT09IGxlbmd0aCkge1xuICAgICAgICAgICAgbGFzdE9yaWdpbmFsU291cmNlID0gbnVsbDtcbiAgICAgICAgICAgIHNvdXJjZU1hcHBpbmdBY3RpdmUgPSBmYWxzZTtcbiAgICAgICAgICB9IGVsc2UgaWYgKHNvdXJjZU1hcHBpbmdBY3RpdmUpIHtcbiAgICAgICAgICAgIG1hcC5hZGRNYXBwaW5nKHtcbiAgICAgICAgICAgICAgc291cmNlOiBvcmlnaW5hbC5zb3VyY2UsXG4gICAgICAgICAgICAgIG9yaWdpbmFsOiB7XG4gICAgICAgICAgICAgICAgbGluZTogb3JpZ2luYWwubGluZSxcbiAgICAgICAgICAgICAgICBjb2x1bW46IG9yaWdpbmFsLmNvbHVtblxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBnZW5lcmF0ZWQ6IHtcbiAgICAgICAgICAgICAgICBsaW5lOiBnZW5lcmF0ZWQubGluZSxcbiAgICAgICAgICAgICAgICBjb2x1bW46IGdlbmVyYXRlZC5jb2x1bW5cbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgbmFtZTogb3JpZ2luYWwubmFtZVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGdlbmVyYXRlZC5jb2x1bW4rKztcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0pO1xuICAgIHRoaXMud2Fsa1NvdXJjZUNvbnRlbnRzKGZ1bmN0aW9uIChzb3VyY2VGaWxlLCBzb3VyY2VDb250ZW50KSB7XG4gICAgICBtYXAuc2V0U291cmNlQ29udGVudChzb3VyY2VGaWxlLCBzb3VyY2VDb250ZW50KTtcbiAgICB9KTtcblxuICAgIHJldHVybiB7IGNvZGU6IGdlbmVyYXRlZC5jb2RlLCBtYXA6IG1hcCB9O1xuICB9O1xuXG4gIGV4cG9ydHMuU291cmNlTm9kZSA9IFNvdXJjZU5vZGU7XG59XG5cblxuXG4vKioqKioqKioqKioqKioqKipcbiAqKiBXRUJQQUNLIEZPT1RFUlxuICoqIC4vbGliL3NvdXJjZS1ub2RlLmpzXG4gKiogbW9kdWxlIGlkID0gMTBcbiAqKiBtb2R1bGUgY2h1bmtzID0gMFxuICoqLyJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.js deleted file mode 100644 index 25199a64c6..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.js +++ /dev/null @@ -1,3005 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["sourceMap"] = factory(); - else - root["sourceMap"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - /* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ - exports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; - exports.SourceNode = __webpack_require__(10).SourceNode; - - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var base64VLQ = __webpack_require__(2); - var util = __webpack_require__(4); - var ArraySet = __webpack_require__(5).ArraySet; - var MappingList = __webpack_require__(6).MappingList; - - /** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ - function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } - - if (source != null && !this._sources.has(source)) { - this._sources.add(source); - } - - if (name != null && !this._names.has(name)) { - this._names.add(name); - } - - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; - - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = {}; - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; - - /** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; - - /** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - result += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - result += ','; - } - } - - result += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; - - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - result += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; - - // lines are stored 0-based in SourceMap spec version 3 - result += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; - - result += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - result += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } - } - - return result; - }; - - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, - key) - ? this._sourcesContents[key] - : null; - }, this); - }; - - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - - return map; - }; - - /** - * Render the source map being generated to a string. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - - exports.SourceMapGenerator = SourceMapGenerator; - } - - -/***/ }, -/* 2 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - { - var base64 = __webpack_require__(3); - - // A single base 64 digit can contain 6 bits of data. For the base 64 variable - // length quantities we use in the source map spec, the first bit is the sign, - // the next four bits are the actual value, and the 6th bit is the - // continuation bit. The continuation bit tells us whether there are more - // digits in this value following this digit. - // - // Continuation - // | Sign - // | | - // V V - // 101011 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var VLQ_CONTINUATION_BIT = VLQ_BASE; - - /** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ - function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; - } - - /** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); - - return encoded; - }; - - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; - } - - -/***/ }, -/* 3 */ -/***/ function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); - - /** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ - exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; - } - throw new TypeError("Must be between 0 and 63: " + number); - }; - - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; - }; - } - - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - /** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ - function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; - - function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; - } - exports.urlParse = urlParse; - - function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; - } - exports.urlGenerate = urlGenerate; - - /** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consequtive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); - - if (path === '') { - path = isAbsolute ? '/' : '.'; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; - } - exports.normalize = normalize; - - /** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ - function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } - - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } - - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; - } - exports.join = join; - - exports.isAbsolute = function (aPath) { - return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); - }; - - /** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ - function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ''); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } - - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } - - ++level; - } - - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); - } - exports.relative = relative; - - /** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ - function toSetString(aStr) { - return '$' + aStr; - } - exports.toSetString = toSetString; - - function fromSetString(aStr) { - return aStr.substr(1); - } - exports.fromSetString = fromSetString; - - /** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ - function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByOriginalPositions = compareByOriginalPositions; - - /** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ - function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - - cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - - function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - - if (aStr1 > aStr2) { - return 1; - } - - return -1; - } - - /** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ - function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; - } - - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var util = __webpack_require__(4); - - /** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ - function ArraySet() { - this._array = []; - this._set = {}; - } - - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; - }; - - /** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number - */ - ArraySet.prototype.size = function ArraySet_size() { - return Object.getOwnPropertyNames(this._set).length; - }; - - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = util.toSetString(aStr); - var isDuplicate = this._set.hasOwnProperty(sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - this._set[sStr] = idx; - } - }; - - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - var sStr = util.toSetString(aStr); - return this._set.hasOwnProperty(sStr); - }; - - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - var sStr = util.toSetString(aStr); - if (this._set.hasOwnProperty(sStr)) { - return this._set[sStr]; - } - throw new Error('"' + aStr + '" is not in the set.'); - }; - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); - }; - - /** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; - - exports.ArraySet = ArraySet; - } - - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var util = __webpack_require__(4); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; - } - - /** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; - } - - /** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } - }; - - /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; - - exports.MappingList = MappingList; - } - - -/***/ }, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var util = __webpack_require__(4); - var binarySearch = __webpack_require__(8); - var ArraySet = __webpack_require__(5).ArraySet; - var base64VLQ = __webpack_require__(2); - var quickSort = __webpack_require__(9).quickSort; - - function SourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap) - : new BasicSourceMapConsumer(sourceMap); - } - - SourceMapConsumer.fromSourceMap = function(aSourceMap) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap); - } - - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; - - // `__generatedMappings` and `__originalMappings` are arrays that hold the - // parsed mapping coordinates from the source map's "mappings" attribute. They - // are lazily instantiated, accessed via the `_generatedMappings` and - // `_originalMappings` getters respectively, and we only parse the mappings - // and create these arrays once queried for a source location. We jump through - // these hoops because there can be many thousands of mappings, and parsing - // them is expensive, so we only want to do it if we must. - // - // Each object in the arrays is of the form: - // - // { - // generatedLine: The line number in the generated code, - // generatedColumn: The column number in the generated code, - // source: The path to the original source file that generated this - // chunk of code, - // originalLine: The line number in the original source that - // corresponds to this chunk of generated code, - // originalColumn: The column number in the original source that - // corresponds to this chunk of generated code, - // name: The name of the original symbol which generated this chunk of - // code. - // } - // - // All properties except for `generatedLine` and `generatedColumn` can be - // `null`. - // - // `_generatedMappings` is ordered by the generated positions. - // - // `_originalMappings` is ordered by the original positions. - - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } - }); - - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } - }); - - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - if (source != null && sourceRoot != null) { - source = util.join(sourceRoot, source); - } - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; - - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: Optional. the column number in the original source. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; - - if (this.sourceRoot != null) { - needle.source = util.relative(this.sourceRoot, needle.source); - } - if (!this._sources.has(needle.source)) { - return []; - } - needle.source = this._sources.indexOf(needle.source); - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - - exports.SourceMapConsumer = SourceMapConsumer; - - /** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The only parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ - function BasicSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - sources = sources - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names, true); - this._sources = ArraySet.fromArray(sources, true); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @returns BasicSourceMapConsumer - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (s) { - return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; - }, this); - } - }); - - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - cachedSegments[str] = segment; - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); - } - } - } - - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); - } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - if (this.sourceRoot != null) { - source = util.join(this.sourceRoot, source); - } - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } - } - - return { - source: null, - line: null, - column: null, - name: null - }; - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - if (this.sourceRoot != null) { - aSource = util.relative(this.sourceRoot, aSource); - } - - if (this._sources.has(aSource)) { - return this.sourcesContent[this._sources.indexOf(aSource)]; - } - - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + aSource)) { - return this.sourcesContent[this._sources.indexOf("/" + aSource)]; - } - } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - if (this.sourceRoot != null) { - source = util.relative(this.sourceRoot, source); - } - if (!this._sources.has(source)) { - return { - line: null, - column: null, - lastColumn: null - }; - } - source = this._sources.indexOf(source); - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - - exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - - /** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The only parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ - function IndexedSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; - - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map')) - } - }); - } - - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - } - return sources; - } - }); - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - - return { - line: null, - column: null - }; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - if (section.consumer.sourceRoot !== null) { - source = util.join(section.consumer.sourceRoot, source); - } - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - } - - -/***/ }, -/* 8 */ -/***/ function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - exports.GREATEST_LOWER_BOUND = 1; - exports.LEAST_UPPER_BOUND = 2; - - /** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ - function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } - - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; - } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } - - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } - } - } - - /** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ - exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } - - return index; - }; - } - - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } - } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); - }; - } - - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - { - var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - var util = __webpack_require__(4); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var NEWLINE_CODE = 10; - - // Private symbol for identifying `SourceNode`s when multiple versions of - // the source-map library are loaded. This MUST NOT CHANGE across - // versions! - var isSourceNode = "$$$isSourceNode$$$"; - - /** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ - function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); - } - - /** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are removed from this array, by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var shiftNextLine = function() { - var lineContents = remainingLines.shift(); - // The last line of a file might not have a newline. - var newLine = remainingLines.shift() || ""; - return lineContents + newLine; - }; - - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[0]; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[0] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[0]; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[0] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLines.length > 0) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.join("")); - } - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; - - /** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } - }; - - /** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; - }; - - /** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; - }; - - /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ - SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; - - /** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; - - /** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - - return { code: generated.code, map: map }; - }; - - exports.SourceNode = SourceNode; - } - - -/***/ } -/******/ ]) -}); -; \ No newline at end of file diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.min.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.min.js deleted file mode 100644 index 3de3bd2e4e..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.sourceMap=n():e.sourceMap=n()}(this,function(){return function(e){function n(t){if(r[t])return r[t].exports;var o=r[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){n.SourceMapGenerator=r(1).SourceMapGenerator,n.SourceMapConsumer=r(7).SourceMapConsumer,n.SourceNode=r(10).SourceNode},function(e,n,r){function t(e){e||(e={}),this._file=i.getArg(e,"file",null),this._sourceRoot=i.getArg(e,"sourceRoot",null),this._skipValidation=i.getArg(e,"skipValidation",!1),this._sources=new s,this._names=new s,this._mappings=new a,this._sourcesContents=null}var o=r(2),i=r(4),s=r(5).ArraySet,a=r(6).MappingList;t.prototype._version=3,t.fromSourceMap=function(e){var n=e.sourceRoot,r=new t({file:e.file,sourceRoot:n});return e.eachMapping(function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=n&&(t.source=i.relative(n,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),r.addMapping(t)}),e.sources.forEach(function(n){var t=e.sourceContentFor(n);null!=t&&r.setSourceContent(n,t)}),r},t.prototype.addMapping=function(e){var n=i.getArg(e,"generated"),r=i.getArg(e,"original",null),t=i.getArg(e,"source",null),o=i.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,r,t,o),null==t||this._sources.has(t)||this._sources.add(t),null==o||this._names.has(o)||this._names.add(o),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:t,name:o})},t.prototype.setSourceContent=function(e,n){var r=e;null!=this._sourceRoot&&(r=i.relative(this._sourceRoot,r)),null!=n?(this._sourcesContents||(this._sourcesContents={}),this._sourcesContents[i.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[i.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},t.prototype.applySourceMap=function(e,n,r){var t=n;if(null==n){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');t=e.file}var o=this._sourceRoot;null!=o&&(t=i.relative(o,t));var a=new s,u=new s;this._mappings.unsortedForEach(function(n){if(n.source===t&&null!=n.originalLine){var s=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=s.source&&(n.source=s.source,null!=r&&(n.source=i.join(r,n.source)),null!=o&&(n.source=i.relative(o,n.source)),n.originalLine=s.line,n.originalColumn=s.column,null!=s.name&&(n.name=s.name))}var l=n.source;null==l||a.has(l)||a.add(l);var c=n.name;null==c||u.has(c)||u.add(c)},this),this._sources=a,this._names=u,e.sources.forEach(function(n){var t=e.sourceContentFor(n);null!=t&&(null!=r&&(n=i.join(r,n)),null!=o&&(n=i.relative(o,n)),this.setSourceContent(n,t))},this)},t.prototype._validateMapping=function(e,n,r,t){if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||n||r||t)&&!(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:n,name:t}))},t.prototype._serializeMappings=function(){for(var e,n,r,t=0,s=1,a=0,u=0,l=0,c=0,g="",p=this._mappings.toArray(),h=0,f=p.length;f>h;h++){if(e=p[h],e.generatedLine!==s)for(t=0;e.generatedLine!==s;)g+=";",s++;else if(h>0){if(!i.compareByGeneratedPositionsInflated(e,p[h-1]))continue;g+=","}g+=o.encode(e.generatedColumn-t),t=e.generatedColumn,null!=e.source&&(r=this._sources.indexOf(e.source),g+=o.encode(r-c),c=r,g+=o.encode(e.originalLine-1-u),u=e.originalLine-1,g+=o.encode(e.originalColumn-a),a=e.originalColumn,null!=e.name&&(n=this._names.indexOf(e.name),g+=o.encode(n-l),l=n))}return g},t.prototype._generateSourcesContent=function(e,n){return e.map(function(e){if(!this._sourcesContents)return null;null!=n&&(e=i.relative(n,e));var r=i.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},t.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},t.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=t},function(e,n,r){function t(e){return 0>e?(-e<<1)+1:(e<<1)+0}function o(e){var n=1===(1&e),r=e>>1;return n?-r:r}var i=r(3),s=5,a=1<>>=s,o>0&&(n|=l),r+=i.encode(n);while(o>0);return r},n.decode=function(e,n,r){var t,a,c=e.length,g=0,p=0;do{if(n>=c)throw new Error("Expected more digits in base 64 VLQ value.");if(a=i.decode(e.charCodeAt(n++)),-1===a)throw new Error("Invalid base64 digit: "+e.charAt(n-1));t=!!(a&l),a&=u,g+=a<=0&&e=n&&r>=e?e-n:e>=t&&o>=e?e-t+l:e>=i&&s>=e?e-i+c:e==a?62:e==u?63:-1}},function(e,n){function r(e,n,r){if(n in e)return e[n];if(3===arguments.length)return r;throw new Error('"'+n+'" is a required argument.')}function t(e){var n=e.match(f);return n?{scheme:n[1],auth:n[2],host:n[3],port:n[4],path:n[5]}:null}function o(e){var n="";return e.scheme&&(n+=e.scheme+":"),n+="//",e.auth&&(n+=e.auth+"@"),e.host&&(n+=e.host),e.port&&(n+=":"+e.port),e.path&&(n+=e.path),n}function i(e){var r=e,i=t(e);if(i){if(!i.path)return e;r=i.path}for(var s,a=n.isAbsolute(r),u=r.split(/\/+/),l=0,c=u.length-1;c>=0;c--)s=u[c],"."===s?u.splice(c,1):".."===s?l++:l>0&&(""===s?(u.splice(c+1,l),l=0):(u.splice(c,2),l--));return r=u.join("/"),""===r&&(r=a?"/":"."),i?(i.path=r,o(i)):r}function s(e,n){""===e&&(e="."),""===n&&(n=".");var r=t(n),s=t(e);if(s&&(e=s.path||"/"),r&&!r.scheme)return s&&(r.scheme=s.scheme),o(r);if(r||n.match(d))return n;if(s&&!s.host&&!s.path)return s.host=n,o(s);var a="/"===n.charAt(0)?n:i(e.replace(/\/+$/,"")+"/"+n);return s?(s.path=a,o(s)):a}function a(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==n.indexOf(e+"/");){var t=e.lastIndexOf("/");if(0>t)return n;if(e=e.slice(0,t),e.match(/^([^\/]+:\/)?\/*$/))return n;++r}return Array(r+1).join("../")+n.substr(e.length+1)}function u(e){return"$"+e}function l(e){return e.substr(1)}function c(e,n,r){var t=e.source-n.source;return 0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t||r?t:(t=e.generatedColumn-n.generatedColumn,0!==t?t:(t=e.generatedLine-n.generatedLine,0!==t?t:e.name-n.name))))}function g(e,n,r){var t=e.generatedLine-n.generatedLine;return 0!==t?t:(t=e.generatedColumn-n.generatedColumn,0!==t||r?t:(t=e.source-n.source,0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t?t:e.name-n.name))))}function p(e,n){return e===n?0:e>n?1:-1}function h(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r?r:(r=e.generatedColumn-n.generatedColumn,0!==r?r:(r=p(e.source,n.source),0!==r?r:(r=e.originalLine-n.originalLine,0!==r?r:(r=e.originalColumn-n.originalColumn,0!==r?r:p(e.name,n.name)))))}n.getArg=r;var f=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,d=/^data:.+\,.+$/;n.urlParse=t,n.urlGenerate=o,n.normalize=i,n.join=s,n.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(f)},n.relative=a,n.toSetString=u,n.fromSetString=l,n.compareByOriginalPositions=c,n.compareByGeneratedPositionsDeflated=g,n.compareByGeneratedPositionsInflated=h},function(e,n,r){function t(){this._array=[],this._set={}}var o=r(4);t.fromArray=function(e,n){for(var r=new t,o=0,i=e.length;i>o;o++)r.add(e[o],n);return r},t.prototype.size=function(){return Object.getOwnPropertyNames(this._set).length},t.prototype.add=function(e,n){var r=o.toSetString(e),t=this._set.hasOwnProperty(r),i=this._array.length;(!t||n)&&this._array.push(e),t||(this._set[r]=i)},t.prototype.has=function(e){var n=o.toSetString(e);return this._set.hasOwnProperty(n)},t.prototype.indexOf=function(e){var n=o.toSetString(e);if(this._set.hasOwnProperty(n))return this._set[n];throw new Error('"'+e+'" is not in the set.')},t.prototype.at=function(e){if(e>=0&&er||t==r&&s>=o||i.compareByGeneratedPositionsInflated(e,n)<=0}function o(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var i=r(4);o.prototype.unsortedForEach=function(e,n){this._array.forEach(e,n)},o.prototype.add=function(e){t(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},o.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},n.MappingList=o},function(e,n,r){function t(e){var n=e;return"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=n.sections?new s(n):new o(n)}function o(e){var n=e;"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=a.getArg(n,"version"),t=a.getArg(n,"sources"),o=a.getArg(n,"names",[]),i=a.getArg(n,"sourceRoot",null),s=a.getArg(n,"sourcesContent",null),u=a.getArg(n,"mappings"),c=a.getArg(n,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);t=t.map(a.normalize).map(function(e){return i&&a.isAbsolute(i)&&a.isAbsolute(e)?a.relative(i,e):e}),this._names=l.fromArray(o,!0),this._sources=l.fromArray(t,!0),this.sourceRoot=i,this.sourcesContent=s,this._mappings=u,this.file=c}function i(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function s(e){var n=e;"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=a.getArg(n,"version"),o=a.getArg(n,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new l,this._names=new l;var i={line:-1,column:0};this._sections=o.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var n=a.getArg(e,"offset"),r=a.getArg(n,"line"),o=a.getArg(n,"column");if(r=0){var i=this._originalMappings[o];if(void 0===e.column)for(var s=i.originalLine;i&&i.originalLine===s;)t.push({line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o];else for(var l=i.originalColumn;i&&i.originalLine===n&&i.originalColumn==l;)t.push({line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o]}return t},n.SourceMapConsumer=t,o.prototype=Object.create(t.prototype),o.prototype.consumer=t,o.fromSourceMap=function(e){var n=Object.create(o.prototype),r=n._names=l.fromArray(e._names.toArray(),!0),t=n._sources=l.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file;for(var s=e._mappings.toArray().slice(),u=n.__generatedMappings=[],c=n.__originalMappings=[],p=0,h=s.length;h>p;p++){var f=s[p],d=new i;d.generatedLine=f.generatedLine,d.generatedColumn=f.generatedColumn,f.source&&(d.source=t.indexOf(f.source),d.originalLine=f.originalLine,d.originalColumn=f.originalColumn,f.name&&(d.name=r.indexOf(f.name)),c.push(d)),u.push(d)}return g(n.__originalMappings,a.compareByOriginalPositions),n},o.prototype._version=3,Object.defineProperty(o.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return null!=this.sourceRoot?a.join(this.sourceRoot,e):e},this)}}),o.prototype._parseMappings=function(e,n){for(var r,t,o,s,u,l=1,p=0,h=0,f=0,d=0,m=0,_=e.length,v=0,y={},C={},A=[],S=[];_>v;)if(";"===e.charAt(v))l++,v++,p=0;else if(","===e.charAt(v))v++;else{for(r=new i,r.generatedLine=l,s=v;_>s&&!this._charIsMappingSeparator(e,s);s++);if(t=e.slice(v,s),o=y[t])v+=t.length;else{for(o=[];s>v;)c.decode(e,v,C),u=C.value,v=C.rest,o.push(u);if(2===o.length)throw new Error("Found a source, but no line and column");if(3===o.length)throw new Error("Found a source and line, but no column");y[t]=o}r.generatedColumn=p+o[0],p=r.generatedColumn,o.length>1&&(r.source=d+o[1],d+=o[1],r.originalLine=h+o[2],h=r.originalLine,r.originalLine+=1,r.originalColumn=f+o[3],f=r.originalColumn,o.length>4&&(r.name=m+o[4],m+=o[4])),S.push(r),"number"==typeof r.originalLine&&A.push(r)}g(S,a.compareByGeneratedPositionsDeflated),this.__generatedMappings=S,g(A,a.compareByOriginalPositions),this.__originalMappings=A},o.prototype._findMapping=function(e,n,r,t,o,i){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[t]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[t]);return u.search(e,n,o,i)},o.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=a.getArg(o,"source",null);null!==i&&(i=this._sources.at(i),null!=this.sourceRoot&&(i=a.join(this.sourceRoot,i)));var s=a.getArg(o,"name",null);return null!==s&&(s=this._names.at(s)),{source:i,line:a.getArg(o,"originalLine",null),column:a.getArg(o,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}},o.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}):!1},o.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=a.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=a.urlParse(this.sourceRoot))){var t=e.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(t))return this.sourcesContent[this._sources.indexOf(t)];if((!r.path||"/"==r.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(n)return null;throw new Error('"'+e+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(e){var n=a.getArg(e,"source");if(null!=this.sourceRoot&&(n=a.relative(this.sourceRoot,n)),!this._sources.has(n))return{line:null,column:null,lastColumn:null};n=this._sources.indexOf(n);var r={source:n,originalLine:a.getArg(e,"line"),originalColumn:a.getArg(e,"column")},o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,a.getArg(e,"bias",t.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=o,s.prototype=Object.create(t.prototype),s.prototype.constructor=t,s.prototype._version=3,Object.defineProperty(s.prototype,"sources",{get:function(){for(var e=[],n=0;n0?t-u>1?r(u,t,o,i,s,a):a==n.LEAST_UPPER_BOUND?t1?r(e,u,o,i,s,a):a==n.LEAST_UPPER_BOUND?u:0>e?-1:e}n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,t,o,i){if(0===t.length)return-1;var s=r(-1,t.length,e,t,o,i||n.GREATEST_LOWER_BOUND);if(0>s)return-1;for(;s-1>=0&&0===o(t[s],t[s-1],!0);)--s;return s}},function(e,n){function r(e,n,r){var t=e[n];e[n]=e[r],e[r]=t}function t(e,n){return Math.round(e+Math.random()*(n-e))}function o(e,n,i,s){if(s>i){var a=t(i,s),u=i-1;r(e,a,s);for(var l=e[s],c=i;s>c;c++)n(e[c],l)<=0&&(u+=1,r(e,u,c));r(e,u+1,c);var g=u+1;o(e,n,i,g-1),o(e,n,g+1,s)}}n.quickSort=function(e,n){o(e,n,0,e.length-1)}},function(e,n,r){function t(e,n,r,t,o){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==n?null:n,this.source=null==r?null:r,this.name=null==o?null:o,this[u]=!0,null!=t&&this.add(t)}var o=r(1).SourceMapGenerator,i=r(4),s=/(\r?\n)/,a=10,u="$$$isSourceNode$$$";t.fromStringWithSourceMap=function(e,n,r){function o(e,n){if(null===e||void 0===e.source)a.add(n);else{var o=r?i.join(r,e.source):e.source;a.add(new t(e.originalLine,e.originalColumn,o,n,e.name))}}var a=new t,u=e.split(s),l=function(){var e=u.shift(),n=u.shift()||"";return e+n},c=1,g=0,p=null;return n.eachMapping(function(e){if(null!==p){if(!(c0&&(p&&o(p,l()),a.add(u.join(""))),n.sources.forEach(function(e){var t=n.sourceContentFor(e);null!=t&&(null!=r&&(e=i.join(r,e)),a.setSourceContent(e,t))}),a},t.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},t.prototype.prepend=function(e){if(Array.isArray(e))for(var n=e.length-1;n>=0;n--)this.prepend(e[n]);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},t.prototype.walk=function(e){for(var n,r=0,t=this.children.length;t>r;r++)n=this.children[r],n[u]?n.walk(e):""!==n&&e(n,{source:this.source,line:this.line,column:this.column,name:this.name})},t.prototype.join=function(e){var n,r,t=this.children.length;if(t>0){for(n=[],r=0;t-1>r;r++)n.push(this.children[r]),n.push(e);n.push(this.children[r]),this.children=n}return this},t.prototype.replaceRight=function(e,n){var r=this.children[this.children.length-1];return r[u]?r.replaceRight(e,n):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,n):this.children.push("".replace(e,n)),this},t.prototype.setSourceContent=function(e,n){this.sourceContents[i.toSetString(e)]=n},t.prototype.walkSourceContents=function(e){for(var n=0,r=this.children.length;r>n;n++)this.children[n][u]&&this.children[n].walkSourceContents(e);for(var t=Object.keys(this.sourceContents),n=0,r=t.length;r>n;n++)e(i.fromSetString(t[n]),this.sourceContents[t[n]])},t.prototype.toString=function(){var e="";return this.walk(function(n){e+=n}),e},t.prototype.toStringWithSourceMap=function(e){var n={code:"",line:1,column:0},r=new o(e),t=!1,i=null,s=null,u=null,l=null;return this.walk(function(e,o){n.code+=e,null!==o.source&&null!==o.line&&null!==o.column?((i!==o.source||s!==o.line||u!==o.column||l!==o.name)&&r.addMapping({source:o.source,original:{line:o.line,column:o.column},generated:{line:n.line,column:n.column},name:o.name}),i=o.source,s=o.line,u=o.column,l=o.name,t=!0):t&&(r.addMapping({generated:{line:n.line,column:n.column}}),i=null,t=!1);for(var c=0,g=e.length;g>c;c++)e.charCodeAt(c)===a?(n.line++,n.column=0,c+1===g?(i=null,t=!1):t&&r.addMapping({source:o.source,original:{line:o.line,column:o.column},generated:{line:n.line,column:n.column},name:o.name})):n.column++}),this.walkSourceContents(function(e,n){r.setSourceContent(e,n)}),{code:n.code,map:r}},n.SourceNode=t}])}); -//# sourceMappingURL=source-map.min.js.map \ No newline at end of file diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.min.js.map b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.min.js.map deleted file mode 100644 index 8470bde426..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/dist/source-map.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///source-map.min.js","webpack:///webpack/bootstrap a7d787c028005295f8d2","webpack:///./source-map.js","webpack:///./lib/source-map-generator.js","webpack:///./lib/base64-vlq.js","webpack:///./lib/base64.js","webpack:///./lib/util.js","webpack:///./lib/array-set.js","webpack:///./lib/mapping-list.js","webpack:///./lib/source-map-consumer.js","webpack:///./lib/binary-search.js","webpack:///./lib/quick-sort.js","webpack:///./lib/source-node.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","SourceMapGenerator","SourceMapConsumer","SourceNode","aArgs","_file","util","getArg","_sourceRoot","_skipValidation","_sources","ArraySet","_names","_mappings","MappingList","_sourcesContents","base64VLQ","prototype","_version","fromSourceMap","aSourceMapConsumer","sourceRoot","generator","file","eachMapping","mapping","newMapping","generated","line","generatedLine","column","generatedColumn","source","relative","original","originalLine","originalColumn","name","addMapping","sources","forEach","sourceFile","content","sourceContentFor","setSourceContent","_validateMapping","has","add","aSourceFile","aSourceContent","toSetString","Object","keys","length","applySourceMap","aSourceMapPath","Error","newSources","newNames","unsortedForEach","originalPositionFor","join","aGenerated","aOriginal","aSource","aName","JSON","stringify","_serializeMappings","nameIdx","sourceIdx","previousGeneratedColumn","previousGeneratedLine","previousOriginalColumn","previousOriginalLine","previousName","previousSource","result","mappings","toArray","i","len","compareByGeneratedPositionsInflated","encode","indexOf","_generateSourcesContent","aSources","aSourceRoot","map","key","hasOwnProperty","toJSON","version","names","sourcesContent","toString","toVLQSigned","aValue","fromVLQSigned","isNegative","shifted","base64","VLQ_BASE_SHIFT","VLQ_BASE","VLQ_BASE_MASK","VLQ_CONTINUATION_BIT","digit","encoded","vlq","decode","aStr","aIndex","aOutParam","continuation","strLen","shift","charCodeAt","charAt","value","rest","intToCharMap","split","number","TypeError","charCode","bigA","bigZ","littleA","littleZ","zero","nine","plus","slash","littleOffset","numberOffset","aDefaultValue","arguments","urlParse","aUrl","match","urlRegexp","scheme","auth","host","port","path","urlGenerate","aParsedUrl","url","normalize","aPath","part","isAbsolute","parts","up","splice","aRoot","aPathUrl","aRootUrl","dataUrlRegexp","joined","replace","level","index","lastIndexOf","slice","Array","substr","fromSetString","compareByOriginalPositions","mappingA","mappingB","onlyCompareOriginal","cmp","compareByGeneratedPositionsDeflated","onlyCompareGenerated","strcmp","aStr1","aStr2","_array","_set","fromArray","aArray","aAllowDuplicates","set","size","getOwnPropertyNames","sStr","isDuplicate","idx","push","at","aIdx","generatedPositionAfter","lineA","lineB","columnA","columnB","_sorted","_last","aCallback","aThisArg","aMapping","sort","aSourceMap","sourceMap","parse","sections","IndexedSourceMapConsumer","BasicSourceMapConsumer","Mapping","lastOffset","_sections","s","offset","offsetLine","offsetColumn","generatedOffset","consumer","binarySearch","quickSort","__generatedMappings","defineProperty","get","_parseMappings","__originalMappings","_charIsMappingSeparator","GENERATED_ORDER","ORIGINAL_ORDER","GREATEST_LOWER_BOUND","LEAST_UPPER_BOUND","aContext","aOrder","context","order","_generatedMappings","_originalMappings","allGeneratedPositionsFor","needle","_findMapping","undefined","lastColumn","create","smc","generatedMappings","destGeneratedMappings","destOriginalMappings","srcMapping","destMapping","str","segment","end","cachedSegments","temp","originalMappings","aNeedle","aMappings","aLineName","aColumnName","aComparator","aBias","search","computeColumnSpans","nextMapping","lastGeneratedColumn","Infinity","hasContentsOfAllSources","some","sc","nullOnMissing","fileUriAbsPath","generatedPositionFor","constructor","j","sectionIndex","section","bias","every","generatedPosition","ret","sectionMappings","adjustedMapping","recursiveSearch","aLow","aHigh","aHaystack","aCompare","mid","Math","floor","swap","ary","x","y","randomIntInRange","low","high","round","random","doQuickSort","comparator","r","pivotIndex","pivot","q","aLine","aColumn","aChunks","children","sourceContents","isSourceNode","REGEX_NEWLINE","NEWLINE_CODE","fromStringWithSourceMap","aGeneratedCode","aRelativePath","addMappingWithCode","code","node","remainingLines","shiftNextLine","lineContents","newLine","lastGeneratedLine","lastMapping","nextLine","aChunk","isArray","chunk","prepend","unshift","walk","aFn","aSep","newChildren","replaceRight","aPattern","aReplacement","lastChild","walkSourceContents","toStringWithSourceMap","sourceMappingActive","lastOriginalSource","lastOriginalLine","lastOriginalColumn","lastOriginalName","sourceContent"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,UAAAD,IAEAD,EAAA,UAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAASL,EAAQD,EAASM,GEjDhCN,EAAAe,mBAAAT,EAAA,GAAAS,mBACAf,EAAAgB,kBAAAV,EAAA,GAAAU,kBACAhB,EAAAiB,WAAAX,EAAA,IAAAW,YF6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EAAA,KACAC,EAAA,KACAC,EAAA,IAqEA,OApEAnW,MAAAqV,KAAA,SAAAH,EAAAtS,GACAP,EAAAkS,MAAAW,EACA,OAAAtS,EAAAF,QACA,OAAAE,EAAAN,MACA,OAAAM,EAAAJ,SACAwT,IAAApT,EAAAF,QACAuT,IAAArT,EAAAN,MACA4T,IAAAtT,EAAAJ,QACA2T,IAAAvT,EAAAG,OACAmD,EAAAlD,YACAN,OAAAE,EAAAF,OACAE,UACAN,KAAAM,EAAAN,KACAE,OAAAI,EAAAJ,QAEAH,WACAC,KAAAD,EAAAC,KACAE,OAAAH,EAAAG,QAEAO,KAAAH,EAAAG,OAGAiT,EAAApT,EAAAF,OACAuT,EAAArT,EAAAN,KACA4T,EAAAtT,EAAAJ,OACA2T,EAAAvT,EAAAG,KACAgT,GAAA,GACOA,IACP7P,EAAAlD,YACAX,WACAC,KAAAD,EAAAC,KACAE,OAAAH,EAAAG,UAGAwT,EAAA,KACAD,GAAA,EAEA,QAAAxJ,GAAA,EAAAxI,EAAAmR,EAAAnR,OAA8CA,EAAAwI,EAAcA,IAC5D2I,EAAApN,WAAAyE,KAAA2H,GACA7R,EAAAC,OACAD,EAAAG,OAAA,EAEA+J,EAAA,IAAAxI,GACAiS,EAAA,KACAD,GAAA,GACWA,GACX7P,EAAAlD,YACAN,OAAAE,EAAAF,OACAE,UACAN,KAAAM,EAAAN,KACAE,OAAAI,EAAAJ,QAEAH,WACAC,KAAAD,EAAAC,KACAE,OAAAH,EAAAG,QAEAO,KAAAH,EAAAG,QAIAV,EAAAG,WAIAxC,KAAA6V,mBAAA,SAAA1S,EAAAiT,GACAlQ,EAAA5C,iBAAAH,EAAAiT,MAGY7B,KAAAlS,EAAAkS,KAAArO,QAGZtG,EAAAiB","file":"source-map.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"sourceMap\"] = factory();\n\telse\n\t\troot[\"sourceMap\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"sourceMap\"] = factory();\n\telse\n\t\troot[\"sourceMap\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/*\n\t * Copyright 2009-2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE.txt or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\texports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator;\n\texports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer;\n\texports.SourceNode = __webpack_require__(10).SourceNode;\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t{\n\t var base64VLQ = __webpack_require__(2);\n\t var util = __webpack_require__(4);\n\t var ArraySet = __webpack_require__(5).ArraySet;\n\t var MappingList = __webpack_require__(6).MappingList;\n\t\n\t /**\n\t * An instance of the SourceMapGenerator represents a source map which is\n\t * being built incrementally. You may pass an object with the following\n\t * properties:\n\t *\n\t * - file: The filename of the generated source.\n\t * - sourceRoot: A root for all relative URLs in this source map.\n\t */\n\t function SourceMapGenerator(aArgs) {\n\t if (!aArgs) {\n\t aArgs = {};\n\t }\n\t this._file = util.getArg(aArgs, 'file', null);\n\t this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);\n\t this._skipValidation = util.getArg(aArgs, 'skipValidation', false);\n\t this._sources = new ArraySet();\n\t this._names = new ArraySet();\n\t this._mappings = new MappingList();\n\t this._sourcesContents = null;\n\t }\n\t\n\t SourceMapGenerator.prototype._version = 3;\n\t\n\t /**\n\t * Creates a new SourceMapGenerator based on a SourceMapConsumer\n\t *\n\t * @param aSourceMapConsumer The SourceMap.\n\t */\n\t SourceMapGenerator.fromSourceMap =\n\t function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {\n\t var sourceRoot = aSourceMapConsumer.sourceRoot;\n\t var generator = new SourceMapGenerator({\n\t file: aSourceMapConsumer.file,\n\t sourceRoot: sourceRoot\n\t });\n\t aSourceMapConsumer.eachMapping(function (mapping) {\n\t var newMapping = {\n\t generated: {\n\t line: mapping.generatedLine,\n\t column: mapping.generatedColumn\n\t }\n\t };\n\t\n\t if (mapping.source != null) {\n\t newMapping.source = mapping.source;\n\t if (sourceRoot != null) {\n\t newMapping.source = util.relative(sourceRoot, newMapping.source);\n\t }\n\t\n\t newMapping.original = {\n\t line: mapping.originalLine,\n\t column: mapping.originalColumn\n\t };\n\t\n\t if (mapping.name != null) {\n\t newMapping.name = mapping.name;\n\t }\n\t }\n\t\n\t generator.addMapping(newMapping);\n\t });\n\t aSourceMapConsumer.sources.forEach(function (sourceFile) {\n\t var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n\t if (content != null) {\n\t generator.setSourceContent(sourceFile, content);\n\t }\n\t });\n\t return generator;\n\t };\n\t\n\t /**\n\t * Add a single mapping from original source line and column to the generated\n\t * source's line and column for this source map being created. The mapping\n\t * object should have the following properties:\n\t *\n\t * - generated: An object with the generated line and column positions.\n\t * - original: An object with the original line and column positions.\n\t * - source: The original source file (relative to the sourceRoot).\n\t * - name: An optional original token name for this mapping.\n\t */\n\t SourceMapGenerator.prototype.addMapping =\n\t function SourceMapGenerator_addMapping(aArgs) {\n\t var generated = util.getArg(aArgs, 'generated');\n\t var original = util.getArg(aArgs, 'original', null);\n\t var source = util.getArg(aArgs, 'source', null);\n\t var name = util.getArg(aArgs, 'name', null);\n\t\n\t if (!this._skipValidation) {\n\t this._validateMapping(generated, original, source, name);\n\t }\n\t\n\t if (source != null && !this._sources.has(source)) {\n\t this._sources.add(source);\n\t }\n\t\n\t if (name != null && !this._names.has(name)) {\n\t this._names.add(name);\n\t }\n\t\n\t this._mappings.add({\n\t generatedLine: generated.line,\n\t generatedColumn: generated.column,\n\t originalLine: original != null && original.line,\n\t originalColumn: original != null && original.column,\n\t source: source,\n\t name: name\n\t });\n\t };\n\t\n\t /**\n\t * Set the source content for a source file.\n\t */\n\t SourceMapGenerator.prototype.setSourceContent =\n\t function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {\n\t var source = aSourceFile;\n\t if (this._sourceRoot != null) {\n\t source = util.relative(this._sourceRoot, source);\n\t }\n\t\n\t if (aSourceContent != null) {\n\t // Add the source content to the _sourcesContents map.\n\t // Create a new _sourcesContents map if the property is null.\n\t if (!this._sourcesContents) {\n\t this._sourcesContents = {};\n\t }\n\t this._sourcesContents[util.toSetString(source)] = aSourceContent;\n\t } else if (this._sourcesContents) {\n\t // Remove the source file from the _sourcesContents map.\n\t // If the _sourcesContents map is empty, set the property to null.\n\t delete this._sourcesContents[util.toSetString(source)];\n\t if (Object.keys(this._sourcesContents).length === 0) {\n\t this._sourcesContents = null;\n\t }\n\t }\n\t };\n\t\n\t /**\n\t * Applies the mappings of a sub-source-map for a specific source file to the\n\t * source map being generated. Each mapping to the supplied source file is\n\t * rewritten using the supplied source map. Note: The resolution for the\n\t * resulting mappings is the minimium of this map and the supplied map.\n\t *\n\t * @param aSourceMapConsumer The source map to be applied.\n\t * @param aSourceFile Optional. The filename of the source file.\n\t * If omitted, SourceMapConsumer's file property will be used.\n\t * @param aSourceMapPath Optional. The dirname of the path to the source map\n\t * to be applied. If relative, it is relative to the SourceMapConsumer.\n\t * This parameter is needed when the two source maps aren't in the same\n\t * directory, and the source map to be applied contains relative source\n\t * paths. If so, those relative source paths need to be rewritten\n\t * relative to the SourceMapGenerator.\n\t */\n\t SourceMapGenerator.prototype.applySourceMap =\n\t function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {\n\t var sourceFile = aSourceFile;\n\t // If aSourceFile is omitted, we will use the file property of the SourceMap\n\t if (aSourceFile == null) {\n\t if (aSourceMapConsumer.file == null) {\n\t throw new Error(\n\t 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +\n\t 'or the source map\\'s \"file\" property. Both were omitted.'\n\t );\n\t }\n\t sourceFile = aSourceMapConsumer.file;\n\t }\n\t var sourceRoot = this._sourceRoot;\n\t // Make \"sourceFile\" relative if an absolute Url is passed.\n\t if (sourceRoot != null) {\n\t sourceFile = util.relative(sourceRoot, sourceFile);\n\t }\n\t // Applying the SourceMap can add and remove items from the sources and\n\t // the names array.\n\t var newSources = new ArraySet();\n\t var newNames = new ArraySet();\n\t\n\t // Find mappings for the \"sourceFile\"\n\t this._mappings.unsortedForEach(function (mapping) {\n\t if (mapping.source === sourceFile && mapping.originalLine != null) {\n\t // Check if it can be mapped by the source map, then update the mapping.\n\t var original = aSourceMapConsumer.originalPositionFor({\n\t line: mapping.originalLine,\n\t column: mapping.originalColumn\n\t });\n\t if (original.source != null) {\n\t // Copy mapping\n\t mapping.source = original.source;\n\t if (aSourceMapPath != null) {\n\t mapping.source = util.join(aSourceMapPath, mapping.source)\n\t }\n\t if (sourceRoot != null) {\n\t mapping.source = util.relative(sourceRoot, mapping.source);\n\t }\n\t mapping.originalLine = original.line;\n\t mapping.originalColumn = original.column;\n\t if (original.name != null) {\n\t mapping.name = original.name;\n\t }\n\t }\n\t }\n\t\n\t var source = mapping.source;\n\t if (source != null && !newSources.has(source)) {\n\t newSources.add(source);\n\t }\n\t\n\t var name = mapping.name;\n\t if (name != null && !newNames.has(name)) {\n\t newNames.add(name);\n\t }\n\t\n\t }, this);\n\t this._sources = newSources;\n\t this._names = newNames;\n\t\n\t // Copy sourcesContents of applied map.\n\t aSourceMapConsumer.sources.forEach(function (sourceFile) {\n\t var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n\t if (content != null) {\n\t if (aSourceMapPath != null) {\n\t sourceFile = util.join(aSourceMapPath, sourceFile);\n\t }\n\t if (sourceRoot != null) {\n\t sourceFile = util.relative(sourceRoot, sourceFile);\n\t }\n\t this.setSourceContent(sourceFile, content);\n\t }\n\t }, this);\n\t };\n\t\n\t /**\n\t * A mapping can have one of the three levels of data:\n\t *\n\t * 1. Just the generated position.\n\t * 2. The Generated position, original position, and original source.\n\t * 3. Generated and original position, original source, as well as a name\n\t * token.\n\t *\n\t * To maintain consistency, we validate that any new mapping being added falls\n\t * in to one of these categories.\n\t */\n\t SourceMapGenerator.prototype._validateMapping =\n\t function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n\t aName) {\n\t if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n\t && aGenerated.line > 0 && aGenerated.column >= 0\n\t && !aOriginal && !aSource && !aName) {\n\t // Case 1.\n\t return;\n\t }\n\t else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n\t && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n\t && aGenerated.line > 0 && aGenerated.column >= 0\n\t && aOriginal.line > 0 && aOriginal.column >= 0\n\t && aSource) {\n\t // Cases 2 and 3.\n\t return;\n\t }\n\t else {\n\t throw new Error('Invalid mapping: ' + JSON.stringify({\n\t generated: aGenerated,\n\t source: aSource,\n\t original: aOriginal,\n\t name: aName\n\t }));\n\t }\n\t };\n\t\n\t /**\n\t * Serialize the accumulated mappings in to the stream of base 64 VLQs\n\t * specified by the source map format.\n\t */\n\t SourceMapGenerator.prototype._serializeMappings =\n\t function SourceMapGenerator_serializeMappings() {\n\t var previousGeneratedColumn = 0;\n\t var previousGeneratedLine = 1;\n\t var previousOriginalColumn = 0;\n\t var previousOriginalLine = 0;\n\t var previousName = 0;\n\t var previousSource = 0;\n\t var result = '';\n\t var mapping;\n\t var nameIdx;\n\t var sourceIdx;\n\t\n\t var mappings = this._mappings.toArray();\n\t for (var i = 0, len = mappings.length; i < len; i++) {\n\t mapping = mappings[i];\n\t\n\t if (mapping.generatedLine !== previousGeneratedLine) {\n\t previousGeneratedColumn = 0;\n\t while (mapping.generatedLine !== previousGeneratedLine) {\n\t result += ';';\n\t previousGeneratedLine++;\n\t }\n\t }\n\t else {\n\t if (i > 0) {\n\t if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n\t continue;\n\t }\n\t result += ',';\n\t }\n\t }\n\t\n\t result += base64VLQ.encode(mapping.generatedColumn\n\t - previousGeneratedColumn);\n\t previousGeneratedColumn = mapping.generatedColumn;\n\t\n\t if (mapping.source != null) {\n\t sourceIdx = this._sources.indexOf(mapping.source);\n\t result += base64VLQ.encode(sourceIdx - previousSource);\n\t previousSource = sourceIdx;\n\t\n\t // lines are stored 0-based in SourceMap spec version 3\n\t result += base64VLQ.encode(mapping.originalLine - 1\n\t - previousOriginalLine);\n\t previousOriginalLine = mapping.originalLine - 1;\n\t\n\t result += base64VLQ.encode(mapping.originalColumn\n\t - previousOriginalColumn);\n\t previousOriginalColumn = mapping.originalColumn;\n\t\n\t if (mapping.name != null) {\n\t nameIdx = this._names.indexOf(mapping.name);\n\t result += base64VLQ.encode(nameIdx - previousName);\n\t previousName = nameIdx;\n\t }\n\t }\n\t }\n\t\n\t return result;\n\t };\n\t\n\t SourceMapGenerator.prototype._generateSourcesContent =\n\t function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n\t return aSources.map(function (source) {\n\t if (!this._sourcesContents) {\n\t return null;\n\t }\n\t if (aSourceRoot != null) {\n\t source = util.relative(aSourceRoot, source);\n\t }\n\t var key = util.toSetString(source);\n\t return Object.prototype.hasOwnProperty.call(this._sourcesContents,\n\t key)\n\t ? this._sourcesContents[key]\n\t : null;\n\t }, this);\n\t };\n\t\n\t /**\n\t * Externalize the source map.\n\t */\n\t SourceMapGenerator.prototype.toJSON =\n\t function SourceMapGenerator_toJSON() {\n\t var map = {\n\t version: this._version,\n\t sources: this._sources.toArray(),\n\t names: this._names.toArray(),\n\t mappings: this._serializeMappings()\n\t };\n\t if (this._file != null) {\n\t map.file = this._file;\n\t }\n\t if (this._sourceRoot != null) {\n\t map.sourceRoot = this._sourceRoot;\n\t }\n\t if (this._sourcesContents) {\n\t map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n\t }\n\t\n\t return map;\n\t };\n\t\n\t /**\n\t * Render the source map being generated to a string.\n\t */\n\t SourceMapGenerator.prototype.toString =\n\t function SourceMapGenerator_toString() {\n\t return JSON.stringify(this.toJSON());\n\t };\n\t\n\t exports.SourceMapGenerator = SourceMapGenerator;\n\t}\n\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t *\n\t * Based on the Base 64 VLQ implementation in Closure Compiler:\n\t * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n\t *\n\t * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n\t * Redistribution and use in source and binary forms, with or without\n\t * modification, are permitted provided that the following conditions are\n\t * met:\n\t *\n\t * * Redistributions of source code must retain the above copyright\n\t * notice, this list of conditions and the following disclaimer.\n\t * * Redistributions in binary form must reproduce the above\n\t * copyright notice, this list of conditions and the following\n\t * disclaimer in the documentation and/or other materials provided\n\t * with the distribution.\n\t * * Neither the name of Google Inc. nor the names of its\n\t * contributors may be used to endorse or promote products derived\n\t * from this software without specific prior written permission.\n\t *\n\t * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\t * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\t * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\t * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\t * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n\t * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\t * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\t * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\t * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t */\n\t{\n\t var base64 = __webpack_require__(3);\n\t\n\t // A single base 64 digit can contain 6 bits of data. For the base 64 variable\n\t // length quantities we use in the source map spec, the first bit is the sign,\n\t // the next four bits are the actual value, and the 6th bit is the\n\t // continuation bit. The continuation bit tells us whether there are more\n\t // digits in this value following this digit.\n\t //\n\t // Continuation\n\t // | Sign\n\t // | |\n\t // V V\n\t // 101011\n\t\n\t var VLQ_BASE_SHIFT = 5;\n\t\n\t // binary: 100000\n\t var VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\t\n\t // binary: 011111\n\t var VLQ_BASE_MASK = VLQ_BASE - 1;\n\t\n\t // binary: 100000\n\t var VLQ_CONTINUATION_BIT = VLQ_BASE;\n\t\n\t /**\n\t * Converts from a two-complement value to a value where the sign bit is\n\t * placed in the least significant bit. For example, as decimals:\n\t * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n\t * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n\t */\n\t function toVLQSigned(aValue) {\n\t return aValue < 0\n\t ? ((-aValue) << 1) + 1\n\t : (aValue << 1) + 0;\n\t }\n\t\n\t /**\n\t * Converts to a two-complement value from a value where the sign bit is\n\t * placed in the least significant bit. For example, as decimals:\n\t * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n\t * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n\t */\n\t function fromVLQSigned(aValue) {\n\t var isNegative = (aValue & 1) === 1;\n\t var shifted = aValue >> 1;\n\t return isNegative\n\t ? -shifted\n\t : shifted;\n\t }\n\t\n\t /**\n\t * Returns the base 64 VLQ encoded value.\n\t */\n\t exports.encode = function base64VLQ_encode(aValue) {\n\t var encoded = \"\";\n\t var digit;\n\t\n\t var vlq = toVLQSigned(aValue);\n\t\n\t do {\n\t digit = vlq & VLQ_BASE_MASK;\n\t vlq >>>= VLQ_BASE_SHIFT;\n\t if (vlq > 0) {\n\t // There are still more digits in this value, so we must make sure the\n\t // continuation bit is marked.\n\t digit |= VLQ_CONTINUATION_BIT;\n\t }\n\t encoded += base64.encode(digit);\n\t } while (vlq > 0);\n\t\n\t return encoded;\n\t };\n\t\n\t /**\n\t * Decodes the next base 64 VLQ value from the given string and returns the\n\t * value and the rest of the string via the out parameter.\n\t */\n\t exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n\t var strLen = aStr.length;\n\t var result = 0;\n\t var shift = 0;\n\t var continuation, digit;\n\t\n\t do {\n\t if (aIndex >= strLen) {\n\t throw new Error(\"Expected more digits in base 64 VLQ value.\");\n\t }\n\t\n\t digit = base64.decode(aStr.charCodeAt(aIndex++));\n\t if (digit === -1) {\n\t throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n\t }\n\t\n\t continuation = !!(digit & VLQ_CONTINUATION_BIT);\n\t digit &= VLQ_BASE_MASK;\n\t result = result + (digit << shift);\n\t shift += VLQ_BASE_SHIFT;\n\t } while (continuation);\n\t\n\t aOutParam.value = fromVLQSigned(result);\n\t aOutParam.rest = aIndex;\n\t };\n\t}\n\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t{\n\t var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\t\n\t /**\n\t * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n\t */\n\t exports.encode = function (number) {\n\t if (0 <= number && number < intToCharMap.length) {\n\t return intToCharMap[number];\n\t }\n\t throw new TypeError(\"Must be between 0 and 63: \" + number);\n\t };\n\t\n\t /**\n\t * Decode a single base 64 character code digit to an integer. Returns -1 on\n\t * failure.\n\t */\n\t exports.decode = function (charCode) {\n\t var bigA = 65; // 'A'\n\t var bigZ = 90; // 'Z'\n\t\n\t var littleA = 97; // 'a'\n\t var littleZ = 122; // 'z'\n\t\n\t var zero = 48; // '0'\n\t var nine = 57; // '9'\n\t\n\t var plus = 43; // '+'\n\t var slash = 47; // '/'\n\t\n\t var littleOffset = 26;\n\t var numberOffset = 52;\n\t\n\t // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\t if (bigA <= charCode && charCode <= bigZ) {\n\t return (charCode - bigA);\n\t }\n\t\n\t // 26 - 51: abcdefghijklmnopqrstuvwxyz\n\t if (littleA <= charCode && charCode <= littleZ) {\n\t return (charCode - littleA + littleOffset);\n\t }\n\t\n\t // 52 - 61: 0123456789\n\t if (zero <= charCode && charCode <= nine) {\n\t return (charCode - zero + numberOffset);\n\t }\n\t\n\t // 62: +\n\t if (charCode == plus) {\n\t return 62;\n\t }\n\t\n\t // 63: /\n\t if (charCode == slash) {\n\t return 63;\n\t }\n\t\n\t // Invalid base64 digit.\n\t return -1;\n\t };\n\t}\n\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t{\n\t /**\n\t * This is a helper function for getting values from parameter/options\n\t * objects.\n\t *\n\t * @param args The object we are extracting values from\n\t * @param name The name of the property we are getting.\n\t * @param defaultValue An optional value to return if the property is missing\n\t * from the object. If this is not specified and the property is missing, an\n\t * error will be thrown.\n\t */\n\t function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t }\n\t exports.getArg = getArg;\n\t\n\t var urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.]*)(?::(\\d+))?(\\S*)$/;\n\t var dataUrlRegexp = /^data:.+\\,.+$/;\n\t\n\t function urlParse(aUrl) {\n\t var match = aUrl.match(urlRegexp);\n\t if (!match) {\n\t return null;\n\t }\n\t return {\n\t scheme: match[1],\n\t auth: match[2],\n\t host: match[3],\n\t port: match[4],\n\t path: match[5]\n\t };\n\t }\n\t exports.urlParse = urlParse;\n\t\n\t function urlGenerate(aParsedUrl) {\n\t var url = '';\n\t if (aParsedUrl.scheme) {\n\t url += aParsedUrl.scheme + ':';\n\t }\n\t url += '//';\n\t if (aParsedUrl.auth) {\n\t url += aParsedUrl.auth + '@';\n\t }\n\t if (aParsedUrl.host) {\n\t url += aParsedUrl.host;\n\t }\n\t if (aParsedUrl.port) {\n\t url += \":\" + aParsedUrl.port\n\t }\n\t if (aParsedUrl.path) {\n\t url += aParsedUrl.path;\n\t }\n\t return url;\n\t }\n\t exports.urlGenerate = urlGenerate;\n\t\n\t /**\n\t * Normalizes a path, or the path portion of a URL:\n\t *\n\t * - Replaces consequtive slashes with one slash.\n\t * - Removes unnecessary '.' parts.\n\t * - Removes unnecessary '/..' parts.\n\t *\n\t * Based on code in the Node.js 'path' core module.\n\t *\n\t * @param aPath The path or url to normalize.\n\t */\n\t function normalize(aPath) {\n\t var path = aPath;\n\t var url = urlParse(aPath);\n\t if (url) {\n\t if (!url.path) {\n\t return aPath;\n\t }\n\t path = url.path;\n\t }\n\t var isAbsolute = exports.isAbsolute(path);\n\t\n\t var parts = path.split(/\\/+/);\n\t for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n\t part = parts[i];\n\t if (part === '.') {\n\t parts.splice(i, 1);\n\t } else if (part === '..') {\n\t up++;\n\t } else if (up > 0) {\n\t if (part === '') {\n\t // The first part is blank if the path is absolute. Trying to go\n\t // above the root is a no-op. Therefore we can remove all '..' parts\n\t // directly after the root.\n\t parts.splice(i + 1, up);\n\t up = 0;\n\t } else {\n\t parts.splice(i, 2);\n\t up--;\n\t }\n\t }\n\t }\n\t path = parts.join('/');\n\t\n\t if (path === '') {\n\t path = isAbsolute ? '/' : '.';\n\t }\n\t\n\t if (url) {\n\t url.path = path;\n\t return urlGenerate(url);\n\t }\n\t return path;\n\t }\n\t exports.normalize = normalize;\n\t\n\t /**\n\t * Joins two paths/URLs.\n\t *\n\t * @param aRoot The root path or URL.\n\t * @param aPath The path or URL to be joined with the root.\n\t *\n\t * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n\t * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n\t * first.\n\t * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n\t * is updated with the result and aRoot is returned. Otherwise the result\n\t * is returned.\n\t * - If aPath is absolute, the result is aPath.\n\t * - Otherwise the two paths are joined with a slash.\n\t * - Joining for example 'http://' and 'www.example.com' is also supported.\n\t */\n\t function join(aRoot, aPath) {\n\t if (aRoot === \"\") {\n\t aRoot = \".\";\n\t }\n\t if (aPath === \"\") {\n\t aPath = \".\";\n\t }\n\t var aPathUrl = urlParse(aPath);\n\t var aRootUrl = urlParse(aRoot);\n\t if (aRootUrl) {\n\t aRoot = aRootUrl.path || '/';\n\t }\n\t\n\t // `join(foo, '//www.example.org')`\n\t if (aPathUrl && !aPathUrl.scheme) {\n\t if (aRootUrl) {\n\t aPathUrl.scheme = aRootUrl.scheme;\n\t }\n\t return urlGenerate(aPathUrl);\n\t }\n\t\n\t if (aPathUrl || aPath.match(dataUrlRegexp)) {\n\t return aPath;\n\t }\n\t\n\t // `join('http://', 'www.example.com')`\n\t if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n\t aRootUrl.host = aPath;\n\t return urlGenerate(aRootUrl);\n\t }\n\t\n\t var joined = aPath.charAt(0) === '/'\n\t ? aPath\n\t : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\t\n\t if (aRootUrl) {\n\t aRootUrl.path = joined;\n\t return urlGenerate(aRootUrl);\n\t }\n\t return joined;\n\t }\n\t exports.join = join;\n\t\n\t exports.isAbsolute = function (aPath) {\n\t return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);\n\t };\n\t\n\t /**\n\t * Make a path relative to a URL or another path.\n\t *\n\t * @param aRoot The root path or URL.\n\t * @param aPath The path or URL to be made relative to aRoot.\n\t */\n\t function relative(aRoot, aPath) {\n\t if (aRoot === \"\") {\n\t aRoot = \".\";\n\t }\n\t\n\t aRoot = aRoot.replace(/\\/$/, '');\n\t\n\t // It is possible for the path to be above the root. In this case, simply\n\t // checking whether the root is a prefix of the path won't work. Instead, we\n\t // need to remove components from the root one by one, until either we find\n\t // a prefix that fits, or we run out of components to remove.\n\t var level = 0;\n\t while (aPath.indexOf(aRoot + '/') !== 0) {\n\t var index = aRoot.lastIndexOf(\"/\");\n\t if (index < 0) {\n\t return aPath;\n\t }\n\t\n\t // If the only part of the root that is left is the scheme (i.e. http://,\n\t // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n\t // have exhausted all components, so the path is not relative to the root.\n\t aRoot = aRoot.slice(0, index);\n\t if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n\t return aPath;\n\t }\n\t\n\t ++level;\n\t }\n\t\n\t // Make sure we add a \"../\" for each component we removed from the root.\n\t return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n\t }\n\t exports.relative = relative;\n\t\n\t /**\n\t * Because behavior goes wacky when you set `__proto__` on objects, we\n\t * have to prefix all the strings in our set with an arbitrary character.\n\t *\n\t * See https://github.com/mozilla/source-map/pull/31 and\n\t * https://github.com/mozilla/source-map/issues/30\n\t *\n\t * @param String aStr\n\t */\n\t function toSetString(aStr) {\n\t return '$' + aStr;\n\t }\n\t exports.toSetString = toSetString;\n\t\n\t function fromSetString(aStr) {\n\t return aStr.substr(1);\n\t }\n\t exports.fromSetString = fromSetString;\n\t\n\t /**\n\t * Comparator between two mappings where the original positions are compared.\n\t *\n\t * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n\t * mappings with the same original source/line/column, but different generated\n\t * line and column the same. Useful when searching for a mapping with a\n\t * stubbed out mapping.\n\t */\n\t function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n\t var cmp = mappingA.source - mappingB.source;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0 || onlyCompareOriginal) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return mappingA.name - mappingB.name;\n\t }\n\t exports.compareByOriginalPositions = compareByOriginalPositions;\n\t\n\t /**\n\t * Comparator between two mappings with deflated source and name indices where\n\t * the generated positions are compared.\n\t *\n\t * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n\t * mappings with the same generated line and column, but different\n\t * source/name/original line and column the same. Useful when searching for a\n\t * mapping with a stubbed out mapping.\n\t */\n\t function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n\t var cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0 || onlyCompareGenerated) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.source - mappingB.source;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return mappingA.name - mappingB.name;\n\t }\n\t exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\t\n\t function strcmp(aStr1, aStr2) {\n\t if (aStr1 === aStr2) {\n\t return 0;\n\t }\n\t\n\t if (aStr1 > aStr2) {\n\t return 1;\n\t }\n\t\n\t return -1;\n\t }\n\t\n\t /**\n\t * Comparator between two mappings with inflated source and name strings where\n\t * the generated positions are compared.\n\t */\n\t function compareByGeneratedPositionsInflated(mappingA, mappingB) {\n\t var cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = strcmp(mappingA.source, mappingB.source);\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return strcmp(mappingA.name, mappingB.name);\n\t }\n\t exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\t}\n\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t{\n\t var util = __webpack_require__(4);\n\t\n\t /**\n\t * A data structure which is a combination of an array and a set. Adding a new\n\t * member is O(1), testing for membership is O(1), and finding the index of an\n\t * element is O(1). Removing elements from the set is not supported. Only\n\t * strings are supported for membership.\n\t */\n\t function ArraySet() {\n\t this._array = [];\n\t this._set = {};\n\t }\n\t\n\t /**\n\t * Static method for creating ArraySet instances from an existing array.\n\t */\n\t ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n\t var set = new ArraySet();\n\t for (var i = 0, len = aArray.length; i < len; i++) {\n\t set.add(aArray[i], aAllowDuplicates);\n\t }\n\t return set;\n\t };\n\t\n\t /**\n\t * Return how many unique items are in this ArraySet. If duplicates have been\n\t * added, than those do not count towards the size.\n\t *\n\t * @returns Number\n\t */\n\t ArraySet.prototype.size = function ArraySet_size() {\n\t return Object.getOwnPropertyNames(this._set).length;\n\t };\n\t\n\t /**\n\t * Add the given string to this set.\n\t *\n\t * @param String aStr\n\t */\n\t ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n\t var sStr = util.toSetString(aStr);\n\t var isDuplicate = this._set.hasOwnProperty(sStr);\n\t var idx = this._array.length;\n\t if (!isDuplicate || aAllowDuplicates) {\n\t this._array.push(aStr);\n\t }\n\t if (!isDuplicate) {\n\t this._set[sStr] = idx;\n\t }\n\t };\n\t\n\t /**\n\t * Is the given string a member of this set?\n\t *\n\t * @param String aStr\n\t */\n\t ArraySet.prototype.has = function ArraySet_has(aStr) {\n\t var sStr = util.toSetString(aStr);\n\t return this._set.hasOwnProperty(sStr);\n\t };\n\t\n\t /**\n\t * What is the index of the given string in the array?\n\t *\n\t * @param String aStr\n\t */\n\t ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n\t var sStr = util.toSetString(aStr);\n\t if (this._set.hasOwnProperty(sStr)) {\n\t return this._set[sStr];\n\t }\n\t throw new Error('\"' + aStr + '\" is not in the set.');\n\t };\n\t\n\t /**\n\t * What is the element at the given index?\n\t *\n\t * @param Number aIdx\n\t */\n\t ArraySet.prototype.at = function ArraySet_at(aIdx) {\n\t if (aIdx >= 0 && aIdx < this._array.length) {\n\t return this._array[aIdx];\n\t }\n\t throw new Error('No element indexed by ' + aIdx);\n\t };\n\t\n\t /**\n\t * Returns the array representation of this set (which has the proper indices\n\t * indicated by indexOf). Note that this is a copy of the internal array used\n\t * for storing the members so that no one can mess with internal state.\n\t */\n\t ArraySet.prototype.toArray = function ArraySet_toArray() {\n\t return this._array.slice();\n\t };\n\t\n\t exports.ArraySet = ArraySet;\n\t}\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2014 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t{\n\t var util = __webpack_require__(4);\n\t\n\t /**\n\t * Determine whether mappingB is after mappingA with respect to generated\n\t * position.\n\t */\n\t function generatedPositionAfter(mappingA, mappingB) {\n\t // Optimized for most common case\n\t var lineA = mappingA.generatedLine;\n\t var lineB = mappingB.generatedLine;\n\t var columnA = mappingA.generatedColumn;\n\t var columnB = mappingB.generatedColumn;\n\t return lineB > lineA || lineB == lineA && columnB >= columnA ||\n\t util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n\t }\n\t\n\t /**\n\t * A data structure to provide a sorted view of accumulated mappings in a\n\t * performance conscious manner. It trades a neglibable overhead in general\n\t * case for a large speedup in case of mappings being added in order.\n\t */\n\t function MappingList() {\n\t this._array = [];\n\t this._sorted = true;\n\t // Serves as infimum\n\t this._last = {generatedLine: -1, generatedColumn: 0};\n\t }\n\t\n\t /**\n\t * Iterate through internal items. This method takes the same arguments that\n\t * `Array.prototype.forEach` takes.\n\t *\n\t * NOTE: The order of the mappings is NOT guaranteed.\n\t */\n\t MappingList.prototype.unsortedForEach =\n\t function MappingList_forEach(aCallback, aThisArg) {\n\t this._array.forEach(aCallback, aThisArg);\n\t };\n\t\n\t /**\n\t * Add the given source mapping.\n\t *\n\t * @param Object aMapping\n\t */\n\t MappingList.prototype.add = function MappingList_add(aMapping) {\n\t if (generatedPositionAfter(this._last, aMapping)) {\n\t this._last = aMapping;\n\t this._array.push(aMapping);\n\t } else {\n\t this._sorted = false;\n\t this._array.push(aMapping);\n\t }\n\t };\n\t\n\t /**\n\t * Returns the flat, sorted array of mappings. The mappings are sorted by\n\t * generated position.\n\t *\n\t * WARNING: This method returns internal data without copying, for\n\t * performance. The return value must NOT be mutated, and should be treated as\n\t * an immutable borrow. If you want to take ownership, you must make your own\n\t * copy.\n\t */\n\t MappingList.prototype.toArray = function MappingList_toArray() {\n\t if (!this._sorted) {\n\t this._array.sort(util.compareByGeneratedPositionsInflated);\n\t this._sorted = true;\n\t }\n\t return this._array;\n\t };\n\t\n\t exports.MappingList = MappingList;\n\t}\n\n\n/***/ },\n/* 7 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t{\n\t var util = __webpack_require__(4);\n\t var binarySearch = __webpack_require__(8);\n\t var ArraySet = __webpack_require__(5).ArraySet;\n\t var base64VLQ = __webpack_require__(2);\n\t var quickSort = __webpack_require__(9).quickSort;\n\t\n\t function SourceMapConsumer(aSourceMap) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n\t }\n\t\n\t return sourceMap.sections != null\n\t ? new IndexedSourceMapConsumer(sourceMap)\n\t : new BasicSourceMapConsumer(sourceMap);\n\t }\n\t\n\t SourceMapConsumer.fromSourceMap = function(aSourceMap) {\n\t return BasicSourceMapConsumer.fromSourceMap(aSourceMap);\n\t }\n\t\n\t /**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\t SourceMapConsumer.prototype._version = 3;\n\t\n\t // `__generatedMappings` and `__originalMappings` are arrays that hold the\n\t // parsed mapping coordinates from the source map's \"mappings\" attribute. They\n\t // are lazily instantiated, accessed via the `_generatedMappings` and\n\t // `_originalMappings` getters respectively, and we only parse the mappings\n\t // and create these arrays once queried for a source location. We jump through\n\t // these hoops because there can be many thousands of mappings, and parsing\n\t // them is expensive, so we only want to do it if we must.\n\t //\n\t // Each object in the arrays is of the form:\n\t //\n\t // {\n\t // generatedLine: The line number in the generated code,\n\t // generatedColumn: The column number in the generated code,\n\t // source: The path to the original source file that generated this\n\t // chunk of code,\n\t // originalLine: The line number in the original source that\n\t // corresponds to this chunk of generated code,\n\t // originalColumn: The column number in the original source that\n\t // corresponds to this chunk of generated code,\n\t // name: The name of the original symbol which generated this chunk of\n\t // code.\n\t // }\n\t //\n\t // All properties except for `generatedLine` and `generatedColumn` can be\n\t // `null`.\n\t //\n\t // `_generatedMappings` is ordered by the generated positions.\n\t //\n\t // `_originalMappings` is ordered by the original positions.\n\t\n\t SourceMapConsumer.prototype.__generatedMappings = null;\n\t Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n\t get: function () {\n\t if (!this.__generatedMappings) {\n\t this._parseMappings(this._mappings, this.sourceRoot);\n\t }\n\t\n\t return this.__generatedMappings;\n\t }\n\t });\n\t\n\t SourceMapConsumer.prototype.__originalMappings = null;\n\t Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n\t get: function () {\n\t if (!this.__originalMappings) {\n\t this._parseMappings(this._mappings, this.sourceRoot);\n\t }\n\t\n\t return this.__originalMappings;\n\t }\n\t });\n\t\n\t SourceMapConsumer.prototype._charIsMappingSeparator =\n\t function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n\t var c = aStr.charAt(index);\n\t return c === \";\" || c === \",\";\n\t };\n\t\n\t /**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\t SourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t throw new Error(\"Subclasses must implement _parseMappings\");\n\t };\n\t\n\t SourceMapConsumer.GENERATED_ORDER = 1;\n\t SourceMapConsumer.ORIGINAL_ORDER = 2;\n\t\n\t SourceMapConsumer.GREATEST_LOWER_BOUND = 1;\n\t SourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\t\n\t /**\n\t * Iterate over each mapping between an original source/line/column and a\n\t * generated line/column in this source map.\n\t *\n\t * @param Function aCallback\n\t * The function that is called with each mapping.\n\t * @param Object aContext\n\t * Optional. If specified, this object will be the value of `this` every\n\t * time that `aCallback` is called.\n\t * @param aOrder\n\t * Either `SourceMapConsumer.GENERATED_ORDER` or\n\t * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n\t * iterate over the mappings sorted by the generated file's line/column\n\t * order or the original's source/line/column order, respectively. Defaults to\n\t * `SourceMapConsumer.GENERATED_ORDER`.\n\t */\n\t SourceMapConsumer.prototype.eachMapping =\n\t function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n\t var context = aContext || null;\n\t var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\t\n\t var mappings;\n\t switch (order) {\n\t case SourceMapConsumer.GENERATED_ORDER:\n\t mappings = this._generatedMappings;\n\t break;\n\t case SourceMapConsumer.ORIGINAL_ORDER:\n\t mappings = this._originalMappings;\n\t break;\n\t default:\n\t throw new Error(\"Unknown order of iteration.\");\n\t }\n\t\n\t var sourceRoot = this.sourceRoot;\n\t mappings.map(function (mapping) {\n\t var source = mapping.source === null ? null : this._sources.at(mapping.source);\n\t if (source != null && sourceRoot != null) {\n\t source = util.join(sourceRoot, source);\n\t }\n\t return {\n\t source: source,\n\t generatedLine: mapping.generatedLine,\n\t generatedColumn: mapping.generatedColumn,\n\t originalLine: mapping.originalLine,\n\t originalColumn: mapping.originalColumn,\n\t name: mapping.name === null ? null : this._names.at(mapping.name)\n\t };\n\t }, this).forEach(aCallback, context);\n\t };\n\t\n\t /**\n\t * Returns all generated line and column information for the original source,\n\t * line, and column provided. If no column is provided, returns all mappings\n\t * corresponding to a either the line we are searching for or the next\n\t * closest line that has any mappings. Otherwise, returns all mappings\n\t * corresponding to the given line and either the column we are searching for\n\t * or the next closest column that has any offsets.\n\t *\n\t * The only argument is an object with the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source.\n\t * - column: Optional. the column number in the original source.\n\t *\n\t * and an array of objects is returned, each with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null.\n\t * - column: The column number in the generated source, or null.\n\t */\n\t SourceMapConsumer.prototype.allGeneratedPositionsFor =\n\t function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n\t var line = util.getArg(aArgs, 'line');\n\t\n\t // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n\t // returns the index of the closest mapping less than the needle. By\n\t // setting needle.originalColumn to 0, we thus find the last mapping for\n\t // the given line, provided such a mapping exists.\n\t var needle = {\n\t source: util.getArg(aArgs, 'source'),\n\t originalLine: line,\n\t originalColumn: util.getArg(aArgs, 'column', 0)\n\t };\n\t\n\t if (this.sourceRoot != null) {\n\t needle.source = util.relative(this.sourceRoot, needle.source);\n\t }\n\t if (!this._sources.has(needle.source)) {\n\t return [];\n\t }\n\t needle.source = this._sources.indexOf(needle.source);\n\t\n\t var mappings = [];\n\t\n\t var index = this._findMapping(needle,\n\t this._originalMappings,\n\t \"originalLine\",\n\t \"originalColumn\",\n\t util.compareByOriginalPositions,\n\t binarySearch.LEAST_UPPER_BOUND);\n\t if (index >= 0) {\n\t var mapping = this._originalMappings[index];\n\t\n\t if (aArgs.column === undefined) {\n\t var originalLine = mapping.originalLine;\n\t\n\t // Iterate until either we run out of mappings, or we run into\n\t // a mapping for a different line than the one we found. Since\n\t // mappings are sorted, this is guaranteed to find all mappings for\n\t // the line we found.\n\t while (mapping && mapping.originalLine === originalLine) {\n\t mappings.push({\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t });\n\t\n\t mapping = this._originalMappings[++index];\n\t }\n\t } else {\n\t var originalColumn = mapping.originalColumn;\n\t\n\t // Iterate until either we run out of mappings, or we run into\n\t // a mapping for a different line than the one we were searching for.\n\t // Since mappings are sorted, this is guaranteed to find all mappings for\n\t // the line we are searching for.\n\t while (mapping &&\n\t mapping.originalLine === line &&\n\t mapping.originalColumn == originalColumn) {\n\t mappings.push({\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t });\n\t\n\t mapping = this._originalMappings[++index];\n\t }\n\t }\n\t }\n\t\n\t return mappings;\n\t };\n\t\n\t exports.SourceMapConsumer = SourceMapConsumer;\n\t\n\t /**\n\t * A BasicSourceMapConsumer instance represents a parsed source map which we can\n\t * query for information about the original file positions by giving it a file\n\t * position in the generated source.\n\t *\n\t * The only parameter is the raw source map (either as a JSON string, or\n\t * already parsed to an object). According to the spec, source maps have the\n\t * following attributes:\n\t *\n\t * - version: Which version of the source map spec this map is following.\n\t * - sources: An array of URLs to the original source files.\n\t * - names: An array of identifiers which can be referrenced by individual mappings.\n\t * - sourceRoot: Optional. The URL root from which all sources are relative.\n\t * - sourcesContent: Optional. An array of contents of the original source files.\n\t * - mappings: A string of base64 VLQs which contain the actual mappings.\n\t * - file: Optional. The generated file this source map is associated with.\n\t *\n\t * Here is an example source map, taken from the source map spec[0]:\n\t *\n\t * {\n\t * version : 3,\n\t * file: \"out.js\",\n\t * sourceRoot : \"\",\n\t * sources: [\"foo.js\", \"bar.js\"],\n\t * names: [\"src\", \"maps\", \"are\", \"fun\"],\n\t * mappings: \"AA,AB;;ABCDE;\"\n\t * }\n\t *\n\t * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n\t */\n\t function BasicSourceMapConsumer(aSourceMap) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n\t }\n\t\n\t var version = util.getArg(sourceMap, 'version');\n\t var sources = util.getArg(sourceMap, 'sources');\n\t // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n\t // requires the array) to play nice here.\n\t var names = util.getArg(sourceMap, 'names', []);\n\t var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n\t var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n\t var mappings = util.getArg(sourceMap, 'mappings');\n\t var file = util.getArg(sourceMap, 'file', null);\n\t\n\t // Once again, Sass deviates from the spec and supplies the version as a\n\t // string rather than a number, so we use loose equality checking here.\n\t if (version != this._version) {\n\t throw new Error('Unsupported version: ' + version);\n\t }\n\t\n\t sources = sources\n\t // Some source maps produce relative source paths like \"./foo.js\" instead of\n\t // \"foo.js\". Normalize these first so that future comparisons will succeed.\n\t // See bugzil.la/1090768.\n\t .map(util.normalize)\n\t // Always ensure that absolute sources are internally stored relative to\n\t // the source root, if the source root is absolute. Not doing this would\n\t // be particularly problematic when the source root is a prefix of the\n\t // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n\t .map(function (source) {\n\t return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n\t ? util.relative(sourceRoot, source)\n\t : source;\n\t });\n\t\n\t // Pass `true` below to allow duplicate names and sources. While source maps\n\t // are intended to be compressed and deduplicated, the TypeScript compiler\n\t // sometimes generates source maps with duplicates in them. See Github issue\n\t // #72 and bugzil.la/889492.\n\t this._names = ArraySet.fromArray(names, true);\n\t this._sources = ArraySet.fromArray(sources, true);\n\t\n\t this.sourceRoot = sourceRoot;\n\t this.sourcesContent = sourcesContent;\n\t this._mappings = mappings;\n\t this.file = file;\n\t }\n\t\n\t BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\t BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\t\n\t /**\n\t * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n\t *\n\t * @param SourceMapGenerator aSourceMap\n\t * The source map that will be consumed.\n\t * @returns BasicSourceMapConsumer\n\t */\n\t BasicSourceMapConsumer.fromSourceMap =\n\t function SourceMapConsumer_fromSourceMap(aSourceMap) {\n\t var smc = Object.create(BasicSourceMapConsumer.prototype);\n\t\n\t var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n\t var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n\t smc.sourceRoot = aSourceMap._sourceRoot;\n\t smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n\t smc.sourceRoot);\n\t smc.file = aSourceMap._file;\n\t\n\t // Because we are modifying the entries (by converting string sources and\n\t // names to indices into the sources and names ArraySets), we have to make\n\t // a copy of the entry or else bad things happen. Shared mutable state\n\t // strikes again! See github issue #191.\n\t\n\t var generatedMappings = aSourceMap._mappings.toArray().slice();\n\t var destGeneratedMappings = smc.__generatedMappings = [];\n\t var destOriginalMappings = smc.__originalMappings = [];\n\t\n\t for (var i = 0, length = generatedMappings.length; i < length; i++) {\n\t var srcMapping = generatedMappings[i];\n\t var destMapping = new Mapping;\n\t destMapping.generatedLine = srcMapping.generatedLine;\n\t destMapping.generatedColumn = srcMapping.generatedColumn;\n\t\n\t if (srcMapping.source) {\n\t destMapping.source = sources.indexOf(srcMapping.source);\n\t destMapping.originalLine = srcMapping.originalLine;\n\t destMapping.originalColumn = srcMapping.originalColumn;\n\t\n\t if (srcMapping.name) {\n\t destMapping.name = names.indexOf(srcMapping.name);\n\t }\n\t\n\t destOriginalMappings.push(destMapping);\n\t }\n\t\n\t destGeneratedMappings.push(destMapping);\n\t }\n\t\n\t quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\t\n\t return smc;\n\t };\n\t\n\t /**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\t BasicSourceMapConsumer.prototype._version = 3;\n\t\n\t /**\n\t * The list of original sources.\n\t */\n\t Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n\t get: function () {\n\t return this._sources.toArray().map(function (s) {\n\t return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;\n\t }, this);\n\t }\n\t });\n\t\n\t /**\n\t * Provide the JIT with a nice shape / hidden class.\n\t */\n\t function Mapping() {\n\t this.generatedLine = 0;\n\t this.generatedColumn = 0;\n\t this.source = null;\n\t this.originalLine = null;\n\t this.originalColumn = null;\n\t this.name = null;\n\t }\n\t\n\t /**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\t BasicSourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t var generatedLine = 1;\n\t var previousGeneratedColumn = 0;\n\t var previousOriginalLine = 0;\n\t var previousOriginalColumn = 0;\n\t var previousSource = 0;\n\t var previousName = 0;\n\t var length = aStr.length;\n\t var index = 0;\n\t var cachedSegments = {};\n\t var temp = {};\n\t var originalMappings = [];\n\t var generatedMappings = [];\n\t var mapping, str, segment, end, value;\n\t\n\t while (index < length) {\n\t if (aStr.charAt(index) === ';') {\n\t generatedLine++;\n\t index++;\n\t previousGeneratedColumn = 0;\n\t }\n\t else if (aStr.charAt(index) === ',') {\n\t index++;\n\t }\n\t else {\n\t mapping = new Mapping();\n\t mapping.generatedLine = generatedLine;\n\t\n\t // Because each offset is encoded relative to the previous one,\n\t // many segments often have the same encoding. We can exploit this\n\t // fact by caching the parsed variable length fields of each segment,\n\t // allowing us to avoid a second parse if we encounter the same\n\t // segment again.\n\t for (end = index; end < length; end++) {\n\t if (this._charIsMappingSeparator(aStr, end)) {\n\t break;\n\t }\n\t }\n\t str = aStr.slice(index, end);\n\t\n\t segment = cachedSegments[str];\n\t if (segment) {\n\t index += str.length;\n\t } else {\n\t segment = [];\n\t while (index < end) {\n\t base64VLQ.decode(aStr, index, temp);\n\t value = temp.value;\n\t index = temp.rest;\n\t segment.push(value);\n\t }\n\t\n\t if (segment.length === 2) {\n\t throw new Error('Found a source, but no line and column');\n\t }\n\t\n\t if (segment.length === 3) {\n\t throw new Error('Found a source and line, but no column');\n\t }\n\t\n\t cachedSegments[str] = segment;\n\t }\n\t\n\t // Generated column.\n\t mapping.generatedColumn = previousGeneratedColumn + segment[0];\n\t previousGeneratedColumn = mapping.generatedColumn;\n\t\n\t if (segment.length > 1) {\n\t // Original source.\n\t mapping.source = previousSource + segment[1];\n\t previousSource += segment[1];\n\t\n\t // Original line.\n\t mapping.originalLine = previousOriginalLine + segment[2];\n\t previousOriginalLine = mapping.originalLine;\n\t // Lines are stored 0-based\n\t mapping.originalLine += 1;\n\t\n\t // Original column.\n\t mapping.originalColumn = previousOriginalColumn + segment[3];\n\t previousOriginalColumn = mapping.originalColumn;\n\t\n\t if (segment.length > 4) {\n\t // Original name.\n\t mapping.name = previousName + segment[4];\n\t previousName += segment[4];\n\t }\n\t }\n\t\n\t generatedMappings.push(mapping);\n\t if (typeof mapping.originalLine === 'number') {\n\t originalMappings.push(mapping);\n\t }\n\t }\n\t }\n\t\n\t quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n\t this.__generatedMappings = generatedMappings;\n\t\n\t quickSort(originalMappings, util.compareByOriginalPositions);\n\t this.__originalMappings = originalMappings;\n\t };\n\t\n\t /**\n\t * Find the mapping that best matches the hypothetical \"needle\" mapping that\n\t * we are searching for in the given \"haystack\" of mappings.\n\t */\n\t BasicSourceMapConsumer.prototype._findMapping =\n\t function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n\t aColumnName, aComparator, aBias) {\n\t // To return the position we are searching for, we must first find the\n\t // mapping for the given position and then return the opposite position it\n\t // points to. Because the mappings are sorted, we can use binary search to\n\t // find the best mapping.\n\t\n\t if (aNeedle[aLineName] <= 0) {\n\t throw new TypeError('Line must be greater than or equal to 1, got '\n\t + aNeedle[aLineName]);\n\t }\n\t if (aNeedle[aColumnName] < 0) {\n\t throw new TypeError('Column must be greater than or equal to 0, got '\n\t + aNeedle[aColumnName]);\n\t }\n\t\n\t return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n\t };\n\t\n\t /**\n\t * Compute the last column for each generated mapping. The last column is\n\t * inclusive.\n\t */\n\t BasicSourceMapConsumer.prototype.computeColumnSpans =\n\t function SourceMapConsumer_computeColumnSpans() {\n\t for (var index = 0; index < this._generatedMappings.length; ++index) {\n\t var mapping = this._generatedMappings[index];\n\t\n\t // Mappings do not contain a field for the last generated columnt. We\n\t // can come up with an optimistic estimate, however, by assuming that\n\t // mappings are contiguous (i.e. given two consecutive mappings, the\n\t // first mapping ends where the second one starts).\n\t if (index + 1 < this._generatedMappings.length) {\n\t var nextMapping = this._generatedMappings[index + 1];\n\t\n\t if (mapping.generatedLine === nextMapping.generatedLine) {\n\t mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n\t continue;\n\t }\n\t }\n\t\n\t // The last mapping for each line spans the entire line.\n\t mapping.lastGeneratedColumn = Infinity;\n\t }\n\t };\n\t\n\t /**\n\t * Returns the original source, line, and column information for the generated\n\t * source's line and column positions provided. The only argument is an object\n\t * with the following properties:\n\t *\n\t * - line: The line number in the generated source.\n\t * - column: The column number in the generated source.\n\t * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n\t * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - source: The original source file, or null.\n\t * - line: The line number in the original source, or null.\n\t * - column: The column number in the original source, or null.\n\t * - name: The original identifier, or null.\n\t */\n\t BasicSourceMapConsumer.prototype.originalPositionFor =\n\t function SourceMapConsumer_originalPositionFor(aArgs) {\n\t var needle = {\n\t generatedLine: util.getArg(aArgs, 'line'),\n\t generatedColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t var index = this._findMapping(\n\t needle,\n\t this._generatedMappings,\n\t \"generatedLine\",\n\t \"generatedColumn\",\n\t util.compareByGeneratedPositionsDeflated,\n\t util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n\t );\n\t\n\t if (index >= 0) {\n\t var mapping = this._generatedMappings[index];\n\t\n\t if (mapping.generatedLine === needle.generatedLine) {\n\t var source = util.getArg(mapping, 'source', null);\n\t if (source !== null) {\n\t source = this._sources.at(source);\n\t if (this.sourceRoot != null) {\n\t source = util.join(this.sourceRoot, source);\n\t }\n\t }\n\t var name = util.getArg(mapping, 'name', null);\n\t if (name !== null) {\n\t name = this._names.at(name);\n\t }\n\t return {\n\t source: source,\n\t line: util.getArg(mapping, 'originalLine', null),\n\t column: util.getArg(mapping, 'originalColumn', null),\n\t name: name\n\t };\n\t }\n\t }\n\t\n\t return {\n\t source: null,\n\t line: null,\n\t column: null,\n\t name: null\n\t };\n\t };\n\t\n\t /**\n\t * Return true if we have the source content for every source in the source\n\t * map, false otherwise.\n\t */\n\t BasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n\t function BasicSourceMapConsumer_hasContentsOfAllSources() {\n\t if (!this.sourcesContent) {\n\t return false;\n\t }\n\t return this.sourcesContent.length >= this._sources.size() &&\n\t !this.sourcesContent.some(function (sc) { return sc == null; });\n\t };\n\t\n\t /**\n\t * Returns the original source content. The only argument is the url of the\n\t * original source file. Returns null if no original source content is\n\t * available.\n\t */\n\t BasicSourceMapConsumer.prototype.sourceContentFor =\n\t function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n\t if (!this.sourcesContent) {\n\t return null;\n\t }\n\t\n\t if (this.sourceRoot != null) {\n\t aSource = util.relative(this.sourceRoot, aSource);\n\t }\n\t\n\t if (this._sources.has(aSource)) {\n\t return this.sourcesContent[this._sources.indexOf(aSource)];\n\t }\n\t\n\t var url;\n\t if (this.sourceRoot != null\n\t && (url = util.urlParse(this.sourceRoot))) {\n\t // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n\t // many users. We can help them out when they expect file:// URIs to\n\t // behave like it would if they were running a local HTTP server. See\n\t // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n\t var fileUriAbsPath = aSource.replace(/^file:\\/\\//, \"\");\n\t if (url.scheme == \"file\"\n\t && this._sources.has(fileUriAbsPath)) {\n\t return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n\t }\n\t\n\t if ((!url.path || url.path == \"/\")\n\t && this._sources.has(\"/\" + aSource)) {\n\t return this.sourcesContent[this._sources.indexOf(\"/\" + aSource)];\n\t }\n\t }\n\t\n\t // This function is used recursively from\n\t // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n\t // don't want to throw if we can't find the source - we just want to\n\t // return null, so we provide a flag to exit gracefully.\n\t if (nullOnMissing) {\n\t return null;\n\t }\n\t else {\n\t throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n\t }\n\t };\n\t\n\t /**\n\t * Returns the generated line and column information for the original source,\n\t * line, and column positions provided. The only argument is an object with\n\t * the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source.\n\t * - column: The column number in the original source.\n\t * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n\t * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null.\n\t * - column: The column number in the generated source, or null.\n\t */\n\t BasicSourceMapConsumer.prototype.generatedPositionFor =\n\t function SourceMapConsumer_generatedPositionFor(aArgs) {\n\t var source = util.getArg(aArgs, 'source');\n\t if (this.sourceRoot != null) {\n\t source = util.relative(this.sourceRoot, source);\n\t }\n\t if (!this._sources.has(source)) {\n\t return {\n\t line: null,\n\t column: null,\n\t lastColumn: null\n\t };\n\t }\n\t source = this._sources.indexOf(source);\n\t\n\t var needle = {\n\t source: source,\n\t originalLine: util.getArg(aArgs, 'line'),\n\t originalColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t var index = this._findMapping(\n\t needle,\n\t this._originalMappings,\n\t \"originalLine\",\n\t \"originalColumn\",\n\t util.compareByOriginalPositions,\n\t util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n\t );\n\t\n\t if (index >= 0) {\n\t var mapping = this._originalMappings[index];\n\t\n\t if (mapping.source === needle.source) {\n\t return {\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t };\n\t }\n\t }\n\t\n\t return {\n\t line: null,\n\t column: null,\n\t lastColumn: null\n\t };\n\t };\n\t\n\t exports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\t\n\t /**\n\t * An IndexedSourceMapConsumer instance represents a parsed source map which\n\t * we can query for information. It differs from BasicSourceMapConsumer in\n\t * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n\t * input.\n\t *\n\t * The only parameter is a raw source map (either as a JSON string, or already\n\t * parsed to an object). According to the spec for indexed source maps, they\n\t * have the following attributes:\n\t *\n\t * - version: Which version of the source map spec this map is following.\n\t * - file: Optional. The generated file this source map is associated with.\n\t * - sections: A list of section definitions.\n\t *\n\t * Each value under the \"sections\" field has two fields:\n\t * - offset: The offset into the original specified at which this section\n\t * begins to apply, defined as an object with a \"line\" and \"column\"\n\t * field.\n\t * - map: A source map definition. This source map could also be indexed,\n\t * but doesn't have to be.\n\t *\n\t * Instead of the \"map\" field, it's also possible to have a \"url\" field\n\t * specifying a URL to retrieve a source map from, but that's currently\n\t * unsupported.\n\t *\n\t * Here's an example source map, taken from the source map spec[0], but\n\t * modified to omit a section which uses the \"url\" field.\n\t *\n\t * {\n\t * version : 3,\n\t * file: \"app.js\",\n\t * sections: [{\n\t * offset: {line:100, column:10},\n\t * map: {\n\t * version : 3,\n\t * file: \"section.js\",\n\t * sources: [\"foo.js\", \"bar.js\"],\n\t * names: [\"src\", \"maps\", \"are\", \"fun\"],\n\t * mappings: \"AAAA,E;;ABCDE;\"\n\t * }\n\t * }],\n\t * }\n\t *\n\t * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n\t */\n\t function IndexedSourceMapConsumer(aSourceMap) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n\t }\n\t\n\t var version = util.getArg(sourceMap, 'version');\n\t var sections = util.getArg(sourceMap, 'sections');\n\t\n\t if (version != this._version) {\n\t throw new Error('Unsupported version: ' + version);\n\t }\n\t\n\t this._sources = new ArraySet();\n\t this._names = new ArraySet();\n\t\n\t var lastOffset = {\n\t line: -1,\n\t column: 0\n\t };\n\t this._sections = sections.map(function (s) {\n\t if (s.url) {\n\t // The url field will require support for asynchronicity.\n\t // See https://github.com/mozilla/source-map/issues/16\n\t throw new Error('Support for url field in sections not implemented.');\n\t }\n\t var offset = util.getArg(s, 'offset');\n\t var offsetLine = util.getArg(offset, 'line');\n\t var offsetColumn = util.getArg(offset, 'column');\n\t\n\t if (offsetLine < lastOffset.line ||\n\t (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n\t throw new Error('Section offsets must be ordered and non-overlapping.');\n\t }\n\t lastOffset = offset;\n\t\n\t return {\n\t generatedOffset: {\n\t // The offset fields are 0-based, but we use 1-based indices when\n\t // encoding/decoding from VLQ.\n\t generatedLine: offsetLine + 1,\n\t generatedColumn: offsetColumn + 1\n\t },\n\t consumer: new SourceMapConsumer(util.getArg(s, 'map'))\n\t }\n\t });\n\t }\n\t\n\t IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\t IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\t\n\t /**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\t IndexedSourceMapConsumer.prototype._version = 3;\n\t\n\t /**\n\t * The list of original sources.\n\t */\n\t Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n\t get: function () {\n\t var sources = [];\n\t for (var i = 0; i < this._sections.length; i++) {\n\t for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n\t sources.push(this._sections[i].consumer.sources[j]);\n\t }\n\t }\n\t return sources;\n\t }\n\t });\n\t\n\t /**\n\t * Returns the original source, line, and column information for the generated\n\t * source's line and column positions provided. The only argument is an object\n\t * with the following properties:\n\t *\n\t * - line: The line number in the generated source.\n\t * - column: The column number in the generated source.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - source: The original source file, or null.\n\t * - line: The line number in the original source, or null.\n\t * - column: The column number in the original source, or null.\n\t * - name: The original identifier, or null.\n\t */\n\t IndexedSourceMapConsumer.prototype.originalPositionFor =\n\t function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n\t var needle = {\n\t generatedLine: util.getArg(aArgs, 'line'),\n\t generatedColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t // Find the section containing the generated position we're trying to map\n\t // to an original position.\n\t var sectionIndex = binarySearch.search(needle, this._sections,\n\t function(needle, section) {\n\t var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n\t if (cmp) {\n\t return cmp;\n\t }\n\t\n\t return (needle.generatedColumn -\n\t section.generatedOffset.generatedColumn);\n\t });\n\t var section = this._sections[sectionIndex];\n\t\n\t if (!section) {\n\t return {\n\t source: null,\n\t line: null,\n\t column: null,\n\t name: null\n\t };\n\t }\n\t\n\t return section.consumer.originalPositionFor({\n\t line: needle.generatedLine -\n\t (section.generatedOffset.generatedLine - 1),\n\t column: needle.generatedColumn -\n\t (section.generatedOffset.generatedLine === needle.generatedLine\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0),\n\t bias: aArgs.bias\n\t });\n\t };\n\t\n\t /**\n\t * Return true if we have the source content for every source in the source\n\t * map, false otherwise.\n\t */\n\t IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n\t function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n\t return this._sections.every(function (s) {\n\t return s.consumer.hasContentsOfAllSources();\n\t });\n\t };\n\t\n\t /**\n\t * Returns the original source content. The only argument is the url of the\n\t * original source file. Returns null if no original source content is\n\t * available.\n\t */\n\t IndexedSourceMapConsumer.prototype.sourceContentFor =\n\t function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t\n\t var content = section.consumer.sourceContentFor(aSource, true);\n\t if (content) {\n\t return content;\n\t }\n\t }\n\t if (nullOnMissing) {\n\t return null;\n\t }\n\t else {\n\t throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n\t }\n\t };\n\t\n\t /**\n\t * Returns the generated line and column information for the original source,\n\t * line, and column positions provided. The only argument is an object with\n\t * the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source.\n\t * - column: The column number in the original source.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null.\n\t * - column: The column number in the generated source, or null.\n\t */\n\t IndexedSourceMapConsumer.prototype.generatedPositionFor =\n\t function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t\n\t // Only consider this section if the requested source is in the list of\n\t // sources of the consumer.\n\t if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {\n\t continue;\n\t }\n\t var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n\t if (generatedPosition) {\n\t var ret = {\n\t line: generatedPosition.line +\n\t (section.generatedOffset.generatedLine - 1),\n\t column: generatedPosition.column +\n\t (section.generatedOffset.generatedLine === generatedPosition.line\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0)\n\t };\n\t return ret;\n\t }\n\t }\n\t\n\t return {\n\t line: null,\n\t column: null\n\t };\n\t };\n\t\n\t /**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\t IndexedSourceMapConsumer.prototype._parseMappings =\n\t function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t this.__generatedMappings = [];\n\t this.__originalMappings = [];\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t var sectionMappings = section.consumer._generatedMappings;\n\t for (var j = 0; j < sectionMappings.length; j++) {\n\t var mapping = sectionMappings[j];\n\t\n\t var source = section.consumer._sources.at(mapping.source);\n\t if (section.consumer.sourceRoot !== null) {\n\t source = util.join(section.consumer.sourceRoot, source);\n\t }\n\t this._sources.add(source);\n\t source = this._sources.indexOf(source);\n\t\n\t var name = section.consumer._names.at(mapping.name);\n\t this._names.add(name);\n\t name = this._names.indexOf(name);\n\t\n\t // The mappings coming from the consumer for the section have\n\t // generated positions relative to the start of the section, so we\n\t // need to offset them to be relative to the start of the concatenated\n\t // generated file.\n\t var adjustedMapping = {\n\t source: source,\n\t generatedLine: mapping.generatedLine +\n\t (section.generatedOffset.generatedLine - 1),\n\t generatedColumn: mapping.generatedColumn +\n\t (section.generatedOffset.generatedLine === mapping.generatedLine\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0),\n\t originalLine: mapping.originalLine,\n\t originalColumn: mapping.originalColumn,\n\t name: name\n\t };\n\t\n\t this.__generatedMappings.push(adjustedMapping);\n\t if (typeof adjustedMapping.originalLine === 'number') {\n\t this.__originalMappings.push(adjustedMapping);\n\t }\n\t }\n\t }\n\t\n\t quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n\t quickSort(this.__originalMappings, util.compareByOriginalPositions);\n\t };\n\t\n\t exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\t}\n\n\n/***/ },\n/* 8 */\n/***/ function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t{\n\t exports.GREATEST_LOWER_BOUND = 1;\n\t exports.LEAST_UPPER_BOUND = 2;\n\t\n\t /**\n\t * Recursive implementation of binary search.\n\t *\n\t * @param aLow Indices here and lower do not contain the needle.\n\t * @param aHigh Indices here and higher do not contain the needle.\n\t * @param aNeedle The element being searched for.\n\t * @param aHaystack The non-empty array being searched.\n\t * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n\t * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n\t * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t */\n\t function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n\t // This function terminates when one of the following is true:\n\t //\n\t // 1. We find the exact element we are looking for.\n\t //\n\t // 2. We did not find the exact element, but we can return the index of\n\t // the next-closest element.\n\t //\n\t // 3. We did not find the exact element, and there is no next-closest\n\t // element than the one we are searching for, so we return -1.\n\t var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n\t var cmp = aCompare(aNeedle, aHaystack[mid], true);\n\t if (cmp === 0) {\n\t // Found the element we are looking for.\n\t return mid;\n\t }\n\t else if (cmp > 0) {\n\t // Our needle is greater than aHaystack[mid].\n\t if (aHigh - mid > 1) {\n\t // The element is in the upper half.\n\t return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n\t }\n\t\n\t // The exact needle element was not found in this haystack. Determine if\n\t // we are in termination case (3) or (2) and return the appropriate thing.\n\t if (aBias == exports.LEAST_UPPER_BOUND) {\n\t return aHigh < aHaystack.length ? aHigh : -1;\n\t } else {\n\t return mid;\n\t }\n\t }\n\t else {\n\t // Our needle is less than aHaystack[mid].\n\t if (mid - aLow > 1) {\n\t // The element is in the lower half.\n\t return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n\t }\n\t\n\t // we are in termination case (3) or (2) and return the appropriate thing.\n\t if (aBias == exports.LEAST_UPPER_BOUND) {\n\t return mid;\n\t } else {\n\t return aLow < 0 ? -1 : aLow;\n\t }\n\t }\n\t }\n\t\n\t /**\n\t * This is an implementation of binary search which will always try and return\n\t * the index of the closest element if there is no exact hit. This is because\n\t * mappings between original and generated line/col pairs are single points,\n\t * and there is an implicit region between each of them, so a miss just means\n\t * that you aren't on the very start of a region.\n\t *\n\t * @param aNeedle The element you are looking for.\n\t * @param aHaystack The array that is being searched.\n\t * @param aCompare A function which takes the needle and an element in the\n\t * array and returns -1, 0, or 1 depending on whether the needle is less\n\t * than, equal to, or greater than the element, respectively.\n\t * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n\t * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n\t */\n\t exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n\t if (aHaystack.length === 0) {\n\t return -1;\n\t }\n\t\n\t var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n\t aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n\t if (index < 0) {\n\t return -1;\n\t }\n\t\n\t // We have found either the exact element, or the next-closest element than\n\t // the one we are searching for. However, there may be more than one such\n\t // element. Make sure we always return the smallest of these.\n\t while (index - 1 >= 0) {\n\t if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n\t break;\n\t }\n\t --index;\n\t }\n\t\n\t return index;\n\t };\n\t}\n\n\n/***/ },\n/* 9 */\n/***/ function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t{\n\t // It turns out that some (most?) JavaScript engines don't self-host\n\t // `Array.prototype.sort`. This makes sense because C++ will likely remain\n\t // faster than JS when doing raw CPU-intensive sorting. However, when using a\n\t // custom comparator function, calling back and forth between the VM's C++ and\n\t // JIT'd JS is rather slow *and* loses JIT type information, resulting in\n\t // worse generated code for the comparator function than would be optimal. In\n\t // fact, when sorting with a comparator, these costs outweigh the benefits of\n\t // sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n\t // a ~3500ms mean speed-up in `bench/bench.html`.\n\t\n\t /**\n\t * Swap the elements indexed by `x` and `y` in the array `ary`.\n\t *\n\t * @param {Array} ary\n\t * The array.\n\t * @param {Number} x\n\t * The index of the first item.\n\t * @param {Number} y\n\t * The index of the second item.\n\t */\n\t function swap(ary, x, y) {\n\t var temp = ary[x];\n\t ary[x] = ary[y];\n\t ary[y] = temp;\n\t }\n\t\n\t /**\n\t * Returns a random integer within the range `low .. high` inclusive.\n\t *\n\t * @param {Number} low\n\t * The lower bound on the range.\n\t * @param {Number} high\n\t * The upper bound on the range.\n\t */\n\t function randomIntInRange(low, high) {\n\t return Math.round(low + (Math.random() * (high - low)));\n\t }\n\t\n\t /**\n\t * The Quick Sort algorithm.\n\t *\n\t * @param {Array} ary\n\t * An array to sort.\n\t * @param {function} comparator\n\t * Function to use to compare two items.\n\t * @param {Number} p\n\t * Start index of the array\n\t * @param {Number} r\n\t * End index of the array\n\t */\n\t function doQuickSort(ary, comparator, p, r) {\n\t // If our lower bound is less than our upper bound, we (1) partition the\n\t // array into two pieces and (2) recurse on each half. If it is not, this is\n\t // the empty array and our base case.\n\t\n\t if (p < r) {\n\t // (1) Partitioning.\n\t //\n\t // The partitioning chooses a pivot between `p` and `r` and moves all\n\t // elements that are less than or equal to the pivot to the before it, and\n\t // all the elements that are greater than it after it. The effect is that\n\t // once partition is done, the pivot is in the exact place it will be when\n\t // the array is put in sorted order, and it will not need to be moved\n\t // again. This runs in O(n) time.\n\t\n\t // Always choose a random pivot so that an input array which is reverse\n\t // sorted does not cause O(n^2) running time.\n\t var pivotIndex = randomIntInRange(p, r);\n\t var i = p - 1;\n\t\n\t swap(ary, pivotIndex, r);\n\t var pivot = ary[r];\n\t\n\t // Immediately after `j` is incremented in this loop, the following hold\n\t // true:\n\t //\n\t // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n\t //\n\t // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n\t for (var j = p; j < r; j++) {\n\t if (comparator(ary[j], pivot) <= 0) {\n\t i += 1;\n\t swap(ary, i, j);\n\t }\n\t }\n\t\n\t swap(ary, i + 1, j);\n\t var q = i + 1;\n\t\n\t // (2) Recurse on each half.\n\t\n\t doQuickSort(ary, comparator, p, q - 1);\n\t doQuickSort(ary, comparator, q + 1, r);\n\t }\n\t }\n\t\n\t /**\n\t * Sort the given array in-place with the given comparator function.\n\t *\n\t * @param {Array} ary\n\t * An array to sort.\n\t * @param {function} comparator\n\t * Function to use to compare two items.\n\t */\n\t exports.quickSort = function (ary, comparator) {\n\t doQuickSort(ary, comparator, 0, ary.length - 1);\n\t };\n\t}\n\n\n/***/ },\n/* 10 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t{\n\t var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator;\n\t var util = __webpack_require__(4);\n\t\n\t // Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n\t // operating systems these days (capturing the result).\n\t var REGEX_NEWLINE = /(\\r?\\n)/;\n\t\n\t // Newline character code for charCodeAt() comparisons\n\t var NEWLINE_CODE = 10;\n\t\n\t // Private symbol for identifying `SourceNode`s when multiple versions of\n\t // the source-map library are loaded. This MUST NOT CHANGE across\n\t // versions!\n\t var isSourceNode = \"$$$isSourceNode$$$\";\n\t\n\t /**\n\t * SourceNodes provide a way to abstract over interpolating/concatenating\n\t * snippets of generated JavaScript source code while maintaining the line and\n\t * column information associated with the original source code.\n\t *\n\t * @param aLine The original line number.\n\t * @param aColumn The original column number.\n\t * @param aSource The original source's filename.\n\t * @param aChunks Optional. An array of strings which are snippets of\n\t * generated JS, or other SourceNodes.\n\t * @param aName The original identifier.\n\t */\n\t function SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n\t this.children = [];\n\t this.sourceContents = {};\n\t this.line = aLine == null ? null : aLine;\n\t this.column = aColumn == null ? null : aColumn;\n\t this.source = aSource == null ? null : aSource;\n\t this.name = aName == null ? null : aName;\n\t this[isSourceNode] = true;\n\t if (aChunks != null) this.add(aChunks);\n\t }\n\t\n\t /**\n\t * Creates a SourceNode from generated code and a SourceMapConsumer.\n\t *\n\t * @param aGeneratedCode The generated code\n\t * @param aSourceMapConsumer The SourceMap for the generated code\n\t * @param aRelativePath Optional. The path that relative sources in the\n\t * SourceMapConsumer should be relative to.\n\t */\n\t SourceNode.fromStringWithSourceMap =\n\t function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n\t // The SourceNode we want to fill with the generated code\n\t // and the SourceMap\n\t var node = new SourceNode();\n\t\n\t // All even indices of this array are one line of the generated code,\n\t // while all odd indices are the newlines between two adjacent lines\n\t // (since `REGEX_NEWLINE` captures its match).\n\t // Processed fragments are removed from this array, by calling `shiftNextLine`.\n\t var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n\t var shiftNextLine = function() {\n\t var lineContents = remainingLines.shift();\n\t // The last line of a file might not have a newline.\n\t var newLine = remainingLines.shift() || \"\";\n\t return lineContents + newLine;\n\t };\n\t\n\t // We need to remember the position of \"remainingLines\"\n\t var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\t\n\t // The generate SourceNodes we need a code range.\n\t // To extract it current and last mapping is used.\n\t // Here we store the last mapping.\n\t var lastMapping = null;\n\t\n\t aSourceMapConsumer.eachMapping(function (mapping) {\n\t if (lastMapping !== null) {\n\t // We add the code from \"lastMapping\" to \"mapping\":\n\t // First check if there is a new line in between.\n\t if (lastGeneratedLine < mapping.generatedLine) {\n\t // Associate first line with \"lastMapping\"\n\t addMappingWithCode(lastMapping, shiftNextLine());\n\t lastGeneratedLine++;\n\t lastGeneratedColumn = 0;\n\t // The remaining code is added without mapping\n\t } else {\n\t // There is no new line in between.\n\t // Associate the code between \"lastGeneratedColumn\" and\n\t // \"mapping.generatedColumn\" with \"lastMapping\"\n\t var nextLine = remainingLines[0];\n\t var code = nextLine.substr(0, mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t remainingLines[0] = nextLine.substr(mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t lastGeneratedColumn = mapping.generatedColumn;\n\t addMappingWithCode(lastMapping, code);\n\t // No more remaining code, continue\n\t lastMapping = mapping;\n\t return;\n\t }\n\t }\n\t // We add the generated code until the first mapping\n\t // to the SourceNode without any mapping.\n\t // Each line is added as separate string.\n\t while (lastGeneratedLine < mapping.generatedLine) {\n\t node.add(shiftNextLine());\n\t lastGeneratedLine++;\n\t }\n\t if (lastGeneratedColumn < mapping.generatedColumn) {\n\t var nextLine = remainingLines[0];\n\t node.add(nextLine.substr(0, mapping.generatedColumn));\n\t remainingLines[0] = nextLine.substr(mapping.generatedColumn);\n\t lastGeneratedColumn = mapping.generatedColumn;\n\t }\n\t lastMapping = mapping;\n\t }, this);\n\t // We have processed all mappings.\n\t if (remainingLines.length > 0) {\n\t if (lastMapping) {\n\t // Associate the remaining code in the current line with \"lastMapping\"\n\t addMappingWithCode(lastMapping, shiftNextLine());\n\t }\n\t // and add the remaining lines without any mapping\n\t node.add(remainingLines.join(\"\"));\n\t }\n\t\n\t // Copy sourcesContent into SourceNode\n\t aSourceMapConsumer.sources.forEach(function (sourceFile) {\n\t var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n\t if (content != null) {\n\t if (aRelativePath != null) {\n\t sourceFile = util.join(aRelativePath, sourceFile);\n\t }\n\t node.setSourceContent(sourceFile, content);\n\t }\n\t });\n\t\n\t return node;\n\t\n\t function addMappingWithCode(mapping, code) {\n\t if (mapping === null || mapping.source === undefined) {\n\t node.add(code);\n\t } else {\n\t var source = aRelativePath\n\t ? util.join(aRelativePath, mapping.source)\n\t : mapping.source;\n\t node.add(new SourceNode(mapping.originalLine,\n\t mapping.originalColumn,\n\t source,\n\t code,\n\t mapping.name));\n\t }\n\t }\n\t };\n\t\n\t /**\n\t * Add a chunk of generated JS to this source node.\n\t *\n\t * @param aChunk A string snippet of generated JS code, another instance of\n\t * SourceNode, or an array where each member is one of those things.\n\t */\n\t SourceNode.prototype.add = function SourceNode_add(aChunk) {\n\t if (Array.isArray(aChunk)) {\n\t aChunk.forEach(function (chunk) {\n\t this.add(chunk);\n\t }, this);\n\t }\n\t else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n\t if (aChunk) {\n\t this.children.push(aChunk);\n\t }\n\t }\n\t else {\n\t throw new TypeError(\n\t \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n\t );\n\t }\n\t return this;\n\t };\n\t\n\t /**\n\t * Add a chunk of generated JS to the beginning of this source node.\n\t *\n\t * @param aChunk A string snippet of generated JS code, another instance of\n\t * SourceNode, or an array where each member is one of those things.\n\t */\n\t SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n\t if (Array.isArray(aChunk)) {\n\t for (var i = aChunk.length-1; i >= 0; i--) {\n\t this.prepend(aChunk[i]);\n\t }\n\t }\n\t else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n\t this.children.unshift(aChunk);\n\t }\n\t else {\n\t throw new TypeError(\n\t \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n\t );\n\t }\n\t return this;\n\t };\n\t\n\t /**\n\t * Walk over the tree of JS snippets in this node and its children. The\n\t * walking function is called once for each snippet of JS and is passed that\n\t * snippet and the its original associated source's line/column location.\n\t *\n\t * @param aFn The traversal function.\n\t */\n\t SourceNode.prototype.walk = function SourceNode_walk(aFn) {\n\t var chunk;\n\t for (var i = 0, len = this.children.length; i < len; i++) {\n\t chunk = this.children[i];\n\t if (chunk[isSourceNode]) {\n\t chunk.walk(aFn);\n\t }\n\t else {\n\t if (chunk !== '') {\n\t aFn(chunk, { source: this.source,\n\t line: this.line,\n\t column: this.column,\n\t name: this.name });\n\t }\n\t }\n\t }\n\t };\n\t\n\t /**\n\t * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n\t * each of `this.children`.\n\t *\n\t * @param aSep The separator.\n\t */\n\t SourceNode.prototype.join = function SourceNode_join(aSep) {\n\t var newChildren;\n\t var i;\n\t var len = this.children.length;\n\t if (len > 0) {\n\t newChildren = [];\n\t for (i = 0; i < len-1; i++) {\n\t newChildren.push(this.children[i]);\n\t newChildren.push(aSep);\n\t }\n\t newChildren.push(this.children[i]);\n\t this.children = newChildren;\n\t }\n\t return this;\n\t };\n\t\n\t /**\n\t * Call String.prototype.replace on the very right-most source snippet. Useful\n\t * for trimming whitespace from the end of a source node, etc.\n\t *\n\t * @param aPattern The pattern to replace.\n\t * @param aReplacement The thing to replace the pattern with.\n\t */\n\t SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n\t var lastChild = this.children[this.children.length - 1];\n\t if (lastChild[isSourceNode]) {\n\t lastChild.replaceRight(aPattern, aReplacement);\n\t }\n\t else if (typeof lastChild === 'string') {\n\t this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n\t }\n\t else {\n\t this.children.push(''.replace(aPattern, aReplacement));\n\t }\n\t return this;\n\t };\n\t\n\t /**\n\t * Set the source content for a source file. This will be added to the SourceMapGenerator\n\t * in the sourcesContent field.\n\t *\n\t * @param aSourceFile The filename of the source file\n\t * @param aSourceContent The content of the source file\n\t */\n\t SourceNode.prototype.setSourceContent =\n\t function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n\t this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n\t };\n\t\n\t /**\n\t * Walk over the tree of SourceNodes. The walking function is called for each\n\t * source file content and is passed the filename and source content.\n\t *\n\t * @param aFn The traversal function.\n\t */\n\t SourceNode.prototype.walkSourceContents =\n\t function SourceNode_walkSourceContents(aFn) {\n\t for (var i = 0, len = this.children.length; i < len; i++) {\n\t if (this.children[i][isSourceNode]) {\n\t this.children[i].walkSourceContents(aFn);\n\t }\n\t }\n\t\n\t var sources = Object.keys(this.sourceContents);\n\t for (var i = 0, len = sources.length; i < len; i++) {\n\t aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n\t }\n\t };\n\t\n\t /**\n\t * Return the string representation of this source node. Walks over the tree\n\t * and concatenates all the various snippets together to one string.\n\t */\n\t SourceNode.prototype.toString = function SourceNode_toString() {\n\t var str = \"\";\n\t this.walk(function (chunk) {\n\t str += chunk;\n\t });\n\t return str;\n\t };\n\t\n\t /**\n\t * Returns the string representation of this source node along with a source\n\t * map.\n\t */\n\t SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n\t var generated = {\n\t code: \"\",\n\t line: 1,\n\t column: 0\n\t };\n\t var map = new SourceMapGenerator(aArgs);\n\t var sourceMappingActive = false;\n\t var lastOriginalSource = null;\n\t var lastOriginalLine = null;\n\t var lastOriginalColumn = null;\n\t var lastOriginalName = null;\n\t this.walk(function (chunk, original) {\n\t generated.code += chunk;\n\t if (original.source !== null\n\t && original.line !== null\n\t && original.column !== null) {\n\t if(lastOriginalSource !== original.source\n\t || lastOriginalLine !== original.line\n\t || lastOriginalColumn !== original.column\n\t || lastOriginalName !== original.name) {\n\t map.addMapping({\n\t source: original.source,\n\t original: {\n\t line: original.line,\n\t column: original.column\n\t },\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t },\n\t name: original.name\n\t });\n\t }\n\t lastOriginalSource = original.source;\n\t lastOriginalLine = original.line;\n\t lastOriginalColumn = original.column;\n\t lastOriginalName = original.name;\n\t sourceMappingActive = true;\n\t } else if (sourceMappingActive) {\n\t map.addMapping({\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t }\n\t });\n\t lastOriginalSource = null;\n\t sourceMappingActive = false;\n\t }\n\t for (var idx = 0, length = chunk.length; idx < length; idx++) {\n\t if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n\t generated.line++;\n\t generated.column = 0;\n\t // Mappings end at eol\n\t if (idx + 1 === length) {\n\t lastOriginalSource = null;\n\t sourceMappingActive = false;\n\t } else if (sourceMappingActive) {\n\t map.addMapping({\n\t source: original.source,\n\t original: {\n\t line: original.line,\n\t column: original.column\n\t },\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t },\n\t name: original.name\n\t });\n\t }\n\t } else {\n\t generated.column++;\n\t }\n\t }\n\t });\n\t this.walkSourceContents(function (sourceFile, sourceContent) {\n\t map.setSourceContent(sourceFile, sourceContent);\n\t });\n\t\n\t return { code: generated.code, map: map };\n\t };\n\t\n\t exports.SourceNode = SourceNode;\n\t}\n\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** source-map.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap a7d787c028005295f8d2\n **/","/*\n * Copyright 2009-2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE.txt or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nexports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;\nexports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;\nexports.SourceNode = require('./lib/source-node').SourceNode;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./source-map.js\n ** module id = 0\n ** module chunks = 0\n **/","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n{\n var base64VLQ = require('./base64-vlq');\n var util = require('./util');\n var ArraySet = require('./array-set').ArraySet;\n var MappingList = require('./mapping-list').MappingList;\n\n /**\n * An instance of the SourceMapGenerator represents a source map which is\n * being built incrementally. You may pass an object with the following\n * properties:\n *\n * - file: The filename of the generated source.\n * - sourceRoot: A root for all relative URLs in this source map.\n */\n function SourceMapGenerator(aArgs) {\n if (!aArgs) {\n aArgs = {};\n }\n this._file = util.getArg(aArgs, 'file', null);\n this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);\n this._skipValidation = util.getArg(aArgs, 'skipValidation', false);\n this._sources = new ArraySet();\n this._names = new ArraySet();\n this._mappings = new MappingList();\n this._sourcesContents = null;\n }\n\n SourceMapGenerator.prototype._version = 3;\n\n /**\n * Creates a new SourceMapGenerator based on a SourceMapConsumer\n *\n * @param aSourceMapConsumer The SourceMap.\n */\n SourceMapGenerator.fromSourceMap =\n function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {\n var sourceRoot = aSourceMapConsumer.sourceRoot;\n var generator = new SourceMapGenerator({\n file: aSourceMapConsumer.file,\n sourceRoot: sourceRoot\n });\n aSourceMapConsumer.eachMapping(function (mapping) {\n var newMapping = {\n generated: {\n line: mapping.generatedLine,\n column: mapping.generatedColumn\n }\n };\n\n if (mapping.source != null) {\n newMapping.source = mapping.source;\n if (sourceRoot != null) {\n newMapping.source = util.relative(sourceRoot, newMapping.source);\n }\n\n newMapping.original = {\n line: mapping.originalLine,\n column: mapping.originalColumn\n };\n\n if (mapping.name != null) {\n newMapping.name = mapping.name;\n }\n }\n\n generator.addMapping(newMapping);\n });\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n generator.setSourceContent(sourceFile, content);\n }\n });\n return generator;\n };\n\n /**\n * Add a single mapping from original source line and column to the generated\n * source's line and column for this source map being created. The mapping\n * object should have the following properties:\n *\n * - generated: An object with the generated line and column positions.\n * - original: An object with the original line and column positions.\n * - source: The original source file (relative to the sourceRoot).\n * - name: An optional original token name for this mapping.\n */\n SourceMapGenerator.prototype.addMapping =\n function SourceMapGenerator_addMapping(aArgs) {\n var generated = util.getArg(aArgs, 'generated');\n var original = util.getArg(aArgs, 'original', null);\n var source = util.getArg(aArgs, 'source', null);\n var name = util.getArg(aArgs, 'name', null);\n\n if (!this._skipValidation) {\n this._validateMapping(generated, original, source, name);\n }\n\n if (source != null && !this._sources.has(source)) {\n this._sources.add(source);\n }\n\n if (name != null && !this._names.has(name)) {\n this._names.add(name);\n }\n\n this._mappings.add({\n generatedLine: generated.line,\n generatedColumn: generated.column,\n originalLine: original != null && original.line,\n originalColumn: original != null && original.column,\n source: source,\n name: name\n });\n };\n\n /**\n * Set the source content for a source file.\n */\n SourceMapGenerator.prototype.setSourceContent =\n function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {\n var source = aSourceFile;\n if (this._sourceRoot != null) {\n source = util.relative(this._sourceRoot, source);\n }\n\n if (aSourceContent != null) {\n // Add the source content to the _sourcesContents map.\n // Create a new _sourcesContents map if the property is null.\n if (!this._sourcesContents) {\n this._sourcesContents = {};\n }\n this._sourcesContents[util.toSetString(source)] = aSourceContent;\n } else if (this._sourcesContents) {\n // Remove the source file from the _sourcesContents map.\n // If the _sourcesContents map is empty, set the property to null.\n delete this._sourcesContents[util.toSetString(source)];\n if (Object.keys(this._sourcesContents).length === 0) {\n this._sourcesContents = null;\n }\n }\n };\n\n /**\n * Applies the mappings of a sub-source-map for a specific source file to the\n * source map being generated. Each mapping to the supplied source file is\n * rewritten using the supplied source map. Note: The resolution for the\n * resulting mappings is the minimium of this map and the supplied map.\n *\n * @param aSourceMapConsumer The source map to be applied.\n * @param aSourceFile Optional. The filename of the source file.\n * If omitted, SourceMapConsumer's file property will be used.\n * @param aSourceMapPath Optional. The dirname of the path to the source map\n * to be applied. If relative, it is relative to the SourceMapConsumer.\n * This parameter is needed when the two source maps aren't in the same\n * directory, and the source map to be applied contains relative source\n * paths. If so, those relative source paths need to be rewritten\n * relative to the SourceMapGenerator.\n */\n SourceMapGenerator.prototype.applySourceMap =\n function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {\n var sourceFile = aSourceFile;\n // If aSourceFile is omitted, we will use the file property of the SourceMap\n if (aSourceFile == null) {\n if (aSourceMapConsumer.file == null) {\n throw new Error(\n 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +\n 'or the source map\\'s \"file\" property. Both were omitted.'\n );\n }\n sourceFile = aSourceMapConsumer.file;\n }\n var sourceRoot = this._sourceRoot;\n // Make \"sourceFile\" relative if an absolute Url is passed.\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n // Applying the SourceMap can add and remove items from the sources and\n // the names array.\n var newSources = new ArraySet();\n var newNames = new ArraySet();\n\n // Find mappings for the \"sourceFile\"\n this._mappings.unsortedForEach(function (mapping) {\n if (mapping.source === sourceFile && mapping.originalLine != null) {\n // Check if it can be mapped by the source map, then update the mapping.\n var original = aSourceMapConsumer.originalPositionFor({\n line: mapping.originalLine,\n column: mapping.originalColumn\n });\n if (original.source != null) {\n // Copy mapping\n mapping.source = original.source;\n if (aSourceMapPath != null) {\n mapping.source = util.join(aSourceMapPath, mapping.source)\n }\n if (sourceRoot != null) {\n mapping.source = util.relative(sourceRoot, mapping.source);\n }\n mapping.originalLine = original.line;\n mapping.originalColumn = original.column;\n if (original.name != null) {\n mapping.name = original.name;\n }\n }\n }\n\n var source = mapping.source;\n if (source != null && !newSources.has(source)) {\n newSources.add(source);\n }\n\n var name = mapping.name;\n if (name != null && !newNames.has(name)) {\n newNames.add(name);\n }\n\n }, this);\n this._sources = newSources;\n this._names = newNames;\n\n // Copy sourcesContents of applied map.\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aSourceMapPath != null) {\n sourceFile = util.join(aSourceMapPath, sourceFile);\n }\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n this.setSourceContent(sourceFile, content);\n }\n }, this);\n };\n\n /**\n * A mapping can have one of the three levels of data:\n *\n * 1. Just the generated position.\n * 2. The Generated position, original position, and original source.\n * 3. Generated and original position, original source, as well as a name\n * token.\n *\n * To maintain consistency, we validate that any new mapping being added falls\n * in to one of these categories.\n */\n SourceMapGenerator.prototype._validateMapping =\n function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n aName) {\n if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aGenerated.line > 0 && aGenerated.column >= 0\n && !aOriginal && !aSource && !aName) {\n // Case 1.\n return;\n }\n else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n && aGenerated.line > 0 && aGenerated.column >= 0\n && aOriginal.line > 0 && aOriginal.column >= 0\n && aSource) {\n // Cases 2 and 3.\n return;\n }\n else {\n throw new Error('Invalid mapping: ' + JSON.stringify({\n generated: aGenerated,\n source: aSource,\n original: aOriginal,\n name: aName\n }));\n }\n };\n\n /**\n * Serialize the accumulated mappings in to the stream of base 64 VLQs\n * specified by the source map format.\n */\n SourceMapGenerator.prototype._serializeMappings =\n function SourceMapGenerator_serializeMappings() {\n var previousGeneratedColumn = 0;\n var previousGeneratedLine = 1;\n var previousOriginalColumn = 0;\n var previousOriginalLine = 0;\n var previousName = 0;\n var previousSource = 0;\n var result = '';\n var mapping;\n var nameIdx;\n var sourceIdx;\n\n var mappings = this._mappings.toArray();\n for (var i = 0, len = mappings.length; i < len; i++) {\n mapping = mappings[i];\n\n if (mapping.generatedLine !== previousGeneratedLine) {\n previousGeneratedColumn = 0;\n while (mapping.generatedLine !== previousGeneratedLine) {\n result += ';';\n previousGeneratedLine++;\n }\n }\n else {\n if (i > 0) {\n if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n continue;\n }\n result += ',';\n }\n }\n\n result += base64VLQ.encode(mapping.generatedColumn\n - previousGeneratedColumn);\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (mapping.source != null) {\n sourceIdx = this._sources.indexOf(mapping.source);\n result += base64VLQ.encode(sourceIdx - previousSource);\n previousSource = sourceIdx;\n\n // lines are stored 0-based in SourceMap spec version 3\n result += base64VLQ.encode(mapping.originalLine - 1\n - previousOriginalLine);\n previousOriginalLine = mapping.originalLine - 1;\n\n result += base64VLQ.encode(mapping.originalColumn\n - previousOriginalColumn);\n previousOriginalColumn = mapping.originalColumn;\n\n if (mapping.name != null) {\n nameIdx = this._names.indexOf(mapping.name);\n result += base64VLQ.encode(nameIdx - previousName);\n previousName = nameIdx;\n }\n }\n }\n\n return result;\n };\n\n SourceMapGenerator.prototype._generateSourcesContent =\n function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n return aSources.map(function (source) {\n if (!this._sourcesContents) {\n return null;\n }\n if (aSourceRoot != null) {\n source = util.relative(aSourceRoot, source);\n }\n var key = util.toSetString(source);\n return Object.prototype.hasOwnProperty.call(this._sourcesContents,\n key)\n ? this._sourcesContents[key]\n : null;\n }, this);\n };\n\n /**\n * Externalize the source map.\n */\n SourceMapGenerator.prototype.toJSON =\n function SourceMapGenerator_toJSON() {\n var map = {\n version: this._version,\n sources: this._sources.toArray(),\n names: this._names.toArray(),\n mappings: this._serializeMappings()\n };\n if (this._file != null) {\n map.file = this._file;\n }\n if (this._sourceRoot != null) {\n map.sourceRoot = this._sourceRoot;\n }\n if (this._sourcesContents) {\n map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n }\n\n return map;\n };\n\n /**\n * Render the source map being generated to a string.\n */\n SourceMapGenerator.prototype.toString =\n function SourceMapGenerator_toString() {\n return JSON.stringify(this.toJSON());\n };\n\n exports.SourceMapGenerator = SourceMapGenerator;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/source-map-generator.js\n ** module id = 1\n ** module chunks = 0\n **/","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n *\n * Based on the Base 64 VLQ implementation in Closure Compiler:\n * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n *\n * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n * * Neither the name of Google Inc. nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n{\n var base64 = require('./base64');\n\n // A single base 64 digit can contain 6 bits of data. For the base 64 variable\n // length quantities we use in the source map spec, the first bit is the sign,\n // the next four bits are the actual value, and the 6th bit is the\n // continuation bit. The continuation bit tells us whether there are more\n // digits in this value following this digit.\n //\n // Continuation\n // | Sign\n // | |\n // V V\n // 101011\n\n var VLQ_BASE_SHIFT = 5;\n\n // binary: 100000\n var VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n // binary: 011111\n var VLQ_BASE_MASK = VLQ_BASE - 1;\n\n // binary: 100000\n var VLQ_CONTINUATION_BIT = VLQ_BASE;\n\n /**\n * Converts from a two-complement value to a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n */\n function toVLQSigned(aValue) {\n return aValue < 0\n ? ((-aValue) << 1) + 1\n : (aValue << 1) + 0;\n }\n\n /**\n * Converts to a two-complement value from a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n */\n function fromVLQSigned(aValue) {\n var isNegative = (aValue & 1) === 1;\n var shifted = aValue >> 1;\n return isNegative\n ? -shifted\n : shifted;\n }\n\n /**\n * Returns the base 64 VLQ encoded value.\n */\n exports.encode = function base64VLQ_encode(aValue) {\n var encoded = \"\";\n var digit;\n\n var vlq = toVLQSigned(aValue);\n\n do {\n digit = vlq & VLQ_BASE_MASK;\n vlq >>>= VLQ_BASE_SHIFT;\n if (vlq > 0) {\n // There are still more digits in this value, so we must make sure the\n // continuation bit is marked.\n digit |= VLQ_CONTINUATION_BIT;\n }\n encoded += base64.encode(digit);\n } while (vlq > 0);\n\n return encoded;\n };\n\n /**\n * Decodes the next base 64 VLQ value from the given string and returns the\n * value and the rest of the string via the out parameter.\n */\n exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n var strLen = aStr.length;\n var result = 0;\n var shift = 0;\n var continuation, digit;\n\n do {\n if (aIndex >= strLen) {\n throw new Error(\"Expected more digits in base 64 VLQ value.\");\n }\n\n digit = base64.decode(aStr.charCodeAt(aIndex++));\n if (digit === -1) {\n throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n }\n\n continuation = !!(digit & VLQ_CONTINUATION_BIT);\n digit &= VLQ_BASE_MASK;\n result = result + (digit << shift);\n shift += VLQ_BASE_SHIFT;\n } while (continuation);\n\n aOutParam.value = fromVLQSigned(result);\n aOutParam.rest = aIndex;\n };\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/base64-vlq.js\n ** module id = 2\n ** module chunks = 0\n **/","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n{\n var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n /**\n * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n */\n exports.encode = function (number) {\n if (0 <= number && number < intToCharMap.length) {\n return intToCharMap[number];\n }\n throw new TypeError(\"Must be between 0 and 63: \" + number);\n };\n\n /**\n * Decode a single base 64 character code digit to an integer. Returns -1 on\n * failure.\n */\n exports.decode = function (charCode) {\n var bigA = 65; // 'A'\n var bigZ = 90; // 'Z'\n\n var littleA = 97; // 'a'\n var littleZ = 122; // 'z'\n\n var zero = 48; // '0'\n var nine = 57; // '9'\n\n var plus = 43; // '+'\n var slash = 47; // '/'\n\n var littleOffset = 26;\n var numberOffset = 52;\n\n // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n if (bigA <= charCode && charCode <= bigZ) {\n return (charCode - bigA);\n }\n\n // 26 - 51: abcdefghijklmnopqrstuvwxyz\n if (littleA <= charCode && charCode <= littleZ) {\n return (charCode - littleA + littleOffset);\n }\n\n // 52 - 61: 0123456789\n if (zero <= charCode && charCode <= nine) {\n return (charCode - zero + numberOffset);\n }\n\n // 62: +\n if (charCode == plus) {\n return 62;\n }\n\n // 63: /\n if (charCode == slash) {\n return 63;\n }\n\n // Invalid base64 digit.\n return -1;\n };\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/base64.js\n ** module id = 3\n ** module chunks = 0\n **/","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n{\n /**\n * This is a helper function for getting values from parameter/options\n * objects.\n *\n * @param args The object we are extracting values from\n * @param name The name of the property we are getting.\n * @param defaultValue An optional value to return if the property is missing\n * from the object. If this is not specified and the property is missing, an\n * error will be thrown.\n */\n function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }\n exports.getArg = getArg;\n\n var urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.]*)(?::(\\d+))?(\\S*)$/;\n var dataUrlRegexp = /^data:.+\\,.+$/;\n\n function urlParse(aUrl) {\n var match = aUrl.match(urlRegexp);\n if (!match) {\n return null;\n }\n return {\n scheme: match[1],\n auth: match[2],\n host: match[3],\n port: match[4],\n path: match[5]\n };\n }\n exports.urlParse = urlParse;\n\n function urlGenerate(aParsedUrl) {\n var url = '';\n if (aParsedUrl.scheme) {\n url += aParsedUrl.scheme + ':';\n }\n url += '//';\n if (aParsedUrl.auth) {\n url += aParsedUrl.auth + '@';\n }\n if (aParsedUrl.host) {\n url += aParsedUrl.host;\n }\n if (aParsedUrl.port) {\n url += \":\" + aParsedUrl.port\n }\n if (aParsedUrl.path) {\n url += aParsedUrl.path;\n }\n return url;\n }\n exports.urlGenerate = urlGenerate;\n\n /**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consequtive slashes with one slash.\n * - Removes unnecessary '.' parts.\n * - Removes unnecessary '/..' parts.\n *\n * Based on code in the Node.js 'path' core module.\n *\n * @param aPath The path or url to normalize.\n */\n function normalize(aPath) {\n var path = aPath;\n var url = urlParse(aPath);\n if (url) {\n if (!url.path) {\n return aPath;\n }\n path = url.path;\n }\n var isAbsolute = exports.isAbsolute(path);\n\n var parts = path.split(/\\/+/);\n for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n part = parts[i];\n if (part === '.') {\n parts.splice(i, 1);\n } else if (part === '..') {\n up++;\n } else if (up > 0) {\n if (part === '') {\n // The first part is blank if the path is absolute. Trying to go\n // above the root is a no-op. Therefore we can remove all '..' parts\n // directly after the root.\n parts.splice(i + 1, up);\n up = 0;\n } else {\n parts.splice(i, 2);\n up--;\n }\n }\n }\n path = parts.join('/');\n\n if (path === '') {\n path = isAbsolute ? '/' : '.';\n }\n\n if (url) {\n url.path = path;\n return urlGenerate(url);\n }\n return path;\n }\n exports.normalize = normalize;\n\n /**\n * Joins two paths/URLs.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be joined with the root.\n *\n * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n * first.\n * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n * is updated with the result and aRoot is returned. Otherwise the result\n * is returned.\n * - If aPath is absolute, the result is aPath.\n * - Otherwise the two paths are joined with a slash.\n * - Joining for example 'http://' and 'www.example.com' is also supported.\n */\n function join(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n if (aPath === \"\") {\n aPath = \".\";\n }\n var aPathUrl = urlParse(aPath);\n var aRootUrl = urlParse(aRoot);\n if (aRootUrl) {\n aRoot = aRootUrl.path || '/';\n }\n\n // `join(foo, '//www.example.org')`\n if (aPathUrl && !aPathUrl.scheme) {\n if (aRootUrl) {\n aPathUrl.scheme = aRootUrl.scheme;\n }\n return urlGenerate(aPathUrl);\n }\n\n if (aPathUrl || aPath.match(dataUrlRegexp)) {\n return aPath;\n }\n\n // `join('http://', 'www.example.com')`\n if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n aRootUrl.host = aPath;\n return urlGenerate(aRootUrl);\n }\n\n var joined = aPath.charAt(0) === '/'\n ? aPath\n : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\n if (aRootUrl) {\n aRootUrl.path = joined;\n return urlGenerate(aRootUrl);\n }\n return joined;\n }\n exports.join = join;\n\n exports.isAbsolute = function (aPath) {\n return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);\n };\n\n /**\n * Make a path relative to a URL or another path.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be made relative to aRoot.\n */\n function relative(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n\n aRoot = aRoot.replace(/\\/$/, '');\n\n // It is possible for the path to be above the root. In this case, simply\n // checking whether the root is a prefix of the path won't work. Instead, we\n // need to remove components from the root one by one, until either we find\n // a prefix that fits, or we run out of components to remove.\n var level = 0;\n while (aPath.indexOf(aRoot + '/') !== 0) {\n var index = aRoot.lastIndexOf(\"/\");\n if (index < 0) {\n return aPath;\n }\n\n // If the only part of the root that is left is the scheme (i.e. http://,\n // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n // have exhausted all components, so the path is not relative to the root.\n aRoot = aRoot.slice(0, index);\n if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n return aPath;\n }\n\n ++level;\n }\n\n // Make sure we add a \"../\" for each component we removed from the root.\n return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n }\n exports.relative = relative;\n\n /**\n * Because behavior goes wacky when you set `__proto__` on objects, we\n * have to prefix all the strings in our set with an arbitrary character.\n *\n * See https://github.com/mozilla/source-map/pull/31 and\n * https://github.com/mozilla/source-map/issues/30\n *\n * @param String aStr\n */\n function toSetString(aStr) {\n return '$' + aStr;\n }\n exports.toSetString = toSetString;\n\n function fromSetString(aStr) {\n return aStr.substr(1);\n }\n exports.fromSetString = fromSetString;\n\n /**\n * Comparator between two mappings where the original positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same original source/line/column, but different generated\n * line and column the same. Useful when searching for a mapping with a\n * stubbed out mapping.\n */\n function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n var cmp = mappingA.source - mappingB.source;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return mappingA.name - mappingB.name;\n }\n exports.compareByOriginalPositions = compareByOriginalPositions;\n\n /**\n * Comparator between two mappings with deflated source and name indices where\n * the generated positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same generated line and column, but different\n * source/name/original line and column the same. Useful when searching for a\n * mapping with a stubbed out mapping.\n */\n function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = mappingA.source - mappingB.source;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return mappingA.name - mappingB.name;\n }\n exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\n function strcmp(aStr1, aStr2) {\n if (aStr1 === aStr2) {\n return 0;\n }\n\n if (aStr1 > aStr2) {\n return 1;\n }\n\n return -1;\n }\n\n /**\n * Comparator between two mappings with inflated source and name strings where\n * the generated positions are compared.\n */\n function compareByGeneratedPositionsInflated(mappingA, mappingB) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n }\n exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/util.js\n ** module id = 4\n ** module chunks = 0\n **/","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n{\n var util = require('./util');\n\n /**\n * A data structure which is a combination of an array and a set. Adding a new\n * member is O(1), testing for membership is O(1), and finding the index of an\n * element is O(1). Removing elements from the set is not supported. Only\n * strings are supported for membership.\n */\n function ArraySet() {\n this._array = [];\n this._set = {};\n }\n\n /**\n * Static method for creating ArraySet instances from an existing array.\n */\n ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n var set = new ArraySet();\n for (var i = 0, len = aArray.length; i < len; i++) {\n set.add(aArray[i], aAllowDuplicates);\n }\n return set;\n };\n\n /**\n * Return how many unique items are in this ArraySet. If duplicates have been\n * added, than those do not count towards the size.\n *\n * @returns Number\n */\n ArraySet.prototype.size = function ArraySet_size() {\n return Object.getOwnPropertyNames(this._set).length;\n };\n\n /**\n * Add the given string to this set.\n *\n * @param String aStr\n */\n ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = util.toSetString(aStr);\n var isDuplicate = this._set.hasOwnProperty(sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n this._set[sStr] = idx;\n }\n };\n\n /**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\n ArraySet.prototype.has = function ArraySet_has(aStr) {\n var sStr = util.toSetString(aStr);\n return this._set.hasOwnProperty(sStr);\n };\n\n /**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\n ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n var sStr = util.toSetString(aStr);\n if (this._set.hasOwnProperty(sStr)) {\n return this._set[sStr];\n }\n throw new Error('\"' + aStr + '\" is not in the set.');\n };\n\n /**\n * What is the element at the given index?\n *\n * @param Number aIdx\n */\n ArraySet.prototype.at = function ArraySet_at(aIdx) {\n if (aIdx >= 0 && aIdx < this._array.length) {\n return this._array[aIdx];\n }\n throw new Error('No element indexed by ' + aIdx);\n };\n\n /**\n * Returns the array representation of this set (which has the proper indices\n * indicated by indexOf). Note that this is a copy of the internal array used\n * for storing the members so that no one can mess with internal state.\n */\n ArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n };\n\n exports.ArraySet = ArraySet;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/array-set.js\n ** module id = 5\n ** module chunks = 0\n **/","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2014 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n{\n var util = require('./util');\n\n /**\n * Determine whether mappingB is after mappingA with respect to generated\n * position.\n */\n function generatedPositionAfter(mappingA, mappingB) {\n // Optimized for most common case\n var lineA = mappingA.generatedLine;\n var lineB = mappingB.generatedLine;\n var columnA = mappingA.generatedColumn;\n var columnB = mappingB.generatedColumn;\n return lineB > lineA || lineB == lineA && columnB >= columnA ||\n util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n }\n\n /**\n * A data structure to provide a sorted view of accumulated mappings in a\n * performance conscious manner. It trades a neglibable overhead in general\n * case for a large speedup in case of mappings being added in order.\n */\n function MappingList() {\n this._array = [];\n this._sorted = true;\n // Serves as infimum\n this._last = {generatedLine: -1, generatedColumn: 0};\n }\n\n /**\n * Iterate through internal items. This method takes the same arguments that\n * `Array.prototype.forEach` takes.\n *\n * NOTE: The order of the mappings is NOT guaranteed.\n */\n MappingList.prototype.unsortedForEach =\n function MappingList_forEach(aCallback, aThisArg) {\n this._array.forEach(aCallback, aThisArg);\n };\n\n /**\n * Add the given source mapping.\n *\n * @param Object aMapping\n */\n MappingList.prototype.add = function MappingList_add(aMapping) {\n if (generatedPositionAfter(this._last, aMapping)) {\n this._last = aMapping;\n this._array.push(aMapping);\n } else {\n this._sorted = false;\n this._array.push(aMapping);\n }\n };\n\n /**\n * Returns the flat, sorted array of mappings. The mappings are sorted by\n * generated position.\n *\n * WARNING: This method returns internal data without copying, for\n * performance. The return value must NOT be mutated, and should be treated as\n * an immutable borrow. If you want to take ownership, you must make your own\n * copy.\n */\n MappingList.prototype.toArray = function MappingList_toArray() {\n if (!this._sorted) {\n this._array.sort(util.compareByGeneratedPositionsInflated);\n this._sorted = true;\n }\n return this._array;\n };\n\n exports.MappingList = MappingList;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/mapping-list.js\n ** module id = 6\n ** module chunks = 0\n **/","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n{\n var util = require('./util');\n var binarySearch = require('./binary-search');\n var ArraySet = require('./array-set').ArraySet;\n var base64VLQ = require('./base64-vlq');\n var quickSort = require('./quick-sort').quickSort;\n\n function SourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n return sourceMap.sections != null\n ? new IndexedSourceMapConsumer(sourceMap)\n : new BasicSourceMapConsumer(sourceMap);\n }\n\n SourceMapConsumer.fromSourceMap = function(aSourceMap) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap);\n }\n\n /**\n * The version of the source mapping spec that we are consuming.\n */\n SourceMapConsumer.prototype._version = 3;\n\n // `__generatedMappings` and `__originalMappings` are arrays that hold the\n // parsed mapping coordinates from the source map's \"mappings\" attribute. They\n // are lazily instantiated, accessed via the `_generatedMappings` and\n // `_originalMappings` getters respectively, and we only parse the mappings\n // and create these arrays once queried for a source location. We jump through\n // these hoops because there can be many thousands of mappings, and parsing\n // them is expensive, so we only want to do it if we must.\n //\n // Each object in the arrays is of the form:\n //\n // {\n // generatedLine: The line number in the generated code,\n // generatedColumn: The column number in the generated code,\n // source: The path to the original source file that generated this\n // chunk of code,\n // originalLine: The line number in the original source that\n // corresponds to this chunk of generated code,\n // originalColumn: The column number in the original source that\n // corresponds to this chunk of generated code,\n // name: The name of the original symbol which generated this chunk of\n // code.\n // }\n //\n // All properties except for `generatedLine` and `generatedColumn` can be\n // `null`.\n //\n // `_generatedMappings` is ordered by the generated positions.\n //\n // `_originalMappings` is ordered by the original positions.\n\n SourceMapConsumer.prototype.__generatedMappings = null;\n Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n get: function () {\n if (!this.__generatedMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__generatedMappings;\n }\n });\n\n SourceMapConsumer.prototype.__originalMappings = null;\n Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n get: function () {\n if (!this.__originalMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__originalMappings;\n }\n });\n\n SourceMapConsumer.prototype._charIsMappingSeparator =\n function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n var c = aStr.charAt(index);\n return c === \";\" || c === \",\";\n };\n\n /**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\n SourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\n SourceMapConsumer.GENERATED_ORDER = 1;\n SourceMapConsumer.ORIGINAL_ORDER = 2;\n\n SourceMapConsumer.GREATEST_LOWER_BOUND = 1;\n SourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\n /**\n * Iterate over each mapping between an original source/line/column and a\n * generated line/column in this source map.\n *\n * @param Function aCallback\n * The function that is called with each mapping.\n * @param Object aContext\n * Optional. If specified, this object will be the value of `this` every\n * time that `aCallback` is called.\n * @param aOrder\n * Either `SourceMapConsumer.GENERATED_ORDER` or\n * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n * iterate over the mappings sorted by the generated file's line/column\n * order or the original's source/line/column order, respectively. Defaults to\n * `SourceMapConsumer.GENERATED_ORDER`.\n */\n SourceMapConsumer.prototype.eachMapping =\n function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n var context = aContext || null;\n var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\n var mappings;\n switch (order) {\n case SourceMapConsumer.GENERATED_ORDER:\n mappings = this._generatedMappings;\n break;\n case SourceMapConsumer.ORIGINAL_ORDER:\n mappings = this._originalMappings;\n break;\n default:\n throw new Error(\"Unknown order of iteration.\");\n }\n\n var sourceRoot = this.sourceRoot;\n mappings.map(function (mapping) {\n var source = mapping.source === null ? null : this._sources.at(mapping.source);\n if (source != null && sourceRoot != null) {\n source = util.join(sourceRoot, source);\n }\n return {\n source: source,\n generatedLine: mapping.generatedLine,\n generatedColumn: mapping.generatedColumn,\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: mapping.name === null ? null : this._names.at(mapping.name)\n };\n }, this).forEach(aCallback, context);\n };\n\n /**\n * Returns all generated line and column information for the original source,\n * line, and column provided. If no column is provided, returns all mappings\n * corresponding to a either the line we are searching for or the next\n * closest line that has any mappings. Otherwise, returns all mappings\n * corresponding to the given line and either the column we are searching for\n * or the next closest column that has any offsets.\n *\n * The only argument is an object with the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: Optional. the column number in the original source.\n *\n * and an array of objects is returned, each with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\n SourceMapConsumer.prototype.allGeneratedPositionsFor =\n function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n var line = util.getArg(aArgs, 'line');\n\n // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n // returns the index of the closest mapping less than the needle. By\n // setting needle.originalColumn to 0, we thus find the last mapping for\n // the given line, provided such a mapping exists.\n var needle = {\n source: util.getArg(aArgs, 'source'),\n originalLine: line,\n originalColumn: util.getArg(aArgs, 'column', 0)\n };\n\n if (this.sourceRoot != null) {\n needle.source = util.relative(this.sourceRoot, needle.source);\n }\n if (!this._sources.has(needle.source)) {\n return [];\n }\n needle.source = this._sources.indexOf(needle.source);\n\n var mappings = [];\n\n var index = this._findMapping(needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n binarySearch.LEAST_UPPER_BOUND);\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (aArgs.column === undefined) {\n var originalLine = mapping.originalLine;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we found. Since\n // mappings are sorted, this is guaranteed to find all mappings for\n // the line we found.\n while (mapping && mapping.originalLine === originalLine) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n } else {\n var originalColumn = mapping.originalColumn;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we were searching for.\n // Since mappings are sorted, this is guaranteed to find all mappings for\n // the line we are searching for.\n while (mapping &&\n mapping.originalLine === line &&\n mapping.originalColumn == originalColumn) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n }\n }\n\n return mappings;\n };\n\n exports.SourceMapConsumer = SourceMapConsumer;\n\n /**\n * A BasicSourceMapConsumer instance represents a parsed source map which we can\n * query for information about the original file positions by giving it a file\n * position in the generated source.\n *\n * The only parameter is the raw source map (either as a JSON string, or\n * already parsed to an object). According to the spec, source maps have the\n * following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - sources: An array of URLs to the original source files.\n * - names: An array of identifiers which can be referrenced by individual mappings.\n * - sourceRoot: Optional. The URL root from which all sources are relative.\n * - sourcesContent: Optional. An array of contents of the original source files.\n * - mappings: A string of base64 VLQs which contain the actual mappings.\n * - file: Optional. The generated file this source map is associated with.\n *\n * Here is an example source map, taken from the source map spec[0]:\n *\n * {\n * version : 3,\n * file: \"out.js\",\n * sourceRoot : \"\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AA,AB;;ABCDE;\"\n * }\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n */\n function BasicSourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sources = util.getArg(sourceMap, 'sources');\n // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n // requires the array) to play nice here.\n var names = util.getArg(sourceMap, 'names', []);\n var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n var mappings = util.getArg(sourceMap, 'mappings');\n var file = util.getArg(sourceMap, 'file', null);\n\n // Once again, Sass deviates from the spec and supplies the version as a\n // string rather than a number, so we use loose equality checking here.\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n sources = sources\n // Some source maps produce relative source paths like \"./foo.js\" instead of\n // \"foo.js\". Normalize these first so that future comparisons will succeed.\n // See bugzil.la/1090768.\n .map(util.normalize)\n // Always ensure that absolute sources are internally stored relative to\n // the source root, if the source root is absolute. Not doing this would\n // be particularly problematic when the source root is a prefix of the\n // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n .map(function (source) {\n return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n ? util.relative(sourceRoot, source)\n : source;\n });\n\n // Pass `true` below to allow duplicate names and sources. While source maps\n // are intended to be compressed and deduplicated, the TypeScript compiler\n // sometimes generates source maps with duplicates in them. See Github issue\n // #72 and bugzil.la/889492.\n this._names = ArraySet.fromArray(names, true);\n this._sources = ArraySet.fromArray(sources, true);\n\n this.sourceRoot = sourceRoot;\n this.sourcesContent = sourcesContent;\n this._mappings = mappings;\n this.file = file;\n }\n\n BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\n /**\n * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n *\n * @param SourceMapGenerator aSourceMap\n * The source map that will be consumed.\n * @returns BasicSourceMapConsumer\n */\n BasicSourceMapConsumer.fromSourceMap =\n function SourceMapConsumer_fromSourceMap(aSourceMap) {\n var smc = Object.create(BasicSourceMapConsumer.prototype);\n\n var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n smc.sourceRoot = aSourceMap._sourceRoot;\n smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n smc.sourceRoot);\n smc.file = aSourceMap._file;\n\n // Because we are modifying the entries (by converting string sources and\n // names to indices into the sources and names ArraySets), we have to make\n // a copy of the entry or else bad things happen. Shared mutable state\n // strikes again! See github issue #191.\n\n var generatedMappings = aSourceMap._mappings.toArray().slice();\n var destGeneratedMappings = smc.__generatedMappings = [];\n var destOriginalMappings = smc.__originalMappings = [];\n\n for (var i = 0, length = generatedMappings.length; i < length; i++) {\n var srcMapping = generatedMappings[i];\n var destMapping = new Mapping;\n destMapping.generatedLine = srcMapping.generatedLine;\n destMapping.generatedColumn = srcMapping.generatedColumn;\n\n if (srcMapping.source) {\n destMapping.source = sources.indexOf(srcMapping.source);\n destMapping.originalLine = srcMapping.originalLine;\n destMapping.originalColumn = srcMapping.originalColumn;\n\n if (srcMapping.name) {\n destMapping.name = names.indexOf(srcMapping.name);\n }\n\n destOriginalMappings.push(destMapping);\n }\n\n destGeneratedMappings.push(destMapping);\n }\n\n quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\n return smc;\n };\n\n /**\n * The version of the source mapping spec that we are consuming.\n */\n BasicSourceMapConsumer.prototype._version = 3;\n\n /**\n * The list of original sources.\n */\n Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n get: function () {\n return this._sources.toArray().map(function (s) {\n return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;\n }, this);\n }\n });\n\n /**\n * Provide the JIT with a nice shape / hidden class.\n */\n function Mapping() {\n this.generatedLine = 0;\n this.generatedColumn = 0;\n this.source = null;\n this.originalLine = null;\n this.originalColumn = null;\n this.name = null;\n }\n\n /**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\n BasicSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n var generatedLine = 1;\n var previousGeneratedColumn = 0;\n var previousOriginalLine = 0;\n var previousOriginalColumn = 0;\n var previousSource = 0;\n var previousName = 0;\n var length = aStr.length;\n var index = 0;\n var cachedSegments = {};\n var temp = {};\n var originalMappings = [];\n var generatedMappings = [];\n var mapping, str, segment, end, value;\n\n while (index < length) {\n if (aStr.charAt(index) === ';') {\n generatedLine++;\n index++;\n previousGeneratedColumn = 0;\n }\n else if (aStr.charAt(index) === ',') {\n index++;\n }\n else {\n mapping = new Mapping();\n mapping.generatedLine = generatedLine;\n\n // Because each offset is encoded relative to the previous one,\n // many segments often have the same encoding. We can exploit this\n // fact by caching the parsed variable length fields of each segment,\n // allowing us to avoid a second parse if we encounter the same\n // segment again.\n for (end = index; end < length; end++) {\n if (this._charIsMappingSeparator(aStr, end)) {\n break;\n }\n }\n str = aStr.slice(index, end);\n\n segment = cachedSegments[str];\n if (segment) {\n index += str.length;\n } else {\n segment = [];\n while (index < end) {\n base64VLQ.decode(aStr, index, temp);\n value = temp.value;\n index = temp.rest;\n segment.push(value);\n }\n\n if (segment.length === 2) {\n throw new Error('Found a source, but no line and column');\n }\n\n if (segment.length === 3) {\n throw new Error('Found a source and line, but no column');\n }\n\n cachedSegments[str] = segment;\n }\n\n // Generated column.\n mapping.generatedColumn = previousGeneratedColumn + segment[0];\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (segment.length > 1) {\n // Original source.\n mapping.source = previousSource + segment[1];\n previousSource += segment[1];\n\n // Original line.\n mapping.originalLine = previousOriginalLine + segment[2];\n previousOriginalLine = mapping.originalLine;\n // Lines are stored 0-based\n mapping.originalLine += 1;\n\n // Original column.\n mapping.originalColumn = previousOriginalColumn + segment[3];\n previousOriginalColumn = mapping.originalColumn;\n\n if (segment.length > 4) {\n // Original name.\n mapping.name = previousName + segment[4];\n previousName += segment[4];\n }\n }\n\n generatedMappings.push(mapping);\n if (typeof mapping.originalLine === 'number') {\n originalMappings.push(mapping);\n }\n }\n }\n\n quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n this.__generatedMappings = generatedMappings;\n\n quickSort(originalMappings, util.compareByOriginalPositions);\n this.__originalMappings = originalMappings;\n };\n\n /**\n * Find the mapping that best matches the hypothetical \"needle\" mapping that\n * we are searching for in the given \"haystack\" of mappings.\n */\n BasicSourceMapConsumer.prototype._findMapping =\n function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n aColumnName, aComparator, aBias) {\n // To return the position we are searching for, we must first find the\n // mapping for the given position and then return the opposite position it\n // points to. Because the mappings are sorted, we can use binary search to\n // find the best mapping.\n\n if (aNeedle[aLineName] <= 0) {\n throw new TypeError('Line must be greater than or equal to 1, got '\n + aNeedle[aLineName]);\n }\n if (aNeedle[aColumnName] < 0) {\n throw new TypeError('Column must be greater than or equal to 0, got '\n + aNeedle[aColumnName]);\n }\n\n return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n };\n\n /**\n * Compute the last column for each generated mapping. The last column is\n * inclusive.\n */\n BasicSourceMapConsumer.prototype.computeColumnSpans =\n function SourceMapConsumer_computeColumnSpans() {\n for (var index = 0; index < this._generatedMappings.length; ++index) {\n var mapping = this._generatedMappings[index];\n\n // Mappings do not contain a field for the last generated columnt. We\n // can come up with an optimistic estimate, however, by assuming that\n // mappings are contiguous (i.e. given two consecutive mappings, the\n // first mapping ends where the second one starts).\n if (index + 1 < this._generatedMappings.length) {\n var nextMapping = this._generatedMappings[index + 1];\n\n if (mapping.generatedLine === nextMapping.generatedLine) {\n mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n continue;\n }\n }\n\n // The last mapping for each line spans the entire line.\n mapping.lastGeneratedColumn = Infinity;\n }\n };\n\n /**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source.\n * - column: The column number in the generated source.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null.\n * - column: The column number in the original source, or null.\n * - name: The original identifier, or null.\n */\n BasicSourceMapConsumer.prototype.originalPositionFor =\n function SourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._generatedMappings,\n \"generatedLine\",\n \"generatedColumn\",\n util.compareByGeneratedPositionsDeflated,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._generatedMappings[index];\n\n if (mapping.generatedLine === needle.generatedLine) {\n var source = util.getArg(mapping, 'source', null);\n if (source !== null) {\n source = this._sources.at(source);\n if (this.sourceRoot != null) {\n source = util.join(this.sourceRoot, source);\n }\n }\n var name = util.getArg(mapping, 'name', null);\n if (name !== null) {\n name = this._names.at(name);\n }\n return {\n source: source,\n line: util.getArg(mapping, 'originalLine', null),\n column: util.getArg(mapping, 'originalColumn', null),\n name: name\n };\n }\n }\n\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n };\n\n /**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\n BasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n function BasicSourceMapConsumer_hasContentsOfAllSources() {\n if (!this.sourcesContent) {\n return false;\n }\n return this.sourcesContent.length >= this._sources.size() &&\n !this.sourcesContent.some(function (sc) { return sc == null; });\n };\n\n /**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\n BasicSourceMapConsumer.prototype.sourceContentFor =\n function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n if (!this.sourcesContent) {\n return null;\n }\n\n if (this.sourceRoot != null) {\n aSource = util.relative(this.sourceRoot, aSource);\n }\n\n if (this._sources.has(aSource)) {\n return this.sourcesContent[this._sources.indexOf(aSource)];\n }\n\n var url;\n if (this.sourceRoot != null\n && (url = util.urlParse(this.sourceRoot))) {\n // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n // many users. We can help them out when they expect file:// URIs to\n // behave like it would if they were running a local HTTP server. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n var fileUriAbsPath = aSource.replace(/^file:\\/\\//, \"\");\n if (url.scheme == \"file\"\n && this._sources.has(fileUriAbsPath)) {\n return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n }\n\n if ((!url.path || url.path == \"/\")\n && this._sources.has(\"/\" + aSource)) {\n return this.sourcesContent[this._sources.indexOf(\"/\" + aSource)];\n }\n }\n\n // This function is used recursively from\n // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n // don't want to throw if we can't find the source - we just want to\n // return null, so we provide a flag to exit gracefully.\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n /**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: The column number in the original source.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\n BasicSourceMapConsumer.prototype.generatedPositionFor =\n function SourceMapConsumer_generatedPositionFor(aArgs) {\n var source = util.getArg(aArgs, 'source');\n if (this.sourceRoot != null) {\n source = util.relative(this.sourceRoot, source);\n }\n if (!this._sources.has(source)) {\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }\n source = this._sources.indexOf(source);\n\n var needle = {\n source: source,\n originalLine: util.getArg(aArgs, 'line'),\n originalColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (mapping.source === needle.source) {\n return {\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n };\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n };\n\n exports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\n /**\n * An IndexedSourceMapConsumer instance represents a parsed source map which\n * we can query for information. It differs from BasicSourceMapConsumer in\n * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n * input.\n *\n * The only parameter is a raw source map (either as a JSON string, or already\n * parsed to an object). According to the spec for indexed source maps, they\n * have the following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - file: Optional. The generated file this source map is associated with.\n * - sections: A list of section definitions.\n *\n * Each value under the \"sections\" field has two fields:\n * - offset: The offset into the original specified at which this section\n * begins to apply, defined as an object with a \"line\" and \"column\"\n * field.\n * - map: A source map definition. This source map could also be indexed,\n * but doesn't have to be.\n *\n * Instead of the \"map\" field, it's also possible to have a \"url\" field\n * specifying a URL to retrieve a source map from, but that's currently\n * unsupported.\n *\n * Here's an example source map, taken from the source map spec[0], but\n * modified to omit a section which uses the \"url\" field.\n *\n * {\n * version : 3,\n * file: \"app.js\",\n * sections: [{\n * offset: {line:100, column:10},\n * map: {\n * version : 3,\n * file: \"section.js\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AAAA,E;;ABCDE;\"\n * }\n * }],\n * }\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n */\n function IndexedSourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sections = util.getArg(sourceMap, 'sections');\n\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n this._sources = new ArraySet();\n this._names = new ArraySet();\n\n var lastOffset = {\n line: -1,\n column: 0\n };\n this._sections = sections.map(function (s) {\n if (s.url) {\n // The url field will require support for asynchronicity.\n // See https://github.com/mozilla/source-map/issues/16\n throw new Error('Support for url field in sections not implemented.');\n }\n var offset = util.getArg(s, 'offset');\n var offsetLine = util.getArg(offset, 'line');\n var offsetColumn = util.getArg(offset, 'column');\n\n if (offsetLine < lastOffset.line ||\n (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n throw new Error('Section offsets must be ordered and non-overlapping.');\n }\n lastOffset = offset;\n\n return {\n generatedOffset: {\n // The offset fields are 0-based, but we use 1-based indices when\n // encoding/decoding from VLQ.\n generatedLine: offsetLine + 1,\n generatedColumn: offsetColumn + 1\n },\n consumer: new SourceMapConsumer(util.getArg(s, 'map'))\n }\n });\n }\n\n IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n /**\n * The version of the source mapping spec that we are consuming.\n */\n IndexedSourceMapConsumer.prototype._version = 3;\n\n /**\n * The list of original sources.\n */\n Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n get: function () {\n var sources = [];\n for (var i = 0; i < this._sections.length; i++) {\n for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n sources.push(this._sections[i].consumer.sources[j]);\n }\n }\n return sources;\n }\n });\n\n /**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source.\n * - column: The column number in the generated source.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null.\n * - column: The column number in the original source, or null.\n * - name: The original identifier, or null.\n */\n IndexedSourceMapConsumer.prototype.originalPositionFor =\n function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n // Find the section containing the generated position we're trying to map\n // to an original position.\n var sectionIndex = binarySearch.search(needle, this._sections,\n function(needle, section) {\n var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n if (cmp) {\n return cmp;\n }\n\n return (needle.generatedColumn -\n section.generatedOffset.generatedColumn);\n });\n var section = this._sections[sectionIndex];\n\n if (!section) {\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n }\n\n return section.consumer.originalPositionFor({\n line: needle.generatedLine -\n (section.generatedOffset.generatedLine - 1),\n column: needle.generatedColumn -\n (section.generatedOffset.generatedLine === needle.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n bias: aArgs.bias\n });\n };\n\n /**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\n IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n return this._sections.every(function (s) {\n return s.consumer.hasContentsOfAllSources();\n });\n };\n\n /**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\n IndexedSourceMapConsumer.prototype.sourceContentFor =\n function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n var content = section.consumer.sourceContentFor(aSource, true);\n if (content) {\n return content;\n }\n }\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n /**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: The column number in the original source.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\n IndexedSourceMapConsumer.prototype.generatedPositionFor =\n function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n // Only consider this section if the requested source is in the list of\n // sources of the consumer.\n if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {\n continue;\n }\n var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n if (generatedPosition) {\n var ret = {\n line: generatedPosition.line +\n (section.generatedOffset.generatedLine - 1),\n column: generatedPosition.column +\n (section.generatedOffset.generatedLine === generatedPosition.line\n ? section.generatedOffset.generatedColumn - 1\n : 0)\n };\n return ret;\n }\n }\n\n return {\n line: null,\n column: null\n };\n };\n\n /**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\n IndexedSourceMapConsumer.prototype._parseMappings =\n function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n this.__generatedMappings = [];\n this.__originalMappings = [];\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n var sectionMappings = section.consumer._generatedMappings;\n for (var j = 0; j < sectionMappings.length; j++) {\n var mapping = sectionMappings[j];\n\n var source = section.consumer._sources.at(mapping.source);\n if (section.consumer.sourceRoot !== null) {\n source = util.join(section.consumer.sourceRoot, source);\n }\n this._sources.add(source);\n source = this._sources.indexOf(source);\n\n var name = section.consumer._names.at(mapping.name);\n this._names.add(name);\n name = this._names.indexOf(name);\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n var adjustedMapping = {\n source: source,\n generatedLine: mapping.generatedLine +\n (section.generatedOffset.generatedLine - 1),\n generatedColumn: mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: name\n };\n\n this.__generatedMappings.push(adjustedMapping);\n if (typeof adjustedMapping.originalLine === 'number') {\n this.__originalMappings.push(adjustedMapping);\n }\n }\n }\n\n quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n quickSort(this.__originalMappings, util.compareByOriginalPositions);\n };\n\n exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/source-map-consumer.js\n ** module id = 7\n ** module chunks = 0\n **/","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n{\n exports.GREATEST_LOWER_BOUND = 1;\n exports.LEAST_UPPER_BOUND = 2;\n\n /**\n * Recursive implementation of binary search.\n *\n * @param aLow Indices here and lower do not contain the needle.\n * @param aHigh Indices here and higher do not contain the needle.\n * @param aNeedle The element being searched for.\n * @param aHaystack The non-empty array being searched.\n * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n */\n function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n // This function terminates when one of the following is true:\n //\n // 1. We find the exact element we are looking for.\n //\n // 2. We did not find the exact element, but we can return the index of\n // the next-closest element.\n //\n // 3. We did not find the exact element, and there is no next-closest\n // element than the one we are searching for, so we return -1.\n var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n var cmp = aCompare(aNeedle, aHaystack[mid], true);\n if (cmp === 0) {\n // Found the element we are looking for.\n return mid;\n }\n else if (cmp > 0) {\n // Our needle is greater than aHaystack[mid].\n if (aHigh - mid > 1) {\n // The element is in the upper half.\n return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // The exact needle element was not found in this haystack. Determine if\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return aHigh < aHaystack.length ? aHigh : -1;\n } else {\n return mid;\n }\n }\n else {\n // Our needle is less than aHaystack[mid].\n if (mid - aLow > 1) {\n // The element is in the lower half.\n return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return mid;\n } else {\n return aLow < 0 ? -1 : aLow;\n }\n }\n }\n\n /**\n * This is an implementation of binary search which will always try and return\n * the index of the closest element if there is no exact hit. This is because\n * mappings between original and generated line/col pairs are single points,\n * and there is an implicit region between each of them, so a miss just means\n * that you aren't on the very start of a region.\n *\n * @param aNeedle The element you are looking for.\n * @param aHaystack The array that is being searched.\n * @param aCompare A function which takes the needle and an element in the\n * array and returns -1, 0, or 1 depending on whether the needle is less\n * than, equal to, or greater than the element, respectively.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n */\n exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n if (aHaystack.length === 0) {\n return -1;\n }\n\n var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n if (index < 0) {\n return -1;\n }\n\n // We have found either the exact element, or the next-closest element than\n // the one we are searching for. However, there may be more than one such\n // element. Make sure we always return the smallest of these.\n while (index - 1 >= 0) {\n if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n break;\n }\n --index;\n }\n\n return index;\n };\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/binary-search.js\n ** module id = 8\n ** module chunks = 0\n **/","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n{\n // It turns out that some (most?) JavaScript engines don't self-host\n // `Array.prototype.sort`. This makes sense because C++ will likely remain\n // faster than JS when doing raw CPU-intensive sorting. However, when using a\n // custom comparator function, calling back and forth between the VM's C++ and\n // JIT'd JS is rather slow *and* loses JIT type information, resulting in\n // worse generated code for the comparator function than would be optimal. In\n // fact, when sorting with a comparator, these costs outweigh the benefits of\n // sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n // a ~3500ms mean speed-up in `bench/bench.html`.\n\n /**\n * Swap the elements indexed by `x` and `y` in the array `ary`.\n *\n * @param {Array} ary\n * The array.\n * @param {Number} x\n * The index of the first item.\n * @param {Number} y\n * The index of the second item.\n */\n function swap(ary, x, y) {\n var temp = ary[x];\n ary[x] = ary[y];\n ary[y] = temp;\n }\n\n /**\n * Returns a random integer within the range `low .. high` inclusive.\n *\n * @param {Number} low\n * The lower bound on the range.\n * @param {Number} high\n * The upper bound on the range.\n */\n function randomIntInRange(low, high) {\n return Math.round(low + (Math.random() * (high - low)));\n }\n\n /**\n * The Quick Sort algorithm.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n * @param {Number} p\n * Start index of the array\n * @param {Number} r\n * End index of the array\n */\n function doQuickSort(ary, comparator, p, r) {\n // If our lower bound is less than our upper bound, we (1) partition the\n // array into two pieces and (2) recurse on each half. If it is not, this is\n // the empty array and our base case.\n\n if (p < r) {\n // (1) Partitioning.\n //\n // The partitioning chooses a pivot between `p` and `r` and moves all\n // elements that are less than or equal to the pivot to the before it, and\n // all the elements that are greater than it after it. The effect is that\n // once partition is done, the pivot is in the exact place it will be when\n // the array is put in sorted order, and it will not need to be moved\n // again. This runs in O(n) time.\n\n // Always choose a random pivot so that an input array which is reverse\n // sorted does not cause O(n^2) running time.\n var pivotIndex = randomIntInRange(p, r);\n var i = p - 1;\n\n swap(ary, pivotIndex, r);\n var pivot = ary[r];\n\n // Immediately after `j` is incremented in this loop, the following hold\n // true:\n //\n // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n //\n // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n for (var j = p; j < r; j++) {\n if (comparator(ary[j], pivot) <= 0) {\n i += 1;\n swap(ary, i, j);\n }\n }\n\n swap(ary, i + 1, j);\n var q = i + 1;\n\n // (2) Recurse on each half.\n\n doQuickSort(ary, comparator, p, q - 1);\n doQuickSort(ary, comparator, q + 1, r);\n }\n }\n\n /**\n * Sort the given array in-place with the given comparator function.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n */\n exports.quickSort = function (ary, comparator) {\n doQuickSort(ary, comparator, 0, ary.length - 1);\n };\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/quick-sort.js\n ** module id = 9\n ** module chunks = 0\n **/","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n{\n var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;\n var util = require('./util');\n\n // Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n // operating systems these days (capturing the result).\n var REGEX_NEWLINE = /(\\r?\\n)/;\n\n // Newline character code for charCodeAt() comparisons\n var NEWLINE_CODE = 10;\n\n // Private symbol for identifying `SourceNode`s when multiple versions of\n // the source-map library are loaded. This MUST NOT CHANGE across\n // versions!\n var isSourceNode = \"$$$isSourceNode$$$\";\n\n /**\n * SourceNodes provide a way to abstract over interpolating/concatenating\n * snippets of generated JavaScript source code while maintaining the line and\n * column information associated with the original source code.\n *\n * @param aLine The original line number.\n * @param aColumn The original column number.\n * @param aSource The original source's filename.\n * @param aChunks Optional. An array of strings which are snippets of\n * generated JS, or other SourceNodes.\n * @param aName The original identifier.\n */\n function SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n this.children = [];\n this.sourceContents = {};\n this.line = aLine == null ? null : aLine;\n this.column = aColumn == null ? null : aColumn;\n this.source = aSource == null ? null : aSource;\n this.name = aName == null ? null : aName;\n this[isSourceNode] = true;\n if (aChunks != null) this.add(aChunks);\n }\n\n /**\n * Creates a SourceNode from generated code and a SourceMapConsumer.\n *\n * @param aGeneratedCode The generated code\n * @param aSourceMapConsumer The SourceMap for the generated code\n * @param aRelativePath Optional. The path that relative sources in the\n * SourceMapConsumer should be relative to.\n */\n SourceNode.fromStringWithSourceMap =\n function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n // The SourceNode we want to fill with the generated code\n // and the SourceMap\n var node = new SourceNode();\n\n // All even indices of this array are one line of the generated code,\n // while all odd indices are the newlines between two adjacent lines\n // (since `REGEX_NEWLINE` captures its match).\n // Processed fragments are removed from this array, by calling `shiftNextLine`.\n var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n var shiftNextLine = function() {\n var lineContents = remainingLines.shift();\n // The last line of a file might not have a newline.\n var newLine = remainingLines.shift() || \"\";\n return lineContents + newLine;\n };\n\n // We need to remember the position of \"remainingLines\"\n var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\n // The generate SourceNodes we need a code range.\n // To extract it current and last mapping is used.\n // Here we store the last mapping.\n var lastMapping = null;\n\n aSourceMapConsumer.eachMapping(function (mapping) {\n if (lastMapping !== null) {\n // We add the code from \"lastMapping\" to \"mapping\":\n // First check if there is a new line in between.\n if (lastGeneratedLine < mapping.generatedLine) {\n // Associate first line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n lastGeneratedLine++;\n lastGeneratedColumn = 0;\n // The remaining code is added without mapping\n } else {\n // There is no new line in between.\n // Associate the code between \"lastGeneratedColumn\" and\n // \"mapping.generatedColumn\" with \"lastMapping\"\n var nextLine = remainingLines[0];\n var code = nextLine.substr(0, mapping.generatedColumn -\n lastGeneratedColumn);\n remainingLines[0] = nextLine.substr(mapping.generatedColumn -\n lastGeneratedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n addMappingWithCode(lastMapping, code);\n // No more remaining code, continue\n lastMapping = mapping;\n return;\n }\n }\n // We add the generated code until the first mapping\n // to the SourceNode without any mapping.\n // Each line is added as separate string.\n while (lastGeneratedLine < mapping.generatedLine) {\n node.add(shiftNextLine());\n lastGeneratedLine++;\n }\n if (lastGeneratedColumn < mapping.generatedColumn) {\n var nextLine = remainingLines[0];\n node.add(nextLine.substr(0, mapping.generatedColumn));\n remainingLines[0] = nextLine.substr(mapping.generatedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n }\n lastMapping = mapping;\n }, this);\n // We have processed all mappings.\n if (remainingLines.length > 0) {\n if (lastMapping) {\n // Associate the remaining code in the current line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n }\n // and add the remaining lines without any mapping\n node.add(remainingLines.join(\"\"));\n }\n\n // Copy sourcesContent into SourceNode\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aRelativePath != null) {\n sourceFile = util.join(aRelativePath, sourceFile);\n }\n node.setSourceContent(sourceFile, content);\n }\n });\n\n return node;\n\n function addMappingWithCode(mapping, code) {\n if (mapping === null || mapping.source === undefined) {\n node.add(code);\n } else {\n var source = aRelativePath\n ? util.join(aRelativePath, mapping.source)\n : mapping.source;\n node.add(new SourceNode(mapping.originalLine,\n mapping.originalColumn,\n source,\n code,\n mapping.name));\n }\n }\n };\n\n /**\n * Add a chunk of generated JS to this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\n SourceNode.prototype.add = function SourceNode_add(aChunk) {\n if (Array.isArray(aChunk)) {\n aChunk.forEach(function (chunk) {\n this.add(chunk);\n }, this);\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n if (aChunk) {\n this.children.push(aChunk);\n }\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n };\n\n /**\n * Add a chunk of generated JS to the beginning of this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\n SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n if (Array.isArray(aChunk)) {\n for (var i = aChunk.length-1; i >= 0; i--) {\n this.prepend(aChunk[i]);\n }\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n this.children.unshift(aChunk);\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n };\n\n /**\n * Walk over the tree of JS snippets in this node and its children. The\n * walking function is called once for each snippet of JS and is passed that\n * snippet and the its original associated source's line/column location.\n *\n * @param aFn The traversal function.\n */\n SourceNode.prototype.walk = function SourceNode_walk(aFn) {\n var chunk;\n for (var i = 0, len = this.children.length; i < len; i++) {\n chunk = this.children[i];\n if (chunk[isSourceNode]) {\n chunk.walk(aFn);\n }\n else {\n if (chunk !== '') {\n aFn(chunk, { source: this.source,\n line: this.line,\n column: this.column,\n name: this.name });\n }\n }\n }\n };\n\n /**\n * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n * each of `this.children`.\n *\n * @param aSep The separator.\n */\n SourceNode.prototype.join = function SourceNode_join(aSep) {\n var newChildren;\n var i;\n var len = this.children.length;\n if (len > 0) {\n newChildren = [];\n for (i = 0; i < len-1; i++) {\n newChildren.push(this.children[i]);\n newChildren.push(aSep);\n }\n newChildren.push(this.children[i]);\n this.children = newChildren;\n }\n return this;\n };\n\n /**\n * Call String.prototype.replace on the very right-most source snippet. Useful\n * for trimming whitespace from the end of a source node, etc.\n *\n * @param aPattern The pattern to replace.\n * @param aReplacement The thing to replace the pattern with.\n */\n SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n var lastChild = this.children[this.children.length - 1];\n if (lastChild[isSourceNode]) {\n lastChild.replaceRight(aPattern, aReplacement);\n }\n else if (typeof lastChild === 'string') {\n this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n }\n else {\n this.children.push(''.replace(aPattern, aReplacement));\n }\n return this;\n };\n\n /**\n * Set the source content for a source file. This will be added to the SourceMapGenerator\n * in the sourcesContent field.\n *\n * @param aSourceFile The filename of the source file\n * @param aSourceContent The content of the source file\n */\n SourceNode.prototype.setSourceContent =\n function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n };\n\n /**\n * Walk over the tree of SourceNodes. The walking function is called for each\n * source file content and is passed the filename and source content.\n *\n * @param aFn The traversal function.\n */\n SourceNode.prototype.walkSourceContents =\n function SourceNode_walkSourceContents(aFn) {\n for (var i = 0, len = this.children.length; i < len; i++) {\n if (this.children[i][isSourceNode]) {\n this.children[i].walkSourceContents(aFn);\n }\n }\n\n var sources = Object.keys(this.sourceContents);\n for (var i = 0, len = sources.length; i < len; i++) {\n aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n }\n };\n\n /**\n * Return the string representation of this source node. Walks over the tree\n * and concatenates all the various snippets together to one string.\n */\n SourceNode.prototype.toString = function SourceNode_toString() {\n var str = \"\";\n this.walk(function (chunk) {\n str += chunk;\n });\n return str;\n };\n\n /**\n * Returns the string representation of this source node along with a source\n * map.\n */\n SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n var generated = {\n code: \"\",\n line: 1,\n column: 0\n };\n var map = new SourceMapGenerator(aArgs);\n var sourceMappingActive = false;\n var lastOriginalSource = null;\n var lastOriginalLine = null;\n var lastOriginalColumn = null;\n var lastOriginalName = null;\n this.walk(function (chunk, original) {\n generated.code += chunk;\n if (original.source !== null\n && original.line !== null\n && original.column !== null) {\n if(lastOriginalSource !== original.source\n || lastOriginalLine !== original.line\n || lastOriginalColumn !== original.column\n || lastOriginalName !== original.name) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n lastOriginalSource = original.source;\n lastOriginalLine = original.line;\n lastOriginalColumn = original.column;\n lastOriginalName = original.name;\n sourceMappingActive = true;\n } else if (sourceMappingActive) {\n map.addMapping({\n generated: {\n line: generated.line,\n column: generated.column\n }\n });\n lastOriginalSource = null;\n sourceMappingActive = false;\n }\n for (var idx = 0, length = chunk.length; idx < length; idx++) {\n if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n generated.line++;\n generated.column = 0;\n // Mappings end at eol\n if (idx + 1 === length) {\n lastOriginalSource = null;\n sourceMappingActive = false;\n } else if (sourceMappingActive) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n } else {\n generated.column++;\n }\n }\n });\n this.walkSourceContents(function (sourceFile, sourceContent) {\n map.setSourceContent(sourceFile, sourceContent);\n });\n\n return { code: generated.code, map: map };\n };\n\n exports.SourceNode = SourceNode;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/source-node.js\n ** module id = 10\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/array-set.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/array-set.js deleted file mode 100644 index 0ffbb9fd98..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/array-set.js +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var util = require('./util'); - - /** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ - function ArraySet() { - this._array = []; - this._set = {}; - } - - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; - }; - - /** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number - */ - ArraySet.prototype.size = function ArraySet_size() { - return Object.getOwnPropertyNames(this._set).length; - }; - - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = util.toSetString(aStr); - var isDuplicate = this._set.hasOwnProperty(sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - this._set[sStr] = idx; - } - }; - - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - var sStr = util.toSetString(aStr); - return this._set.hasOwnProperty(sStr); - }; - - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - var sStr = util.toSetString(aStr); - if (this._set.hasOwnProperty(sStr)) { - return this._set[sStr]; - } - throw new Error('"' + aStr + '" is not in the set.'); - }; - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); - }; - - /** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; - - exports.ArraySet = ArraySet; -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/base64-vlq.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/base64-vlq.js deleted file mode 100644 index f2a07f7c37..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/base64-vlq.js +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -{ - var base64 = require('./base64'); - - // A single base 64 digit can contain 6 bits of data. For the base 64 variable - // length quantities we use in the source map spec, the first bit is the sign, - // the next four bits are the actual value, and the 6th bit is the - // continuation bit. The continuation bit tells us whether there are more - // digits in this value following this digit. - // - // Continuation - // | Sign - // | | - // V V - // 101011 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var VLQ_CONTINUATION_BIT = VLQ_BASE; - - /** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ - function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; - } - - /** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); - - return encoded; - }; - - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/base64.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/base64.js deleted file mode 100644 index dfda6ce186..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/base64.js +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); - - /** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ - exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; - } - throw new TypeError("Must be between 0 and 63: " + number); - }; - - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; - }; -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/binary-search.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/binary-search.js deleted file mode 100644 index 03161e6bf3..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/binary-search.js +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - exports.GREATEST_LOWER_BOUND = 1; - exports.LEAST_UPPER_BOUND = 2; - - /** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ - function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } - - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; - } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } - - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } - } - } - - /** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ - exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } - - return index; - }; -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/mapping-list.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/mapping-list.js deleted file mode 100644 index 287a6076a8..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/mapping-list.js +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var util = require('./util'); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; - } - - /** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; - } - - /** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } - }; - - /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; - - exports.MappingList = MappingList; -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/quick-sort.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/quick-sort.js deleted file mode 100644 index f92823cea5..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/quick-sort.js +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } - } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); - }; -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-map-consumer.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-map-consumer.js deleted file mode 100644 index 242f21c6c5..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-map-consumer.js +++ /dev/null @@ -1,1082 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var util = require('./util'); - var binarySearch = require('./binary-search'); - var ArraySet = require('./array-set').ArraySet; - var base64VLQ = require('./base64-vlq'); - var quickSort = require('./quick-sort').quickSort; - - function SourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap) - : new BasicSourceMapConsumer(sourceMap); - } - - SourceMapConsumer.fromSourceMap = function(aSourceMap) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap); - } - - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; - - // `__generatedMappings` and `__originalMappings` are arrays that hold the - // parsed mapping coordinates from the source map's "mappings" attribute. They - // are lazily instantiated, accessed via the `_generatedMappings` and - // `_originalMappings` getters respectively, and we only parse the mappings - // and create these arrays once queried for a source location. We jump through - // these hoops because there can be many thousands of mappings, and parsing - // them is expensive, so we only want to do it if we must. - // - // Each object in the arrays is of the form: - // - // { - // generatedLine: The line number in the generated code, - // generatedColumn: The column number in the generated code, - // source: The path to the original source file that generated this - // chunk of code, - // originalLine: The line number in the original source that - // corresponds to this chunk of generated code, - // originalColumn: The column number in the original source that - // corresponds to this chunk of generated code, - // name: The name of the original symbol which generated this chunk of - // code. - // } - // - // All properties except for `generatedLine` and `generatedColumn` can be - // `null`. - // - // `_generatedMappings` is ordered by the generated positions. - // - // `_originalMappings` is ordered by the original positions. - - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } - }); - - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } - }); - - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - if (source != null && sourceRoot != null) { - source = util.join(sourceRoot, source); - } - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; - - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: Optional. the column number in the original source. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; - - if (this.sourceRoot != null) { - needle.source = util.relative(this.sourceRoot, needle.source); - } - if (!this._sources.has(needle.source)) { - return []; - } - needle.source = this._sources.indexOf(needle.source); - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - - exports.SourceMapConsumer = SourceMapConsumer; - - /** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The only parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ - function BasicSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - sources = sources - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names, true); - this._sources = ArraySet.fromArray(sources, true); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @returns BasicSourceMapConsumer - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (s) { - return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; - }, this); - } - }); - - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - cachedSegments[str] = segment; - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); - } - } - } - - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); - } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - if (this.sourceRoot != null) { - source = util.join(this.sourceRoot, source); - } - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } - } - - return { - source: null, - line: null, - column: null, - name: null - }; - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - if (this.sourceRoot != null) { - aSource = util.relative(this.sourceRoot, aSource); - } - - if (this._sources.has(aSource)) { - return this.sourcesContent[this._sources.indexOf(aSource)]; - } - - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + aSource)) { - return this.sourcesContent[this._sources.indexOf("/" + aSource)]; - } - } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - if (this.sourceRoot != null) { - source = util.relative(this.sourceRoot, source); - } - if (!this._sources.has(source)) { - return { - line: null, - column: null, - lastColumn: null - }; - } - source = this._sources.indexOf(source); - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - - exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - - /** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The only parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ - function IndexedSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; - - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map')) - } - }); - } - - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - } - return sources; - } - }); - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - - return { - line: null, - column: null - }; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - if (section.consumer.sourceRoot !== null) { - source = util.join(section.consumer.sourceRoot, source); - } - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-map-generator.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-map-generator.js deleted file mode 100644 index ffc76cdf51..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-map-generator.js +++ /dev/null @@ -1,396 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var base64VLQ = require('./base64-vlq'); - var util = require('./util'); - var ArraySet = require('./array-set').ArraySet; - var MappingList = require('./mapping-list').MappingList; - - /** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ - function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } - - if (source != null && !this._sources.has(source)) { - this._sources.add(source); - } - - if (name != null && !this._names.has(name)) { - this._names.add(name); - } - - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; - - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = {}; - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; - - /** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; - - /** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - result += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - result += ','; - } - } - - result += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; - - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - result += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; - - // lines are stored 0-based in SourceMap spec version 3 - result += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; - - result += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - result += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } - } - - return result; - }; - - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, - key) - ? this._sourcesContents[key] - : null; - }, this); - }; - - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - - return map; - }; - - /** - * Render the source map being generated to a string. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - - exports.SourceMapGenerator = SourceMapGenerator; -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-node.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-node.js deleted file mode 100644 index 8b0fd59184..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/source-node.js +++ /dev/null @@ -1,408 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator; - var util = require('./util'); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var NEWLINE_CODE = 10; - - // Private symbol for identifying `SourceNode`s when multiple versions of - // the source-map library are loaded. This MUST NOT CHANGE across - // versions! - var isSourceNode = "$$$isSourceNode$$$"; - - /** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ - function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); - } - - /** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are removed from this array, by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var shiftNextLine = function() { - var lineContents = remainingLines.shift(); - // The last line of a file might not have a newline. - var newLine = remainingLines.shift() || ""; - return lineContents + newLine; - }; - - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[0]; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[0] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[0]; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[0] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLines.length > 0) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.join("")); - } - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; - - /** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } - }; - - /** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; - }; - - /** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; - }; - - /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ - SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; - - /** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; - - /** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - - return { code: generated.code, map: map }; - }; - - exports.SourceNode = SourceNode; -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/util.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/util.js deleted file mode 100644 index 4581590224..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/lib/util.js +++ /dev/null @@ -1,369 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -{ - /** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ - function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; - - function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; - } - exports.urlParse = urlParse; - - function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; - } - exports.urlGenerate = urlGenerate; - - /** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consequtive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); - - if (path === '') { - path = isAbsolute ? '/' : '.'; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; - } - exports.normalize = normalize; - - /** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ - function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } - - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } - - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; - } - exports.join = join; - - exports.isAbsolute = function (aPath) { - return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); - }; - - /** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ - function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ''); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } - - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } - - ++level; - } - - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); - } - exports.relative = relative; - - /** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ - function toSetString(aStr) { - return '$' + aStr; - } - exports.toSetString = toSetString; - - function fromSetString(aStr) { - return aStr.substr(1); - } - exports.fromSetString = fromSetString; - - /** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ - function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByOriginalPositions = compareByOriginalPositions; - - /** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ - function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - - cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - - function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - - if (aStr1 > aStr2) { - return 1; - } - - return -1; - } - - /** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ - function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/package.json b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/package.json deleted file mode 100644 index 347af4c1b5..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/package.json +++ /dev/null @@ -1,240 +0,0 @@ -{ - "_args": [ - [ - "source-map@~0.5.0", - "/Users/rebecca/code/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast" - ] - ], - "_from": "source-map@>=0.5.0 <0.6.0", - "_id": "source-map@0.5.3", - "_inCache": true, - "_installable": true, - "_location": "/readable-stream/unreachable-branch-transform/recast/source-map", - "_npmUser": { - "email": "fitzgen@gmail.com", - "name": "nickfitzgerald" - }, - "_npmVersion": "1.4.9", - "_phantomChildren": {}, - "_requested": { - "name": "source-map", - "raw": "source-map@~0.5.0", - "rawSpec": "~0.5.0", - "scope": null, - "spec": ">=0.5.0 <0.6.0", - "type": "range" - }, - "_requiredBy": [ - "/readable-stream/unreachable-branch-transform/recast" - ], - "_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.3.tgz", - "_shasum": "82674b85a71b0be76c3e7416d15e9f5252eb3be0", - "_shrinkwrap": null, - "_spec": "source-map@~0.5.0", - "_where": "/Users/rebecca/code/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast", - "author": { - "email": "nfitzgerald@mozilla.com", - "name": "Nick Fitzgerald" - }, - "bugs": { - "url": "https://github.com/mozilla/source-map/issues" - }, - "contributors": [ - { - "email": "tobias.koppers@googlemail.com", - "name": "Tobias Koppers" - }, - { - "email": "duncan@dweebd.com", - "name": "Duncan Beevers" - }, - { - "email": "scrane@mozilla.com", - "name": "Stephen Crane" - }, - { - "email": "seddon.ryan@gmail.com", - "name": "Ryan Seddon" - }, - { - "email": "miles.elam@deem.com", - "name": "Miles Elam" - }, - { - "email": "mihai.bazon@gmail.com", - "name": "Mihai Bazon" - }, - { - "email": "github.public.email@michael.ficarra.me", - "name": "Michael Ficarra" - }, - { - "email": "todd@twolfson.com", - "name": "Todd Wolfson" - }, - { - "email": "alexander@solovyov.net", - "name": "Alexander Solovyov" - }, - { - "email": "fgnass@gmail.com", - "name": "Felix Gnass" - }, - { - "email": "conrad.irwin@gmail.com", - "name": "Conrad Irwin" - }, - { - "email": "usrbincc@yahoo.com", - "name": "usrbincc" - }, - { - "email": "glasser@davidglasser.net", - "name": "David Glasser" - }, - { - "email": "chase@newrelic.com", - "name": "Chase Douglas" - }, - { - "email": "evan.exe@gmail.com", - "name": "Evan Wallace" - }, - { - "email": "fayearthur@gmail.com", - "name": "Heather Arthur" - }, - { - "email": "hughskennedy@gmail.com", - "name": "Hugh Kennedy" - }, - { - "email": "glasser@davidglasser.net", - "name": "David Glasser" - }, - { - "email": "simon.lydell@gmail.com", - "name": "Simon Lydell" - }, - { - "email": "jellyes2@gmail.com", - "name": "Jmeas Smith" - }, - { - "email": "mzgoddard@gmail.com", - "name": "Michael Z Goddard" - }, - { - "email": "azu@users.noreply.github.com", - "name": "azu" - }, - { - "email": "john@gozde.ca", - "name": "John Gozde" - }, - { - "email": "akirkton@truefitinnovation.com", - "name": "Adam Kirkton" - }, - { - "email": "christopher.montgomery@dowjones.com", - "name": "Chris Montgomery" - }, - { - "email": "jryans@gmail.com", - "name": "J. Ryan Stinnett" - }, - { - "email": "jherrington@walmartlabs.com", - "name": "Jack Herrington" - }, - { - "email": "jeffpalentine@gmail.com", - "name": "Chris Truter" - }, - { - "email": "daniel@danielespeset.com", - "name": "Daniel Espeset" - }, - { - "email": "jamie.lf.wong@gmail.com", - "name": "Jamie Wong" - }, - { - "email": "ejpbruel@mozilla.com", - "name": "Eddy Bruël" - }, - { - "email": "hawkrives@gmail.com", - "name": "Hawken Rives" - }, - { - "email": "giladp007@gmail.com", - "name": "Gilad Peleg" - }, - { - "email": "djchie.dev@gmail.com", - "name": "djchie" - }, - { - "email": "garysye@gmail.com", - "name": "Gary Ye" - }, - { - "email": "nicolas.lalevee@hibnet.org", - "name": "Nicolas Lalevée" - } - ], - "dependencies": {}, - "description": "Generates and consumes source maps", - "devDependencies": { - "doctoc": "^0.15.0", - "webpack": "^1.12.0" - }, - "directories": {}, - "dist": { - "shasum": "82674b85a71b0be76c3e7416d15e9f5252eb3be0", - "tarball": "https://registry.npmjs.org/source-map/-/source-map-0.5.3.tgz" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "source-map.js", - "lib/", - "dist/source-map.debug.js", - "dist/source-map.js", - "dist/source-map.min.js", - "dist/source-map.min.js.map" - ], - "homepage": "https://github.com/mozilla/source-map", - "license": "BSD-3-Clause", - "main": "./source-map.js", - "maintainers": [ - { - "email": "mozilla-developer-tools@googlegroups.com", - "name": "mozilla-devtools" - }, - { - "email": "dherman@mozilla.com", - "name": "mozilla" - }, - { - "email": "fitzgen@gmail.com", - "name": "nickfitzgerald" - } - ], - "name": "source-map", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/mozilla/source-map.git" - }, - "scripts": { - "build": "webpack --color", - "test": "node test/run-tests.js", - "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" - }, - "version": "0.5.3" -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/source-map.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/source-map.js deleted file mode 100644 index bc88fe820c..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/node_modules/source-map/source-map.js +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ -exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator; -exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer; -exports.SourceNode = require('./lib/source-node').SourceNode; diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/package.json b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/package.json deleted file mode 100644 index d23aed14af..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/node_modules/recast/package.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "_args": [ - [ - "recast@^0.11.4", - "/Users/rebecca/code/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform" - ] - ], - "_from": "recast@>=0.11.4 <0.12.0", - "_id": "recast@0.11.5", - "_inCache": true, - "_installable": true, - "_location": "/readable-stream/unreachable-branch-transform/recast", - "_nodeVersion": "4.2.4", - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/recast-0.11.5.tgz_1460645169588_0.9154388136230409" - }, - "_npmUser": { - "email": "bn@cs.stanford.edu", - "name": "benjamn" - }, - "_npmVersion": "3.3.9", - "_phantomChildren": {}, - "_requested": { - "name": "recast", - "raw": "recast@^0.11.4", - "rawSpec": "^0.11.4", - "scope": null, - "spec": ">=0.11.4 <0.12.0", - "type": "range" - }, - "_requiredBy": [ - "/readable-stream/unreachable-branch-transform" - ], - "_resolved": "https://registry.npmjs.org/recast/-/recast-0.11.5.tgz", - "_shasum": "a85d6333586eeaec508498e1e4c4690a14cb662b", - "_shrinkwrap": null, - "_spec": "recast@^0.11.4", - "_where": "/Users/rebecca/code/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform", - "author": { - "email": "bn@cs.stanford.edu", - "name": "Ben Newman" - }, - "browser": { - "fs": false - }, - "bugs": { - "url": "https://github.com/benjamn/recast/issues" - }, - "dependencies": { - "ast-types": "0.8.16", - "esprima": "~2.7.1", - "private": "~0.1.5", - "source-map": "~0.5.0" - }, - "description": "JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator", - "devDependencies": { - "babylon": "~6.4.2", - "esprima-fb": "^15001.1001.0-dev-harmony-fb", - "mocha": "~2.2.5" - }, - "directories": {}, - "dist": { - "shasum": "a85d6333586eeaec508498e1e4c4690a14cb662b", - "tarball": "https://registry.npmjs.org/recast/-/recast-0.11.5.tgz" - }, - "engines": { - "node": ">= 0.8" - }, - "gitHead": "47398cf78c9e9c0ce779c86140810528258e607d", - "homepage": "http://github.com/benjamn/recast", - "keywords": [ - "ast", - "rewriting", - "refactoring", - "codegen", - "syntax", - "transformation", - "parsing", - "pretty-printing" - ], - "license": "MIT", - "main": "main.js", - "maintainers": [ - { - "email": "bn@cs.stanford.edu", - "name": "benjamn" - } - ], - "name": "recast", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/benjamn/recast.git" - }, - "scripts": { - "debug": "node ./node_modules/mocha/bin/mocha --debug-brk --reporter spec", - "test": "node ./node_modules/mocha/bin/mocha --reporter spec --full-trace" - }, - "version": "0.11.5" -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/package.json b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/package.json deleted file mode 100644 index ee4e7050f1..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/package.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "_args": [ - [ - "unreachable-branch-transform@~0.5.0", - "/Users/rebecca/code/npm/node_modules/readable-stream" - ] - ], - "_from": "unreachable-branch-transform@>=0.5.0 <0.6.0", - "_id": "unreachable-branch-transform@0.5.1", - "_inCache": true, - "_installable": true, - "_location": "/readable-stream/unreachable-branch-transform", - "_nodeVersion": "5.10.1", - "_npmOperationalInternal": { - "host": "packages-16-east.internal.npmjs.com", - "tmp": "tmp/unreachable-branch-transform-0.5.1.tgz_1460612866423_0.1859290194697678" - }, - "_npmUser": { - "email": "zertosh@gmail.com", - "name": "zertosh" - }, - "_npmVersion": "3.8.3", - "_phantomChildren": {}, - "_requested": { - "name": "unreachable-branch-transform", - "raw": "unreachable-branch-transform@~0.5.0", - "rawSpec": "~0.5.0", - "scope": null, - "spec": ">=0.5.0 <0.6.0", - "type": "range" - }, - "_requiredBy": [ - "/readable-stream" - ], - "_resolved": "https://registry.npmjs.org/unreachable-branch-transform/-/unreachable-branch-transform-0.5.1.tgz", - "_shasum": "5e0a5da810b4f4cc6866afc28b59aa6e8c84db5d", - "_shrinkwrap": null, - "_spec": "unreachable-branch-transform@~0.5.0", - "_where": "/Users/rebecca/code/npm/node_modules/readable-stream", - "author": { - "email": "zertosh@gmail.com", - "name": "Andres Suarez" - }, - "bugs": { - "url": "https://github.com/zertosh/unreachable-branch-transform/issues" - }, - "dependencies": { - "esmangle-evaluator": "^1.0.0", - "recast": "^0.11.4" - }, - "description": "Browserify transform to remove unreachable code", - "devDependencies": { - "browserify": "^13.0.0", - "tap": "^5.7.1" - }, - "directories": {}, - "dist": { - "shasum": "5e0a5da810b4f4cc6866afc28b59aa6e8c84db5d", - "tarball": "https://registry.npmjs.org/unreachable-branch-transform/-/unreachable-branch-transform-0.5.1.tgz" - }, - "files": [ - "README.md", - "index.js", - "unreachableBranchTransformer.js" - ], - "gitHead": "9b47a0aea78a873a4d3efb4e48d0455ed8d72d01", - "homepage": "https://github.com/zertosh/unreachable-branch-transform", - "keywords": [ - "browserify", - "browserify-transform", - "transform", - "minify", - "unreachable" - ], - "license": "MIT", - "main": "index.js", - "maintainers": [ - { - "email": "zertosh@gmail.com", - "name": "zertosh" - } - ], - "name": "unreachable-branch-transform", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/zertosh/unreachable-branch-transform.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "version": "0.5.1" -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/unreachableBranchTransformer.js b/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/unreachableBranchTransformer.js deleted file mode 100644 index 7469897dad..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/unreachable-branch-transform/unreachableBranchTransformer.js +++ /dev/null @@ -1,97 +0,0 @@ -var Evaluator = require('esmangle-evaluator'); - -var recast = require('recast'); -var types = recast.types; -var b = types.builders; - -var VISITOR_METHODS = { - visitLogicalExpression: visitLogicalExp, - visitIfStatement: visitCondition, - visitConditionalExpression: visitCondition -}; - -module.exports = function(branch) { - recast.visit(branch, VISITOR_METHODS); - return branch; -}; - - -/** - * "||" and "&&" - */ -function visitLogicalExp(path) { - var leftEval = Evaluator.booleanCondition(path.node.left); - - if (typeof leftEval !== 'boolean') { - // console.log('___ %s ___', path.node.operator); - this.traverse(path); - return; - } - - var leftSideEffect = Evaluator.hasSideEffect(path.node.left); - if (leftSideEffect) { - this.traverse(path); - return; - } - - if (leftEval === true && path.node.operator === '||') { - // console.log('true || ___'); - path.replace(path.node.left); - recast.visit(path, VISITOR_METHODS); - return false; - } - - if (leftEval === true && path.node.operator === '&&') { - // console.log('true && ___'); - path.replace(path.node.right); - recast.visit(path, VISITOR_METHODS); - return false; - } - - if (leftEval === false && path.node.operator === '&&') { - // console.log('false && ___'); - path.replace(path.node.left); - recast.visit(path, VISITOR_METHODS); - return false; - } - - if (leftEval === false && path.node.operator === '||') { - // console.log('false || ___'); - path.replace(path.node.right); - recast.visit(path, VISITOR_METHODS); - return false; - } -} - -/** - * "if" and ternary "?" - */ -function visitCondition(path) { - var testEval = Evaluator.booleanCondition(path.node.test); - - if (typeof testEval !== 'boolean') { - // console.log('if/? ___'); - this.traverse(path); - return; - } - - var testSideEffect = Evaluator.hasSideEffect(path.node.test); - if (testSideEffect) { - this.traverse(path); - return; - } - - if (testEval === true) { - // console.log('if/? (true)'); - path.replace(path.value.consequent); - recast.visit(path, VISITOR_METHODS); - return false; - } - - if (testEval === false) { - // console.log('if/? (false)'); - path.replace(path.value.alternate); - recast.visit(path, VISITOR_METHODS); - return false; - } -} diff --git a/deps/npm/node_modules/readable-stream/package.json b/deps/npm/node_modules/readable-stream/package.json index c480daa337..ef5ff11b1d 100644 --- a/deps/npm/node_modules/readable-stream/package.json +++ b/deps/npm/node_modules/readable-stream/package.json @@ -1,35 +1,40 @@ { "_args": [ [ - "readable-stream@latest", - "/Users/rebecca/code/npm" + { + "name": "readable-stream", + "raw": "readable-stream@2.1.3", + "rawSpec": "2.1.3", + "scope": null, + "spec": "2.1.3", + "type": "version" + }, + "/Users/zkat/Documents/code/npm" ] ], - "_from": "readable-stream@latest", - "_id": "readable-stream@2.1.0", + "_from": "readable-stream@2.1.3", + "_id": "readable-stream@2.1.3", "_inCache": true, "_installable": true, "_location": "/readable-stream", - "_nodeVersion": "5.10.1", + "_nodeVersion": "5.11.0", "_npmOperationalInternal": { "host": "packages-16-east.internal.npmjs.com", - "tmp": "tmp/readable-stream-2.1.0.tgz_1460568003255_0.9190005895216018" + "tmp": "tmp/readable-stream-2.1.3.tgz_1463587875388_0.811288726516068" }, "_npmUser": { "email": "calvin.metcalf@gmail.com", "name": "cwmma" }, - "_npmVersion": "3.8.3", - "_phantomChildren": { - "inherits": "2.0.1" - }, + "_npmVersion": "3.8.6", + "_phantomChildren": {}, "_requested": { "name": "readable-stream", - "raw": "readable-stream@latest", - "rawSpec": "latest", + "raw": "readable-stream@2.1.3", + "rawSpec": "2.1.3", "scope": null, - "spec": "latest", - "type": "tag" + "spec": "2.1.3", + "type": "version" }, "_requiredBy": [ "/", @@ -39,35 +44,29 @@ "/tap", "/tap/tap-parser" ], - "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.0.tgz", - "_shasum": "36f42ea0424eb29a985e4a81d31be2f96e1f2f80", + "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.3.tgz", + "_shasum": "9db8ec4025b4c71e69aec60b453b590c8afeb0df", "_shrinkwrap": null, - "_spec": "readable-stream@latest", - "_where": "/Users/rebecca/code/npm", + "_spec": "readable-stream@2.1.3", + "_where": "/Users/zkat/Documents/code/npm", "browser": { "util": false }, - "browserify": { - "transform": [ - "inline-process-browser", - "unreachable-branch-transform" - ] - }, "bugs": { "url": "https://github.com/nodejs/readable-stream/issues" }, "dependencies": { + "buffer-shims": "^1.0.0", "core-util-is": "~1.0.0", "inherits": "~2.0.1", - "inline-process-browser": "~2.0.1", "isarray": "~1.0.0", "process-nextick-args": "~1.0.6", "string_decoder": "~0.10.x", - "unreachable-branch-transform": "~0.5.0", "util-deprecate": "~1.0.1" }, "description": "Streams3, a user-land copy of the stream library from Node.js", "devDependencies": { + "assert": "~1.4.0", "nyc": "^6.4.0", "tap": "~0.7.1", "tape": "~4.5.1", @@ -75,10 +74,10 @@ }, "directories": {}, "dist": { - "shasum": "36f42ea0424eb29a985e4a81d31be2f96e1f2f80", - "tarball": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.0.tgz" + "shasum": "9db8ec4025b4c71e69aec60b453b590c8afeb0df", + "tarball": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.3.tgz" }, - "gitHead": "4c2d8e2639ffd516b12544ce0c117cc0345daa3f", + "gitHead": "abcff84645534aaedaed4192c4ce788af9112bc2", "homepage": "https://github.com/nodejs/readable-stream#readme", "keywords": [ "readable", @@ -125,5 +124,5 @@ "test": "tap test/parallel/*.js test/ours/*.js", "write-zuul": "printf \"ui: tape\nbrowsers:\n - name: $BROWSER_NAME\n version: $BROWSER_VERSION\n\">.zuul.yml" }, - "version": "2.1.0" + "version": "2.1.3" } diff --git a/deps/npm/node_modules/readable-stream/readable.js b/deps/npm/node_modules/readable-stream/readable.js index 0b0228a36d..be2688a071 100644 --- a/deps/npm/node_modules/readable-stream/readable.js +++ b/deps/npm/node_modules/readable-stream/readable.js @@ -11,8 +11,6 @@ exports.Duplex = require('./lib/_stream_duplex.js'); exports.Transform = require('./lib/_stream_transform.js'); exports.PassThrough = require('./lib/_stream_passthrough.js'); -// inline-process-browser and unreachable-branch-transform make sure this is -// removed in browserify builds -if (!process.browser && process.env.READABLE_STREAM === 'disable') { - module.exports = require('stream'); +if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream; } diff --git a/deps/npm/node_modules/realize-package-specifier/index.js b/deps/npm/node_modules/realize-package-specifier/index.js index 935f600b0a..eae8fbaf82 100644 --- a/deps/npm/node_modules/realize-package-specifier/index.js +++ b/deps/npm/node_modules/realize-package-specifier/index.js @@ -33,7 +33,9 @@ module.exports = function (spec, where, cb) { dep.name = null } } - if (dep.type == "local" || dep.type == "directory") dep.spec = specpath + if (dep.type == "local" || dep.type == "directory") { + dep.spec = path.resolve(specpath) + } cb(null, dep) } } diff --git a/deps/npm/node_modules/which/.npmignore b/deps/npm/node_modules/which/.npmignore deleted file mode 100644 index 0ac606ffcb..0000000000 --- a/deps/npm/node_modules/which/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -.nyc_output/ -coverage/ -node_modules/ diff --git a/deps/npm/node_modules/which/.travis.yml b/deps/npm/node_modules/which/.travis.yml deleted file mode 100644 index 7f22ad5a13..0000000000 --- a/deps/npm/node_modules/which/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -sudo: false -language: node_js -node_js: - - '0.10' - - '0.12' - - '4' diff --git a/deps/npm/node_modules/which/CHANGELOG.md b/deps/npm/node_modules/which/CHANGELOG.md new file mode 100644 index 0000000000..8309580424 --- /dev/null +++ b/deps/npm/node_modules/which/CHANGELOG.md @@ -0,0 +1,118 @@ +# Changes + + +## v1.2.9 + +* fix for paths starting with ../ +* Remove unused `is-absolute` module + +## v1.2.8 + +* bullet items in changelog that contain (but don't start with) # + +## v1.2.7 + +* strip 'update changelog' changelog entries out of changelog + +## v1.2.6 + +* make the changelog bulleted + +## v1.2.5 + +* make a changelog, and keep it up to date +* don't include tests in package +* Properly handle relative-path executables +* appveyor +* Attach error code to Not Found error +* Make tests pass on Windows + +## v1.2.4 + +* Fix typo + +## v1.2.3 + +* update isexe, fix regression in pathExt handling + +## v1.2.2 + +* update deps, use isexe module, test windows + +## v1.2.1 + +* Sometimes windows PATH entries are quoted +* Fixed a bug in the check for group and user mode bits. This bug was introduced during refactoring for supporting strict mode. +* doc cli + +## v1.2.0 + +* Add support for opt.all and -as cli flags +* test the bin +* update travis +* Allow checking for multiple programs in bin/which +* tap 2 + +## v1.1.2 + +* travis +* Refactored and fixed undefined error on Windows +* Support strict mode + +## v1.1.1 + +* test +g exes against secondary groups, if available +* Use windows exe semantics on cygwin & msys +* cwd should be first in path on win32, not last +* Handle lower-case 'env.Path' on Windows +* Update docs +* use single-quotes + +## v1.1.0 + +* Add tests, depend on is-absolute + +## v1.0.9 + +* which.js: root is allowed to execute files owned by anyone + +## v1.0.8 + +* don't use graceful-fs + +## v1.0.7 + +* add license to package.json + +## v1.0.6 + +* isc license + +## 1.0.5 + +* Awful typo + +## 1.0.4 + +* Test for path absoluteness properly +* win: Allow '' as a pathext if cmd has a . in it + +## 1.0.3 + +* Remove references to execPath +* Make `which.sync()` work on Windows by honoring the PATHEXT variable. +* Make `isExe()` always return true on Windows. +* MIT + +## 1.0.2 + +* Only files can be exes + +## 1.0.1 + +* Respect the PATHEXT env for win32 support +* should 0755 the bin +* binary +* guts +* package +* 1st diff --git a/deps/npm/node_modules/which/changelog.sh b/deps/npm/node_modules/which/changelog.sh new file mode 100644 index 0000000000..360e54af40 --- /dev/null +++ b/deps/npm/node_modules/which/changelog.sh @@ -0,0 +1,9 @@ +#!/bin/bash +( + echo '# Changes' + echo '' + git log --first-parent --pretty=format:'%s' \ + | grep -v '^update changelog' \ + | perl -p -e 's/^((v?[0-9]+\.?)+)$/\n## \1\n/g' \ + | perl -p -e 's/^([^#\s].*)$/* \1/g' +)> CHANGELOG.md diff --git a/deps/npm/node_modules/which/node_modules/is-absolute/LICENSE b/deps/npm/node_modules/which/node_modules/is-absolute/LICENSE deleted file mode 100644 index 904ab073b7..0000000000 --- a/deps/npm/node_modules/which/node_modules/is-absolute/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2015, Jon Schlinkert.Copyright (c) 2009-2015, TJ Holowaychuk. - -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/which/node_modules/is-absolute/README.md b/deps/npm/node_modules/which/node_modules/is-absolute/README.md deleted file mode 100644 index 2347828a3e..0000000000 --- a/deps/npm/node_modules/which/node_modules/is-absolute/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# is-absolute [![NPM version](https://badge.fury.io/js/is-absolute.svg)](http://badge.fury.io/js/is-absolute) [![Build Status](https://travis-ci.org/jonschlinkert/is-absolute.svg)](https://travis-ci.org/jonschlinkert/is-absolute) - -> Return true if a file path is absolute. - -Based on the `isAbsolute` utility method in [express](https://github.com/visionmedia/express). - -## Install with [npm](npmjs.org) - -```bash -npm i is-absolute --save -``` - -## Usage - -```js -var isAbsolute = require('is-absolute'); -console.log(isAbsolute('a/b/c.js')); -//=> 'false'; -``` - -## Running tests -Install dev dependencies. - -```bash -npm i -d && npm test -``` - - -## Contributing -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-absolute/issues) - - -## Other projects -* [is-relative](https://github.com/jonschlinkert/is-relative): Returns `true` if the path appears to be relative. -* [is-dotfile](https://github.com/regexps/is-dotfile): Return true if a file path is (or has) a dotfile. -* [is-glob](https://github.com/jonschlinkert/is-glob): Returns `true` if the given string looks like a glob pattern. -* [cwd](https://github.com/jonschlinkert/cwd): Node.js util for easily getting the current working directory of a project based on package.json or the given path. -* [git-config-path](https://github.com/jonschlinkert/git-config-path): Resolve the path to the user's global .gitconfig. - -## Author - -**Jon Schlinkert** - -+ [github/jonschlinkert](https://github.com/jonschlinkert) -+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) - -## License -Copyright (c) 2014-2015 Jon Schlinkert -Released under the MIT license - -*** - -_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 05, 2015._ diff --git a/deps/npm/node_modules/which/node_modules/is-absolute/index.js b/deps/npm/node_modules/which/node_modules/is-absolute/index.js deleted file mode 100644 index 9df4d5c240..0000000000 --- a/deps/npm/node_modules/which/node_modules/is-absolute/index.js +++ /dev/null @@ -1,26 +0,0 @@ -/*! - * is-absolute - * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT License. - */ - -'use strict'; - -var isRelative = require('is-relative'); - -module.exports = function isAbsolute(filepath) { - if ('/' === filepath[0]) { - return true; - } - if (':' === filepath[1] && '\\' === filepath[2]) { - return true; - } - // Microsoft Azure absolute filepath - if ('\\\\' == filepath.substring(0, 2)) { - return true; - } - if (!isRelative(filepath)) { - return true; - } -}; diff --git a/deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/LICENSE-MIT b/deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/LICENSE-MIT deleted file mode 100644 index b576e8d484..0000000000 --- a/deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/LICENSE-MIT +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Jon Schlinkert - -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/which/node_modules/is-absolute/node_modules/is-relative/README.md b/deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/README.md deleted file mode 100644 index 5d7a2a2aab..0000000000 --- a/deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# is-relative [![NPM version](https://badge.fury.io/js/is-relative.svg)](http://badge.fury.io/js/is-relative) - -> Returns `true` if the path appears to be relative. - -## Install -### Install with [npm](npmjs.org) - -```bash -npm i is-relative --save -``` - -## Usage -### [isRelative](index.js#L16) - -* `filepath` **{String}**: Path to test. -* `returns`: {Boolean} - -```js -var isRelative = require('is-relative'); -isRelative('README.md'); -//=> true -``` - - -## Author - -**Jon Schlinkert** - -+ [github/jonschlinkert](https://github.com/jonschlinkert) -+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) - -## License -Copyright (c) 2014 Jon Schlinkert -Released under the MIT license - -*** - -_This file was generated by [verb](https://github.com/assemble/verb) on November 17, 2014._ \ No newline at end of file diff --git a/deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/index.js b/deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/index.js deleted file mode 100644 index ffc760a82a..0000000000 --- a/deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/index.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -/** - * ```js - * var isRelative = require('is-relative'); - * isRelative('README.md'); - * //=> true - * ``` - * - * @name isRelative - * @param {String} `filepath` Path to test. - * @return {Boolean} - * @api public - */ - -module.exports = function isRelative(filepath) { - if (typeof filepath !== 'string') { - throw new Error('isRelative expects a string.'); - } - return !/^([a-z]+:)?[\\\/]/i.test(filepath); -}; \ No newline at end of file diff --git a/deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/package.json b/deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/package.json deleted file mode 100644 index d582081dd1..0000000000 --- a/deps/npm/node_modules/which/node_modules/is-absolute/node_modules/is-relative/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "is-relative", - "description": "Returns `true` if the path appears to be relative.", - "version": "0.1.3", - "homepage": "https://github.com/jonschlinkert/is-relative", - "author": { - "name": "Jon Schlinkert", - "url": "https://github.com/jonschlinkert" - }, - "repository": { - "type": "git", - "url": "git://github.com/jonschlinkert/is-relative.git" - }, - "bugs": { - "url": "https://github.com/jonschlinkert/is-relative/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/jonschlinkert/is-relative/blob/master/LICENSE-MIT" - } - ], - "keywords": [ - "absolute", - "check", - "file", - "filepath", - "is", - "normalize", - "path", - "path.relative", - "relative", - "resolve", - "slash", - "slashes", - "uri", - "url" - ], - "main": "index.js", - "files": [ - "index.js", - "LICENSE-MIT" - ], - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha -R spec" - }, - "devDependencies": { - "mocha": "*", - "verb": ">= 0.2.6", - "verb-tag-jscomments": "^0.1.4" - }, - "_id": "is-relative@0.1.3", - "_shasum": "905fee8ae86f45b3ec614bc3c15c869df0876e82", - "_from": "is-relative@>=0.1.0 <0.2.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "jonschlinkert", - "email": "github@sellside.com" - }, - "maintainers": [ - { - "name": "jonschlinkert", - "email": "github@sellside.com" - } - ], - "dist": { - "shasum": "905fee8ae86f45b3ec614bc3c15c869df0876e82", - "tarball": "http://registry.npmjs.org/is-relative/-/is-relative-0.1.3.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/is-relative/-/is-relative-0.1.3.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/deps/npm/node_modules/which/node_modules/is-absolute/package.json b/deps/npm/node_modules/which/node_modules/is-absolute/package.json deleted file mode 100644 index 4f954b855f..0000000000 --- a/deps/npm/node_modules/which/node_modules/is-absolute/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "is-absolute", - "description": "Return true if a file path is absolute.", - "version": "0.1.7", - "homepage": "https://github.com/jonschlinkert/is-absolute", - "author": { - "name": "Jon Schlinkert", - "url": "https://github.com/jonschlinkert" - }, - "repository": { - "type": "git", - "url": "git://github.com/jonschlinkert/is-absolute.git" - }, - "bugs": { - "url": "https://github.com/jonschlinkert/is-absolute/issues" - }, - "license": { - "type": "MIT", - "url": "https://github.com/jonschlinkert/is-absolute/blob/master/LICENSE" - }, - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "is-relative": "^0.1.0" - }, - "devDependencies": { - "mocha": "*" - }, - "keywords": [ - "absolute", - "check", - "file", - "filepath", - "is", - "normalize", - "path", - "path.relative", - "relative", - "resolve", - "slash", - "slashes", - "uri", - "url" - ], - "gitHead": "90cca7b671620bf28b778a61fddc8a986a2e1095", - "_id": "is-absolute@0.1.7", - "_shasum": "847491119fccb5fb436217cc737f7faad50f603f", - "_from": "is-absolute@>=0.1.7 <0.2.0", - "_npmVersion": "2.5.1", - "_nodeVersion": "0.12.0", - "_npmUser": { - "name": "jonschlinkert", - "email": "github@sellside.com" - }, - "maintainers": [ - { - "name": "jonschlinkert", - "email": "github@sellside.com" - } - ], - "dist": { - "shasum": "847491119fccb5fb436217cc737f7faad50f603f", - "tarball": "http://registry.npmjs.org/is-absolute/-/is-absolute-0.1.7.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-0.1.7.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/deps/npm/node_modules/which/node_modules/isexe/LICENSE b/deps/npm/node_modules/which/node_modules/isexe/LICENSE new file mode 100644 index 0000000000..19129e315f --- /dev/null +++ b/deps/npm/node_modules/which/node_modules/isexe/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/which/node_modules/isexe/package.json b/deps/npm/node_modules/which/node_modules/isexe/package.json index 49aeeab2a3..9f0f9d2aed 100644 --- a/deps/npm/node_modules/which/node_modules/isexe/package.json +++ b/deps/npm/node_modules/which/node_modules/isexe/package.json @@ -6,16 +6,20 @@ ] ], "_from": "isexe@>=1.1.1 <2.0.0", - "_id": "isexe@1.1.1", + "_id": "isexe@1.1.2", "_inCache": true, "_installable": true, "_location": "/which/isexe", "_nodeVersion": "4.0.0", + "_npmOperationalInternal": { + "host": "packages-9-west.internal.npmjs.com", + "tmp": "tmp/isexe-1.1.2.tgz_1454992795963_0.7608721863944083" + }, "_npmUser": { "email": "i@izs.me", "name": "isaacs" }, - "_npmVersion": "2.14.15", + "_npmVersion": "3.7.0", "_phantomChildren": {}, "_requested": { "name": "isexe", @@ -28,8 +32,8 @@ "_requiredBy": [ "/which" ], - "_resolved": "https://registry.npmjs.org/isexe/-/isexe-1.1.1.tgz", - "_shasum": "f0d4793ed2fb5c46bfdeab760bbb965f4485a66c", + "_resolved": "https://registry.npmjs.org/isexe/-/isexe-1.1.2.tgz", + "_shasum": "36f3e22e60750920f5e7241a476a8c6a42275ad0", "_shrinkwrap": null, "_spec": "isexe@^1.1.1", "_where": "/Users/rebecca/code/npm/node_modules/which", @@ -52,18 +56,18 @@ "test": "test" }, "dist": { - "shasum": "f0d4793ed2fb5c46bfdeab760bbb965f4485a66c", - "tarball": "http://registry.npmjs.org/isexe/-/isexe-1.1.1.tgz" + "shasum": "36f3e22e60750920f5e7241a476a8c6a42275ad0", + "tarball": "http://registry.npmjs.org/isexe/-/isexe-1.1.2.tgz" }, - "gitHead": "af83031caed58654ad9d20b98eb710d383618ad7", + "gitHead": "1882eed72c2ba152f4dd1336d857b0755ae306d9", "homepage": "https://github.com/isaacs/isexe#readme", "keywords": [], "license": "ISC", "main": "index.js", "maintainers": [ { - "name": "isaacs", - "email": "i@izs.me" + "email": "i@izs.me", + "name": "isaacs" } ], "name": "isexe", @@ -76,5 +80,5 @@ "scripts": { "test": "tap test/*.js --branches=100 --statements=100 --functions=100 --lines=100" }, - "version": "1.1.1" + "version": "1.1.2" } diff --git a/deps/npm/node_modules/which/package.json b/deps/npm/node_modules/which/package.json index 04f90fa687..9f1f7a9fcd 100644 --- a/deps/npm/node_modules/which/package.json +++ b/deps/npm/node_modules/which/package.json @@ -1,42 +1,54 @@ { "_args": [ [ - "which@~1.2.1", - "/Users/rebecca/code/npm" + { + "name": "which", + "raw": "which@1.2.9", + "rawSpec": "1.2.9", + "scope": null, + "spec": "1.2.9", + "type": "version" + }, + "/Users/zkat/Documents/code/npm" ] ], - "_from": "which@>=1.2.1 <1.3.0", - "_id": "which@1.2.4", + "_from": "which@1.2.9", + "_id": "which@1.2.9", "_inCache": true, "_installable": true, "_location": "/which", - "_nodeVersion": "4.0.0", + "_nodeVersion": "4.4.4", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/which-1.2.9.tgz_1463603459182_0.9633393425028771" + }, "_npmUser": { "email": "i@izs.me", "name": "isaacs" }, - "_npmVersion": "2.14.15", + "_npmVersion": "3.9.1", "_phantomChildren": {}, "_requested": { "name": "which", - "raw": "which@~1.2.1", - "rawSpec": "~1.2.1", + "raw": "which@1.2.9", + "rawSpec": "1.2.9", "scope": null, - "spec": ">=1.2.1 <1.3.0", - "type": "range" + "spec": "1.2.9", + "type": "version" }, "_requiredBy": [ "/", "/node-gyp", - "/standard/standard-format/esformatter/npm-run/npm-path", + "/tap/foreground-child", "/tap/foreground-child/cross-spawn-async", - "/tap/nyc/istanbul" + "/tap/nyc/istanbul", + "/tap/nyc/spawn-wrap" ], - "_resolved": "https://registry.npmjs.org/which/-/which-1.2.4.tgz", - "_shasum": "1557f96080604e5b11b3599eb9f45b50a9efd722", + "_resolved": "https://registry.npmjs.org/which/-/which-1.2.9.tgz", + "_shasum": "0b3a0e5c073bc10ca7b9ec13534eeef8a71ab61f", "_shrinkwrap": null, - "_spec": "which@~1.2.1", - "_where": "/Users/rebecca/code/npm", + "_spec": "which@1.2.9", + "_where": "/Users/zkat/Documents/code/npm", "author": { "email": "i@izs.me", "name": "Isaac Z. Schlueter", @@ -49,7 +61,6 @@ "url": "https://github.com/isaacs/node-which/issues" }, "dependencies": { - "is-absolute": "^0.1.7", "isexe": "^1.1.1" }, "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", @@ -60,17 +71,21 @@ }, "directories": {}, "dist": { - "shasum": "1557f96080604e5b11b3599eb9f45b50a9efd722", - "tarball": "http://registry.npmjs.org/which/-/which-1.2.4.tgz" + "shasum": "0b3a0e5c073bc10ca7b9ec13534eeef8a71ab61f", + "tarball": "https://registry.npmjs.org/which/-/which-1.2.9.tgz" }, - "gitHead": "1375684d40af9de2ecc527d1ab9b87b537d7a1cc", + "files": [ + "which.js", + "bin/which" + ], + "gitHead": "34aac93a4c4ee9e3c7a49fe09778ca942e636cce", "homepage": "https://github.com/isaacs/node-which#readme", "license": "ISC", "main": "which.js", "maintainers": [ { - "name": "isaacs", - "email": "i@izs.me" + "email": "i@izs.me", + "name": "isaacs" } ], "name": "which", @@ -81,7 +96,9 @@ "url": "git://github.com/isaacs/node-which.git" }, "scripts": { + "changelog": "bash changelog.sh", + "postversion": "npm run changelog && git add CHANGELOG.md && git commit -m 'update changelog - '${npm_package_version}", "test": "tap test/*.js --cov" }, - "version": "1.2.4" + "version": "1.2.9" } diff --git a/deps/npm/node_modules/which/test/basic.js b/deps/npm/node_modules/which/test/basic.js deleted file mode 100644 index 54c8d2384d..0000000000 --- a/deps/npm/node_modules/which/test/basic.js +++ /dev/null @@ -1,120 +0,0 @@ -var t = require('tap') -var fs = require('fs') -var rimraf = require('rimraf') -var mkdirp = require('mkdirp') -var fixture = __dirname + '/fixture' -var which = require('../which.js') -var path = require('path') - -var isWindows = process.platform === 'win32' || - process.env.OSTYPE === 'cygwin' || - process.env.OSTYPE === 'msys' - -var skip = { skip: isWindows ? 'not relevant on windows' : false } - -t.test('setup', function (t) { - rimraf.sync(fixture) - mkdirp.sync(fixture) - fs.writeFileSync(fixture + '/foo.sh', 'echo foo\n') - t.end() -}) - -t.test('does not find non-executable', skip, function (t) { - t.plan(2) - - t.test('absolute', function (t) { - t.plan(2) - which(fixture + '/foo.sh', function (er) { - t.isa(er, Error) - }) - - t.throws(function () { - which.sync(fixture + '/foo.sh') - }) - }) - - t.test('with path', function (t) { - t.plan(2) - which('foo.sh', { path: fixture }, function (er) { - t.isa(er, Error) - }) - - t.throws(function () { - which.sync('foo.sh', { path: fixture }) - }) - }) -}) - -t.test('make executable', function (t) { - fs.chmodSync(fixture + '/foo.sh', '0755') - t.end() -}) - -t.test('find when executable', function (t) { - var opt = { pathExt: '.sh' } - var expect = path.resolve(fixture, 'foo.sh').toLowerCase() - var PATH = process.env.PATH || process.env.Path - - t.test('absolute', function (t) { - runTest(fixture + '/foo.sh', t) - }) - - t.test('with process.env.PATH', function (t) { - process.env.PATH = process.env.Path = fixture - runTest('foo.sh', t) - }) - - t.test('with process.env.Path', { - skip: isWindows ? false : 'Only for Windows' - }, function (t) { - process.env.PATH = "" - process.env.Path = fixture - runTest('foo.sh', t) - }) - - t.test('with pathExt', { - skip: isWindows ? false : 'Only for Windows' - }, function (t) { - var pe = process.env.PATHEXT - process.env.PATHEXT = '.SH' - - t.test('foo.sh', function (t) { - runTest('foo.sh', t) - }) - t.test('foo', function (t) { - runTest('foo', t) - }) - t.test('replace', function (t) { - process.env.PATHEXT = pe - t.end() - }) - t.end() - }) - - t.test('with path opt', function (t) { - opt.path = fixture - runTest('foo.sh', t) - }) - - function runTest(exec, t) { - t.plan(2) - - var found = which.sync(exec, opt).toLowerCase() - t.equal(found, expect) - - which(exec, opt, function (er, found) { - if (er) - throw er - t.equal(found.toLowerCase(), expect) - t.end() - process.env.PATH = PATH - }) - } - - t.end() -}) - -t.test('clean', function (t) { - rimraf.sync(fixture) - t.end() -}) diff --git a/deps/npm/node_modules/which/test/bin.js b/deps/npm/node_modules/which/test/bin.js deleted file mode 100644 index ff7eb530c7..0000000000 --- a/deps/npm/node_modules/which/test/bin.js +++ /dev/null @@ -1,119 +0,0 @@ -var t = require('tap') -var spawn = require('child_process').spawn -var node = process.execPath -var bin = require.resolve('../bin/which') - -function which (args, extraPath, cb) { - if (typeof extraPath === 'function') - cb = extraPath, extraPath = null - - var options = {} - if (extraPath) { - var sep = process.platform === 'win32' ? ';' : ':' - var p = process.env.PATH + sep + extraPath - options.env = Object.keys(process.env).reduce(function (env, k) { - if (!k.match(/^path$/i)) - env[k] = process.env[k] - return env - }, { PATH: p }) - } - - var out = '' - var err = '' - var child = spawn(node, [bin].concat(args), options) - child.stdout.on('data', function (c) { - out += c - }) - child.stderr.on('data', function (c) { - err += c - }) - child.on('close', function (code, signal) { - cb(code, signal, out.trim(), err.trim()) - }) -} - -t.test('finds node', function (t) { - which('node', function (code, signal, out, err) { - t.equal(signal, null) - t.equal(code, 0) - t.equal(err, '') - t.match(out, /[\\\/]node(\.exe)?$/) - t.end() - }) -}) - -t.test('does not find flergyderp', function (t) { - which('flergyderp', function (code, signal, out, err) { - t.equal(signal, null) - t.equal(code, 1) - t.equal(err, '') - t.match(out, '') - t.end() - }) -}) - -t.test('finds node and tap', function (t) { - which(['node', 'tap'], function (code, signal, out, err) { - t.equal(signal, null) - t.equal(code, 0) - t.equal(err, '') - t.match(out.split(/\n/), [ - /[\\\/]node(\.exe)?$/, - /[\\\/]tap(\.cmd)?$/ - ]) - t.end() - }) -}) - -t.test('finds node and tap, but not flergyderp', function (t) { - which(['node', 'flergyderp', 'tap'], function (code, signal, out, err) { - t.equal(signal, null) - t.equal(code, 1) - t.equal(err, '') - t.match(out.split(/\n/), [ - /[\\\/]node(\.exe)?$/, - /[\\\/]tap(\.cmd)?$/ - ]) - t.end() - }) -}) - -t.test('cli flags', function (t) { - var p = require('path').dirname(bin) - var cases = [ '-a', '-s', '-as', '-sa' ] - t.plan(cases.length) - cases.forEach(function (c) { - t.test(c, function (t) { - which(['which', c], p, function (code, signal, out, err) { - t.equal(signal, null) - t.equal(code, 0) - t.equal(err, '') - if (/s/.test(c)) - t.equal(out, '', 'should be silent') - else if (/a/.test(c)) - t.ok(out.split(/\n/).length > 1, 'should have more than 1 result') - t.end() - }) - }) - }) -}) - -t.test('shows usage', function (t) { - which([], function (code, signal, out, err) { - t.equal(signal, null) - t.equal(code, 1) - t.equal(err, 'usage: which [-as] program ...') - t.equal(out, '') - t.end() - }) -}) - -t.test('complains about unknown flag', function (t) { - which(['node', '-sax'], function (code, signal, out, err) { - t.equal(signal, null) - t.equal(code, 1) - t.equal(out, '') - t.equal(err, 'which: illegal option -- x\nusage: which [-as] program ...') - t.end() - }) -}) diff --git a/deps/npm/node_modules/which/test/windows.js b/deps/npm/node_modules/which/test/windows.js deleted file mode 100644 index 1d5e4294a6..0000000000 --- a/deps/npm/node_modules/which/test/windows.js +++ /dev/null @@ -1,10 +0,0 @@ -// pretend to be Windows. -if (process.platform === 'win32') { - var t = require('tap') - t.plan(0, 'already on windows') - process.exit(0) -} - -process.env.Path = process.env.PATH.split(':').join(';') -process.env.OSTYPE = 'cygwin' -require('./basic.js') diff --git a/deps/npm/node_modules/which/which.js b/deps/npm/node_modules/which/which.js index 5cf0124d78..b61da894ff 100644 --- a/deps/npm/node_modules/which/which.js +++ b/deps/npm/node_modules/which/which.js @@ -9,9 +9,15 @@ var path = require('path') var COLON = isWindows ? ';' : ':' var isexe = require('isexe') var fs = require('fs') -var isAbsolute = require('is-absolute') -function getPathInfo(cmd, opt) { +function getNotFoundError (cmd) { + var er = new Error('not found: ' + cmd) + er.code = 'ENOENT' + + return er +} + +function getPathInfo (cmd, opt) { var colon = opt.colon || COLON var pathEnv = opt.path || process.env.Path || process.env.PATH || '' var pathExt = [''] @@ -31,9 +37,9 @@ function getPathInfo(cmd, opt) { pathExt.unshift('') } - // If it's absolute, then we don't bother searching the pathenv. + // If it has a slash, then we don't bother searching the pathenv. // just check the file itself, and that's it. - if (isAbsolute(cmd)) + if (cmd.match(/\//) || isWindows && cmd.match(/\\/)) pathEnv = [''] return { @@ -60,14 +66,17 @@ function which (cmd, opt, cb) { if (opt.all && found.length) return cb(null, found) else - return cb(new Error('not found: '+cmd)) + return cb(getNotFoundError(cmd)) } var pathPart = pathEnv[i] if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') pathPart = pathPart.slice(1, -1) - var p = path.resolve(pathPart, cmd) + var p = path.join(pathPart, cmd) + if (!pathPart && (/^\.[\\\/]/).test(cmd)) { + p = cmd.slice(0, 2) + p + } ;(function E (ii, ll) { if (ii === ll) return F(i + 1, l) var ext = pathExt[ii] @@ -99,6 +108,9 @@ function whichSync (cmd, opt) { pathPart = pathPart.slice(1, -1) var p = path.join(pathPart, cmd) + if (!pathPart && /^\.[\\\/]/.test(cmd)) { + p = cmd.slice(0, 2) + p + } for (var j = 0, ll = pathExt.length; j < ll; j ++) { var cur = p + pathExt[j] var is @@ -117,5 +129,5 @@ function whichSync (cmd, opt) { if (opt.all && found.length) return found - throw new Error('not found: '+cmd) + throw getNotFoundError(cmd) } diff --git a/deps/npm/package.json b/deps/npm/package.json index 567aafb9a1..1623994091 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "3.8.9", + "version": "3.9.3", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -44,24 +44,24 @@ "fs-vacuum": "~1.2.9", "fs-write-stream-atomic": "~1.0.8", "fstream": "~1.0.8", - "fstream-npm": "~1.0.7", + "fstream-npm": "~1.1.0", "glob": "~7.0.3", - "graceful-fs": "~4.1.3", + "graceful-fs": "~4.1.4", "has-unicode": "~2.0.0", - "hosted-git-info": "~2.1.4", + "hosted-git-info": "~2.1.5", "iferr": "~0.1.5", - "inflight": "~1.0.4", + "inflight": "~1.0.5", "inherits": "~2.0.1", "ini": "~1.3.4", - "init-package-json": "~1.9.3", + "init-package-json": "~1.9.4", "lockfile": "~1.0.1", - "lodash._baseuniq": "~4.5.1", + "lodash._baseuniq": "~4.6.0", "lodash.clonedeep": "~4.3.2", "lodash.isarray": "~4.0.0", - "lodash.keys": "~4.0.6", - "lodash.union": "~4.3.0", - "lodash.uniq": "~4.2.1", - "lodash.without": "~4.1.2", + "lodash.keys": "~4.0.7", + "lodash.union": "~4.4.0", + "lodash.uniq": "~4.3.0", + "lodash.without": "~4.2.0", "mkdirp": "~0.5.1", "node-gyp": "~3.3.1", "nopt": "~3.0.6", @@ -81,8 +81,8 @@ "read-cmd-shim": "~1.0.1", "read-installed": "~4.0.3", "read-package-json": "~2.0.4", - "read-package-tree": "~5.1.2", - "readable-stream": "~2.1.0", + "read-package-tree": "~5.1.4", + "readable-stream": "~2.1.3", "realize-package-specifier": "~3.0.3", "request": "~2.72.0", "retry": "~0.9.0", @@ -99,7 +99,7 @@ "unique-filename": "~1.1.0", "unpipe": "~1.0.0", "validate-npm-package-name": "~2.2.2", - "which": "~1.2.4", + "which": "~1.2.9", "wrappy": "~1.0.1", "write-file-atomic": "~1.1.4" }, @@ -196,7 +196,7 @@ "npm-registry-mock": "~1.0.1", "require-inject": "~1.3.1", "sprintf-js": "~1.0.3", - "standard": "~5.4.1", + "standard": "~6.0.8", "tacks": "~1.2.1", "tap": "~5.7.1" }, @@ -204,7 +204,7 @@ "dumpconf": "env | grep npm | sort | uniq", "prepublish": "node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make doc-clean && make -j4 doc", "preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"update AUTHORS\" || true", - "tap": "tap --timeout 240", + "tap": "tap --coverage --reporter=classic --timeout 300", "test": "standard && npm run test-tap", "test-tap": "npm run tap -- \"test/tap/*.js\"", "test-node": "\"$NODE\" \"node_modules/.bin/tap\" --timeout 240 \"test/tap/*.js\"" diff --git a/deps/npm/test/common-tap.js b/deps/npm/test/common-tap.js index d7e9c8f7d0..847c87ba0f 100644 --- a/deps/npm/test/common-tap.js +++ b/deps/npm/test/common-tap.js @@ -1,3 +1,8 @@ +'use strict' +var fs = require('graceful-fs') +var readCmdShim = require('read-cmd-shim') +var isWindows = require('../lib/utils/is-windows.js') + // cheesy hackaround for test deps (read: nock) that rely on setImmediate if (!global.setImmediate || !require('timers').setImmediate) { require('timers').setImmediate = global.setImmediate = function () { @@ -25,9 +30,12 @@ process.env.random_env_var = 'foo' process.env.npm_config_node_version = process.version.replace(/-.*$/, '') var bin = exports.bin = require.resolve('../bin/npm-cli.js') + var chain = require('slide').chain var once = require('once') +var nodeBin = exports.nodeBin = process.env.npm_node_execpath || process.env.NODE || process.execPath + exports.npm = function (cmd, opts, cb) { cb = once(cb) cmd = [bin].concat(cmd) @@ -40,8 +48,7 @@ exports.npm = function (cmd, opts, cb) { var stdout = '' var stderr = '' - var node = process.execPath - var child = spawn(node, cmd, opts) + var child = spawn(nodeBin, cmd, opts) if (child.stderr) { child.stderr.on('data', function (chunk) { @@ -88,3 +95,27 @@ exports.makeGitRepo = function (params, cb) { chain(commands, cb) } + +exports.readBinLink = function (path) { + if (isWindows) { + return readCmdShim.sync(path) + } else { + return fs.readlinkSync(path) + } +} + +exports.skipIfWindows = function (why) { + if (!isWindows) return + console.log('1..1') + if (!why) why = 'this test not available on windows' + console.log('ok 1 # skip ' + why) + process.exit(0) +} + +exports.pendIfWindows = function (why) { + if (!isWindows) return + console.log('1..1') + if (!why) why = 'this test is pending further changes on windows' + console.log('not ok 1 # todo ' + why) + process.exit(0) +} diff --git a/deps/npm/test/fixtures/config/userconfig-with-gc b/deps/npm/test/fixtures/config/userconfig-with-gc new file mode 100644 index 0000000000..62ad80be11 --- /dev/null +++ b/deps/npm/test/fixtures/config/userconfig-with-gc @@ -0,0 +1,22 @@ +globalconfig=/Users/zkat/Documents/code/npm/test/fixtures/config/globalconfig +email=i@izs.me +env-thing=asdf +init.author.name=Isaac Z. Schlueter +init.author.email=i@izs.me +init.author.url=http://blog.izs.me/ +init.version=1.2.3 +proprietary-attribs=false +npm:publishtest=true +_npmjs.org:couch=https://admin:password@localhost:5984/registry +npm-www:nocache=1 +sign-git-tag=false +message=v%s +strict-ssl=false +_auth="dXNlcm5hbWU6cGFzc3dvcmQ=" + +[_token] +AuthSession=yabba-dabba-doodle +version=1 +expires=1345001053415 +path=/ +httponly=true diff --git a/deps/npm/test/tap/00-config-setup.js b/deps/npm/test/tap/00-config-setup.js index 0310f48d5c..7303c8328f 100644 --- a/deps/npm/test/tap/00-config-setup.js +++ b/deps/npm/test/tap/00-config-setup.js @@ -21,7 +21,7 @@ exports.ucData = 'sign-git-tag': true, message: 'v%s', 'strict-ssl': false, - 'tmp': process.env.HOME + '/.tmp', + 'tmp': path.normalize(process.env.HOME + '/.tmp'), _auth: 'dXNlcm5hbWU6cGFzc3dvcmQ=', _token: { AuthSession: 'yabba-dabba-doodle', @@ -38,10 +38,10 @@ Object.keys(process.env).forEach(function (k) { } }) process.env.npm_config_userconfig = exports.userconfig -process.env.npm_config_other_env_thing = 1000 +process.env.npm_config_other_env_thing = '1000' process.env.random_env_var = 'asdf' process.env.npm_config__underbar_env_thing = 'underful' -process.env.NPM_CONFIG_UPPERCASE_ENV_THING = 42 +process.env.NPM_CONFIG_UPPERCASE_ENV_THING = '42' exports.envData = { userconfig: exports.userconfig, @@ -61,11 +61,11 @@ try { fs.statSync(projectConf) } catch (er) { // project conf not found, probably working with packed npm - fs.writeFileSync(projectConf, function () {/* + fs.writeFileSync(projectConf, function () { /* save-prefix = ~ proprietary-attribs = false legacy-bundling = true - */}.toString().split('\n').slice(1, -1).join('\n')) + */ }.toString().split('\n').slice(1, -1).join('\n')) } var projectRc = path.join(__dirname, '..', 'fixtures', 'config', '.npmrc') diff --git a/deps/npm/test/tap/bugs.js b/deps/npm/test/tap/bugs.js index 090c2b9cb2..8b992fd7be 100644 --- a/deps/npm/test/tap/bugs.js +++ b/deps/npm/test/tap/bugs.js @@ -1,9 +1,6 @@ -if (process.platform === 'win32') { - console.error('skipping test, because windows and shebangs') - process.exit(0) -} - var common = require('../common-tap.js') +common.pendIfWindows('not working because Windows and shebangs') + var mr = require('npm-registry-mock') var test = require('tap').test diff --git a/deps/npm/test/tap/builtin-config.js b/deps/npm/test/tap/builtin-config.js index bb08767c56..22a447c9cf 100644 --- a/deps/npm/test/tap/builtin-config.js +++ b/deps/npm/test/tap/builtin-config.js @@ -14,7 +14,7 @@ var folder = path.resolve(__dirname, 'builtin-config') var test = require('tap').test var npm = path.resolve(__dirname, '../..') var spawn = require('child_process').spawn -var node = process.execPath +var node = common.nodeBin test('setup', function (t) { t.plan(1) @@ -34,9 +34,10 @@ test('install npm into first folder', function (t) { '--prefix=' + folder + '/first', '--ignore-scripts', '--cache=' + folder + '/cache', - '--loglevel=silent', - '--tmp=' + folder + '/tmp'] - common.npm(args, {stdio: 'inherit'}, function (er, code) { + '--tmp=' + folder + '/tmp', + '--loglevel=warn', + '--progress'] + common.npm(args, {}, function (er, code) { if (er) throw er t.equal(code, 0) t.end() @@ -49,8 +50,7 @@ test('write npmrc file', function (t) { '--prefix=' + folder + '/first', '--cache=' + folder + '/cache', '--tmp=' + folder + '/tmp', - '--', - node, __filename, 'write-builtin', process.pid + '--', node, __filename, 'write-builtin', process.pid ], {'stdio': 'inherit'}, function (er, code) { @@ -73,9 +73,9 @@ test('use first npm to install second npm', function (t) { {}, function (er, code, so) { if (er) throw er - t.equal(code, 0) + t.equal(code, 0, 'got npm root') var root = so.trim() - t.ok(fs.statSync(root).isDirectory()) + t.ok(fs.statSync(root).isDirectory(), 'npm root is dir') var bin = path.resolve(root, 'npm/bin/npm-cli.js') spawn( @@ -84,14 +84,16 @@ test('use first npm to install second npm', function (t) { bin, 'install', npm, '-g', + '--ignore-scripts', '--prefix=' + folder + '/second', '--cache=' + folder + '/cache', '--tmp=' + folder + '/tmp' - ] + ], + {} ) .on('error', function (er) { throw er }) .on('close', function (code) { - t.equal(code, 0, 'code is zero') + t.equal(code, 0, 'second npm install') t.end() }) } @@ -120,9 +122,9 @@ test('verify that the builtin config matches', function (t) { var secondRoot = so.trim() var firstRc = path.resolve(firstRoot, 'npm', 'npmrc') var secondRc = path.resolve(secondRoot, 'npm', 'npmrc') - var firstData = fs.readFileSync(firstRc, 'utf8') - var secondData = fs.readFileSync(secondRc, 'utf8') - t.equal(firstData, secondData) + var firstData = fs.readFileSync(firstRc, 'utf8').split(/\r?\n/) + var secondData = fs.readFileSync(secondRc, 'utf8').split(/\r?\n/) + t.isDeeply(firstData, secondData) t.end() }) }) diff --git a/deps/npm/test/tap/bundled-dependencies-no-pkgjson.js b/deps/npm/test/tap/bundled-dependencies-no-pkgjson.js new file mode 100644 index 0000000000..44eb47a03a --- /dev/null +++ b/deps/npm/test/tap/bundled-dependencies-no-pkgjson.js @@ -0,0 +1,47 @@ +var test = require('tap').test +var path = require('path') +var fs = require('graceful-fs') + +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') +var common = require('../common-tap.js') + +var dir = path.resolve(__dirname, 'bundled-dependencies-no-pkgjson') +var pkg = path.resolve(dir, 'pkg-with-bundled-dep') +var dep = path.resolve(pkg, 'node_modules', 'a-bundled-dep') + +var pkgJson = JSON.stringify({ + name: 'pkg-with-bundled-dep', + version: '1.0.0', + dependencies: { + }, + bundledDependencies: [ + 'a-bundled-dep' + ] +}, null, 2) + '\n' + +test('setup', function (t) { + mkdirp.sync(path.join(dir, 'node_modules')) + mkdirp.sync(dep) + + fs.writeFileSync(path.resolve(pkg, 'package.json'), pkgJson) + fs.writeFileSync(path.resolve(dep, 'index.js'), '') + t.end() +}) + +test('proper error on bundled dep with no package.json', function (t) { + t.plan(3) + var npmArgs = ['install', './' + path.basename(pkg)] + + common.npm(npmArgs, { cwd: dir }, function (err, code, stdout, stderr) { + t.ifError(err, 'npm ran without issue') + t.notEqual(code, 0) + t.like(stderr, /ENOENT/, 'ENOENT should be in stderr') + t.end() + }) +}) + +test('cleanup', function (t) { + rimraf.sync(dir) + t.end() +}) diff --git a/deps/npm/test/tap/cache-ls-filenames.js b/deps/npm/test/tap/cache-ls-filenames.js new file mode 100644 index 0000000000..c67bca25f3 --- /dev/null +++ b/deps/npm/test/tap/cache-ls-filenames.js @@ -0,0 +1,51 @@ +var t = require('tap') +var path = require('path') +var fs = require('fs') +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') +var spawn = require('child_process').spawn +var npm = require.resolve('../../bin/npm-cli.js') +var dir = path.resolve(__dirname, 'cache-ls-filenames') +var node = process.execPath + +t.test('setup', function (t) { + rimraf.sync(dir) + mkdirp.sync(dir + '/a/b/c/d') + for (var i = 0; i < 5; i++) { + fs.writeFileSync(dir + '/file-' + i, 'x\n') + fs.writeFileSync(dir + '/a/b/file-' + i, 'x\n') + } + t.end() +}) + +function test (t, args) { + var child = spawn(node, [npm, 'cache', 'ls', '--cache=' + dir].concat(args)) + var out = '' + child.stdout.on('data', function (c) { + out += c + }) + child.on('close', function (code, signal) { + t.equal(code, 0) + t.equal(signal, null) + out.trim().split(/[\n\r]+/).map(function (filename) { + return filename.replace(/^~/, process.env.HOME) + }).forEach(function (file) { + // verify that all exist + t.ok(fs.existsSync(file), 'exists: ' + file) + }) + t.end() + }) +} + +t.test('without path arg', function (t) { + test(t, []) +}) + +t.test('with path arg', function (t) { + test(t, ['a']) +}) + +t.test('cleanup', function (t) { + rimraf.sync(dir) + t.end() +}) diff --git a/deps/npm/test/tap/cache-shasum.js b/deps/npm/test/tap/cache-shasum.js index 90915ed850..40495c0995 100644 --- a/deps/npm/test/tap/cache-shasum.js +++ b/deps/npm/test/tap/cache-shasum.js @@ -1,4 +1,3 @@ -var npm = require.resolve('../../') var test = require('tap').test var path = require('path') var rimraf = require('rimraf') @@ -6,7 +5,6 @@ var mkdirp = require('mkdirp') var mr = require('npm-registry-mock') var common = require('../common-tap.js') var cache = path.resolve(__dirname, 'cache-shasum') -var spawn = require('child_process').spawn var sha = require('sha') var server @@ -21,20 +19,15 @@ test('mock reg', function (t) { }) test('npm cache add request', function (t) { - var c = spawn(process.execPath, [ - npm, 'cache', 'add', 'request@2.27.0', + common.npm([ + 'cache', 'add', 'request@2.27.0', '--cache=' + cache, '--registry=' + common.registry, - '--loglevel=quiet' - ]) - c.stderr.pipe(process.stderr) - - c.stdout.on('data', function (d) { - t.fail('Should not get data on stdout: ' + d) - }) - - c.on('close', function (code) { - t.notOk(code, 'exit ok') + '--loglevel=error' + ], {}, function (err, code, stdout) { + if (err) throw err + t.is(code, 0, 'cmd ran without error') + t.is(stdout, '', 'should not get data on stdout') t.end() }) }) @@ -53,6 +46,5 @@ test('compare', function (t) { test('cleanup', function (t) { server.close() - rimraf.sync(cache) - t.end() + rimraf(cache, t.end) }) diff --git a/deps/npm/test/tap/check-permissions.js b/deps/npm/test/tap/check-permissions.js index d3c0c6da25..0a5f2e038a 100644 --- a/deps/npm/test/tap/check-permissions.js +++ b/deps/npm/test/tap/check-permissions.js @@ -78,9 +78,14 @@ function writableTests (t, writable) { writable(writableDir, function (er) { t.error(er, 'writable dir is writable') }) - writable(nonWritableDir, function (er) { - t.ok(er, 'non-writable dir resulted in an error') - }) + if (process.platform !== 'win32') { + // Windows folders cannot be set to be read-only. + writable(nonWritableDir, function (er) { + t.ok(er, 'non-writable dir resulted in an error') + }) + } else { + t.pass('windows folders cannot be read-only') + } } function cleanup () { diff --git a/deps/npm/test/tap/config-basic.js b/deps/npm/test/tap/config-basic.js index ff33181470..cabfa24396 100644 --- a/deps/npm/test/tap/config-basic.js +++ b/deps/npm/test/tap/config-basic.js @@ -11,7 +11,6 @@ var projectData = { var ucData = common.ucData var envData = common.envData -var envDataFix = common.envDataFix var gcData = { 'package-config:foo': 'boo' } @@ -19,9 +18,17 @@ var biData = {} var cli = { foo: 'bar', umask: parseInt('022', 8) } +var expectNames = [ + 'cli', + 'envData', + 'projectData', + 'ucData', + 'gcData', + 'biData' +] var expectList = [ cli, - envDataFix, + envData, projectData, ucData, gcData, @@ -31,7 +38,7 @@ var expectList = [ var expectSources = { cli: { data: cli }, env: { - data: envDataFix, + data: envData, source: envData, prefix: '' }, @@ -53,17 +60,31 @@ var expectSources = { builtin: { data: biData } } +function isDeeplyDetails (t, aa, bb, msg, seen) { + if (aa == null && bb == null) return t.pass(msg) + if (typeof bb !== 'object') return t.is(aa, bb, msg) + if (!seen) seen = [] + for (var kk in seen) if (seen[kk] === aa || seen[kk] === bb) return + seen.push(aa, bb) + t.is(Object.keys(aa).length, Object.keys(bb).length, msg + ': # of elements') + Object.keys(bb).forEach(function (key) { + isDeeplyDetails(t, aa[key], bb[key], msg + ' -> ' + key, seen) + }) +} + test('no builtin', function (t) { t.comment(process.env) npmconf.load(cli, function (er, conf) { if (er) throw er - t.same(conf.list, expectList, 'config properties in list format match expected') - t.same(conf.sources, expectSources, 'config by source matches expected') + expectNames.forEach(function (name, ii) { + isDeeplyDetails(t, conf.list[ii], expectList[ii], 'config properities list: ' + name) + }) + isDeeplyDetails(t, conf.sources, expectSources, 'config by source') t.same(npmconf.rootConf.list, [], 'root configuration is empty') - t.equal(npmconf.rootConf.root, npmconf.defs.defaults, 'defaults match up') - t.equal(conf.root, npmconf.defs.defaults, 'current root config matches defaults') - t.equal(conf.get('umask'), parseInt('022', 8), 'umask is as expected') - t.equal(conf.get('heading'), 'npm', 'config name is as expected') + isDeeplyDetails(t, npmconf.rootConf.root, npmconf.defs.defaults, 'defaults') + isDeeplyDetails(t, conf.root, npmconf.defs.defaults, 'current root config is defaults') + t.is(conf.get('umask'), parseInt('022', 8), 'umask is as expected') + t.is(conf.get('heading'), 'npm', 'config name is as expected') t.end() }) }) diff --git a/deps/npm/test/tap/config-certfile.js b/deps/npm/test/tap/config-certfile.js index 223ff34196..4b960672ad 100644 --- a/deps/npm/test/tap/config-certfile.js +++ b/deps/npm/test/tap/config-certfile.js @@ -12,7 +12,8 @@ test('cafile loads as ca', function (t) { if (er) throw er t.same(conf.get('cafile'), cafile) - t.same(conf.get('ca').join('\n'), fs.readFileSync(cafile, 'utf8').trim()) + var ca = fs.readFileSync(cafile, 'utf8').trim() + t.same(conf.get('ca').join(ca.match(/\r/g) ? '\r\n' : '\n'), ca) t.end() }) }) diff --git a/deps/npm/test/tap/config-edit.js b/deps/npm/test/tap/config-edit.js index f9e09aba3a..7d6eb2588d 100644 --- a/deps/npm/test/tap/config-edit.js +++ b/deps/npm/test/tap/config-edit.js @@ -8,7 +8,7 @@ var common = require('../common-tap.js') var pkg = path.resolve(__dirname, 'npm-global-edit') -var editorSrc = function () {/* +var editorSrc = function () { /* #!/usr/bin/env node var fs = require('fs') if (fs.existsSync(process.argv[2])) { @@ -17,7 +17,7 @@ if (fs.existsSync(process.argv[2])) { console.log('error') process.exit(1) } -*/}.toString().split('\n').slice(1, -1).join('\n') +*/ }.toString().split('\n').slice(1, -1).join('\n') var editorPath = path.join(pkg, 'editor') test('setup', function (t) { @@ -38,7 +38,9 @@ test('saving configs', function (t) { cwd: pkg, env: { PATH: process.env.PATH, - EDITOR: editorPath + // We rely on the cwd + relative path combo here because otherwise, + // this test will break if there's spaces in the editorPath + EDITOR: 'node editor' } } common.npm( diff --git a/deps/npm/test/tap/dedupe-scoped.js b/deps/npm/test/tap/dedupe-scoped.js index bc352356d4..bcd520420b 100644 --- a/deps/npm/test/tap/dedupe-scoped.js +++ b/deps/npm/test/tap/dedupe-scoped.js @@ -11,12 +11,12 @@ var modules = join(pkg, 'node_modules') var EXEC_OPTS = { cwd: pkg } -var body = function () {/* -@scope/shared@2.1.6 node_modules/first/node_modules/@scope/shared -> node_modules/@scope/shared -firstUnique@0.6.0 node_modules/first/node_modules/firstUnique -> node_modules/firstUnique -secondUnique@1.2.0 node_modules/second/node_modules/secondUnique -> node_modules/secondUnique -- @scope/shared@2.1.6 node_modules/second/node_modules/@scope/shared -*/}.toString().split('\n').slice(1, -1) +var body = [ + '@scope/shared@2.1.6 node_modules/first/node_modules/@scope/shared -> node_modules/@scope/shared', + 'firstUnique@0.6.0 node_modules/first/node_modules/firstUnique -> node_modules/firstUnique', + 'secondUnique@1.2.0 node_modules/second/node_modules/secondUnique -> node_modules/secondUnique', + '- @scope/shared@2.1.6 node_modules/second/node_modules/@scope/shared' +] var deduper = { 'name': 'dedupe', @@ -79,7 +79,7 @@ test('dedupe finds the common scoped modules and moves it up one level', functio t.notOk(code, 'npm ran without issue') t.notOk(stderr, 'npm printed no errors') t.same( - stdout.trim().split('\n').map(ltrimm), + stdout.trim().replace(/\\/g, '/').split('\n').map(ltrimm), body.map(ltrimm), 'got expected output' ) diff --git a/deps/npm/test/tap/do-not-remove-other-bins.js b/deps/npm/test/tap/do-not-remove-other-bins.js index af6de62305..6fec728d43 100644 --- a/deps/npm/test/tap/do-not-remove-other-bins.js +++ b/deps/npm/test/tap/do-not-remove-other-bins.js @@ -93,7 +93,7 @@ test('verify bins', function (t) { var bin = path.dirname( path.resolve( installBin, - fs.readlinkSync(path.join(installBin, 'testbin')))) + common.readBinLink(path.join(installBin, 'testbin')))) t.is(bin, path.join(installPath, 'node_modules', 'b')) t.end() }) @@ -114,7 +114,7 @@ test('verify postremoval bins', function (t) { var bin = path.dirname( path.resolve( installBin, - fs.readlinkSync(path.join(installBin, 'testbin')))) + common.readBinLink(path.join(installBin, 'testbin')))) t.is(bin, path.join(installPath, 'node_modules', 'b')) t.end() }) diff --git a/deps/npm/test/tap/extraneous-dep-cycle-ls-ok.js b/deps/npm/test/tap/extraneous-dep-cycle-ls-ok.js index 23b7519361..767cb6d7ff 100644 --- a/deps/npm/test/tap/extraneous-dep-cycle-ls-ok.js +++ b/deps/npm/test/tap/extraneous-dep-cycle-ls-ok.js @@ -57,7 +57,7 @@ var expected = pkg + '\n' + ' └── moduleB@1.0.0\n\n' test('extraneous-dep-cycle', function (t) { - common.npm(['ls'], {cwd: pkg}, function (er, code, stdout, stderr) { + common.npm(['ls', '--unicode=true'], {cwd: pkg}, function (er, code, stdout, stderr) { t.ifErr(er, 'install finished successfully') t.is(stdout, expected, 'ls output shows module') t.end() diff --git a/deps/npm/test/tap/gently-rm-linked-module.js b/deps/npm/test/tap/gently-rm-linked-module.js index 1ffe7a8208..aeae71eee0 100644 --- a/deps/npm/test/tap/gently-rm-linked-module.js +++ b/deps/npm/test/tap/gently-rm-linked-module.js @@ -1,28 +1,52 @@ +var common = require('../common-tap.js') + var basename = require('path').basename var resolve = require('path').resolve var fs = require('graceful-fs') var test = require('tap').test -var mkdirp = require('mkdirp') var rimraf = require('rimraf') - -var common = require('../common-tap.js') +var Tacks = require('tacks') +var File = Tacks.File +var Dir = Tacks.Dir +var Symlink = Tacks.Symlink +var extend = Object.assign || require('util')._extend +var isWindows = require('../../lib/utils/is-windows.js') var base = resolve(__dirname, basename(__filename, '.js')) -var pkg = resolve(base, 'gently-rm-linked') -var dep = resolve(base, 'test-linked') -var glb = resolve(base, 'test-global') -var lnk = resolve(base, 'test-global-link') +var fixture = new Tacks(Dir({ + 'working-dir': Dir({ + 'node_modules': Dir({}) // so it doesn't try to install into npm's own node_modules + }), + 'test-module': Dir({ + 'package.json': File({ + name: '@test/linked', + version: '1.0.0', + bin: { + linked: './index.js' + } + }), + 'index.js': File("module.exports = function () { console.log('whoop whoop') }") + }), + 'global-dir': Dir({}), + 'linked-global-dir': Symlink('global-dir') +})) -var EXEC_OPTS = { cwd: pkg } +var workingDir = resolve(base, 'working-dir') +var toInstall = resolve(base, 'test-module') +var linkedGlobal = resolve(base, 'linked-global-dir') -var index = "module.exports = function () { console.log('whoop whoop') }" +var env = extend({}, process.env) -var fixture = { - name: '@test/linked', - version: '1.0.0', - bin: { - linked: './index.js' - } +// We set the global install location via env var here +// instead of passing it in via `--prefix` because +// `--prefix` ALSO changes the current package location. +// And we don't ue the PREFIX env var because +// npm_config_prefix takes precedence over it and is +// passed in when running from the npm test suite. +env.npm_config_prefix = linkedGlobal +var EXEC_OPTS = { + cwd: workingDir, + env: env } test('setup', function (t) { @@ -36,32 +60,41 @@ test('install and link', function (t) { // link our test module into the global folder common.npm( [ - '--prefix', lnk, '--loglevel', 'error', 'link', - dep + toInstall ], EXEC_OPTS, - function (er, code, stdout, stderr) { + function (er, code) { if (er) throw er t.is(code, 0, 'link succeeded') - t.is(stderr, '', 'no log output') - t.ok(doesModuleExist(), 'installed ok') + var globalBin = resolve(linkedGlobal, isWindows ? '.' : 'bin', 'linked') + var globalModule = resolve(linkedGlobal, isWindows ? '.' : 'lib', 'node_modules', '@test', 'linked') + var localBin = resolve(workingDir, 'node_modules', '.bin', 'linked') + var localModule = resolve(workingDir, 'node_modules', '@test', 'linked') + try { + t.ok(fs.statSync(globalBin), 'global bin exists') + t.is(fs.lstatSync(globalModule).isSymbolicLink(), true, 'global module is link') + t.ok(fs.statSync(localBin), 'local bin exists') + t.is(fs.lstatSync(localModule).isSymbolicLink(), true, 'local module is link') + } catch (ex) { + t.ifError(ex, 'linking happened') + } + if (code !== 0) return t.end() // and try removing it and make sure that succeeds common.npm( [ '--global', - '--prefix', lnk, '--loglevel', 'error', 'rm', '@test/linked' ], EXEC_OPTS, - function (er, code, stdout, stderr) { + function (er, code) { if (er) throw er t.is(code, 0, 'rm succeeded') - t.is(stderr, '', 'no log output') - t.notOk(doesModuleExist(), 'removed ok') + t.throws(function () { fs.statSync(globalBin) }, 'global bin removed') + t.throws(function () { fs.statSync(globalModule) }, 'global module removed') t.end() } ) @@ -75,32 +108,11 @@ test('cleanup', function (t) { t.end() }) -function doesModuleExist () { - var binPath = resolve(lnk, 'bin', 'linked') - var pkgPath = resolve(lnk, 'lib', 'node_modules', '@test', 'linked') - try { - fs.statSync(binPath) - fs.statSync(pkgPath) - return true - } catch (ex) { - return false - } -} - function cleanup () { - rimraf.sync(pkg) - rimraf.sync(dep) - rimraf.sync(lnk) - rimraf.sync(glb) + fixture.remove(base) + rimraf.sync(base) } function setup () { - mkdirp.sync(pkg) - mkdirp.sync(glb) - fs.symlinkSync(glb, lnk) - // so it doesn't try to install into npm's own node_modules - mkdirp.sync(resolve(pkg, 'node_modules')) - mkdirp.sync(dep) - fs.writeFileSync(resolve(dep, 'package.json'), JSON.stringify(fixture)) - fs.writeFileSync(resolve(dep, 'index.js'), index) + fixture.create(base) } diff --git a/deps/npm/test/tap/gently-rm-symlinked-global-dir.js b/deps/npm/test/tap/gently-rm-symlinked-global-dir.js index 93ed3edaa4..b159a4ec2f 100644 --- a/deps/npm/test/tap/gently-rm-symlinked-global-dir.js +++ b/deps/npm/test/tap/gently-rm-symlinked-global-dir.js @@ -1,10 +1,11 @@ +var common = require('../common-tap.js') + var resolve = require('path').resolve var fs = require('graceful-fs') var test = require('tap').test var mkdirp = require('mkdirp') var rimraf = require('rimraf') - -var common = require('../common-tap.js') +var isWindows = require('../../lib/utils/is-windows.js') var pkg = resolve(__dirname, 'gently-rm-linked') var dep = resolve(__dirname, 'test-linked') @@ -36,6 +37,7 @@ test('install and link', function (t) { '--global', '--prefix', lnk, '--loglevel', 'silent', + '--unicode', 'false', 'install', '../test-linked' ], EXEC_OPTS, @@ -52,6 +54,7 @@ test('install and link', function (t) { '--global', '--prefix', lnk, '--loglevel', 'silent', + '--unicode', 'false', 'install', '../test-linked' ], EXEC_OPTS, @@ -84,15 +87,20 @@ function removeBlank (line) { return line !== '' } +function resolvePath () { + return resolve.apply(null, Array.prototype.slice.call(arguments) + .filter(function (arg) { return arg })) +} + function verify (t, stdout) { - var binPath = resolve(lnk, 'bin', 'linked') - var pkgPath = resolve(lnk, 'lib', 'node_modules', '@test', 'linked') - var trgPath = resolve(pkgPath, 'index.js') + var binPath = resolvePath(lnk, !isWindows && 'bin', 'linked') + var pkgPath = resolvePath(lnk, !isWindows && 'lib', 'node_modules', '@test', 'linked') + var trgPath = resolvePath(pkgPath, 'index.js') t.deepEqual( stdout.split('\n').filter(removeBlank), [ binPath + ' -> ' + trgPath, - resolve(lnk, 'lib'), - '└── @test/linked@1.0.0 ' + resolvePath(lnk, !isWindows && 'lib'), + '`-- @test/linked@1.0.0 ' ], 'got expected install output' ) @@ -108,7 +116,7 @@ function cleanup () { function setup () { mkdirp.sync(pkg) mkdirp.sync(glb) - fs.symlinkSync(glb, lnk) + fs.symlinkSync(glb, lnk, 'junction') // so it doesn't try to install into npm's own node_modules mkdirp.sync(resolve(pkg, 'node_modules')) mkdirp.sync(dep) diff --git a/deps/npm/test/tap/git-cache-locking.js b/deps/npm/test/tap/git-cache-locking.js index e08c96e1b7..29ab5709b9 100644 --- a/deps/npm/test/tap/git-cache-locking.js +++ b/deps/npm/test/tap/git-cache-locking.js @@ -6,6 +6,7 @@ var mkdirp = require('mkdirp') var pkg = path.resolve(__dirname, 'git-cache-locking') var tmp = path.join(pkg, 'tmp') var cache = path.join(pkg, 'cache') +var shallowClone = Object.assign || require('util')._extend test('setup', function (t) { rimraf.sync(pkg) @@ -17,6 +18,12 @@ test('git-cache-locking: install a git dependency', function (t) { // disable git integration tests on Travis. if (process.env.TRAVIS) return t.end() + var gitEnv = shallowClone({}, process.env) + gitEnv.npm_config_cache = cache + gitEnv.npm_config_tmp = tmp + gitEnv.npm_config_prefix = pkg + gitEnv.npm_config_global = 'false' + // package c depends on a.git#master and b.git#master // package b depends on a.git#master common.npm([ @@ -24,17 +31,9 @@ test('git-cache-locking: install a git dependency', function (t) { 'git://github.com/nigelzor/npm-4503-c.git' ], { cwd: pkg, - env: { - npm_config_cache: cache, - npm_config_tmp: tmp, - npm_config_prefix: pkg, - npm_config_global: 'false', - HOME: process.env.HOME, - Path: process.env.PATH, - PATH: process.env.PATH - } + env: gitEnv }, function (err, code, stdout, stderr) { - t.ifErr(err, 'npm install finished without error') + if (err) throw err t.equal(0, code, 'npm install should succeed') t.end() }) diff --git a/deps/npm/test/tap/git-cache-no-hooks.js b/deps/npm/test/tap/git-cache-no-hooks.js index cfc2d1dc62..0021064cea 100644 --- a/deps/npm/test/tap/git-cache-no-hooks.js +++ b/deps/npm/test/tap/git-cache-no-hooks.js @@ -1,12 +1,11 @@ var test = require('tap').test var fs = require('fs') var path = require('path') +var common = require('../common-tap.js') var rimraf = require('rimraf') var mkdirp = require('mkdirp') -var spawn = require('child_process').spawn -var npmCli = require.resolve('../../bin/npm-cli.js') -var node = process.execPath var pkg = path.resolve(__dirname, 'git-cache-no-hooks') +var osenv = require('osenv') var tmp = path.join(pkg, 'tmp') var cache = path.join(pkg, 'cache') @@ -23,27 +22,15 @@ test('git-cache-no-hooks: install a git dependency', function (t) { // disable git integration tests on Travis. if (process.env.TRAVIS) return t.end() - var command = [ - npmCli, - 'install', - 'git://github.com/nigelzor/npm-4503-a.git' - ] - var child = spawn(node, command, { - cwd: pkg, - env: { - 'npm_config_cache': cache, - 'npm_config_tmp': tmp, - 'npm_config_prefix': pkg, - 'npm_config_global': 'false', - 'npm_config_umask': '00', - HOME: process.env.HOME, - Path: process.env.PATH, - PATH: process.env.PATH - }, - stdio: 'inherit' - }) - - child.on('close', function (code) { + common.npm([ + 'install', 'git://github.com/nigelzor/npm-4503-a.git', + '--cache', cache, + '--tmp', tmp + ], { + cwd: pkg + }, function (err, code, stdout, stderr) { + t.ifErr(err, 'npm completed') + t.equal(stderr, '', 'no error output') t.equal(code, 0, 'npm install should succeed') // verify permissions on git hooks @@ -57,6 +44,7 @@ test('git-cache-no-hooks: install a git dependency', function (t) { }) test('cleanup', function (t) { + process.chdir(osenv.tmpdir()) rimraf.sync(pkg) t.end() }) diff --git a/deps/npm/test/tap/git-dependency-install-link.js b/deps/npm/test/tap/git-dependency-install-link.js index 8af1b853ad..1bf839f302 100644 --- a/deps/npm/test/tap/git-dependency-install-link.js +++ b/deps/npm/test/tap/git-dependency-install-link.js @@ -13,6 +13,7 @@ var common = require('../common-tap.js') var pkg = resolve(__dirname, 'git-dependency-install-link') var repo = resolve(__dirname, 'git-dependency-install-link-repo') +var prefix = resolve(__dirname, 'git-dependency-install-link-prefix') var cache = resolve(pkg, 'cache') var daemon @@ -25,6 +26,7 @@ var EXEC_OPTS = { cwd: pkg, cache: cache } +process.env.npm_config_prefix = prefix var pjParent = JSON.stringify({ name: 'parent', @@ -63,7 +65,7 @@ test('setup', function (t) { test('install from git repo [no --link]', function (t) { process.chdir(pkg) - common.npm(['install', '--loglevel', 'error'], EXEC_OPTS, function (err, code, stdout, stderr) { + common.npm(['install'], EXEC_OPTS, function (err, code, stdout, stderr) { t.ifError(err, 'npm install failed') t.dissimilar(stderr, /Command failed:/, 'expect git to succeed') @@ -82,11 +84,13 @@ 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) { + common.npm(['install', '--link'], EXEC_OPTS, function (err, code, stdout, stderr) { t.ifError(err, 'npm install --link failed') + t.equal(code, 0, 'npm install --link returned non-0 code') t.dissimilar(stderr, /Command failed:/, 'expect git to succeed') t.dissimilar(stderr, /version not found/, 'should not go to repository') + t.equal(stderr, '', 'no actual output on stderr') readJson(resolve(pkg, 'node_modules', 'child', 'package.json'), function (err, data) { t.ifError(err, 'error reading child package.json') @@ -170,5 +174,6 @@ function setup (cb) { function cleanup () { process.chdir(osenv.tmpdir()) rimraf.sync(repo) + rimraf.sync(prefix) rimraf.sync(pkg) } diff --git a/deps/npm/test/tap/git-npmignore.js b/deps/npm/test/tap/git-npmignore.js index 4cd9898722..6b99bdf1fa 100644 --- a/deps/npm/test/tap/git-npmignore.js +++ b/deps/npm/test/tap/git-npmignore.js @@ -1,21 +1,50 @@ -var cat = require('graceful-fs').writeFileSync -var exec = require('child_process').exec +var child_process = require('child_process') var readdir = require('graceful-fs').readdirSync +var path = require('path') var resolve = require('path').resolve -var mkdirp = require('mkdirp') var rimraf = require('rimraf') var test = require('tap').test -var tmpdir = require('osenv').tmpdir var which = require('which') var common = require('../common-tap.js') +var escapeArg = require('../../lib/utils/escape-arg.js') +var Tacks = require('tacks') +var Dir = Tacks.Dir +var File = Tacks.File + +var fixture = new Tacks(Dir({ + deps: Dir({ + gitch: Dir({ + '.npmignore': File( + 't.js\n' + ), + '.gitignore': File( + 'node_modules/\n' + ), + 'a.js': File( + "console.log('hi');" + ), + 't.js': File( + "require('tap').test(function (t) { t.pass('I am a test!'); t.end(); });" + ), + 'package.json': File({ + name: 'gitch', + version: '1.0.0', + private: true, + main: 'a.js' + }) + }) + }), + 'node_modules': Dir({ + }) +})) -var pkg = resolve(__dirname, 'git-npmignore') -var dep = resolve(pkg, 'deps', 'gitch') +var testdir = resolve(__dirname, path.basename(__filename, '.js')) +var dep = resolve(testdir, 'deps', 'gitch') var packname = 'gitch-1.0.0.tgz' -var packed = resolve(pkg, packname) -var modules = resolve(pkg, 'node_modules') +var packed = resolve(testdir, packname) +var modules = resolve(testdir, 'node_modules') var installed = resolve(modules, 'gitch') var expected = [ 'a.js', @@ -23,18 +52,11 @@ var expected = [ '.npmignore' ].sort() -var EXEC_OPTS = { cwd: pkg } - -var gitignore = 'node_modules/\n' -var npmignore = 't.js\n' +var NPM_OPTS = { cwd: testdir } -var a = "console.log('hi');" -var t = "require('tap').test(function (t) { t.pass('I am a test!'); t.end(); });" -var fixture = { - 'name': 'gitch', - 'version': '1.0.0', - 'private': true, - 'main': 'a.js' +function exec (todo, opts, cb) { + console.log(' # EXEC:', todo) + child_process.exec(todo, opts, cb) } test('setup', function (t) { @@ -50,7 +72,10 @@ test('npm pack directly from directory', function (t) { }) test('npm pack via git', function (t) { - packInstallTest('git+file://' + dep, t) + var urlPath = dep + .replace(/\\/g, '/') // fixup slashes for Windows + .replace(/^\/+/, '') // remove any leading slashes + packInstallTest('git+file:///' + urlPath, t) }) test('cleanup', function (t) { @@ -60,31 +85,32 @@ test('cleanup', function (t) { }) function packInstallTest (spec, t) { + console.log(' # pack', spec) common.npm( [ - '--loglevel', 'silent', + '--loglevel', 'error', 'pack', spec ], - EXEC_OPTS, + NPM_OPTS, function (err, code, stdout, stderr) { - t.ifError(err, 'npm pack ran without error') - t.notOk(code, 'npm pack exited cleanly') - t.notOk(stderr, 'npm pack ran silently') - t.equal(stdout.trim(), packname, 'got expected package name') + if (err) throw err + t.is(code, 0, 'npm pack exited cleanly') + t.is(stderr, '', 'npm pack ran silently') + t.is(stdout.trim(), packname, 'got expected package name') common.npm( [ - '--loglevel', 'silent', + '--loglevel', 'error', 'install', packed ], - EXEC_OPTS, + NPM_OPTS, function (err, code, stdout, stderr) { - t.ifError(err, 'npm install ran without error') - t.notOk(code, 'npm install exited cleanly') - t.notOk(stderr, 'npm install ran silently') + if (err) throw err + t.is(code, 0, 'npm install exited cleanly') + t.is(stderr, '', 'npm install ran silently') var actual = readdir(installed).sort() - t.same(actual, expected, 'no unexpected files in packed directory') + t.isDeeply(actual, expected, 'no unexpected files in packed directory') rimraf(packed, function () { t.end() @@ -96,72 +122,71 @@ function packInstallTest (spec, t) { } function cleanup () { - process.chdir(tmpdir()) - rimraf.sync(pkg) + fixture.remove(testdir) + rimraf.sync(testdir) } function setup (cb) { cleanup() - mkdirp.sync(modules) - mkdirp.sync(dep) - - process.chdir(dep) - - cat(resolve(dep, '.npmignore'), npmignore) - cat(resolve(dep, '.gitignore'), gitignore) - cat(resolve(dep, 'a.js'), a) - cat(resolve(dep, 't.js'), t) - cat(resolve(dep, 'package.json'), JSON.stringify(fixture)) + fixture.create(testdir) common.npm( [ - '--loglevel', 'silent', + '--loglevel', 'error', 'cache', 'clean' ], - EXEC_OPTS, + NPM_OPTS, function (er, code, _, stderr) { if (er) return cb(er) if (code) return cb(new Error('npm cache nonzero exit: ' + code)) if (stderr) return cb(new Error('npm cache clean error: ' + stderr)) - which('git', function found (er, git) { + which('git', function found (er, gitPath) { if (er) return cb(er) - exec(git + ' init', init) + var git = escapeArg(gitPath) + + exec(git + ' init', {cwd: dep}, init) function init (er, _, stderr) { if (er) return cb(er) if (stderr) return cb(new Error('git init error: ' + stderr)) - exec(git + " config user.name 'Phantom Faker'", user) + exec(git + " config user.name 'Phantom Faker'", {cwd: dep}, user) } function user (er, _, stderr) { if (er) return cb(er) if (stderr) return cb(new Error('git config error: ' + stderr)) - exec(git + ' config user.email nope@not.real', email) + exec(git + ' config user.email nope@not.real', {cwd: dep}, email) } function email (er, _, stderr) { if (er) return cb(er) if (stderr) return cb(new Error('git config error: ' + stderr)) - exec(git + ' add .', addAll) + exec(git + ' config core.autocrlf input', {cwd: dep}, autocrlf) + } + + function autocrlf (er, _, stderr) { + if (er) return cb(er) + if (stderr) return cb(new Error('git config error: ' + stderr)) + + exec(git + ' add .', {cwd: dep}, addAll) } function addAll (er, _, stderr) { if (er) return cb(er) if (stderr) return cb(new Error('git add . error: ' + stderr)) - exec(git + ' commit -m boot', commit) + exec(git + ' commit -m boot', {cwd: dep}, commit) } function commit (er, _, stderr) { if (er) return cb(er) if (stderr) return cb(new Error('git commit error: ' + stderr)) - cb() } }) diff --git a/deps/npm/test/tap/github-shortcut.js b/deps/npm/test/tap/github-shortcut.js index 1b01de4cff..c0a67d21a4 100644 --- a/deps/npm/test/tap/github-shortcut.js +++ b/deps/npm/test/tap/github-shortcut.js @@ -32,10 +32,10 @@ test('github-shortcut', function (t) { 'child_process': { 'execFile': function (cmd, args, options, cb) { process.nextTick(function () { - if (args[0] !== 'clone') return cb(null, '', '') + if (args.indexOf('clone') === -1) return cb(null, '', '') var cloneUrl = cloneUrls.shift() if (cloneUrl) { - t.is(args[3], cloneUrl[0], cloneUrl[1]) + t.is(args[args.length - 2], cloneUrl[0], cloneUrl[1]) } else { t.fail('too many attempts to clone') } @@ -52,8 +52,8 @@ test('github-shortcut', function (t) { loglevel: 'silent' } t.plan(1 + cloneUrls.length) - npm.load(opts, function (er) { - t.ifError(er, 'npm loaded without error') + npm.load(opts, function (err) { + t.ifError(err, 'npm loaded without error') npm.commands.install(['foo/private'], function (er, result) { t.end() }) diff --git a/deps/npm/test/tap/graceful-restart.js b/deps/npm/test/tap/graceful-restart.js index 21da0d9904..56513fbf7e 100644 --- a/deps/npm/test/tap/graceful-restart.js +++ b/deps/npm/test/tap/graceful-restart.js @@ -70,7 +70,7 @@ test('graceless restart', function (t) { createChild(['run-script', 'restart'], function (err, code, out) { t.ifError(err, 'restart finished successfully') t.equal(code, 0, 'npm run-script exited with code') - t.equal(out, outGraceless, 'expected all scripts to run') + t.equal(out.replace(/\r/g, ''), outGraceless, 'expected all scripts to run') t.end() }) }) @@ -80,7 +80,7 @@ test('graceful restart', function (t) { createChild(['run-script', 'restart'], function (err, code, out) { t.ifError(err, 'restart finished successfully') t.equal(code, 0, 'npm run-script exited with code') - t.equal(out, outGraceful, 'expected only *restart scripts to run') + t.equal(out.replace(/\r/g, ''), outGraceful, 'expected only *restart scripts to run') t.end() }) }) diff --git a/deps/npm/test/tap/install-bad-man.js b/deps/npm/test/tap/install-bad-man.js index 756b4a5902..226d0b24fc 100644 --- a/deps/npm/test/tap/install-bad-man.js +++ b/deps/npm/test/tap/install-bad-man.js @@ -21,6 +21,8 @@ var json = { man: [ './install-bad-man.1.lol' ] } +common.pendIfWindows('man pages do not get installed on Windows') + test('setup', function (t) { setup() t.pass('setup ran') diff --git a/deps/npm/test/tap/install-link-scripts.js b/deps/npm/test/tap/install-link-scripts.js index 5ad2feafe8..acc88b4b2c 100644 --- a/deps/npm/test/tap/install-link-scripts.js +++ b/deps/npm/test/tap/install-link-scripts.js @@ -24,15 +24,15 @@ var dependency = { name: 'dep', version: '1.0.0', scripts: { - install: './bin/foo' + install: 'node ./bin/foo' } } -var foo = function () {/* +var foo = function () { /* #!/usr/bin/env node console.log('hey sup') -*/}.toString().split('\n').slice(1, -1).join('\n') +*/ }.toString().split('\n').slice(1, -1).join('\n') process.env.npm_config_prefix = tmp diff --git a/deps/npm/test/tap/install-man.js b/deps/npm/test/tap/install-man.js index d309788b25..d24819ca78 100644 --- a/deps/npm/test/tap/install-man.js +++ b/deps/npm/test/tap/install-man.js @@ -11,6 +11,8 @@ var common = require('../common-tap.js') var pkg = resolve(__dirname, 'install-man') var target = resolve(__dirname, 'install-man-target') +common.pendIfWindows('man pages do not get installed on Windows') + var EXEC_OPTS = { cwd: target } diff --git a/deps/npm/test/tap/install-save-local.js b/deps/npm/test/tap/install-save-local.js index a9de5ba194..1bc739cb89 100644 --- a/deps/npm/test/tap/install-save-local.js +++ b/deps/npm/test/tap/install-save-local.js @@ -53,7 +53,7 @@ test('\'npm install --save ../local/path\' should save to package.json', functio var pkgJson = JSON.parse(fs.readFileSync(pkg + '/package.json', 'utf8')) t.is(Object.keys(pkgJson.dependencies).length, 1, 'only one dep') t.ok( - /file:.*?[/]package-local-dependency$/.test(pkgJson.dependencies['package-local-dependency']), + /file:.*?[/\\]package-local-dependency$/.test(pkgJson.dependencies['package-local-dependency']), 'local package saved correctly' ) t.end() @@ -82,7 +82,7 @@ test('\'npm install --save-dev ../local/path\' should save to package.json', fun var pkgJson = JSON.parse(fs.readFileSync(pkg + '/package.json', 'utf8')) t.is(Object.keys(pkgJson.devDependencies).length, 1, 'only one dep') t.ok( - /file:.*?[/]package-local-dev-dependency$/.test(pkgJson.devDependencies['package-local-dev-dependency']), + /file:.*?[/\\]package-local-dev-dependency$/.test(pkgJson.devDependencies['package-local-dev-dependency']), 'local package saved correctly' ) diff --git a/deps/npm/test/tap/install-scoped-already-installed.js b/deps/npm/test/tap/install-scoped-already-installed.js index f3c191ddb0..58966b047c 100644 --- a/deps/npm/test/tap/install-scoped-already-installed.js +++ b/deps/npm/test/tap/install-scoped-already-installed.js @@ -125,7 +125,7 @@ test('cleanup', function (t) { }) function contains (list, element) { - var matcher = new RegExp(element + '$') + var matcher = new RegExp(element.replace(/\//g, '[\\\\/]') + '$') for (var i = 0; i < list.length; ++i) { if (matcher.test(list[i])) { return true diff --git a/deps/npm/test/tap/install-scoped-link.js b/deps/npm/test/tap/install-scoped-link.js index 029acb3813..9171b8f46f 100644 --- a/deps/npm/test/tap/install-scoped-link.js +++ b/deps/npm/test/tap/install-scoped-link.js @@ -8,6 +8,8 @@ var osenv = require('osenv') var rimraf = require('rimraf') var test = require('tap').test +var escapeExecPath = require('../../lib/utils/escape-exec-path') + var common = require('../common-tap.js') var pkg = path.join(__dirname, 'install-scoped-link') @@ -16,7 +18,7 @@ var modules = path.join(work, 'node_modules') var EXEC_OPTS = { cwd: work } -var world = 'console.log("hello blrbld")\n' +var world = '#!/usr/bin/env node\nconsole.log("hello blrbld")\n' var json = { name: '@scoped/package', @@ -61,7 +63,7 @@ test('installing package with links', function (t) { var hello = path.join(modules, '.bin', 'hello') t.ok(existsSync(hello), 'binary link exists') - exec('node ' + hello, function (err, stdout, stderr) { + exec(escapeExecPath(hello), function (err, stdout, stderr) { t.ifError(err, 'command ran fine') t.notOk(stderr, 'got no error output back') t.equal(stdout, 'hello blrbld\n', 'output was as expected') diff --git a/deps/npm/test/tap/legacy-bundled-git.js b/deps/npm/test/tap/legacy-bundled-git.js index 355f9467c1..15fbac84ea 100644 --- a/deps/npm/test/tap/legacy-bundled-git.js +++ b/deps/npm/test/tap/legacy-bundled-git.js @@ -69,8 +69,6 @@ test('bundled-git', function (t) { common.npm(['install', '--global-style', fixturepath], {cwd: basepath}, installCheckAndTest) function installCheckAndTest (err, code, stdout, stderr) { if (err) throw err - console.error(stderr) - console.log(stdout) t.is(code, 0, 'install went ok') var actual = require(path.resolve(installedpath, 'node_modules/glob/node_modules/minimatch/package.json')) @@ -82,8 +80,6 @@ test('bundled-git', function (t) { } function removeCheckAndDone (err, code, stdout, stderr) { if (err) throw err - console.error(stderr) - console.log(stdout) t.is(code, 0, 'remove went ok') t.done() } diff --git a/deps/npm/test/tap/legacy-missing-bindir.js b/deps/npm/test/tap/legacy-missing-bindir.js index a55703bebd..2285f8d2a7 100644 --- a/deps/npm/test/tap/legacy-missing-bindir.js +++ b/deps/npm/test/tap/legacy-missing-bindir.js @@ -48,8 +48,6 @@ test('missing-bindir', function (t) { function installCheckAndTest (err, code, stdout, stderr) { if (err) throw err - if (stderr) console.error(stderr) - console.log(stdout) t.is(code, 0, 'install went ok') t.is(installedExists('README'), true, 'README') t.is(installedExists('package.json'), true, 'package.json') @@ -58,8 +56,6 @@ test('missing-bindir', function (t) { function removeCheckAndDone (err, code, stdout, stderr) { if (err) throw err - console.error(stderr) - console.log(stdout) t.is(code, 0, 'remove went ok') t.done() } diff --git a/deps/npm/test/tap/legacy-npm-self-install.js b/deps/npm/test/tap/legacy-npm-self-install.js index 313c059493..57880496c7 100644 --- a/deps/npm/test/tap/legacy-npm-self-install.js +++ b/deps/npm/test/tap/legacy-npm-self-install.js @@ -50,7 +50,7 @@ test('npm-self-install', function (t) { env.npm_config_user_agent = null env.npm_config_color = 'always' env.npm_config_progress = 'always' - var PATH = env.PATH.split(pathsep) + var PATH = env.PATH ? env.PATH.split(pathsep) : [] var binpath = isWin32 ? globalpath : path.join(globalpath, 'bin') var cmdname = isWin32 ? 'npm.cmd' : 'npm' PATH.unshift(binpath) @@ -63,7 +63,7 @@ test('npm-self-install', function (t) { if (err) throw err t.is(code, 0, 'install went ok') t.is(exists(binpath, cmdname), true, 'binary was installed') - t.is(exists(globalpath, 'lib', 'node_modules', 'npm'), true, 'module path exists') + t.is(exists(globalpath, isWin32 ? '' : 'lib', 'node_modules', 'npm'), true, 'module path exists') common.npm(['ls', '--json', '--depth=0'], {cwd: basepath, env: env}, lsCheckAndRemove) } function lsCheckAndRemove (err, code, stdout, stderr) { @@ -73,7 +73,7 @@ test('npm-self-install', function (t) { var installed = JSON.parse(stdout.trim()) t.is(Object.keys(installed.dependencies).length, 1, 'one thing installed') t.is(path.resolve(globalpath, installed.dependencies.npm.from), tarball, 'and it was our npm tarball') - common.npm(['rm', 'npm'], {cwd: basepath, env: env, stdio: 'inherit'}, removeCheck) + common.npm(['rm', 'npm'], {cwd: basepath, env: env}, removeCheck) } function removeCheck (err, code) { if (err) throw err diff --git a/deps/npm/test/tap/legacy-test-package.js b/deps/npm/test/tap/legacy-test-package.js index b0cbaa01a5..d94666b43e 100644 --- a/deps/npm/test/tap/legacy-test-package.js +++ b/deps/npm/test/tap/legacy-test-package.js @@ -36,24 +36,18 @@ test('test-package', function (t) { function installCheckAndTest (err, code, stdout, stderr) { if (err) throw err - console.error(stderr) - console.log(stdout) t.is(code, 0, 'install went ok') common.npm(['test'], {cwd: installedpath}, testCheckAndRemove) } function testCheckAndRemove (err, code, stdout, stderr) { if (err) throw err - console.error(stderr) - console.log(stdout) t.is(code, 0, 'npm test w/o test is ok') common.npm(['rm', fixturepath], {cwd: basepath}, removeCheckAndDone) } function removeCheckAndDone (err, code, stdout, stderr) { if (err) throw err - console.error(stderr) - console.log(stdout) t.is(code, 0, 'remove went ok') t.done() } diff --git a/deps/npm/test/tap/legacy-url-dep.js b/deps/npm/test/tap/legacy-url-dep.js index 9807d6916a..46378cd3ef 100644 --- a/deps/npm/test/tap/legacy-url-dep.js +++ b/deps/npm/test/tap/legacy-url-dep.js @@ -37,8 +37,6 @@ test('url-dep', function (t) { common.npm(['install', fixturepath], {cwd: basepath}, installCheckAndTest) function installCheckAndTest (err, code, stdout, stderr) { if (err) throw err - console.error(stderr) - console.log(stdout) t.is(code, 0, 'install went ok') t.done() } diff --git a/deps/npm/test/tap/lifecycle-path.js b/deps/npm/test/tap/lifecycle-path.js index 39761b48d7..3264fe87be 100644 --- a/deps/npm/test/tap/lifecycle-path.js +++ b/deps/npm/test/tap/lifecycle-path.js @@ -7,54 +7,45 @@ var rimraf = require('rimraf') var test = require('tap').test var common = require('../common-tap.js') +var isWindows = require('../../lib/utils/is-windows.js') var pkg = path.resolve(__dirname, 'lifecycle-path') -var link = path.resolve(pkg, 'node-bin') var PATH -if (process.platform === 'win32') { +if (isWindows) { // On Windows the 'comspec' environment variable is used, // so cmd.exe does not need to be on the path. - PATH = 'C:\\foo\\bar' + PATH = path.dirname(process.env.ComSpec) } else { // On non-Windows, without the path to the shell, nothing usually works. PATH = '/bin:/usr/bin' } -var printPath = 'console.log(process.env.PATH)\n' - -var json = { - name: 'glorb', - version: '1.2.3', - scripts: { - path: './node-bin/node print-path.js' - } -} - test('setup', function (t) { cleanup() mkdirp.sync(pkg) fs.writeFileSync( path.join(pkg, 'package.json'), - JSON.stringify(json, null, 2) + JSON.stringify({}, null, 2) ) - fs.writeFileSync(path.join(pkg, 'print-path.js'), printPath) - fs.symlinkSync(path.dirname(process.execPath), link, 'dir') t.end() }) test('make sure the path is correct', function (t) { - common.npm(['run-script', 'path'], { + common.npm(['run-script', 'env'], { cwd: pkg, env: { - PATH: PATH, - stdio: [ 0, 'pipe', 2 ] - } + PATH: PATH + }, + stdio: [ 0, 'pipe', 2 ] }, function (er, code, stdout) { if (er) throw er t.equal(code, 0, 'exit code') - // remove the banner, we just care about the last line - stdout = stdout.trim().split(/\r|\n/).pop() + var lineMatch = function (line) { + return /^PATH=/i.test(line) + } + // extract just the path value + stdout = stdout.split(/\r?\n/).filter(lineMatch).pop().replace(/^PATH=/, '') var pathSplit = process.platform === 'win32' ? ';' : ':' var root = path.resolve(__dirname, '../..') var actual = stdout.split(pathSplit).map(function (p) { @@ -63,15 +54,19 @@ test('make sure the path is correct', function (t) { } return p.replace(/\\/g, '/') }) + // spawn-wrap adds itself to the path when coverage is enabled + actual = actual.filter(function (p) { + return !p.match(/\.node-spawn-wrap/) + }) // get the ones we tacked on, then the system-specific requirements var expect = [ '{{ROOT}}/bin/node-gyp-bin', '{{ROOT}}/test/tap/lifecycle-path/node_modules/.bin', path.dirname(process.execPath) - ].concat(PATH.split(pathSplit).map(function (p) { + ].concat(PATH.split(pathSplit)).map(function (p) { return p.replace(/\\/g, '/') - })) + }) t.same(actual, expect) t.end() }) diff --git a/deps/npm/test/tap/logout-scoped.js b/deps/npm/test/tap/logout-scoped.js index 1323a4d32e..db99320478 100644 --- a/deps/npm/test/tap/logout-scoped.js +++ b/deps/npm/test/tap/logout-scoped.js @@ -12,11 +12,11 @@ var pkg = path.resolve(__dirname, 'logout') var outfile = path.join(pkg, '_npmrc') var opts = { cwd: pkg } -var contents = function () {/* +var contents = function () { /* foo=boo @bar:registry=http://localhost:1337 //localhost:1337/:_authToken=glarb -*/}.toString().split('\n').slice(1, -1).join('\n') +*/ }.toString().split('\n').slice(1, -1).join('\n') function mocks (server) { server.delete('/-/user/token/glarb') @@ -47,7 +47,7 @@ test('npm logout', function (t) { t.notOk(code, 'exited OK') var config = fs.readFileSync(outfile, 'utf8') - t.equal(config, 'foo=boo\n', 'creds gone') + t.equal(config.trim(), 'foo=boo', 'creds gone') s.close() t.end() } diff --git a/deps/npm/test/tap/logout.js b/deps/npm/test/tap/logout.js index ebe0f51ba1..d62cb4fffc 100644 --- a/deps/npm/test/tap/logout.js +++ b/deps/npm/test/tap/logout.js @@ -12,10 +12,10 @@ var pkg = path.resolve(__dirname, 'logout') var outfile = path.join(pkg, '_npmrc') var opts = { cwd: pkg } -var contents = function () {/* +var contents = function () { /* foo=boo //localhost:1337/:_authToken=glarb -*/}.toString().split('\n').slice(1, -1).join('\n') +*/ }.toString().split('\n').slice(1, -1).join('\n') function mocks (server) { server.delete('/-/user/token/glarb') @@ -45,7 +45,7 @@ test('npm logout', function (t) { t.notOk(code, 'exited OK') var config = fs.readFileSync(outfile, 'utf8') - t.equal(config, 'foo=boo\n', 'creds gone') + t.notMatch(config, /localhost/, 'creds gone') s.close() t.end() } diff --git a/deps/npm/test/tap/ls-l-depth-0.js b/deps/npm/test/tap/ls-l-depth-0.js index 24fa062908..3958520943 100644 --- a/deps/npm/test/tap/ls-l-depth-0.js +++ b/deps/npm/test/tap/ls-l-depth-0.js @@ -53,6 +53,7 @@ test('#6311: npm ll --depth=0 duplicates listing', function (t) { [ '--loglevel', 'silent', '--registry', common.registry, + '--unicode=true', 'install', dep ], EXEC_OPTS, @@ -72,6 +73,7 @@ test('#6311: npm ll --depth=0 duplicates listing', function (t) { [ '--loglevel', 'silent', 'ls', '--long', + '--unicode=true', '--depth', '0' ], EXEC_OPTS, diff --git a/deps/npm/test/tap/ls.js b/deps/npm/test/tap/ls.js new file mode 100644 index 0000000000..acec723afb --- /dev/null +++ b/deps/npm/test/tap/ls.js @@ -0,0 +1,188 @@ +'use strict' +var test = require('tap').test +var path = require('path') +var rimraf = require('rimraf') +var common = require('../common-tap.js') +var basepath = path.resolve(__dirname, path.basename(__filename, '.js')) +var fixturepath = path.resolve(basepath, 'npm-test-files') +var pkgpath = path.resolve(fixturepath, 'npm-test-ls') +var Tacks = require('tacks') +var File = Tacks.File +var Dir = Tacks.Dir + +test('ls without arg', function (t) { + var fixture = new Tacks( + Dir({ + 'npm-test-ls': Dir({ + 'package.json': File({ + name: 'npm-test-ls', + version: '1.0.0', + dependencies: { + 'dep': 'file:../dep' + } + }) + }), + 'dep': Dir({ + 'package.json': File({ + name: 'dep', + version: '1.0.0' + }) + }) + }) + ) + withFixture(t, fixture, function (done) { + common.npm([ + 'ls', '--json' + ], { + cwd: pkgpath + }, function (err, code, stdout, stderr) { + t.ifErr(err, 'ls succeeded') + t.equal(0, code, 'exit 0 on ls') + var pkg = JSON.parse(stdout) + var deps = pkg.dependencies + t.ok(deps.dep, 'dep present') + done() + }) + }) +}) + +test('ls with filter arg', function (t) { + var fixture = new Tacks( + Dir({ + 'npm-test-ls': Dir({ + 'package.json': File({ + name: 'npm-test-ls', + version: '1.0.0', + dependencies: { + 'dep': 'file:../dep' + } + }) + }), + 'dep': Dir({ + 'package.json': File({ + name: 'dep', + version: '1.0.0' + }) + }), + 'otherdep': Dir({ + 'package.json': File({ + name: 'otherdep', + version: '1.0.0' + }) + }) + }) + ) + withFixture(t, fixture, function (done) { + common.npm([ + 'ls', 'dep', + '--json' + ], { + cwd: path.join(fixturepath, 'npm-test-ls') + }, function (err, code, stdout, stderr) { + t.ifErr(err, 'ls succeeded') + t.equal(0, code, 'exit 0 on ls') + var pkg = JSON.parse(stdout) + var deps = pkg.dependencies + t.ok(deps.dep, 'dep present') + t.notOk(deps.otherdep, 'other dep not present') + done() + }) + }) +}) + +test('ls with missing filtered arg', function (t) { + var fixture = new Tacks( + Dir({ + 'npm-test-ls': Dir({ + 'package.json': File({ + name: 'npm-test-ls', + version: '1.0.0', + dependencies: { + 'dep': 'file:../dep' + } + }) + }), + 'dep': Dir({ + 'package.json': File({ + name: 'dep', + version: '1.0.0' + }) + }) + }) + ) + withFixture(t, fixture, function (done) { + common.npm([ + 'ls', 'notadep', + '--json' + ], { + cwd: path.join(fixturepath, 'npm-test-ls') + }, function (err, code, stdout, stderr) { + t.ifErr(err, 'ls succeeded') + t.equal(1, code, 'exit 1 on ls') + var pkg = JSON.parse(stdout) + var deps = pkg.dependencies + t.notOk(deps, 'deps missing') + t.done() + }) + }) +}) + +test('ls with prerelease pkg', function (t) { + var fixture = new Tacks( + Dir({ + 'npm-test-ls': Dir({ + 'package.json': File({ + name: 'npm-test-ls', + version: '1.0.0', + dependencies: { + 'dep': 'file:../dep' + } + }) + }), + 'dep': Dir({ + 'package.json': File({ + name: 'dep', + version: '1.0.0-pre' + }) + }) + }) + ) + withFixture(t, fixture, function (done) { + common.npm([ + 'ls', 'dep', + '--json' + ], { + cwd: path.join(fixturepath, 'npm-test-ls') + }, function (err, code, stdout, stderr) { + t.ifErr(err, 'ls succeeded') + t.equal(0, code, 'exit 0 on ls') + var pkg = JSON.parse(stdout) + var deps = pkg.dependencies + t.ok(deps.dep, 'dep present') + t.done() + }) + }) +}) + +test('cleanup', function (t) { + rimraf.sync(basepath) + t.done() +}) + +function withFixture (t, fixture, tester) { + fixture.create(fixturepath) + common.npm(['install'], { + cwd: path.join(fixturepath, 'npm-test-ls') + }, checkAndTest) + function checkAndTest (err, code) { + if (err) throw err + t.is(code, 0, 'install went ok') + tester(removeAndDone) + } + function removeAndDone (err) { + if (err) throw err + fixture.remove(fixturepath) + rimraf.sync(basepath) + t.done() + } +} diff --git a/deps/npm/test/tap/no-global-warns.js b/deps/npm/test/tap/no-global-warns.js index 2d831eaae9..cae62fff99 100644 --- a/deps/npm/test/tap/no-global-warns.js +++ b/deps/npm/test/tap/no-global-warns.js @@ -14,13 +14,7 @@ var toInstall = path.join(base, 'to-install') var config = 'prefix = ' + base var configPath = path.join(base, '_npmrc') -var extend = Object.assign || require('util')._extend - -var OPTS = { - env: extend({ - 'npm_config_userconfig': configPath - }, process.env) -} +var OPTS = { } var installJSON = { name: 'to-install', @@ -40,11 +34,18 @@ test('setup', function (t) { }) test('no-global-warns', function (t) { - common.npm(['install', '-g', toInstall], OPTS, function (err, code, stdout, stderr) { - t.ifError(err, 'installed w/o error') - t.is(stderr, '', 'no warnings printed to stderr') - t.end() - }) + common.npm( + [ + 'install', '-g', + '--userconfig=' + configPath, + toInstall + ], + OPTS, + function (err, code, stdout, stderr) { + t.ifError(err, 'installed w/o error') + t.is(stderr, '', 'no warnings printed to stderr') + t.end() + }) }) test('cleanup', function (t) { diff --git a/deps/npm/test/tap/optional-metadep-rollback-collision.js b/deps/npm/test/tap/optional-metadep-rollback-collision.js index d5116f30fc..a9294858d2 100644 --- a/deps/npm/test/tap/optional-metadep-rollback-collision.js +++ b/deps/npm/test/tap/optional-metadep-rollback-collision.js @@ -63,7 +63,7 @@ var opdep_json = { } } -var badServer = function () {/* +var badServer = function () { /* var createServer = require('http').createServer var spawn = require('child_process').spawn var fs = require('fs') @@ -98,9 +98,9 @@ if (process.argv[2]) { fs.writeFileSync(pidfile, child.pid + '\n') } -*/}.toString().split('\n').slice(1, -1).join('\n') +*/ }.toString().split('\n').slice(1, -1).join('\n') -var blart = function () {/* +var blart = function () { /* var rando = require('crypto').randomBytes var resolve = require('path').resolve @@ -152,7 +152,7 @@ mkdirp(BASEDIR, function go () { keepItGoingLouder = {} }, 3 * 1000) }) -*/}.toString().split('\n').slice(1, -1).join('\n') +*/ }.toString().split('\n').slice(1, -1).join('\n') test('setup', function (t) { cleanup() diff --git a/deps/npm/test/tap/outdated-depth-deep.js b/deps/npm/test/tap/outdated-depth-deep.js index 27c5f3e9fc..682b1ca958 100644 --- a/deps/npm/test/tap/outdated-depth-deep.js +++ b/deps/npm/test/tap/outdated-depth-deep.js @@ -2,7 +2,6 @@ var common = require('../common-tap') var path = require('path') var test = require('tap').test var rimraf = require('rimraf') -var npm = require('../../') var mr = require('npm-registry-mock') var pkg = path.resolve(__dirname, 'outdated-depth-deep') var cache = path.resolve(pkg, 'cache') @@ -41,38 +40,50 @@ test('setup', function (t) { }) test('outdated depth deep (9999)', function (t) { - var underscoreOutdated = ['underscore', '1.3.1', '1.3.1', '1.5.1', '1.3.1'] - var childPkg = path.resolve(pkg, 'node_modules', 'npm-test-peer-deps') + var conf = [ + '--registry', common.registry, + '--cache', cache + ] - var expected = [ [childPkg].concat(underscoreOutdated).concat([null]), - [pkg].concat(underscoreOutdated).concat([null]) ] + var server + mr({ port: common.port }, thenTopLevelInstall) - process.chdir(pkg) + function thenTopLevelInstall (err, s) { + if (err) throw err + server = s + common.npm(conf.concat(['install', '.']), {cwd: pkg}, thenDeepInstall) + } + + function thenDeepInstall (err, code, stdout, stderr) { + if (err) throw err + t.is(code, 0, 'install completed successfully') + t.is('', stderr, 'no error output') + var depPath = path.join(pkg, 'node_modules', 'npm-test-peer-deps') + common.npm(conf.concat(['install', 'underscore']), {cwd: depPath}, thenRunOutdated) + } + + function thenRunOutdated (err, code, stdout, stderr) { + if (err) throw err + t.is(code, 0, 'deep install completed successfully') + t.is('', stderr, 'no error output') + common.npm(conf.concat(['outdated', '--depth', 9999]), {cwd: pkg}, thenValidateOutput) + } - mr({ port: common.port }, function (er, s) { - npm.load({ - cache: cache, - loglevel: 'silent', - registry: common.registry, - depth: 9999 - }, - function () { - npm.install('.', function (er) { - if (er) throw new Error(er) - var nodepath = process.env.npm_node_execpath || process.env.NODE || process.execPath - var clibin = path.resolve(__dirname, '../../bin/npm-cli.js') - npm.explore('npm-test-peer-deps', nodepath, clibin, 'install', 'underscore', function (er) { - if (er) throw new Error(er) - npm.outdated(function (err, d) { - if (err) throw new Error(err) - t.deepEqual(d, expected) - s.close() - t.end() - }) - }) - }) - }) - }) + function thenValidateOutput (err, code, stdout, stderr) { + if (err) throw err + t.is(code, 0, 'outdated completed successfully') + t.is('', stderr, 'no error output') + t.match( + stdout, + /underscore.*1\.3\.1.*1\.3\.1.*1\.5\.1.*whatever\n/g, + 'child package listed') + t.match( + stdout, + /underscore.*1\.3\.1.*1\.3\.1.*1\.5\.1.*whatever > npm-test-peer-deps/g, + 'child package listed') + server.close() + t.end() + } }) test('cleanup', function (t) { diff --git a/deps/npm/test/tap/outdated-depth-integer.js b/deps/npm/test/tap/outdated-depth-integer.js index a1fc2b99d2..32bf785f27 100644 --- a/deps/npm/test/tap/outdated-depth-integer.js +++ b/deps/npm/test/tap/outdated-depth-integer.js @@ -3,7 +3,8 @@ var test = require('tap').test var rimraf = require('rimraf') var npm = require('../../') var mr = require('npm-registry-mock') -var pkg = __dirname + '/outdated-depth-integer' +var path = require('path') +var pkg = path.resolve('outdated-depth-integer') var osenv = require('osenv') var mkdirp = require('mkdirp') diff --git a/deps/npm/test/tap/outdated.js b/deps/npm/test/tap/outdated.js index c5ce8d182f..3a46705e38 100644 --- a/deps/npm/test/tap/outdated.js +++ b/deps/npm/test/tap/outdated.js @@ -104,7 +104,7 @@ test('it should not throw', function (t) { } npm.outdated(function (er, d) { t.ifError(er, 'outdated success') - + output = output.map(function (x) { return x.replace(/\r/g, '') }) console.log = originalLog t.same(output, expOut) diff --git a/deps/npm/test/tap/publish-access-unscoped-restricted-fails.js b/deps/npm/test/tap/publish-access-unscoped-restricted-fails.js index 4c7fce7351..660d0f48d7 100644 --- a/deps/npm/test/tap/publish-access-unscoped-restricted-fails.js +++ b/deps/npm/test/tap/publish-access-unscoped-restricted-fails.js @@ -4,59 +4,35 @@ var path = require('path') var test = require('tap').test var mkdirp = require('mkdirp') var rimraf = require('rimraf') - -var npm = require('../../') var common = require('../common-tap.js') var pkg = path.join(__dirname, 'publish-access-unscoped') test('setup', function (t) { - mkdirp(path.join(pkg, 'cache'), function () { - var configuration = { - cache: path.join(pkg, 'cache'), - loglevel: 'silent', - registry: common.registry - } - - npm.load(configuration, next) - }) - - function next (er) { - t.ifError(er, 'npm loaded successfully') - - process.chdir(pkg) - fs.writeFile( - path.join(pkg, 'package.json'), - JSON.stringify({ - name: 'publish-access', - version: '1.2.5' - }), - 'ascii', - function (er) { - t.ifError(er) - - t.pass('setup done') - t.end() - } - ) - } + mkdirp.sync(pkg) + fs.writeFileSync( + path.join(pkg, 'package.json'), + JSON.stringify({ + name: 'publish-access', + version: '1.2.5' + })) + t.pass('setup done') + t.end() }) test('unscoped packages cannot be restricted', function (t) { - npm.config.set('access', 'restricted') - npm.commands.publish([], false, function (er) { - t.ok(er, 'got an error back') - t.equal(er.message, "Can't restrict access to unscoped packages.") + var args = ['--access=restricted', '--loglevel=warn', '--registry=' + common.registry] + var opts = {stdio: [0, 1, 'pipe'], cwd: pkg} + common.npm(['publish'].concat(args), opts, function (err, code, stdout, stderr) { + if (err) throw err + t.notEqual(code, 0, 'publish not successful') + t.match(stderr, "Can't restrict access to unscoped packages.") t.end() }) }) test('cleanup', function (t) { - process.chdir(__dirname) - rimraf(pkg, function (er) { - t.ifError(er) - - t.end() - }) + rimraf.sync(pkg) + t.end() }) diff --git a/deps/npm/test/tap/publish-config.js b/deps/npm/test/tap/publish-config.js index 57070f78ba..399fd0f93b 100644 --- a/deps/npm/test/tap/publish-config.js +++ b/deps/npm/test/tap/publish-config.js @@ -29,7 +29,7 @@ test(function (t) { res.end(JSON.stringify({ error: 'sshhh. naptime nao. \\^O^/ <(YAWWWWN!)' })) - child.kill('SIGHUP') + child.kill('SIGINT') }).listen(common.port, function () { t.pass('server is listening') diff --git a/deps/npm/test/tap/registry.js b/deps/npm/test/tap/registry.js index 7b17192f66..d8ec4a204e 100644 --- a/deps/npm/test/tap/registry.js +++ b/deps/npm/test/tap/registry.js @@ -31,6 +31,8 @@ var extend = Object.assign || require('util')._extend function runTests () { var env = extend({ TAP: 1 }, process.env) env.npm = npmExec + // TODO: fix tap and / or nyc to handle nested invocations properly + env.COVERALLS_REPO_TOKEN = '' var opts = { cwd: ca, @@ -49,7 +51,7 @@ function runTests () { env: env, stdio: 'inherit' } - common.npm(['test', '--', '-Rtap'], opts, function (err, code) { + common.npm(['test', '--', '-Rtap', '--no-coverage'], opts, function (err, code) { if (err) { throw err } if (code) { return test('need test to work', function (t) { diff --git a/deps/npm/test/tap/repo.js b/deps/npm/test/tap/repo.js index 292415705e..e2751573d0 100644 --- a/deps/npm/test/tap/repo.js +++ b/deps/npm/test/tap/repo.js @@ -1,8 +1,3 @@ -if (process.platform === 'win32') { - console.error('skipping test, because windows and shebangs') - process.exit(0) -} - var common = require('../common-tap.js') var mr = require('npm-registry-mock') @@ -10,15 +5,18 @@ var test = require('tap').test var rimraf = require('rimraf') var fs = require('fs') var path = require('path') +var fakeBrowser = path.join(__dirname, '_script.sh') var outFile = path.join(__dirname, '/_output') var opts = { cwd: __dirname } +common.pendIfWindows('This is trickier to convert without opening new shells') + test('setup', function (t) { var s = '#!/usr/bin/env bash\n' + 'echo \"$@\" > ' + JSON.stringify(__dirname) + '/_output\n' - fs.writeFileSync(__dirname + '/_script.sh', s, 'ascii') - fs.chmodSync(__dirname + '/_script.sh', '0755') + fs.writeFileSync(fakeBrowser, s, 'ascii') + fs.chmodSync(fakeBrowser, '0755') t.pass('made script') t.end() }) @@ -29,7 +27,7 @@ test('npm repo underscore', function (t) { 'repo', 'underscore', '--registry=' + common.registry, '--loglevel=silent', - '--browser=' + __dirname + '/_script.sh' + '--browser=' + fakeBrowser ], opts, function (err, code, stdout, stderr) { t.ifError(err, 'repo command ran without error') t.equal(code, 0, 'exit ok') @@ -48,7 +46,7 @@ test('npm repo optimist - github (https://)', function (t) { 'repo', 'optimist', '--registry=' + common.registry, '--loglevel=silent', - '--browser=' + __dirname + '/_script.sh' + '--browser=' + fakeBrowser ], opts, function (err, code, stdout, stderr) { t.ifError(err, 'repo command ran without error') t.equal(code, 0, 'exit ok') @@ -67,7 +65,7 @@ test('npm repo npm-test-peer-deps - no repo', function (t) { 'repo', 'npm-test-peer-deps', '--registry=' + common.registry, '--loglevel=silent', - '--browser=' + __dirname + '/_script.sh' + '--browser=' + fakeBrowser ], opts, function (err, code, stdout, stderr) { t.ifError(err, 'repo command ran without error') t.equal(code, 1, 'exit not ok') @@ -83,7 +81,7 @@ test('npm repo test-repo-url-http - non-github (http://)', function (t) { 'repo', 'test-repo-url-http', '--registry=' + common.registry, '--loglevel=silent', - '--browser=' + __dirname + '/_script.sh' + '--browser=' + fakeBrowser ], opts, function (err, code, stdout, stderr) { t.ifError(err, 'repo command ran without error') t.equal(code, 0, 'exit ok') @@ -102,7 +100,7 @@ test('npm repo test-repo-url-https - non-github (https://)', function (t) { 'repo', 'test-repo-url-https', '--registry=' + common.registry, '--loglevel=silent', - '--browser=' + __dirname + '/_script.sh' + '--browser=' + fakeBrowser ], opts, function (err, code, stdout, stderr) { t.ifError(err, 'repo command ran without error') t.equal(code, 0, 'exit ok') @@ -121,7 +119,7 @@ test('npm repo test-repo-url-ssh - non-github (ssh://)', function (t) { 'repo', 'test-repo-url-ssh', '--registry=' + common.registry, '--loglevel=silent', - '--browser=' + __dirname + '/_script.sh' + '--browser=' + fakeBrowser ], opts, function (err, code, stdout, stderr) { t.ifError(err, 'repo command ran without error') t.equal(code, 0, 'exit ok') @@ -135,7 +133,7 @@ test('npm repo test-repo-url-ssh - non-github (ssh://)', function (t) { }) test('cleanup', function (t) { - fs.unlinkSync(__dirname + '/_script.sh') + fs.unlinkSync(fakeBrowser) t.pass('cleaned up') t.end() }) diff --git a/deps/npm/test/tap/retry-on-stale-cache.js b/deps/npm/test/tap/retry-on-stale-cache.js new file mode 100644 index 0000000000..3a7f5c206c --- /dev/null +++ b/deps/npm/test/tap/retry-on-stale-cache.js @@ -0,0 +1,195 @@ +var path = require('path') + +var mr = require('npm-registry-mock') +var test = require('tap').test +var common = require('../common-tap') +var extend = Object.assign || require('util')._extend +var Tacks = require('tacks') +var Dir = Tacks.Dir +var File = Tacks.File + +var workdir = path.join(__dirname, path.basename(__filename, '.js')) +var cachedir = path.join(workdir, 'cache') +var modulesdir = path.join(workdir, 'modules') +var oldModule = path.join(modulesdir, 'good-night-0.1.0.tgz') +var newModule = path.join(modulesdir, 'good-night-1.0.0.tgz') + +var config = [ + '--cache', cachedir, + '--prefix', workdir, + '--registry', common.registry +] + +var fixture = new Tacks(Dir({ + 'cache': Dir(), + 'modules': Dir({ + 'good-night-0.1.0.tgz': File(new Buffer( + '1f8b0800000000000003ed934f4bc43010c57beea7187a59056dd36eff80' + + 'de85050541c1f3d8c634da4e4a925a8af8dd6db7bb8ba0e0c15559e9eff2' + + '206f929909bc06f327143c6826f51f8d2267cf30c6d2388641c32c61ef75' + + '4d9426e084519a25491645cbcc61e192c5d1e0ef7b90cf688d453d8cf2dd' + + '77a65d60a707c28b0b031e61cdbd33f08452c52949515aef64729eb93652' + + 'd168323ff4d9f6bce026d7b2b11bafef11b1eb3a221a2aa6126c6da9f4e8' + + '5e691f6e908a1a697b5ff346196995eec7023399c1c7fe95cc3999f57077' + + 'b717d7979efbeafef5a7fd2336b90f6a943484ff477a7c917f96c5bbfc87' + + '493ae63f627138e7ff37c815195571bf52e268b1820e0d0825498055d069' + + '6939d8521ab86f2dace0815715a0a9386f16c7e7730c676666660e9837c0' + + 'f6795d000c0000', + 'hex' + )), + 'good-night-1.0.0.tgz': File(new Buffer( + '1f8b0800000000000003ed954d6bc24010863dfb2bb6b9a8503793b849a0' + + 'eda5979efa052d484184252e495a331b76d78a94fef76e8cf683163cd42a' + + '957d2e03796777268187543c7de299f0aba6d2472db1b5650020668cd81a' + + '24117cae4bc23822ad208c93284a1208c216040318c436dff6223f31d386' + + '2bbbca6fef69de85bcd77fc24b9b583ce4a5f04e88974939e96391e5c63b' + + '6e9267a17421b10e030a14d6cf2742a7aaa8cc2a5b2c38e7f3f91c116d47' + + 'd3c2672697aa4eaf1425771c2725c7f579252aa90b23d5a26ed04de87f9f' + + '3f2d52817ab9dcf0fee2f6d26bbfb6f7fdd10e8895f77ec90bb4f2ffc98c' + + '0dfe439c7cf81fc4b5ff213070feef8254a2965341a732eb76b4cef39c12' + + 'e456eb52d82a29198dc637639f9c751fce8796eba35ea777ea0c3c14d6fe' + + '532314f62ba9ccf6676cf21fbefcff59ed3f4b22e7ff2e60110bc37d2fe1' + + '70381c8e9df306642df14500100000', + 'hex' + )) + }) +})) + +var server + +// In this test we mock a situation where the user has a package in his cache, +// a newer version of the package is published, and the user tried to install +// said new version while requestion that the cache be used. +// npm should see that it doesn't have the package in its cache and hit the +// registry. +var onlyOldMetadata = { + 'name': 'good-night', + 'dist-tags': { + 'latest': '0.1.0' + }, + 'versions': { + '0.1.0': { + 'name': 'good-night', + 'version': '0.1.0', + 'dist': { + 'shasum': '2a746d49dd074ba0ec2d6ff13babd40c658d89eb', + 'tarball': 'http://localhost:' + common.port + '/good-night/-/good-night-0.1.0.tgz' + } + } + } +} + +var oldAndNewMetadata = extend({}, onlyOldMetadata) +oldAndNewMetadata['dist-tags'] = { latest: '1.0.0' } +oldAndNewMetadata.versions = extend({ + '1.0.0': { + 'name': 'good-night', + 'version': '1.0.0', + 'dist': { + 'shasum': 'f377bf002a0a8fc4085d347a160a790b76896bc3', + 'tarball': 'http://localhost:' + common.port + '/good-night/-/good-night-1.0.0.tgz' + } + } +}, oldAndNewMetadata.versions) + +function setup () { + cleanup() + fixture.create(workdir) +} + +function cleanup () { + fixture.remove(workdir) +} + +test('setup', function (t) { + setup() + t.end() +}) + +test('setup initial server', function (t) { + mr({ + port: common.port, + throwOnUnmatched: true + }, function (err, s) { + t.ifError(err, 'registry mocked successfully') + server = s + + server.get('/good-night') + .many({ min: 1, max: 1 }) + .reply(200, onlyOldMetadata) + server.get('/good-night/-/good-night-0.1.0.tgz') + .many({ min: 1, max: 1 }) + .replyWithFile(200, oldModule) + + t.end() + }) +}) + +test('install initial version', function (t) { + common.npm(config.concat([ + 'install', 'good-night' + ]), {stdio: 'inherit'}, function (err, code) { + if (err) throw err + t.is(code, 0, 'initial install succeeded') + server.done() + t.end() + }) +}) + +test('cleanup initial server', function (t) { + server.close() + t.end() +}) + +test('setup new server', function (t) { + mr({ + port: common.port, + throwOnUnmatched: true + }, function (err, s) { + t.ifError(err, 'registry mocked successfully') + server = s + + server.get('/good-night') + .many({ min: 1, max: 1 }) + .reply(200, oldAndNewMetadata) + + server.get('/good-night/-/good-night-1.0.0.tgz') + .many({ min: 1, max: 1 }) + .replyWithFile(200, newModule) + + t.end() + }) +}) + +test('install new version', function (t) { + common.npm(config.concat([ + '--cache-min', 'Infinity', + 'install', 'good-night@1.0.0' + ]), {stdio: 'inherit'}, function (err, code) { + if (err) throw err + t.is(code, 0, 'install succeeded') + + t.end() + }) +}) + +test('install does not hit server again', function (t) { + // The mock server route definitions ensure we don't hit the server again + common.npm(config.concat([ + '--cache-min', 'Infinity', + 'install', 'good-night' + ]), {stdio: [0, 'pipe', 2]}, function (err, code, stdout) { + if (err) throw err + t.is(code, 0, 'install succeeded') + + t.match(stdout, /@1\.0\.0/, 'installed latest version') + server.done() + t.end() + }) +}) + +test('cleanup', function (t) { + server.close() + cleanup() + t.end() +}) diff --git a/deps/npm/test/tap/scripts-whitespace-windows.js b/deps/npm/test/tap/scripts-whitespace-windows.js index bff0e534ef..27a04601c7 100644 --- a/deps/npm/test/tap/scripts-whitespace-windows.js +++ b/deps/npm/test/tap/scripts-whitespace-windows.js @@ -37,12 +37,12 @@ var dependency = { var extend = Object.assign || require('util')._extend -var foo = function () {/* +var foo = function () { /* #!/usr/bin/env node if (process.argv.length === 8) console.log('npm-test-fine') -*/}.toString().split('\n').slice(1, -1).join('\n') +*/ }.toString().split('\n').slice(1, -1).join('\n') test('setup', function (t) { cleanup() diff --git a/deps/npm/test/tap/shrinkwrap-nested.js b/deps/npm/test/tap/shrinkwrap-nested.js new file mode 100644 index 0000000000..92c81f29e3 --- /dev/null +++ b/deps/npm/test/tap/shrinkwrap-nested.js @@ -0,0 +1,153 @@ +'use strict' +var test = require('tap').test +var Tacks = require('tacks') +var File = Tacks.File +var Dir = Tacks.Dir +var fs = require('fs') +var path = require('path') +var common = require('../common-tap.js') + +var testdir = path.resolve(__dirname, path.basename(__filename, '.js')) +var modAdir = path.resolve(testdir, 'modA') +var modB1dir = path.resolve(testdir, 'modB@1') +var modB2dir = path.resolve(testdir, 'modB@2') +var modCdir = path.resolve(testdir, 'modC') + +var fixture = new Tacks(Dir({ + 'package.json': File({ + dependencies: { + modA: 'file://' + modAdir, + modC: 'file://' + modCdir + } + }), + 'npm-shrinkwrap.json': File({ + dependencies: { + modA: { + version: '1.0.0', + from: 'modA', + resolved: 'file://' + modAdir + }, + modB: { + version: '1.0.0', + from: 'modB@1', + resolved: 'file://' + modB1dir + } + } + }), + 'modA': Dir({ + 'package.json': File({ + name: 'modA', + version: '1.0.0', + dependencies: { + 'modB': 'file://' + modB1dir + } + }) + }), + 'modB@1': Dir({ + 'package.json': File({ + name: 'modB', + version: '1.0.0' + }), + 'B1': File('') + }), + 'modB@2': Dir({ + 'package.json': File({ + name: 'modB', + version: '2.0.0' + }), + 'B2': File('') + }), + 'modC': Dir({ + 'package.json': File({ + name: 'modC', + version: '1.0.0', + dependencies: { + 'modB': 'file://' + modB2dir + } + }) + }) +})) + +var newShrinkwrap = new Tacks(Dir({ + 'npm-shrinkwrap.json': File({ + dependencies: { + modA: { + version: '1.0.0', + from: 'modA', + resolved: 'file://' + modAdir + }, + modB: { + version: '1.0.0', + from: 'modB@1', + resolved: 'file://' + modB1dir + }, + modC: { + version: '1.0.0', + from: 'modC', + resolved: 'file://' + modCdir, + dependencies: { + modB: { + version: '1.0.0', + from: 'modB@1', + resolved: 'file://' + modB1dir + } + } + } + } + }), + 'node_modules': Dir({ + 'modB@1': Dir({ + 'package.json': File({ + _requested: { + name: 'modB', + raw: 'modB@file:' + modB1dir, + rawSpec: 'file:' + modB1dir, + scope: null, + spec: modB1dir, + type: 'directory' + }, + dependencies: { }, + devDependencies: { }, + name: 'modB', + optionalDependencies: { }, + readme: 'ERROR: No README data found!', + version: '1.0.0' + }) + }) + }) +})) + +function setup () { + fixture.create(testdir) +} + +function cleanup () { + fixture.remove(testdir) +} + +test('setup', function (t) { + cleanup() + setup() + common.npm(['install'], {cwd: testdir, stdio: [0, 2, 2]}, function (err, code) { + if (err) throw err + t.is(code, 0) + t.end() + }) +}) + +test('incremental install', function (t) { + newShrinkwrap.create(testdir) + common.npm(['install'], {cwd: testdir, stdio: [0, 2, 2]}, function (err, code) { + if (err) throw err + t.is(code, 0, 'npm itself completed ok') + fs.stat(path.join(testdir, 'node_modules', 'modC', 'node_modules', 'modB', 'B1'), function (missing) { + t.ok(!missing, 'modC got the updated version of modB') + t.end() + }) + }) +}) + +test('cleanup', function (t) { + cleanup() + t.end() +}) diff --git a/deps/npm/test/tap/shrinkwrap-version-match.js b/deps/npm/test/tap/shrinkwrap-version-match.js index cb4e925504..7d9fed729a 100644 --- a/deps/npm/test/tap/shrinkwrap-version-match.js +++ b/deps/npm/test/tap/shrinkwrap-version-match.js @@ -1,8 +1,9 @@ 'use strict' var test = require('tap').test +var Tacks = require('tacks') +var File = Tacks.File +var Dir = Tacks.Dir var fs = require('fs') -var mkdirp = require('mkdirp') -var rimraf = require('rimraf') var path = require('path') var common = require('../common-tap.js') @@ -11,77 +12,68 @@ var modAdir = path.resolve(testdir, 'modA') var modB1dir = path.resolve(testdir, 'modB@1') var modB2dir = path.resolve(testdir, 'modB@2') var modCdir = path.resolve(testdir, 'modC') -var testjson = { - dependencies: { - modA: 'file://' + modAdir, - modC: 'file://' + modCdir - } -} -var testshrinkwrap = { - dependencies: { - modA: { + +var fixture = new Tacks(Dir({ + 'package.json': File({ + dependencies: { + modA: 'file://' + modAdir, + modC: 'file://' + modCdir + } + }), + 'npm-shrinkwrap.json': File({ + dependencies: { + modA: { + version: '1.0.0', + from: 'modA', + resolved: 'file://' + modAdir + }, + modB: { + version: '1.0.0', + from: 'modB@1', + resolved: 'file://' + modB1dir + } + } + }), + 'modA': Dir({ + 'package.json': File({ + name: 'modA', version: '1.0.0', - from: 'modA', - resolved: 'file://' + modAdir - }, - modB: { + dependencies: { + 'modB': 'file://' + modB1dir + } + }) + }), + 'modB@1': Dir({ + 'package.json': File({ + name: 'modB', + version: '1.0.0' + }), + 'B1': File('') + }), + 'modB@2': Dir({ + 'package.json': File({ + name: 'modB', + version: '2.0.0' + }), + 'B2': File('') + }), + 'modC': Dir({ + 'package.json': File({ + name: 'modC', version: '1.0.0', - from: 'modB@1', - resolved: 'file://' + modB1dir - } - } -} -var modAjson = { - name: 'modA', - version: '1.0.0', - dependencies: { - 'modB': 'file://' + modB1dir - } -} -var modCjson = { - name: 'modC', - version: '1.0.0', - dependencies: { - 'modB': 'file://' + modB2dir - } -} -var modB1json = { - name: 'modB', - version: '1.0.0' -} -var modB2json = { - name: 'modB', - version: '2.0.0' -} - -function writepjson (dir, content) { - writejson(dir, 'package.json', content) -} -function writejson (dir, file, content) { - writefile(dir, file, JSON.stringify(content, null, 2)) -} -function writefile (dir, file, content) { - fs.writeFileSync(path.join(dir, file), content) -} + dependencies: { + 'modB': 'file://' + modB2dir + } + }) + }) +})) function setup () { - mkdirp.sync(testdir) - writepjson(testdir, testjson) - writejson(testdir, 'npm-shrinkwrap.json', testshrinkwrap) - mkdirp.sync(modAdir) - writepjson(modAdir, modAjson) - mkdirp.sync(modB1dir) - writepjson(modB1dir, modB1json) - writefile(modB1dir, 'B1', '') - mkdirp.sync(modB2dir) - writepjson(modB2dir, modB2json) - writefile(modB2dir, 'B2', '') - mkdirp.sync(modCdir) - writepjson(modCdir, modCjson) + fixture.create(testdir) } function cleanup () { - rimraf.sync(testdir) + fixture.remove(testdir) } test('setup', function (t) { diff --git a/deps/npm/test/tap/sorted-package-json.js b/deps/npm/test/tap/sorted-package-json.js index 427212ff56..557f3dc53d 100644 --- a/deps/npm/test/tap/sorted-package-json.js +++ b/deps/npm/test/tap/sorted-package-json.js @@ -2,9 +2,6 @@ var test = require('tap').test var path = require('path') var rimraf = require('rimraf') var mkdirp = require('mkdirp') -var spawn = require('child_process').spawn -var npm = require.resolve('../../bin/npm-cli.js') -var node = process.execPath var pkg = path.resolve(__dirname, 'sorted-package-json') var tmp = path.join(pkg, 'tmp') var cache = path.join(pkg, 'cache') @@ -12,36 +9,31 @@ var fs = require('fs') var common = require('../common-tap.js') var mr = require('npm-registry-mock') var osenv = require('osenv') +var packageJson = path.resolve(pkg, 'package.json') -test('sorting dependencies', function (t) { - var packageJson = path.resolve(pkg, 'package.json') - - cleanup() - mkdirp.sync(cache) - mkdirp.sync(tmp) +test('setup', function (t) { setup() + t.pass('setup success') + t.done() +}) +test('sorting dependencies', function (t) { var before = JSON.parse(fs.readFileSync(packageJson).toString()) mr({ port: common.port }, function (er, s) { // underscore is already in the package.json, // but --save will trigger a rewrite with sort - var child = spawn(node, [npm, 'install', '--save', 'underscore@1.3.3', '--no-progress', '--loglevel=error'], { - cwd: pkg, - env: { - 'npm_config_registry': common.registry, - 'npm_config_cache': cache, - 'npm_config_tmp': tmp, - 'npm_config_prefix': pkg, - 'npm_config_global': 'false', - HOME: process.env.HOME, - Path: process.env.PATH, - PATH: process.env.PATH - }, - stdio: ['ignore', 'ignore', process.stderr] - }) - - child.on('close', function (code) { + common.npm([ + 'install', + '--save', 'underscore@1.3.3', + '--no-progress', + '--cache', cache, + '--tmp', tmp, + '--registry', common.registry + ], { + cwd: pkg + }, function (err, code, stdout, stderr) { + t.ifError(err, 'no error') t.equal(code, 0, 'npm install exited with code') var result = fs.readFileSync(packageJson).toString() var resultAsJson = JSON.parse(result) @@ -68,9 +60,10 @@ test('cleanup', function (t) { }) function setup () { + cleanup() mkdirp.sync(pkg) - fs.writeFileSync(path.resolve(pkg, 'package.json'), JSON.stringify({ + fs.writeFileSync(packageJson, JSON.stringify({ 'name': 'sorted-package-json', 'version': '0.0.0', 'description': '', @@ -91,4 +84,6 @@ function cleanup () { process.chdir(osenv.tmpdir()) rimraf.sync(cache) rimraf.sync(pkg) + mkdirp.sync(cache) + mkdirp.sync(tmp) } diff --git a/deps/npm/test/tap/spawn-enoent-help.js b/deps/npm/test/tap/spawn-enoent-help.js index 716f6ebd15..d4a6fcdd83 100644 --- a/deps/npm/test/tap/spawn-enoent-help.js +++ b/deps/npm/test/tap/spawn-enoent-help.js @@ -6,6 +6,8 @@ var common = require('../common-tap.js') var pkg = path.resolve(__dirname, 'spawn-enoent-help') +common.pendIfWindows('man pages are not built on Windows') + test('setup', function (t) { rimraf.sync(pkg) mkdirp.sync(pkg) diff --git a/deps/npm/test/tap/symlink-cycle.js b/deps/npm/test/tap/symlink-cycle.js index b09b25acc8..62aa8e0674 100644 --- a/deps/npm/test/tap/symlink-cycle.js +++ b/deps/npm/test/tap/symlink-cycle.js @@ -57,5 +57,5 @@ function setup () { path.join(cycle, 'package.json'), JSON.stringify(cycleJSON, null, 2) ) - fs.symlinkSync(cycle, path.join(cycle, 'node_modules', 'cycle')) + fs.symlinkSync(cycle, path.join(cycle, 'node_modules', 'cycle'), 'junction') } diff --git a/deps/npm/test/tap/umask-lifecycle.js b/deps/npm/test/tap/umask-lifecycle.js index aa07084f15..c4c3233637 100644 --- a/deps/npm/test/tap/umask-lifecycle.js +++ b/deps/npm/test/tap/umask-lifecycle.js @@ -6,24 +6,30 @@ var rimraf = require('rimraf') var test = require('tap').test var sprintf = require('sprintf-js').sprintf +var escapeExecPath = require('../../lib/utils/escape-exec-path.js') +var escapeArg = require('../../lib/utils/escape-arg.js') var common = require('../common-tap.js') var pkg = path.resolve(__dirname, 'umask-lifecycle') +var nodeCmd = escapeExecPath(common.nodeBin) +var npmCmd = nodeCmd + ' ' + escapeArg(common.bin) +var umaskScript = npmCmd + ' config get umask && ' + nodeCmd + ' -pe "[process.env.npm_config_umask, process.umask()]"' + var pj = JSON.stringify({ name: 'x', version: '1.2.3', - scripts: { umask: '$npm_execpath config get umask && echo "$npm_config_umask" && node -pe "process.umask()"' } + scripts: { umask: umaskScript } }, null, 2) + '\n' var umask = process.umask() var expected = [ '', '> x@1.2.3 umask ' + path.join(__dirname, 'umask-lifecycle'), - '> $npm_execpath config get umask && echo "$npm_config_umask" && node -pe "process.umask()"', + '> ' + umaskScript, '', sprintf('%04o', umask), - sprintf('%04o', umask), - sprintf('%d', umask), + "[ '" + sprintf('%04o', umask) + "', " + + sprintf('%d', umask) + ' ]', '' ].join('\n') diff --git a/deps/npm/test/tap/unit-child-path.js b/deps/npm/test/tap/unit-child-path.js index 5e9b452a38..902e8f5ec7 100644 --- a/deps/npm/test/tap/unit-child-path.js +++ b/deps/npm/test/tap/unit-child-path.js @@ -1,9 +1,16 @@ 'use strict' var test = require('tap').test var childPath = require('../../lib/utils/child-path.js') +var path = require('path') test('childPath', function (t) { - t.is(childPath('/path/to', {name: 'abc'}), '/path/to/node_modules/abc', 'basic use') - t.is(childPath('/path/to', {package: {name: '@zed/abc'}}), '/path/to/node_modules/@zed/abc', 'scoped use') + t.is( + path.resolve(childPath('/path/to', {name: 'abc'})), + path.resolve('/path/to/node_modules/abc'), + 'basic use') + t.is( + path.resolve(childPath('/path/to', {package: {name: '@zed/abc'}})), + path.resolve('/path/to/node_modules/@zed/abc'), + 'scoped use') t.end() }) diff --git a/deps/npm/test/tap/unit-gentlyrm.js b/deps/npm/test/tap/unit-gentlyrm.js index 8e61be1964..8ea0a11fc2 100644 --- a/deps/npm/test/tap/unit-gentlyrm.js +++ b/deps/npm/test/tap/unit-gentlyrm.js @@ -1,6 +1,7 @@ 'use strict' var test = require('tap').test var requireInject = require('require-inject') +var path = require('path') function error (code) { var er = new Error() @@ -8,11 +9,54 @@ function error (code) { return er } +function platformPath (unixPath) { + if (unixPath[0] === '/') { + return path.resolve(unixPath) + } else { + return path.join.apply(path, unixPath.split('/')) + } +} + +function makeObjUsePlatformPaths (obj) { + if (typeof obj === 'string') { + return platformPath(obj) + } else if (obj == null || typeof obj !== 'object') { + return obj + } else { + Object.keys(obj).forEach(function (key) { + var newKey = platformPath(key) + obj[key] = makeObjUsePlatformPaths(obj[key]) + if (newKey !== key) { + obj[newKey] = obj[key] + delete obj[key] + } + }) + } + return obj +} + +function makeArgsUsePlatformPaths (fn) { + return function () { + var args = Array.prototype.slice.call(arguments) + return fn.apply(null, makeObjUsePlatformPaths(args)) + } +} + +function pathIs (t, arg1, arg2, msg) { + t.is(arg1, makeObjUsePlatformPaths(arg2), msg) +} + +function pathIsDeeply (t, arg1, arg2, msg) { + t.isDeeply(arg1, makeObjUsePlatformPaths(arg2), msg) +} + function mockWith (fixture) { + makeObjUsePlatformPaths(fixture) return { '../../lib/npm.js': {}, 'graceful-fs': { lstat: function (path, cb) { + path = platformPath(path) var entry = fixture[path] if (!entry) return cb(error('ENOENT')) cb(null, { @@ -22,6 +66,7 @@ function mockWith (fixture) { }) }, readlink: function (path, cb) { + path = platformPath(path) var entry = fixture[path] if (!entry) return cb(error('ENOENT')) if (entry.type !== 'symlink') return cb(error('EINVAL')) @@ -29,6 +74,7 @@ function mockWith (fixture) { } }, 'read-cmd-shim': function (path, cb) { + path = platformPath(path) var entry = fixture[path] if (!entry) return cb(error('ENOENT')) if (entry.type === 'directory') return cb(error('EISDIR')) @@ -51,7 +97,7 @@ test('readLinkOrShim', function (t) { }) var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mocks) - var readLinkOrShim = gentlyRm._readLinkOrShim + var readLinkOrShim = makeArgsUsePlatformPaths(gentlyRm._readLinkOrShim) readLinkOrShim('/path/to/nowhere', function (er, path) { t.is(er && er.code, 'ENOENT', 'missing files are errors') @@ -61,19 +107,19 @@ test('readLinkOrShim', function (t) { }) readLinkOrShim('/path/to/directory', function (er, path) { t.ifError(er, "reading dirs isn't an error") - t.is(path, null, 'reading non links/cmdshims gives us null') + pathIs(t, path, null, 'reading non links/cmdshims gives us null') }) readLinkOrShim('/path/to/file', function (er, path) { t.ifError(er, "reading non-cmdshim files isn't an error") - t.is(path, null, 'reading non links/cmdshims gives us null') + pathIs(t, path, null, 'reading non links/cmdshims gives us null') }) readLinkOrShim('/path/to/link', function (er, path) { t.ifError(er, "reading links isn't an error") - t.is(path, '../to/file', 'reading links works') + pathIs(t, path, '../to/file', 'reading links works') }) readLinkOrShim('/path/to/cmdshim', function (er, path) { t.ifError(er, "reading cmdshims isn't an error") - t.is(path, '../to/file', 'reading cmdshims works') + pathIs(t, path, '../to/file', 'reading cmdshims works') }) t.done() }) @@ -89,26 +135,30 @@ test('resolveSymlink', function (t) { }) var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mocks) - var resolveSymlink = gentlyRm._resolveSymlink + var resolveSymlink = makeArgsUsePlatformPaths(gentlyRm._resolveSymlink) resolveSymlink('/path/to/nowhere', function (er, path) { t.is(er && er.code, 'ENOENT', 'missing files are errors') }) + + // these aren't symlinks so we get back what we passed in resolveSymlink('/path/to/directory', function (er, path) { t.ifError(er, "reading dirs isn't an error") - t.is(path, '/path/to/directory', 'reading non links/cmdshims gives us path we passed in') + pathIs(t, path, '/path/to/directory', 'reading non links/cmdshims gives us path we passed in') }) resolveSymlink('/path/to/file', function (er, path) { t.ifError(er, "reading non-cmdshim files isn't an error") - t.is(path, '/path/to/file', 'reading non links/cmdshims gives us the path we passed in') + pathIs(t, path, '/path/to/file', 'reading non links/cmdshims gives us the path we passed in') }) + + // these are symlinks so the resolved version is platform specific resolveSymlink('/path/to/link', function (er, path) { t.ifError(er, "reading links isn't an error") - t.is(path, '/path/to/file', 'reading links works') + pathIs(t, path, '/path/to/file', 'reading links works') }) resolveSymlink('/path/to/cmdshim', function (er, path) { t.ifError(er, "reading cmdshims isn't an error") - t.is(path, '/path/to/file', 'reading cmdshims works') + pathIs(t, path, '/path/to/file', 'reading cmdshims works') }) t.done() }) @@ -128,48 +178,48 @@ test('readAllLinks', function (t) { }) var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mocks) - var readAllLinks = gentlyRm._readAllLinks + var readAllLinks = makeArgsUsePlatformPaths(gentlyRm._readAllLinks) readAllLinks('/path/to/nowhere', function (er, path) { t.is(er && er.code, 'ENOENT', 'missing files are errors') }) readAllLinks('/path/to/directory', function (er, path) { t.ifError(er, "reading dirs isn't an error") - t.isDeeply(path, ['/path/to/directory'], 'reading non links/cmdshims gives us path we passed in') + pathIsDeeply(t, path, ['/path/to/directory'], 'reading non links/cmdshims gives us path we passed in') }) readAllLinks('/path/to/file', function (er, path) { t.ifError(er, "reading non-cmdshim files isn't an error") - t.isDeeply(path, ['/path/to/file'], 'reading non links/cmdshims gives us the path we passed in') + pathIsDeeply(t, path, ['/path/to/file'], 'reading non links/cmdshims gives us the path we passed in') }) readAllLinks('/path/to/linktobad', function (er, path) { t.is(er && er.code, 'ENOENT', 'links to missing files are errors') }) - readAllLinks('/path/to/link', function (er, path) { + readAllLinks('/path/to/link', function (er, results) { t.ifError(er, "reading links isn't an error") - t.isDeeply(path, ['/path/to/link', '/path/to/file'], 'reading links works') + pathIsDeeply(t, results, ['/path/to/link', '/path/to/file'], 'reading links works') }) readAllLinks('/path/to/cmdshim', function (er, path) { t.ifError(er, "reading cmdshims isn't an error") - t.isDeeply(path, ['/path/to/cmdshim', '/path/to/file'], 'reading cmdshims works') + pathIsDeeply(t, path, ['/path/to/cmdshim', '/path/to/file'], 'reading cmdshims works') }) readAllLinks('/path/to/linktolink', function (er, path) { t.ifError(er, "reading link to link isn't an error") - t.isDeeply(path, ['/path/to/linktolink', '/path/to/link', '/path/to/file'], 'reading link to link works') + pathIsDeeply(t, path, ['/path/to/linktolink', '/path/to/link', '/path/to/file'], 'reading link to link works') }) readAllLinks('/path/to/linktolink^2', function (er, path) { t.ifError(er, "reading link to link to link isn't an error") - t.isDeeply(path, ['/path/to/linktolink^2', '/path/to/linktolink', '/path/to/link', '/path/to/file'], 'reading link to link to link works') + pathIsDeeply(t, path, ['/path/to/linktolink^2', '/path/to/linktolink', '/path/to/link', '/path/to/file'], 'reading link to link to link works') }) readAllLinks('/path/to/linktocmdshim', function (er, path) { t.ifError(er, "reading link to cmdshim isn't an error") - t.isDeeply(path, ['/path/to/linktocmdshim', '/path/to/cmdshim', '/path/to/file'], 'reading link to cmdshim works') + pathIsDeeply(t, path, ['/path/to/linktocmdshim', '/path/to/cmdshim', '/path/to/file'], 'reading link to cmdshim works') }) t.done() }) test('areAnyInsideAny', function (t) { var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mockWith({})) - var areAnyInsideAny = gentlyRm._areAnyInsideAny + var areAnyInsideAny = makeArgsUsePlatformPaths(gentlyRm._areAnyInsideAny) var noneOneToOne = areAnyInsideAny(['/abc'], ['/xyz']) t.is(noneOneToOne, false, 'none inside: one to one') @@ -181,42 +231,42 @@ test('areAnyInsideAny', function (t) { t.is(noneManyToMany, false, 'none inside: many to many') var oneToOne = areAnyInsideAny(['/one/toOne'], ['/one']) - t.isDeeply(oneToOne, {target: '/one/toOne', path: '/one'}, 'first: one to one') + pathIsDeeply(t, oneToOne, {target: '/one/toOne', path: '/one'}, 'first: one to one') var firstOneToMany = areAnyInsideAny(['/abc/def'], ['/abc', '/def', '/ghi']) - t.isDeeply(firstOneToMany, {target: '/abc/def', path: '/abc'}, 'first: one to many') + pathIsDeeply(t, firstOneToMany, {target: '/abc/def', path: '/abc'}, 'first: one to many') var secondOneToMany = areAnyInsideAny(['/def/ghi'], ['/abc', '/def', '/ghi']) - t.isDeeply(secondOneToMany, {target: '/def/ghi', path: '/def'}, 'second: one to many') + pathIsDeeply(t, secondOneToMany, {target: '/def/ghi', path: '/def'}, 'second: one to many') var lastOneToMany = areAnyInsideAny(['/ghi/jkl'], ['/abc', '/def', '/ghi']) - t.isDeeply(lastOneToMany, {target: '/ghi/jkl', path: '/ghi'}, 'last: one to many') + pathIsDeeply(t, lastOneToMany, {target: '/ghi/jkl', path: '/ghi'}, 'last: one to many') var firstManyToOne = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/abc']) - t.isDeeply(firstManyToOne, {target: '/abc/def', path: '/abc'}, 'first: many to one') + pathIsDeeply(t, firstManyToOne, {target: '/abc/def', path: '/abc'}, 'first: many to one') var secondManyToOne = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/uvw']) - t.isDeeply(secondManyToOne, {target: '/uvw/def', path: '/uvw'}, 'second: many to one') + pathIsDeeply(t, secondManyToOne, {target: '/uvw/def', path: '/uvw'}, 'second: many to one') var lastManyToOne = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/xyz']) - t.isDeeply(lastManyToOne, {target: '/xyz/def', path: '/xyz'}, 'last: many to one') + pathIsDeeply(t, lastManyToOne, {target: '/xyz/def', path: '/xyz'}, 'last: many to one') var firstToFirst = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/abc', '/uvw', '/xyz']) - t.isDeeply(firstToFirst, {target: '/abc/def', path: '/abc'}, 'first to first: many to many') + pathIsDeeply(t, firstToFirst, {target: '/abc/def', path: '/abc'}, 'first to first: many to many') var firstToSecond = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/nope', '/abc', '/xyz']) - t.isDeeply(firstToSecond, {target: '/abc/def', path: '/abc'}, 'first to second: many to many') + pathIsDeeply(t, firstToSecond, {target: '/abc/def', path: '/abc'}, 'first to second: many to many') var firstToLast = areAnyInsideAny(['/abc/def', '/uvw/def', '/xyz/def'], ['/nope', '/nooo', '/abc']) - t.isDeeply(firstToLast, {target: '/abc/def', path: '/abc'}, 'first to last: many to many') + pathIsDeeply(t, firstToLast, {target: '/abc/def', path: '/abc'}, 'first to last: many to many') var secondToFirst = areAnyInsideAny(['/!!!', '/abc/def', '/xyz/def'], ['/abc', '/uvw', '/xyz']) - t.isDeeply(secondToFirst, {target: '/abc/def', path: '/abc'}, 'second to first: many to many') + pathIsDeeply(t, secondToFirst, {target: '/abc/def', path: '/abc'}, 'second to first: many to many') var secondToSecond = areAnyInsideAny(['/!!!', '/abc/def', '/xyz/def'], ['/nope', '/abc', '/xyz']) - t.isDeeply(secondToSecond, {target: '/abc/def', path: '/abc'}, 'second to second: many to many') + pathIsDeeply(t, secondToSecond, {target: '/abc/def', path: '/abc'}, 'second to second: many to many') var secondToLast = areAnyInsideAny(['/!!!', '/abc/def', '/uvw/def'], ['/nope', '/nooo', '/abc']) - t.isDeeply(secondToLast, {target: '/abc/def', path: '/abc'}, 'second to last: many to many') + pathIsDeeply(t, secondToLast, {target: '/abc/def', path: '/abc'}, 'second to last: many to many') var lastToFirst = areAnyInsideAny(['/!!!', '/???', '/abc/def'], ['/abc', '/uvw', '/xyz']) - t.isDeeply(lastToFirst, {target: '/abc/def', path: '/abc'}, 'last to first: many to many') + pathIsDeeply(t, lastToFirst, {target: '/abc/def', path: '/abc'}, 'last to first: many to many') var lastToSecond = areAnyInsideAny(['/!!!', '/???', '/abc/def'], ['/nope', '/abc', '/xyz']) - t.isDeeply(lastToSecond, {target: '/abc/def', path: '/abc'}, 'last to second: many to many') + pathIsDeeply(t, lastToSecond, {target: '/abc/def', path: '/abc'}, 'last to second: many to many') var lastToLast = areAnyInsideAny(['/!!!', '/???', '/abc/def'], ['/nope', '/nooo', '/abc']) - t.isDeeply(lastToLast, {target: '/abc/def', path: '/abc'}, 'last to last: many to many') + pathIsDeeply(t, lastToLast, {target: '/abc/def', path: '/abc'}, 'last to last: many to many') t.done() }) @@ -233,11 +283,11 @@ test('isEverInside', function (t) { }) var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mocks) - var isEverInside = gentlyRm._isEverInside + var isEverInside = makeArgsUsePlatformPaths(gentlyRm._isEverInside) isEverInside('/path/to/file', ['/path/to', '/path/to/invalid'], function (er, inside) { t.ifError(er) - t.isDeeply(inside, {target: '/path/to/file', path: '/path/to'}, 'bad paths are ignored if something matches') + pathIsDeeply(t, inside, {target: '/path/to/file', path: '/path/to'}, 'bad paths are ignored if something matches') }) isEverInside('/path/to/invalid', ['/path/to/invalid'], function (er, inside) { @@ -255,20 +305,20 @@ test('isEverInside', function (t) { isEverInside('/path/to/file', ['/path/to'], function (er, inside) { t.ifError(er) - t.isDeeply(inside, {target: '/path/to/file', path: '/path/to'}, 'plain file in plain path') + pathIsDeeply(t, inside, {target: '/path/to/file', path: '/path/to'}, 'plain file in plain path') }) isEverInside('/path/other/link', ['/path/to'], function (er, inside) { t.ifError(er) - t.isDeeply(inside, {target: '/path/to/file', path: '/path/to'}, 'link in plain path') + pathIsDeeply(t, inside, {target: '/path/to/file', path: '/path/to'}, 'link in plain path') }) isEverInside('/path/to/file', ['/linkpath'], function (er, inside) { t.ifError(er) - t.isDeeply(inside, {target: '/path/to/file', path: '/path/to'}, 'plain file in link path') + pathIsDeeply(t, inside, {target: '/path/to/file', path: '/path/to'}, 'plain file in link path') }) isEverInside('/path/other/link', ['/linkpath'], function (er, inside) { t.ifError(er) - t.isDeeply(inside, {target: '/path/to/file', path: '/path/to'}, 'link in link path') + pathIsDeeply(t, inside, {target: '/path/to/file', path: '/path/to'}, 'link in link path') }) t.done() @@ -276,15 +326,15 @@ test('isEverInside', function (t) { test('isSafeToRm', function (t) { var gentlyRm = requireInject('../../lib/utils/gently-rm.js', mockWith({})) - var isSafeToRm = gentlyRm._isSafeToRm + var isSafeToRm = makeArgsUsePlatformPaths(gentlyRm._isSafeToRm) t.plan(12) function testIsSafeToRm (t, parent, target, shouldPath, shouldBase, msg) { isSafeToRm(parent, target, function (er, path, base) { t.ifError(er, msg + ' no error') - t.is(path, shouldPath, msg + ' path') - t.is(base, shouldBase, msg + ' base') + pathIs(t, path, shouldPath, msg + ' path') + pathIs(t, base, shouldBase, msg + ' base') }) } diff --git a/deps/npm/test/tap/unit-link.js b/deps/npm/test/tap/unit-link.js new file mode 100644 index 0000000000..e4b9094068 --- /dev/null +++ b/deps/npm/test/tap/unit-link.js @@ -0,0 +1,281 @@ +'use strict' +var util = require('util') +var test = require('tap').test +var requireInject = require('require-inject') +var dezalgo = require('dezalgo') +var mkdirp = require('mkdirp') +var path = require('path') + +test('gently/force', function (t) { + t.plan(5) + + linkOk(t, 'gently=true, force=false, works', { + // args + from: 'wibble', + to: '/foo/bar/baz', + gently: true, + abs: true, + force: false, + + // expect + rm: {'/foo/bar/baz': {gently: true}}, + mkdir: {'/foo/bar': true}, + lstat: {'/foo/bar/wibble': {isLink: false}}, + stat: {'/foo/bar/wibble': true}, + symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, + readlink: {} + }) + + linkNotOk(t, 'gently=true, force=false, does not work', { + // args + from: 'wibble', + to: '/foo/bar/baz', + gently: true, + abs: true, + force: false, + + // expect + rm: {'/foo/bar/baz': {gently: false}}, + mkdir: {'/foo/bar': true}, + lstat: {'/foo/bar/wibble': {isLink: false}}, + stat: {'/foo/bar/wibble': true}, + symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, + readlink: {} + }) + + linkOk(t, 'gently=false, force=false, aok', { + // args + from: 'wibble', + to: '/foo/bar/baz', + gently: false, + abs: true, + force: false, + + // expect + rm: {'/foo/bar/baz': {gently: false}}, + mkdir: {'/foo/bar': true}, + lstat: {'/foo/bar/wibble': {isLink: false}}, + stat: {'/foo/bar/wibble': true}, + symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, + readlink: {} + }) + + linkOk(t, 'gently=true, force=true, aok', { + // args + from: 'wibble', + to: '/foo/bar/baz', + gently: true, + abs: true, + force: true, + + // expect + rm: {'/foo/bar/baz': {gently: false}}, + mkdir: {'/foo/bar': true}, + lstat: {'/foo/bar/wibble': {isLink: false}}, + stat: {'/foo/bar/wibble': true}, + symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, + readlink: {} + }) + + linkOk(t, 'gently=false, force=true, aok', { + // args + from: 'wibble', + to: '/foo/bar/baz', + gently: false, + abs: true, + force: true, + + // expect + rm: {'/foo/bar/baz': {gently: false}}, + mkdir: {'/foo/bar': true}, + lstat: {'/foo/bar/wibble': {isLink: false}}, + stat: {'/foo/bar/wibble': true}, + symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, + readlink: {} + }) +}) + +test('abs, noabs', function (t) { + t.plan(4) + + linkOk(t, 'abs', { + // args + from: 'wibble', + to: '/foo/bar/baz', + gently: true, + abs: true, + force: false, + + // expect + rm: {'/foo/bar/baz': {gently: true}}, + mkdir: {'/foo/bar': true}, + lstat: {'/foo/bar/wibble': {isLink: false}}, + stat: {'/foo/bar/wibble': true}, + symlink: {'/foo/bar/wibble': {'/foo/bar/baz': 'junction'}}, + readlink: {} + }) + + linkOk(t, 'relative', { + // args + from: 'wibble', + to: '/foo/bar/baz', + gently: true, + abs: false, + force: false, + + // expect + rm: {'/foo/bar/baz': {gently: true}}, + mkdir: {'/foo/bar': true}, + lstat: {'/foo/bar/wibble': {isLink: false}}, + stat: {'/foo/bar/wibble': true}, + symlink: {'wibble': {'/foo/bar/baz': 'junction'}}, + readlink: {} + }) + + linkOk(t, 'relative ..', { + // args + from: '../wibble/bark/blump', + to: '/foo/bar/baz', + gently: true, + abs: false, + force: false, + + // expect + rm: {'/foo/bar/baz': {gently: true}}, + mkdir: {'/foo/bar': true}, + lstat: {'/foo/wibble/bark/blump': {isLink: false}}, + stat: {'/foo/wibble/bark/blump': true}, + symlink: {'../wibble/bark/blump': {'/foo/bar/baz': 'junction'}}, + readlink: {} + }) + + linkOk(t, 'relative .. deep', { + // args + from: 'zib/zap/../../../wibble/bark/blump', + to: '/foo/bar/baz', + gently: true, + abs: false, + force: false, + + // expect + rm: {'/foo/bar/baz': {gently: true}}, + mkdir: {'/foo/bar': true}, + lstat: {'/foo/wibble/bark/blump': {isLink: false}}, + stat: {'/foo/wibble/bark/blump': true}, + symlink: {'../wibble/bark/blump': {'/foo/bar/baz': 'junction'}}, + readlink: {} + }) +}) + +function linkOk (t, msg, opts) { + testLink(opts, function (err) { + t.ifError(err, msg) + }) +} + +function linkNotOk (t, msg, opts) { + testLink(opts, function (err) { + t.ok(err, msg) + }) +} + +function platformPath (unixPath) { + if (unixPath[0] === '/') { + return path.resolve(unixPath) + } else { + return path.join.apply(path, unixPath.split('/')) + } +} + +function platformerize (obj) { + Object.keys(obj).forEach(function (key) { + var newKey = platformPath(key) + if (typeof obj[key] === 'object') { + platformerize(obj[key]) + } else if (typeof obj[key] === 'string') { + obj[key] = platformPath(obj[key]) + } + if (newKey !== key) { + obj[newKey] = obj[key] + delete obj[key] + } + }) +} + +function testLink (opts, cb) { + var mkdirpMock = dezalgo(function (dir, cb) { + if (opts.mkdir[dir]) { + cb() + } else { + cb(new Error('mkdirp failed: ' + util.inspect(dir))) + } + }) + // sync version used by istanbul for test coverage + // we shouldn't have to do this ;.; + // require-inject and/or instanbul will need patching + mkdirpMock.sync = mkdirp.sync + + // convert any paths in our opts into platform specific paths, for windows support. + platformerize(opts) + + var link = requireInject('../../lib/utils/link.js', { + '../../lib/npm.js': { + config: { + get: function (name) { + if (name !== 'force') return new Error('unknown config key: ' + name) + return opts.force + } + } + }, + '../../lib/utils/gently-rm.js': dezalgo(function (toRemove, gently, cb) { + if (opts.rm[toRemove] && opts.rm[toRemove].gently === gently) { + cb() + } else { + cb(new Error('Removing toRemove: ' + util.inspect(toRemove) + + ' gently: ' + util.inspect(gently) + + ' not allowed: ' + util.inspect(opts.rm))) + } + }), + 'mkdirp': mkdirpMock, + 'graceful-fs': { + 'stat': dezalgo(function (file, cb) { + if (opts.stat[file]) { + cb(null, {}) + } else { + cb(new Error('stat failed for: ' + util.inspect(file))) + } + }), + 'lstat': dezalgo(function (file, cb) { + if (opts.lstat[file]) { + var linkStat = opts.lstat[file] + cb(null, { + isSymbolicLink: function () { + return linkStat.isLink + } + }) + } else { + cb(new Error('lstat failed for: ' + util.inspect(file))) + } + }), + 'symlink': dezalgo(function (from, to, type, cb) { + if (!cb) { + cb = type + type = null + } + if (opts.symlink[from] && opts.symlink[from][to] === type) { + cb() + } else { + cb(new Error('symlink failed from: ' + util.inspect(from) + ' to: ' + util.inspect(to) + ' type: ' + util.inspect(type))) + } + }), + 'readlink': function (file, cb) { + if (opts.readlink[file]) { + cb() + } else { + cb(new Error('readlink failed for: ' + util.inspect(file))) + } + } + } + }) + link(opts.from, opts.to, opts.gently, opts.abs, cb) +} diff --git a/deps/npm/test/tap/unpack-foreign-tarball.js b/deps/npm/test/tap/unpack-foreign-tarball.js index 56d707c31a..d128e94d8c 100644 --- a/deps/npm/test/tap/unpack-foreign-tarball.js +++ b/deps/npm/test/tap/unpack-foreign-tarball.js @@ -21,8 +21,7 @@ var EXEC_OPTS = { 'npm_config_cache': cache, 'npm_config_tmp': tmp }, - cwd: pkg, - stdio: [ 'pipe', 'pipe', 2 ] + cwd: pkg } function verify (t, files, err, code) { diff --git a/deps/npm/test/tap/unpublish-config.js b/deps/npm/test/tap/unpublish-config.js index d6e18eb024..92a0c731fe 100644 --- a/deps/npm/test/tap/unpublish-config.js +++ b/deps/npm/test/tap/unpublish-config.js @@ -44,7 +44,7 @@ test('cursory test of unpublishing with config', function (t) { res.end(JSON.stringify({ error: 'shh no tears, only dreams now' })) - child.kill('SIGHUP') + child.kill('SIGINT') }).listen(common.port, function () { t.pass('server is listening') diff --git a/deps/npm/test/tap/verify-no-lifecycle-on-repo.js b/deps/npm/test/tap/verify-no-lifecycle-on-repo.js index 29f79e2983..eedaa756b8 100644 --- a/deps/npm/test/tap/verify-no-lifecycle-on-repo.js +++ b/deps/npm/test/tap/verify-no-lifecycle-on-repo.js @@ -4,7 +4,8 @@ var fs = require('graceful-fs') var mkdirp = require('mkdirp') var rimraf = require('rimraf') var test = require('tap').test -var common = require('../common-tap.js') +var requireInject = require('require-inject') +require('../common-tap.js') var base = path.join(__dirname, path.basename(__filename, '.js')) @@ -20,6 +21,17 @@ var baseJSON = { } } +var lastOpened +var npm = requireInject.installGlobally('../../lib/npm.js', { + '../../lib/utils/lifecycle.js': function (pkg, stage, wd, unsafe, failOk, cb) { + cb(new Error("Shouldn't be calling lifecycle scripts")) + }, + opener: function (url, options, cb) { + lastOpened = {url: url, options: options} + cb() + } +}) + test('setup', function (t) { cleanup() setup() @@ -27,11 +39,14 @@ test('setup', function (t) { }) test('repo', function (t) { - common.npm(['repo', '--browser=echo'], {cwd: base}, function (er, code, stdout, stderr) { - t.ifError(er, 'npm config ran without issue') - t.is(code, 0, 'exited with a non-error code') - t.is(stderr, '', 'Ran without errors') - t.end() + process.chdir(base) + npm.load({browser: 'echo'}, function () { + npm.commands.repo([], function (err) { + t.ifError(err, 'no errors') + t.match(lastOpened.url, baseJSON.repository.url, 'opened the right url') + t.is(lastOpened.options.command, 'echo', 'opened with a specified browser') + t.end() + }) }) }) diff --git a/deps/npm/test/tap/version-lifecycle.js b/deps/npm/test/tap/version-lifecycle.js index 5d78b71d59..3b4fb50b24 100644 --- a/deps/npm/test/tap/version-lifecycle.js +++ b/deps/npm/test/tap/version-lifecycle.js @@ -21,11 +21,10 @@ test('npm version with failing preversion lifecycle script', function ( version: '0.0.0', description: 'Test for npm version if preversion script fails', scripts: { - preversion: './fail.sh' + preversion: 'node ./fail.js' } }), 'utf8') - fs.writeFileSync(path.resolve(pkg, 'fail.sh'), 'exit 50', 'utf8') - fs.chmodSync(path.resolve(pkg, 'fail.sh'), 448) + fs.writeFileSync(path.resolve(pkg, 'fail.js'), 'process.exit(50)', 'utf8') npm.load({cache: cache, 'sign-git-tag': false, registry: common.registry}, function () { var version = require('../../lib/version') version(['patch'], function (err) { @@ -44,11 +43,10 @@ test('npm version with failing version lifecycle script', function (t) version: '0.0.0', description: 'Test for npm version if postversion script fails', scripts: { - version: './fail.sh' + version: 'node ./fail.js' } }), 'utf8') - fs.writeFileSync(path.resolve(pkg, 'fail.sh'), 'exit 50', 'utf8') - fs.chmodSync(path.resolve(pkg, 'fail.sh'), 448) + fs.writeFileSync(path.resolve(pkg, 'fail.js'), 'process.exit(50)', 'utf8') npm.load({cache: cache, 'sign-git-tag': false, registry: common.registry}, function () { var version = require('../../lib/version') version(['patch'], function (err) { @@ -67,11 +65,10 @@ test('npm version with failing postversion lifecycle script', function version: '0.0.0', description: 'Test for npm version if postversion script fails', scripts: { - postversion: './fail.sh' + postversion: 'node ./fail.js' } }), 'utf8') - fs.writeFileSync(path.resolve(pkg, 'fail.sh'), 'exit 50', 'utf8') - fs.chmodSync(path.resolve(pkg, 'fail.sh'), 448) + fs.writeFileSync(path.resolve(pkg, 'fail.js'), 'process.exit(50)', 'utf8') npm.load({cache: cache, 'sign-git-tag': false, registry: common.registry}, function () { var version = require('../../lib/version') version(['patch'], function (err) { @@ -90,9 +87,9 @@ test('npm version execution order', function (t) { version: '0.0.0', description: 'Test for npm version if postversion script fails', scripts: { - preversion: './preversion.sh', - version: './version.sh', - postversion: './postversion.sh' + preversion: 'node ./preversion.js', + version: 'node ./version.js', + postversion: 'node ./postversion.js' } }), 'utf8') makeScript('preversion') @@ -143,14 +140,31 @@ function setup () { } function makeScript (lifecycle) { - var contents = [ - 'cp package.json ' + lifecycle + '-package.json', - 'git add ' + lifecycle + '-package.json', - 'git status --porcelain > ' + lifecycle + '-git.txt' - ].join('\n') - var scriptPath = path.join(pkg, lifecycle + '.sh') - fs.writeFileSync(scriptPath, contents, 'utf-8') - fs.chmodSync(scriptPath, 448) + function contents (lifecycle) { + var fs = require('fs') + var exec = require('child_process').exec + fs.createReadStream('package.json') + .pipe(fs.createWriteStream(lifecycle + '-package.json')) + .on('close', function () { + exec( + 'git add ' + lifecycle + '-package.json', + function () { + exec( + 'git status --porcelain', + function (err, stdout) { + if (err) throw err + fs.writeFileSync(lifecycle + '-git.txt', stdout) + } + ) + } + ) + }) + } + var scriptPath = path.join(pkg, lifecycle + '.js') + fs.writeFileSync( + scriptPath, + '(' + contents.toString() + ')(\'' + lifecycle + '\')', + 'utf-8') } function readPackage (lifecycle) { diff --git a/deps/npm/test/tap/version-update-shrinkwrap.js b/deps/npm/test/tap/version-update-shrinkwrap.js index c51ab2cb0d..d9f54d6872 100644 --- a/deps/npm/test/tap/version-update-shrinkwrap.js +++ b/deps/npm/test/tap/version-update-shrinkwrap.js @@ -110,15 +110,12 @@ test('npm version updates shrinkwrap and updates git', function (t) { }) test('cleanup', function (t) { - // windows fix for locked files - process.chdir(osenv.tmpdir()) - - rimraf.sync(pkg) + cleanup() t.end() }) function setup () { - rimraf.sync(pkg) + cleanup() mkdirp.sync(pkg) mkdirp.sync(cache) var contents = { @@ -132,3 +129,10 @@ function setup () { fs.writeFileSync(path.resolve(pkg, 'npm-shrinkwrap.json'), JSON.stringify(contents), 'utf8') process.chdir(pkg) } + +function cleanup () { + // windows fix for locked files + process.chdir(osenv.tmpdir()) + rimraf.sync(cache) + rimraf.sync(pkg) +} -- cgit v1.2.3